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

Unified Diff: Source/core/css/resolver/ViewportStyleResolver.cpp

Issue 23742003: Use css-device-adapt constraining for legacy viewport tags. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More review issues. Created 7 years, 3 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
Index: Source/core/css/resolver/ViewportStyleResolver.cpp
diff --git a/Source/core/css/resolver/ViewportStyleResolver.cpp b/Source/core/css/resolver/ViewportStyleResolver.cpp
index 34239374452d71ee590cdda4ac0ae685e9848c03..7691d07341ed1958c7e398409d1ab5c9d358c1a6 100644
--- a/Source/core/css/resolver/ViewportStyleResolver.cpp
+++ b/Source/core/css/resolver/ViewportStyleResolver.cpp
@@ -40,7 +40,8 @@
namespace WebCore {
ViewportStyleResolver::ViewportStyleResolver(Document* document)
- : m_document(document)
+ : m_document(document),
+ m_hasAuthorStyle(false)
{
ASSERT(m_document);
}
@@ -78,19 +79,17 @@ void ViewportStyleResolver::resolve()
if (!m_document)
return;
- if (!m_propertySet) {
- // FIXME: This is not entirely correct. If the doctype is XHTML MP, or there is a Meta
- // element for setting the viewport, the viewport arguments should fall back to those
- // settings when the @viewport rules are all removed. For now, reset to implicit when
- // there was an @viewport rule which has now been removed.
- if (m_document->viewportArguments().type == ViewportArguments::CSSDeviceAdaptation) {
+ if (!m_hasAuthorStyle && (m_document->useLegacyViewportArguments() || !m_propertySet)) {
+ if (!m_propertySet)
m_document->setViewportArguments(ViewportArguments());
- m_document->updateViewportArguments();
- }
+ else
+ m_propertySet = 0;
return;
}
- ViewportArguments arguments(ViewportArguments::CSSDeviceAdaptation);
+ ASSERT(m_propertySet);
+
+ ViewportArguments arguments(m_hasAuthorStyle ? ViewportArguments::AuthorStyleSheet : ViewportArguments::UserAgentStyleSheet);
arguments.userZoom = getViewportArgumentValue(CSSPropertyUserZoom);
arguments.zoom = getViewportArgumentValue(CSSPropertyZoom);
@@ -103,9 +102,9 @@ void ViewportStyleResolver::resolve()
arguments.orientation = getViewportArgumentValue(CSSPropertyOrientation);
m_document->setViewportArguments(arguments);
- m_document->updateViewportArguments();
m_propertySet = 0;
+ m_hasAuthorStyle = false;
}
float ViewportStyleResolver::getViewportArgumentValue(CSSPropertyID id) const

Powered by Google App Engine
This is Rietveld 408576698