Chromium Code Reviews| Index: Source/core/html/HTMLFormControlElement.cpp |
| diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp |
| index 08ac138310c5ce5c1f779fb581780ac7d2b0f682..bdceeda2b3af6d6d56de136df6541d9f98e9c8b7 100644 |
| --- a/Source/core/html/HTMLFormControlElement.cpp |
| +++ b/Source/core/html/HTMLFormControlElement.cpp |
| @@ -55,6 +55,7 @@ HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Doc |
| , m_willValidate(true) |
| , m_isValid(true) |
| , m_wasChangedSinceLastFormControlChangeEvent(false) |
| + , m_wasFocusedByMouse(false) |
| , m_hasAutofocused(false) |
| { |
| setForm(form ? form : findFormAncestor()); |
| @@ -321,11 +322,32 @@ bool HTMLFormControlElement::isKeyboardFocusable(KeyboardEvent*) const |
| return isFocusable() && document()->frame(); |
| } |
| -bool HTMLFormControlElement::isMouseFocusable() const |
| +bool HTMLFormControlElement::shouldShowFocusRingOnMouseFocus() const |
| { |
| return false; |
| } |
| +void HTMLFormControlElement::dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode, FocusDirection direction) |
| +{ |
| + m_wasFocusedByMouse = direction == FocusDirectionMouse; |
| + HTMLElement::dispatchFocusEvent(oldFocusedNode, direction); |
| +} |
| + |
| +bool HTMLFormControlElement::shouldHaveFocusAppearance() const |
| +{ |
| + return shouldShowFocusRingOnMouseFocus() || !m_wasFocusedByMouse; |
| +} |
| + |
| +void HTMLFormControlElement::willHandleKeyDownEvent() |
|
ojan
2013/05/31 22:48:16
Could this instead be HTMLFormControlElement::defa
tkent
2013/06/02 23:52:14
It's hard because there are many "if (event->defau
|
| +{ |
| + if (!m_wasFocusedByMouse) |
| + return; |
| + m_wasFocusedByMouse = false; |
|
ojan
2013/05/31 22:48:16
Do you also need to handle blur and clear this boo
tkent
2013/06/02 23:52:14
It's unnecessary. The flag should be referred only
|
| + if (renderer()) |
| + renderer()->repaint(); |
| +} |
| + |
| + |
| short HTMLFormControlElement::tabIndex() const |
| { |
| // Skip the supportsFocus check in HTMLElement. |