--- a/accessible/html/HTMLFormControlAccessible.cpp
+++ b/accessible/html/HTMLFormControlAccessible.cpp
@@ -10,17 +10,17 @@
#include "nsEventShell.h"
#include "nsTextEquivUtils.h"
#include "Relation.h"
#include "Role.h"
#include "States.h"
#include "nsContentList.h"
#include "mozilla/dom/HTMLInputElement.h"
-#include "nsIDOMHTMLTextAreaElement.h"
+#include "mozilla/dom/HTMLTextAreaElement.h"
#include "nsIEditor.h"
#include "nsIFormControl.h"
#include "nsIPersistentProperties2.h"
#include "nsISelectionController.h"
#include "nsIServiceManager.h"
#include "nsITextControlElement.h"
#include "nsITextControlFrame.h"
#include "nsNameSpaceManager.h"
@@ -340,17 +340,17 @@ HTMLTextFieldAccessible::NativeName(nsSt
void
HTMLTextFieldAccessible::Value(nsString& aValue)
{
aValue.Truncate();
if (NativeState() & states::PROTECTED) // Don't return password text!
return;
- nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mContent));
+ HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(mContent);
if (textArea) {
textArea->GetValue(aValue);
return;
}
HTMLInputElement* input = HTMLInputElement::FromContent(mContent);
if (input) {
// Pass NonSystem as the caller type, to be safe. We don't expect to have a
--- a/browser/components/sessionstore/test/browser_248970_b_perwindowpb.js
+++ b/browser/components/sessionstore/test/browser_248970_b_perwindowpb.js
@@ -60,17 +60,17 @@ function test() {
function compareFormValue(aTab, aQuery, aValue) {
let node = getElementByXPath(aTab, aQuery);
if (!node)
return false;
if (node instanceof Ci.nsIDOMHTMLInputElement)
return aValue == (node.type == "checkbox" || node.type == "radio" ?
node.checked : node.value);
- if (node instanceof Ci.nsIDOMHTMLTextAreaElement)
+ if (ChromeUtils.getClassName(node) === "HTMLTextAreaElement")
return aValue == node.value;
if (!node.multiple)
return aValue == node.selectedIndex;
return Array.every(node.options, (aOpt, aIx) =>
(aValue.indexOf(aIx) > -1) == aOpt.selected);
}
/**
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -35,17 +35,16 @@
#include "Link.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/SVGTitleElement.h"
#include "nsIDOMEvent.h"
#include "nsIDOMFileList.h"
#include "nsIDOMMouseEvent.h"
#include "nsIFormControl.h"
#include "nsIDOMHTMLInputElement.h"
-#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMHTMLHtmlElement.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIImageLoadingContent.h"
#include "nsIWebNavigation.h"
#include "nsIDOMHTMLElement.h"
#include "nsIPresShell.h"
#include "nsIStringBundle.h"
#include "nsPIDOMWindow.h"
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -167,16 +167,17 @@
#include "nsFrameLoader.h"
#include "nsEscape.h"
#include "nsObjectLoadingContent.h"
#include "nsHtml5TreeOpExecutor.h"
#include "mozilla/dom/HTMLLinkElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/HTMLIFrameElement.h"
#include "mozilla/dom/HTMLImageElement.h"
+#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/MediaSource.h"
#include "mozilla/dom/FlyWebService.h"
#include "mozAutoDocUpdate.h"
#include "nsGlobalWindow.h"
#include "mozilla/Encoding.h"
#include "nsDOMNavigationTiming.h"
@@ -225,17 +226,16 @@
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/WebComponentsBinding.h"
#include "mozilla/dom/CustomElementRegistryBinding.h"
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/dom/TimeoutManager.h"
#include "mozilla/ExtensionPolicyService.h"
#include "nsFrame.h"
#include "nsDOMCaretPosition.h"
-#include "nsIDOMHTMLTextAreaElement.h"
#include "nsViewportInfo.h"
#include "mozilla/StaticPtr.h"
#include "nsITextControlElement.h"
#include "nsIDOMNSEditableElement.h"
#include "nsIEditor.h"
#include "nsIDOMCSSStyleRule.h"
#include "mozilla/css/StyleRule.h"
#include "nsIHttpChannelInternal.h"
@@ -10946,17 +10946,17 @@ nsIDocument::CaretPositionFromPoint(floa
nsCOMPtr<nsIContent> node = offsets.content;
uint32_t offset = offsets.offset;
nsCOMPtr<nsIContent> anonNode = node;
bool nodeIsAnonymous = node && node->IsInNativeAnonymousSubtree();
if (nodeIsAnonymous) {
node = ptFrame->GetContent();
nsIContent* nonanon = node->FindFirstNonChromeOnlyAccessContent();
- nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea = do_QueryInterface(nonanon);
+ HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(nonanon);
nsITextControlFrame* textFrame = do_QueryFrame(nonanon->GetPrimaryFrame());
nsNumberControlFrame* numberFrame = do_QueryFrame(nonanon->GetPrimaryFrame());
if (textFrame || numberFrame) {
// If the anonymous content node has a child, then we need to make sure
// that we get the appropriate child, as otherwise the offset may not be
// correct when we construct a range for it.
nsCOMPtr<nsIContent> firstChild = anonNode->GetFirstChild();
if (firstChild) {
--- a/dom/base/nsWindowRoot.cpp
+++ b/dom/base/nsWindowRoot.cpp
@@ -14,22 +14,22 @@
#include "nsPresContext.h"
#include "nsLayoutCID.h"
#include "nsContentCID.h"
#include "nsString.h"
#include "nsGlobalWindow.h"
#include "nsFocusManager.h"
#include "nsIContent.h"
#include "nsIDOMHTMLInputElement.h"
-#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIControllers.h"
#include "nsIController.h"
#include "xpcpublic.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/TabParent.h"
+#include "mozilla/dom/HTMLTextAreaElement.h"
#ifdef MOZ_XUL
#include "nsXULElement.h"
#endif
using namespace mozilla;
using namespace mozilla::dom;
@@ -229,18 +229,18 @@ nsWindowRoot::GetControllers(bool aForVi
if (xulElement) {
ErrorResult rv;
*aResult = xulElement->GetControllers(rv);
NS_IF_ADDREF(*aResult);
return rv.StealNSResult();
}
#endif
- nsCOMPtr<nsIDOMHTMLTextAreaElement> htmlTextArea =
- do_QueryInterface(focusedContent);
+ HTMLTextAreaElement* htmlTextArea =
+ HTMLTextAreaElement::FromContent(focusedContent);
if (htmlTextArea)
return htmlTextArea->GetControllers(aResult);
nsCOMPtr<nsIDOMHTMLInputElement> htmlInputElement =
do_QueryInterface(focusedContent);
if (htmlInputElement)
return htmlInputElement->GetControllers(aResult);
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -81,17 +81,16 @@ HTMLTextAreaElement::HTMLTextAreaElement
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLTextAreaElement,
nsGenericHTMLFormElementWithState,
mValidity,
mControllers,
mState)
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLTextAreaElement,
nsGenericHTMLFormElementWithState,
- nsIDOMHTMLTextAreaElement,
nsITextControlElement,
nsIDOMNSEditableElement,
nsIMutationObserver,
nsIConstraintValidation)
// nsIDOMHTMLTextAreaElement
nsresult
@@ -116,44 +115,37 @@ HTMLTextAreaElement::Clone(mozilla::dom:
NS_ENSURE_SUCCESS(rv, rv);
}
it->mLastValueChangeWasInteractive = mLastValueChangeWasInteractive;
it.forget(aResult);
return NS_OK;
}
-NS_IMETHODIMP
-HTMLTextAreaElement::GetForm(nsIDOMHTMLFormElement** aForm)
-{
- return nsGenericHTMLFormElementWithState::GetForm(aForm);
-}
-
-
// nsIContent
-NS_IMETHODIMP
+void
HTMLTextAreaElement::Select()
{
// XXX Bug? We have to give the input focus before contents can be
// selected
FocusTristate state = FocusState();
if (state == eUnfocusable) {
- return NS_OK;
+ return;
}
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
RefPtr<nsPresContext> presContext = GetPresContext(eForComposedDoc);
if (state == eInactiveWindow) {
if (fm)
fm->SetFocus(this, nsIFocusManager::FLAG_NOSCROLL);
SelectAll(presContext);
- return NS_OK;
+ return;
}
nsEventStatus status = nsEventStatus_eIgnore;
WidgetGUIEvent event(true, eFormSelect, nullptr);
// XXXbz HTMLInputElement guards against this reentering; shouldn't we?
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
&event, nullptr, &status);
@@ -167,18 +159,16 @@ HTMLTextAreaElement::Select()
nsCOMPtr<nsIDOMElement> focusedElement;
fm->GetFocusedElement(getter_AddRefs(focusedElement));
if (SameCOMIdentity(static_cast<nsIDOMNode*>(this), focusedElement)) {
// Now Select all the text!
SelectAll(presContext);
}
}
}
-
- return NS_OK;
}
NS_IMETHODIMP
HTMLTextAreaElement::SelectAll(nsPresContext* aPresContext)
{
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
if (formControlFrame) {
@@ -198,53 +188,38 @@ HTMLTextAreaElement::IsHTMLFocusable(boo
return true;
}
// disabled textareas are not focusable
*aIsFocusable = !IsDisabled();
return false;
}
-NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Autofocus, autofocus)
-NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(HTMLTextAreaElement, Cols, cols, DEFAULT_COLS)
-NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Disabled, disabled)
-NS_IMPL_NON_NEGATIVE_INT_ATTR(HTMLTextAreaElement, MaxLength, maxlength)
-NS_IMPL_NON_NEGATIVE_INT_ATTR(HTMLTextAreaElement, MinLength, minlength)
-NS_IMPL_STRING_ATTR(HTMLTextAreaElement, Name, name)
-NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, ReadOnly, readonly)
-NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Required, required)
-NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(HTMLTextAreaElement, Rows, rows, DEFAULT_ROWS_TEXTAREA)
-NS_IMPL_STRING_ATTR(HTMLTextAreaElement, Wrap, wrap)
-NS_IMPL_STRING_ATTR(HTMLTextAreaElement, Placeholder, placeholder)
-
int32_t
HTMLTextAreaElement::TabIndexDefault()
{
return 0;
}
-NS_IMETHODIMP
+void
HTMLTextAreaElement::GetType(nsAString& aType)
{
aType.AssignLiteral("textarea");
-
- return NS_OK;
}
-NS_IMETHODIMP
+void
HTMLTextAreaElement::GetValue(nsAString& aValue)
{
nsAutoString value;
GetValueInternal(value, true);
// Normalize CRLF and CR to LF
nsContentUtils::PlatformToDOMLineBreaks(value);
aValue = value;
- return NS_OK;
}
void
HTMLTextAreaElement::GetValueInternal(nsAString& aValue, bool aIgnoreWrap) const
{
mState.GetValue(aValue, aIgnoreWrap);
}
@@ -366,41 +341,42 @@ HTMLTextAreaElement::SetValueInternal(co
if (!mState.SetValue(aValue, aFlags)) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
-NS_IMETHODIMP
-HTMLTextAreaElement::SetValue(const nsAString& aValue)
+void
+HTMLTextAreaElement::SetValue(const nsAString& aValue, ErrorResult& aError)
{
// If the value has been set by a script, we basically want to keep the
// current change event state. If the element is ready to fire a change
// event, we should keep it that way. Otherwise, we should make sure the
// element will not fire any event because of the script interaction.
//
// NOTE: this is currently quite expensive work (too much string
// manipulation). We should probably optimize that.
nsAutoString currentValue;
GetValueInternal(currentValue, true);
nsresult rv =
SetValueInternal(aValue,
nsTextEditorState::eSetValue_ByContent |
nsTextEditorState::eSetValue_Notify |
nsTextEditorState::eSetValue_MoveCursorToEndIfValueChanged);
- NS_ENSURE_SUCCESS(rv, rv);
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ aError.Throw(rv);
+ return;
+ }
if (mFocusedValue.Equals(currentValue)) {
GetValueInternal(mFocusedValue, true);
}
-
- return NS_OK;
}
NS_IMETHODIMP
HTMLTextAreaElement::SetUserInput(const nsAString& aValue)
{
return SetValueInternal(aValue,
nsTextEditorState::eSetValue_BySetUserInput |
nsTextEditorState::eSetValue_Notify|
@@ -419,31 +395,22 @@ HTMLTextAreaElement::SetValueChanged(boo
if (mValueChanged != previousValue) {
UpdateState(true);
}
return NS_OK;
}
-NS_IMETHODIMP
-HTMLTextAreaElement::GetDefaultValue(nsAString& aDefaultValue)
+void
+HTMLTextAreaElement::GetDefaultValue(nsAString& aDefaultValue, ErrorResult& aError)
{
if (!nsContentUtils::GetNodeTextContent(this, false, aDefaultValue, fallible)) {
- return NS_ERROR_OUT_OF_MEMORY;
+ aError.Throw(NS_ERROR_OUT_OF_MEMORY);
}
- return NS_OK;
-}
-
-NS_IMETHODIMP
-HTMLTextAreaElement::SetDefaultValue(const nsAString& aDefaultValue)
-{
- ErrorResult error;
- SetDefaultValue(aDefaultValue, error);
- return error.StealNSResult();
}
void
HTMLTextAreaElement::SetDefaultValue(const nsAString& aDefaultValue, ErrorResult& aError)
{
nsresult rv = nsContentUtils::SetNodeTextContent(this, aDefaultValue, true);
if (NS_SUCCEEDED(rv) && !mValueChanged) {
Reset();
@@ -697,17 +664,17 @@ HTMLTextAreaElement::GetControllers(Erro
}
mControllers->AppendController(controller);
}
return mControllers;
}
-NS_IMETHODIMP
+nsresult
HTMLTextAreaElement::GetControllers(nsIControllers** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
ErrorResult error;
*aResult = GetControllers(error);
NS_IF_ADDREF(*aResult);
@@ -717,25 +684,16 @@ HTMLTextAreaElement::GetControllers(nsIC
uint32_t
HTMLTextAreaElement::GetTextLength()
{
nsAutoString val;
GetValue(val);
return val.Length();
}
-NS_IMETHODIMP
-HTMLTextAreaElement::GetTextLength(int32_t *aTextLength)
-{
- NS_ENSURE_ARG_POINTER(aTextLength);
- *aTextLength = GetTextLength();
-
- return NS_OK;
-}
-
Nullable<uint32_t>
HTMLTextAreaElement::GetSelectionStart(ErrorResult& aError)
{
uint32_t selStart, selEnd;
GetSelectionRange(&selStart, &selEnd, aError);
return Nullable<uint32_t>(selStart);
}
@@ -821,17 +779,18 @@ HTMLTextAreaElement::SetValueFromSetRang
nsTextEditorState::eSetValue_ByContent |
nsTextEditorState::eSetValue_Notify);
}
nsresult
HTMLTextAreaElement::Reset()
{
nsAutoString resetVal;
- GetDefaultValue(resetVal);
+ IgnoredErrorResult res;
+ GetDefaultValue(resetVal, res);
SetValueChanged(false);
nsresult rv = SetValueInternal(resetVal,
nsTextEditorState::eSetValue_Internal);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
@@ -916,22 +875,24 @@ bool
HTMLTextAreaElement::RestoreState(nsPresState* aState)
{
nsCOMPtr<nsISupportsString> state
(do_QueryInterface(aState->GetStateProperty()));
if (state) {
nsAutoString data;
state->GetData(data);
- nsresult rv = SetValue(data);
- NS_ENSURE_SUCCESS(rv, false);
+ ErrorResult rv;
+ SetValue(data, rv);
+ ENSURE_SUCCESS(rv, false);
}
if (aState->IsDisabledSet() && !aState->GetDisabled()) {
- SetDisabled(false);
+ IgnoredErrorResult rv;
+ SetDisabled(false, rv);
}
return false;
}
EventStates
HTMLTextAreaElement::IntrinsicState() const
{
@@ -1115,17 +1076,19 @@ HTMLTextAreaElement::CopyInnerTo(Element
{
nsresult rv = nsGenericHTMLFormElementWithState::CopyInnerTo(aDest,
aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->OwnerDoc()->IsStaticDocument()) {
nsAutoString value;
GetValueInternal(value, true);
- return static_cast<HTMLTextAreaElement*>(aDest)->SetValue(value);
+ ErrorResult ret;
+ static_cast<HTMLTextAreaElement*>(aDest)->SetValue(value, ret);
+ return ret.StealNSResult();
}
return NS_OK;
}
bool
HTMLTextAreaElement::IsMutable() const
{
return (!HasAttr(kNameSpaceID_None, nsGkAtoms::readonly) && !IsDisabled());
@@ -1152,49 +1115,45 @@ bool
HTMLTextAreaElement::IsTooLong()
{
if (!mValueChanged ||
!mLastValueChangeWasInteractive ||
!HasAttr(kNameSpaceID_None, nsGkAtoms::maxlength)) {
return false;
}
- int32_t maxLength = -1;
- GetMaxLength(&maxLength);
+ int32_t maxLength = MaxLength();
// Maxlength of -1 means parsing error.
if (maxLength == -1) {
return false;
}
- int32_t textLength = -1;
- GetTextLength(&textLength);
+ int32_t textLength = GetTextLength();
return textLength > maxLength;
}
bool
HTMLTextAreaElement::IsTooShort()
{
if (!mValueChanged ||
!mLastValueChangeWasInteractive ||
!HasAttr(kNameSpaceID_None, nsGkAtoms::minlength)) {
return false;
}
- int32_t minLength = -1;
- GetMinLength(&minLength);
+ int32_t minLength = MinLength();
// Minlength of -1 means parsing error.
if (minLength == -1) {
return false;
}
- int32_t textLength = -1;
- GetTextLength(&textLength);
+ int32_t textLength = GetTextLength();
return textLength && textLength < minLength;
}
bool
HTMLTextAreaElement::IsValueMissing() const
{
if (!Required() || !IsMutable()) {
@@ -1236,45 +1195,39 @@ HTMLTextAreaElement::GetValidationMessag
{
nsresult rv = NS_OK;
switch (aType)
{
case VALIDITY_STATE_TOO_LONG:
{
nsAutoString message;
- int32_t maxLength = -1;
- int32_t textLength = -1;
+ int32_t maxLength = MaxLength();
+ int32_t textLength = GetTextLength();
nsAutoString strMaxLength;
nsAutoString strTextLength;
- GetMaxLength(&maxLength);
- GetTextLength(&textLength);
-
strMaxLength.AppendInt(maxLength);
strTextLength.AppendInt(textLength);
const char16_t* params[] = { strMaxLength.get(), strTextLength.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationTextTooLong",
params, message);
aValidationMessage = message;
}
break;
case VALIDITY_STATE_TOO_SHORT:
{
nsAutoString message;
- int32_t minLength = -1;
- int32_t textLength = -1;
+ int32_t minLength = MinLength();
+ int32_t textLength = GetTextLength();
nsAutoString strMinLength;
nsAutoString strTextLength;
- GetMinLength(&minLength);
- GetTextLength(&textLength);
-
strMinLength.AppendInt(minLength);
strTextLength.AppendInt(textLength);
const char16_t* params[] = { strMinLength.get(), strTextLength.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationTextTooShort",
params, message);
aValidationMessage = message;
@@ -1346,17 +1299,18 @@ HTMLTextAreaElement::GetRows()
}
return DEFAULT_ROWS_TEXTAREA;
}
NS_IMETHODIMP_(void)
HTMLTextAreaElement::GetDefaultValueFromContent(nsAString& aValue)
{
- GetDefaultValue(aValue);
+ IgnoredErrorResult rv;
+ GetDefaultValue(aValue, rv);
}
NS_IMETHODIMP_(bool)
HTMLTextAreaElement::ValueChanged() const
{
return mValueChanged;
}
--- a/dom/html/HTMLTextAreaElement.h
+++ b/dom/html/HTMLTextAreaElement.h
@@ -3,17 +3,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_HTMLTextAreaElement_h
#define mozilla_dom_HTMLTextAreaElement_h
#include "mozilla/Attributes.h"
-#include "nsIDOMHTMLTextAreaElement.h"
#include "nsITextControlElement.h"
#include "nsIControllers.h"
#include "nsIDOMNSEditableElement.h"
#include "nsCOMPtr.h"
#include "nsGenericHTMLElement.h"
#include "nsStubMutationObserver.h"
#include "nsIConstraintValidation.h"
#include "mozilla/dom/HTMLFormElement.h"
@@ -34,42 +33,40 @@ class EventChainPostVisitor;
class EventChainPreVisitor;
class EventStates;
namespace dom {
class HTMLFormSubmission;
class HTMLTextAreaElement final : public nsGenericHTMLFormElementWithState,
- public nsIDOMHTMLTextAreaElement,
public nsITextControlElement,
public nsIDOMNSEditableElement,
public nsStubMutationObserver,
public nsIConstraintValidation
{
public:
using nsIConstraintValidation::GetValidationMessage;
explicit HTMLTextAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
FromParser aFromParser = NOT_FROM_PARSER);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
+ NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLTextAreaElement, textarea)
+
virtual int32_t TabIndexDefault() override;
// Element
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override
{
return true;
}
- // nsIDOMHTMLTextAreaElement
- NS_DECL_NSIDOMHTMLTEXTAREAELEMENT
-
// nsIDOMNSEditableElement
NS_IMETHOD GetEditor(nsIEditor** aEditor) override
{
nsCOMPtr<nsIEditor> editor = GetEditor();
editor.forget(aEditor);
return NS_OK;
}
NS_IMETHOD SetUserInput(const nsAString& aInput) override;
@@ -232,22 +229,28 @@ public:
{
int32_t maxLength = MaxLength();
if (aMinLength < 0 || (maxLength >= 0 && aMinLength > maxLength)) {
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
} else {
SetHTMLIntAttr(nsGkAtoms::minlength, aMinLength, aError);
}
}
- // XPCOM GetName is fine
+ void GetName(nsAString& aName)
+ {
+ GetHTMLAttr(nsGkAtoms::name, aName);
+ }
void SetName(const nsAString& aName, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::name, aName, aError);
}
- // XPCOM GetPlaceholder is fine
+ void GetPlaceholder(nsAString& aPlaceholder)
+ {
+ GetHTMLAttr(nsGkAtoms::placeholder, aPlaceholder);
+ }
void SetPlaceholder(const nsAString& aPlaceholder, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::placeholder, aPlaceholder, aError);
}
bool ReadOnly()
{
return GetBoolAttr(nsGkAtoms::readonly);
}
@@ -274,40 +277,48 @@ public:
{
return GetIntAttr(nsGkAtoms::rows, DEFAULT_ROWS_TEXTAREA);
}
void SetRows(uint32_t aRows, ErrorResult& aError)
{
uint32_t rows = aRows ? aRows : DEFAULT_ROWS_TEXTAREA;
SetUnsignedIntAttr(nsGkAtoms::rows, rows, DEFAULT_ROWS_TEXTAREA, aError);
}
- // XPCOM GetWrap is fine
+ void GetWrap(nsAString& aWrap)
+ {
+ GetHTMLAttr(nsGkAtoms::wrap, aWrap);
+ }
void SetWrap(const nsAString& aWrap, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::wrap, aWrap, aError);
}
- // XPCOM GetType is fine
- // XPCOM GetDefaultValue is fine
+ void GetType(nsAString& aType);
+ void GetDefaultValue(nsAString& aDefaultValue, ErrorResult& aError);
void SetDefaultValue(const nsAString& aDefaultValue, ErrorResult& aError);
- // XPCOM GetValue/SetValue are fine
+ void GetValue(nsAString& aValue);
+ void SetValue(const nsAString& aValue, ErrorResult& aError);
+
uint32_t GetTextLength();
// Override SetCustomValidity so we update our state properly when it's called
// via bindings.
void SetCustomValidity(const nsAString& aError);
- // XPCOM Select is fine
+ void Select();
Nullable<uint32_t> GetSelectionStart(ErrorResult& aError);
void SetSelectionStart(const Nullable<uint32_t>& aSelectionStart, ErrorResult& aError);
Nullable<uint32_t> GetSelectionEnd(ErrorResult& aError);
void SetSelectionEnd(const Nullable<uint32_t>& aSelectionEnd, ErrorResult& aError);
void GetSelectionDirection(nsAString& aDirection, ErrorResult& aError);
void SetSelectionDirection(const nsAString& aDirection, ErrorResult& aError);
void SetSelectionRange(uint32_t aSelectionStart, uint32_t aSelectionEnd, const Optional<nsAString>& aDirecton, ErrorResult& aError);
nsIControllers* GetControllers(ErrorResult& aError);
+ // XPCOM adapter function widely used throughout code, leaving it as is.
+ nsresult GetControllers(nsIControllers** aResult);
+
nsIEditor* GetEditor()
{
return mState.GetTextEditor();
}
protected:
virtual ~HTMLTextAreaElement() {}
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -14,17 +14,16 @@
#include "nsLayoutCID.h"
#include "nsITextControlFrame.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMDocument.h"
#include "nsContentCreatorFunctions.h"
#include "nsTextControlFrame.h"
#include "nsIControllers.h"
#include "nsIDOMHTMLInputElement.h"
-#include "nsIDOMHTMLTextAreaElement.h"
#include "nsITransactionManager.h"
#include "nsIControllerContext.h"
#include "nsAttrValue.h"
#include "nsAttrValueInlines.h"
#include "nsGenericHTMLElement.h"
#include "nsIDOMEventListener.h"
#include "nsIEditorObserver.h"
#include "nsIWidget.h"
@@ -38,16 +37,17 @@
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
#include "nsTextNode.h"
#include "nsIController.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/HTMLInputElement.h"
+#include "mozilla/dom/HTMLTextAreaElement.h"
#include "nsNumberControlFrame.h"
#include "nsFrameSelection.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Telemetry.h"
#include "mozilla/layers/ScrollInputMethods.h"
using namespace mozilla;
using namespace mozilla::dom;
@@ -963,18 +963,18 @@ DoCommandCallback(Command aCommand, void
nsTextControlFrame *frame = static_cast<nsTextControlFrame*>(aData);
nsIContent *content = frame->GetContent();
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(content);
if (input) {
input->GetControllers(getter_AddRefs(controllers));
} else {
- nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea =
- do_QueryInterface(content);
+ HTMLTextAreaElement* textArea =
+ HTMLTextAreaElement::FromContent(content);
if (textArea) {
textArea->GetControllers(getter_AddRefs(controllers));
}
}
if (!controllers) {
NS_WARNING("Could not get controllers");
@@ -1507,18 +1507,19 @@ nsTextEditorState::PrepareEditor(const n
if (!SuppressEventHandlers(presContext)) {
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsIDOMHTMLInputElement> inputElement =
do_QueryInterface(mTextCtrlElement);
if (inputElement) {
rv = inputElement->GetControllers(getter_AddRefs(controllers));
} else {
- nsCOMPtr<nsIDOMHTMLTextAreaElement> textAreaElement =
- do_QueryInterface(mTextCtrlElement);
+ nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
+ HTMLTextAreaElement* textAreaElement =
+ HTMLTextAreaElement::FromContentOrNull(content);
if (!textAreaElement)
return NS_ERROR_FAILURE;
rv = textAreaElement->GetControllers(getter_AddRefs(controllers));
}
NS_ENSURE_SUCCESS(rv, rv);
@@ -2171,18 +2172,19 @@ nsTextEditorState::UnbindFromFrame(nsTex
{
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsIDOMHTMLInputElement> inputElement =
do_QueryInterface(mTextCtrlElement);
if (inputElement)
inputElement->GetControllers(getter_AddRefs(controllers));
else
{
- nsCOMPtr<nsIDOMHTMLTextAreaElement> textAreaElement =
- do_QueryInterface(mTextCtrlElement);
+ nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
+ HTMLTextAreaElement* textAreaElement =
+ HTMLTextAreaElement::FromContentOrNull(content);
if (textAreaElement) {
textAreaElement->GetControllers(getter_AddRefs(controllers));
}
}
if (controllers)
{
uint32_t numControllers;
--- a/dom/interfaces/html/moz.build
+++ b/dom/interfaces/html/moz.build
@@ -16,17 +16,16 @@ XPIDL_SOURCES += [
'nsIDOMHTMLHtmlElement.idl',
'nsIDOMHTMLInputElement.idl',
'nsIDOMHTMLMediaElement.idl',
'nsIDOMHTMLOptionElement.idl',
'nsIDOMHTMLOptionsCollection.idl',
'nsIDOMHTMLScriptElement.idl',
'nsIDOMHTMLSelectElement.idl',
'nsIDOMHTMLSourceElement.idl',
- 'nsIDOMHTMLTextAreaElement.idl',
'nsIDOMMozBrowserFrame.idl',
'nsIDOMTimeRanges.idl',
'nsIDOMValidityState.idl',
'nsIMozBrowserFrame.idl',
]
XPIDL_MODULE = 'dom_html'
deleted file mode 100644
--- a/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsIDOMHTMLElement.idl"
-
-interface nsIControllers;
-interface nsIDOMValidityState;
-
-/**
- * The nsIDOMHTMLTextAreaElement interface is the interface to a
- * [X]HTML textarea element.
- *
- * This interface is trying to follow the DOM Level 2 HTML specification:
- * http://www.w3.org/TR/DOM-Level-2-HTML/
- *
- * with changes from the work-in-progress WHATWG HTML specification:
- * http://www.whatwg.org/specs/web-apps/current-work/
- */
-
-[uuid(7a4aeb2e-fcf3-443e-b002-ca1c8ea322e9)]
-interface nsIDOMHTMLTextAreaElement : nsISupports
-{
- attribute boolean autofocus;
- attribute unsigned long cols;
- attribute boolean disabled;
- readonly attribute nsIDOMHTMLFormElement form;
- attribute long maxLength;
- attribute long minLength;
- attribute DOMString name;
- attribute DOMString placeholder;
- attribute boolean readOnly;
- attribute boolean required;
- attribute unsigned long rows;
- /**
- * Reflects the wrap content attribute. Possible values are "soft", "hard" and
- * "off". "soft" is the default.
- */
- [Null(Stringify)]
- attribute DOMString wrap;
-
- readonly attribute DOMString type;
- attribute DOMString defaultValue;
- attribute DOMString value;
- readonly attribute long textLength;
-
- void select();
-
- // Mozilla extensions
- // Please make sure to update the HTMLTextAreaElement Web IDL interface to
- // mirror the list of Mozilla extensions here when changing it.
- readonly attribute nsIControllers controllers;
-};
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -7,16 +7,17 @@
#include "WebBrowserPersistDocumentParent.h"
#include "mozilla/dom/HTMLAnchorElement.h"
#include "mozilla/dom/HTMLAreaElement.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLLinkElement.h"
#include "mozilla/dom/HTMLObjectElement.h"
#include "mozilla/dom/HTMLSharedElement.h"
+#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/TabParent.h"
#include "nsComponentManagerUtils.h"
#include "nsContentUtils.h"
#include "nsContentCID.h"
#include "nsCycleCollectionParticipant.h"
#include "nsFrameLoader.h"
#include "nsIComponentRegistrar.h"
#include "nsIContent.h"
@@ -26,17 +27,16 @@
#include "nsIDOMHTMLBaseElement.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMHTMLSourceElement.h"
-#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMMozNamedAttrMap.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeFilter.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMTreeWalker.h"
#include "nsIDOMWindowUtils.h"
#include "nsIDocShell.h"
@@ -1148,17 +1148,17 @@ PersistNodeFixup::FixupNode(nsIDOMNode *
break;
default:
break;
}
}
return rv;
}
- nsCOMPtr<nsIDOMHTMLTextAreaElement> nodeAsTextArea = do_QueryInterface(aNodeIn);
+ dom::HTMLTextAreaElement* nodeAsTextArea = dom::HTMLTextAreaElement::FromContent(content);
if (nodeAsTextArea) {
rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
// Tell the document encoder to serialize the text child we create below
*aSerializeCloneKids = true;
nsAutoString valueStr;
nodeAsTextArea->GetValue(valueStr);
--- a/dom/webidl/HTMLTextAreaElement.webidl
+++ b/dom/webidl/HTMLTextAreaElement.webidl
@@ -41,19 +41,19 @@ interface HTMLTextAreaElement : HTMLElem
attribute boolean required;
[CEReactions, SetterThrows, Pure]
attribute unsigned long rows;
[CEReactions, SetterThrows, Pure]
attribute DOMString wrap;
[Constant]
readonly attribute DOMString type;
- [CEReactions, SetterThrows, Pure]
+ [CEReactions, Throws, Pure]
attribute DOMString defaultValue;
- [CEReactions, TreatNullAs=EmptyString] attribute DOMString value;
+ [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString value;
readonly attribute unsigned long textLength;
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
[Throws]
readonly attribute DOMString validationMessage;
boolean checkValidity();
boolean reportValidity();
@@ -73,18 +73,17 @@ interface HTMLTextAreaElement : HTMLElem
[Throws]
void setRangeText(DOMString replacement, unsigned long start,
unsigned long end, optional SelectionMode selectionMode = "preserve");
[Throws]
void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
};
partial interface HTMLTextAreaElement {
- // Mirrored chrome-only Mozilla extensions to nsIDOMHTMLTextAreaElement.
- // Please make sure to update this list of nsIDOMHTMLTextAreaElement changes.
+ // Chrome-only Mozilla extensions
[Throws, ChromeOnly]
readonly attribute XULControllers controllers;
};
partial interface HTMLTextAreaElement {
// Mirrored chrome-only nsIDOMNSEditableElement methods. Please make sure
// to update this list if nsIDOMNSEditableElement changes.
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -18,17 +18,16 @@
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsNameSpaceManager.h"
#include "nsIDocument.h"
#include "nsIController.h"
#include "nsIControllers.h"
#include "nsXULElement.h"
#include "nsIURI.h"
-#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsFocusManager.h"
#include "nsIFormControl.h"
#include "nsIDOMEventListener.h"
#include "nsPIDOMWindow.h"
#include "nsPIWindowRoot.h"
#include "nsIDOMWindow.h"
#include "nsIServiceManager.h"
@@ -45,16 +44,17 @@
#include "nsXBLSerialize.h"
#include "nsJSUtils.h"
#include "mozilla/BasicEvents.h"
#include "mozilla/JSEventHandler.h"
#include "mozilla/Preferences.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/EventHandlerBinding.h"
+#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/layers/KeyboardMap.h"
#include "xpcpublic.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
@@ -676,17 +676,17 @@ nsXBLPrototypeHandler::GetController(Eve
RefPtr<nsXULElement> xulElement =
nsXULElement::FromContentOrNull(targetContent);
if (xulElement) {
IgnoredErrorResult rv;
controllers = xulElement->GetControllers(rv);
}
if (!controllers) {
- nsCOMPtr<nsIDOMHTMLTextAreaElement> htmlTextArea(do_QueryInterface(aTarget));
+ HTMLTextAreaElement* htmlTextArea = HTMLTextAreaElement::FromContent(targetContent);
if (htmlTextArea)
htmlTextArea->GetControllers(getter_AddRefs(controllers));
}
if (!controllers) {
nsCOMPtr<nsIDOMHTMLInputElement> htmlInputElement(do_QueryInterface(aTarget));
if (htmlInputElement)
htmlInputElement->GetControllers(getter_AddRefs(controllers));
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -11,17 +11,16 @@
#include "nsFontMetrics.h"
#include "nsTextControlFrame.h"
#include "nsIPlaintextEditor.h"
#include "nsCaret.h"
#include "nsCSSPseudoElements.h"
#include "nsGenericHTMLElement.h"
#include "nsIEditor.h"
#include "nsTextFragment.h"
-#include "nsIDOMHTMLTextAreaElement.h"
#include "nsNameSpaceManager.h"
#include "nsCheckboxRadioFrame.h" //for registering accesskeys
#include "nsIContent.h"
#include "nsPresContext.h"
#include "nsGkAtoms.h"
#include "nsLayoutUtils.h"
#include "nsIDOMElement.h"
@@ -1157,32 +1156,30 @@ nsTextControlFrame::AttributeChanged(int
}
// Allow the base class to handle common attributes supported by all form
// elements...
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
}
-nsresult
+void
nsTextControlFrame::GetText(nsString& aText)
{
- nsresult rv = NS_OK;
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
NS_ASSERTION(txtCtrl, "Content not a text control element");
if (IsSingleLineTextControl()) {
// There will be no line breaks so we can ignore the wrap property.
txtCtrl->GetTextEditorValue(aText, true);
} else {
- nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea = do_QueryInterface(mContent);
+ HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromContent(mContent);
if (textArea) {
- rv = textArea->GetValue(aText);
+ textArea->GetValue(aText);
}
}
- return rv;
}
///END NSIFRAME OVERLOADS
/////BEGIN PROTECTED METHODS
bool
nsTextControlFrame::GetMaxLength(int32_t* aSize)
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -164,17 +164,17 @@ public:
//==== OVERLOAD of nsIFrame
/** handler for attribute changes to mContent */
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) override;
- nsresult GetText(nsString& aText);
+ void GetText(nsString& aText);
virtual nsresult PeekOffset(nsPeekOffsetStruct *aPos) override;
NS_DECL_QUERYFRAME
protected:
/**
* Launch the reflow on the child frames - see nsTextControlFrame::Reflow()
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -21,30 +21,30 @@
#include "nsNameSpaceManager.h"
#include "nsIDocumentInlines.h"
#include "nsFontMetrics.h"
#include "nsBoxLayoutState.h"
#include "mozilla/dom/NodeInfo.h"
#include "nsScrollbarFrame.h"
#include "nsIScrollbarMediator.h"
#include "nsITextControlFrame.h"
-#include "nsIDOMHTMLTextAreaElement.h"
#include "nsNodeInfoManager.h"
#include "nsContentCreatorFunctions.h"
#include "nsPresState.h"
#include "nsIHTMLDocument.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsBidiPresUtils.h"
#include "nsBidiUtils.h"
#include "mozilla/ContentEvents.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/dom/Element.h"
+#include "mozilla/dom/HTMLTextAreaElement.h"
#include <stdint.h>
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Telemetry.h"
#include "FrameLayerBuilder.h"
#include "nsSMILKeySpline.h"
#include "nsSubDocumentFrame.h"
#include "nsSVGOuterSVGFrame.h"
#include "nsIObjectLoadingContent.h"
@@ -4497,17 +4497,18 @@ ScrollFrameHelper::CreateAnonymousConten
canHaveHorizontal = true;
canHaveVertical = true;
}
// The anonymous <div> used by <inputs> never gets scrollbars.
nsITextControlFrame* textFrame = do_QueryFrame(parent);
if (textFrame) {
// Make sure we are not a text area.
- nsCOMPtr<nsIDOMHTMLTextAreaElement> textAreaElement(do_QueryInterface(parent->GetContent()));
+ HTMLTextAreaElement* textAreaElement =
+ HTMLTextAreaElement::FromContent(parent->GetContent());
if (!textAreaElement) {
mNeverHasVerticalScrollbar = mNeverHasHorizontalScrollbar = true;
return NS_OK;
}
}
nsNodeInfoManager *nodeInfoManager =
presContext->Document()->NodeInfoManager();
--- a/mobile/android/modules/ActionBarHandler.jsm
+++ b/mobile/android/modules/ActionBarHandler.jsm
@@ -203,17 +203,17 @@ var ActionBarHandler = {
let [element, win] = [Services.focus.focusedElement, Services.focus.focusedWindow];
if (!element) {
// No focused editable.
return [null, win];
}
// Return focused editable text element and its window.
if (((element instanceof Ci.nsIDOMHTMLInputElement) && element.mozIsTextField(false)) ||
- (element instanceof Ci.nsIDOMHTMLTextAreaElement) ||
+ (ChromeUtils.getClassName(element) === "HTMLTextAreaElement") ||
element.isContentEditable) {
return [element, win];
}
// Focused element can't contain text.
return [null, win];
},
@@ -738,17 +738,17 @@ var ActionBarHandler = {
if (!this._selectionID) {
return "";
}
let selection = this._getSelection();
// Textarea can contain LF, etc.
if (this._targetElement &&
- this._targetElement instanceof Ci.nsIDOMHTMLTextAreaElement) {
+ ChromeUtils.getClassName(this._targetElement) === "HTMLTextAreaElement") {
let flags = Ci.nsIDocumentEncoder.OutputPreformatted |
Ci.nsIDocumentEncoder.OutputRaw;
return selection.QueryInterface(Ci.nsISelectionPrivate).
toStringWithFormat("text/plain", flags, 0);
}
// Return explicitly selected text.
return selection.toString();
--- a/mobile/android/tests/browser/robocop/testAccessibleCarets.js
+++ b/mobile/android/tests/browser/robocop/testAccessibleCarets.js
@@ -41,17 +41,17 @@ function do_promiseTabChangeEvent(tabId,
}
/**
* Selection methods vary if we have an input / textarea element,
* or if we have basic content.
*/
function isInputOrTextarea(element) {
return ((element instanceof Ci.nsIDOMHTMLInputElement) ||
- (element instanceof Ci.nsIDOMHTMLTextAreaElement));
+ (ChromeUtils.getClassName(element) === "HTMLTextAreaElement"));
}
/**
* Return the selection controller based on element.
*/
function elementSelection(element) {
return (isInputOrTextarea(element)) ?
element.editor.selection :
--- a/toolkit/modules/BrowserUtils.jsm
+++ b/toolkit/modules/BrowserUtils.jsm
@@ -495,17 +495,17 @@ this.BrowserUtils = {
let collapsed = selection.isCollapsed;
let url;
let linkText;
// try getting a selected text in text input.
if (!selectionStr && focusedElement instanceof Ci.nsIDOMNSEditableElement) {
// Don't get the selection for password fields. See bug 565717.
- if (focusedElement instanceof Ci.nsIDOMHTMLTextAreaElement ||
+ if (ChromeUtils.getClassName(focusedElement) === "HTMLTextAreaElement" ||
(focusedElement instanceof Ci.nsIDOMHTMLInputElement &&
focusedElement.mozIsTextField(true))) {
selectionStr = focusedElement.editor.selection.toString();
}
}
if (selectionStr) {
// Have some text, let's figure out if it looks like a URL that isn't
--- a/toolkit/modules/sessionstore/FormData.jsm
+++ b/toolkit/modules/sessionstore/FormData.jsm
@@ -202,17 +202,17 @@ var FormDataInternal = {
// We do not want to collect credit card numbers.
if (node instanceof Ci.nsIDOMHTMLInputElement &&
isValidCCNumber(node.value)) {
continue;
}
if (node instanceof Ci.nsIDOMHTMLInputElement ||
- node instanceof Ci.nsIDOMHTMLTextAreaElement ||
+ ChromeUtils.getClassName(node) === "HTMLTextAreaElement" ||
node instanceof Ci.nsIDOMXULTextBoxElement) {
switch (node.type) {
case "checkbox":
case "radio":
value = node.checked;
hasDefaultValue = value == node.defaultChecked;
break;
case "file":
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -53,17 +53,16 @@
#include "nsIDOMHTMLHtmlElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMHTMLOptionsCollection.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIDOMHTMLSourceElement.h"
-#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMediaList.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMMouseScrollEvent.h"
#include "nsIDOMMutationEvent.h"
#include "nsIDOMMozNamedAttrMap.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeIterator.h"
@@ -158,17 +157,16 @@
#include "mozilla/dom/HTMLInputElementBinding.h"
#include "mozilla/dom/HTMLMediaElementBinding.h"
#include "mozilla/dom/HTMLObjectElementBinding.h"
#include "mozilla/dom/HTMLOptionElementBinding.h"
#include "mozilla/dom/HTMLOptionsCollectionBinding.h"
#include "mozilla/dom/HTMLScriptElementBinding.h"
#include "mozilla/dom/HTMLSelectElementBinding.h"
#include "mozilla/dom/HTMLSourceElementBinding.h"
-#include "mozilla/dom/HTMLTextAreaElementBinding.h"
#include "mozilla/dom/KeyEventBinding.h"
#include "mozilla/dom/ListBoxObjectBinding.h"
#include "mozilla/dom/MediaListBinding.h"
#include "mozilla/dom/MessageEventBinding.h"
#include "mozilla/dom/MenuBoxObjectBinding.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/MouseScrollEventBinding.h"
#include "mozilla/dom/MutationEventBinding.h"
@@ -314,17 +312,16 @@ const ComponentsInterfaceShimEntry kComp
DEFINE_SHIM(HTMLHtmlElement),
DEFINE_SHIM(HTMLInputElement),
DEFINE_SHIM(HTMLMediaElement),
DEFINE_SHIM(HTMLOptionElement),
DEFINE_SHIM(HTMLOptionsCollection),
DEFINE_SHIM(HTMLScriptElement),
DEFINE_SHIM(HTMLSelectElement),
DEFINE_SHIM(HTMLSourceElement),
- DEFINE_SHIM(HTMLTextAreaElement),
DEFINE_SHIM(KeyEvent),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),
DEFINE_SHIM(MediaList),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIMenuBoxObject, MenuBoxObject),
DEFINE_SHIM(MouseEvent),
DEFINE_SHIM(MouseScrollEvent),
DEFINE_SHIM(MutationEvent),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMMozNamedAttrMap, NamedNodeMap),