Merge from Chromium at DEPS revision r213780
This commit was generated by merge_to_master.py.
Change-Id: I702915ad75bd2cc5201b0239db771978b0a8137d
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index dc64b8d..3d1ad9c 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -50,7 +50,9 @@
#include "core/dom/Document.h"
#include "core/dom/DocumentSharedObjectPool.h"
#include "core/dom/ElementRareData.h"
+#include "core/dom/EventDispatcher.h"
#include "core/dom/ExceptionCode.h"
+#include "core/dom/FocusEvent.h"
#include "core/dom/FullscreenController.h"
#include "core/dom/MutationObserverInterestGroup.h"
#include "core/dom/MutationRecord.h"
@@ -2059,6 +2061,32 @@
}
}
+void Element::dispatchFocusEvent(Element* oldFocusedElement, FocusDirection)
+{
+ RefPtr<FocusEvent> event = FocusEvent::create(eventNames().focusEvent, false, false, document()->defaultView(), 0, oldFocusedElement);
+ EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(event.release()));
+}
+
+void Element::dispatchBlurEvent(Element* newFocusedElement)
+{
+ RefPtr<FocusEvent> event = FocusEvent::create(eventNames().blurEvent, false, false, document()->defaultView(), 0, newFocusedElement);
+ EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event.release()));
+}
+
+void Element::dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocusedElement)
+{
+ ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
+ ASSERT(eventType == eventNames().focusinEvent || eventType == eventNames().DOMFocusInEvent);
+ dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, oldFocusedElement)));
+}
+
+void Element::dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocusedElement)
+{
+ ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
+ ASSERT(eventType == eventNames().focusoutEvent || eventType == eventNames().DOMFocusOutEvent);
+ dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, newFocusedElement)));
+}
+
String Element::innerText()
{
// We need to update layout, since plainText uses line boxes in the render tree.