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

Unified Diff: Source/core/html/HTMLFormControlElement.cpp

Issue 562653002: Do not reset mouse focus flag on keydown at anchor elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add regression test (click-focus-keydown-no-ring) Created 6 years, 3 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 | « Source/core/html/HTMLFormControlElement.h ('k') | Source/core/svg/SVGAElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLFormControlElement.cpp
diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp
index 3ad09c1b9ffe14b63973f60877eb318aad4bf0be..827199b43fc83dde6ba73e35664e27a11e24e4da 100644
--- a/Source/core/html/HTMLFormControlElement.cpp
+++ b/Source/core/html/HTMLFormControlElement.cpp
@@ -340,14 +340,22 @@ bool HTMLFormControlElement::shouldHaveFocusAppearance() const
return !m_wasFocusedByMouse || shouldShowFocusRingOnMouseFocus();
}
-bool HTMLFormControlElement::wasFocusedByMouse() const
+void HTMLFormControlElement::dispatchFocusEvent(Element* oldFocusedElement, FocusType type)
{
- return m_wasFocusedByMouse;
+ if (type != FocusTypePage)
+ m_wasFocusedByMouse = type == FocusTypeMouse;
+ HTMLElement::dispatchFocusEvent(oldFocusedElement, type);
}
-void HTMLFormControlElement::setWasFocusedByMouse(bool wasFocusedByMouse)
+void HTMLFormControlElement::willCallDefaultEventHandler(const Event& event)
{
- m_wasFocusedByMouse = wasFocusedByMouse;
+ if (!m_wasFocusedByMouse)
+ return;
+ if (!event.isKeyboardEvent() || event.type() != EventTypeNames::keydown)
+ return;
+ m_wasFocusedByMouse = false;
+ if (renderer())
+ renderer()->setShouldDoFullPaintInvalidation(true);
}
short HTMLFormControlElement::tabIndex() const
« no previous file with comments | « Source/core/html/HTMLFormControlElement.h ('k') | Source/core/svg/SVGAElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698