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

Side by Side 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 unified diff | 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 »
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) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Simon Hausmann <hausmann@kde.org> 4 * (C) 2000 Simon Hausmann <hausmann@kde.org>
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 } 190 }
191 HTMLElement::attributeWillChange(name, oldValue, newValue); 191 HTMLElement::attributeWillChange(name, oldValue, newValue);
192 } 192 }
193 193
194 void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) 194 void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
195 { 195 {
196 if (name == hrefAttr) { 196 if (name == hrefAttr) {
197 bool wasLink = isLink(); 197 bool wasLink = isLink();
198 setIsLink(!value.isNull()); 198 setIsLink(!value.isNull());
199 if (wasLink != isLink()) { 199 if (wasLink || isLink()) {
200 didAffectSelector(AffectedSelectorLink | AffectedSelectorVisited | A ffectedSelectorEnabled); 200 AffectedSelectorMask affectedPseudo = AffectedSelectorLink | Affecte dSelectorVisited;
201 if (wasLink && treeScope().adjustedFocusedElement() == this) { 201 if (wasLink != isLink())
202 // We might want to call blur(), but it's dangerous to dispatch 202 affectedPseudo |= AffectedSelectorEnabled;
203 // events here. 203 didAffectSelector(affectedPseudo);
204 document().setNeedsFocusedElementCheck(); 204 }
205 } 205 if (wasLink && !isLink() && treeScope().adjustedFocusedElement() == this ) {
206 // We might want to call blur(), but it's dangerous to dispatch
207 // events here.
208 document().setNeedsFocusedElementCheck();
206 } 209 }
207 if (isLink()) { 210 if (isLink()) {
208 String parsedURL = stripLeadingAndTrailingHTMLSpaces(value); 211 String parsedURL = stripLeadingAndTrailingHTMLSpaces(value);
209 if (document().isDNSPrefetchEnabled()) { 212 if (document().isDNSPrefetchEnabled()) {
210 if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "http s") || parsedURL.startsWith("//")) 213 if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "http s") || parsedURL.startsWith("//"))
211 prefetchDNS(document().completeURL(parsedURL).host()); 214 prefetchDNS(document().completeURL(parsedURL).host());
212 } 215 }
213 } 216 }
214 invalidateCachedVisitedLinkHash(); 217 invalidateCachedVisitedLinkHash();
215 } else if (name == nameAttr || name == titleAttr) { 218 } else if (name == nameAttr || name == titleAttr) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 Vector<String> argv; 397 Vector<String> argv;
395 argv.append("a"); 398 argv.append("a");
396 argv.append(fastGetAttribute(hrefAttr)); 399 argv.append(fastGetAttribute(hrefAttr));
397 activityLogger->logEvent("blinkAddElement", argv.size(), argv.data() ); 400 activityLogger->logEvent("blinkAddElement", argv.size(), argv.data() );
398 } 401 }
399 } 402 }
400 return HTMLElement::insertedInto(insertionPoint); 403 return HTMLElement::insertedInto(insertionPoint);
401 } 404 }
402 405
403 } 406 }
OLDNEW
« 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