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

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

Issue 2420413005: Collect @viewport before constructing RuleSets. (Closed)
Patch Set: Rebased Created 4 years, 2 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: third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.cpp
index 91ba92d0a8ac5d12950d4a062aa09c7c2cda6fb0..aab5a680243cabe7a948fd1a2e85e924d784a5d2 100644
--- a/third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.cpp
@@ -39,11 +39,12 @@
#include "core/css/StyleRule.h"
#include "core/css/StyleRuleImport.h"
#include "core/css/StyleSheetContents.h"
-#include "core/css/resolver/ScopedStyleResolver.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentStyleSheetCollection.h"
#include "core/dom/NodeComputedStyle.h"
#include "core/dom/ViewportDescription.h"
+#include "core/frame/FrameView.h"
+#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
#include "core/layout/api/LayoutViewItem.h"
@@ -93,15 +94,6 @@ void ViewportStyleResolver::collectViewportRulesFromUASheets() {
DCHECK(!defaultStyleSheets.defaultStyleSheet()->hasViewportRule());
}
-void ViewportStyleResolver::collectViewportRules() {
- reset();
- collectViewportRulesFromUASheets();
- if (ScopedStyleResolver* scopedResolver = m_document->scopedStyleResolver())
- scopedResolver->collectViewportRulesTo(this);
-
- resolve();
-}
-
void ViewportStyleResolver::collectViewportChildRules(
const HeapVector<Member<StyleRuleBase>>& rules,
Origin origin) {
@@ -159,16 +151,6 @@ void ViewportStyleResolver::collectViewportRulesFromAuthorSheet(
collectViewportRulesFromAuthorSheetContents(contents);
}
-void ViewportStyleResolver::collectViewportRules(RuleSet* rules,
- Origin origin) {
- rules->compactRulesIfNeeded();
-
- const HeapVector<Member<StyleRuleViewport>>& viewportRules =
- rules->viewportRules();
- for (size_t i = 0; i < viewportRules.size(); ++i)
- addViewportRule(*viewportRules[i], origin);
-}
-
void ViewportStyleResolver::addViewportRule(StyleRuleViewport& viewportRule,
Origin origin) {
StylePropertySet& propertySet = viewportRule.mutableProperties();
@@ -298,18 +280,17 @@ Length ViewportStyleResolver::viewportLengthValue(CSSPropertyID id) {
bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits();
documentStyle->setHasViewportUnits(false);
+ FrameView* view = m_document->frame()->view();
+ DCHECK(view);
+
CSSToLengthConversionData::FontSizes fontSizes(documentStyle, documentStyle);
CSSToLengthConversionData::ViewportSize viewportSize(
- m_document->layoutViewItem());
+ view->initialViewportWidth(), view->initialViewportHeight());
Length result = primitiveValue->convertToLength(
CSSToLengthConversionData(documentStyle, fontSizes, viewportSize, 1.0f));
- if (documentStyle->hasViewportUnits()) {
- // TODO (rune@opera.com): remove the setHasViewportUnit when
- // initialViewportChanged() goes live.
- m_document->setHasViewportUnits();
+ if (documentStyle->hasViewportUnits())
m_hasViewportUnits = true;
- }
documentStyle->setHasViewportUnits(documentStyleHasViewportUnits);
return result;
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.h ('k') | third_party/WebKit/Source/core/dom/StyleEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698