Title: [248093] branches/safari-608-branch
Revision
248093
Author
[email protected]
Date
2019-07-31 18:23:14 -0700 (Wed, 31 Jul 2019)

Log Message

Cherry-pick r248080. rdar://problem/53788956

    [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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248080 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-608-branch/LayoutTests/ChangeLog (248092 => 248093)


--- branches/safari-608-branch/LayoutTests/ChangeLog	2019-08-01 01:23:10 UTC (rev 248092)
+++ branches/safari-608-branch/LayoutTests/ChangeLog	2019-08-01 01:23:14 UTC (rev 248093)
@@ -1,5 +1,49 @@
 2019-07-31  Alan Coon  <[email protected]>
 
+        Cherry-pick r248080. rdar://problem/53788956
+
+    [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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248080 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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  Alan Coon  <[email protected]>
+
         Cherry-pick r248071. rdar://problem/53789003
 
     Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage

Added: branches/safari-608-branch/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode-expected.txt (0 => 248093)


--- branches/safari-608-branch/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode-expected.txt	2019-08-01 01:23:14 UTC (rev 248093)
@@ -0,0 +1,4 @@
+PASS if 'clicked' text is shown below.
+clicked
+END OF TEST
+

Added: branches/safari-608-branch/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html (0 => 248093)


--- branches/safari-608-branch/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html	2019-08-01 01:23:14 UTC (rev 248093)
@@ -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: branches/safari-608-branch/LayoutTests/platform/ios/TestExpectations (248092 => 248093)


--- branches/safari-608-branch/LayoutTests/platform/ios/TestExpectations	2019-08-01 01:23:10 UTC (rev 248092)
+++ branches/safari-608-branch/LayoutTests/platform/ios/TestExpectations	2019-08-01 01:23:14 UTC (rev 248093)
@@ -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: branches/safari-608-branch/Source/WebCore/ChangeLog (248092 => 248093)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-08-01 01:23:10 UTC (rev 248092)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-08-01 01:23:14 UTC (rev 248093)
@@ -1,5 +1,56 @@
 2019-07-31  Alan Coon  <[email protected]>
 
+        Cherry-pick r248080. rdar://problem/53788956
+
+    [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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248080 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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  Alan Coon  <[email protected]>
+
         Cherry-pick r248079. rdar://problem/53788988
 
     [iPadOS] Enable simulated mouse events on iqiyi.com to fix the video controls

Modified: branches/safari-608-branch/Source/WebCore/page/ios/ContentChangeObserver.cpp (248092 => 248093)


--- branches/safari-608-branch/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-08-01 01:23:10 UTC (rev 248092)
+++ branches/safari-608-branch/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-08-01 01:23:14 UTC (rev 248093)
@@ -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