Title: [243413] trunk
Revision
243413
Author
[email protected]
Date
2019-03-23 13:47:47 -0700 (Sat, 23 Mar 2019)

Log Message

[ContentChangeObserver] Check if the transitioned content is visible at onAnimationEnd
https://bugs.webkit.org/show_bug.cgi?id=196171

Reviewed by Simon Fraser.

Source/WebCore:

At onAnimationEnd we don't yet have the final computed style for the transitioned content.
However the current state (before computing the final style) might already be qualified to be visible.
Introduce "CompletedTransition" to indicate that the transition is all set as far observing is concerned
(as opposed to "EndedTransition" where we still need to observe the content for the final style change).

Test: fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::didFinishTransition):
(WebCore::ContentChangeObserver::adjustObservedState):
* page/ios/ContentChangeObserver.h:

LayoutTests:

* fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end-expected.txt: Added.
* fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (243412 => 243413)


--- trunk/LayoutTests/ChangeLog	2019-03-23 16:39:01 UTC (rev 243412)
+++ trunk/LayoutTests/ChangeLog	2019-03-23 20:47:47 UTC (rev 243413)
@@ -1,3 +1,13 @@
+2019-03-23  Zalan Bujtas  <[email protected]>
+
+        [ContentChangeObserver] Check if the transitioned content is visible at onAnimationEnd
+        https://bugs.webkit.org/show_bug.cgi?id=196171
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end.html: Added.
+
 2019-03-22  Devin Rousso  <[email protected]>
 
         Unreviewed, fix test failures after r243269.

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end-expected.txt (0 => 243413)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end-expected.txt	2019-03-23 20:47:47 UTC (rev 243413)
@@ -0,0 +1,2 @@
+PASS if 'clicked' text is not shown below.
+

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end.html (0 => 243413)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end.html	2019-03-23 20:47:47 UTC (rev 243413)
@@ -0,0 +1,60 @@
+<html>
+<head>
+<title>This tests the case when touchEnd triggers a 0ms transition with delay.</title>
+<script src=""
+<style>
+#tapthis {
+    width: 400px;
+    height: 400px;
+    border: 1px solid green;
+}
+
+#becomesVisible {
+	position: absolute;
+	top: 100px;
+	left: -110px;
+	width: 100px;
+	height: 100px;
+	background-color: green;
+	transition: left 200ms ease-in-out 10ms;
+}
+</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>
+<pre id=result></pre>
+<script>
+tapthis.addEventListener("mousemove", function( event ) {
+    becomesVisible.style.left = "400px";
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+
+becomesVisible.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked hidden";
+}, false);
+
+tapthis.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked";
+}, false);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (243412 => 243413)


--- trunk/Source/WebCore/ChangeLog	2019-03-23 16:39:01 UTC (rev 243412)
+++ trunk/Source/WebCore/ChangeLog	2019-03-23 20:47:47 UTC (rev 243413)
@@ -1,3 +1,22 @@
+2019-03-23  Zalan Bujtas  <[email protected]>
+
+        [ContentChangeObserver] Check if the transitioned content is visible at onAnimationEnd
+        https://bugs.webkit.org/show_bug.cgi?id=196171
+
+        Reviewed by Simon Fraser.
+
+        At onAnimationEnd we don't yet have the final computed style for the transitioned content.
+        However the current state (before computing the final style) might already be qualified to be visible.
+        Introduce "CompletedTransition" to indicate that the transition is all set as far observing is concerned
+        (as opposed to "EndedTransition" where we still need to observe the content for the final style change).
+
+        Test: fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-with-non-0px-end.html
+
+        * page/ios/ContentChangeObserver.cpp:
+        (WebCore::ContentChangeObserver::didFinishTransition):
+        (WebCore::ContentChangeObserver::adjustObservedState):
+        * page/ios/ContentChangeObserver.h:
+
 2019-03-23  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Remove build time dependency on Geoclue2

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp (243412 => 243413)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-23 16:39:01 UTC (rev 243412)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-23 20:47:47 UTC (rev 243413)
@@ -152,7 +152,7 @@
         return;
     LOG_WITH_STREAM(ContentObservation, stream << "didFinishTransition: transition finished (" << &element << ").");
 
-    adjustObservedState(Event::EndedTransition);
+    adjustObservedState(isConsideredHidden(element) ? Event::EndedTransition : Event::CompletedTransition);
 }
 
 void ContentChangeObserver::didRemoveTransition(const Element& element, CSSPropertyID propertyID)
@@ -434,7 +434,7 @@
         break;
     case Event::EndedTransition:
         // onAnimationEnd can be called while in the middle of resolving the document (synchronously) or
-        // asynchronously right before the style update is issued.
+        // asynchronously right before the style update is issued. It also means we don't know whether this animation ends up producing visible content yet. 
         if (m_document.inStyleRecalc()) {
             // We need to start observing this style change synchronously.
             m_isInObservedStyleRecalc = true;
@@ -441,6 +441,14 @@
         } else
             setShouldObserveNextStyleRecalc(true);
         break;
+    case Event::CompletedTransition:
+        // Set visibility flag on and report visible change synchronously or asynchronously depending whether we are in the middle of style recalc.
+        contentVisibilityDidChange();
+        if (m_document.inStyleRecalc())
+            m_isInObservedStyleRecalc = true;
+        else if (!isObservationTimeWindowActive())
+            adjustStateAndNotifyContentChangeIfNeeded();
+        break;
     case Event::EndedFixedObservationTimeWindow:
         adjustStateAndNotifyContentChangeIfNeeded();
         break;

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.h (243412 => 243413)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.h	2019-03-23 16:39:01 UTC (rev 243412)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.h	2019-03-23 20:47:47 UTC (rev 243413)
@@ -173,6 +173,7 @@
         EndedStyleRecalc,
         AddedTransition,
         EndedTransition,
+        CompletedTransition,
         CanceledTransition,
         StartedFixedObservationTimeWindow,
         EndedFixedObservationTimeWindow,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to