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

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

Issue 1667623002: Make sure Document::updateLayoutTree*() is called before Element::isFocusable(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comments Created 4 years, 10 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 35399cff8565c8edc5b25c49a79ad22a1ff3878f..b073d1cc1dd6a8117e67a4c1b358b5eab5a50f14 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -258,24 +258,9 @@ bool Element::layoutObjectIsFocusable() const
return canvas->layoutObject() && canvas->layoutObject()->style()->visibility() == VISIBLE;
}
- // FIXME: These asserts should be in Node::isFocusable, but there are some
- // callsites like Document::setFocusedElement that would currently fail on
- // them. See crbug.com/251163
- if (!layoutObject()) {
- // We can't just use needsStyleRecalc() because if the node is in a
- // display:none tree it might say it needs style recalc but the whole
- // document is actually up to date.
- // In addition, style cannot be cleared out for non-active documents,
- // so in that case the childNeedsStyleRecalc check is invalid.
- ASSERT(!document().isActive() || !document().childNeedsStyleRecalc());
- }
-
// FIXME: Even if we are not visible, we might have a child that is visible.
// Hyatt wants to fix that some day with a "has visible content" flag or the like.
- if (!layoutObject() || layoutObject()->style()->visibility() != VISIBLE)
- return false;
-
- return true;
+ return layoutObject() && layoutObject()->style()->visibility() == VISIBLE;
}
PassRefPtrWillBeRawPtr<Node> Element::cloneNode(bool deep)
@@ -2446,6 +2431,12 @@ bool Element::supportsSpatialNavigationFocus() const
bool Element::isFocusable() const
{
+ // We can't just use needsStyleRecalc() because if the node is in a
+ // display:none tree it might say it needs style recalc but the whole
+ // document is actually up to date.
+ // In addition, style cannot be cleared out for non-active documents, so in
+ // that case the childNeedsStyleRecalc check is invalid.
+ ASSERT(!document().isActive() || !document().childNeedsStyleRecalc());
return inDocument() && supportsFocus() && !isInert() && layoutObjectIsFocusable();
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698