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

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

Issue 979033003: Move code from StyleResolver to ViewportStyleResolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 5 years, 9 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 | « Source/core/css/resolver/ViewportStyleResolver.h ('k') | Source/core/frame/Settings.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/ViewportStyleResolver.cpp
diff --git a/Source/core/css/resolver/ViewportStyleResolver.cpp b/Source/core/css/resolver/ViewportStyleResolver.cpp
index 531535a8ded8674e47504671573d0e39d2e12d4b..3bc42dbfbb52197ad64bbaf05bde9d5e482e6de4 100644
--- a/Source/core/css/resolver/ViewportStyleResolver.cpp
+++ b/Source/core/css/resolver/ViewportStyleResolver.cpp
@@ -31,14 +31,17 @@
#include "core/css/resolver/ViewportStyleResolver.h"
#include "core/CSSValueKeywords.h"
+#include "core/css/CSSDefaultStyleSheets.h"
#include "core/css/CSSPrimitiveValueMappings.h"
#include "core/css/CSSToLengthConversionData.h"
#include "core/css/StylePropertySet.h"
#include "core/css/StyleRule.h"
+#include "core/css/resolver/ScopedStyleResolver.h"
#include "core/dom/Document.h"
#include "core/dom/NodeLayoutStyle.h"
#include "core/dom/ViewportDescription.h"
#include "core/frame/FrameView.h"
+#include "core/frame/Settings.h"
namespace blink {
@@ -51,6 +54,28 @@ ViewportStyleResolver::ViewportStyleResolver(Document* document)
ASSERT(m_document);
}
+void ViewportStyleResolver::collectViewportRules()
+{
+ CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance();
+ collectViewportRules(defaultStyleSheets.defaultStyle(), UserAgentOrigin);
+
+ bool useMobileViewportStyle = m_document->settings() && m_document->settings()->useMobileViewportStyle();
+#if OS(ANDROID)
+ // FIXME: Remove when useMobileViewportStyle is set from chromium.
+ useMobileViewportStyle = true;
+#endif
+ if (useMobileViewportStyle)
+ collectViewportRules(defaultStyleSheets.defaultMobileViewportStyle(), UserAgentOrigin);
+
+ if (m_document->isMobileDocument())
+ collectViewportRules(defaultStyleSheets.defaultXHTMLMobileProfileStyle(), UserAgentOrigin);
+
+ if (ScopedStyleResolver* scopedResolver = m_document->scopedStyleResolver())
+ scopedResolver->collectViewportRulesTo(this);
+
+ resolve();
+}
+
void ViewportStyleResolver::collectViewportRules(RuleSet* rules, Origin origin)
{
rules->compactRulesIfNeeded();
@@ -84,9 +109,6 @@ void ViewportStyleResolver::addViewportRule(StyleRuleViewport* viewportRule, Ori
void ViewportStyleResolver::resolve()
{
- if (!m_document)
- return;
-
if (!m_propertySet) {
m_document->setViewportDescription(ViewportDescription(ViewportDescription::UserAgentStyleSheet));
return;
« no previous file with comments | « Source/core/css/resolver/ViewportStyleResolver.h ('k') | Source/core/frame/Settings.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698