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

Unified Diff: Source/core/page/FocusController.cpp

Issue 205033004: Dispatch change and blur event for input type=text when window focus is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Using HTMLFormControlElement instead of HTMLInputElement to check changes and dispatch change event Created 6 years, 9 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 | « LayoutTests/fast/forms/text/text-window-lost-focus-change-event-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/FocusController.cpp
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index 8c0002e58fee5754ad3ce1e2135aa09b61563354..17a3fecab16cc261c4d2f5e624aba55c99ca4e22 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -46,6 +46,7 @@
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLAreaElement.h"
#include "core/html/HTMLImageElement.h"
+#include "core/html/HTMLInputElement.h"
tkent 2014/03/27 00:46:04 I don't think adding dependency to a specific elem
#include "core/html/HTMLPlugInElement.h"
#include "core/html/HTMLShadowElement.h"
#include "core/page/Chrome.h"
@@ -144,7 +145,15 @@ static inline void dispatchEventsOnWindowAndFocusedNode(Document* document, bool
if (!focused && document->focusedElement()) {
RefPtr<Element> focusedElement(document->focusedElement());
- focusedElement->dispatchBlurEvent(0);
+ if (focusedElement && focusedElement->isHTMLElement()) {
+ HTMLElement* element = toHTMLElement(focusedElement);
+ if (element && element->isFormControlElement()) {
+ if (toHTMLFormControlElement(element)->wasChangedSinceLastFormControlChangeEvent())
+ toHTMLFormControlElement(element)->dispatchFormControlChangeEvent();
+ }
+ }
+ if (focusedElement == document->focusedElement())
+ focusedElement->dispatchBlurEvent(0);
if (focusedElement == document->focusedElement()) {
focusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, 0);
if (focusedElement == document->focusedElement())
« no previous file with comments | « LayoutTests/fast/forms/text/text-window-lost-focus-change-event-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698