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

Side by Side Diff: third_party/WebKit/Source/core/dom/VisitedLinkState.cpp

Issue 1689873004: Invalidate :-webkit-any-link for visited state changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | 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 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void VisitedLinkState::invalidateStyleForAllLinks(bool invalidateVisitedLinkHash es) 61 void VisitedLinkState::invalidateStyleForAllLinks(bool invalidateVisitedLinkHash es)
62 { 62 {
63 if (m_linksCheckedForVisitedState.isEmpty()) 63 if (m_linksCheckedForVisitedState.isEmpty())
64 return; 64 return;
65 for (Node& node : NodeTraversal::startsAt(document().firstChild())) { 65 for (Node& node : NodeTraversal::startsAt(document().firstChild())) {
66 if (node.isLink()) { 66 if (node.isLink()) {
67 if (invalidateVisitedLinkHashes && isHTMLAnchorElement(node)) 67 if (invalidateVisitedLinkHashes && isHTMLAnchorElement(node))
68 toHTMLAnchorElement(node).invalidateCachedVisitedLinkHash(); 68 toHTMLAnchorElement(node).invalidateCachedVisitedLinkHash();
69 toElement(node).pseudoStateChanged(CSSSelector::PseudoLink); 69 toElement(node).pseudoStateChanged(CSSSelector::PseudoLink);
70 toElement(node).pseudoStateChanged(CSSSelector::PseudoVisited); 70 toElement(node).pseudoStateChanged(CSSSelector::PseudoVisited);
71 toElement(node).pseudoStateChanged(CSSSelector::PseudoAnyLink);
71 } 72 }
72 } 73 }
73 } 74 }
74 75
75 void VisitedLinkState::invalidateStyleForLink(LinkHash linkHash) 76 void VisitedLinkState::invalidateStyleForLink(LinkHash linkHash)
76 { 77 {
77 if (!m_linksCheckedForVisitedState.contains(linkHash)) 78 if (!m_linksCheckedForVisitedState.contains(linkHash))
78 return; 79 return;
79 for (Node& node : NodeTraversal::startsAt(document().firstChild())) { 80 for (Node& node : NodeTraversal::startsAt(document().firstChild())) {
80 if (node.isLink() && linkHashForElement(toElement(node)) == linkHash) { 81 if (node.isLink() && linkHashForElement(toElement(node)) == linkHash) {
81 toElement(node).pseudoStateChanged(CSSSelector::PseudoLink); 82 toElement(node).pseudoStateChanged(CSSSelector::PseudoLink);
82 toElement(node).pseudoStateChanged(CSSSelector::PseudoVisited); 83 toElement(node).pseudoStateChanged(CSSSelector::PseudoVisited);
84 toElement(node).pseudoStateChanged(CSSSelector::PseudoAnyLink);
83 } 85 }
84 } 86 }
85 } 87 }
86 88
87 EInsideLink VisitedLinkState::determineLinkStateSlowCase(const Element& element) 89 EInsideLink VisitedLinkState::determineLinkStateSlowCase(const Element& element)
88 { 90 {
89 ASSERT(element.isLink()); 91 ASSERT(element.isLink());
90 ASSERT(document().isActive()); 92 ASSERT(document().isActive());
91 ASSERT(document() == element.document()); 93 ASSERT(document() == element.document());
92 94
(...skipping 17 matching lines...) Expand all
110 112
111 return InsideUnvisitedLink; 113 return InsideUnvisitedLink;
112 } 114 }
113 115
114 DEFINE_TRACE(VisitedLinkState) 116 DEFINE_TRACE(VisitedLinkState)
115 { 117 {
116 visitor->trace(m_document); 118 visitor->trace(m_document);
117 } 119 }
118 120
119 } // namespace blink 121 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698