Title: [138189] branches/chromium/1364
- Revision
- 138189
- Author
- le...@chromium.org
- Date
- 2012-12-19 12:47:05 -0800 (Wed, 19 Dec 2012)
Log Message
Merge 138095
> Input elements with default touch handlers don't update handler counts when changing documents
> https://bugs.webkit.org/show_bug.cgi?id=105334
>
> Reviewed by James Robinson.
>
> Source/WebCore:
>
> When an Input element with default touch event handlers changes documents, it failed to
> update the touch event handler sets in both the old and new document. This patch fixes this
> case.
>
> Test: fast/events/touch/touch-input-element-change-documents.html
>
> * dom/Document.h:
> (WebCore::Document::didRemoveTouchEventTargetNode) This function makes sense when touch
> handling is enabled, regardless of whether we're tracking the rects.
> * dom/Document.cpp:
> * html/HTMLInputElement.cpp:
> (WebCore::HTMLInputElement::~HTMLInputElement): Switch from didRemoveTouchEventHandler to
> didRemoveTouchEventTargetNode, since we don't care about counts in the destructor.
> (WebCore::HTMLInputElement::updateType): Fixing incorrect indentation.
> (WebCore::HTMLInputElement::didMoveToNewDocument): Adding the node to the new document and
> removing it from the old.
>
> LayoutTests:
>
> * fast/events/touch/touch-input-element-change-documents-expected.txt: Added.
> * fast/events/touch/touch-input-element-change-documents.html: Added.
>
TBR=le...@chromium.org
Review URL: https://codereview.chromium.org/11649024
Modified Paths
Added Paths
Diff
Copied: branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt (from rev 138095, trunk/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt) (0 => 138189)
--- branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt 2012-12-19 20:47:05 UTC (rev 138189)
@@ -0,0 +1,12 @@
+This test checks that we correctly update the touch event handler count when an Input element with default touch handlers changes documents.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.internals.touchEventHandlerCount(document) is 0
+PASS window.internals.touchEventHandlerCount(document) is 0
+PASS window.internals.touchEventHandlerCount(document) is 2
+PASS window.internals.touchEventHandlerCount(document) is 3
+PASS window.internals.touchEventHandlerCount(document) is 2
+PASS window.internals.touchEventHandlerCount(document) is 0
+
Copied: branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents.html (from rev 138095, trunk/LayoutTests/fast/events/touch/touch-input-element-change-documents.html) (0 => 138189)
--- branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents.html (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents.html 2012-12-19 20:47:05 UTC (rev 138189)
@@ -0,0 +1,30 @@
+<script src=""
+<div id='container'></div>
+<script>
+description("This test checks that we correctly update the touch event handler count when an Input element with default touch handlers changes documents.");
+
+
+ shouldBe('window.internals.touchEventHandlerCount(document)', '0');
+
+ // There are two touchable Input elements in Audio's shadow DOM when controls are enabled.
+ var input = document.createElement('audio');
+ input.setAttribute("controls", true);
+ var container = document.getElementById('container');
+
+ shouldBe('window.internals.touchEventHandlerCount(document)', '0');
+
+ container.appendChild(input);
+ shouldBe('window.internals.touchEventHandlerCount(document)', '2');
+
+ input._ontouchend_ = function() { };
+ shouldBe('window.internals.touchEventHandlerCount(document)', '3');
+
+ input._ontouchend_ = null;
+ shouldBe('window.internals.touchEventHandlerCount(document)', '2');
+
+ document.implementation.createDocument("", "", null).adoptNode(input);
+ shouldBe('window.internals.touchEventHandlerCount(document)', '0');
+
+
+</script>
+</body>
Modified: branches/chromium/1364/Source/WebCore/dom/Document.cpp (138188 => 138189)
--- branches/chromium/1364/Source/WebCore/dom/Document.cpp 2012-12-19 20:45:11 UTC (rev 138188)
+++ branches/chromium/1364/Source/WebCore/dom/Document.cpp 2012-12-19 20:47:05 UTC (rev 138189)
@@ -5654,7 +5654,7 @@
#endif
}
-#if ENABLE(TOUCH_EVENT_TRACKING)
+#if ENABLE(TOUCH_EVENTS)
void Document::didRemoveEventTargetNode(Node* handler)
{
if (m_touchEventTargets.get())
Modified: branches/chromium/1364/Source/WebCore/dom/Document.h (138188 => 138189)
--- branches/chromium/1364/Source/WebCore/dom/Document.h 2012-12-19 20:45:11 UTC (rev 138188)
+++ branches/chromium/1364/Source/WebCore/dom/Document.h 2012-12-19 20:47:05 UTC (rev 138189)
@@ -1128,7 +1128,7 @@
void didAddTouchEventHandler(Node*);
void didRemoveTouchEventHandler(Node*);
-#if ENABLE(TOUCH_EVENT_TRACKING)
+#if ENABLE(TOUCH_EVENTS)
void didRemoveEventTargetNode(Node*);
#endif
Modified: branches/chromium/1364/Source/WebCore/html/HTMLInputElement.cpp (138188 => 138189)
--- branches/chromium/1364/Source/WebCore/html/HTMLInputElement.cpp 2012-12-19 20:45:11 UTC (rev 138188)
+++ branches/chromium/1364/Source/WebCore/html/HTMLInputElement.cpp 2012-12-19 20:47:05 UTC (rev 138189)
@@ -163,7 +163,7 @@
document()->formController()->checkedRadioButtons().removeButton(this);
#if ENABLE(TOUCH_EVENTS)
if (m_hasTouchEventHandler)
- document()->didRemoveTouchEventHandler(this);
+ document()->didRemoveEventTargetNode(this);
#endif
}
@@ -488,11 +488,11 @@
#if ENABLE(TOUCH_EVENTS)
bool hasTouchEventHandler = m_inputType->hasTouchEventHandler();
if (hasTouchEventHandler != m_hasTouchEventHandler) {
- if (hasTouchEventHandler)
- document()->didAddTouchEventHandler(this);
- else
- document()->didRemoveTouchEventHandler(this);
- m_hasTouchEventHandler = hasTouchEventHandler;
+ if (hasTouchEventHandler)
+ document()->didAddTouchEventHandler(this);
+ else
+ document()->didRemoveTouchEventHandler(this);
+ m_hasTouchEventHandler = hasTouchEventHandler;
}
#endif
@@ -1499,11 +1499,20 @@
oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
if (isRadioButton())
oldDocument->formController()->checkedRadioButtons().removeButton(this);
+#if ENABLE(TOUCH_EVENTS)
+ if (m_hasTouchEventHandler)
+ oldDocument->didRemoveEventTargetNode(this);
+#endif
}
if (needsSuspensionCallback)
document()->registerForPageCacheSuspensionCallbacks(this);
+#if ENABLE(TOUCH_EVENTS)
+ if (m_hasTouchEventHandler)
+ document()->didAddTouchEventHandler(this);
+#endif
+
HTMLTextFormControlElement::didMoveToNewDocument(oldDocument);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes