From d8a50304107dab4621c9c81c6b429850ff4c9197 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Thu, 3 Jan 2013 17:17:36 +0200 Subject: [PATCH 1/2] Bug 816340 - Propagate events to chrome even if there is a disabled form control in the event target chain, r=jst,gavin --- browser/base/content/nsContextMenu.js | 13 +++- content/base/src/contentAreaDropListener.js | 17 +++++ content/base/test/chrome/Makefile.in | 2 + content/base/test/chrome/file_bug816340.xul | 70 +++++++++++++++++++ content/base/test/chrome/test_bug816340.xul | 31 ++++++++ content/events/public/nsEventDispatcher.h | 16 +++-- content/events/src/nsEventDispatcher.cpp | 52 +++++++++++++- content/html/content/public/nsIFormControl.h | 8 ++- .../html/content/src/nsGenericHTMLElement.h | 2 +- .../html/content/src/nsHTMLButtonElement.cpp | 12 +++- .../content/src/nsHTMLFieldSetElement.cpp | 8 ++- .../html/content/src/nsHTMLFieldSetElement.h | 1 + .../html/content/src/nsHTMLInputElement.cpp | 8 ++- content/html/content/src/nsHTMLInputElement.h | 1 + .../html/content/src/nsHTMLSelectElement.cpp | 12 ++-- .../html/content/src/nsHTMLSelectElement.h | 1 + .../content/src/nsHTMLTextAreaElement.cpp | 12 +++- content/xul/content/src/nsXULElement.cpp | 1 + dom/base/nsDOMWindowUtils.cpp | 24 +++++++ dom/interfaces/base/nsIDOMWindowUtils.idl | 9 ++- layout/base/nsPresShell.cpp | 28 -------- 21 files changed, 278 insertions(+), 50 deletions(-) create mode 100644 content/base/test/chrome/file_bug816340.xul create mode 100644 content/base/test/chrome/test_bug816340.xul diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index 44a9b2b47f8..ebfc82f8b7b 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -432,7 +432,8 @@ nsContextMenu.prototype = { setTarget: function (aNode, aRangeParent, aRangeOffset) { const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; if (aNode.namespaceURI == xulNS || - aNode.nodeType == Node.DOCUMENT_NODE) { + aNode.nodeType == Node.DOCUMENT_NODE || + this.isDisabledForEvents(aNode)) { this.shouldDisplay = false; return; } @@ -1290,6 +1291,16 @@ nsContextMenu.prototype = { "contextMenu.hasBGImage = " + this.hasBGImage + "\n"; }, + isDisabledForEvents: function(aNode) { + let ownerDoc = aNode.ownerDocument; + return + ownerDoc.defaultView && + ownerDoc.defaultView + .QueryInterface(Components.interfaces.nsIInterfaceRequestor) + .getInterface(Components.interfaces.nsIDOMWindowUtils) + .isNodeDisabledForEvents(aNode); + }, + isTargetATextBox: function(node) { if (node instanceof HTMLInputElement) return node.mozIsTextField(false); diff --git a/content/base/src/contentAreaDropListener.js b/content/base/src/contentAreaDropListener.js index b101dfc62b8..44afa67157f 100644 --- a/content/base/src/contentAreaDropListener.js +++ b/content/base/src/contentAreaDropListener.js @@ -95,6 +95,9 @@ ContentAreaDropListener.prototype = canDropLink: function(aEvent, aAllowSameDocument) { + if (this._eventTargetIsDisabled(aEvent)) + return false; + let dataTransfer = aEvent.dataTransfer; let types = dataTransfer.types; if (!types.contains("application/x-moz-file") && @@ -131,6 +134,8 @@ ContentAreaDropListener.prototype = dropLink: function(aEvent, aName, aDisallowInherit) { aName.value = ""; + if (this._eventTargetIsDisabled(aEvent)) + return ""; let dataTransfer = aEvent.dataTransfer; let [url, name] = this._getDropURL(dataTransfer); @@ -147,6 +152,18 @@ ContentAreaDropListener.prototype = aName.value = name; return url; + }, + + _eventTargetIsDisabled: function(aEvent) + { + let ownerDoc = aEvent.originalTarget.ownerDocument; + if (!ownerDoc || !ownerDoc.defaultView) + return false; + + return ownerDoc.defaultView + .QueryInterface(Components.interfaces.nsIInterfaceRequestor) + .getInterface(Components.interfaces.nsIDOMWindowUtils) + .isNodeDisabledForEvents(aEvent.originalTarget); } }; diff --git a/content/base/test/chrome/Makefile.in b/content/base/test/chrome/Makefile.in index b6eb355f19d..dfa45d89df7 100644 --- a/content/base/test/chrome/Makefile.in +++ b/content/base/test/chrome/Makefile.in @@ -49,6 +49,8 @@ MOCHITEST_CHROME_FILES = \ test_csp_bug768029.html \ test_bug800386.xul \ test_csp_bug773891.html \ + test_bug816340.xul \ + file_bug816340.xul \ test_domparsing.xul \ test_bug814638.xul \ host_bug814638.xul \ diff --git a/content/base/test/chrome/file_bug816340.xul b/content/base/test/chrome/file_bug816340.xul new file mode 100644 index 00000000000..bf980e43734 --- /dev/null +++ b/content/base/test/chrome/file_bug816340.xul @@ -0,0 +1,70 @@ + + + + + + diff --git a/content/base/test/chrome/test_bug816340.xul b/content/base/test/chrome/test_bug816340.xul new file mode 100644 index 00000000000..c6ad12b4290 --- /dev/null +++ b/content/base/test/chrome/test_bug816340.xul @@ -0,0 +1,31 @@ + + + + + + + + + + Mozilla Bug 816340 + + + + + diff --git a/content/events/public/nsEventDispatcher.h b/content/events/public/nsEventDispatcher.h index 2e3ee9dd44f..816546f6d94 100644 --- a/content/events/public/nsEventDispatcher.h +++ b/content/events/public/nsEventDispatcher.h @@ -100,15 +100,17 @@ public: nsEventStatus aEventStatus, bool aIsInAnon) : nsEventChainVisitor(aPresContext, aEvent, aDOMEvent, aEventStatus), - mCanHandle(true), mForceContentDispatch(false), - mRelatedTargetIsInAnon(false), mOriginalTargetIsInAnon(aIsInAnon), - mWantsWillHandleEvent(false), mMayHaveListenerManager(true), - mParentTarget(nullptr), mEventTargetAtParent(nullptr) {} + mCanHandle(true), mAutomaticChromeDispatch(true), + mForceContentDispatch(false), mRelatedTargetIsInAnon(false), + mOriginalTargetIsInAnon(aIsInAnon), mWantsWillHandleEvent(false), + mMayHaveListenerManager(true), mParentTarget(nullptr), + mEventTargetAtParent(nullptr) {} void Reset() { mItemFlags = 0; mItemData = nullptr; mCanHandle = true; + mAutomaticChromeDispatch = true; mForceContentDispatch = false; mWantsWillHandleEvent = false; mMayHaveListenerManager = true; @@ -124,6 +126,12 @@ public: */ bool mCanHandle; + /** + * If mCanHandle is false and mAutomaticChromeDispatch is also false + * event will not be dispatched to the chrome event handler. + */ + bool mAutomaticChromeDispatch; + /** * If mForceContentDispatch is set to true, * content dispatching is not disabled for this event target. diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp index 7c4815e65c6..17dc6bd757a 100644 --- a/content/events/src/nsEventDispatcher.cpp +++ b/content/events/src/nsEventDispatcher.cpp @@ -197,7 +197,7 @@ public: static void ResetMaxEtciCount() { - NS_ASSERTION(!sCurrentEtciCount, "Wrong time to call ResetMaxEtciCount()!"); + MOZ_ASSERT(!sCurrentEtciCount, "Wrong time to call ResetMaxEtciCount()!"); sMaxEtciCount = 0; } @@ -438,6 +438,30 @@ int32_t ChainItemPool::sEtciPoolUsers = 0; void NS_ShutdownChainItemPool() { ChainItemPool::Shutdown(); } +nsEventTargetChainItem* +EventTargetChainItemForChromeTarget(ChainItemPool& aPool, + nsINode* aNode, + nsEventTargetChainItem* aChild = nullptr) +{ + if (!aNode->IsInDoc()) { + return nullptr; + } + nsPIDOMWindow* win = aNode->OwnerDoc()->GetInnerWindow(); + nsIDOMEventTarget* piTarget = win ? win->GetParentTarget() : nullptr; + NS_ENSURE_TRUE(piTarget, nullptr); + + nsEventTargetChainItem* etci = + nsEventTargetChainItem::Create(aPool.GetPool(), + piTarget->GetTargetForEventTargetChain(), + aChild); + NS_ENSURE_TRUE(etci, nullptr); + if (!etci->IsValid()) { + nsEventTargetChainItem::Destroy(aPool.GetPool(), etci); + return nullptr; + } + return etci; +} + /* static */ nsresult nsEventDispatcher::Dispatch(nsISupports* aTarget, nsPresContext* aPresContext, @@ -577,6 +601,13 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, isInAnon); targetEtci->PreHandleEvent(preVisitor); + if (!preVisitor.mCanHandle && preVisitor.mAutomaticChromeDispatch && content) { + // Event target couldn't handle the event. Try to propagate to chrome. + nsEventTargetChainItem::Destroy(pool.GetPool(), targetEtci); + targetEtci = EventTargetChainItemForChromeTarget(pool, content); + NS_ENSURE_STATE(targetEtci); + targetEtci->PreHandleEvent(preVisitor); + } if (preVisitor.mCanHandle) { // At least the original target can handle the event. // Setting the retarget to the |target| simplifies retargeting code. @@ -584,6 +615,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, targetEtci->SetNewTarget(t); nsEventTargetChainItem* topEtci = targetEtci; while (preVisitor.mParentTarget) { + nsIDOMEventTarget* parentTarget = preVisitor.mParentTarget; nsEventTargetChainItem* parentEtci = nsEventTargetChainItem::Create(pool.GetPool(), preVisitor.mParentTarget, topEtci); @@ -610,6 +642,24 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, } else { nsEventTargetChainItem::Destroy(pool.GetPool(), parentEtci); parentEtci = nullptr; + if (preVisitor.mAutomaticChromeDispatch && content) { + // Even if the current target can't handle the event, try to + // propagate to chrome. + nsCOMPtr disabledTarget = do_QueryInterface(parentTarget); + if (disabledTarget) { + parentEtci = EventTargetChainItemForChromeTarget(pool, + disabledTarget, + topEtci); + if (parentEtci) { + parentEtci->PreHandleEvent(preVisitor); + if (preVisitor.mCanHandle) { + targetEtci->SetNewTarget(parentTarget); + topEtci = parentEtci; + continue; + } + } + } + } break; } } diff --git a/content/html/content/public/nsIFormControl.h b/content/html/content/public/nsIFormControl.h index 0905b61825a..6bebf21e428 100644 --- a/content/html/content/public/nsIFormControl.h +++ b/content/html/content/public/nsIFormControl.h @@ -70,8 +70,8 @@ PR_STATIC_ASSERT((uint32_t)eButtonElementTypesMax < (uint32_t)NS_FORM_INPUT_ELEM PR_STATIC_ASSERT((uint32_t)eInputElementTypesMax < 1<<8); #define NS_IFORMCONTROL_IID \ -{ 0xbc53dcf5, 0xbd4f, 0x4991, \ - { 0xa1, 0x87, 0xc4, 0x57, 0x98, 0x54, 0xda, 0x6e } } +{ 0x4b89980c, 0x4dcd, 0x428f, \ + { 0xb7, 0xad, 0x43, 0x5b, 0x93, 0x29, 0x79, 0xec } } /** * Interface which all form controls (e.g. buttons, checkboxes, text, @@ -182,6 +182,10 @@ public: */ inline bool AllowDraggableChildren() const; + virtual bool IsDisabledForEvents(uint32_t aMessage) + { + return false; + } protected: /** diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 5f364e2c307..be36cd8d64f 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -1178,7 +1178,7 @@ protected: void* aData); // Returns true if the event should not be handled from PreHandleEvent - virtual bool IsElementDisabledForEvents(uint32_t aMessage, nsIFrame* aFrame); + bool IsElementDisabledForEvents(uint32_t aMessage, nsIFrame* aFrame); // The focusability state of this form control. eUnfocusable means that it // shouldn't be focused at all, eInactiveWindow means it's in an inactive diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index 80d7201bd0c..31a3028c0eb 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -82,6 +82,7 @@ public: NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission); NS_IMETHOD SaveState(); bool RestoreState(nsPresState* aState); + virtual bool IsDisabledForEvents(uint32_t aMessage); nsEventStates IntrinsicState() const; @@ -251,17 +252,22 @@ nsHTMLButtonElement::ParseAttribute(int32_t aNamespaceID, aResult); } -nsresult -nsHTMLButtonElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) +bool +nsHTMLButtonElement::IsDisabledForEvents(uint32_t aMessage) { nsIFormControlFrame* formControlFrame = GetFormControlFrame(false); nsIFrame* formFrame = NULL; if (formControlFrame) { formFrame = do_QueryFrame(formControlFrame); } + return IsElementDisabledForEvents(aMessage, formFrame); +} +nsresult +nsHTMLButtonElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) +{ aVisitor.mCanHandle = false; - if (IsElementDisabledForEvents(aVisitor.mEvent->message, formFrame)) { + if (IsDisabledForEvents(aVisitor.mEvent->message)) { return NS_OK; } diff --git a/content/html/content/src/nsHTMLFieldSetElement.cpp b/content/html/content/src/nsHTMLFieldSetElement.cpp index c738840bbb3..ecce8d3e574 100644 --- a/content/html/content/src/nsHTMLFieldSetElement.cpp +++ b/content/html/content/src/nsHTMLFieldSetElement.cpp @@ -74,13 +74,19 @@ NS_IMPL_STRING_ATTR(nsHTMLFieldSetElement, Name, name) // nsIConstraintValidation NS_IMPL_NSICONSTRAINTVALIDATION(nsHTMLFieldSetElement) +bool +nsHTMLFieldSetElement::IsDisabledForEvents(uint32_t aMessage) +{ + return IsElementDisabledForEvents(aMessage, nullptr); +} + // nsIContent nsresult nsHTMLFieldSetElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) { // Do not process any DOM events if the element is disabled. aVisitor.mCanHandle = false; - if (IsElementDisabledForEvents(aVisitor.mEvent->message, NULL)) { + if (IsDisabledForEvents(aVisitor.mEvent->message)) { return NS_OK; } diff --git a/content/html/content/src/nsHTMLFieldSetElement.h b/content/html/content/src/nsHTMLFieldSetElement.h index 317358e1343..9a926582fb9 100644 --- a/content/html/content/src/nsHTMLFieldSetElement.h +++ b/content/html/content/src/nsHTMLFieldSetElement.h @@ -51,6 +51,7 @@ public: NS_IMETHOD_(uint32_t) GetType() const { return NS_FORM_FIELDSET; } NS_IMETHOD Reset(); NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission); + virtual bool IsDisabledForEvents(uint32_t aMessage); virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; virtual nsXPCClassInfo* GetClassInfo(); virtual nsIDOMNode* AsDOMNode() { return this; } diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 4fe4585f821..2fe32b5d353 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -2243,12 +2243,18 @@ nsHTMLInputElement::NeedToInitializeEditorForEvent(nsEventChainPreVisitor& aVisi } } +bool +nsHTMLInputElement::IsDisabledForEvents(uint32_t aMessage) +{ + return IsElementDisabledForEvents(aMessage, GetPrimaryFrame()); +} + nsresult nsHTMLInputElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) { // Do not process any DOM events if the element is disabled aVisitor.mCanHandle = false; - if (IsElementDisabledForEvents(aVisitor.mEvent->message, GetPrimaryFrame())) { + if (IsDisabledForEvents(aVisitor.mEvent->message)) { return NS_OK; } diff --git a/content/html/content/src/nsHTMLInputElement.h b/content/html/content/src/nsHTMLInputElement.h index 372cdecfa89..b20bcea4520 100644 --- a/content/html/content/src/nsHTMLInputElement.h +++ b/content/html/content/src/nsHTMLInputElement.h @@ -104,6 +104,7 @@ public: NS_IMETHOD SaveState(); virtual bool RestoreState(nsPresState* aState); virtual bool AllowDrop(); + virtual bool IsDisabledForEvents(uint32_t aMessage); virtual void FieldSetDisabledChanged(bool aNotify); diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp index e50f666b64a..aede0a51ad4 100644 --- a/content/html/content/src/nsHTMLSelectElement.cpp +++ b/content/html/content/src/nsHTMLSelectElement.cpp @@ -1483,18 +1483,22 @@ nsHTMLSelectElement::GetAttributeMappingFunction() const return &MapAttributesIntoRule; } - -nsresult -nsHTMLSelectElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) +bool +nsHTMLSelectElement::IsDisabledForEvents(uint32_t aMessage) { nsIFormControlFrame* formControlFrame = GetFormControlFrame(false); nsIFrame* formFrame = nullptr; if (formControlFrame) { formFrame = do_QueryFrame(formControlFrame); } + return IsElementDisabledForEvents(aMessage, formFrame); +} +nsresult +nsHTMLSelectElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) +{ aVisitor.mCanHandle = false; - if (IsElementDisabledForEvents(aVisitor.mEvent->message, formFrame)) { + if (IsDisabledForEvents(aVisitor.mEvent->message)) { return NS_OK; } diff --git a/content/html/content/src/nsHTMLSelectElement.h b/content/html/content/src/nsHTMLSelectElement.h index 278c9860cf6..592f5020576 100644 --- a/content/html/content/src/nsHTMLSelectElement.h +++ b/content/html/content/src/nsHTMLSelectElement.h @@ -271,6 +271,7 @@ public: NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission); NS_IMETHOD SaveState(); virtual bool RestoreState(nsPresState* aState); + virtual bool IsDisabledForEvents(uint32_t aMessage); virtual void FieldSetDisabledChanged(bool aNotify); diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index 535992000c8..51ae0a018cd 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -97,6 +97,7 @@ public: NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission); NS_IMETHOD SaveState(); virtual bool RestoreState(nsPresState* aState); + virtual bool IsDisabledForEvents(uint32_t aMessage); virtual void FieldSetDisabledChanged(bool aNotify); @@ -665,17 +666,22 @@ nsHTMLTextAreaElement::GetAttributeMappingFunction() const return &MapAttributesIntoRule; } -nsresult -nsHTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) +bool +nsHTMLTextAreaElement::IsDisabledForEvents(uint32_t aMessage) { nsIFormControlFrame* formControlFrame = GetFormControlFrame(false); nsIFrame* formFrame = NULL; if (formControlFrame) { formFrame = do_QueryFrame(formControlFrame); } + return IsElementDisabledForEvents(aMessage, formFrame); +} +nsresult +nsHTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) +{ aVisitor.mCanHandle = false; - if (IsElementDisabledForEvents(aVisitor.mEvent->message, formFrame)) { + if (IsDisabledForEvents(aVisitor.mEvent->message)) { return NS_OK; } diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 58ccaecebf0..7d841ee89bd 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -1126,6 +1126,7 @@ nsXULElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) // Stop building the event target chain for the original event. // We don't want it to propagate to any DOM nodes. aVisitor.mCanHandle = false; + aVisitor.mAutomaticChromeDispatch = false; // XXX sXBL/XBL2 issue! Owner or current document? nsCOMPtr domDoc(do_QueryInterface(GetCurrentDoc())); diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 4a492de1a77..ba78854a346 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -67,6 +67,7 @@ #include "nsIDOMFileHandle.h" #include "nsPrintfCString.h" #include "nsViewportInfo.h" +#include "nsIFormControl.h" using namespace mozilla; using namespace mozilla::dom; @@ -3090,3 +3091,26 @@ nsDOMWindowUtils::AllowScriptsToClose() static_cast(window.get())->AllowScriptsToClose(); return NS_OK; } + +NS_IMETHODIMP +nsDOMWindowUtils::IsNodeDisabledForEvents(nsIDOMNode* aNode, bool* aRetVal) +{ + *aRetVal = false; + if (!nsContentUtils::IsCallerChrome()) { + return NS_ERROR_DOM_SECURITY_ERR; + } + nsCOMPtr n = do_QueryInterface(aNode); + nsINode* node = n; + while (node) { + if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) { + nsCOMPtr fc = do_QueryInterface(node); + if (fc && fc->IsDisabledForEvents(NS_EVENT_NULL)) { + *aRetVal = true; + break; + } + } + node = node->GetParentNode(); + } + + return NS_OK; +} diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index d28e22d857c..2ea03cb3105 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -40,7 +40,7 @@ interface nsIDOMTouch; interface nsIDOMClientRect; interface nsIURI; -[scriptable, uuid(C98B7275-93C4-4EAD-B7CF-573D872C1071)] +[scriptable, uuid(2196a216-ed3c-46dd-aa24-9f5b3ac17539)] interface nsIDOMWindowUtils : nsISupports { /** @@ -1285,4 +1285,11 @@ interface nsIDOMWindowUtils : nsISupports { * was created can be closed using scripts. */ void allowScriptsToClose(); + + /** + * In certain cases the event handling of nodes, form controls in practice, + * may be disabled. Such cases are for example the existence of disabled + * attribute or -moz-user-input: none/disabled. + */ + boolean isNodeDisabledForEvents(in nsIDOMNode aNode); }; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 33eaa3e3ddc..83434a7012f 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -6563,34 +6563,6 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus) } } if (eventTarget) { -#ifdef MOZ_B2G - // Horrible hack for B2G to propagate events even from - // disabled form elements to chrome. See bug 804811. - // See also nsGenericHTMLFormElement::IsElementDisabledForEvents. - if (aEvent->message != NS_MOUSE_MOVE) { - nsINode* possibleFormElement = eventTarget->ChromeOnlyAccess() ? - static_cast(eventTarget.get())-> - FindFirstNonChromeOnlyAccessContent() : - eventTarget; - if (possibleFormElement && - possibleFormElement->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) { - nsEvent event(true, NS_EVENT_TYPE_NULL); - nsCOMArray targets; - nsEventDispatcher::Dispatch(eventTarget, nullptr, &event, nullptr, - nullptr, nullptr, &targets); - nsCOMPtr last; - if (targets.Count()) { - last = do_QueryInterface(targets[targets.Count() - 1]); - } - if (!targets.Count() || - (last && - nsContentUtils::ContentIsDescendantOf(last, - possibleFormElement))) { - aEvent->mFlags.mOnlyChromeDispatch = true; - } - } - } -#endif if (aEvent->eventStructType == NS_COMPOSITION_EVENT || aEvent->eventStructType == NS_TEXT_EVENT) { nsIMEStateManager::DispatchCompositionEvent(eventTarget, From b86f8dcd2636248986fbcbcb5b1d0005271e0cab Mon Sep 17 00:00:00 2001 From: Armen Zambrano Gasparnian Date: Thu, 3 Jan 2013 13:20:25 -0500 Subject: [PATCH 2/2] Bug 825259 - No working SUT agent on the b2g panda images - Add Negatus back to the nightly branch and update negatus snapshot used for panda builds. DONTBUILD. r=jgriffin --- b2g/config/panda/releng-pandaboard.tt | 4 ++-- b2g/config/panda/sources.xml | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/b2g/config/panda/releng-pandaboard.tt b/b2g/config/panda/releng-pandaboard.tt index 210f9c89fa3..542c9bbcc7b 100644 --- a/b2g/config/panda/releng-pandaboard.tt +++ b/b2g/config/panda/releng-pandaboard.tt @@ -1,7 +1,7 @@ [ { -"size": 676536592, -"digest": "5aa3f1b523faa8996dbcde44a99d846740f80b5361d3109f36688c7bac86979861311c4e7d69b67d9ea1d7c56e20947a30576b3e3f08f7c1e42ec4c2192d92e1", +"size": 676733720, +"digest": "6ae117e64af1e8532004e9de44f172b5db88f42a91b8821503b3832de6e168f8c000229705a5110ce294065780a6371e7852dd76ddd8f3c6113892a093b6fc55", "algorithm": "sha512", "filename": "gonk.tar.xz" } diff --git a/b2g/config/panda/sources.xml b/b2g/config/panda/sources.xml index 03f65390c0d..17e50fc1fa0 100644 --- a/b2g/config/panda/sources.xml +++ b/b2g/config/panda/sources.xml @@ -10,11 +10,11 @@ - + - + @@ -94,5 +94,6 @@ - + + \ No newline at end of file