Index: third_party/WebKit/Source/core/dom/Element.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp |
index 7c0ce545a2e190f042784245f69865a1003d0b39..f01ea115c29f67fe68fcde5dea822cc767b52016 100644 |
--- a/third_party/WebKit/Source/core/dom/Element.cpp |
+++ b/third_party/WebKit/Source/core/dom/Element.cpp |
@@ -2224,7 +2224,7 @@ void Element::parseAttribute(const QualifiedName& name, const AtomicString&, con |
int tabindex = 0; |
if (value.isEmpty()) { |
clearTabIndexExplicitlyIfNeeded(); |
- if (treeScope().adjustedFocusedElement() == this) { |
+ if (isInTreeScope() && rootTreeScope().adjustedFocusedElement() == this) { |
// We might want to call blur(), but it's dangerous to dispatch |
// events here. |
document().setNeedsFocusedElementCheck(); |
@@ -2422,7 +2422,7 @@ void Element::updateFocusAppearance(SelectionBehaviorOnFocus selectionBehavior) |
void Element::blur() |
{ |
cancelFocusAppearanceUpdate(); |
- if (treeScope().adjustedFocusedElement() == this) { |
+ if (isInTreeScope() && rootTreeScope().adjustedFocusedElement() == this) { |
Document& doc = document(); |
if (doc.page()) |
doc.page()->focusController().setFocusedElement(0, doc.frame()); |
@@ -3144,7 +3144,7 @@ inline void Element::updateId(const AtomicString& oldId, const AtomicString& new |
if (oldId == newId) |
return; |
- updateId(treeScope(), oldId, newId); |
+ updateId(rootTreeScope(), oldId, newId); |
} |
inline void Element::updateId(TreeScope& scope, const AtomicString& oldId, const AtomicString& newId) |