Bug 1351860 - Move mType from HTMLInputElement to nsIFormControl and make GetType non-virtual inlined, r=jessica

--HG--
extra : rebase_source : b7d76ce3321ea0d622da74a72b7278fd0fa63310
This commit is contained in:
Olli Pettay 2017-03-31 22:49:00 -04:00
Родитель 3a0357deec
Коммит d47c995985
37 изменённых файлов: 69 добавлений и 77 удалений

Просмотреть файл

@ -1557,7 +1557,7 @@ ChromeContextMenuListener::HandleEvent(nsIDOMEvent* aMouseEvent)
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(node));
if (formControl) {
if (formControl->GetType() == NS_FORM_TEXTAREA) {
if (formControl->ControlType() == NS_FORM_TEXTAREA) {
flags |= nsIContextMenuListener::CONTEXT_TEXT;
flags2 |= nsIContextMenuListener2::CONTEXT_TEXT;
targetDOMnode = node;

Просмотреть файл

@ -466,7 +466,7 @@ DragDataProducer::Produce(DataTransfer* aDataTransfer,
// Note that while <object> elements implement nsIFormControl, we should
// really allow dragging them if they happen to be images.
nsCOMPtr<nsIFormControl> form(do_QueryInterface(mTarget));
if (form && !mIsAltKeyPressed && form->GetType() != NS_FORM_OBJECT) {
if (form && !mIsAltKeyPressed && form->ControlType() != NS_FORM_OBJECT) {
*aCanDrag = false;
return NS_OK;
}

Просмотреть файл

@ -2763,7 +2763,7 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
if (control && htmlFormControls && htmlForms) {
// Append the control type
KeyAppendInt(control->GetType(), aKey);
KeyAppendInt(control->ControlType(), aKey);
// If in a form, add form name / index of form / index in form
int32_t index = -1;

Просмотреть файл

@ -869,7 +869,7 @@ nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
// check if we are looking at a password input
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(srcNode);
if (formControl) {
if (formControl->GetType() == NS_FORM_INPUT_PASSWORD) {
if (formControl->ControlType() == NS_FORM_INPUT_PASSWORD) {
return false;
}
}

Просмотреть файл

@ -318,7 +318,7 @@ nsFocusManager::GetRedirectedFocus(nsIContent* aContent)
// For input number, redirect focus to our anonymous text control.
if (aContent->IsHTMLElement(nsGkAtoms::input)) {
bool typeIsNumber =
static_cast<dom::HTMLInputElement*>(aContent)->GetType() ==
static_cast<dom::HTMLInputElement*>(aContent)->ControlType() ==
NS_FORM_INPUT_NUMBER;
if (typeIsNumber) {

Просмотреть файл

@ -1534,7 +1534,7 @@ EventStateManager::FireContextClick()
if (formCtrl) {
allowedToDispatch = formCtrl->IsTextOrNumberControl(/*aExcludePassword*/ false) ||
formCtrl->GetType() == NS_FORM_INPUT_FILE;
formCtrl->ControlType() == NS_FORM_INPUT_FILE;
}
else if (mGestureDownContent->IsAnyOfHTMLElements(nsGkAtoms::applet,
nsGkAtoms::embed,

Просмотреть файл

@ -1035,7 +1035,7 @@ IMEStateManager::SetIMEState(const IMEState& aState,
}
}
context.mActionHint.Assign(
willSubmit ? (control->GetType() == NS_FORM_INPUT_SEARCH ?
willSubmit ? (control->ControlType() == NS_FORM_INPUT_SEARCH ?
NS_LITERAL_STRING("search") : NS_LITERAL_STRING("go")) :
(formElement ?
NS_LITERAL_STRING("next") : EmptyString()));

Просмотреть файл

@ -57,8 +57,7 @@ static const nsAttrValue::EnumTable* kButtonDefaultType = &kButtonTypeTable[2];
// Construction, destruction
HTMLButtonElement::HTMLButtonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
FromParser aFromParser)
: nsGenericHTMLFormElementWithState(aNodeInfo),
mType(kButtonDefaultType->value),
: nsGenericHTMLFormElementWithState(aNodeInfo, kButtonDefaultType->value),
mDisabledChanged(false),
mInInternalActivate(false),
mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT))

Просмотреть файл

@ -47,7 +47,6 @@ public:
NS_DECL_NSIDOMHTMLBUTTONELEMENT
// overriden nsIFormControl methods
NS_IMETHOD_(uint32_t) GetType() const override { return mType; }
NS_IMETHOD Reset() override;
NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
NS_IMETHOD SaveState() override;
@ -172,7 +171,6 @@ public:
protected:
virtual ~HTMLButtonElement();
uint8_t mType;
bool mDisabledChanged;
bool mInInternalActivate;
bool mInhibitStateRestoration;

Просмотреть файл

@ -18,7 +18,7 @@ namespace mozilla {
namespace dom {
HTMLFieldSetElement::HTMLFieldSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLFormElement(aNodeInfo)
: nsGenericHTMLFormElement(aNodeInfo, NS_FORM_FIELDSET)
, mElements(nullptr)
, mFirstLegend(nullptr)
, mInvalidElementsCount(0)

Просмотреть файл

@ -50,7 +50,6 @@ public:
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
// nsIFormControl
NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_FIELDSET; }
NS_IMETHOD Reset() override;
NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
virtual bool IsDisabledForEvents(EventMessage aMessage) override;

Просмотреть файл

@ -29,7 +29,7 @@ HTMLFormControlsCollection::ShouldBeInElements(nsIFormControl* aFormControl)
// <input type=image> elements to the list of form controls in a
// form.
switch (aFormControl->GetType()) {
switch (aFormControl->ControlType()) {
case NS_FORM_BUTTON_BUTTON :
case NS_FORM_BUTTON_RESET :
case NS_FORM_BUTTON_SUBMIT :

Просмотреть файл

@ -1251,7 +1251,7 @@ HTMLFormElement::AddElement(nsGenericHTMLFormElement* aChild,
AssertDocumentOrder(controlList, this);
#endif
int32_t type = aChild->GetType();
int32_t type = aChild->ControlType();
//
// If it is a password control, and the password manager has not yet been
@ -1352,7 +1352,7 @@ HTMLFormElement::RemoveElement(nsGenericHTMLFormElement* aChild,
// Remove it from the radio group if it's a radio button
//
nsresult rv = NS_OK;
if (aChild->GetType() == NS_FORM_INPUT_RADIO) {
if (aChild->ControlType() == NS_FORM_INPUT_RADIO) {
RefPtr<HTMLInputElement> radio =
static_cast<HTMLInputElement*>(aChild);
radio->WillRemoveFromRadioGroup();
@ -1818,7 +1818,7 @@ HTMLFormElement::ImplicitSubmissionIsDisabled() const
uint32_t length = mControls->mElements.Length();
for (uint32_t i = 0; i < length && numDisablingControlsFound < 2; ++i) {
if (mControls->mElements[i]->IsSingleLineTextControl(false) ||
mControls->mElements[i]->GetType() == NS_FORM_INPUT_NUMBER) {
mControls->mElements[i]->ControlType() == NS_FORM_INPUT_NUMBER) {
numDisablingControlsFound++;
}
}
@ -2024,7 +2024,7 @@ HTMLFormElement::SubmissionCanProceed(Element* aSubmitter)
nsCOMPtr<nsIFormControl> fc = do_QueryInterface(aSubmitter);
MOZ_ASSERT(fc);
uint32_t type = fc->GetType();
uint32_t type = fc->ControlType();
MOZ_ASSERT(type == NS_FORM_INPUT_SUBMIT ||
type == NS_FORM_INPUT_IMAGE ||
type == NS_FORM_BUTTON_SUBMIT,
@ -2225,7 +2225,7 @@ HTMLFormElement::GetNextRadioButton(const nsAString& aName,
index = 0;
}
radio = HTMLInputElement::FromContentOrNull(radioGroup->Item(index));
isRadio = radio && radio->GetType() == NS_FORM_INPUT_RADIO;
isRadio = radio && radio->ControlType() == NS_FORM_INPUT_RADIO;
if (!isRadio) {
continue;
}
@ -2253,7 +2253,7 @@ HTMLFormElement::WalkRadioGroup(const nsAString& aName,
uint32_t len = GetElementCount();
for (uint32_t i = 0; i < len; i++) {
control = GetElementAt(i);
if (control->GetType() == NS_FORM_INPUT_RADIO) {
if (control->ControlType() == NS_FORM_INPUT_RADIO) {
nsCOMPtr<nsIContent> controlContent = do_QueryInterface(control);
if (controlContent &&
controlContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
@ -2275,7 +2275,7 @@ HTMLFormElement::WalkRadioGroup(const nsAString& aName,
// If it's just a lone radio button, then select it.
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(item);
if (formControl) {
if (formControl->GetType() == NS_FORM_INPUT_RADIO) {
if (formControl->ControlType() == NS_FORM_INPUT_RADIO) {
aVisitor->Visit(formControl);
}
return NS_OK;
@ -2291,7 +2291,7 @@ HTMLFormElement::WalkRadioGroup(const nsAString& aName,
nsCOMPtr<nsIDOMNode> node;
nodeList->Item(i, getter_AddRefs(node));
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(node);
if (formControl && formControl->GetType() == NS_FORM_INPUT_RADIO &&
if (formControl && formControl->ControlType() == NS_FORM_INPUT_RADIO &&
!aVisitor->Visit(formControl)) {
break;
}

Просмотреть файл

@ -1054,8 +1054,7 @@ static nsresult FireEventForAccessibility(nsIDOMHTMLInputElement* aTarget,
HTMLInputElement::HTMLInputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
FromParser aFromParser, FromClone aFromClone)
: nsGenericHTMLFormElementWithState(aNodeInfo)
, mType(kInputDefaultType->value)
: nsGenericHTMLFormElementWithState(aNodeInfo, kInputDefaultType->value)
, mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown)
, mDisabledChanged(false)
, mValueChanged(false)
@ -3514,7 +3513,7 @@ HTMLInputElement::Focus(ErrorResult& aError)
// See if the child is a button control.
nsCOMPtr<nsIFormControl> formCtrl =
do_QueryInterface(childFrame->GetContent());
if (formCtrl && formCtrl->GetType() == NS_FORM_BUTTON_BUTTON) {
if (formCtrl && formCtrl->ControlType() == NS_FORM_BUTTON_BUTTON) {
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(formCtrl);
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm && element) {

Просмотреть файл

@ -164,7 +164,6 @@ public:
NS_IMETHOD SetUserInput(const nsAString& aInput) override;
// Overriden nsIFormControl methods
NS_IMETHOD_(uint32_t) GetType() const override { return mType; }
NS_IMETHOD Reset() override;
NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
NS_IMETHOD SaveState() override;
@ -1609,12 +1608,6 @@ protected:
// Milliseconds in a day.
static const double kMsPerDay;
/**
* The type of this input (<input type=...>) as an integer.
* @see nsIFormControl.h (specifically NS_FORM_INPUT_*)
*/
uint8_t mType;
nsContentUtils::AutocompleteAttrState mAutocompleteAttrState;
bool mDisabledChanged : 1;
bool mValueChanged : 1;

Просмотреть файл

@ -30,7 +30,7 @@ namespace dom {
HTMLObjectElement::HTMLObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
: nsGenericHTMLFormElement(aNodeInfo, NS_FORM_OBJECT),
mIsDoneAddingChildren(!aFromParser)
{
RegisterActivityObserver();

Просмотреть файл

@ -69,11 +69,6 @@ public:
virtual IMEState GetDesiredIMEState() override;
// Overriden nsIFormControl methods
NS_IMETHOD_(uint32_t) GetType() const override
{
return NS_FORM_OBJECT;
}
NS_IMETHOD Reset() override;
NS_IMETHOD SubmitNamesValues(HTMLFormSubmission *aFormSubmission) override;

Просмотреть файл

@ -21,7 +21,7 @@ namespace dom {
HTMLOutputElement::HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo)
: nsGenericHTMLFormElement(aNodeInfo, NS_FORM_OUTPUT)
, mValueModeFlag(eModeDefault)
, mIsDoneAddingChildren(!aFromParser)
{

Просмотреть файл

@ -31,7 +31,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIFormControl
NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_OUTPUT; }
NS_IMETHOD Reset() override;
NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;

Просмотреть файл

@ -117,7 +117,7 @@ SafeOptionListMutation::~SafeOptionListMutation()
HTMLSelectElement::HTMLSelectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
FromParser aFromParser)
: nsGenericHTMLFormElementWithState(aNodeInfo),
: nsGenericHTMLFormElementWithState(aNodeInfo, NS_FORM_SELECT),
mOptions(new HTMLOptionsCollection(this)),
mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown),
mIsDoneAddingChildren(!aFromParser),

Просмотреть файл

@ -296,7 +296,6 @@ public:
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
// Overriden nsIFormControl methods
NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_SELECT; }
NS_IMETHOD Reset() override;
NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
NS_IMETHOD SaveState() override;

Просмотреть файл

@ -53,7 +53,7 @@ namespace dom {
HTMLTextAreaElement::HTMLTextAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
FromParser aFromParser)
: nsGenericHTMLFormElementWithState(aNodeInfo),
: nsGenericHTMLFormElementWithState(aNodeInfo, NS_FORM_TEXTAREA),
mValueChanged(false),
mLastValueChangeWasInteractive(false),
mHandlingSelect(false),

Просмотреть файл

@ -72,7 +72,6 @@ public:
NS_IMETHOD SetUserInput(const nsAString& aInput) override;
// nsIFormControl
NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_TEXTAREA; }
NS_IMETHOD Reset() override;
NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
NS_IMETHOD SaveState() override;

Просмотреть файл

@ -25,7 +25,7 @@ HTMLInputElement*
GetAsRadio(nsIContent* node)
{
HTMLInputElement* el = HTMLInputElement::FromContent(node);
if (el && el->GetType() == NS_FORM_INPUT_RADIO) {
if (el && el->ControlType() == NS_FORM_INPUT_RADIO) {
return el;
}
return nullptr;

Просмотреть файл

@ -403,7 +403,7 @@ nsGenericHTMLElement::Spellcheck()
}
// Is this a multiline plaintext input?
int32_t controlType = formControl->GetType();
int32_t controlType = formControl->ControlType();
if (controlType == NS_FORM_TEXTAREA) {
return true; // Spellchecked by default
}
@ -1730,8 +1730,10 @@ nsGenericHTMLElement::TouchEventsEnabled(JSContext* aCx, JSObject* aGlobal)
//----------------------------------------------------------------------
nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
uint8_t aType)
: nsGenericHTMLElement(aNodeInfo)
, nsIFormControl(aType)
, mForm(nullptr)
, mFieldSet(nullptr)
{
@ -2090,7 +2092,7 @@ nsGenericHTMLFormElement::ForgetFieldSet(nsIContent* aFieldset)
bool
nsGenericHTMLFormElement::CanBeDisabled() const
{
int32_t type = GetType();
int32_t type = ControlType();
// It's easier to test the types that _cannot_ be disabled
return
type != NS_FORM_OBJECT &&
@ -2403,7 +2405,7 @@ bool
nsGenericHTMLFormElement::IsLabelable() const
{
// TODO: keygen should be in that list, see bug 101019.
uint32_t type = GetType();
uint32_t type = ControlType();
return (type & NS_FORM_INPUT_ELEMENT && type != NS_FORM_INPUT_HIDDEN) ||
type & NS_FORM_BUTTON_ELEMENT ||
// type == NS_FORM_KEYGEN ||
@ -2730,9 +2732,9 @@ nsGenericHTMLElement::ChangeEditableState(int32_t aChange)
//----------------------------------------------------------------------
nsGenericHTMLFormElementWithState::nsGenericHTMLFormElementWithState(
already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo
already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo, uint8_t aType
)
: nsGenericHTMLFormElement(aNodeInfo)
: nsGenericHTMLFormElement(aNodeInfo, aType)
{
mStateKey.SetIsVoid(true);
}

Просмотреть файл

@ -1208,7 +1208,8 @@ class nsGenericHTMLFormElement : public nsGenericHTMLElement,
public nsIFormControl
{
public:
explicit nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
uint8_t aType);
NS_DECL_ISUPPORTS_INHERITED
@ -1368,7 +1369,8 @@ protected:
class nsGenericHTMLFormElementWithState : public nsGenericHTMLFormElement
{
public:
explicit nsGenericHTMLFormElementWithState(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
nsGenericHTMLFormElementWithState(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
uint8_t aType);
/**
* Get the presentation state for a piece of content, or create it if it does

Просмотреть файл

@ -92,6 +92,10 @@ static_assert(static_cast<uint32_t>(eInputElementTypesMax) < 1<<8,
class nsIFormControl : public nsISupports
{
public:
nsIFormControl(uint8_t aType)
: mType(aType)
{
}
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFORMCONTROL_IID)
@ -130,7 +134,7 @@ public:
* Get the type of this control as an int (see NS_FORM_* above)
* @return the type of this control
*/
NS_IMETHOD_(uint32_t) GetType() const = 0 ;
uint32_t ControlType() const { return mType; }
/**
* Reset this form control (as it should be when the user clicks the Reset
@ -226,12 +230,14 @@ protected:
* @return whether this is a auto-focusable form control.
*/
inline bool IsAutofocusable() const;
uint8_t mType;
};
bool
nsIFormControl::IsSubmitControl() const
{
uint32_t type = GetType();
uint32_t type = ControlType();
return type == NS_FORM_INPUT_SUBMIT ||
type == NS_FORM_INPUT_IMAGE ||
type == NS_FORM_BUTTON_SUBMIT;
@ -240,7 +246,7 @@ nsIFormControl::IsSubmitControl() const
bool
nsIFormControl::IsTextControl(bool aExcludePassword) const
{
uint32_t type = GetType();
uint32_t type = ControlType();
return type == NS_FORM_TEXTAREA ||
IsSingleLineTextControl(aExcludePassword, type);
}
@ -248,13 +254,13 @@ nsIFormControl::IsTextControl(bool aExcludePassword) const
bool
nsIFormControl::IsTextOrNumberControl(bool aExcludePassword) const
{
return IsTextControl(aExcludePassword) || GetType() == NS_FORM_INPUT_NUMBER;
return IsTextControl(aExcludePassword) || ControlType() == NS_FORM_INPUT_NUMBER;
}
bool
nsIFormControl::IsSingleLineTextControl(bool aExcludePassword) const
{
return IsSingleLineTextControl(aExcludePassword, GetType());
return IsSingleLineTextControl(aExcludePassword, ControlType());
}
/*static*/
@ -282,7 +288,7 @@ bool
nsIFormControl::IsSubmittableControl() const
{
// TODO: keygen should be in that list, see bug 101019.
uint32_t type = GetType();
uint32_t type = ControlType();
return type == NS_FORM_OBJECT ||
type == NS_FORM_TEXTAREA ||
type == NS_FORM_SELECT ||
@ -294,7 +300,7 @@ nsIFormControl::IsSubmittableControl() const
bool
nsIFormControl::AllowDraggableChildren() const
{
uint32_t type = GetType();
uint32_t type = ControlType();
return type == NS_FORM_OBJECT ||
type == NS_FORM_FIELDSET ||
type == NS_FORM_OUTPUT;
@ -303,7 +309,7 @@ nsIFormControl::AllowDraggableChildren() const
bool
nsIFormControl::IsAutofocusable() const
{
uint32_t type = GetType();
uint32_t type = ControlType();
return type & NS_FORM_INPUT_ELEMENT ||
type & NS_FORM_BUTTON_ELEMENT ||
type == NS_FORM_TEXTAREA ||

Просмотреть файл

@ -1979,7 +1979,7 @@ nsTextEditorState::GetParentNumberControl(nsFrame* aFrame) const
// that situation, the type of the control has changed, but its frame has
// not been reconstructed yet. So we need to check the type of the input
// control in addition to the type of the frame.
return (input->GetType() == NS_FORM_INPUT_NUMBER) ? input : nullptr;
return (input->ControlType() == NS_FORM_INPUT_NUMBER) ? input : nullptr;
}
return nullptr;

Просмотреть файл

@ -1208,7 +1208,7 @@ PersistNodeFixup::FixupNode(nsIDOMNode *aNodeIn,
RefPtr<dom::HTMLInputElement> outElt =
dom::HTMLInputElement::FromContentOrNull(content);
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(*aNodeOut);
switch (formControl->GetType()) {
switch (formControl->ControlType()) {
case NS_FORM_INPUT_EMAIL:
case NS_FORM_INPUT_SEARCH:
case NS_FORM_INPUT_TEXT:

Просмотреть файл

@ -1208,7 +1208,7 @@ EditorEventListener::IsFileControlTextBox()
return false;
}
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(parent);
return formControl->GetType() == NS_FORM_INPUT_FILE;
return formControl->ControlType() == NS_FORM_INPUT_FILE;
}
bool

Просмотреть файл

@ -3728,7 +3728,7 @@ nsCSSFrameConstructor::FindInputData(Element* aElement,
nsCOMPtr<nsIFormControl> control = do_QueryInterface(aElement);
NS_ASSERTION(control, "input doesn't implement nsIFormControl?");
auto controlType = control->GetType();
auto controlType = control->ControlType();
// Note that Android/Gonk widgets don't have theming support and thus
// appearance:none is the same as any other appearance value.

Просмотреть файл

@ -121,7 +121,7 @@ nsColorControlFrame::AttributeChanged(int32_t aNameSpaceID,
// still a color control, which might not be the case if the type attribute
// was removed/changed.
nsCOMPtr<nsIFormControl> fctrl = do_QueryInterface(GetContent());
if (fctrl->GetType() == NS_FORM_INPUT_COLOR &&
if (fctrl->ControlType() == NS_FORM_INPUT_COLOR &&
aNameSpaceID == kNameSpaceID_None && nsGkAtoms::value == aAttribute) {
UpdateColor();
}

Просмотреть файл

@ -1450,7 +1450,7 @@ nsComboboxControlFrame::SetInitialChildList(ChildListID aListID,
for (nsFrameList::Enumerator e(aChildList); !e.AtEnd(); e.Next()) {
nsCOMPtr<nsIFormControl> formControl =
do_QueryInterface(e.get()->GetContent());
if (formControl && formControl->GetType() == NS_FORM_BUTTON_BUTTON) {
if (formControl && formControl->ControlType() == NS_FORM_BUTTON_BUTTON) {
mButtonFrame = e.get();
break;
}

Просмотреть файл

@ -383,8 +383,8 @@ nsDateTimeControlFrame::AttributeChanged(int32_t aNameSpaceID,
auto contentAsInputElem = static_cast<dom::HTMLInputElement*>(mContent);
// If script changed the <input>'s type before setting these attributes
// then we don't need to do anything since we are going to be reframed.
if (contentAsInputElem->GetType() == NS_FORM_INPUT_TIME ||
contentAsInputElem->GetType() == NS_FORM_INPUT_DATE) {
if (contentAsInputElem->ControlType() == NS_FORM_INPUT_TIME ||
contentAsInputElem->ControlType() == NS_FORM_INPUT_DATE) {
nsCOMPtr<nsIDateTimeInputArea> inputAreaContent =
do_QueryInterface(mInputAreaContent);
if (aAttribute == nsGkAtoms::value) {

Просмотреть файл

@ -94,7 +94,7 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsXPIDLString& aString) const
nsCOMPtr<nsIFormControl> form = do_QueryInterface(mContent);
NS_ENSURE_TRUE(form, NS_ERROR_UNEXPECTED);
int32_t type = form->GetType();
int32_t type = form->ControlType();
const char *prop;
if (type == NS_FORM_INPUT_RESET) {
prop = "Reset";

Просмотреть файл

@ -489,7 +489,7 @@ nsRangeFrame::GetValueAsFractionOfRange()
MOZ_ASSERT(mContent->IsHTMLElement(nsGkAtoms::input), "bad cast");
dom::HTMLInputElement* input = static_cast<dom::HTMLInputElement*>(mContent);
MOZ_ASSERT(input->GetType() == NS_FORM_INPUT_RANGE);
MOZ_ASSERT(input->ControlType() == NS_FORM_INPUT_RANGE);
Decimal value = input->GetValueAsDecimal();
Decimal minimum = input->GetMinimum();
@ -518,7 +518,7 @@ nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent)
MOZ_ASSERT(mContent->IsHTMLElement(nsGkAtoms::input), "bad cast");
dom::HTMLInputElement* input = static_cast<dom::HTMLInputElement*>(mContent);
MOZ_ASSERT(input->GetType() == NS_FORM_INPUT_RANGE);
MOZ_ASSERT(input->ControlType() == NS_FORM_INPUT_RANGE);
Decimal minimum = input->GetMinimum();
Decimal maximum = input->GetMaximum();
@ -750,7 +750,8 @@ nsRangeFrame::AttributeChanged(int32_t aNameSpaceID,
// and this frame will shortly be destroyed, there's no point in calling
// UpdateForValueChange() anyway.
MOZ_ASSERT(mContent->IsHTMLElement(nsGkAtoms::input), "bad cast");
bool typeIsRange = static_cast<dom::HTMLInputElement*>(mContent)->GetType() ==
bool typeIsRange =
static_cast<dom::HTMLInputElement*>(mContent)->ControlType() ==
NS_FORM_INPUT_RANGE;
// If script changed the <input>'s type before setting these attributes
// then we don't need to do anything since we are going to be reframed.

Просмотреть файл

@ -740,8 +740,9 @@ nsFormFillController::StartSearch(const nsAString &aSearchString, const nsAStrin
// If the login manager has indicated it's responsible for this field, let it
// handle the autocomplete. Otherwise, handle with form history.
// This method is sometimes called in unit tests and from XUL without a focused node.
if (mFocusedInputNode && (mPwmgrInputs.Get(mFocusedInputNode) ||
formControl->GetType() == NS_FORM_INPUT_PASSWORD)) {
if (mFocusedInputNode &&
(mPwmgrInputs.Get(mFocusedInputNode) ||
formControl->ControlType() == NS_FORM_INPUT_PASSWORD)) {
// Handle the case where a password field is focused but
// MarkAsLoginManagerField wasn't called because password manager is disabled.
@ -1033,7 +1034,7 @@ nsFormFillController::MaybeStartControllingInput(nsIDOMHTMLInputElement* aInput)
bool isPwmgrInput = false;
if (mPwmgrInputs.Get(inputNode) ||
formControl->GetType() == NS_FORM_INPUT_PASSWORD) {
formControl->ControlType() == NS_FORM_INPUT_PASSWORD) {
isPwmgrInput = true;
}
@ -1048,7 +1049,7 @@ nsFormFillController::FocusEventDelayedCallback(nsIFormControl* aFormControl)
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(mFocusedInputNode);
if (!formControl || formControl != aFormControl ||
formControl->GetType() != NS_FORM_INPUT_PASSWORD) {
formControl->ControlType() != NS_FORM_INPUT_PASSWORD) {
return;
}