Title: [231915] trunk
Revision
231915
Author
wenson_hs...@apple.com
Date
2018-05-17 12:20:28 -0700 (Thu, 17 May 2018)

Log Message

[Extra zoom mode] Disabled adaptations are not reset upon mainframe navigation
https://bugs.webkit.org/show_bug.cgi?id=185735
<rdar://problem/40335311>

Reviewed by Tim Horton.

Source/WebCore:

When performing mainframe navigation, we currently don't update the Page's ViewportConfiguration's disabled
adaptations. This causes disabled adaptations from the previous main document to persist. To fix this, propagate
the new document's disabled adaptations to the client when it becomes the main document in the page.

Test: fast/viewport/extrazoom/viewport-adaptations-after-navigation.html

* dom/Document.cpp:
(WebCore::Document::didBecomeCurrentDocumentInFrame):
(WebCore::Document::processDisabledAdaptations):
(WebCore::Document::dispatchDisabledAdaptationsDidChangeForMainFrame):
* dom/Document.h:

LayoutTests:

Adds a new layout test that disables extra zoom mode adaptations, navigates to a new document, and checks that
the innerWidth and innerHeight are reset to their expected (default) values.

* fast/viewport/extrazoom/viewport-adaptations-after-navigation.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231914 => 231915)


--- trunk/LayoutTests/ChangeLog	2018-05-17 18:47:06 UTC (rev 231914)
+++ trunk/LayoutTests/ChangeLog	2018-05-17 19:20:28 UTC (rev 231915)
@@ -1,3 +1,16 @@
+2018-05-17  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Extra zoom mode] Disabled adaptations are not reset upon mainframe navigation
+        https://bugs.webkit.org/show_bug.cgi?id=185735
+        <rdar://problem/40335311>
+
+        Reviewed by Tim Horton.
+
+        Adds a new layout test that disables extra zoom mode adaptations, navigates to a new document, and checks that
+        the innerWidth and innerHeight are reset to their expected (default) values.
+
+        * fast/viewport/extrazoom/viewport-adaptations-after-navigation.html: Added.
+
 2018-05-17  Chris Dumez  <cdu...@apple.com>
 
         Cross-Origin-Options: deny/allow-postmessage should prevent getting navigated by cross-origin scripts

Added: trunk/LayoutTests/fast/viewport/extrazoom/viewport-adaptations-after-navigation.html (0 => 231915)


--- trunk/LayoutTests/fast/viewport/extrazoom/viewport-adaptations-after-navigation.html	                        (rev 0)
+++ trunk/LayoutTests/fast/viewport/extrazoom/viewport-adaptations-after-navigation.html	2018-05-17 19:20:28 UTC (rev 231915)
@@ -0,0 +1,41 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<head>
+    <script src=""
+    <style>
+        body, html {
+            margin: 0;
+            width: 100%;
+            height: 100%;
+        }
+    </style>
+    <script>
+        async function runTest() {
+            if (!window.testRunner) {
+                description("Please use WebKitTestRunner to run this test.");
+                return;
+            }
+
+            const matches = location.search.match(/previousSize=([0-9]+),([0-9]+)/);
+            if (matches) {
+                document.write(`previous size: (${parseInt(matches[1])}, ${parseInt(matches[2])}); current size: (${innerWidth}, ${innerHeight})`);
+                testRunner.notifyDone();
+                return;
+            }
+
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+
+            const meta = document.createElement("meta");
+            meta.setAttribute("name", "disabled-adaptations");
+            meta.setAttribute("content", internals.extraZoomModeAdaptationName());
+            document.head.appendChild(meta);
+            await UIHelper.ensureVisibleContentRectUpdate();
+
+            location.href += `?previousSize=${innerWidth},${innerHeight}`;
+        }
+    </script>
+</head>
+<body _onload_="runTest()"></body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (231914 => 231915)


--- trunk/Source/WebCore/ChangeLog	2018-05-17 18:47:06 UTC (rev 231914)
+++ trunk/Source/WebCore/ChangeLog	2018-05-17 19:20:28 UTC (rev 231915)
@@ -1,3 +1,23 @@
+2018-05-17  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Extra zoom mode] Disabled adaptations are not reset upon mainframe navigation
+        https://bugs.webkit.org/show_bug.cgi?id=185735
+        <rdar://problem/40335311>
+
+        Reviewed by Tim Horton.
+
+        When performing mainframe navigation, we currently don't update the Page's ViewportConfiguration's disabled
+        adaptations. This causes disabled adaptations from the previous main document to persist. To fix this, propagate
+        the new document's disabled adaptations to the client when it becomes the main document in the page.
+
+        Test: fast/viewport/extrazoom/viewport-adaptations-after-navigation.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::didBecomeCurrentDocumentInFrame):
+        (WebCore::Document::processDisabledAdaptations):
+        (WebCore::Document::dispatchDisabledAdaptationsDidChangeForMainFrame):
+        * dom/Document.h:
+
 2018-05-17  Eric Carlson  <eric.carl...@apple.com>
 
         [iOS] Update AirPlay route monitoring

Modified: trunk/Source/WebCore/dom/Document.cpp (231914 => 231915)


--- trunk/Source/WebCore/dom/Document.cpp	2018-05-17 18:47:06 UTC (rev 231914)
+++ trunk/Source/WebCore/dom/Document.cpp	2018-05-17 19:20:28 UTC (rev 231915)
@@ -2229,6 +2229,7 @@
     if (!hasLivingRenderTree())
         createRenderTree();
 
+    dispatchDisabledAdaptationsDidChangeForMainFrame();
     updateViewportArguments();
 
     // FIXME: Doing this only for the main frame is insufficient.
@@ -3417,9 +3418,18 @@
         return;
 
     m_disabledAdaptations = disabledAdaptations;
+    dispatchDisabledAdaptationsDidChangeForMainFrame();
+}
 
-    if (page() && frame()->isMainFrame())
-        page()->chrome().dispatchDisabledAdaptationsDidChange(m_disabledAdaptations);
+void Document::dispatchDisabledAdaptationsDidChangeForMainFrame()
+{
+    if (!frame()->isMainFrame())
+        return;
+
+    if (!page())
+        return;
+
+    page()->chrome().dispatchDisabledAdaptationsDidChange(m_disabledAdaptations);
 }
 
 void Document::processViewport(const String& features, ViewportArguments::Type origin)

Modified: trunk/Source/WebCore/dom/Document.h (231914 => 231915)


--- trunk/Source/WebCore/dom/Document.h	2018-05-17 18:47:06 UTC (rev 231914)
+++ trunk/Source/WebCore/dom/Document.h	2018-05-17 19:20:28 UTC (rev 231915)
@@ -1506,6 +1506,8 @@
     void addDocumentToFullScreenChangeEventQueue(Document*);
 #endif
 
+    void dispatchDisabledAdaptationsDidChangeForMainFrame();
+
 #if ENABLE(TELEPHONE_NUMBER_DETECTION)
     friend void setParserFeature(const String& key, const String& value, Document*, void* userData);
     void setIsTelephoneNumberParsingAllowed(bool);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to