Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
WebKit does not support DOM 3 Events FocusEvent
https://bugs.webkit.org/show_bug.cgi?id=76216 Source/WebCore: Created a new FocusEvent class (extends UIEvent) with a relatedTarget attribute. Moved the {Focus,Blur,FocusIn,FocusOut}EventDispatchMediator classes inside FocusEvent. Now when focusin or focusout events are dispatched, a FocusEvent is created with the relatedTarget attribute set accordingly. No other logic changes have been made besides adding the FocusEvent class. Patch by Terry Anderson <tdanderson@chromium.org> on 2012-02-16 Reviewed by Eric Seidel. Test: fast/events/related-target-focusevent.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * DerivedSources.pri: * GNUmakefile.list.am: * Target.pri: * WebCore.gypi: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: - Included mention of FocusEvent / JSFocusEvent in the above files to allow the patch to build on the different platforms * dom/EventDispatchMediator.cpp: * dom/EventDispatchMediator.h: * dom/EventFactory.in: * dom/FocusEvent.cpp: Added. (WebCore): (WebCore::FocusEvent::FocusEvent): (WebCore::FocusEvent::~FocusEvent): (WebCore::FocusEvent::initFocusEvent): (WebCore::FocusEvent::interfaceName): (WebCore::FocusInEventDispatchMediator::create): (WebCore::FocusInEventDispatchMediator::FocusInEventDispatchMediator): (WebCore::FocusInEventDispatchMediator::dispatchEvent): (WebCore::FocusInEventDispatchMediator::event): (WebCore::FocusOutEventDispatchMediator::create): (WebCore::FocusOutEventDispatchMediator::FocusOutEventDispatchMediator): (WebCore::FocusOutEventDispatchMediator::dispatchEvent): (WebCore::FocusOutEventDispatchMediator::event): (WebCore::FocusEventDispatchMediator::create): (WebCore::FocusEventDispatchMediator::FocusEventDispatchMediator): (WebCore::FocusEventDispatchMediator::dispatchEvent): (WebCore::BlurEventDispatchMediator::create): (WebCore::BlurEventDispatchMediator::BlurEventDispatchMediator): (WebCore::BlurEventDispatchMediator::dispatchEvent): * dom/FocusEvent.h: Copied from Source/WebCore/dom/EventDispatchMediator.h. (WebCore): (FocusEvent): (WebCore::FocusEvent::create): (WebCore::FocusEvent::relatedTarget): (WebCore::FocusEvent::setRelatedTarget): (FocusInEventDispatchMediator): (FocusOutEventDispatchMediator): (FocusEventDispatchMediator): (BlurEventDispatchMediator): * dom/FocusEvent.idl: Added. * dom/Node.cpp: (WebCore::Node::dispatchFocusInEvent): (WebCore::Node::dispatchFocusOutEvent): * dom/UIEvent.cpp: * dom/UIEvent.h: * page/DOMWindow.idl: LayoutTests: Patch by Terry Anderson <tdanderson@chromium.org> on 2012-02-16 Reviewed by Eric Seidel. * fast/dom/shadow/shadow-boundary-events-expected.txt: * fast/dom/shadow/shadow-boundary-events.html: - Changed the focusin/focusout parts of this layout test to include the relatedTarget attribute, which is now set on FocusEvent objects * fast/events/event-creation-expected.txt: * fast/events/event-creation.html: - Added the creation of FocusEvents to this layout test * fast/events/related-target-focusevent-expected.txt: Added. * fast/events/related-target-focusevent.html: Added. - This is a new layout test I created specifically for this patch Canonical link: https://commits.webkit.org/95788@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
573 additions
and 116 deletions.
- +18 −0 LayoutTests/ChangeLog
- +4 −4 LayoutTests/fast/dom/shadow/shadow-boundary-events-expected.txt
- +4 −4 LayoutTests/fast/dom/shadow/shadow-boundary-events.html
- +4 −0 LayoutTests/fast/events/event-creation-expected.txt
- +6 −0 LayoutTests/fast/events/event-creation.html
- +21 −0 LayoutTests/fast/events/related-target-focusevent-expected.txt
- +73 −0 LayoutTests/fast/events/related-target-focusevent.html
- +2 −0 Source/WebCore/CMakeLists.txt
- +67 −0 Source/WebCore/ChangeLog
- +1 −0 Source/WebCore/DerivedSources.cpp
- +1 −0 Source/WebCore/DerivedSources.make
- +1 −0 Source/WebCore/DerivedSources.pri
- +5 −0 Source/WebCore/GNUmakefile.list.am
- +2 −0 Source/WebCore/Target.pri
- +8 −0 Source/WebCore/WebCore.gypi
- +18 −0 Source/WebCore/WebCore.xcodeproj/project.pbxproj
- +1 −0 Source/WebCore/dom/DOMAllInOne.cpp
- +1 −35 Source/WebCore/dom/EventDispatchMediator.cpp
- +1 −18 Source/WebCore/dom/EventDispatchMediator.h
- +2 −0 Source/WebCore/dom/EventFactory.in
- +171 −0 Source/WebCore/dom/FocusEvent.cpp
- +108 −0 Source/WebCore/dom/FocusEvent.h
- +47 −0 Source/WebCore/dom/FocusEvent.idl
- +3 −2 Source/WebCore/dom/Node.cpp
- +1 −34 Source/WebCore/dom/UIEvent.cpp
- +1 −18 Source/WebCore/dom/UIEvent.h
- +2 −1 Source/WebCore/page/DOMWindow.idl
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,21 @@ | ||
Layout test for https://bugs.webkit.org/show_bug.cgi?id=76216. Checks that the relatedTarget attribute for FocusEvent objects is being set correctly when focusin/focusout events are dispatched. Press tab four times to dispatch a focusin and focusout event for each of the buttons below. | ||
|
||
Meow Purr Fur! Done | ||
Expected Result | ||
|
||
Meow received focusin, its relatedTarget is null | ||
Meow received focusout, its relatedTarget is Purr | ||
Purr received focusin, its relatedTarget is Meow | ||
Purr received focusout, its relatedTarget is Fur! | ||
Fur! received focusin, its relatedTarget is Purr | ||
Fur! received focusout, its relatedTarget is Done | ||
|
||
Actual Result | ||
|
||
Meow received focusin, its relatedTarget is null | ||
Meow received focusout, its relatedTarget is Purr | ||
Purr received focusin, its relatedTarget is Meow | ||
Purr received focusout, its relatedTarget is Fur! | ||
Fur! received focusin, its relatedTarget is Purr | ||
Fur! received focusout, its relatedTarget is Done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,73 @@ | ||
<html> | ||
<head> | ||
<script> | ||
|
||
function log(msg) | ||
{ | ||
document.getElementById('log').appendChild(document.createTextNode(msg + '\n')); | ||
} | ||
|
||
function test() | ||
{ | ||
if (window.layoutTestController) | ||
layoutTestController.dumpAsText(); | ||
|
||
var INEVENT = "focusin"; | ||
var OUTEVENT = "focusout"; | ||
|
||
var b1 = document.getElementById('button1'); | ||
var b2 = document.getElementById('button2'); | ||
var b3 = document.getElementById('button3'); | ||
|
||
b1.addEventListener(INEVENT, TestInEvent, true); | ||
b2.addEventListener(INEVENT, TestInEvent, true); | ||
b3.addEventListener(INEVENT, TestInEvent, true); | ||
|
||
b1.addEventListener(OUTEVENT, TestOutEvent, true); | ||
b2.addEventListener(OUTEVENT, TestOutEvent, true); | ||
b3.addEventListener(OUTEVENT, TestOutEvent, true); | ||
|
||
if (!window.layoutTestController) | ||
return; | ||
|
||
for (var i = 0; i < 4; i++) | ||
eventSender.keyDown('\t'); | ||
} | ||
|
||
function TestInEvent(evt) | ||
{ | ||
if (evt.relatedTarget) | ||
log(evt.target.innerText + " received focusin, its relatedTarget is " + evt.relatedTarget.innerText); | ||
else | ||
log(evt.target.innerText + " received focusin, its relatedTarget is " + evt.relatedTarget); | ||
} | ||
|
||
function TestOutEvent(evt) | ||
{ | ||
if (evt.relatedTarget) | ||
log(evt.target.innerText + " received focusout, its relatedTarget is " + evt.relatedTarget.innerText); | ||
else | ||
log(evt.target.innerText + " received focusout, its relatedTarget is " + evt.relatedTarget); | ||
|
||
} | ||
</script> | ||
</head> | ||
<body onload="test()"> | ||
<p>Layout test for <a href="https://bugs.webkit.org/show_bug.cgi?id=76216" tabindex=-1>https://bugs.webkit.org/show_bug.cgi?id=76216</a>. Checks that the relatedTarget attribute for FocusEvent objects is being set correctly when focusin/focusout events are dispatched. <b>Press tab four times</b> to dispatch a focusin and focusout event for each of the buttons below.</p> | ||
<button id="button1">Meow</button> | ||
<button id="button2">Purr</button> | ||
<button id="button3">Fur!</button> | ||
<button id="inputdone">Done</button> | ||
<p>Expected Result</p> | ||
<pre> | ||
Meow received focusin, its relatedTarget is null | ||
Meow received focusout, its relatedTarget is Purr | ||
Purr received focusin, its relatedTarget is Meow | ||
Purr received focusout, its relatedTarget is Fur! | ||
Fur! received focusin, its relatedTarget is Purr | ||
Fur! received focusout, its relatedTarget is Done | ||
</pre> | ||
<p>Actual Result</p> | ||
<pre id="log"></pre> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.