Skip to content
Permalink
Browse files
[Extra zoom mode] Disabled adaptations are not reset upon mainframe n…
…avigation

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.


Canonical link: https://commits.webkit.org/201202@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231915 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
whsieh committed May 17, 2018
1 parent 4c4f902 commit 88cfcfbaca300f02586e64cafffd30abb44f40b7
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 2 deletions.
@@ -1,3 +1,16 @@
2018-05-17 Wenson Hsieh <wenson_hsieh@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 <cdumez@apple.com>

Cross-Origin-Options: deny/allow-postmessage should prevent getting navigated by cross-origin scripts
@@ -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="../../../resources/ui-helper.js"></script>
<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>
@@ -1,3 +1,23 @@
2018-05-17 Wenson Hsieh <wenson_hsieh@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.carlson@apple.com>

[iOS] Update AirPlay route monitoring
@@ -2229,6 +2229,7 @@ void Document::didBecomeCurrentDocumentInFrame()
if (!hasLivingRenderTree())
createRenderTree();

dispatchDisabledAdaptationsDidChangeForMainFrame();
updateViewportArguments();

// FIXME: Doing this only for the main frame is insufficient.
@@ -3417,9 +3418,18 @@ void Document::processDisabledAdaptations(const String& disabledAdaptationsStrin
return;

m_disabledAdaptations = disabledAdaptations;
dispatchDisabledAdaptationsDidChangeForMainFrame();
}

void Document::dispatchDisabledAdaptationsDidChangeForMainFrame()
{
if (!frame()->isMainFrame())
return;

if (!page())
return;

if (page() && frame()->isMainFrame())
page()->chrome().dispatchDisabledAdaptationsDidChange(m_disabledAdaptations);
page()->chrome().dispatchDisabledAdaptationsDidChange(m_disabledAdaptations);
}

void Document::processViewport(const String& features, ViewportArguments::Type origin)
@@ -1506,6 +1506,8 @@ class Document
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);

0 comments on commit 88cfcfb

Please sign in to comment.