Title: [263858] trunk
Revision
263858
Author
grao...@webkit.org
Date
2020-07-02 13:35:14 -0700 (Thu, 02 Jul 2020)

Log Message

visualViewport.addEventListener("scroll"*** fires permanently after zoom or orientation change
https://bugs.webkit.org/show_bug.cgi?id=211522
<rdar://problem/62939371>

Reviewed by Simon Fraser.

Source/WebCore:

Correctly set the flag indicating that a scroll event has been dispatched on the visual viewport.

Test: fast/visual-viewport/scroll-event-fired-during-scroll-alone.html

* dom/Document.cpp:
(WebCore::Document::runScrollSteps):

LayoutTests:

Add a test that checks that after a call to scrollTo() no further "scroll" events are dispatched on window.visualViewport.

* fast/visual-viewport/scroll-event-fired-during-scroll-alone-expected.txt: Added.
* fast/visual-viewport/scroll-event-fired-during-scroll-alone.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (263857 => 263858)


--- trunk/LayoutTests/ChangeLog	2020-07-02 20:26:56 UTC (rev 263857)
+++ trunk/LayoutTests/ChangeLog	2020-07-02 20:35:14 UTC (rev 263858)
@@ -1,3 +1,16 @@
+2020-07-02  Antoine Quint  <grao...@webkit.org>
+
+        visualViewport.addEventListener("scroll"*** fires permanently after zoom or orientation change
+        https://bugs.webkit.org/show_bug.cgi?id=211522
+        <rdar://problem/62939371>
+
+        Reviewed by Simon Fraser.
+
+        Add a test that checks that after a call to scrollTo() no further "scroll" events are dispatched on window.visualViewport.
+
+        * fast/visual-viewport/scroll-event-fired-during-scroll-alone-expected.txt: Added.
+        * fast/visual-viewport/scroll-event-fired-during-scroll-alone.html: Added.
+
 2020-07-02  Chris Dumez  <cdu...@apple.com>
 
         Resync web-platform-tests/html/browsers from upstream

Added: trunk/LayoutTests/fast/visual-viewport/scroll-event-fired-during-scroll-alone-expected.txt (0 => 263858)


--- trunk/LayoutTests/fast/visual-viewport/scroll-event-fired-during-scroll-alone-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/visual-viewport/scroll-event-fired-during-scroll-alone-expected.txt	2020-07-02 20:35:14 UTC (rev 263858)
@@ -0,0 +1,3 @@
+
+PASS Verify that a scroll event gets fired on window.visualViewport when its offset changes but not after the scroll has completed. 
+

Added: trunk/LayoutTests/fast/visual-viewport/scroll-event-fired-during-scroll-alone.html (0 => 263858)


--- trunk/LayoutTests/fast/visual-viewport/scroll-event-fired-during-scroll-alone.html	                        (rev 0)
+++ trunk/LayoutTests/fast/visual-viewport/scroll-event-fired-during-scroll-alone.html	2020-07-02 20:35:14 UTC (rev 263858)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<style>
+  body {
+    height: 2000px;
+    width: 2000px;
+  }
+</style>
+
+<script src=""
+<script src=""
+<script>
+
+    function getUIScript() {
+        const pageScaleFactor = 2;
+        return `(function() {
+            uiController.zoomToScale(${pageScaleFactor}, function() {
+                uiController.uiScriptComplete(uiController.zoomScale);
+            });
+        })();`;
+    }
+
+    let numScrollEvents = 0;
+    window.visualViewport.addEventListener("scroll", event => numScrollEvents++);
+
+    promise_test(async () => {
+        await new Promise(resolve => window.addEventListener("load", resolve));
+        await new Promise(resolve => testRunner.runUIScript(getUIScript(), resolve));
+
+        window.scrollTo(1000, 1000);
+        await new Promise(requestAnimationFrame);
+        assert_not_equals(numScrollEvents, 0, "Calling window.scrollTo() caused 'scroll' events to be dispatched.");
+
+        const numScrollEventsAfterScroll = numScrollEvents;
+        await new Promise(requestAnimationFrame);
+        assert_equals(numScrollEventsAfterScroll, numScrollEvents, "There were no additional scroll events after scrolling.");
+    }, "Verify that a scroll event gets fired on window.visualViewport when its offset changes but not after the scroll has completed.");
+
+</script>

Modified: trunk/Source/WebCore/ChangeLog (263857 => 263858)


--- trunk/Source/WebCore/ChangeLog	2020-07-02 20:26:56 UTC (rev 263857)
+++ trunk/Source/WebCore/ChangeLog	2020-07-02 20:35:14 UTC (rev 263858)
@@ -1,3 +1,18 @@
+2020-07-02  Antoine Quint  <grao...@webkit.org>
+
+        visualViewport.addEventListener("scroll"*** fires permanently after zoom or orientation change
+        https://bugs.webkit.org/show_bug.cgi?id=211522
+        <rdar://problem/62939371>
+
+        Reviewed by Simon Fraser.
+
+        Correctly set the flag indicating that a scroll event has been dispatched on the visual viewport.
+
+        Test: fast/visual-viewport/scroll-event-fired-during-scroll-alone.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::runScrollSteps):
+
 2020-07-02  Zalan Bujtas  <za...@apple.com>
 
         Overlapping content on earny.co

Modified: trunk/Source/WebCore/dom/Document.cpp (263857 => 263858)


--- trunk/Source/WebCore/dom/Document.cpp	2020-07-02 20:26:56 UTC (rev 263857)
+++ trunk/Source/WebCore/dom/Document.cpp	2020-07-02 20:35:14 UTC (rev 263858)
@@ -4130,7 +4130,7 @@
     }
     if (m_needsVisualViewportScrollEvent) {
         LOG_WITH_STREAM(Events, stream << "Document" << this << "sending scroll events to visualViewport");
-        m_needsVisualViewportResizeEvent = false;
+        m_needsVisualViewportScrollEvent = false;
         if (auto* window = domWindow())
             window->visualViewport().dispatchEvent(Event::create(eventNames().scrollEvent, Event::CanBubble::No, Event::IsCancelable::No));
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to