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

Side by Side Diff: third_party/WebKit/Source/core/css/MediaQueryEvaluator.h

Issue 2430923005: MediaValuesInitialViewport passed to MediaQueryEvaluator as bool. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/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 21 matching lines...) Expand all
32 #include "platform/heap/Handle.h" 32 #include "platform/heap/Handle.h"
33 #include "wtf/text/WTFString.h" 33 #include "wtf/text/WTFString.h"
34 34
35 namespace blink { 35 namespace blink {
36 class LocalFrame; 36 class LocalFrame;
37 class MediaQuery; 37 class MediaQuery;
38 class MediaQueryExp; 38 class MediaQueryExp;
39 class MediaQueryResult; 39 class MediaQueryResult;
40 class MediaQuerySet; 40 class MediaQuerySet;
41 class MediaValues; 41 class MediaValues;
42 class MediaValuesInitialViewport;
42 43
43 using MediaQueryResultList = HeapVector<Member<MediaQueryResult>>; 44 using MediaQueryResultList = HeapVector<Member<MediaQueryResult>>;
44 45
45 // Class that evaluates css media queries as defined in 46 // Class that evaluates css media queries as defined in
46 // CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/) 47 // CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/)
47 // Special constructors are needed, if simple media queries are to be 48 // Special constructors are needed, if simple media queries are to be
48 // evaluated without knowledge of the medium features. This can happen 49 // evaluated without knowledge of the medium features. This can happen
49 // for example when parsing UA stylesheets, if evaluation is done 50 // for example when parsing UA stylesheets, if evaluation is done
50 // right after parsing. 51 // right after parsing.
51 // 52 //
(...skipping 21 matching lines...) Expand all
73 MediaQueryEvaluator(const char* acceptedMediaType, 74 MediaQueryEvaluator(const char* acceptedMediaType,
74 bool mediaFeatureResult = false); 75 bool mediaFeatureResult = false);
75 76
76 // Creates evaluator which evaluates full media queries. 77 // Creates evaluator which evaluates full media queries.
77 explicit MediaQueryEvaluator(LocalFrame*); 78 explicit MediaQueryEvaluator(LocalFrame*);
78 79
79 // Creates evaluator which evaluates in a thread-safe manner a subset of media 80 // Creates evaluator which evaluates in a thread-safe manner a subset of media
80 // values. 81 // values.
81 explicit MediaQueryEvaluator(const MediaValues&); 82 explicit MediaQueryEvaluator(const MediaValues&);
82 83
84 explicit MediaQueryEvaluator(MediaValuesInitialViewport*);
85
83 ~MediaQueryEvaluator(); 86 ~MediaQueryEvaluator();
84 87
85 bool mediaTypeMatch(const String& mediaTypeToMatch) const; 88 bool mediaTypeMatch(const String& mediaTypeToMatch) const;
86 89
87 // Evaluates a list of media queries. 90 // Evaluates a list of media queries.
88 bool eval(const MediaQuerySet*, 91 bool eval(const MediaQuerySet*,
89 MediaQueryResultList* viewportDependent = 0, 92 MediaQueryResultList* viewportDependent = nullptr,
90 MediaQueryResultList* deviceDependent = 0) const; 93 MediaQueryResultList* deviceDependent = nullptr) const;
91 94
92 // Evaluates media query. 95 // Evaluates media query.
93 bool eval(const MediaQuery*, 96 bool eval(const MediaQuery*,
94 MediaQueryResultList* viewportDependent = 0, 97 MediaQueryResultList* viewportDependent = nullptr,
95 MediaQueryResultList* deviceDependent = 0) const; 98 MediaQueryResultList* deviceDependent = nullptr) const;
96 99
97 // Evaluates media query subexpression, ie "and (media-feature: value)" part. 100 // Evaluates media query subexpression, ie "and (media-feature: value)" part.
98 bool eval(const MediaQueryExp*) const; 101 bool eval(const MediaQueryExp*) const;
99 102
100 DECLARE_TRACE(); 103 DECLARE_TRACE();
101 104
102 private: 105 private:
103 const String mediaType() const; 106 const String mediaType() const;
104 107
105 String m_mediaType; 108 String m_mediaType;
106 bool m_expectedResult; 109 bool m_expectedResult = false;
107 Member<MediaValues> m_mediaValues; 110 Member<MediaValues> m_mediaValues;
108 }; 111 };
109 112
110 } // namespace blink 113 } // namespace blink
111 #endif 114 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698