зеркало из https://github.com/mozilla/gecko-dev.git
Backout Bug 1351860, r=backout
This commit is contained in:
Родитель
b86d26e216
Коммит
31b1f5cc92
|
@ -1557,7 +1557,7 @@ ChromeContextMenuListener::HandleEvent(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(node));
|
||||
if (formControl) {
|
||||
if (formControl->ControlType() == NS_FORM_TEXTAREA) {
|
||||
if (formControl->GetType() == 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->ControlType() != NS_FORM_OBJECT) {
|
||||
if (form && !mIsAltKeyPressed && form->GetType() != 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->ControlType(), aKey);
|
||||
KeyAppendInt(control->GetType(), 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->ControlType() == NS_FORM_INPUT_PASSWORD) {
|
||||
if (formControl->GetType() == 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)->ControlType() ==
|
||||
static_cast<dom::HTMLInputElement*>(aContent)->GetType() ==
|
||||
NS_FORM_INPUT_NUMBER;
|
||||
|
||||
if (typeIsNumber) {
|
||||
|
|
|
@ -1534,7 +1534,7 @@ EventStateManager::FireContextClick()
|
|||
|
||||
if (formCtrl) {
|
||||
allowedToDispatch = formCtrl->IsTextOrNumberControl(/*aExcludePassword*/ false) ||
|
||||
formCtrl->ControlType() == NS_FORM_INPUT_FILE;
|
||||
formCtrl->GetType() == 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->ControlType() == NS_FORM_INPUT_SEARCH ?
|
||||
willSubmit ? (control->GetType() == NS_FORM_INPUT_SEARCH ?
|
||||
NS_LITERAL_STRING("search") : NS_LITERAL_STRING("go")) :
|
||||
(formElement ?
|
||||
NS_LITERAL_STRING("next") : EmptyString()));
|
||||
|
|
|
@ -57,7 +57,8 @@ static const nsAttrValue::EnumTable* kButtonDefaultType = &kButtonTypeTable[2];
|
|||
// Construction, destruction
|
||||
HTMLButtonElement::HTMLButtonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
||||
FromParser aFromParser)
|
||||
: nsGenericHTMLFormElementWithState(aNodeInfo, kButtonDefaultType->value),
|
||||
: nsGenericHTMLFormElementWithState(aNodeInfo),
|
||||
mType(kButtonDefaultType->value),
|
||||
mDisabledChanged(false),
|
||||
mInInternalActivate(false),
|
||||
mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT))
|
||||
|
|
|
@ -47,6 +47,7 @@ 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;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
HTMLFieldSetElement::HTMLFieldSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
: nsGenericHTMLFormElement(aNodeInfo, NS_FORM_FIELDSET)
|
||||
: nsGenericHTMLFormElement(aNodeInfo)
|
||||
, mElements(nullptr)
|
||||
, mFirstLegend(nullptr)
|
||||
, mInvalidElementsCount(0)
|
||||
|
|
|
@ -50,6 +50,7 @@ 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->ControlType()) {
|
||||
switch (aFormControl->GetType()) {
|
||||
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->ControlType();
|
||||
int32_t type = aChild->GetType();
|
||||
|
||||
//
|
||||
// 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->ControlType() == NS_FORM_INPUT_RADIO) {
|
||||
if (aChild->GetType() == 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]->ControlType() == NS_FORM_INPUT_NUMBER) {
|
||||
mControls->mElements[i]->GetType() == 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->ControlType();
|
||||
uint32_t type = fc->GetType();
|
||||
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->ControlType() == NS_FORM_INPUT_RADIO;
|
||||
isRadio = radio && radio->GetType() == 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->ControlType() == NS_FORM_INPUT_RADIO) {
|
||||
if (control->GetType() == 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->ControlType() == NS_FORM_INPUT_RADIO) {
|
||||
if (formControl->GetType() == 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->ControlType() == NS_FORM_INPUT_RADIO &&
|
||||
if (formControl && formControl->GetType() == NS_FORM_INPUT_RADIO &&
|
||||
!aVisitor->Visit(formControl)) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1054,7 +1054,8 @@ static nsresult FireEventForAccessibility(nsIDOMHTMLInputElement* aTarget,
|
|||
|
||||
HTMLInputElement::HTMLInputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
||||
FromParser aFromParser, FromClone aFromClone)
|
||||
: nsGenericHTMLFormElementWithState(aNodeInfo, kInputDefaultType->value)
|
||||
: nsGenericHTMLFormElementWithState(aNodeInfo)
|
||||
, mType(kInputDefaultType->value)
|
||||
, mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown)
|
||||
, mDisabledChanged(false)
|
||||
, mValueChanged(false)
|
||||
|
@ -3513,7 +3514,7 @@ HTMLInputElement::Focus(ErrorResult& aError)
|
|||
// See if the child is a button control.
|
||||
nsCOMPtr<nsIFormControl> formCtrl =
|
||||
do_QueryInterface(childFrame->GetContent());
|
||||
if (formCtrl && formCtrl->ControlType() == NS_FORM_BUTTON_BUTTON) {
|
||||
if (formCtrl && formCtrl->GetType() == NS_FORM_BUTTON_BUTTON) {
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(formCtrl);
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm && element) {
|
||||
|
|
|
@ -164,6 +164,7 @@ 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;
|
||||
|
@ -1608,6 +1609,12 @@ 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, NS_FORM_OBJECT),
|
||||
: nsGenericHTMLFormElement(aNodeInfo),
|
||||
mIsDoneAddingChildren(!aFromParser)
|
||||
{
|
||||
RegisterActivityObserver();
|
||||
|
|
|
@ -69,6 +69,11 @@ 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, NS_FORM_OUTPUT)
|
||||
: nsGenericHTMLFormElement(aNodeInfo)
|
||||
, mValueModeFlag(eModeDefault)
|
||||
, mIsDoneAddingChildren(!aFromParser)
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ 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, NS_FORM_SELECT),
|
||||
: nsGenericHTMLFormElementWithState(aNodeInfo),
|
||||
mOptions(new HTMLOptionsCollection(this)),
|
||||
mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown),
|
||||
mIsDoneAddingChildren(!aFromParser),
|
||||
|
|
|
@ -296,6 +296,7 @@ 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, NS_FORM_TEXTAREA),
|
||||
: nsGenericHTMLFormElementWithState(aNodeInfo),
|
||||
mValueChanged(false),
|
||||
mLastValueChangeWasInteractive(false),
|
||||
mHandlingSelect(false),
|
||||
|
|
|
@ -72,6 +72,7 @@ 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->ControlType() == NS_FORM_INPUT_RADIO) {
|
||||
if (el && el->GetType() == NS_FORM_INPUT_RADIO) {
|
||||
return el;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
@ -403,7 +403,7 @@ nsGenericHTMLElement::Spellcheck()
|
|||
}
|
||||
|
||||
// Is this a multiline plaintext input?
|
||||
int32_t controlType = formControl->ControlType();
|
||||
int32_t controlType = formControl->GetType();
|
||||
if (controlType == NS_FORM_TEXTAREA) {
|
||||
return true; // Spellchecked by default
|
||||
}
|
||||
|
@ -1730,10 +1730,8 @@ nsGenericHTMLElement::TouchEventsEnabled(JSContext* aCx, JSObject* aGlobal)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
||||
uint8_t aType)
|
||||
nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
, nsIFormControl(aType)
|
||||
, mForm(nullptr)
|
||||
, mFieldSet(nullptr)
|
||||
{
|
||||
|
@ -2092,7 +2090,7 @@ nsGenericHTMLFormElement::ForgetFieldSet(nsIContent* aFieldset)
|
|||
bool
|
||||
nsGenericHTMLFormElement::CanBeDisabled() const
|
||||
{
|
||||
int32_t type = ControlType();
|
||||
int32_t type = GetType();
|
||||
// It's easier to test the types that _cannot_ be disabled
|
||||
return
|
||||
type != NS_FORM_OBJECT &&
|
||||
|
@ -2405,7 +2403,7 @@ bool
|
|||
nsGenericHTMLFormElement::IsLabelable() const
|
||||
{
|
||||
// TODO: keygen should be in that list, see bug 101019.
|
||||
uint32_t type = ControlType();
|
||||
uint32_t type = GetType();
|
||||
return (type & NS_FORM_INPUT_ELEMENT && type != NS_FORM_INPUT_HIDDEN) ||
|
||||
type & NS_FORM_BUTTON_ELEMENT ||
|
||||
// type == NS_FORM_KEYGEN ||
|
||||
|
@ -2732,9 +2730,9 @@ nsGenericHTMLElement::ChangeEditableState(int32_t aChange)
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
nsGenericHTMLFormElementWithState::nsGenericHTMLFormElementWithState(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo, uint8_t aType
|
||||
already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo
|
||||
)
|
||||
: nsGenericHTMLFormElement(aNodeInfo, aType)
|
||||
: nsGenericHTMLFormElement(aNodeInfo)
|
||||
{
|
||||
mStateKey.SetIsVoid(true);
|
||||
}
|
||||
|
|
|
@ -1208,8 +1208,7 @@ class nsGenericHTMLFormElement : public nsGenericHTMLElement,
|
|||
public nsIFormControl
|
||||
{
|
||||
public:
|
||||
nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
||||
uint8_t aType);
|
||||
explicit nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
@ -1369,8 +1368,7 @@ protected:
|
|||
class nsGenericHTMLFormElementWithState : public nsGenericHTMLFormElement
|
||||
{
|
||||
public:
|
||||
nsGenericHTMLFormElementWithState(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
||||
uint8_t aType);
|
||||
explicit nsGenericHTMLFormElementWithState(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||
|
||||
/**
|
||||
* Get the presentation state for a piece of content, or create it if it does
|
||||
|
|
|
@ -92,10 +92,6 @@ 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)
|
||||
|
||||
|
@ -134,7 +130,7 @@ public:
|
|||
* Get the type of this control as an int (see NS_FORM_* above)
|
||||
* @return the type of this control
|
||||
*/
|
||||
uint32_t ControlType() const { return mType; }
|
||||
NS_IMETHOD_(uint32_t) GetType() const = 0 ;
|
||||
|
||||
/**
|
||||
* Reset this form control (as it should be when the user clicks the Reset
|
||||
|
@ -230,14 +226,12 @@ protected:
|
|||
* @return whether this is a auto-focusable form control.
|
||||
*/
|
||||
inline bool IsAutofocusable() const;
|
||||
|
||||
uint8_t mType;
|
||||
};
|
||||
|
||||
bool
|
||||
nsIFormControl::IsSubmitControl() const
|
||||
{
|
||||
uint32_t type = ControlType();
|
||||
uint32_t type = GetType();
|
||||
return type == NS_FORM_INPUT_SUBMIT ||
|
||||
type == NS_FORM_INPUT_IMAGE ||
|
||||
type == NS_FORM_BUTTON_SUBMIT;
|
||||
|
@ -246,7 +240,7 @@ nsIFormControl::IsSubmitControl() const
|
|||
bool
|
||||
nsIFormControl::IsTextControl(bool aExcludePassword) const
|
||||
{
|
||||
uint32_t type = ControlType();
|
||||
uint32_t type = GetType();
|
||||
return type == NS_FORM_TEXTAREA ||
|
||||
IsSingleLineTextControl(aExcludePassword, type);
|
||||
}
|
||||
|
@ -254,13 +248,13 @@ nsIFormControl::IsTextControl(bool aExcludePassword) const
|
|||
bool
|
||||
nsIFormControl::IsTextOrNumberControl(bool aExcludePassword) const
|
||||
{
|
||||
return IsTextControl(aExcludePassword) || ControlType() == NS_FORM_INPUT_NUMBER;
|
||||
return IsTextControl(aExcludePassword) || GetType() == NS_FORM_INPUT_NUMBER;
|
||||
}
|
||||
|
||||
bool
|
||||
nsIFormControl::IsSingleLineTextControl(bool aExcludePassword) const
|
||||
{
|
||||
return IsSingleLineTextControl(aExcludePassword, ControlType());
|
||||
return IsSingleLineTextControl(aExcludePassword, GetType());
|
||||
}
|
||||
|
||||
/*static*/
|
||||
|
@ -288,7 +282,7 @@ bool
|
|||
nsIFormControl::IsSubmittableControl() const
|
||||
{
|
||||
// TODO: keygen should be in that list, see bug 101019.
|
||||
uint32_t type = ControlType();
|
||||
uint32_t type = GetType();
|
||||
return type == NS_FORM_OBJECT ||
|
||||
type == NS_FORM_TEXTAREA ||
|
||||
type == NS_FORM_SELECT ||
|
||||
|
@ -300,7 +294,7 @@ nsIFormControl::IsSubmittableControl() const
|
|||
bool
|
||||
nsIFormControl::AllowDraggableChildren() const
|
||||
{
|
||||
uint32_t type = ControlType();
|
||||
uint32_t type = GetType();
|
||||
return type == NS_FORM_OBJECT ||
|
||||
type == NS_FORM_FIELDSET ||
|
||||
type == NS_FORM_OUTPUT;
|
||||
|
@ -309,7 +303,7 @@ nsIFormControl::AllowDraggableChildren() const
|
|||
bool
|
||||
nsIFormControl::IsAutofocusable() const
|
||||
{
|
||||
uint32_t type = ControlType();
|
||||
uint32_t type = GetType();
|
||||
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->ControlType() == NS_FORM_INPUT_NUMBER) ? input : nullptr;
|
||||
return (input->GetType() == 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->ControlType()) {
|
||||
switch (formControl->GetType()) {
|
||||
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->ControlType() == NS_FORM_INPUT_FILE;
|
||||
return formControl->GetType() == 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->ControlType();
|
||||
auto controlType = control->GetType();
|
||||
|
||||
// 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->ControlType() == NS_FORM_INPUT_COLOR &&
|
||||
if (fctrl->GetType() == 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->ControlType() == NS_FORM_BUTTON_BUTTON) {
|
||||
if (formControl && formControl->GetType() == 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->ControlType() == NS_FORM_INPUT_TIME ||
|
||||
contentAsInputElem->ControlType() == NS_FORM_INPUT_DATE) {
|
||||
if (contentAsInputElem->GetType() == NS_FORM_INPUT_TIME ||
|
||||
contentAsInputElem->GetType() == 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->ControlType();
|
||||
int32_t type = form->GetType();
|
||||
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->ControlType() == NS_FORM_INPUT_RANGE);
|
||||
MOZ_ASSERT(input->GetType() == 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->ControlType() == NS_FORM_INPUT_RANGE);
|
||||
MOZ_ASSERT(input->GetType() == NS_FORM_INPUT_RANGE);
|
||||
|
||||
Decimal minimum = input->GetMinimum();
|
||||
Decimal maximum = input->GetMaximum();
|
||||
|
@ -750,8 +750,7 @@ 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)->ControlType() ==
|
||||
bool typeIsRange = static_cast<dom::HTMLInputElement*>(mContent)->GetType() ==
|
||||
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,9 +740,8 @@ 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->ControlType() == NS_FORM_INPUT_PASSWORD)) {
|
||||
if (mFocusedInputNode && (mPwmgrInputs.Get(mFocusedInputNode) ||
|
||||
formControl->GetType() == NS_FORM_INPUT_PASSWORD)) {
|
||||
|
||||
// Handle the case where a password field is focused but
|
||||
// MarkAsLoginManagerField wasn't called because password manager is disabled.
|
||||
|
@ -1034,7 +1033,7 @@ nsFormFillController::MaybeStartControllingInput(nsIDOMHTMLInputElement* aInput)
|
|||
|
||||
bool isPwmgrInput = false;
|
||||
if (mPwmgrInputs.Get(inputNode) ||
|
||||
formControl->ControlType() == NS_FORM_INPUT_PASSWORD) {
|
||||
formControl->GetType() == NS_FORM_INPUT_PASSWORD) {
|
||||
isPwmgrInput = true;
|
||||
}
|
||||
|
||||
|
@ -1049,7 +1048,7 @@ nsFormFillController::FocusEventDelayedCallback(nsIFormControl* aFormControl)
|
|||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(mFocusedInputNode);
|
||||
|
||||
if (!formControl || formControl != aFormControl ||
|
||||
formControl->ControlType() != NS_FORM_INPUT_PASSWORD) {
|
||||
formControl->GetType() != NS_FORM_INPUT_PASSWORD) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче