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

Side by Side Diff: third_party/WebKit/Source/core/css/SelectorChecker.cpp

Issue 2490393002: Match camelCased SVG attributes selectors in html documents. (Closed)
Patch Set: Rebased and fixed return statement Created 4 years, 1 month 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
OLDNEW
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. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 element.synchronizeAttribute(selectorAttr.localName()); 552 element.synchronizeAttribute(selectorAttr.localName());
553 553
554 const AtomicString& selectorValue = selector.value(); 554 const AtomicString& selectorValue = selector.value();
555 TextCaseSensitivity caseSensitivity = 555 TextCaseSensitivity caseSensitivity =
556 (selector.attributeMatch() == CSSSelector::CaseInsensitive) 556 (selector.attributeMatch() == CSSSelector::CaseInsensitive)
557 ? TextCaseASCIIInsensitive 557 ? TextCaseASCIIInsensitive
558 : TextCaseSensitive; 558 : TextCaseSensitive;
559 559
560 AttributeCollection attributes = element.attributesWithoutUpdate(); 560 AttributeCollection attributes = element.attributesWithoutUpdate();
561 for (const auto& attributeItem : attributes) { 561 for (const auto& attributeItem : attributes) {
562 if (!attributeItem.matches(selectorAttr)) 562 if (!attributeItem.matches(selectorAttr)) {
563 continue; 563 if (element.isHTMLElement() || !element.document().isHTMLDocument())
564 continue;
565 // Non-html attributes in html documents are normalized to their camel-
566 // cased version during parsing if applicable. Yet, attribute selectors
567 // are lower-cased for selectors in html documents. Compare the selector
568 // and the attribute local name insensitively to e.g. allow matching SVG
569 // attributes like viewBox.
570 if (!attributeItem.matchesCaseInsensitive(selectorAttr))
571 continue;
572 }
564 573
565 if (attributeValueMatches(attributeItem, match, selectorValue, 574 if (attributeValueMatches(attributeItem, match, selectorValue,
566 caseSensitivity)) 575 caseSensitivity))
567 return true; 576 return true;
568 577
569 if (caseSensitivity == TextCaseASCIIInsensitive) { 578 if (caseSensitivity == TextCaseASCIIInsensitive) {
570 if (selectorAttr.namespaceURI() != starAtom) 579 if (selectorAttr.namespaceURI() != starAtom)
571 return false; 580 return false;
572 continue; 581 continue;
573 } 582 }
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 } 1277 }
1269 1278
1270 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) { 1279 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) {
1271 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element), 1280 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element),
1272 CSSSelector::PseudoFocus)) 1281 CSSSelector::PseudoFocus))
1273 return true; 1282 return true;
1274 return element.isFocused() && isFrameFocused(element); 1283 return element.isFocused() && isFrameFocused(element);
1275 } 1284 }
1276 1285
1277 } // namespace blink 1286 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/css/viewBox-attribute-selector.html ('k') | third_party/WebKit/Source/core/dom/Attribute.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698