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 ad733eb0c4ddb3bace00238d67d869cb8e823127..cda00bea3aa0d11f85cd1cd3d217127b256322f8 100644 |
--- a/third_party/WebKit/Source/core/dom/Element.cpp |
+++ b/third_party/WebKit/Source/core/dom/Element.cpp |
@@ -2223,7 +2223,7 @@ void Element::parseAttribute(const QualifiedName& name, const AtomicString&, con |
int tabindex = 0; |
if (value.isEmpty()) { |
clearTabIndexExplicitlyIfNeeded(); |
- if (treeScope().adjustedFocusedElement() == this) { |
+ if (adjustedFocusedElementInTreeScope() == this) { |
// We might want to call blur(), but it's dangerous to dispatch |
// events here. |
document().setNeedsFocusedElementCheck(); |
@@ -2421,7 +2421,7 @@ void Element::updateFocusAppearance(SelectionBehaviorOnFocus selectionBehavior) |
void Element::blur() |
{ |
cancelFocusAppearanceUpdate(); |
- if (treeScope().adjustedFocusedElement() == this) { |
+ if (adjustedFocusedElementInTreeScope() == this) { |
Document& doc = document(); |
if (doc.page()) |
doc.page()->focusController().setFocusedElement(0, doc.frame()); |
@@ -2488,6 +2488,11 @@ bool Element::isFocusedElementInDocument() const |
return this == document().focusedElement(); |
} |
+Element* Element::adjustedFocusedElementInTreeScope() const |
+{ |
+ return isInTreeScope() ? containingTreeScope().adjustedFocusedElement() : nullptr; |
+} |
+ |
void Element::dispatchFocusEvent(Element* oldFocusedElement, WebFocusType type, InputDeviceCapabilities* sourceCapabilities) |
{ |
dispatchEvent(FocusEvent::create(EventTypeNames::focus, false, false, document().domWindow(), 0, oldFocusedElement, sourceCapabilities)); |
@@ -3151,7 +3156,7 @@ inline void Element::updateId(const AtomicString& oldId, const AtomicString& new |
if (oldId == newId) |
return; |
- updateId(treeScope(), oldId, newId); |
+ updateId(containingTreeScope(), oldId, newId); |
} |
inline void Element::updateId(TreeScope& scope, const AtomicString& oldId, const AtomicString& newId) |