Index: Source/core/dom/Element.cpp |
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
index 0253525e3481a27a63fbedffb0bd68d3fdddb7af..fe79ed5c6b097d94fbc3fef74c989bbd9cf602b9 100644 |
--- a/Source/core/dom/Element.cpp |
+++ b/Source/core/dom/Element.cpp |
@@ -2164,8 +2164,22 @@ bool Element::isMouseFocusable() const |
return isFocusable(); |
} |
-void Element::dispatchFocusEvent(Element* oldFocusedElement, FocusType) |
+void Element::willCallDefaultEventHandler(const Event& event) |
{ |
+ if (!wasFocusedByMouse()) |
+ return; |
+ if (!event.isKeyboardEvent() || event.type() != EventTypeNames::keydown) |
+ return; |
+ setWasFocusedByMouse(false); |
+ if (renderer()) |
+ renderer()->setShouldDoFullPaintInvalidation(true); |
+} |
+ |
+void Element::dispatchFocusEvent(Element* oldFocusedElement, FocusType type) |
+{ |
+ if (type != FocusTypePage) |
+ setWasFocusedByMouse(type == FocusTypeMouse); |
+ |
RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::focus, false, false, document().domWindow(), 0, oldFocusedElement); |
EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(event.release())); |
} |