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

Side by Side Diff: Source/core/css/resolver/StylePropertyRange.h

Issue 892643002: Split property priority functions out of StyleResolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
Timothy Loh 2015/02/01 22:17:09 2015 ;)
andersr 2015/02/02 15:51:24 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef StylePropertyRange_h
6 #define StylePropertyRange_h
7
8 #include "core/CSSPropertyNames.h"
9
10 namespace blink {
11
12 enum StyleApplicationPass {
Timothy Loh 2015/02/01 22:17:09 Nit-picking about names since we're already touchi
andersr 2015/02/02 15:51:24 Done.
13 HighPriorityProperties,
14 LowPriorityProperties
15 };
16
17 class StylePropertyRange {
18 public:
19 template <StyleApplicationPass pass>
20 static inline CSSPropertyID firstCSSPropertyId();
21
22 template <StyleApplicationPass pass>
23 static inline CSSPropertyID lastCSSPropertyId();
24
25 template <StyleApplicationPass pass>
26 static inline bool isPropertyForPass(CSSPropertyID property)
27 {
28 return firstCSSPropertyId<pass>() <= property && property <= lastCSSProp ertyId<pass>();
29 }
30 };
31
32 // This method returns the first CSSPropertyId of high priority properties.
Timothy Loh 2015/02/01 22:17:09 I'd describe property priority above the enum up t
andersr 2015/02/02 15:51:24 Done.
33 // Other properties can depend on high priority properties. For example,
34 // border-color property with currentColor value depends on color property.
35 // All high priority properties are obtained by using
36 // firstCSSPropertyId<HighPriorityProperties> and
37 // lastCSSPropertyId<HighPriorityProperties>.
38 template<>
39 inline CSSPropertyID StylePropertyRange::firstCSSPropertyId<HighPriorityProperti es>()
40 {
41 static_assert(CSSPropertyColor == firstCSSProperty, "CSSPropertyColor should be the first high priority property");
42 return CSSPropertyColor;
43 }
44
45 // This method returns the last CSSPropertyId of high priority properties.
46 template<>
47 inline CSSPropertyID StylePropertyRange::lastCSSPropertyId<HighPriorityPropertie s>()
48 {
49 static_assert(CSSPropertyZoom == CSSPropertyColor + 16, "CSSPropertyZoom sho uld be the end of the high priority property range");
50 static_assert(CSSPropertyTextRendering == CSSPropertyZoom - 1, "CSSPropertyT extRendering should be immediately before CSSPropertyZoom");
51 return CSSPropertyZoom;
52 }
53
54 // This method returns the first CSSPropertyId of remaining properties,
55 // i.e. low priority properties. No properties depend on low priority
56 // properties. So we don't need to resolve such properties quickly.
57 // All low priority properties are obtained by using
58 // firstCSSPropertyId<LowPriorityProperties> and
59 // lastCSSPropertyId<LowPriorityProperties>.
60 template<>
61 inline CSSPropertyID StylePropertyRange::firstCSSPropertyId<LowPriorityPropertie s>()
62 {
63 static_assert(CSSPropertyAlignContent == CSSPropertyZoom + 1, "CSSPropertyAl ignContent should be the first low priority property");
64 return CSSPropertyAlignContent;
65 }
66
67 // This method returns the last CSSPropertyId of low priority properties.
68 template<>
69 inline CSSPropertyID StylePropertyRange::lastCSSPropertyId<LowPriorityProperties >()
70 {
71 return static_cast<CSSPropertyID>(lastCSSProperty);
72 }
73
74 } // namespace blink
75
76 #endif // StylePropertyRange_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698