Chromium Code Reviews| 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..342bb09c8184ba76f0b520327dbfd9d0113a1bea 100644 |
| --- a/third_party/WebKit/Source/core/dom/Element.h |
| +++ b/third_party/WebKit/Source/core/dom/Element.h |
| @@ -410,11 +410,14 @@ 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. |
| + // Whether the node can actually be focused. Callers should ensure |
| + // ComputedStyle is up to date; |
| + // e.g. Calling Document::updateLayoutTreeIgnorePendingStylesheets(). |
|
falken
2016/02/05 04:42:40
comment nits: one space after period is consistent
tkent
2016/02/05 04:57:45
Done.
|
| 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 +586,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, we must not retrieve layout information like position and size. |
|
falken
2016/02/05 04:42:40
"we" -> "it" is more consistent with the previous
tkent
2016/02/05 04:57:45
Done.
|
| + // This method cannot be moved to LayoutObject because some focusable nodes |
| + // don't have layoutObjects. e.g., HTMLOptionElement. |
| + // TODO(tkent): Rename this to isFocusableStyle. |
|
falken
2016/02/05 04:42:40
good idea!
|
| virtual bool layoutObjectIsFocusable() const; |
| // classAttributeChanged() exists to share code between |