Title: [243556] trunk
Revision
243556
Author
za...@apple.com
Date
2019-03-27 12:05:27 -0700 (Wed, 27 Mar 2019)

Log Message

[ContentChangeObserver] Stop using the global _WKContentChange
https://bugs.webkit.org/show_bug.cgi?id=196288
<rdar://problem/49228081>

Reviewed by Simon Fraser.

Source/WebCore:

This patch ensures that activities on frames don't overwrite the observed state on other frames.
(Unfortunately the global variable is still used in WebKitLegacy (see webkit.org/b/196286)).

Tests: fast/events/touch/ios/content-observation/remove-subframe-while-observing.html
       fast/events/touch/ios/content-observation/subframe.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::observedContentChange const): Deleted.
* page/ios/ContentChangeObserver.h:
(WebCore::ContentChangeObserver::observedContentChange const):
(WebCore::ContentChangeObserver::setHasNoChangeState):
(WebCore::ContentChangeObserver::setHasIndeterminateState):
(WebCore::ContentChangeObserver::setHasVisibleChangeState):
(WebCore::ContentChangeObserver::setObservedContentState):

LayoutTests:

* fast/events/touch/ios/content-observation/remove-subframe-while-observing-expected.txt: Added.
* fast/events/touch/ios/content-observation/remove-subframe-while-observing.html: Added.
* fast/events/touch/ios/content-observation/subframe.html: Added.
* platform/ios-device-wk1/TestExpectations:
* platform/ios-simulator-wk1/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (243555 => 243556)


--- trunk/LayoutTests/ChangeLog	2019-03-27 18:56:05 UTC (rev 243555)
+++ trunk/LayoutTests/ChangeLog	2019-03-27 19:05:27 UTC (rev 243556)
@@ -1,3 +1,17 @@
+2019-03-27  Zalan Bujtas  <za...@apple.com>
+
+        [ContentChangeObserver] Stop using the global _WKContentChange
+        https://bugs.webkit.org/show_bug.cgi?id=196288
+        <rdar://problem/49228081>
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/content-observation/remove-subframe-while-observing-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/remove-subframe-while-observing.html: Added.
+        * fast/events/touch/ios/content-observation/subframe.html: Added.
+        * platform/ios-device-wk1/TestExpectations:
+        * platform/ios-simulator-wk1/TestExpectations:
+
 2019-03-27  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Remove the SVG tear off objects for SVGPathSeg, SVGPathSegList and SVGAnimatedPathSegList

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/remove-subframe-while-observing-expected.txt (0 => 243556)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/remove-subframe-while-observing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/remove-subframe-while-observing-expected.txt	2019-03-27 19:05:27 UTC (rev 243556)
@@ -0,0 +1,2 @@
+PASS if 'clicked' text is not shown below.
+

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/remove-subframe-while-observing.html (0 => 243556)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/remove-subframe-while-observing.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/remove-subframe-while-observing.html	2019-03-27 19:05:27 UTC (rev 243556)
@@ -0,0 +1,63 @@
+<html>
+<head>
+<title>This tests the case when visible content change happens on the main frame while the subframe is removed</title>
+<script src=""
+<style>
+#tapthis {
+    width: 400px;
+    height: 400px;
+    border: 1px solid green;
+}
+
+#becomesVisible {
+    display: none;
+    width: 100px;
+    height: 100px;
+    background-color: green;
+}
+</style>
+<script>
+async function test() {
+    if (!window.testRunner || !testRunner.runUIScript)
+        return;
+    if (window.internals)
+        internals.settings.setContentChangeObserverEnabled(true);
+
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+
+    let rect = tapthis.getBoundingClientRect();
+    let x = rect.left + rect.width / 2;
+    let y = rect.top + rect.height / 2;
+
+    await tapAtPoint(x, y);
+}
+</script>
+</head>
+<body _onload_="test()">
+<div id=tapthis>PASS if 'clicked' text is not shown below.</div>
+<div id=becomesVisible></div>
+<iframe id=removeThis src=""
+<pre id=result></pre>
+<script>
+tapthis.addEventListener("mousemove", function( event ) {
+    becomesVisible.style.display = "block";
+    document.body.offsetHeight;
+
+    let iframeToRemove = document.getElementById("removeThis");
+    if (iframeToRemove)
+        iframeToRemove.remove();
+    if (window.testRunner)
+        setTimeout("testRunner.notifyDone()", 250);
+}, false);
+
+becomesVisible.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked hidden";
+}, false);
+
+tapthis.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked";
+}, false);
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/subframe.html (0 => 243556)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/subframe.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/subframe.html	2019-03-27 19:05:27 UTC (rev 243556)
@@ -0,0 +1 @@
+subframe content
\ No newline at end of file

Modified: trunk/LayoutTests/platform/ios-device-wk1/TestExpectations (243555 => 243556)


--- trunk/LayoutTests/platform/ios-device-wk1/TestExpectations	2019-03-27 18:56:05 UTC (rev 243555)
+++ trunk/LayoutTests/platform/ios-device-wk1/TestExpectations	2019-03-27 19:05:27 UTC (rev 243556)
@@ -3,3 +3,4 @@
 # See http://trac.webkit.org/wiki/TestExpectations for more information on this file.
 #
 
+webkit.org/b/196286 fast/events/touch/ios/content-observation/remove-subframe-while-observing.html [ Failure ]

Modified: trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations (243555 => 243556)


--- trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations	2019-03-27 18:56:05 UTC (rev 243555)
+++ trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations	2019-03-27 19:05:27 UTC (rev 243556)
@@ -14,3 +14,5 @@
 editing/pasteboard/data-transfer-item-list-add-file-on-copy.html [ Pass ]
 editing/pasteboard/data-transfer-item-list-add-file-multiple-times.html [ Pass ]
 editing/pasteboard/data-transfer-items-add-custom-data.html [ Pass ]
+
+webkit.org/b/196286 fast/events/touch/ios/content-observation/remove-subframe-while-observing.html [ Failure ]
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (243555 => 243556)


--- trunk/Source/WebCore/ChangeLog	2019-03-27 18:56:05 UTC (rev 243555)
+++ trunk/Source/WebCore/ChangeLog	2019-03-27 19:05:27 UTC (rev 243556)
@@ -1,3 +1,26 @@
+2019-03-27  Zalan Bujtas  <za...@apple.com>
+
+        [ContentChangeObserver] Stop using the global _WKContentChange
+        https://bugs.webkit.org/show_bug.cgi?id=196288
+        <rdar://problem/49228081>
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that activities on frames don't overwrite the observed state on other frames.  
+        (Unfortunately the global variable is still used in WebKitLegacy (see webkit.org/b/196286)).
+
+        Tests: fast/events/touch/ios/content-observation/remove-subframe-while-observing.html
+               fast/events/touch/ios/content-observation/subframe.html
+
+        * page/ios/ContentChangeObserver.cpp:
+        (WebCore::ContentChangeObserver::observedContentChange const): Deleted.
+        * page/ios/ContentChangeObserver.h:
+        (WebCore::ContentChangeObserver::observedContentChange const):
+        (WebCore::ContentChangeObserver::setHasNoChangeState):
+        (WebCore::ContentChangeObserver::setHasIndeterminateState):
+        (WebCore::ContentChangeObserver::setHasVisibleChangeState):
+        (WebCore::ContentChangeObserver::setObservedContentState):
+
 2019-03-27  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Remove the SVG tear off objects for SVGPathSeg, SVGPathSegList and SVGAnimatedPathSegList

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp (243555 => 243556)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-27 18:56:05 UTC (rev 243555)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-27 19:05:27 UTC (rev 243556)
@@ -334,11 +334,6 @@
     m_mouseMovedEventIsBeingDispatched = false;
 }
 
-WKContentChange ContentChangeObserver::observedContentChange() const
-{
-    return WKObservedContentChange();
-}
-
 void ContentChangeObserver::setShouldObserveNextStyleRecalc(bool shouldObserve)
 {
     if (shouldObserve)

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.h (243555 => 243556)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.h	2019-03-27 18:56:05 UTC (rev 243555)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.h	2019-03-27 19:05:27 UTC (rev 243556)
@@ -45,7 +45,7 @@
     ContentChangeObserver(Document&);
 
     WEBCORE_EXPORT void startContentObservationForDuration(Seconds duration);
-    WEBCORE_EXPORT WKContentChange observedContentChange() const;
+    WKContentChange observedContentChange() const { return m_observedContentState; }
 
     void didInstallDOMTimer(const DOMTimer&, Seconds timeout, bool singleShot);
     void didRemoveDOMTimer(const DOMTimer&);
@@ -142,9 +142,9 @@
     void stopObservingPendingActivities();
     void reset();
 
-    void setHasIndeterminateState();
-    void setHasVisibleChangeState();
-    void setHasNoChangeState();
+    void setHasNoChangeState() { setObservedContentState(WKContentNoChange); }
+    void setHasIndeterminateState() { setObservedContentState(WKContentIndeterminateChange); }
+    void setHasVisibleChangeState() { setObservedContentState(WKContentVisibilityChange); } 
 
     bool hasVisibleChangeState() const { return observedContentChange() == WKContentVisibilityChange; }
     bool hasObservedDOMTimer() const { return !m_DOMTimerList.isEmpty(); }
@@ -158,6 +158,7 @@
     bool isObservationTimeWindowActive() const { return m_contentObservationTimer.isActive(); }
 
     void completeDurationBasedContentObservation();
+    void setObservedContentState(WKContentChange);
 
     enum class Event {
         StartedTouchStartEventDispatching,
@@ -186,6 +187,7 @@
     HashSet<const DOMTimer*> m_DOMTimerList;
     // FIXME: Move over to WeakHashSet when it starts supporting const.
     HashSet<const Element*> m_elementsWithTransition;
+    WKContentChange m_observedContentState { WKContentNoChange };
     bool m_touchEventIsBeingDispatched { false };
     bool m_isWaitingForStyleRecalc { false };
     bool m_isInObservedStyleRecalc { false };
@@ -196,22 +198,12 @@
     bool m_isObservingTransitions { false };
 };
 
-inline void ContentChangeObserver::setHasNoChangeState()
+inline void ContentChangeObserver::setObservedContentState(WKContentChange observedContentChange)
 {
-    WKSetObservedContentChange(WKContentNoChange);
+    m_observedContentState = observedContentChange;
+    WKSetObservedContentChange(observedContentChange);
 }
 
-inline void ContentChangeObserver::setHasIndeterminateState()
-{
-    ASSERT(!hasVisibleChangeState());
-    WKSetObservedContentChange(WKContentIndeterminateChange);
-}
-
-inline void ContentChangeObserver::setHasVisibleChangeState()
-{
-    WKSetObservedContentChange(WKContentVisibilityChange);
-}
-
 inline bool ContentChangeObserver::isObservingContentChanges() const
 {
     return m_touchEventIsBeingDispatched
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to