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

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

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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Element.h
diff --git a/third_party/WebKit/Source/core/dom/Element.h b/third_party/WebKit/Source/core/dom/Element.h
index 240ec279fd27930c3ebc18d8a715b73653b1d06e..604565dcb07440546cc8cace39a82e2efc43b1bc 100644
--- a/third_party/WebKit/Source/core/dom/Element.h
+++ b/third_party/WebKit/Source/core/dom/Element.h
@@ -410,11 +410,15 @@ public:
// layoutObjectIsFocusable(), this method may be called when layout is not up to
// date, so it must not use the layoutObject to determine focusability.
virtual bool supportsFocus() const;
- // Whether the node can actually be focused.
+ // isFocusable(), isKeyboardFocusable(), and isMouseFocusable() check
+ // whether the element can actually be focused. Callers should ensure
+ // ComputedStyle is up to date;
+ // e.g. by calling Document::updateLayoutTreeIgnorePendingStylesheets().
bool isFocusable() const;
- bool isFocusedElementInDocument() const;
virtual bool isKeyboardFocusable() const;
virtual bool isMouseFocusable() const;
+ bool isFocusedElementInDocument() const;
+
virtual void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, InputDeviceCapabilities* sourceCapabilities = nullptr);
virtual void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, InputDeviceCapabilities* sourceCapabilities = nullptr);
virtual void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocusedElement, WebFocusType, InputDeviceCapabilities* sourceCapabilities = nullptr);
@@ -583,11 +587,13 @@ protected:
void clearTabIndexExplicitlyIfNeeded();
void setTabIndexExplicitly(short);
- // Subclasses may override this method to affect focusability. Unlike
- // supportsFocus, this method must be called on an up-to-date layout, so it
- // may use the layoutObject to reason about focusability. This method cannot be
- // moved to LayoutObject because some focusable nodes don't have layoutObjects,
- // e.g., HTMLOptionElement.
+ // Subclasses may override this method to affect focusability. This method
+ // must be called on an up-to-date ComputedStyle, so it may use existence of
+ // layoutObject and the LayoutObject::style() to reason about focusability.
+ // However, it must not retrieve layout information like position and size.
+ // This method cannot be moved to LayoutObject because some focusable nodes
+ // don't have layoutObjects. e.g., HTMLOptionElement.
+ // TODO(tkent): Rename this to isFocusableStyle.
virtual bool layoutObjectIsFocusable() const;
// classAttributeChanged() exists to share code between
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698