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

Unified Diff: Source/core/html/HTMLAnchorElement.cpp

Issue 537353002: Update :link/:visited style when changing href. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/css/visited-link-href-changed-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLAnchorElement.cpp
diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp
index fcd81d8c01a7dea5f2b9818188e643d2a231607d..8705c2e196c4518a47b9cdbf2c46c74e01e83971 100644
--- a/Source/core/html/HTMLAnchorElement.cpp
+++ b/Source/core/html/HTMLAnchorElement.cpp
@@ -196,13 +196,16 @@ void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicSt
if (name == hrefAttr) {
bool wasLink = isLink();
setIsLink(!value.isNull());
- if (wasLink != isLink()) {
- didAffectSelector(AffectedSelectorLink | AffectedSelectorVisited | AffectedSelectorEnabled);
- if (wasLink && treeScope().adjustedFocusedElement() == this) {
- // We might want to call blur(), but it's dangerous to dispatch
- // events here.
- document().setNeedsFocusedElementCheck();
- }
+ if (wasLink || isLink()) {
+ AffectedSelectorMask affectedPseudo = AffectedSelectorLink | AffectedSelectorVisited;
+ if (wasLink != isLink())
+ affectedPseudo |= AffectedSelectorEnabled;
+ didAffectSelector(affectedPseudo);
+ }
+ if (wasLink && !isLink() && treeScope().adjustedFocusedElement() == this) {
+ // We might want to call blur(), but it's dangerous to dispatch
+ // events here.
+ document().setNeedsFocusedElementCheck();
}
if (isLink()) {
String parsedURL = stripLeadingAndTrailingHTMLSpaces(value);
« no previous file with comments | « LayoutTests/fast/css/visited-link-href-changed-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698