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.
4 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
26 #include "core/css/RuleSet.h"
27 #include "core/css/SelectorChecker.h"
28 #include "platform/heap/Handle.h"
29 #include "wtf/RefPtr.h"
30 #include "wtf/Vector.h"
34 class StylePropertySet;
37 RuleRange(int& firstRuleIndex, int& lastRuleIndex): firstRuleIndex(firstRuleIndex), lastRuleIndex(lastRuleIndex) { }
43 MatchRanges() : firstUARule(-1), lastUARule(-1), firstAuthorRule(-1), lastAuthorRule(-1) { }
48 RuleRange UARuleRange() { return RuleRange(firstUARule, lastUARule); }
49 RuleRange authorRuleRange() { return RuleRange(firstAuthorRule, lastAuthorRule); }
52 struct MatchedProperties {
53 ALLOW_ONLY_INLINE_ALLOCATION();
60 RefPtrWillBeMember<StylePropertySet> properties;
64 unsigned linkMatchType : 2;
65 unsigned whitelistType : 2;
67 // Used to make sure all memory is zero-initialized since we compute the hash over the bytes of this object.
68 void* possiblyPaddedMember;
74 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::MatchedProperties);
81 MatchResult() : isCacheable(true) { }
82 WillBeHeapVector<MatchedProperties, 64> matchedProperties;
86 void addMatchedProperties(const StylePropertySet* properties, unsigned linkMatchType = SelectorChecker::MatchAll, PropertyWhitelistType = PropertyWhitelistNone);
89 inline bool operator==(const MatchRanges& a, const MatchRanges& b)
91 return a.firstUARule == b.firstUARule
92 && a.lastUARule == b.lastUARule
93 && a.firstAuthorRule == b.firstAuthorRule
94 && a.lastAuthorRule == b.lastAuthorRule;
97 inline bool operator!=(const MatchRanges& a, const MatchRanges& b)
102 inline bool operator==(const MatchedProperties& a, const MatchedProperties& b)
104 return a.properties == b.properties && a.m_types.linkMatchType == b.m_types.linkMatchType;
107 inline bool operator!=(const MatchedProperties& a, const MatchedProperties& b)
114 #endif // MatchResult_h