| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 using namespace HTMLNames; | 50 using namespace HTMLNames; |
| 51 | 51 |
| 52 // ----------------------------------------------------------------- | 52 // ----------------------------------------------------------------- |
| 53 | 53 |
| 54 static inline bool isSelectorMatchingHTMLBasedOnRuleHash(const CSSSelector& sele
ctor) | 54 static inline bool isSelectorMatchingHTMLBasedOnRuleHash(const CSSSelector& sele
ctor) |
| 55 { | 55 { |
| 56 if (selector.match() == CSSSelector::Tag) { | 56 if (selector.match() == CSSSelector::Tag) { |
| 57 const AtomicString& selectorNamespace = selector.tagQName().namespaceURI
(); | 57 const AtomicString& selectorNamespace = selector.tagQName().namespaceURI
(); |
| 58 if (selectorNamespace != starAtom && selectorNamespace != xhtmlNamespace
URI) | 58 if (selectorNamespace != starAtom && selectorNamespace != xhtmlNamespace
URI) |
| 59 return false; | 59 return false; |
| 60 if (selector.relation() == CSSSelector::SubSelector) { | 60 if (selector.relation() == CSSSelector::SubSelector && selector.tagHisto
ry()) |
| 61 ASSERT(selector.tagHistory()); | |
| 62 return isSelectorMatchingHTMLBasedOnRuleHash(*selector.tagHistory())
; | 61 return isSelectorMatchingHTMLBasedOnRuleHash(*selector.tagHistory())
; |
| 63 } | |
| 64 return true; | 62 return true; |
| 65 } | 63 } |
| 66 if (SelectorChecker::isCommonPseudoClassSelector(selector)) | 64 if (SelectorChecker::isCommonPseudoClassSelector(selector)) |
| 67 return true; | 65 return true; |
| 68 return selector.match() == CSSSelector::Id || selector.match() == CSSSelecto
r::Class; | 66 return selector.match() == CSSSelector::Id || selector.match() == CSSSelecto
r::Class; |
| 69 } | 67 } |
| 70 | 68 |
| 71 static inline bool selectorListContainsUncommonAttributeSelector(const CSSSelect
or* selector) | 69 static inline bool selectorListContainsUncommonAttributeSelector(const CSSSelect
or* selector) |
| 72 { | 70 { |
| 73 const CSSSelectorList* selectorList = selector->selectorList(); | 71 const CSSSelectorList* selectorList = selector->selectorList(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 AtomicString id; | 172 AtomicString id; |
| 175 AtomicString className; | 173 AtomicString className; |
| 176 AtomicString customPseudoElementName; | 174 AtomicString customPseudoElementName; |
| 177 AtomicString tagName; | 175 AtomicString tagName; |
| 178 | 176 |
| 179 #ifndef NDEBUG | 177 #ifndef NDEBUG |
| 180 m_allRules.append(ruleData); | 178 m_allRules.append(ruleData); |
| 181 #endif | 179 #endif |
| 182 | 180 |
| 183 const CSSSelector* it = &component; | 181 const CSSSelector* it = &component; |
| 184 for (; it && it->relation() == CSSSelector::SubSelector; it = it->tagHistory
()) { | 182 for (; it && it->relation() == CSSSelector::SubSelector; it = it->tagHistory
()) |
| 185 extractValuesforSelector(it, id, className, customPseudoElementName, tag
Name); | 183 extractValuesforSelector(it, id, className, customPseudoElementName, tag
Name); |
| 186 } | |
| 187 // FIXME: this null check should not be necessary. See crbug.com/358475 | |
| 188 if (it) | 184 if (it) |
| 189 extractValuesforSelector(it, id, className, customPseudoElementName, tag
Name); | 185 extractValuesforSelector(it, id, className, customPseudoElementName, tag
Name); |
| 190 | 186 |
| 191 // Prefer rule sets in order of most likely to apply infrequently. | 187 // Prefer rule sets in order of most likely to apply infrequently. |
| 192 if (!id.isEmpty()) { | 188 if (!id.isEmpty()) { |
| 193 addToRuleSet(id, ensurePendingRules()->idRules, ruleData); | 189 addToRuleSet(id, ensurePendingRules()->idRules, ruleData); |
| 194 return true; | 190 return true; |
| 195 } | 191 } |
| 196 if (!className.isEmpty()) { | 192 if (!className.isEmpty()) { |
| 197 addToRuleSet(className, ensurePendingRules()->classRules, ruleData); | 193 addToRuleSet(className, ensurePendingRules()->classRules, ruleData); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 410 |
| 415 #ifndef NDEBUG | 411 #ifndef NDEBUG |
| 416 void RuleSet::show() | 412 void RuleSet::show() |
| 417 { | 413 { |
| 418 for (const auto& rule: m_allRules) | 414 for (const auto& rule: m_allRules) |
| 419 rule.selector().show(); | 415 rule.selector().show(); |
| 420 } | 416 } |
| 421 #endif | 417 #endif |
| 422 | 418 |
| 423 } // namespace blink | 419 } // namespace blink |
| OLD | NEW |