Chromium Code Reviews| 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 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 if (isHTMLAnchorElement(element)) | 52 if (isHTMLAnchorElement(element)) |
| 53 return toHTMLAnchorElement(element).visitedLinkHash(); | 53 return toHTMLAnchorElement(element).visitedLinkHash(); |
| 54 return visitedLinkHash(element.document().baseURL(), attribute.isNull() ? li nkAttribute(element) : attribute); | 54 return visitedLinkHash(element.document().baseURL(), attribute.isNull() ? li nkAttribute(element) : attribute); |
| 55 } | 55 } |
| 56 | 56 |
| 57 VisitedLinkState::VisitedLinkState(const Document& document) | 57 VisitedLinkState::VisitedLinkState(const Document& document) |
| 58 : m_document(document) | 58 : m_document(document) |
| 59 { | 59 { |
| 60 } | 60 } |
| 61 | 61 |
| 62 void VisitedLinkState::invalidateStyleForAllLinks() | 62 void VisitedLinkState::invalidateStyleForAllLinks(bool invalidateVisitedLinkHash es) |
| 63 { | 63 { |
| 64 if (m_linksCheckedForVisitedState.isEmpty()) | 64 if (m_linksCheckedForVisitedState.isEmpty()) |
| 65 return; | 65 return; |
| 66 for (Node& node : NodeTraversal::startsAt(document().firstChild())) { | 66 for (Node& node : NodeTraversal::startsAt(document().firstChild())) { |
| 67 if (node.isLink()) | 67 if (node.isLink()) { |
| 68 if (invalidateVisitedLinkHashes && isHTMLAnchorElement(node)) | |
|
brettw
2015/12/08 00:54:42
Although I'm in the root-level owners file, I'm no
| |
| 69 toHTMLAnchorElement(node).invalidateCachedVisitedLinkHash(); | |
| 68 node.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTra cing::create(StyleChangeReason::VisitedLink)); | 70 node.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTra cing::create(StyleChangeReason::VisitedLink)); |
| 71 } | |
| 69 } | 72 } |
| 70 } | 73 } |
| 71 | 74 |
| 72 void VisitedLinkState::invalidateStyleForLink(LinkHash linkHash) | 75 void VisitedLinkState::invalidateStyleForLink(LinkHash linkHash) |
| 73 { | 76 { |
| 74 if (!m_linksCheckedForVisitedState.contains(linkHash)) | 77 if (!m_linksCheckedForVisitedState.contains(linkHash)) |
| 75 return; | 78 return; |
| 76 for (Node& node : NodeTraversal::startsAt(document().firstChild())) { | 79 for (Node& node : NodeTraversal::startsAt(document().firstChild())) { |
| 77 if (node.isLink() && linkHashForElement(toElement(node)) == linkHash) | 80 if (node.isLink() && linkHashForElement(toElement(node)) == linkHash) |
| 78 node.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTra cing::create(StyleChangeReason::VisitedLink)); | 81 node.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTra cing::create(StyleChangeReason::VisitedLink)); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 105 | 108 |
| 106 return InsideUnvisitedLink; | 109 return InsideUnvisitedLink; |
| 107 } | 110 } |
| 108 | 111 |
| 109 DEFINE_TRACE(VisitedLinkState) | 112 DEFINE_TRACE(VisitedLinkState) |
| 110 { | 113 { |
| 111 visitor->trace(m_document); | 114 visitor->trace(m_document); |
| 112 } | 115 } |
| 113 | 116 |
| 114 } // namespace blink | 117 } // namespace blink |
| OLD | NEW |