Title: [121166] trunk
- Revision
- 121166
- Author
- [email protected]
- Date
- 2012-06-25 10:39:07 -0700 (Mon, 25 Jun 2012)
Log Message
ASSERT(m_wheelEventHandlerCount > 0) can fire
https://bugs.webkit.org/show_bug.cgi?id=89856
Reviewed by Eric Seidel.
Source/WebCore:
When a node with a wheel or a touch event is moved from one document to
another, the didAddMumble/didRemoveMumble calls do not balance because
they're called on different documents. This patch twiddles the counts
appropriately in that case.
Test: fast/events/move-element-with-wheel-and-touch-event-listeners.html
* dom/EventNames.h:
(WebCore::EventNames::isTouchEventType):
(EventNames):
(WebCore::EventNames::touchEventNames):
* dom/Node.cpp:
(WebCore::Node::didMoveToNewDocument):
LayoutTests:
Test what happens when we move a node with wheel and/or touch events
from one document to another. Prior to this patch, this test triggers
ASSERT(m_wheelEventHandlerCount > 0) in Document.cpp.
* fast/events/move-element-with-wheel-and-touch-event-listeners-expected.txt: Added.
* fast/events/move-element-with-wheel-and-touch-event-listeners.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (121165 => 121166)
--- trunk/LayoutTests/ChangeLog 2012-06-25 17:38:32 UTC (rev 121165)
+++ trunk/LayoutTests/ChangeLog 2012-06-25 17:39:07 UTC (rev 121166)
@@ -1,3 +1,17 @@
+2012-06-25 Adam Barth <[email protected]>
+
+ ASSERT(m_wheelEventHandlerCount > 0) can fire
+ https://bugs.webkit.org/show_bug.cgi?id=89856
+
+ Reviewed by Eric Seidel.
+
+ Test what happens when we move a node with wheel and/or touch events
+ from one document to another. Prior to this patch, this test triggers
+ ASSERT(m_wheelEventHandlerCount > 0) in Document.cpp.
+
+ * fast/events/move-element-with-wheel-and-touch-event-listeners-expected.txt: Added.
+ * fast/events/move-element-with-wheel-and-touch-event-listeners.html: Added.
+
2012-06-25 Shinya Kawanaka <[email protected]>
[Shadow] Executing Italic and InsertUnorderedList in Shadow DOM causes a crash
Added: trunk/LayoutTests/fast/events/move-element-with-wheel-and-touch-event-listeners-expected.txt (0 => 121166)
--- trunk/LayoutTests/fast/events/move-element-with-wheel-and-touch-event-listeners-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/move-element-with-wheel-and-touch-event-listeners-expected.txt 2012-06-25 17:39:07 UTC (rev 121166)
@@ -0,0 +1,2 @@
+ This test passes if it doesn't crash.
+
Added: trunk/LayoutTests/fast/events/move-element-with-wheel-and-touch-event-listeners.html (0 => 121166)
--- trunk/LayoutTests/fast/events/move-element-with-wheel-and-touch-event-listeners.html (rev 0)
+++ trunk/LayoutTests/fast/events/move-element-with-wheel-and-touch-event-listeners.html 2012-06-25 17:39:07 UTC (rev 121166)
@@ -0,0 +1,21 @@
+<iframe src="" id=foo></div>"></iframe>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+function doNothing() {
+}
+
+addEventListener("load", function() {
+ var element = frames[0].document.getElementById("foo");
+
+ element.addEventListener("mousewheel", doNothing, false);
+ element.addEventListener("touchstart", doNothing, false);
+
+ document.body.appendChild(element);
+
+ element.removeEventListener("mousewheel", doNothing, false);
+ element.removeEventListener("touchstart", doNothing, false);
+}, false);
+</script>
+This test passes if it doesn't crash.
Modified: trunk/Source/WebCore/ChangeLog (121165 => 121166)
--- trunk/Source/WebCore/ChangeLog 2012-06-25 17:38:32 UTC (rev 121165)
+++ trunk/Source/WebCore/ChangeLog 2012-06-25 17:39:07 UTC (rev 121166)
@@ -1,3 +1,24 @@
+2012-06-25 Adam Barth <[email protected]>
+
+ ASSERT(m_wheelEventHandlerCount > 0) can fire
+ https://bugs.webkit.org/show_bug.cgi?id=89856
+
+ Reviewed by Eric Seidel.
+
+ When a node with a wheel or a touch event is moved from one document to
+ another, the didAddMumble/didRemoveMumble calls do not balance because
+ they're called on different documents. This patch twiddles the counts
+ appropriately in that case.
+
+ Test: fast/events/move-element-with-wheel-and-touch-event-listeners.html
+
+ * dom/EventNames.h:
+ (WebCore::EventNames::isTouchEventType):
+ (EventNames):
+ (WebCore::EventNames::touchEventNames):
+ * dom/Node.cpp:
+ (WebCore::Node::didMoveToNewDocument):
+
2012-06-25 Eric Seidel <[email protected]>
Split map* functions out of StyleResolver into a helper object
Modified: trunk/Source/WebCore/dom/EventNames.h (121165 => 121166)
--- trunk/Source/WebCore/dom/EventNames.h 2012-06-25 17:38:32 UTC (rev 121165)
+++ trunk/Source/WebCore/dom/EventNames.h 2012-06-25 17:39:07 UTC (rev 121166)
@@ -251,8 +251,22 @@
inline bool isTouchEventType(const AtomicString& eventType) const
{
- return eventType == touchstartEvent || eventType == touchmoveEvent || eventType == touchendEvent || eventType == touchcancelEvent;
+ return eventType == touchstartEvent
+ || eventType == touchmoveEvent
+ || eventType == touchendEvent
+ || eventType == touchcancelEvent;
}
+
+ Vector<AtomicString> touchEventNames() const
+ {
+ Vector<AtomicString> names;
+ names.reserveCapacity(4);
+ names.append(touchstartEvent);
+ names.append(touchmoveEvent);
+ names.append(touchendEvent);
+ names.append(touchcancelEvent);
+ return names;
+ }
};
inline EventNames& eventNames()
Modified: trunk/Source/WebCore/dom/Node.cpp (121165 => 121166)
--- trunk/Source/WebCore/dom/Node.cpp 2012-06-25 17:38:32 UTC (rev 121165)
+++ trunk/Source/WebCore/dom/Node.cpp 2012-06-25 17:39:07 UTC (rev 121166)
@@ -2309,6 +2309,21 @@
// FIXME: Event listener types for this node should be set on the new owner document here.
+ const EventListenerVector& wheelListeners = getEventListeners(eventNames().mousewheelEvent);
+ for (size_t i = 0; i < wheelListeners.size(); ++i) {
+ oldDocument->didRemoveWheelEventHandler();
+ document()->didAddWheelEventHandler();
+ }
+
+ Vector<AtomicString> touchEventNames = eventNames().touchEventNames();
+ for (size_t i = 0; i < touchEventNames.size(); ++i) {
+ const EventListenerVector& listeners = getEventListeners(touchEventNames[i]);
+ for (size_t j = 0; j < listeners.size(); ++j) {
+ oldDocument->didRemoveTouchEventHandler();
+ document()->didAddTouchEventHandler();
+ }
+ }
+
#if ENABLE(MUTATION_OBSERVERS)
if (Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserverRegistry()) {
for (size_t i = 0; i < registry->size(); ++i) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes