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

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

Issue 2806003002: Verify that constant vectors aren't invalidated during iteration. (Closed)
Patch Set: Created 3 years, 8 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/RuleSet.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 * Copyright (C) 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. 6 * Copyright (C) 2013 Intel Corporation. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 MediaQueryResultList* deviceDependentMediaQueryResults) const { 144 MediaQueryResultList* deviceDependentMediaQueryResults) const {
145 if (!querySet) 145 if (!querySet)
146 return true; 146 return true;
147 147
148 const HeapVector<Member<MediaQuery>>& queries = querySet->queryVector(); 148 const HeapVector<Member<MediaQuery>>& queries = querySet->queryVector();
149 if (!queries.size()) 149 if (!queries.size())
150 return true; // Empty query list evaluates to true. 150 return true; // Empty query list evaluates to true.
151 151
152 // Iterate over queries, stop if any of them eval to true (OR semantics). 152 // Iterate over queries, stop if any of them eval to true (OR semantics).
153 bool result = false; 153 bool result = false;
154 for (size_t i = 0; i < queries.size() && !result; ++i) 154 for (size_t i = 0; i < queries.size() && !result; ++i) {
155 // TODO(sof): CHECK() added for crbug.com/699269 diagnosis, remove sooner.
156 CHECK_EQ(queries.data(), querySet->queryVector().data());
155 result = eval(queries[i].get(), viewportDependentMediaQueryResults, 157 result = eval(queries[i].get(), viewportDependentMediaQueryResults,
156 deviceDependentMediaQueryResults); 158 deviceDependentMediaQueryResults);
159 }
157 160
158 return result; 161 return result;
159 } 162 }
160 163
161 template <typename T> 164 template <typename T>
162 bool compareValue(T a, T b, MediaFeaturePrefix op) { 165 bool compareValue(T a, T b, MediaFeaturePrefix op) {
163 switch (op) { 166 switch (op) {
164 case MinPrefix: 167 case MinPrefix:
165 return a >= b; 168 return a >= b;
166 case MaxPrefix: 169 case MaxPrefix:
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 // Call the media feature evaluation function. Assume no prefix and let 813 // Call the media feature evaluation function. Assume no prefix and let
811 // trampoline functions override the prefix if prefix is used. 814 // trampoline functions override the prefix if prefix is used.
812 EvalFunc func = gFunctionMap->at(expr->mediaFeature().impl()); 815 EvalFunc func = gFunctionMap->at(expr->mediaFeature().impl());
813 if (func) 816 if (func)
814 return func(expr->expValue(), NoPrefix, *m_mediaValues); 817 return func(expr->expValue(), NoPrefix, *m_mediaValues);
815 818
816 return false; 819 return false;
817 } 820 }
818 821
819 } // namespace blink 822 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/RuleSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698