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

Unified Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1883083002: Introduce Node::containingTreeScope(), which asserts that the node's root is a tree scope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: renamed Created 4 years, 7 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
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)
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/LiveNodeListBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698