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

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: Created 4 years, 11 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..6f8c69281063f3b9af2a96af9801bd499d16e872 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,7 @@ bool Element::supportsSpatialNavigationFocus() const
bool Element::isFocusable() const
{
+ ASSERT(!document().isActive() || !document().childNeedsStyleRecalc());
falken 2016/02/05 04:42:40 Was the comment about using childNeedsStyleRecalc(
tkent 2016/02/05 04:57:45 Ah, the comment is still valid. I add it again.
return inDocument() && supportsFocus() && !isInert() && layoutObjectIsFocusable();
}

Powered by Google App Engine
This is Rietveld 408576698