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

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

Issue 18888002: Introduce isHTMLAnchorElement and toHTMLAnchorElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 months 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
« no previous file with comments | « Source/core/css/CSSDefaultStyleSheets.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. 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 22 matching lines...) Expand all
33 #include "core/css/CSSSelectorList.h" 33 #include "core/css/CSSSelectorList.h"
34 #include "core/css/SiblingTraversalStrategies.h" 34 #include "core/css/SiblingTraversalStrategies.h"
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/dom/Element.h" 36 #include "core/dom/Element.h"
37 #include "core/dom/FullscreenController.h" 37 #include "core/dom/FullscreenController.h"
38 #include "core/dom/NodeRenderStyle.h" 38 #include "core/dom/NodeRenderStyle.h"
39 #include "core/dom/Text.h" 39 #include "core/dom/Text.h"
40 #include "core/dom/shadow/InsertionPoint.h" 40 #include "core/dom/shadow/InsertionPoint.h"
41 #include "core/dom/shadow/ShadowRoot.h" 41 #include "core/dom/shadow/ShadowRoot.h"
42 #include "core/editing/FrameSelection.h" 42 #include "core/editing/FrameSelection.h"
43 #include "core/html/HTMLAnchorElement.h"
43 #include "core/html/HTMLDocument.h" 44 #include "core/html/HTMLDocument.h"
44 #include "core/html/HTMLFrameElementBase.h" 45 #include "core/html/HTMLFrameElementBase.h"
45 #include "core/html/HTMLInputElement.h" 46 #include "core/html/HTMLInputElement.h"
46 #include "core/html/HTMLOptionElement.h" 47 #include "core/html/HTMLOptionElement.h"
47 #include "core/html/parser/HTMLParserIdioms.h" 48 #include "core/html/parser/HTMLParserIdioms.h"
48 #include "core/inspector/InspectorInstrumentation.h" 49 #include "core/inspector/InspectorInstrumentation.h"
49 #include "core/page/FocusController.h" 50 #include "core/page/FocusController.h"
50 #include "core/page/Frame.h" 51 #include "core/page/Frame.h"
51 #include "core/page/Page.h" 52 #include "core/page/Page.h"
52 #include "core/platform/ScrollableArea.h" 53 #include "core/platform/ScrollableArea.h"
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 element->setChildrenAffectedByDrag(true); 584 element->setChildrenAffectedByDrag(true);
584 } 585 }
585 if (element->renderer() && element->renderer()->isDragging()) 586 if (element->renderer() && element->renderer()->isDragging())
586 return true; 587 return true;
587 break; 588 break;
588 case CSSSelector::PseudoFocus: 589 case CSSSelector::PseudoFocus:
589 return matchesFocusPseudoClass(element); 590 return matchesFocusPseudoClass(element);
590 case CSSSelector::PseudoHover: 591 case CSSSelector::PseudoHover:
591 // If we're in quirks mode, then hover should never match anchors wi th no 592 // If we're in quirks mode, then hover should never match anchors wi th no
592 // href and *:hover should not match anything. This is important for sites like wsj.com. 593 // href and *:hover should not match anything. This is important for sites like wsj.com.
593 if (m_strictParsing || context.isSubSelector || (selector->m_match = = CSSSelector::Tag && selector->tagQName() != anyQName() && !element->hasTagName (aTag)) || element->isLink()) { 594 if (m_strictParsing || context.isSubSelector || (selector->m_match = = CSSSelector::Tag && selector->tagQName() != anyQName() && !isHTMLAnchorElement (element)) || element->isLink()) {
594 if (m_mode == ResolvingStyle) { 595 if (m_mode == ResolvingStyle) {
595 if (context.elementStyle) 596 if (context.elementStyle)
596 context.elementStyle->setAffectedByHover(); 597 context.elementStyle->setAffectedByHover();
597 else 598 else
598 element->setChildrenAffectedByHover(true); 599 element->setChildrenAffectedByHover(true);
599 } 600 }
600 if (element->hovered() || InspectorInstrumentation::forcePseudoS tate(element, CSSSelector::PseudoHover)) 601 if (element->hovered() || InspectorInstrumentation::forcePseudoS tate(element, CSSSelector::PseudoHover))
601 return true; 602 return true;
602 } 603 }
603 break; 604 break;
604 case CSSSelector::PseudoActive: 605 case CSSSelector::PseudoActive:
605 // If we're in quirks mode, then :active should never match anchors with no 606 // If we're in quirks mode, then :active should never match anchors with no
606 // href and *:active should not match anything. 607 // href and *:active should not match anything.
607 if (m_strictParsing || context.isSubSelector || (selector->m_match = = CSSSelector::Tag && selector->tagQName() != anyQName() && !element->hasTagName (aTag)) || element->isLink()) { 608 if (m_strictParsing || context.isSubSelector || (selector->m_match = = CSSSelector::Tag && selector->tagQName() != anyQName() && !isHTMLAnchorElement (element)) || element->isLink()) {
608 if (m_mode == ResolvingStyle) { 609 if (m_mode == ResolvingStyle) {
609 if (context.elementStyle) 610 if (context.elementStyle)
610 context.elementStyle->setAffectedByActive(); 611 context.elementStyle->setAffectedByActive();
611 else 612 else
612 element->setChildrenAffectedByActive(true); 613 element->setChildrenAffectedByActive(true);
613 } 614 }
614 if (element->active() || InspectorInstrumentation::forcePseudoSt ate(element, CSSSelector::PseudoActive)) 615 if (element->active() || InspectorInstrumentation::forcePseudoSt ate(element, CSSSelector::PseudoActive))
615 return true; 616 return true;
616 } 617 }
617 break; 618 break;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 return element->focused() && isFrameFocused(element); 911 return element->focused() && isFrameFocused(element);
911 } 912 }
912 913
913 template 914 template
914 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const DOMSiblingTraversalStrategy&) const; 915 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const DOMSiblingTraversalStrategy&) const;
915 916
916 template 917 template
917 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const ShadowDOMSiblingTraversalStrategy&) const; 918 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const ShadowDOMSiblingTraversalStrategy&) const;
918 919
919 } 920 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSDefaultStyleSheets.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698