Diff
Modified: trunk/LayoutTests/ChangeLog (142239 => 142240)
--- trunk/LayoutTests/ChangeLog 2013-02-08 07:58:37 UTC (rev 142239)
+++ trunk/LayoutTests/ChangeLog 2013-02-08 08:05:49 UTC (rev 142240)
@@ -1,3 +1,21 @@
+2013-02-08 Kentaro Hara <[email protected]>
+
+ Support a relatedTarget attribute on focus/blur events
+ https://bugs.webkit.org/show_bug.cgi?id=109176
+
+ Reviewed by Ojan Vafai.
+
+ In bug 76216, we supported a relatedTarget attribute on
+ focusin/focusout events. We should also support it on focus/blur events.
+
+ See http://lists.w3.org/Archives/Public/www-dom/2012OctDec/0061.html
+ for the www-dom discussion.
+
+ * fast/dom/shadow/shadow-boundary-events-expected.txt:
+ * fast/dom/shadow/shadow-boundary-events.html:
+ * fast/events/related-target-focusevent-expected.txt:
+ * fast/events/related-target-focusevent.html:
+
2013-02-07 Yury Semikhatsky <[email protected]>
Web Inspector: reduce number of native memory instrumentation categories
Modified: trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events-expected.txt (142239 => 142240)
--- trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events-expected.txt 2013-02-08 07:58:37 UTC (rev 142239)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events-expected.txt 2013-02-08 08:05:49 UTC (rev 142240)
@@ -71,13 +71,13 @@
Move focus from a node to its sibling node. All nodes are outside of shadow boundary.
Moving focus from divB to divC
-PASS dispatchedEvent("focus") is ["divC(@divA)(capturing phase)", "divC(@divC)"]
-PASS dispatchedEvent("blur") is ["divB(@divA)(capturing phase)", "divB(@divB)"]
+PASS dispatchedEvent("focus") is ["divC(<-divB)(@divA)(capturing phase)", "divC(<-divB)(@divC)"]
+PASS dispatchedEvent("blur") is ["divB(<-divC)(@divA)(capturing phase)", "divB(<-divC)(@divB)"]
Old focused node and new focused node exist in separated subtrees, crossing shadow boundaries. Making sure that an event is not dispatched beyond the lowest common boundary.
Moving focus from shadowD/shadowF/shadowG/divH to shadowD/shadowK/divL
-PASS dispatchedEvent("focus") is ["shadowK(@divJ)(capturing phase)", "shadowK(@shadowK)", "divL(@divL)"]
-PASS dispatchedEvent("blur") is ["shadowF(@divE)(capturing phase)", "shadowF(@shadowF)", "shadowG(@shadowG)", "divH(@divH)"]
+PASS dispatchedEvent("focus") is ["shadowK(<-shadowF)(@divJ)(capturing phase)", "shadowK(<-shadowF)(@shadowK)", "divL(<-shadowF)(@divL)"]
+PASS dispatchedEvent("blur") is ["shadowF(<-shadowK)(@divE)(capturing phase)", "shadowF(<-shadowK)(@shadowF)", "shadowG(<-shadowK)(@shadowG)", "divH(<-shadowK)(@divH)"]
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events.html (142239 => 142240)
--- trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events.html 2013-02-08 07:58:37 UTC (rev 142239)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-boundary-events.html 2013-02-08 08:05:49 UTC (rev 142240)
@@ -194,13 +194,13 @@
// Test for focus/blur events. Event listners should be registerd on captureing phase.
moveFocus('divB', 'divC',
'Move focus from a node to its sibling node. All nodes are outside of shadow boundary.');
- shouldBe('dispatchedEvent("focus")', '["divC(@divA)(capturing phase)", "divC(@divC)"]');
- shouldBe('dispatchedEvent("blur")', '["divB(@divA)(capturing phase)", "divB(@divB)"]');
+ shouldBe('dispatchedEvent("focus")', '["divC(<-divB)(@divA)(capturing phase)", "divC(<-divB)(@divC)"]');
+ shouldBe('dispatchedEvent("blur")', '["divB(<-divC)(@divA)(capturing phase)", "divB(<-divC)(@divB)"]');
moveFocus('shadowD/shadowF/shadowG/divH', 'shadowD/shadowK/divL',
'Old focused node and new focused node exist in separated subtrees, crossing shadow boundaries. Making sure that an event is not dispatched beyond the lowest common boundary.');
- shouldBe('dispatchedEvent("focus")', '["shadowK(@divJ)(capturing phase)", "shadowK(@shadowK)", "divL(@divL)"]');
- shouldBe('dispatchedEvent("blur")', '["shadowF(@divE)(capturing phase)", "shadowF(@shadowF)", "shadowG(@shadowG)", "divH(@divH)"]');
+ shouldBe('dispatchedEvent("focus")', '["shadowK(<-shadowF)(@divJ)(capturing phase)", "shadowK(<-shadowF)(@shadowK)", "divL(<-shadowF)(@divL)"]');
+ shouldBe('dispatchedEvent("blur")', '["shadowF(<-shadowK)(@divE)(capturing phase)", "shadowF(<-shadowK)(@shadowF)", "shadowG(<-shadowK)(@shadowG)", "divH(<-shadowK)(@divH)"]');
}
test();
Modified: trunk/LayoutTests/fast/events/related-target-focusevent-expected.txt (142239 => 142240)
--- trunk/LayoutTests/fast/events/related-target-focusevent-expected.txt 2013-02-08 07:58:37 UTC (rev 142239)
+++ trunk/LayoutTests/fast/events/related-target-focusevent-expected.txt 2013-02-08 08:05:49 UTC (rev 142240)
@@ -1,9 +1,11 @@
PASS event.relatedTarget is null
+PASS event.relatedTarget is null
PASS event.relatedTarget is input2
+PASS event.relatedTarget is input2
PASS event.relatedTarget is input1
+PASS event.relatedTarget is input1
PASS event.relatedTarget is input3
-PASS event.relatedTarget is input2
-PASS event.relatedTarget is input4
+PASS event.relatedTarget is input3
PASS successfullyParsed is true
TEST COMPLETE
@@ -12,4 +14,4 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
+
Modified: trunk/LayoutTests/fast/events/related-target-focusevent.html (142239 => 142240)
--- trunk/LayoutTests/fast/events/related-target-focusevent.html 2013-02-08 07:58:37 UTC (rev 142239)
+++ trunk/LayoutTests/fast/events/related-target-focusevent.html 2013-02-08 08:05:49 UTC (rev 142240)
@@ -7,7 +7,6 @@
<input id="input1" type="text"></input>
<input id="input2" type="text"></input>
<input id="input3" type="text"></input>
-<input id="input4" type="text"></input>
<script>
jsTestIsAsync = true;
@@ -17,14 +16,17 @@
var input2 = document.getElementById('input2');
var input3 = document.getElementById('input3');
-input1.addEventListener("focusin", function(event) { shouldBe('event.relatedTarget', 'null'); });
+input1.addEventListener("focusin", function(event) { shouldBeNull('event.relatedTarget'); });
input1.addEventListener("focusout", function(event) { shouldBe('event.relatedTarget', 'input2'); });
+input1.addEventListener("focus", function(event) { shouldBeNull('event.relatedTarget'); });
+input1.addEventListener("blur", function(event) { shouldBe('event.relatedTarget', 'input2'); });
input2.addEventListener("focusin", function(event) { shouldBe('event.relatedTarget', 'input1'); });
input2.addEventListener("focusout", function(event) { shouldBe('event.relatedTarget', 'input3'); });
-input3.addEventListener("focusin", function(event) { shouldBe('event.relatedTarget', 'input2'); });
-input3.addEventListener("focusout", function(event) { shouldBe('event.relatedTarget', 'input4'); finishJSTest(); });
+input2.addEventListener("focus", function(event) { shouldBe('event.relatedTarget', 'input1'); });
+input2.addEventListener("blur", function(event) { shouldBe('event.relatedTarget', 'input3'); finishJSTest(); });
-for (var i = 0; i < 4; i++) {
+input1.focus();
+for (var i = 0; i < 2; i++) {
eventSender.keyDown('\t');
}
</script>
Modified: trunk/Source/WebCore/ChangeLog (142239 => 142240)
--- trunk/Source/WebCore/ChangeLog 2013-02-08 07:58:37 UTC (rev 142239)
+++ trunk/Source/WebCore/ChangeLog 2013-02-08 08:05:49 UTC (rev 142240)
@@ -1,3 +1,33 @@
+2013-02-08 Kentaro Hara <[email protected]>
+
+ Support a relatedTarget attribute on focus/blur events
+ https://bugs.webkit.org/show_bug.cgi?id=109176
+
+ Reviewed by Ojan Vafai.
+
+ In bug 76216, we supported a relatedTarget attribute on
+ focusin/focusout events. We should also support it on focus/blur events.
+
+ See http://lists.w3.org/Archives/Public/www-dom/2012OctDec/0061.html
+ for the www-dom discussion.
+
+ Test: fast/dom/shadow/shadow-boundary-events.html
+ fast/events/related-target-focusevent.html
+
+ * dom/EventDispatchMediator.cpp:
+ (WebCore::FocusEventDispatchMediator::create):
+ (WebCore::FocusEventDispatchMediator::FocusEventDispatchMediator):
+ (WebCore::BlurEventDispatchMediator::create):
+ (WebCore::BlurEventDispatchMediator::BlurEventDispatchMediator):
+ * dom/EventDispatchMediator.h:
+ (FocusEventDispatchMediator):
+ (BlurEventDispatchMediator):
+ * dom/Node.cpp:
+ (WebCore::Node::dispatchFocusInEvent):
+ (WebCore::Node::dispatchFocusOutEvent):
+ (WebCore::Node::dispatchFocusEvent):
+ (WebCore::Node::dispatchBlurEvent):
+
2013-02-07 Yury Semikhatsky <[email protected]>
Web Inspector: reduce number of native memory instrumentation categories
Modified: trunk/Source/WebCore/dom/EventDispatchMediator.cpp (142239 => 142240)
--- trunk/Source/WebCore/dom/EventDispatchMediator.cpp 2013-02-08 07:58:37 UTC (rev 142239)
+++ trunk/Source/WebCore/dom/EventDispatchMediator.cpp 2013-02-08 08:05:49 UTC (rev 142240)
@@ -52,13 +52,13 @@
return dispatcher->dispatchEvent(m_event.get());
}
-PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<Node> oldFocusedNode)
+PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<Event> event, PassRefPtr<Node> oldFocusedNode)
{
- return adoptRef(new FocusEventDispatchMediator(oldFocusedNode));
+ return adoptRef(new FocusEventDispatchMediator(event, oldFocusedNode));
}
-FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<Node> oldFocusedNode)
- : EventDispatchMediator(Event::create(eventNames().focusEvent, false, false))
+FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<Event> event, PassRefPtr<Node> oldFocusedNode)
+ : EventDispatchMediator(event)
, m_oldFocusedNode(oldFocusedNode)
{
}
@@ -69,13 +69,13 @@
return EventDispatchMediator::dispatchEvent(dispatcher);
}
-PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<Node> newFocusedNode)
+PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<Event> event, PassRefPtr<Node> newFocusedNode)
{
- return adoptRef(new BlurEventDispatchMediator(newFocusedNode));
+ return adoptRef(new BlurEventDispatchMediator(event, newFocusedNode));
}
-BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<Node> newFocusedNode)
- : EventDispatchMediator(Event::create(eventNames().blurEvent, false, false))
+BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<Event> event, PassRefPtr<Node> newFocusedNode)
+ : EventDispatchMediator(event)
, m_newFocusedNode(newFocusedNode)
{
}
Modified: trunk/Source/WebCore/dom/EventDispatchMediator.h (142239 => 142240)
--- trunk/Source/WebCore/dom/EventDispatchMediator.h 2013-02-08 07:58:37 UTC (rev 142239)
+++ trunk/Source/WebCore/dom/EventDispatchMediator.h 2013-02-08 08:05:49 UTC (rev 142240)
@@ -59,18 +59,18 @@
class FocusEventDispatchMediator : public EventDispatchMediator {
public:
- static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<Node> oldFocusedNode);
+ static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<Event>, PassRefPtr<Node> oldFocusedNode);
private:
- explicit FocusEventDispatchMediator(PassRefPtr<Node> oldFocusedNode);
+ FocusEventDispatchMediator(PassRefPtr<Event>, PassRefPtr<Node> oldFocusedNode);
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
RefPtr<Node> m_oldFocusedNode;
};
class BlurEventDispatchMediator : public EventDispatchMediator {
public:
- static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<Node> newFocusedNode);
+ static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<Event>, PassRefPtr<Node> newFocusedNode);
private:
- explicit BlurEventDispatchMediator(PassRefPtr<Node> newFocusedNode);
+ BlurEventDispatchMediator(PassRefPtr<Event>, PassRefPtr<Node> newFocusedNode);
virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
RefPtr<Node> m_newFocusedNode;
};
Modified: trunk/Source/WebCore/dom/Node.cpp (142239 => 142240)
--- trunk/Source/WebCore/dom/Node.cpp 2013-02-08 07:58:37 UTC (rev 142239)
+++ trunk/Source/WebCore/dom/Node.cpp 2013-02-08 08:05:49 UTC (rev 142240)
@@ -2357,6 +2357,9 @@
{
ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
ASSERT(eventType == eventNames().focusinEvent || eventType == eventNames().DOMFocusInEvent);
+ // FIXME: We should pass oldFocusedNode to FocusEvent::create() and
+ // remove oldFocusedNode from FocusInEventDispatchMediator::create().
+ // See https://bugs.webkit.org/show_bug.cgi?id=109261
dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, 0), oldFocusedNode));
}
@@ -2364,6 +2367,9 @@
{
ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
ASSERT(eventType == eventNames().focusoutEvent || eventType == eventNames().DOMFocusOutEvent);
+ // FIXME: We should pass newFocusedNode to FocusEvent::create() and
+ // remove newFocusedNode from FocusOutEventDispatchMediator::create().
+ // See https://bugs.webkit.org/show_bug.cgi?id=109261
dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, 0), newFocusedNode));
}
@@ -2422,8 +2428,12 @@
{
if (document()->page())
document()->page()->chrome()->client()->elementDidFocus(this);
-
- EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(oldFocusedNode));
+
+ // FIXME: We should pass oldFocusedNode to FocusEvent::create() and
+ // remove oldFocusedNode from FocusEventDispatchMediator::create().
+ // See https://bugs.webkit.org/show_bug.cgi?id=109261
+ RefPtr<FocusEvent> event = FocusEvent::create(eventNames().focusEvent, false, false, document()->defaultView(), 0, 0);
+ EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(event.release(), oldFocusedNode));
}
void Node::dispatchBlurEvent(PassRefPtr<Node> newFocusedNode)
@@ -2431,7 +2441,11 @@
if (document()->page())
document()->page()->chrome()->client()->elementDidBlur(this);
- EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(newFocusedNode));
+ // FIXME: We should pass newFocusedNode to FocusEvent::create() and
+ // remove newFocusedNode from BlurEventDispatchMediator::create().
+ // See https://bugs.webkit.org/show_bug.cgi?id=109261
+ RefPtr<FocusEvent> event = FocusEvent::create(eventNames().blurEvent, false, false, document()->defaultView(), 0, 0);
+ EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event.release(), newFocusedNode));
}
void Node::dispatchChangeEvent()