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

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: Changed approach Created 6 years, 5 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/MediaQueryEvaluator.cpp ('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 e7c5ab5c58f4e042c2cee74d0b805b26102f3158..798dc9ddeef74967fe3c4968f8dc719ed1d00db6 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"
@@ -467,12 +468,19 @@ void StyleResolver::matchWatchSelectorRules(ElementRuleCollector& collector)
collector.sortAndTransferMatchedRules();
}
+static bool printMediaType(FrameView* view)
+{
+ if (!view)
+ return false;
+ return equalIgnoringCase(view->mediaType(), MediaTypeNames::print);
+}
+
void StyleResolver::matchUARules(ElementRuleCollector& collector)
{
collector.setMatchingUARules(true);
CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance();
- RuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific("print")
+ RuleSet* userAgentStyleSheet = printMediaType(document().view())
esprehn 2014/07/25 23:42:04 Why would this be slow? mediaTypeMatchSpecific jus
? defaultStyleSheets.defaultPrintStyle() : defaultStyleSheets.defaultStyle();
matchUARules(collector, userAgentStyleSheet);
« no previous file with comments | « Source/core/css/MediaQueryEvaluator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698