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

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: Add test 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..6b96158fa69447b81bbae0d5dcb0afa76c50b4fa 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -3150,7 +3150,7 @@ 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;
}
@@ -3160,37 +3160,35 @@ void Document::setViewportDescription(const ViewportDescription& viewportDescrip
if (viewportDescription == m_viewportDescription)
dgozman 2016/05/09 17:36:19 This check looks strange now (and was before). Why
aelias_OOO_until_Jul13 2016/05/09 23:56:02 Agreed it's weird now. I'd like to preserve a saf
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;
dgozman 2016/05/09 17:36:19 Should we do something similar to |m_viewportDefau
aelias_OOO_until_Jul13 2016/05/09 23:56:02 I don't think there's a risk of bugs with this one
if (viewportDescription.isLegacyViewportType()) {
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)
- 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;
+ m_viewportDescription = viewportDescription;
}
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