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

Unified Diff: Source/core/css/MediaQueryEvaluator.h

Issue 201813002: Enable Media query evaluation in the preload scanner (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix Debug crash. Values based MediaValues::create Created 6 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/core.gypi ('k') | Source/core/css/MediaQueryEvaluator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/MediaQueryEvaluator.h
diff --git a/Source/core/css/MediaQueryEvaluator.h b/Source/core/css/MediaQueryEvaluator.h
index bf047a0a41ab4d4120171f45048582f4e0e39170..ae61df2cb99c8a01fada99ec599c6f72b35f824d 100644
--- a/Source/core/css/MediaQueryEvaluator.h
+++ b/Source/core/css/MediaQueryEvaluator.h
@@ -37,56 +37,58 @@ class MediaQueryExp;
class MediaQueryResult;
class MediaQuerySet;
class RenderStyle;
+class MediaValues;
typedef WillBeHeapVector<RefPtrWillBeMember<MediaQueryResult> > MediaQueryResultList;
-/**
- * Class that evaluates css media queries as defined in
- * CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/)
- * Special constructors are needed, if simple media queries are to be
- * evaluated without knowledge of the medium features. This can happen
- * for example when parsing UA stylesheets, if evaluation is done
- * right after parsing.
- *
- * the boolean parameter is used to approximate results of evaluation, if
- * the device characteristics are not known. This can be used to prune the loading
- * of stylesheets to only those which are probable to match.
- */
+// Class that evaluates css media queries as defined in
+// CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/)
+// Special constructors are needed, if simple media queries are to be
+// evaluated without knowledge of the medium features. This can happen
+// for example when parsing UA stylesheets, if evaluation is done
+// right after parsing.
+//
+// the boolean parameter is used to approximate results of evaluation, if
+// the device characteristics are not known. This can be used to prune the loading
+// of stylesheets to only those which are probable to match.
+
class MediaQueryEvaluator {
WTF_MAKE_NONCOPYABLE(MediaQueryEvaluator); WTF_MAKE_FAST_ALLOCATED;
public:
- /** Creates evaluator which evaluates only simple media queries
- * Evaluator returns true for "all", and returns value of \mediaFeatureResult
- * for any media features
- */
+ // Creates evaluator which evaluates only simple media queries
+ // Evaluator returns true for "all", and returns value of \mediaFeatureResult
+ // for any media features
+
explicit MediaQueryEvaluator(bool mediaFeatureResult = false);
- /** Creates evaluator which evaluates only simple media queries
- * Evaluator returns true for acceptedMediaType and returns value of \mediafeatureResult
- * for any media features
- */
+ // Creates evaluator which evaluates only simple media queries
+ // Evaluator returns true for acceptedMediaType and returns value of \mediafeatureResult
+ // for any media features
+
MediaQueryEvaluator(const String& acceptedMediaType, bool mediaFeatureResult = false);
MediaQueryEvaluator(const char* acceptedMediaType, bool mediaFeatureResult = false);
- /** Creates evaluator which evaluates full media queries */
+ // Creates evaluator which evaluates full media queries
MediaQueryEvaluator(const String& acceptedMediaType, LocalFrame*, RenderStyle*);
+ // Creates evaluator which evaluates in a thread-safe manner a subset of media values
+ MediaQueryEvaluator(const String& acceptedMediaType, const MediaValues&);
+
~MediaQueryEvaluator();
bool mediaTypeMatch(const String& mediaTypeToMatch) const;
bool mediaTypeMatchSpecific(const char* mediaTypeToMatch) const;
- /** Evaluates a list of media queries */
+ // Evaluates a list of media queries
bool eval(const MediaQuerySet*, MediaQueryResultList* = 0) const;
- /** Evaluates media query subexpression, ie "and (media-feature: value)" part */
+ // Evaluates media query subexpression, ie "and (media-feature: value)" part
bool eval(const MediaQueryExp*) const;
private:
String m_mediaType;
- LocalFrame* m_frame; // Not owned.
- RefPtr<RenderStyle> m_style;
- bool m_expResult;
+ bool m_expectedResult;
+ RefPtr<MediaValues> m_mediaValues;
};
} // namespace
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/MediaQueryEvaluator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698