diff options
author | athenian200 <athenian200@outlook.com> | 2020-01-16 14:07:04 -0600 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:16:31 +0200 |
commit | 563dc95cdbdd94496360f14fc277c4b8fc79bbab (patch) | |
tree | 8c0dd0fb0fc73264d0a513f06497155071c598d1 /dom/html | |
parent | 7e59ac9036ae2cbb91ff216e50eac75b9588557a (diff) | |
download | UXP-563dc95cdbdd94496360f14fc277c4b8fc79bbab.tar UXP-563dc95cdbdd94496360f14fc277c4b8fc79bbab.tar.gz UXP-563dc95cdbdd94496360f14fc277c4b8fc79bbab.tar.lz UXP-563dc95cdbdd94496360f14fc277c4b8fc79bbab.tar.xz UXP-563dc95cdbdd94496360f14fc277c4b8fc79bbab.zip |
Issue #1356 - Remove -moz-user-input disabled to improve event handling.
Diffstat (limited to 'dom/html')
-rw-r--r-- | dom/html/HTMLLabelElement.h | 2 | ||||
-rw-r--r-- | dom/html/HTMLObjectElement.h | 2 | ||||
-rw-r--r-- | dom/html/HTMLOptGroupElement.cpp | 11 | ||||
-rw-r--r-- | dom/html/HTMLOptGroupElement.h | 4 | ||||
-rw-r--r-- | dom/html/HTMLOptionElement.h | 4 | ||||
-rw-r--r-- | dom/html/HTMLOutputElement.h | 2 | ||||
-rw-r--r-- | dom/html/nsGenericHTMLElement.cpp | 21 | ||||
-rw-r--r-- | dom/html/nsGenericHTMLElement.h | 6 |
8 files changed, 13 insertions, 39 deletions
diff --git a/dom/html/HTMLLabelElement.h b/dom/html/HTMLLabelElement.h index c8385fc53..4057ffef6 100644 --- a/dom/html/HTMLLabelElement.h +++ b/dom/html/HTMLLabelElement.h @@ -59,8 +59,6 @@ public: using nsGenericHTMLElement::Focus; virtual void Focus(mozilla::ErrorResult& aError) override; - virtual bool IsDisabled() const override { return false; } - // nsIContent virtual nsresult PostHandleEvent( EventChainPostVisitor& aVisitor) override; diff --git a/dom/html/HTMLObjectElement.h b/dom/html/HTMLObjectElement.h index 4041b78a3..5226154da 100644 --- a/dom/html/HTMLObjectElement.h +++ b/dom/html/HTMLObjectElement.h @@ -77,8 +77,6 @@ public: NS_IMETHOD Reset() override; NS_IMETHOD SubmitNamesValues(HTMLFormSubmission *aFormSubmission) override; - virtual bool IsDisabled() const override { return false; } - virtual void DoneAddingChildren(bool aHaveNotified) override; virtual bool IsDoneAddingChildren() override; diff --git a/dom/html/HTMLOptGroupElement.cpp b/dom/html/HTMLOptGroupElement.cpp index 8a044fbf3..9e738961d 100644 --- a/dom/html/HTMLOptGroupElement.cpp +++ b/dom/html/HTMLOptGroupElement.cpp @@ -53,15 +53,14 @@ HTMLOptGroupElement::PreHandleEvent(EventChainPreVisitor& aVisitor) aVisitor.mCanHandle = false; // Do not process any DOM events if the element is disabled // XXXsmaug This is not the right thing to do. But what is? - if (HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) { + if (IsDisabled()) { return NS_OK; } - nsIFrame* frame = GetPrimaryFrame(); - if (frame) { - const nsStyleUserInterface* uiStyle = frame->StyleUserInterface(); - if (uiStyle->mUserInput == StyleUserInput::None || - uiStyle->mUserInput == StyleUserInput::Disabled) { + if (nsIFrame* frame = GetPrimaryFrame()) { + // FIXME(emilio): This poking at the style of the frame is broken unless we + // flush before every event handling, which we don't really want to. + if (frame->StyleUserInterface()->mUserInput == StyleUserInput::None) { return NS_OK; } } diff --git a/dom/html/HTMLOptGroupElement.h b/dom/html/HTMLOptGroupElement.h index d53a2e32b..e46a6a953 100644 --- a/dom/html/HTMLOptGroupElement.h +++ b/dom/html/HTMLOptGroupElement.h @@ -46,10 +46,6 @@ public: virtual nsIDOMNode* AsDOMNode() override { return this; } - virtual bool IsDisabled() const override { - return HasAttr(kNameSpaceID_None, nsGkAtoms::disabled); - } - bool Disabled() const { return GetBoolAttr(nsGkAtoms::disabled); diff --git a/dom/html/HTMLOptionElement.h b/dom/html/HTMLOptionElement.h index e220b84df..4b5e192ff 100644 --- a/dom/html/HTMLOptionElement.h +++ b/dom/html/HTMLOptionElement.h @@ -67,10 +67,6 @@ public: nsresult CopyInnerTo(mozilla::dom::Element* aDest); - virtual bool IsDisabled() const override { - return HasAttr(kNameSpaceID_None, nsGkAtoms::disabled); - } - bool Disabled() const { return GetBoolAttr(nsGkAtoms::disabled); diff --git a/dom/html/HTMLOutputElement.h b/dom/html/HTMLOutputElement.h index 588262480..6b6c3f66c 100644 --- a/dom/html/HTMLOutputElement.h +++ b/dom/html/HTMLOutputElement.h @@ -35,8 +35,6 @@ public: NS_IMETHOD Reset() override; NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override; - virtual bool IsDisabled() const override { return false; } - nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override; bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute, diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 2f890325a..0c8bcc9c8 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -2109,14 +2109,6 @@ nsGenericHTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor) return nsGenericHTMLElement::PreHandleEvent(aVisitor); } -/* virtual */ -bool -nsGenericHTMLFormElement::IsDisabled() const -{ - return HasAttr(kNameSpaceID_None, nsGkAtoms::disabled) || - (mFieldSet && mFieldSet->IsDisabled()); -} - void nsGenericHTMLFormElement::ForgetFieldSet(nsIContent* aFieldset) { @@ -2308,14 +2300,13 @@ nsGenericHTMLFormElement::IsElementDisabledForEvents(EventMessage aMessage, break; } - bool disabled = IsDisabled(); - if (!disabled && aFrame) { - const nsStyleUserInterface* uiStyle = aFrame->StyleUserInterface(); - disabled = uiStyle->mUserInput == StyleUserInput::None || - uiStyle->mUserInput == StyleUserInput::Disabled; - + // FIXME(emilio): This poking at the style of the frame is slightly bogus + // unless we flush before every event, which we don't really want to do. + if (aFrame && + aFrame->StyleUserInterface()->mUserInput == StyleUserInput::None) { + return true; } - return disabled; + return IsDisabled(); } void diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h index 72039f266..940404f93 100644 --- a/dom/html/nsGenericHTMLElement.h +++ b/dom/html/nsGenericHTMLElement.h @@ -817,8 +817,8 @@ public: /** * Returns the current disabled state of the element. */ - virtual bool IsDisabled() const { - return false; + bool IsDisabled() const { + return State().HasState(NS_EVENT_STATE_DISABLED); } bool IsHidden() const @@ -1222,8 +1222,6 @@ public: virtual nsresult PreHandleEvent( mozilla::EventChainPreVisitor& aVisitor) override; - virtual bool IsDisabled() const override; - /** * This callback is called by a fieldest on all its elements whenever its * disabled attribute is changed so the element knows its disabled state |