| 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, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 bool caseInsensitive = selector.attributeMatchType() == CSSSelector::CaseIns
ensitive; | 467 bool caseInsensitive = selector.attributeMatchType() == CSSSelector::CaseIns
ensitive; |
| 468 | 468 |
| 469 AttributeCollection attributes = element.attributesWithoutUpdate(); | 469 AttributeCollection attributes = element.attributesWithoutUpdate(); |
| 470 for (const auto& attributeItem: attributes) { | 470 for (const auto& attributeItem: attributes) { |
| 471 if (!attributeItem.matches(selectorAttr)) | 471 if (!attributeItem.matches(selectorAttr)) |
| 472 continue; | 472 continue; |
| 473 | 473 |
| 474 if (attributeValueMatches(attributeItem, match, selectorValue, !caseInse
nsitive)) | 474 if (attributeValueMatches(attributeItem, match, selectorValue, !caseInse
nsitive)) |
| 475 return true; | 475 return true; |
| 476 | 476 |
| 477 if (caseInsensitive) | 477 if (caseInsensitive) { |
| 478 if (selectorAttr.namespaceURI() != starAtom) |
| 479 return false; |
| 478 continue; | 480 continue; |
| 481 } |
| 479 | 482 |
| 480 // Legacy dictates that values of some attributes should be compared in | 483 // Legacy dictates that values of some attributes should be compared in |
| 481 // a case-insensitive manner regardless of whether the case insensitive | 484 // a case-insensitive manner regardless of whether the case insensitive |
| 482 // flag is set or not. | 485 // flag is set or not. |
| 483 bool legacyCaseInsensitive = element.document().isHTMLDocument() && !HTM
LDocument::isCaseSensitiveAttribute(selectorAttr); | 486 bool legacyCaseInsensitive = element.document().isHTMLDocument() && !HTM
LDocument::isCaseSensitiveAttribute(selectorAttr); |
| 484 | 487 |
| 485 // If case-insensitive, re-check, and count if result differs. | 488 // If case-insensitive, re-check, and count if result differs. |
| 486 // See http://code.google.com/p/chromium/issues/detail?id=327060 | 489 // See http://code.google.com/p/chromium/issues/detail?id=327060 |
| 487 if (legacyCaseInsensitive && attributeValueMatches(attributeItem, match,
selectorValue, false)) { | 490 if (legacyCaseInsensitive && attributeValueMatches(attributeItem, match,
selectorValue, false)) { |
| 488 UseCounter::count(element.document(), UseCounter::CaseInsensitiveAtt
rSelectorMatch); | 491 UseCounter::count(element.document(), UseCounter::CaseInsensitiveAtt
rSelectorMatch); |
| 489 return true; | 492 return true; |
| 490 } | 493 } |
| 494 if (selectorAttr.namespaceURI() != starAtom) |
| 495 return false; |
| 491 } | 496 } |
| 492 | 497 |
| 493 return false; | 498 return false; |
| 494 } | 499 } |
| 495 | 500 |
| 496 template<typename SiblingTraversalStrategy> | 501 template<typename SiblingTraversalStrategy> |
| 497 bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
lingTraversalStrategy& siblingTraversalStrategy, unsigned* specificity) const | 502 bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
lingTraversalStrategy& siblingTraversalStrategy, unsigned* specificity) const |
| 498 { | 503 { |
| 499 ASSERT(context.element); | 504 ASSERT(context.element); |
| 500 Element& element = *context.element; | 505 Element& element = *context.element; |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 return isHTMLSelectElement(element) && !toHTMLSelectElement(element).usesMen
uList(); | 1178 return isHTMLSelectElement(element) && !toHTMLSelectElement(element).usesMen
uList(); |
| 1174 } | 1179 } |
| 1175 | 1180 |
| 1176 template | 1181 template |
| 1177 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; | 1182 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; |
| 1178 | 1183 |
| 1179 template | 1184 template |
| 1180 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; | 1185 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; |
| 1181 | 1186 |
| 1182 } | 1187 } |
| OLD | NEW |