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

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

Issue 2625903002: Improve performance of HTMLElement::attributeChanged. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLElement.cpp b/third_party/WebKit/Source/core/html/HTMLElement.cpp
index 729ac0ef40a33ce2a8d2a9bb2f77c30bc47fc229..deaffb100f9afb20f25292e1f32f9b3112c24a82 100644
--- a/third_party/WebKit/Source/core/html/HTMLElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLElement.cpp
@@ -430,11 +430,14 @@ void HTMLElement::attributeChanged(const AttributeModificationParams& params) {
Element::attributeChanged(params);
if (params.reason != AttributeModificationReason::kDirectly)
return;
- if (adjustedFocusedElementInTreeScope() != this)
- return;
+ // adjustedFocusedElementInTreeScope() is not trivial. We should check
+ // attribute names, then call adjustedFocusedElementInTreeScope().
if (params.name == hiddenAttr && !params.newValue.isNull()) {
- blur();
+ if (adjustedFocusedElementInTreeScope() == this)
+ blur();
} else if (params.name == contenteditableAttr) {
+ if (adjustedFocusedElementInTreeScope() != this)
+ return;
// The attribute change may cause supportsFocus() to return false
// for the element which had focus.
//
« 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