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

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

Issue 2586143004: Blur immediately if an attribute change made an element unfocasable. (Closed)
Patch Set: Update comments and a function name Created 4 years 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
Index: third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp b/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
index 243f494f442a73d5ada474ed479660b14bc431d9..724d1f843102bbf9af4b2f4369aa2c76680b059a 100644
--- a/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
@@ -251,6 +251,20 @@ void HTMLAnchorElement::setActive(bool down) {
ContainerNode::setActive(down);
}
+void HTMLAnchorElement::attributeChanged(const QualifiedName& name,
+ const AtomicString& oldValue,
+ const AtomicString& newValue,
+ AttributeModificationReason reason) {
+ HTMLElement::attributeChanged(name, oldValue, newValue, reason);
+ if (reason != AttributeModificationReason::kDirectly)
+ return;
+ if (name != hrefAttr && isLink())
+ return;
+ if (adjustedFocusedElementInTreeScope() != this)
+ return;
+ blur();
+}
+
void HTMLAnchorElement::parseAttribute(const QualifiedName& name,
const AtomicString& oldValue,
const AtomicString& value) {
@@ -262,11 +276,6 @@ void HTMLAnchorElement::parseAttribute(const QualifiedName& name,
pseudoStateChanged(CSSSelector::PseudoVisited);
pseudoStateChanged(CSSSelector::PseudoAnyLink);
}
- if (wasLink && !isLink() && adjustedFocusedElementInTreeScope() == this) {
- // We might want to call blur(), but it's dangerous to dispatch
- // events here.
- document().setNeedsFocusedElementCheck();
- }
if (isLink()) {
String parsedURL = stripLeadingAndTrailingHTMLSpaces(value);
if (document().isDNSPrefetchEnabled()) {
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLAnchorElement.h ('k') | third_party/WebKit/Source/core/html/HTMLElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698