Title: [138181] trunk
- Revision
- 138181
- Author
- le...@chromium.org
- Date
- 2012-12-19 11:22:12 -0800 (Wed, 19 Dec 2012)
Log Message
Correct missing touch event handler de-registration for nested Documents and DOMWindows
https://bugs.webkit.org/show_bug.cgi?id=105384
Reviewed by James Robinson.
Source/WebCore:
Correcting case by which a nested DOMWindow wouldn't clean up its event handler references
on its Document when removeAllEventListeners was called. Also, correctly propagating this
from a nested Document to its owner Document.
Updating fast/events/touch/touch-handler-count.html to catch this bug.
* dom/Document.cpp:
(WebCore::Document::didRemoveEventTargetNode):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::removeAllEventListeners):
LayoutTests:
* fast/events/touch/touch-handler-count-expected.txt:
* fast/events/touch/touch-handler-count.html: Adding case of nested DOMWindows with event handlers.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (138180 => 138181)
--- trunk/LayoutTests/ChangeLog 2012-12-19 19:20:38 UTC (rev 138180)
+++ trunk/LayoutTests/ChangeLog 2012-12-19 19:22:12 UTC (rev 138181)
@@ -1,5 +1,15 @@
2012-12-19 Levi Weintraub <le...@chromium.org>
+ Correct missing touch event handler de-registration for nested Documents and DOMWindows
+ https://bugs.webkit.org/show_bug.cgi?id=105384
+
+ Reviewed by James Robinson.
+
+ * fast/events/touch/touch-handler-count-expected.txt:
+ * fast/events/touch/touch-handler-count.html: Adding case of nested DOMWindows with event handlers.
+
+2012-12-19 Levi Weintraub <le...@chromium.org>
+
Unreviewed gardening. The previous rebaseline didn't quite get it right for Mac.
* platform/chromium-mac-lion/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png:
Modified: trunk/LayoutTests/fast/events/touch/touch-handler-count-expected.txt (138180 => 138181)
--- trunk/LayoutTests/fast/events/touch/touch-handler-count-expected.txt 2012-12-19 19:20:38 UTC (rev 138180)
+++ trunk/LayoutTests/fast/events/touch/touch-handler-count-expected.txt 2012-12-19 19:22:12 UTC (rev 138181)
@@ -71,4 +71,8 @@
PASS window.internals.touchEventHandlerCount(document) is 2
PASS window.internals.touchEventHandlerCount(document) is 2
PASS window.internals.touchEventHandlerCount(document) is 0
+Test that nested Documents' touch handlers are properly removed from their parent Document.
+PASS window.internals.touchEventHandlerCount(document) is 0
+PASS window.internals.touchEventHandlerCount(document) is 1
+PASS window.internals.touchEventHandlerCount(document) is 0
Modified: trunk/LayoutTests/fast/events/touch/touch-handler-count.html (138180 => 138181)
--- trunk/LayoutTests/fast/events/touch/touch-handler-count.html 2012-12-19 19:20:38 UTC (rev 138180)
+++ trunk/LayoutTests/fast/events/touch/touch-handler-count.html 2012-12-19 19:22:12 UTC (rev 138181)
@@ -204,5 +204,24 @@
shouldBe('window.internals.touchEventHandlerCount(document)', '0');
})();
+debug("Test that nested Documents' touch handlers are properly removed from their parent Document.");
+(function() {
+ var iframe = document.createElement('iframe');
+ var touchtarget = document.getElementById('touchtarget');
+
+ shouldBe('window.internals.touchEventHandlerCount(document)', '0');
+
+ touchtarget.appendChild(iframe);
+
+ var nestedDocument = iframe.contentWindow.document;
+ nestedDocument.open('text/html', 'replace');
+ nestedDocument.write("<!DOCTYPE html>\n<html><body _onload_=\"window._ontouchstart_ = function() { };\"></body>");
+ nestedDocument.close();
+
+ shouldBe('window.internals.touchEventHandlerCount(document)', '1');
+
+ touchtarget.removeChild(iframe);
+ shouldBe('window.internals.touchEventHandlerCount(document)', '0');
+})();
</script>
</body>
Modified: trunk/Source/WebCore/ChangeLog (138180 => 138181)
--- trunk/Source/WebCore/ChangeLog 2012-12-19 19:20:38 UTC (rev 138180)
+++ trunk/Source/WebCore/ChangeLog 2012-12-19 19:22:12 UTC (rev 138181)
@@ -1,3 +1,21 @@
+2012-12-19 Levi Weintraub <le...@chromium.org>
+
+ Correct missing touch event handler de-registration for nested Documents and DOMWindows
+ https://bugs.webkit.org/show_bug.cgi?id=105384
+
+ Reviewed by James Robinson.
+
+ Correcting case by which a nested DOMWindow wouldn't clean up its event handler references
+ on its Document when removeAllEventListeners was called. Also, correctly propagating this
+ from a nested Document to its owner Document.
+
+ Updating fast/events/touch/touch-handler-count.html to catch this bug.
+
+ * dom/Document.cpp:
+ (WebCore::Document::didRemoveEventTargetNode):
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::removeAllEventListeners):
+
2012-12-18 Simon Fraser <simon.fra...@apple.com>
Fix regression from r137923 that caused all tiles to paint when scrolling
Modified: trunk/Source/WebCore/dom/Document.cpp (138180 => 138181)
--- trunk/Source/WebCore/dom/Document.cpp 2012-12-19 19:20:38 UTC (rev 138180)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-12-19 19:22:12 UTC (rev 138181)
@@ -5659,6 +5659,9 @@
{
if (m_touchEventTargets.get())
m_touchEventTargets->removeAll(handler);
+ if (handler == this)
+ if (Document* parentDocument = this->parentDocument())
+ parentDocument->didRemoveEventTargetNode(this);
}
#endif
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (138180 => 138181)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2012-12-19 19:20:38 UTC (rev 138180)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2012-12-19 19:22:12 UTC (rev 138181)
@@ -1685,6 +1685,10 @@
if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
controller->removeAllDeviceEventListeners(this);
#endif
+#if ENABLE(TOUCH_EVENTS)
+ if (Document* document = this->document())
+ document->didRemoveEventTargetNode(document);
+#endif
removeAllUnloadEventListeners(this);
removeAllBeforeUnloadEventListeners(this);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes