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

Side by Side Diff: sky/engine/core/css/MediaQueryEvaluator.h

Issue 848483003: Simplify media query handling for stylesheets. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/css/MediaQueryEvaluator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * CSS Media Query Evaluator 2 * CSS Media Query Evaluator
3 * 3 *
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 17 matching lines...) Expand all
28 #ifndef SKY_ENGINE_CORE_CSS_MEDIAQUERYEVALUATOR_H_ 28 #ifndef SKY_ENGINE_CORE_CSS_MEDIAQUERYEVALUATOR_H_
29 #define SKY_ENGINE_CORE_CSS_MEDIAQUERYEVALUATOR_H_ 29 #define SKY_ENGINE_CORE_CSS_MEDIAQUERYEVALUATOR_H_
30 30
31 #include "sky/engine/platform/heap/Handle.h" 31 #include "sky/engine/platform/heap/Handle.h"
32 #include "sky/engine/wtf/text/WTFString.h" 32 #include "sky/engine/wtf/text/WTFString.h"
33 33
34 namespace blink { 34 namespace blink {
35 class LocalFrame; 35 class LocalFrame;
36 class MediaQuery; 36 class MediaQuery;
37 class MediaQueryExp; 37 class MediaQueryExp;
38 class MediaQueryResult;
39 class MediaQuerySet; 38 class MediaQuerySet;
40 class MediaValues; 39 class MediaValues;
41 class RenderStyle; 40 class RenderStyle;
42 41
43 typedef Vector<RefPtr<MediaQueryResult> > MediaQueryResultList;
44
45 // Class that evaluates css media queries as defined in 42 // Class that evaluates css media queries as defined in
46 // CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/) 43 // CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/)
47 // Special constructors are needed, if simple media queries are to be 44 // Special constructors are needed, if simple media queries are to be
48 // evaluated without knowledge of the medium features. This can happen 45 // evaluated without knowledge of the medium features. This can happen
49 // for example when parsing UA stylesheets, if evaluation is done 46 // for example when parsing UA stylesheets, if evaluation is done
50 // right after parsing. 47 // right after parsing.
51 // 48 //
52 // the boolean parameter is used to approximate results of evaluation, if 49 // the boolean parameter is used to approximate results of evaluation, if
53 // the device characteristics are not known. This can be used to prune the loadi ng 50 // the device characteristics are not known. This can be used to prune the loadi ng
54 // of stylesheets to only those which are probable to match. 51 // of stylesheets to only those which are probable to match.
(...skipping 17 matching lines...) Expand all
72 explicit MediaQueryEvaluator(LocalFrame*); 69 explicit MediaQueryEvaluator(LocalFrame*);
73 70
74 // Creates evaluator which evaluates in a thread-safe manner a subset of med ia values. 71 // Creates evaluator which evaluates in a thread-safe manner a subset of med ia values.
75 explicit MediaQueryEvaluator(const MediaValues&); 72 explicit MediaQueryEvaluator(const MediaValues&);
76 73
77 ~MediaQueryEvaluator(); 74 ~MediaQueryEvaluator();
78 75
79 bool mediaTypeMatch(const String& mediaTypeToMatch) const; 76 bool mediaTypeMatch(const String& mediaTypeToMatch) const;
80 77
81 // Evaluates a list of media queries. 78 // Evaluates a list of media queries.
82 bool eval(const MediaQuerySet*, MediaQueryResultList* = 0) const; 79 bool eval(const MediaQuerySet*) const;
83 80
84 // Evaluates media query. 81 // Evaluates media query.
85 bool eval(const MediaQuery*, MediaQueryResultList*) const; 82 bool eval(const MediaQuery*) const;
86 83
87 // Evaluates media query subexpression, ie "and (media-feature: value)" part . 84 // Evaluates media query subexpression, ie "and (media-feature: value)" part .
88 bool eval(const MediaQueryExp*) const; 85 bool eval(const MediaQueryExp*) const;
89 86
90 private: 87 private:
91 const String mediaType() const; 88 const String mediaType() const;
92 89
93 String m_mediaType; 90 String m_mediaType;
94 bool m_expectedResult; 91 bool m_expectedResult;
95 RefPtr<MediaValues> m_mediaValues; 92 RefPtr<MediaValues> m_mediaValues;
96 }; 93 };
97 94
98 } // namespace 95 } // namespace
99 #endif // SKY_ENGINE_CORE_CSS_MEDIAQUERYEVALUATOR_H_ 96 #endif // SKY_ENGINE_CORE_CSS_MEDIAQUERYEVALUATOR_H_
OLDNEW
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/css/MediaQueryEvaluator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698