Index: Source/WebCore/dom/Node.cpp |
=================================================================== |
--- Source/WebCore/dom/Node.cpp (revision 146891) |
+++ Source/WebCore/dom/Node.cpp (working copy) |
@@ -903,6 +903,14 @@ |
return this; |
} |
+#if ENABLE(DIALOG_ELEMENT) |
+bool Node::isInert() const |
+{ |
+ Element* dialog = document()->activeModalDialog(); |
+ return dialog && !containsIncludingShadowDOM(dialog) && !dialog->containsIncludingShadowDOM(this); |
+} |
+#endif |
+ |
unsigned Node::nodeIndex() const |
{ |
Node *_tempNode = previousSibling(); |
@@ -2310,7 +2318,7 @@ |
if (!hasEventTargetData()) |
return; |
- if (isElementNode() && toElement(this)->disabled() && event->isMouseEvent()) |
+ if (disabled() && event->isMouseEvent()) |
return; |
fireEventListeners(event); |
@@ -2450,6 +2458,15 @@ |
dispatchScopedEvent(Event::create(eventNames().inputEvent, true, false)); |
} |
+bool Node::disabled() const |
+{ |
+#if ENABLE(DIALOG_ELEMENT) |
+ if (isInert()) |
+ return true; |
+#endif |
+ return false; |
+} |
+ |
void Node::defaultEventHandler(Event* event) |
{ |
if (event->target() != this) |
@@ -2509,14 +2526,14 @@ |
bool Node::willRespondToMouseMoveEvents() |
{ |
- if (isElementNode() && toElement(this)->disabled()) |
+ if (disabled()) |
return false; |
return hasEventListeners(eventNames().mousemoveEvent) || hasEventListeners(eventNames().mouseoverEvent) || hasEventListeners(eventNames().mouseoutEvent); |
} |
bool Node::willRespondToMouseClickEvents() |
{ |
- if (isElementNode() && toElement(this)->disabled()) |
+ if (disabled()) |
return false; |
return isContentEditable(UserSelectAllIsAlwaysNonEditable) || hasEventListeners(eventNames().mouseupEvent) || hasEventListeners(eventNames().mousedownEvent) || hasEventListeners(eventNames().clickEvent) || hasEventListeners(eventNames().DOMActivateEvent); |
} |
@@ -2524,7 +2541,7 @@ |
bool Node::willRespondToTouchEvents() |
{ |
#if ENABLE(TOUCH_EVENTS) |
- if (isElementNode() && toElement(this)->disabled()) |
+ if (disabled()) |
return false; |
return hasEventListeners(eventNames().touchstartEvent) || hasEventListeners(eventNames().touchmoveEvent) || hasEventListeners(eventNames().touchcancelEvent) || hasEventListeners(eventNames().touchendEvent); |
#else |