Title: [138208] branches/chromium/1364
Revision
138208
Author
k...@chromium.org
Date
2012-12-19 17:36:29 -0800 (Wed, 19 Dec 2012)

Log Message

Revert 138189
> 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

TBR=le...@chromium.org
Review URL: https://codereview.chromium.org/11571072

Modified Paths

Removed Paths

Diff

Deleted: branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt (138207 => 138208)


--- branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt	2012-12-20 01:34:41 UTC (rev 138207)
+++ branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt	2012-12-20 01:36:29 UTC (rev 138208)
@@ -1,12 +0,0 @@
-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
-

Deleted: branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents.html (138207 => 138208)


--- branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents.html	2012-12-20 01:34:41 UTC (rev 138207)
+++ branches/chromium/1364/LayoutTests/fast/events/touch/touch-input-element-change-documents.html	2012-12-20 01:36:29 UTC (rev 138208)
@@ -1,30 +0,0 @@
-<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 (138207 => 138208)


--- branches/chromium/1364/Source/WebCore/dom/Document.cpp	2012-12-20 01:34:41 UTC (rev 138207)
+++ branches/chromium/1364/Source/WebCore/dom/Document.cpp	2012-12-20 01:36:29 UTC (rev 138208)
@@ -5654,7 +5654,7 @@
 #endif
 }
 
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(TOUCH_EVENT_TRACKING)
 void Document::didRemoveEventTargetNode(Node* handler)
 {
     if (m_touchEventTargets.get())

Modified: branches/chromium/1364/Source/WebCore/dom/Document.h (138207 => 138208)


--- branches/chromium/1364/Source/WebCore/dom/Document.h	2012-12-20 01:34:41 UTC (rev 138207)
+++ branches/chromium/1364/Source/WebCore/dom/Document.h	2012-12-20 01:36:29 UTC (rev 138208)
@@ -1128,7 +1128,7 @@
     void didAddTouchEventHandler(Node*);
     void didRemoveTouchEventHandler(Node*);
 
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(TOUCH_EVENT_TRACKING)
     void didRemoveEventTargetNode(Node*);
 #endif
 

Modified: branches/chromium/1364/Source/WebCore/html/HTMLInputElement.cpp (138207 => 138208)


--- branches/chromium/1364/Source/WebCore/html/HTMLInputElement.cpp	2012-12-20 01:34:41 UTC (rev 138207)
+++ branches/chromium/1364/Source/WebCore/html/HTMLInputElement.cpp	2012-12-20 01:36:29 UTC (rev 138208)
@@ -163,7 +163,7 @@
         document()->formController()->checkedRadioButtons().removeButton(this);
 #if ENABLE(TOUCH_EVENTS)
     if (m_hasTouchEventHandler)
-        document()->didRemoveEventTargetNode(this);
+        document()->didRemoveTouchEventHandler(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,20 +1499,11 @@
             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

Reply via email to