OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights reserved. |
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "platform/weborigin/SecurityOrigin.h" | 44 #include "platform/weborigin/SecurityOrigin.h" |
45 | 45 |
46 #include "wtf/TerminatedArrayBuilder.h" | 46 #include "wtf/TerminatedArrayBuilder.h" |
47 | 47 |
48 namespace blink { | 48 namespace blink { |
49 | 49 |
50 using namespace HTMLNames; | 50 using namespace HTMLNames; |
51 | 51 |
52 // ----------------------------------------------------------------- | 52 // ----------------------------------------------------------------- |
53 | 53 |
54 static inline bool isSelectorMatchingHTMLBasedOnRuleHash(const CSSSelector& sele
ctor) | |
55 { | |
56 if (selector.match() == CSSSelector::Tag) { | |
57 const AtomicString& selectorNamespace = selector.tagQName().namespaceURI
(); | |
58 if (selectorNamespace != starAtom && selectorNamespace != xhtmlNamespace
URI) | |
59 return false; | |
60 if (selector.relation() == CSSSelector::SubSelector && selector.tagHisto
ry()) | |
61 return isSelectorMatchingHTMLBasedOnRuleHash(*selector.tagHistory())
; | |
62 return true; | |
63 } | |
64 if (SelectorChecker::isCommonPseudoClassSelector(selector)) | |
65 return true; | |
66 return selector.match() == CSSSelector::Id || selector.match() == CSSSelecto
r::Class; | |
67 } | |
68 | |
69 static inline bool selectorListContainsUncommonAttributeSelector(const CSSSelect
or* selector) | 54 static inline bool selectorListContainsUncommonAttributeSelector(const CSSSelect
or* selector) |
70 { | 55 { |
71 const CSSSelectorList* selectorList = selector->selectorList(); | 56 const CSSSelectorList* selectorList = selector->selectorList(); |
72 if (!selectorList) | 57 if (!selectorList) |
73 return false; | 58 return false; |
74 for (const CSSSelector* selector = selectorList->first(); selector; selector
= CSSSelectorList::next(*selector)) { | 59 for (const CSSSelector* selector = selectorList->first(); selector; selector
= CSSSelectorList::next(*selector)) { |
75 for (const CSSSelector* component = selector; component; component = com
ponent->tagHistory()) { | 60 for (const CSSSelector* component = selector; component; component = com
ponent->tagHistory()) { |
76 if (component->isAttributeSelector()) | 61 if (component->isAttributeSelector()) |
77 return true; | 62 return true; |
78 } | 63 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 105 } |
121 return PropertyWhitelistNone; | 106 return PropertyWhitelistNone; |
122 } | 107 } |
123 | 108 |
124 RuleData::RuleData(StyleRule* rule, unsigned selectorIndex, unsigned position, A
ddRuleFlags addRuleFlags) | 109 RuleData::RuleData(StyleRule* rule, unsigned selectorIndex, unsigned position, A
ddRuleFlags addRuleFlags) |
125 : m_rule(rule) | 110 : m_rule(rule) |
126 , m_selectorIndex(selectorIndex) | 111 , m_selectorIndex(selectorIndex) |
127 , m_isLastInArray(false) | 112 , m_isLastInArray(false) |
128 , m_position(position) | 113 , m_position(position) |
129 , m_specificity(selector().specificity()) | 114 , m_specificity(selector().specificity()) |
130 , m_hasMultipartSelector(!!selector().tagHistory()) | |
131 , m_hasRightmostSelectorMatchingHTMLBasedOnRuleHash(isSelectorMatchingHTMLBa
sedOnRuleHash(selector())) | |
132 , m_containsUncommonAttributeSelector(blink::containsUncommonAttributeSelect
or(selector())) | 115 , m_containsUncommonAttributeSelector(blink::containsUncommonAttributeSelect
or(selector())) |
133 , m_linkMatchType(SelectorChecker::determineLinkMatchType(selector())) | 116 , m_linkMatchType(SelectorChecker::determineLinkMatchType(selector())) |
134 , m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin) | 117 , m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin) |
135 , m_propertyWhitelistType(determinePropertyWhitelistType(addRuleFlags, selec
tor())) | 118 , m_propertyWhitelistType(determinePropertyWhitelistType(addRuleFlags, selec
tor())) |
136 { | 119 { |
137 ASSERT(m_position == position); | 120 ASSERT(m_position == position); |
138 ASSERT(m_selectorIndex == selectorIndex); | 121 ASSERT(m_selectorIndex == selectorIndex); |
139 SelectorFilter::collectIdentifierHashes(selector(), m_descendantSelectorIden
tifierHashes, maximumIdentifierCount); | 122 SelectorFilter::collectIdentifierHashes(selector(), m_descendantSelectorIden
tifierHashes, maximumIdentifierCount); |
140 } | 123 } |
141 | 124 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 399 |
417 #ifndef NDEBUG | 400 #ifndef NDEBUG |
418 void RuleSet::show() | 401 void RuleSet::show() |
419 { | 402 { |
420 for (const auto& rule: m_allRules) | 403 for (const auto& rule: m_allRules) |
421 rule.selector().show(); | 404 rule.selector().show(); |
422 } | 405 } |
423 #endif | 406 #endif |
424 | 407 |
425 } // namespace blink | 408 } // namespace blink |
OLD | NEW |