Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1930363002: Avoid clobbering state in viewport tag initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 3a08cfb7e1398a606ce73915bb0c1b314137e08a..83dccc328cae5b967cd24fbeec54850047387add 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -3150,47 +3150,46 @@ void Document::maybeHandleHttpRefresh(const String& content, HttpRefreshType htt
m_frame->navigationScheduler().scheduleRedirect(delay, refreshURL);
}
-bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin)
+bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin) const
{
return settings() && settings()->viewportMetaMergeContentQuirk() && m_legacyViewportDescription.isMetaViewportType() && m_legacyViewportDescription.type == origin;
}
void Document::setViewportDescription(const ViewportDescription& viewportDescription)
{
- if (viewportDescription == m_viewportDescription)
- return;
-
- if (settings() && !settings()->viewportMetaEnabled() && viewportDescription.isLegacyViewportType())
- return;
-
- // The UA-defined min-width is used by the processing of legacy meta tags.
- if (!viewportDescription.isSpecifiedByAuthor())
- m_viewportDefaultMinWidth = viewportDescription.minWidth;
-
if (viewportDescription.isLegacyViewportType()) {
+ if (viewportDescription == m_legacyViewportDescription)
+ return;
m_legacyViewportDescription = viewportDescription;
-
- // When no author style for @viewport is present, and a meta tag for defining
- // the viewport is, apply the meta tag viewport instead of the UA styles.
- if (m_viewportDescription.type == ViewportDescription::AuthorStyleSheet)
+ } else {
+ if (viewportDescription == m_viewportDescription)
return;
m_viewportDescription = viewportDescription;
- } else {
- // If the legacy viewport tag has higher priority than the cascaded @viewport
- // descriptors, use the values from the legacy tag.
- if (!shouldOverrideLegacyDescription(viewportDescription.type))
- m_viewportDescription = m_legacyViewportDescription;
- else
- m_viewportDescription = viewportDescription;
+
+ // The UA-defined min-width is considered specifically by Android WebView quirks mode.
+ if (!viewportDescription.isSpecifiedByAuthor())
+ m_viewportDefaultMinWidth = viewportDescription.minWidth;
}
updateViewportDescription();
}
+ViewportDescription Document::viewportDescription() const
+{
+ ViewportDescription appliedViewportDescription = m_viewportDescription;
+ bool viewportMetaEnabled = settings() && settings()->viewportMetaEnabled();
+ if (m_legacyViewportDescription.type != ViewportDescription::UserAgentStyleSheet && viewportMetaEnabled)
+ appliedViewportDescription = m_legacyViewportDescription;
+ if (shouldOverrideLegacyDescription(m_viewportDescription.type))
+ appliedViewportDescription = m_viewportDescription;
+
+ return appliedViewportDescription;
+}
+
void Document::updateViewportDescription()
{
if (frame() && frame()->isMainFrame()) {
- frameHost()->chromeClient().dispatchViewportPropertiesDidChange(m_viewportDescription);
+ frameHost()->chromeClient().dispatchViewportPropertiesDidChange(viewportDescription());
}
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698