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

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

Issue 405953002: Fix MQEvaluator::mediaType() related perf regressions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Really fix the issue Created 6 years, 4 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/StyleResolver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index 02803fd8518cbeaffb01f97cb613a5f96c44c05e..f4db9228cd45ce9857feb15a84e8c0c184191301 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -31,6 +31,7 @@
#include "core/CSSPropertyNames.h"
#include "core/HTMLNames.h"
+#include "core/MediaTypeNames.h"
#include "core/StylePropertyShorthand.h"
#include "core/animation/ActiveAnimations.h"
#include "core/animation/Animation.h"
@@ -132,16 +133,19 @@ StyleResolver::StyleResolver(Document& document)
: m_document(document)
, m_viewportStyleResolver(ViewportStyleResolver::create(&document))
, m_needCollectFeatures(false)
+ , m_printMediaType(false)
, m_styleResourceLoader(document.fetcher())
, m_styleSharingDepth(0)
, m_styleResolverStatsSequence(0)
, m_accessCount(0)
{
FrameView* view = document.view();
- if (view)
+ if (view) {
m_medium = adoptPtr(new MediaQueryEvaluator(&view->frame()));
- else
+ m_printMediaType = equalIgnoringCase(view->mediaType(), MediaTypeNames::print);
esprehn 2014/08/11 20:33:21 Do we destroy the StyleResolver when the media typ
+ } else {
m_medium = adoptPtr(new MediaQueryEvaluator("all"));
+ }
initWatchedSelectorRules(CSSSelectorWatch::from(document).watchedCallbackSelectors());
@@ -456,8 +460,7 @@ void StyleResolver::matchUARules(ElementRuleCollector& collector)
collector.setMatchingUARules(true);
CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance();
- RuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific("print")
- ? defaultStyleSheets.defaultPrintStyle() : defaultStyleSheets.defaultStyle();
+ RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.defaultPrintStyle() : defaultStyleSheets.defaultStyle();
matchUARules(collector, userAgentStyleSheet);
// In quirks mode, we match rules from the quirks user agent sheet.
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698