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. |
// |