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

Unified Diff: Source/core/dom/Document.h

Issue 23809007: Refactor the viewport code to be more understandable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « no previous file | Source/core/dom/Document.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.h
diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h
index e3596b69393f3746d1b53121cc9a64a7d44c90fb..88bbd01aa349008e081ea1a48d3391213b1a2733 100644
--- a/Source/core/dom/Document.h
+++ b/Source/core/dom/Document.h
@@ -289,6 +289,7 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitvisibilitychange);
DEFINE_ATTRIBUTE_EVENT_LISTENER(securitypolicyviolation);
+ bool shouldOverrideLegacyViewport(ViewportArguments::Type);
void setViewportArguments(const ViewportArguments&);
const ViewportArguments& viewportArguments() const { return m_viewportArguments; }
#ifndef NDEBUG
@@ -1404,15 +1405,12 @@ inline const Document* Document::templateDocument() const
return m_templateDocument.get();
}
-inline void Document::setViewportArguments(const ViewportArguments& viewportArguments)
+inline bool Document::shouldOverrideLegacyViewport(ViewportArguments::Type origin)
{
- // If the legacy viewport tag has higher priority than the cascaded @viewport
- // descriptors, use the values from the legacy tag.
- if (viewportArguments.type < m_legacyViewportArguments.type)
- m_viewportArguments = m_legacyViewportArguments;
- else
- m_viewportArguments = viewportArguments;
- updateViewportArguments();
+ // The different (legacy) meta tags have different priorities based on the type
+ // regardless of which order they appear in the DOM. The priority is given by the
+ // ViewportArguments::Type enum.
+ return origin >= m_legacyViewportArguments.type;
}
inline Document* toDocument(ScriptExecutionContext* scriptExecutionContext)
« no previous file with comments | « no previous file | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698