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

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

Issue 418163003: Simplify watched selector handling and remove remnants of user stylesheets (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cascade
Patch Set: use includeEmptyRules flag on MatchRequest Created 6 years, 4 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 | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/core/css/resolver/MatchResult.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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 14 matching lines...) Expand all
25 25
26 #include "core/css/RuleSet.h" 26 #include "core/css/RuleSet.h"
27 #include "core/css/SelectorChecker.h" 27 #include "core/css/SelectorChecker.h"
28 #include "platform/heap/Handle.h" 28 #include "platform/heap/Handle.h"
29 #include "wtf/RefPtr.h" 29 #include "wtf/RefPtr.h"
30 #include "wtf/Vector.h" 30 #include "wtf/Vector.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 class StylePropertySet; 34 class StylePropertySet;
35 class StyleRule;
36 35
37 struct RuleRange { 36 struct RuleRange {
38 RuleRange(int& firstRuleIndex, int& lastRuleIndex): firstRuleIndex(firstRule Index), lastRuleIndex(lastRuleIndex) { } 37 RuleRange(int& firstRuleIndex, int& lastRuleIndex): firstRuleIndex(firstRule Index), lastRuleIndex(lastRuleIndex) { }
39 int& firstRuleIndex; 38 int& firstRuleIndex;
40 int& lastRuleIndex; 39 int& lastRuleIndex;
41 }; 40 };
42 41
43 struct MatchRanges { 42 struct MatchRanges {
44 MatchRanges() : firstUARule(-1), lastUARule(-1), firstAuthorRule(-1), lastAu thorRule(-1), firstUserRule(-1), lastUserRule(-1) { } 43 MatchRanges() : firstUARule(-1), lastUARule(-1), firstAuthorRule(-1), lastAu thorRule(-1) { }
45 int firstUARule; 44 int firstUARule;
46 int lastUARule; 45 int lastUARule;
47 int firstAuthorRule; 46 int firstAuthorRule;
48 int lastAuthorRule; 47 int lastAuthorRule;
49 int firstUserRule;
50 int lastUserRule;
51 RuleRange UARuleRange() { return RuleRange(firstUARule, lastUARule); } 48 RuleRange UARuleRange() { return RuleRange(firstUARule, lastUARule); }
52 RuleRange authorRuleRange() { return RuleRange(firstAuthorRule, lastAuthorRu le); } 49 RuleRange authorRuleRange() { return RuleRange(firstAuthorRule, lastAuthorRu le); }
53 RuleRange userRuleRange() { return RuleRange(firstUserRule, lastUserRule); }
54 }; 50 };
55 51
56 struct MatchedProperties { 52 struct MatchedProperties {
57 ALLOW_ONLY_INLINE_ALLOCATION(); 53 ALLOW_ONLY_INLINE_ALLOCATION();
58 public: 54 public:
59 MatchedProperties(); 55 MatchedProperties();
60 ~MatchedProperties(); 56 ~MatchedProperties();
61 57
62 void trace(Visitor*); 58 void trace(Visitor*);
63 59
(...skipping 13 matching lines...) Expand all
77 73
78 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::MatchedProperties); 74 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::MatchedProperties);
79 75
80 namespace blink { 76 namespace blink {
81 77
82 class MatchResult { 78 class MatchResult {
83 STACK_ALLOCATED(); 79 STACK_ALLOCATED();
84 public: 80 public:
85 MatchResult() : isCacheable(true) { } 81 MatchResult() : isCacheable(true) { }
86 WillBeHeapVector<MatchedProperties, 64> matchedProperties; 82 WillBeHeapVector<MatchedProperties, 64> matchedProperties;
87 WillBeHeapVector<RawPtrWillBeMember<StyleRule>, 64> matchedRules;
88 MatchRanges ranges; 83 MatchRanges ranges;
89 bool isCacheable; 84 bool isCacheable;
90 85
91 void addMatchedProperties(const StylePropertySet* properties, StyleRule* = 0 , unsigned linkMatchType = SelectorChecker::MatchAll, PropertyWhitelistType = Pr opertyWhitelistNone); 86 void addMatchedProperties(const StylePropertySet* properties, unsigned linkM atchType = SelectorChecker::MatchAll, PropertyWhitelistType = PropertyWhitelistN one);
92 }; 87 };
93 88
94 inline bool operator==(const MatchRanges& a, const MatchRanges& b) 89 inline bool operator==(const MatchRanges& a, const MatchRanges& b)
95 { 90 {
96 return a.firstUARule == b.firstUARule 91 return a.firstUARule == b.firstUARule
97 && a.lastUARule == b.lastUARule 92 && a.lastUARule == b.lastUARule
98 && a.firstAuthorRule == b.firstAuthorRule 93 && a.firstAuthorRule == b.firstAuthorRule
99 && a.lastAuthorRule == b.lastAuthorRule 94 && a.lastAuthorRule == b.lastAuthorRule;
100 && a.firstUserRule == b.firstUserRule
101 && a.lastUserRule == b.lastUserRule;
102 } 95 }
103 96
104 inline bool operator!=(const MatchRanges& a, const MatchRanges& b) 97 inline bool operator!=(const MatchRanges& a, const MatchRanges& b)
105 { 98 {
106 return !(a == b); 99 return !(a == b);
107 } 100 }
108 101
109 inline bool operator==(const MatchedProperties& a, const MatchedProperties& b) 102 inline bool operator==(const MatchedProperties& a, const MatchedProperties& b)
110 { 103 {
111 return a.properties == b.properties && a.m_types.linkMatchType == b.m_types. linkMatchType; 104 return a.properties == b.properties && a.m_types.linkMatchType == b.m_types. linkMatchType;
112 } 105 }
113 106
114 inline bool operator!=(const MatchedProperties& a, const MatchedProperties& b) 107 inline bool operator!=(const MatchedProperties& a, const MatchedProperties& b)
115 { 108 {
116 return !(a == b); 109 return !(a == b);
117 } 110 }
118 111
119 } // namespace blink 112 } // namespace blink
120 113
121 #endif // MatchResult_h 114 #endif // MatchResult_h
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/core/css/resolver/MatchResult.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698