Title: [248080] trunk
Revision
248080
Author
[email protected]
Date
2019-07-31 16:01:43 -0700 (Wed, 31 Jul 2019)

Log Message

[ContentChangeObserver] twitch.tv video controls do not always respond to taps in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=200309
<rdar://problem/52964977>

Reviewed by Simon Fraser.

Source/WebCore:

Do not consider an element visible if it is not a descendant of the active fullscreen element.

This patch fixes the cases when the user taps on a button in fullscreen mode while the non-fullscreen content is being mutated and
the ContentChangeObserver mistakenly registers it as a valid, actionable change and as a result we don't fire the click event (stay at hover).

Test: fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::fullscreenElement):
(WebCore::ContentChangeObserver::isVisuallyHidden):

LayoutTests:

* fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode-expected.txt: Added.
* fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html: Added.
* platform/ios/TestExpectations: Fullscreen API is not yet enabled on iOS.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (248079 => 248080)


--- trunk/LayoutTests/ChangeLog	2019-07-31 22:58:01 UTC (rev 248079)
+++ trunk/LayoutTests/ChangeLog	2019-07-31 23:01:43 UTC (rev 248080)
@@ -1,3 +1,15 @@
+2019-07-31  Zalan Bujtas  <[email protected]>
+
+        [ContentChangeObserver] twitch.tv video controls do not always respond to taps in fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=200309
+        <rdar://problem/52964977>
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html: Added.
+        * platform/ios/TestExpectations: Fullscreen API is not yet enabled on iOS.
+
 2019-07-31  Saam Barati  <[email protected]>
 
         [WHLSL Remove char/short/half types

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode-expected.txt (0 => 248080)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode-expected.txt	2019-07-31 23:01:43 UTC (rev 248080)
@@ -0,0 +1,4 @@
+PASS if 'clicked' text is shown below.
+clicked
+END OF TEST
+

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html (0 => 248080)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html	2019-07-31 23:01:43 UTC (rev 248080)
@@ -0,0 +1,70 @@
+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<title>This tests the case when the tap target node is not part of the fullscreen content -> hidden -> click</title>
+<script src=""
+<script src=""
+<style>
+#becomesVisible {
+    visibility: hidden;
+    width: 100px;
+    height: 100px;
+    background-color: green;
+}
+#tapThis {
+    width: 50px;
+    height: 50px;
+    background-color: blue;
+}
+</style>
+<script>
+async function test() {
+    if (!window.testRunner || !testRunner.runUIScript)
+        return;
+    if (window.internals) {
+        internals.settings.setContentChangeObserverEnabled(true);
+        internals.settings.setFullScreenEnabled(true);
+    }
+
+    testRunner.dumpAsText();
+
+    if ("webkitRequestFullScreen" in Element.prototype) {
+        var fullscreenChanged = async function(event) {
+            fullscreen.offsetHeight;
+
+            await UIHelper.activateElement(tapThis);
+        };
+        document.addEventListener('webkitfullscreenchange', fullscreenChanged);
+
+        runWithKeyDown(function () {
+            fullscreen.webkitRequestFullScreen();
+        });
+    } else {
+        consoleWrite("FAILED, couldn't find webkitRequestFullScreen.");
+        endTest();
+    }
+
+}
+</script>
+</head>
+<body _onload_="test()">
+PASS if 'clicked' text is shown below.<br>
+<div id=fullscreen><div id=tapThis></div></div>
+<div id=becomesVisible></div>
+<pre id=result></pre>
+<script>
+tapThis.addEventListener("mousemove", function( event ) {
+    becomesVisible.style.visibility = "visible";
+}, false);
+
+becomesVisible.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked hidden";
+}, false);
+
+tapThis.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked";
+    endTest();
+}, false);
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (248079 => 248080)


--- trunk/LayoutTests/platform/ios/TestExpectations	2019-07-31 22:58:01 UTC (rev 248079)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2019-07-31 23:01:43 UTC (rev 248080)
@@ -37,6 +37,7 @@
 fullscreen
 http/tests/fullscreen
 compositing/no-compositing-when-fulll-screen-is-present.html
+webkit.org/b/200308 fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html [ Skip ]
 
 # WebGPU is not enabled on iOS Simulator.
 webgpu [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (248079 => 248080)


--- trunk/Source/WebCore/ChangeLog	2019-07-31 22:58:01 UTC (rev 248079)
+++ trunk/Source/WebCore/ChangeLog	2019-07-31 23:01:43 UTC (rev 248080)
@@ -1,3 +1,22 @@
+2019-07-31  Zalan Bujtas  <[email protected]>
+
+        [ContentChangeObserver] twitch.tv video controls do not always respond to taps in fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=200309
+        <rdar://problem/52964977>
+
+        Reviewed by Simon Fraser.
+
+        Do not consider an element visible if it is not a descendant of the active fullscreen element.
+
+        This patch fixes the cases when the user taps on a button in fullscreen mode while the non-fullscreen content is being mutated and
+        the ContentChangeObserver mistakenly registers it as a valid, actionable change and as a result we don't fire the click event (stay at hover).
+
+        Test: fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html
+
+        * page/ios/ContentChangeObserver.cpp:
+        (WebCore::fullscreenElement):
+        (WebCore::ContentChangeObserver::isVisuallyHidden):
+
 2019-07-31  Saam Barati  <[email protected]>
 
         [WHLSL Remove char/short/half types

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp (248079 => 248080)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-07-31 22:58:01 UTC (rev 248079)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-07-31 23:01:43 UTC (rev 248080)
@@ -30,6 +30,7 @@
 #include "ChromeClient.h"
 #include "DOMTimer.h"
 #include "Document.h"
+#include "FullscreenManager.h"
 #include "HTMLIFrameElement.h"
 #include "HTMLImageElement.h"
 #include "Logging.h"
@@ -43,6 +44,23 @@
 static const Seconds maximumDelayForTimers { 400_ms };
 static const Seconds maximumDelayForTransitions { 300_ms };
 
+#if ENABLE(FULLSCREEN_API)
+static bool isHiddenBehindFullscreenElement(const Node& descendantCandidate)
+{
+    // Fullscreen status is propagated on the ancestor document chain all the way to the top document.
+    auto& document = descendantCandidate.document();
+    auto* topMostFullScreenElement = document.topDocument().fullscreenManager().fullscreenElement();
+    if (!topMostFullScreenElement)
+        return false;
+
+    // If the document where the node lives does not have an active fullscreen element, it is a sibling/nephew document -> not a descendant.
+    auto* fullscreenElement = document.fullscreenManager().fullscreenElement();
+    if (!fullscreenElement)
+        return true;
+    return !descendantCandidate.isDescendantOf(*fullscreenElement);
+}
+#endif
+
 bool ContentChangeObserver::isVisuallyHidden(const Node& node)
 {
     if (!node.renderStyle())
@@ -88,6 +106,11 @@
         if (!parent->renderStyle() || !parent->renderStyle()->opacity())
             return true;
     }
+
+#if ENABLE(FULLSCREEN_API)
+    if (isHiddenBehindFullscreenElement(node))
+        return true;
+#endif
     return false;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to