| Differences between
and this patch
- a/LayoutTests/ChangeLog +12 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2010-11-05  Dimitri Glazkov  <dglazkov@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Implement shadow DOM-aware event targeting and introduce EventContext to track the context of each event dispatch.
6
        https://bugs.webkit.org/show_bug.cgi?id=46015
7
8
        * fast/events/shadow-boundary-crossing-2-expected.txt: Added.
9
        * fast/events/shadow-boundary-crossing-2.html: Added.
10
        * fast/events/shadow-boundary-crossing.html:
11
        * media/audio-delete-while-slider-thumb-clicked.html:
12
1
2010-11-04  Adam Roben  <aroben@apple.com>
13
2010-11-04  Adam Roben  <aroben@apple.com>
2
14
3
        Add more failing tests to the Windows Skipped file
15
        Add more failing tests to the Windows Skipped file
- a/LayoutTests/fast/events/shadow-boundary-crossing-2-expected.txt +7 lines
Line 0 a/LayoutTests/fast/events/shadow-boundary-crossing-2-expected.txt_sec1
1
Tests to ensure that shadow DOM boundary is not crossed during event propagation. Can only run within DRT.
2
3
See bug 46015 for details.
4
5
Mutation events should not propagate out of the shadow DOM: PASS
6
Other events should be retargeted: PASS
7
After event dispatch, the event object should not reveal shadow DOM: PASS
- a/LayoutTests/fast/events/shadow-boundary-crossing-2.html +81 lines
Line 0 a/LayoutTests/fast/events/shadow-boundary-crossing-2.html_sec1
1
<html>
2
<head>
3
<script>
4
5
var logDiv;
6
7
function log(msg, success)
8
{
9
    logDiv.appendChild(document.createElement('div')).textContent = msg + ': ' + (success ? 'PASS' : 'FAIL');
10
}
11
12
function clickOn(element)
13
{
14
    if (!window.eventSender)
15
        return;
16
17
    var x = element.offsetLeft + element.offsetWidth / 2;
18
    var y = element.offsetTop + element.offsetHeight / 2;
19
    eventSender.mouseMoveTo(x, y);
20
    eventSender.mouseDown();
21
    eventSender.mouseUp();
22
}
23
24
var tests = {
25
    mutationEventPropagation: function()
26
    {
27
        var textarea = document.body.appendChild(document.createElement('textarea'));
28
        var mutationEventFired;
29
        textarea.addEventListener('DOMSubtreeModified', function(e)
30
        {
31
            mutationEventFired = true;
32
        }, false);
33
        textarea.value = 'test';
34
        // Trigger style recalc and sadly, the actual mutation of the textarea shadow DOM.
35
        textarea.offsetHeight;
36
        log('Mutation events should not propagate out of the shadow DOM', !mutationEventFired);
37
        textarea.parentNode.removeChild(textarea);
38
    },
39
    eventInProgress: function()
40
    {
41
        var textInput = document.body.appendChild(document.createElement('input'));
42
        textInput.addEventListener('click', function(e)
43
        {
44
            log('Other events should be retargeted', e.target == textInput);
45
        }, false);
46
        clickOn(textInput);
47
        textInput.parentNode.removeChild(textInput);
48
    },
49
    finalEventObject: function()
50
    {
51
        var textInput = document.body.appendChild(document.createElement('input'));
52
        var storedEvent;
53
        textInput.addEventListener('click', function(e)
54
        {
55
            storedEvent = e;
56
        }, false);
57
        clickOn(textInput);
58
        log('After event dispatch, the event object should not reveal shadow DOM', storedEvent && storedEvent.target == textInput);
59
        textInput.parentNode.removeChild(textInput);
60
    }
61
};
62
63
function runTest()
64
{
65
    if (window.layoutTestController)
66
        layoutTestController.dumpAsText();
67
68
    logDiv = document.getElementById('log');
69
    for(var testName in tests) {
70
        tests[testName]();
71
    }
72
}
73
74
</script>
75
</head>
76
<body onload="runTest()">
77
    <p>Tests to ensure that shadow DOM boundary is not crossed during event propagation. Can only run within DRT.
78
    <p>See <a href="https://bugs.webkit.org/show_bug.cgi?id=46015">bug 46015</a> for details.
79
    <div id="log"></div>
80
</body>
81
</html>
- a/LayoutTests/fast/events/shadow-boundary-crossing.html -4 / +5 lines
Lines 2-12 a/LayoutTests/fast/events/shadow-boundary-crossing.html_sec1
2
<head>
2
<head>
3
    <title></title>
3
    <title></title>
4
    <script type="text/javascript">
4
    <script type="text/javascript">
5
        var fired = false;
5
        var success;
6
        var target;
6
7
7
        function selectStart(event)
8
        function selectStart(event)
8
        {
9
        {
9
            fired = true;
10
            success = event.target == target;
10
        }
11
        }
11
12
12
        function test()
13
        function test()
Lines 15-21 a/LayoutTests/fast/events/shadow-boundary-crossing.html_sec2
15
                return;
16
                return;
16
            layoutTestController.dumpAsText();
17
            layoutTestController.dumpAsText();
17
18
18
            var target = document.getElementById("target");
19
            target = document.getElementById("target");
19
            var x = target.offsetLeft + target.offsetWidth / 2;
20
            var x = target.offsetLeft + target.offsetWidth / 2;
20
            var y = target.offsetTop + target.offsetHeight / 2;
21
            var y = target.offsetTop + target.offsetHeight / 2;
21
22
Lines 23-29 a/LayoutTests/fast/events/shadow-boundary-crossing.html_sec3
23
            eventSender.mouseDown();
24
            eventSender.mouseDown();
24
            eventSender.mouseUp();
25
            eventSender.mouseUp();
25
26
26
            document.getElementById("result").innerText = fired ? "FAIL" : "PASS";
27
            document.getElementById("result").innerText = !success ? "FAIL" : "PASS";
27
        }
28
        }
28
29
29
        addEventListener("selectstart", selectStart, true);
30
        addEventListener("selectstart", selectStart, true);
- a/LayoutTests/media/audio-delete-while-slider-thumb-clicked.html -4 / +4 lines
Lines 50-60 a/LayoutTests/media/audio-delete-while-slider-thumb-clicked.html_sec1
50
50
51
                var audio = document.getElementById('audio');
51
                var audio = document.getElementById('audio');
52
52
53
                var middle = audio.offsetLeft + (audio.offsetWidth / 2);
53
                var center = audio.offsetLeft + (audio.offsetWidth / 2);
54
                var bottom = audio.offsetTop + audio.offsetHeight;
54
                var middle = audio.offsetTop + (audio.offsetHeight / 2);
55
                
55
                
56
                var x = middle + 16 + 16 + 8;
56
                var x = center + 16 + 16 + 8;
57
                var y = bottom - 8;
57
                var y = middle;
58
58
59
                // drag slider, leave the mouse down
59
                // drag slider, leave the mouse down
60
                log("clicking in controller");
60
                log("clicking in controller");
- a/WebCore/Android.mk +2 lines
Lines 132-137 LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ a/WebCore/Android.mk_sec1
132
	dom/EntityReference.cpp \
132
	dom/EntityReference.cpp \
133
	dom/ErrorEvent.cpp \
133
	dom/ErrorEvent.cpp \
134
	dom/Event.cpp \
134
	dom/Event.cpp \
135
	dom/EventContext.cpp \
135
	dom/EventNames.cpp \
136
	dom/EventNames.cpp \
136
	dom/EventTarget.cpp \
137
	dom/EventTarget.cpp \
137
	dom/ExceptionBase.cpp \
138
	dom/ExceptionBase.cpp \
Lines 192-197 LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ a/WebCore/Android.mk_sec2
192
	dom/WebKitAnimationEvent.cpp \
193
	dom/WebKitAnimationEvent.cpp \
193
	dom/WebKitTransitionEvent.cpp \
194
	dom/WebKitTransitionEvent.cpp \
194
	dom/WheelEvent.cpp \
195
	dom/WheelEvent.cpp \
196
	dom/WindowEventContext.cpp \
195
	dom/XMLDocumentParser.cpp \
197
	dom/XMLDocumentParser.cpp \
196
	dom/XMLDocumentParserLibxml2.cpp \
198
	dom/XMLDocumentParserLibxml2.cpp \
197
	dom/XMLDocumentParserScope.cpp \
199
	dom/XMLDocumentParserScope.cpp \
- a/WebCore/CMakeLists.txt +2 lines
Lines 824-829 SET(WebCore_SOURCES a/WebCore/CMakeLists.txt_sec1
824
    dom/EntityReference.cpp
824
    dom/EntityReference.cpp
825
    dom/ErrorEvent.cpp
825
    dom/ErrorEvent.cpp
826
    dom/Event.cpp
826
    dom/Event.cpp
827
    dom/EventContext.cpp
827
    dom/EventNames.cpp
828
    dom/EventNames.cpp
828
    dom/EventTarget.cpp
829
    dom/EventTarget.cpp
829
    dom/ExceptionBase.cpp
830
    dom/ExceptionBase.cpp
Lines 881-886 SET(WebCore_SOURCES a/WebCore/CMakeLists.txt_sec2
881
    dom/WebKitAnimationEvent.cpp
882
    dom/WebKitAnimationEvent.cpp
882
    dom/WebKitTransitionEvent.cpp
883
    dom/WebKitTransitionEvent.cpp
883
    dom/WheelEvent.cpp
884
    dom/WheelEvent.cpp
885
    dom/WindowEventContext.cpp
884
    dom/XMLDocumentParser.cpp
886
    dom/XMLDocumentParser.cpp
885
    dom/XMLDocumentParserLibxml2.cpp
887
    dom/XMLDocumentParserLibxml2.cpp
886
    dom/XMLDocumentParserScope.cpp
888
    dom/XMLDocumentParserScope.cpp
- a/WebCore/ChangeLog +62 lines
Lines 1-3 a/WebCore/ChangeLog_sec1
1
2010-11-05  Dimitri Glazkov  <dglazkov@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Implement shadow DOM-aware event targeting and introduce EventContext to track the context of each event dispatch.
6
        https://bugs.webkit.org/show_bug.cgi?id=46015
7
8
        Test: fast/events/shadow-boundary-crossing-2.html
9
10
        * Android.mk:
11
        * CMakeLists.txt:
12
        * GNUmakefile.am:
13
        * WebCore.gypi:
14
        * WebCore.pro:
15
        * WebCore.vcproj/WebCore.vcproj:
16
        * WebCore.xcodeproj/project.pbxproj:
17
        * dom/ContainerNode.cpp:
18
        (WebCore::notifyChildInserted):
19
        * dom/DOMAllInOne.cpp:
20
        * dom/EventContext.cpp: Added.
21
        (WebCore::EventContext::EventContext):
22
        (WebCore::EventContext::handleLocalEvents):
23
        * dom/EventContext.h: Added.
24
        (WebCore::EventContext::node):
25
        (WebCore::EventContext::target):
26
        * dom/Node.cpp:
27
        (WebCore::Node::markAncestorsWithChildNeedsStyleRecalc):
28
        (WebCore::Node::createRendererIfNeeded):
29
        (WebCore::Node::enclosingLinkEventParentOrSelf):
30
        (WebCore::eventTargetRespectingSVGTargetRules):
31
        (WebCore::Node::getEventAncestors):
32
        (WebCore::topEventContext):
33
        (WebCore::Node::dispatchGenericEvent):
34
        * dom/Node.h:
35
        (WebCore::Node::parentOrHostNode):
36
        * dom/Text.cpp:
37
        (WebCore::Text::createRenderer):
38
        * dom/WindowEventContext.cpp: Added.
39
        (WebCore::WindowEventContext::WindowEventContext):
40
        (WebCore::WindowEventContext::handleLocalEvents):
41
        * dom/WindowEventContext.h: Added.
42
        (WebCore::WindowEventContext::window):
43
        (WebCore::WindowEventContext::target):
44
        * inspector/InspectorDOMAgent.cpp:
45
        (WebCore::InspectorDOMAgent::getEventListenersForNode):
46
        * inspector/InspectorInstrumentation.cpp:
47
        (WebCore::eventHasListeners):
48
        (WebCore::InspectorInstrumentation::willDispatchEventImpl):
49
        * inspector/InspectorInstrumentation.h:
50
        (WebCore::InspectorInstrumentation::willDispatchEvent):
51
        * page/EventHandler.cpp:
52
        (WebCore::EventHandler::updateMouseEventTargetNode):
53
        * rendering/RenderTextControlMultiLine.cpp:
54
        (WebCore::RenderTextControlMultiLine::subtreeHasChanged):
55
        * rendering/ShadowElement.h:
56
        (WebCore::ShadowElement::shadowParent):
57
        (WebCore::ShadowElement::shadowParentNode):
58
        * rendering/TextControlInnerElements.cpp:
59
        (WebCore::TextControlInnerTextElement::defaultEventHandler):
60
        * svg/SVGElement.cpp:
61
        * svg/SVGElement.h:
62
1
2010-11-04  Nikolas Zimmermann  <nzimmermann@rim.com>
63
2010-11-04  Nikolas Zimmermann  <nzimmermann@rim.com>
2
64
3
        Reviewed by Andreas Kling.
65
        Reviewed by Andreas Kling.
- a/WebCore/GNUmakefile.am -1 / +5 lines
Lines 1133-1140 webcore_sources += \ a/WebCore/GNUmakefile.am_sec1
1133
	WebCore/dom/ErrorEvent.cpp \
1133
	WebCore/dom/ErrorEvent.cpp \
1134
	WebCore/dom/ErrorEvent.h \
1134
	WebCore/dom/ErrorEvent.h \
1135
	WebCore/dom/Event.cpp \
1135
	WebCore/dom/Event.cpp \
1136
	WebCore/dom/EventException.h \
1137
	WebCore/dom/Event.h \
1136
	WebCore/dom/Event.h \
1137
	WebCore/dom/EventContext.cpp \
1138
	WebCore/dom/EventContext.h \
1139
	WebCore/dom/EventException.h \
1138
	WebCore/dom/EventListener.h \
1140
	WebCore/dom/EventListener.h \
1139
	WebCore/dom/EventNames.cpp \
1141
	WebCore/dom/EventNames.cpp \
1140
	WebCore/dom/EventNames.h \
1142
	WebCore/dom/EventNames.h \
Lines 1262-1267 webcore_sources += \ a/WebCore/GNUmakefile.am_sec2
1262
	WebCore/dom/WebKitTransitionEvent.h \
1264
	WebCore/dom/WebKitTransitionEvent.h \
1263
	WebCore/dom/WheelEvent.cpp \
1265
	WebCore/dom/WheelEvent.cpp \
1264
	WebCore/dom/WheelEvent.h \
1266
	WebCore/dom/WheelEvent.h \
1267
	WebCore/dom/WindowEventContext.cpp \
1268
	WebCore/dom/WindowEventContext.h \
1265
	WebCore/dom/XMLDocumentParser.cpp \
1269
	WebCore/dom/XMLDocumentParser.cpp \
1266
	WebCore/dom/XMLDocumentParser.h \
1270
	WebCore/dom/XMLDocumentParser.h \
1267
	WebCore/dom/XMLDocumentParserLibxml2.cpp \
1271
	WebCore/dom/XMLDocumentParserLibxml2.cpp \
- a/WebCore/WebCore.gypi +4 lines
Lines 1206-1211 a/WebCore/WebCore.gypi_sec1
1206
            'dom/ErrorEvent.h',
1206
            'dom/ErrorEvent.h',
1207
            'dom/Event.cpp',
1207
            'dom/Event.cpp',
1208
            'dom/Event.h',
1208
            'dom/Event.h',
1209
            'dom/EventContext.cpp',
1210
            'dom/EventContext.h',
1209
            'dom/EventException.h',
1211
            'dom/EventException.h',
1210
            'dom/EventListener.h',
1212
            'dom/EventListener.h',
1211
            'dom/EventNames.cpp',
1213
            'dom/EventNames.cpp',
Lines 1341-1346 a/WebCore/WebCore.gypi_sec2
1341
            'dom/WebKitTransitionEvent.h',
1343
            'dom/WebKitTransitionEvent.h',
1342
            'dom/WheelEvent.cpp',
1344
            'dom/WheelEvent.cpp',
1343
            'dom/WheelEvent.h',
1345
            'dom/WheelEvent.h',
1346
            'dom/WindowEventContext.cpp',
1347
            'dom/WindowEventContext.h',
1344
            'dom/XMLDocumentParser.cpp',
1348
            'dom/XMLDocumentParser.cpp',
1345
            'dom/XMLDocumentParser.h',
1349
            'dom/XMLDocumentParser.h',
1346
            'dom/XMLDocumentParserLibxml2.cpp',
1350
            'dom/XMLDocumentParserLibxml2.cpp',
- a/WebCore/WebCore.pro +2 lines
Lines 713-718 SOURCES += \ a/WebCore/WebCore.pro_sec1
713
    dom/EntityReference.cpp \
713
    dom/EntityReference.cpp \
714
    dom/ErrorEvent.cpp \
714
    dom/ErrorEvent.cpp \
715
    dom/Event.cpp \
715
    dom/Event.cpp \
716
    dom/EventContext.cpp \
716
    dom/EventNames.cpp \
717
    dom/EventNames.cpp \
717
    dom/EventTarget.cpp \
718
    dom/EventTarget.cpp \
718
    dom/ExceptionBase.cpp \
719
    dom/ExceptionBase.cpp \
Lines 773-778 SOURCES += \ a/WebCore/WebCore.pro_sec2
773
    dom/WebKitAnimationEvent.cpp \
774
    dom/WebKitAnimationEvent.cpp \
774
    dom/WebKitTransitionEvent.cpp \
775
    dom/WebKitTransitionEvent.cpp \
775
    dom/WheelEvent.cpp \
776
    dom/WheelEvent.cpp \
777
    dom/WindowEventContext.cpp \
776
    dom/XMLDocumentParser.cpp \
778
    dom/XMLDocumentParser.cpp \
777
    dom/XMLDocumentParserQt.cpp \
779
    dom/XMLDocumentParserQt.cpp \
778
    dom/default/PlatformMessagePortChannel.cpp \
780
    dom/default/PlatformMessagePortChannel.cpp \
- a/WebCore/WebCore.vcproj/WebCore.vcproj +112 lines
Lines 42256-42261 a/WebCore/WebCore.vcproj/WebCore.vcproj_sec1
42256
				>
42256
				>
42257
			</File>
42257
			</File>
42258
			<File
42258
			<File
42259
				RelativePath="..\dom\EventContext.cpp"
42260
				>
42261
				<FileConfiguration
42262
					Name="Debug|Win32"
42263
					ExcludedFromBuild="true"
42264
					>
42265
					<Tool
42266
						Name="VCCLCompilerTool"
42267
					/>
42268
				</FileConfiguration>
42269
				<FileConfiguration
42270
					Name="Release|Win32"
42271
					ExcludedFromBuild="true"
42272
					>
42273
					<Tool
42274
						Name="VCCLCompilerTool"
42275
					/>
42276
				</FileConfiguration>
42277
				<FileConfiguration
42278
					Name="Debug_Internal|Win32"
42279
					ExcludedFromBuild="true"
42280
					>
42281
					<Tool
42282
						Name="VCCLCompilerTool"
42283
					/>
42284
				</FileConfiguration>
42285
				<FileConfiguration
42286
					Name="Debug_Cairo|Win32"
42287
					ExcludedFromBuild="true"
42288
					>
42289
					<Tool
42290
						Name="VCCLCompilerTool"
42291
					/>
42292
				</FileConfiguration>
42293
				<FileConfiguration
42294
					Name="Release_Cairo|Win32"
42295
					ExcludedFromBuild="true"
42296
					>
42297
					<Tool
42298
						Name="VCCLCompilerTool"
42299
					/>
42300
				</FileConfiguration>
42301
				<FileConfiguration
42302
					Name="Debug_All|Win32"
42303
					ExcludedFromBuild="true"
42304
					>
42305
					<Tool
42306
						Name="VCCLCompilerTool"
42307
					/>
42308
				</FileConfiguration>
42309
			</File>
42310
			<File
42311
				RelativePath="..\dom\EventContext.h"
42312
				>
42313
			</File>
42314
			<File
42259
				RelativePath="..\dom\EventException.h"
42315
				RelativePath="..\dom\EventException.h"
42260
				>
42316
				>
42261
			</File>
42317
			</File>
Lines 45344-45349 a/WebCore/WebCore.vcproj/WebCore.vcproj_sec2
45344
				>
45400
				>
45345
			</File>
45401
			</File>
45346
			<File
45402
			<File
45403
				RelativePath="..\dom\WindowEventContext.cpp"
45404
				>
45405
				<FileConfiguration
45406
					Name="Debug|Win32"
45407
					ExcludedFromBuild="true"
45408
					>
45409
					<Tool
45410
						Name="VCCLCompilerTool"
45411
					/>
45412
				</FileConfiguration>
45413
				<FileConfiguration
45414
					Name="Release|Win32"
45415
					ExcludedFromBuild="true"
45416
					>
45417
					<Tool
45418
						Name="VCCLCompilerTool"
45419
					/>
45420
				</FileConfiguration>
45421
				<FileConfiguration
45422
					Name="Debug_Internal|Win32"
45423
					ExcludedFromBuild="true"
45424
					>
45425
					<Tool
45426
						Name="VCCLCompilerTool"
45427
					/>
45428
				</FileConfiguration>
45429
				<FileConfiguration
45430
					Name="Debug_Cairo|Win32"
45431
					ExcludedFromBuild="true"
45432
					>
45433
					<Tool
45434
						Name="VCCLCompilerTool"
45435
					/>
45436
				</FileConfiguration>
45437
				<FileConfiguration
45438
					Name="Release_Cairo|Win32"
45439
					ExcludedFromBuild="true"
45440
					>
45441
					<Tool
45442
						Name="VCCLCompilerTool"
45443
					/>
45444
				</FileConfiguration>
45445
				<FileConfiguration
45446
					Name="Debug_All|Win32"
45447
					ExcludedFromBuild="true"
45448
					>
45449
					<Tool
45450
						Name="VCCLCompilerTool"
45451
					/>
45452
				</FileConfiguration>
45453
			</File>
45454
			<File
45455
				RelativePath="..\dom\WindowEventContext.h"
45456
				>
45457
			</File>
45458
			<File
45347
				RelativePath="..\dom\XMLDocumentParser.cpp"
45459
				RelativePath="..\dom\XMLDocumentParser.cpp"
45348
				>
45460
				>
45349
				<FileConfiguration
45461
				<FileConfiguration
- a/WebCore/WebCore.xcodeproj/project.pbxproj +16 lines
Lines 895-901 a/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
895
		410B7E721045FAB000D8224F /* JSMessageEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */; };
895
		410B7E721045FAB000D8224F /* JSMessageEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */; };
896
		411046410FA222A600BA436A /* ScriptEventListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 4110463F0FA222A600BA436A /* ScriptEventListener.h */; };
896
		411046410FA222A600BA436A /* ScriptEventListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 4110463F0FA222A600BA436A /* ScriptEventListener.h */; };
897
		411046420FA222A600BA436A /* ScriptEventListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 411046400FA222A600BA436A /* ScriptEventListener.cpp */; };
897
		411046420FA222A600BA436A /* ScriptEventListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 411046400FA222A600BA436A /* ScriptEventListener.cpp */; };
898
		4123E569127B3041000FEEA7 /* WindowEventContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4123E567127B3041000FEEA7 /* WindowEventContext.h */; };
899
		4123E56A127B3041000FEEA7 /* WindowEventContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4123E568127B3041000FEEA7 /* WindowEventContext.cpp */; };
898
		4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */; };
900
		4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */; };
901
		4138D3351244054800323D33 /* EventContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4138D3331244054800323D33 /* EventContext.h */; };
902
		4138D3361244054800323D33 /* EventContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4138D3341244054800323D33 /* EventContext.cpp */; };
899
		4162A450101145AE00DFF3ED /* DedicatedWorkerContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A44D101145AE00DFF3ED /* DedicatedWorkerContext.cpp */; };
903
		4162A450101145AE00DFF3ED /* DedicatedWorkerContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A44D101145AE00DFF3ED /* DedicatedWorkerContext.cpp */; };
900
		4162A451101145AE00DFF3ED /* DedicatedWorkerContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A44E101145AE00DFF3ED /* DedicatedWorkerContext.h */; };
904
		4162A451101145AE00DFF3ED /* DedicatedWorkerContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A44E101145AE00DFF3ED /* DedicatedWorkerContext.h */; };
901
		4162A454101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */; };
905
		4162A454101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */; };
Lines 6972-6978 a/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
6972
		410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageEventCustom.cpp; sourceTree = "<group>"; };
6976
		410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageEventCustom.cpp; sourceTree = "<group>"; };
6973
		4110463F0FA222A600BA436A /* ScriptEventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptEventListener.h; sourceTree = "<group>"; };
6977
		4110463F0FA222A600BA436A /* ScriptEventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptEventListener.h; sourceTree = "<group>"; };
6974
		411046400FA222A600BA436A /* ScriptEventListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptEventListener.cpp; sourceTree = "<group>"; };
6978
		411046400FA222A600BA436A /* ScriptEventListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptEventListener.cpp; sourceTree = "<group>"; };
6979
		4123E567127B3041000FEEA7 /* WindowEventContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowEventContext.h; sourceTree = "<group>"; };
6980
		4123E568127B3041000FEEA7 /* WindowEventContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowEventContext.cpp; sourceTree = "<group>"; };
6975
		4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; };
6981
		4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; };
6982
		4138D3331244054800323D33 /* EventContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventContext.h; sourceTree = "<group>"; };
6983
		4138D3341244054800323D33 /* EventContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventContext.cpp; sourceTree = "<group>"; };
6976
		4162A44D101145AE00DFF3ED /* DedicatedWorkerContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DedicatedWorkerContext.cpp; path = workers/DedicatedWorkerContext.cpp; sourceTree = "<group>"; };
6984
		4162A44D101145AE00DFF3ED /* DedicatedWorkerContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DedicatedWorkerContext.cpp; path = workers/DedicatedWorkerContext.cpp; sourceTree = "<group>"; };
6977
		4162A44E101145AE00DFF3ED /* DedicatedWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DedicatedWorkerContext.h; path = workers/DedicatedWorkerContext.h; sourceTree = "<group>"; };
6985
		4162A44E101145AE00DFF3ED /* DedicatedWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DedicatedWorkerContext.h; path = workers/DedicatedWorkerContext.h; sourceTree = "<group>"; };
6978
		4162A44F101145AE00DFF3ED /* DedicatedWorkerContext.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DedicatedWorkerContext.idl; path = workers/DedicatedWorkerContext.idl; sourceTree = "<group>"; };
6986
		4162A44F101145AE00DFF3ED /* DedicatedWorkerContext.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DedicatedWorkerContext.idl; path = workers/DedicatedWorkerContext.idl; sourceTree = "<group>"; };
Lines 18202-18207 a/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
18202
				85031B2B0A44EFC700F992E0 /* Event.cpp */,
18210
				85031B2B0A44EFC700F992E0 /* Event.cpp */,
18203
				85031B2C0A44EFC700F992E0 /* Event.h */,
18211
				85031B2C0A44EFC700F992E0 /* Event.h */,
18204
				14E836D209F8512000B85AE4 /* Event.idl */,
18212
				14E836D209F8512000B85AE4 /* Event.idl */,
18213
				4138D3341244054800323D33 /* EventContext.cpp */,
18214
				4138D3331244054800323D33 /* EventContext.h */,
18205
				BC60D9090D2A17CE00B9918F /* EventException.h */,
18215
				BC60D9090D2A17CE00B9918F /* EventException.h */,
18206
				BC60D90A0D2A17CE00B9918F /* EventException.idl */,
18216
				BC60D90A0D2A17CE00B9918F /* EventException.idl */,
18207
				935FBC4409BA00B900E230B1 /* EventListener.h */,
18217
				935FBC4409BA00B900E230B1 /* EventListener.h */,
Lines 18362-18367 a/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
18362
				85031B3A0A44EFC700F992E0 /* WheelEvent.cpp */,
18372
				85031B3A0A44EFC700F992E0 /* WheelEvent.cpp */,
18363
				85031B3B0A44EFC700F992E0 /* WheelEvent.h */,
18373
				85031B3B0A44EFC700F992E0 /* WheelEvent.h */,
18364
				93EEC1F709C2877700C515D1 /* WheelEvent.idl */,
18374
				93EEC1F709C2877700C515D1 /* WheelEvent.idl */,
18375
				4123E568127B3041000FEEA7 /* WindowEventContext.cpp */,
18376
				4123E567127B3041000FEEA7 /* WindowEventContext.h */,
18365
				F523D30902DE4476018635CA /* XMLDocumentParser.cpp */,
18377
				F523D30902DE4476018635CA /* XMLDocumentParser.cpp */,
18366
				F523D30A02DE4476018635CA /* XMLDocumentParser.h */,
18378
				F523D30A02DE4476018635CA /* XMLDocumentParser.h */,
18367
				54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */,
18379
				54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */,
Lines 19528-19533 a/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
19528
				89878560122CA064003AABDA /* ErrorCallback.h in Headers */,
19540
				89878560122CA064003AABDA /* ErrorCallback.h in Headers */,
19529
				2ECF7AE210162B5800427DE7 /* ErrorEvent.h in Headers */,
19541
				2ECF7AE210162B5800427DE7 /* ErrorEvent.h in Headers */,
19530
				85031B420A44EFC700F992E0 /* Event.h in Headers */,
19542
				85031B420A44EFC700F992E0 /* Event.h in Headers */,
19543
				4138D3351244054800323D33 /* EventContext.h in Headers */,
19531
				BC60D90C0D2A17CE00B9918F /* EventException.h in Headers */,
19544
				BC60D90C0D2A17CE00B9918F /* EventException.h in Headers */,
19532
				93C09A530B064DB3005ABD4D /* EventHandler.h in Headers */,
19545
				93C09A530B064DB3005ABD4D /* EventHandler.h in Headers */,
19533
				935FBC4509BA00B900E230B1 /* EventListener.h in Headers */,
19546
				935FBC4509BA00B900E230B1 /* EventListener.h in Headers */,
Lines 21195-21200 a/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
21195
				85031B510A44EFC700F992E0 /* WheelEvent.h in Headers */,
21208
				85031B510A44EFC700F992E0 /* WheelEvent.h in Headers */,
21196
				9380F47409A11AB4001FDB34 /* Widget.h in Headers */,
21209
				9380F47409A11AB4001FDB34 /* Widget.h in Headers */,
21197
				939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */,
21210
				939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */,
21211
				4123E569127B3041000FEEA7 /* WindowEventContext.h in Headers */,
21198
				BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */,
21212
				BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */,
21199
				E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */,
21213
				E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */,
21200
				08203AA00ED8C35300B8B61A /* WMLAccessElement.h in Headers */,
21214
				08203AA00ED8C35300B8B61A /* WMLAccessElement.h in Headers */,
Lines 22167-22172 a/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
22167
				893C480C1248BD3A002B3D86 /* EntrySync.cpp in Sources */,
22181
				893C480C1248BD3A002B3D86 /* EntrySync.cpp in Sources */,
22168
				2ECF7AE110162B5800427DE7 /* ErrorEvent.cpp in Sources */,
22182
				2ECF7AE110162B5800427DE7 /* ErrorEvent.cpp in Sources */,
22169
				85031B410A44EFC700F992E0 /* Event.cpp in Sources */,
22183
				85031B410A44EFC700F992E0 /* Event.cpp in Sources */,
22184
				4138D3361244054800323D33 /* EventContext.cpp in Sources */,
22170
				93C09A810B064F00005ABD4D /* EventHandler.cpp in Sources */,
22185
				93C09A810B064F00005ABD4D /* EventHandler.cpp in Sources */,
22171
				93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */,
22186
				93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */,
22172
				1CA19E050DC255950065A994 /* EventLoopMac.mm in Sources */,
22187
				1CA19E050DC255950065A994 /* EventLoopMac.mm in Sources */,
Lines 23767-23772 a/WebCore/WebCore.xcodeproj/project.pbxproj_sec8
23767
				9380F47309A11AB4001FDB34 /* Widget.cpp in Sources */,
23782
				9380F47309A11AB4001FDB34 /* Widget.cpp in Sources */,
23768
				9380F47809A11ACC001FDB34 /* WidgetMac.mm in Sources */,
23783
				9380F47809A11ACC001FDB34 /* WidgetMac.mm in Sources */,
23769
				939B02EE0EA2DBC400C54570 /* WidthIterator.cpp in Sources */,
23784
				939B02EE0EA2DBC400C54570 /* WidthIterator.cpp in Sources */,
23785
				4123E56A127B3041000FEEA7 /* WindowEventContext.cpp in Sources */,
23770
				BC8243E80D0CFD7500460C8F /* WindowFeatures.cpp in Sources */,
23786
				BC8243E80D0CFD7500460C8F /* WindowFeatures.cpp in Sources */,
23771
				08203A9F0ED8C35300B8B61A /* WMLAccessElement.cpp in Sources */,
23787
				08203A9F0ED8C35300B8B61A /* WMLAccessElement.cpp in Sources */,
23772
				088C97510ECB6E28000534BA /* WMLAElement.cpp in Sources */,
23788
				088C97510ECB6E28000534BA /* WMLAElement.cpp in Sources */,
- a/WebCore/dom/ContainerNode.cpp -1 / +2 lines
Lines 1005-1011 static void notifyChildInserted(Node* child) a/WebCore/dom/ContainerNode.cpp_sec1
1005
    RefPtr<Node> c = child;
1005
    RefPtr<Node> c = child;
1006
    RefPtr<Document> document = child->document();
1006
    RefPtr<Document> document = child->document();
1007
1007
1008
    if (c->parentNode() && c->parentNode()->inDocument())
1008
    Node* parentOrHostNode = c->parentOrHostNode();
1009
    if (parentOrHostNode && parentOrHostNode->inDocument())
1009
        c->insertedIntoDocument();
1010
        c->insertedIntoDocument();
1010
    else
1011
    else
1011
        c->insertedIntoTree(true);
1012
        c->insertedIntoTree(true);
- a/WebCore/dom/DOMAllInOne.cpp +2 lines
Lines 69-74 a/WebCore/dom/DOMAllInOne.cpp_sec1
69
#include "EntityReference.cpp"
69
#include "EntityReference.cpp"
70
#include "ErrorEvent.cpp"
70
#include "ErrorEvent.cpp"
71
#include "Event.cpp"
71
#include "Event.cpp"
72
#include "EventContext.cpp"
72
#include "EventNames.cpp"
73
#include "EventNames.cpp"
73
#include "EventTarget.cpp"
74
#include "EventTarget.cpp"
74
#include "ExceptionBase.cpp"
75
#include "ExceptionBase.cpp"
Lines 126-130 a/WebCore/dom/DOMAllInOne.cpp_sec2
126
#include "WebKitAnimationEvent.cpp"
127
#include "WebKitAnimationEvent.cpp"
127
#include "WebKitTransitionEvent.cpp"
128
#include "WebKitTransitionEvent.cpp"
128
#include "WheelEvent.cpp"
129
#include "WheelEvent.cpp"
130
#include "WindowEventContext.cpp"
129
#include "XMLDocumentParser.cpp"
131
#include "XMLDocumentParser.cpp"
130
#include "XMLDocumentParserScope.cpp"
132
#include "XMLDocumentParserScope.cpp"
- a/WebCore/dom/EventContext.cpp +51 lines
Line 0 a/WebCore/dom/EventContext.cpp_sec1
1
/*
2
 * Copyright (C) 2010 Google Inc. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24
 *
25
 */
26
27
#include "config.h"
28
#include "EventContext.h"
29
30
#include "DOMWindow.h"
31
#include "Document.h"
32
#include "Event.h"
33
#include "Node.h"
34
35
namespace WebCore {
36
37
EventContext::EventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget> currentTarget, PassRefPtr<EventTarget> target)
38
    : m_node(node)
39
    , m_currentTarget(currentTarget)
40
    , m_target(target)
41
{
42
}
43
44
void EventContext::handleLocalEvents(Event* event) const
45
{
46
    event->setTarget(m_target.get());
47
    event->setCurrentTarget(m_currentTarget.get());
48
    m_node->handleLocalEvents(event);
49
}
50
51
}
- a/WebCore/dom/EventContext.h +65 lines
Line 0 a/WebCore/dom/EventContext.h_sec1
1
/*
2
 * Copyright (C) 2010 Google Inc. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24
 *
25
 */
26
27
#ifndef EventContext_h
28
#define EventContext_h
29
30
#include <wtf/RefPtr.h>
31
32
namespace WebCore {
33
34
class EventTarget;
35
class Event;
36
class Node;
37
38
class EventContext {
39
public:
40
    // FIXME: Use ContainerNode instead of Node.
41
    EventContext(PassRefPtr<Node>, PassRefPtr<EventTarget> currentTarget, PassRefPtr<EventTarget> target);
42
43
    Node* node() const;
44
    EventTarget* target() const;
45
    void handleLocalEvents(Event*) const;
46
47
private:
48
    RefPtr<Node> m_node;
49
    RefPtr<EventTarget> m_currentTarget;
50
    RefPtr<EventTarget> m_target;
51
};
52
53
inline Node* EventContext::node() const
54
{
55
    return m_node.get();
56
}
57
58
inline EventTarget* EventContext::target() const
59
{
60
    return m_target.get();
61
}
62
63
}
64
65
#endif // EventContext_h
- a/WebCore/dom/Node.cpp -66 / +59 lines
Lines 45-50 a/WebCore/dom/Node.cpp_sec1
45
#include "DynamicNodeList.h"
45
#include "DynamicNodeList.h"
46
#include "Element.h"
46
#include "Element.h"
47
#include "Event.h"
47
#include "Event.h"
48
#include "EventContext.h"
48
#include "EventException.h"
49
#include "EventException.h"
49
#include "EventHandler.h"
50
#include "EventHandler.h"
50
#include "EventListener.h"
51
#include "EventListener.h"
Lines 80-85 a/WebCore/dom/Node.cpp_sec2
80
#include "WebKitAnimationEvent.h"
81
#include "WebKitAnimationEvent.h"
81
#include "WebKitTransitionEvent.h"
82
#include "WebKitTransitionEvent.h"
82
#include "WheelEvent.h"
83
#include "WheelEvent.h"
84
#include "WindowEventContext.h"
83
#include "XMLNames.h"
85
#include "XMLNames.h"
84
#include "htmlediting.h"
86
#include "htmlediting.h"
85
#include <wtf/HashSet.h>
87
#include <wtf/HashSet.h>
Lines 734-742 inline void Node::setStyleChange(StyleChangeType changeType) a/WebCore/dom/Node.cpp_sec3
734
736
735
inline void Node::markAncestorsWithChildNeedsStyleRecalc()
737
inline void Node::markAncestorsWithChildNeedsStyleRecalc()
736
{
738
{
737
    for (ContainerNode* p = parentNode(); p && !p->childNeedsStyleRecalc(); p = p->parentNode())
739
    for (ContainerNode* p = parentOrHostNode(); p && !p->childNeedsStyleRecalc(); p = p->parentOrHostNode())
738
        p->setChildNeedsStyleRecalc();
740
        p->setChildNeedsStyleRecalc();
739
    
741
740
    if (document()->childNeedsStyleRecalc())
742
    if (document()->childNeedsStyleRecalc())
741
        document()->scheduleStyleRecalc();
743
        document()->scheduleStyleRecalc();
742
}
744
}
Lines 1321-1327 void Node::createRendererIfNeeded() a/WebCore/dom/Node.cpp_sec4
1321
1323
1322
    ASSERT(!renderer());
1324
    ASSERT(!renderer());
1323
    
1325
    
1324
    ContainerNode* parent = parentNode();    
1326
    ContainerNode* parent = parentOrHostNode();
1325
    ASSERT(parent);
1327
    ASSERT(parent);
1326
    
1328
    
1327
    RenderObject* parentRenderer = parent->renderer();
1329
    RenderObject* parentRenderer = parent->renderer();
Lines 2239-2252 void Node::getSubresourceURLs(ListHashSet<KURL>& urls) const a/WebCore/dom/Node.cpp_sec5
2239
    addSubresourceAttributeURLs(urls);
2241
    addSubresourceAttributeURLs(urls);
2240
}
2242
}
2241
2243
2242
ContainerNode* Node::eventParentNode()
2243
{
2244
    return parentNode();
2245
}
2246
2247
Node* Node::enclosingLinkEventParentOrSelf()
2244
Node* Node::enclosingLinkEventParentOrSelf()
2248
{
2245
{
2249
    for (Node* node = this; node; node = node->eventParentNode()) {
2246
    for (Node* node = this; node; node = node->parentOrHostNode()) {
2250
        // For imagemaps, the enclosing link node is the associated area element not the image itself.
2247
        // For imagemaps, the enclosing link node is the associated area element not the image itself.
2251
        // So we don't let images be the enclosingLinkNode, even though isLink sometimes returns true
2248
        // So we don't let images be the enclosingLinkNode, even though isLink sometimes returns true
2252
        // for them.
2249
        // for them.
Lines 2484-2495 void Node::handleLocalEvents(Event* event) a/WebCore/dom/Node.cpp_sec6
2484
    fireEventListeners(event);
2481
    fireEventListeners(event);
2485
}
2482
}
2486
2483
2487
#if ENABLE(SVG)
2484
static inline EventTarget* eventTargetRespectingSVGTargetRules(Node* referenceNode)
2488
static inline SVGElementInstance* eventTargetAsSVGElementInstance(Node* referenceNode)
2489
{
2485
{
2490
    ASSERT(referenceNode);
2486
    ASSERT(referenceNode);
2487
2488
#if ENABLE(SVG)
2491
    if (!referenceNode->isSVGElement())
2489
    if (!referenceNode->isSVGElement())
2492
        return 0;
2490
        return referenceNode;
2493
2491
2494
    // Spec: The event handling for the non-exposed tree works as if the referenced element had been textually included
2492
    // Spec: The event handling for the non-exposed tree works as if the referenced element had been textually included
2495
    // as a deeply cloned child of the 'use' element, except that events are dispatched to the SVGElementInstance objects
2493
    // as a deeply cloned child of the 'use' element, except that events are dispatched to the SVGElementInstance objects
Lines 2503-2538 static inline SVGElementInstance* eventTargetAsSVGElementInstance(Node* referenc a/WebCore/dom/Node.cpp_sec7
2503
        if (SVGElementInstance* instance = static_cast<SVGUseElement*>(shadowTreeParentElement)->instanceForShadowTreeElement(referenceNode))
2501
        if (SVGElementInstance* instance = static_cast<SVGUseElement*>(shadowTreeParentElement)->instanceForShadowTreeElement(referenceNode))
2504
            return instance;
2502
            return instance;
2505
    }
2503
    }
2504
#endif
2506
2505
2507
    return 0;
2506
    return referenceNode;
2508
}
2507
}
2509
#endif
2510
2508
2511
static inline EventTarget* eventTargetRespectingSVGTargetRules(Node* referenceNode)
2509
void Node::getEventAncestors(Vector<EventContext>& ancestors, EventTarget* originalTarget, EventDispatchBehavior behavior)
2512
{
2510
{
2513
    ASSERT(referenceNode);
2511
    if (!inDocument())
2512
        return;
2514
2513
2515
#if ENABLE(SVG)
2514
    EventTarget* target = originalTarget;
2516
    if (SVGElementInstance* instance = eventTargetAsSVGElementInstance(referenceNode)) {
2515
    Node* ancestor = this;
2517
        ASSERT(instance->shadowTreeElement() == referenceNode);
2516
    bool shouldSkipNextAncestor = false;
2518
        return instance;
2517
    while (true) {
2519
    }
2518
        if (ancestor->isShadowNode()) {
2520
#endif
2519
            if (behavior == StayInsideShadowDOM)
2520
                return;
2521
            ancestor = ancestor->shadowParentNode();
2522
            if (!shouldSkipNextAncestor)
2523
                target = ancestor;
2524
        } else
2525
            ancestor = ancestor->parentNode();
2521
2526
2522
    return referenceNode;
2527
        if (!ancestor)
2523
}
2528
            return;
2524
2529
2525
void Node::eventAncestors(Vector<RefPtr<ContainerNode> > &ancestors)
2526
{
2527
    if (inDocument()) {
2528
        for (ContainerNode* ancestor = eventParentNode(); ancestor; ancestor = ancestor->eventParentNode()) {
2529
#if ENABLE(SVG)
2530
#if ENABLE(SVG)
2530
            // Skip <use> shadow tree elements.
2531
        // Skip SVGShadowTreeRootElement.
2531
            if (ancestor->isSVGElement() && ancestor->isShadowNode())
2532
        shouldSkipNextAncestor = ancestor->isSVGElement() && ancestor->isShadowNode();
2532
                continue;
2533
        if (shouldSkipNextAncestor)
2534
            continue;
2533
#endif
2535
#endif
2534
            ancestors.append(ancestor);
2536
        // FIXME: Unroll the extra loop inside eventTargetRespectingSVGTargetRules into this loop.
2535
        }
2537
        ancestors.append(EventContext(ancestor, eventTargetRespectingSVGTargetRules(ancestor), target));
2538
2536
    }
2539
    }
2537
}
2540
}
2538
2541
Lines 2547-2552 bool Node::dispatchEvent(PassRefPtr<Event> prpEvent) a/WebCore/dom/Node.cpp_sec8
2547
    return dispatchGenericEvent(event.release());
2550
    return dispatchGenericEvent(event.release());
2548
}
2551
}
2549
2552
2553
static const EventContext* topEventContext(const Vector<EventContext>& ancestors)
2554
{
2555
    return ancestors.isEmpty() ? 0 : &(ancestors.last());
2556
}
2557
2550
bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent)
2558
bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent)
2551
{
2559
{
2552
    RefPtr<Event> event(prpEvent);
2560
    RefPtr<Event> event(prpEvent);
Lines 2559-2578 bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent) a/WebCore/dom/Node.cpp_sec9
2559
    // If the node is not in a document just send the event to it.
2567
    // If the node is not in a document just send the event to it.
2560
    // Be sure to ref all of nodes since event handlers could result in the last reference going away.
2568
    // Be sure to ref all of nodes since event handlers could result in the last reference going away.
2561
    RefPtr<Node> thisNode(this);
2569
    RefPtr<Node> thisNode(this);
2562
    Vector<RefPtr<ContainerNode> > ancestors;
2570
    RefPtr<EventTarget> originalTarget = event->target();
2563
    eventAncestors(ancestors);
2571
    Vector<EventContext> ancestors;
2572
    getEventAncestors(ancestors, originalTarget.get(), event->isMutationEvent() ? StayInsideShadowDOM : RetargetEvent);
2564
2573
2565
    // Set up a pointer to indicate whether / where to dispatch window events.
2574
    WindowEventContext windowContext(event.get(), this, topEventContext(ancestors));
2566
    // We don't dispatch load events to the window. That quirk was originally
2567
    // added because Mozilla doesn't propagate load events to the window object.
2568
    DOMWindow* targetForWindowEvents = 0;
2569
    if (event->type() != eventNames().loadEvent) {
2570
        Node* topLevelContainer = ancestors.isEmpty() ? this : ancestors.last().get();
2571
        if (topLevelContainer->isDocumentNode())
2572
            targetForWindowEvents = static_cast<Document*>(topLevelContainer)->domWindow();
2573
    }
2574
2575
2575
    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(document(), *event, targetForWindowEvents, this, ancestors);
2576
    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(document(), *event, windowContext.window(), this, ancestors);
2576
2577
2577
    // Give the target node a chance to do some work before DOM event handlers get a crack.
2578
    // Give the target node a chance to do some work before DOM event handlers get a crack.
2578
    void* data = preDispatchEventHandler(event.get());
2579
    void* data = preDispatchEventHandler(event.get());
Lines 2582-2603 bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent) a/WebCore/dom/Node.cpp_sec10
2582
    // Trigger capturing event handlers, starting at the top and working our way down.
2583
    // Trigger capturing event handlers, starting at the top and working our way down.
2583
    event->setEventPhase(Event::CAPTURING_PHASE);
2584
    event->setEventPhase(Event::CAPTURING_PHASE);
2584
2585
2585
    if (targetForWindowEvents) {
2586
    if (windowContext.handleLocalEvents(event.get()) && event->propagationStopped())
2586
        event->setCurrentTarget(targetForWindowEvents);
2587
        goto doneDispatching;
2587
        targetForWindowEvents->fireEventListeners(event.get());
2588
2588
        if (event->propagationStopped())
2589
            goto doneDispatching;
2590
    }
2591
    for (size_t i = ancestors.size(); i; --i) {
2589
    for (size_t i = ancestors.size(); i; --i) {
2592
        ContainerNode* ancestor = ancestors[i - 1].get();
2590
        ancestors[i - 1].handleLocalEvents(event.get());
2593
        event->setCurrentTarget(eventTargetRespectingSVGTargetRules(ancestor));
2594
        ancestor->handleLocalEvents(event.get());
2595
        if (event->propagationStopped())
2591
        if (event->propagationStopped())
2596
            goto doneDispatching;
2592
            goto doneDispatching;
2597
    }
2593
    }
2598
2594
2599
    event->setEventPhase(Event::AT_TARGET);
2595
    event->setEventPhase(Event::AT_TARGET);
2600
2596
    event->setTarget(originalTarget.get());
2601
    event->setCurrentTarget(eventTargetRespectingSVGTargetRules(this));
2597
    event->setCurrentTarget(eventTargetRespectingSVGTargetRules(this));
2602
    handleLocalEvents(event.get());
2598
    handleLocalEvents(event.get());
2603
    if (event->propagationStopped())
2599
    if (event->propagationStopped())
Lines 2609-2629 bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent) a/WebCore/dom/Node.cpp_sec11
2609
2605
2610
        size_t size = ancestors.size();
2606
        size_t size = ancestors.size();
2611
        for (size_t i = 0; i < size; ++i) {
2607
        for (size_t i = 0; i < size; ++i) {
2612
            ContainerNode* ancestor = ancestors[i].get();
2608
            ancestors[i].handleLocalEvents(event.get());
2613
            event->setCurrentTarget(eventTargetRespectingSVGTargetRules(ancestor));
2614
            ancestor->handleLocalEvents(event.get());
2615
            if (event->propagationStopped() || event->cancelBubble())
2616
                goto doneDispatching;
2617
        }
2618
        if (targetForWindowEvents) {
2619
            event->setCurrentTarget(targetForWindowEvents);
2620
            targetForWindowEvents->fireEventListeners(event.get());
2621
            if (event->propagationStopped() || event->cancelBubble())
2609
            if (event->propagationStopped() || event->cancelBubble())
2622
                goto doneDispatching;
2610
                goto doneDispatching;
2623
        }
2611
        }
2612
        windowContext.handleLocalEvents(event.get());
2624
    }
2613
    }
2625
2614
2626
doneDispatching:
2615
doneDispatching:
2616
    event->setTarget(originalTarget.get());
2627
    event->setCurrentTarget(0);
2617
    event->setCurrentTarget(0);
2628
    event->setEventPhase(0);
2618
    event->setEventPhase(0);
2629
2619
Lines 2644-2651 doneDispatching: a/WebCore/dom/Node.cpp_sec12
2644
        if (event->bubbles()) {
2634
        if (event->bubbles()) {
2645
            size_t size = ancestors.size();
2635
            size_t size = ancestors.size();
2646
            for (size_t i = 0; i < size; ++i) {
2636
            for (size_t i = 0; i < size; ++i) {
2647
                ContainerNode* ancestor = ancestors[i].get();
2637
                ancestors[i].node()->defaultEventHandler(event.get());
2648
                ancestor->defaultEventHandler(event.get());
2649
                ASSERT(!event->defaultPrevented());
2638
                ASSERT(!event->defaultPrevented());
2650
                if (event->defaultHandled())
2639
                if (event->defaultHandled())
2651
                    goto doneWithDefault;
2640
                    goto doneWithDefault;
Lines 2655-2660 doneDispatching: a/WebCore/dom/Node.cpp_sec13
2655
2644
2656
doneWithDefault:
2645
doneWithDefault:
2657
2646
2647
    // Ensure that after event dispatch, the event's target object is the
2648
    // outermost shadow DOM boundary.
2649
    event->setTarget(windowContext.target());
2650
    event->setCurrentTarget(0);
2658
    InspectorInstrumentation::didDispatchEvent(cookie);
2651
    InspectorInstrumentation::didDispatchEvent(cookie);
2659
2652
2660
    return !event->defaultPrevented();
2653
    return !event->defaultPrevented();
- a/WebCore/dom/Node.h -5 / +16 lines
Lines 49-54 class Document; a/WebCore/dom/Node.h_sec1
49
class DynamicNodeList;
49
class DynamicNodeList;
50
class Element;
50
class Element;
51
class Event;
51
class Event;
52
class EventContext;
52
class EventListener;
53
class EventListener;
53
class FloatPoint;
54
class FloatPoint;
54
class Frame;
55
class Frame;
Lines 85-90 enum StyleChangeType { a/WebCore/dom/Node.h_sec2
85
    SyntheticStyleChange = 3 << nodeStyleChangeShift
86
    SyntheticStyleChange = 3 << nodeStyleChangeShift
86
};
87
};
87
88
89
enum EventDispatchBehavior {
90
    RetargetEvent,
91
    StayInsideShadowDOM
92
};
93
88
class Node : public EventTarget, public TreeShared<ContainerNode>, public ScriptWrappable {
94
class Node : public EventTarget, public TreeShared<ContainerNode>, public ScriptWrappable {
89
    friend class Document;
95
    friend class Document;
90
public:
96
public:
Lines 204-219 public: a/WebCore/dom/Node.h_sec3
204
    Node* shadowAncestorNode();
210
    Node* shadowAncestorNode();
205
    Node* shadowTreeRootNode();
211
    Node* shadowTreeRootNode();
206
    bool isInShadowTree();
212
    bool isInShadowTree();
207
213
    // Node's parent or shadow tree host.
208
    // The node's parent for the purpose of event capture and bubbling.
214
    ContainerNode* parentOrHostNode();
209
    virtual ContainerNode* eventParentNode();
210
215
211
    // Returns the enclosing event parent node (or self) that, when clicked, would trigger a navigation.
216
    // Returns the enclosing event parent node (or self) that, when clicked, would trigger a navigation.
212
    Node* enclosingLinkEventParentOrSelf();
217
    Node* enclosingLinkEventParentOrSelf();
213
218
214
    // Node ancestors when concerned about event flow.
219
    // Node ancestors when concerned about event flow.
215
    // FIXME: Should be named getEventAncestors.
220
    void getEventAncestors(Vector<EventContext>& ancestors, EventTarget*, EventDispatchBehavior = RetargetEvent);
216
    void eventAncestors(Vector<RefPtr<ContainerNode> > &ancestors);
217
221
218
    bool isBlockFlow() const;
222
    bool isBlockFlow() const;
219
    bool isBlockFlowOrBlockTable() const;
223
    bool isBlockFlowOrBlockTable() const;
Lines 693-698 inline void addSubresourceURL(ListHashSet<KURL>& urls, const KURL& url) a/WebCore/dom/Node.h_sec4
693
        urls.add(url);
697
        urls.add(url);
694
}
698
}
695
699
700
inline ContainerNode* Node::parentOrHostNode()
701
{
702
    if (ContainerNode* parent = parentNode())
703
        return parent;
704
    return shadowParentNode();
705
}
706
696
} //namespace
707
} //namespace
697
708
698
#ifndef NDEBUG
709
#ifndef NDEBUG
- a/WebCore/dom/Text.cpp -2 / +3 lines
Lines 240-248 bool Text::rendererIsNeeded(RenderStyle *style) a/WebCore/dom/Text.cpp_sec1
240
RenderObject* Text::createRenderer(RenderArena* arena, RenderStyle*)
240
RenderObject* Text::createRenderer(RenderArena* arena, RenderStyle*)
241
{
241
{
242
#if ENABLE(SVG)
242
#if ENABLE(SVG)
243
    if (parentNode()->isSVGElement()
243
    Node* parentOrHost = parentOrHostNode();
244
    if (parentOrHost->isSVGElement()
244
#if ENABLE(SVG_FOREIGN_OBJECT)
245
#if ENABLE(SVG_FOREIGN_OBJECT)
245
        && !parentNode()->hasTagName(SVGNames::foreignObjectTag)
246
        && !parentOrHost->hasTagName(SVGNames::foreignObjectTag)
246
#endif
247
#endif
247
    )
248
    )
248
        return new (arena) RenderSVGInlineText(this, dataImpl());
249
        return new (arena) RenderSVGInlineText(this, dataImpl());
- a/WebCore/dom/WindowEventContext.cpp +64 lines
Line 0 a/WebCore/dom/WindowEventContext.cpp_sec1
1
/*
2
 * Copyright (C) 2010 Google Inc. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24
 *
25
 */
26
27
#include "config.h"
28
#include "WindowEventContext.h"
29
30
#include "DOMWindow.h"
31
#include "Document.h"
32
#include "Event.h"
33
#include "EventContext.h"
34
#include "Node.h"
35
36
namespace WebCore {
37
38
WindowEventContext::WindowEventContext(Event* event, PassRefPtr<Node> node, const EventContext* topEventContext)
39
{
40
    // We don't dispatch load events to the window. That quirk was originally
41
    // added because Mozilla doesn't propagate load events to the window object.
42
    if (event->type() == eventNames().loadEvent)
43
        return;
44
45
    Node* topLevelContainer = topEventContext ? topEventContext->node() : node.get();
46
    if (!topLevelContainer->isDocumentNode())
47
        return;
48
49
    m_window = static_cast<Document*>(topLevelContainer)->domWindow();
50
    m_target = topEventContext ? topEventContext->target() : node.get();
51
}
52
53
bool WindowEventContext::handleLocalEvents(Event* event)
54
{
55
    if (!m_window)
56
        return false;
57
58
    event->setTarget(target());
59
    event->setCurrentTarget(window());
60
    m_window->fireEventListeners(event);
61
    return true;
62
}
63
64
}
- a/WebCore/dom/WindowEventContext.h +65 lines
Line 0 a/WebCore/dom/WindowEventContext.h_sec1
1
/*
2
 * Copyright (C) 2010 Google Inc. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24
 *
25
 */
26
27
#ifndef WindowEventContext_h
28
#define WindowEventContext_h
29
30
#include <wtf/RefPtr.h>
31
32
namespace WebCore {
33
34
class DOMWindow;
35
class EventTarget;
36
class EventContext;
37
class Event;
38
class Node;
39
40
class WindowEventContext {
41
public:
42
    WindowEventContext(Event*, PassRefPtr<Node>, const EventContext*);
43
44
    DOMWindow* window() const;
45
    EventTarget* target() const;
46
    bool handleLocalEvents(Event* event);
47
48
private:
49
    RefPtr<DOMWindow> m_window;
50
    RefPtr<EventTarget> m_target;
51
};
52
53
inline DOMWindow* WindowEventContext::window() const
54
{
55
    return m_window.get();
56
}
57
58
inline EventTarget* WindowEventContext::target() const
59
{
60
    return m_target.get();
61
}
62
63
}
64
65
#endif // WindowEventContext_h
- a/WebCore/inspector/InspectorDOMAgent.cpp -3 / +4 lines
Lines 51-56 a/WebCore/inspector/InspectorDOMAgent.cpp_sec1
51
#include "Document.h"
51
#include "Document.h"
52
#include "DocumentType.h"
52
#include "DocumentType.h"
53
#include "Event.h"
53
#include "Event.h"
54
#include "EventContext.h"
54
#include "EventListener.h"
55
#include "EventListener.h"
55
#include "EventNames.h"
56
#include "EventNames.h"
56
#include "EventTarget.h"
57
#include "EventTarget.h"
Lines 607-619 void InspectorDOMAgent::getEventListenersForNode(long nodeId, long* outNodeId, R a/WebCore/inspector/InspectorDOMAgent.cpp_sec2
607
        return;
608
        return;
608
609
609
    // The Node's Event Ancestors (not including self)
610
    // The Node's Event Ancestors (not including self)
610
    Vector<RefPtr<ContainerNode> > ancestors;
611
    Vector<EventContext> ancestors;
611
    node->eventAncestors(ancestors);
612
    node->getEventAncestors(ancestors, node);
612
613
613
    // Nodes and their Listeners for the concerned event types (order is top to bottom)
614
    // Nodes and their Listeners for the concerned event types (order is top to bottom)
614
    Vector<EventListenerInfo> eventInformation;
615
    Vector<EventListenerInfo> eventInformation;
615
    for (size_t i = ancestors.size(); i; --i) {
616
    for (size_t i = ancestors.size(); i; --i) {
616
        ContainerNode* ancestor = ancestors[i - 1].get();
617
        Node* ancestor = ancestors[i - 1].node();
617
        for (size_t j = 0; j < eventTypesLength; ++j) {
618
        for (size_t j = 0; j < eventTypesLength; ++j) {
618
            AtomicString& type = eventTypes[j];
619
            AtomicString& type = eventTypes[j];
619
            if (ancestor->hasEventListeners(type))
620
            if (ancestor->hasEventListeners(type))
- a/WebCore/inspector/InspectorInstrumentation.cpp -4 / +4 lines
Lines 35-40 a/WebCore/inspector/InspectorInstrumentation.cpp_sec1
35
35
36
#include "DOMWindow.h"
36
#include "DOMWindow.h"
37
#include "Event.h"
37
#include "Event.h"
38
#include "EventContext.h"
38
#include "InspectorController.h"
39
#include "InspectorController.h"
39
#include "InspectorDOMAgent.h"
40
#include "InspectorDOMAgent.h"
40
#include "InspectorDebuggerAgent.h"
41
#include "InspectorDebuggerAgent.h"
Lines 53-59 static const char* const timerFiredEventName = "timerFired"; a/WebCore/inspector/InspectorInstrumentation.cpp_sec2
53
54
54
int InspectorInstrumentation::s_frontendCounter = 0;
55
int InspectorInstrumentation::s_frontendCounter = 0;
55
56
56
static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors)
57
static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
57
{
58
{
58
    if (window && window->hasEventListeners(eventType))
59
    if (window && window->hasEventListeners(eventType))
59
        return true;
60
        return true;
Lines 62-68 static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window, a/WebCore/inspector/InspectorInstrumentation.cpp_sec3
62
        return true;
63
        return true;
63
64
64
    for (size_t i = 0; i < ancestors.size(); i++) {
65
    for (size_t i = 0; i < ancestors.size(); i++) {
65
        ContainerNode* ancestor = ancestors[i].get();
66
        Node* ancestor = ancestors[i].node();
66
        if (ancestor->hasEventListeners(eventType))
67
        if (ancestor->hasEventListeners(eventType))
67
            return true;
68
            return true;
68
    }
69
    }
Lines 139-145 void InspectorInstrumentation::characterDataModifiedImpl(InspectorController* in a/WebCore/inspector/InspectorInstrumentation.cpp_sec4
139
        domAgent->characterDataModified(characterData);
140
        domAgent->characterDataModified(characterData);
140
}
141
}
141
142
142
143
void InspectorInstrumentation::willSendXMLHttpRequestImpl(InspectorController* inspectorController, const String& url)
143
void InspectorInstrumentation::willSendXMLHttpRequestImpl(InspectorController* inspectorController, const String& url)
144
{
144
{
145
#if ENABLE(JAVASCRIPT_DEBUGGER)
145
#if ENABLE(JAVASCRIPT_DEBUGGER)
Lines 213-219 void InspectorInstrumentation::didChangeXHRReadyStateImpl(const InspectorInstrum a/WebCore/inspector/InspectorInstrumentation.cpp_sec5
213
        timelineAgent->didChangeXHRReadyState();
213
        timelineAgent->didChangeXHRReadyState();
214
}
214
}
215
215
216
InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InspectorController* inspectorController, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors)
216
InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InspectorController* inspectorController, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
217
{
217
{
218
    pauseOnNativeEventIfNeeded(inspectorController, listenerEventCategoryType, event.type(), false);
218
    pauseOnNativeEventIfNeeded(inspectorController, listenerEventCategoryType, event.type(), false);
219
219
- a/WebCore/inspector/InspectorInstrumentation.h -4 / +4 lines
Lines 40-45 namespace WebCore { a/WebCore/inspector/InspectorInstrumentation.h_sec1
40
40
41
class CharacterData;
41
class CharacterData;
42
class Element;
42
class Element;
43
class EventContext;
43
class InspectorController;
44
class InspectorController;
44
class InspectorTimelineAgent;
45
class InspectorTimelineAgent;
45
class KURL;
46
class KURL;
Lines 73-79 public: a/WebCore/inspector/InspectorInstrumentation.h_sec2
73
    static void didCallFunction(const InspectorInstrumentationCookie&);
74
    static void didCallFunction(const InspectorInstrumentationCookie&);
74
    static InspectorInstrumentationCookie willChangeXHRReadyState(ScriptExecutionContext*, XMLHttpRequest* request);
75
    static InspectorInstrumentationCookie willChangeXHRReadyState(ScriptExecutionContext*, XMLHttpRequest* request);
75
    static void didChangeXHRReadyState(const InspectorInstrumentationCookie&);
76
    static void didChangeXHRReadyState(const InspectorInstrumentationCookie&);
76
    static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors);
77
    static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors);
77
    static void didDispatchEvent(const InspectorInstrumentationCookie&);
78
    static void didDispatchEvent(const InspectorInstrumentationCookie&);
78
    static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window);
79
    static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window);
79
    static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
80
    static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
Lines 130-136 private: a/WebCore/inspector/InspectorInstrumentation.h_sec3
130
    static void didCallFunctionImpl(const InspectorInstrumentationCookie&);
131
    static void didCallFunctionImpl(const InspectorInstrumentationCookie&);
131
    static InspectorInstrumentationCookie willChangeXHRReadyStateImpl(InspectorController*, XMLHttpRequest* request);
132
    static InspectorInstrumentationCookie willChangeXHRReadyStateImpl(InspectorController*, XMLHttpRequest* request);
132
    static void didChangeXHRReadyStateImpl(const InspectorInstrumentationCookie&);
133
    static void didChangeXHRReadyStateImpl(const InspectorInstrumentationCookie&);
133
    static InspectorInstrumentationCookie willDispatchEventImpl(InspectorController*, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors);
134
    static InspectorInstrumentationCookie willDispatchEventImpl(InspectorController*, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors);
134
    static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
135
    static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
135
    static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InspectorController*, const Event& event, DOMWindow* window);
136
    static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InspectorController*, const Event& event, DOMWindow* window);
136
    static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
137
    static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
Lines 225-231 inline void InspectorInstrumentation::characterDataModified(Document* document, a/WebCore/inspector/InspectorInstrumentation.h_sec4
225
#endif
226
#endif
226
}
227
}
227
228
228
229
inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url)
229
inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url)
230
{
230
{
231
#if ENABLE(INSPECTOR)
231
#if ENABLE(INSPECTOR)
Lines 293-299 inline void InspectorInstrumentation::didChangeXHRReadyState(const InspectorInst a/WebCore/inspector/InspectorInstrumentation.h_sec5
293
#endif
293
#endif
294
}
294
}
295
295
296
inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors)
296
inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
297
{
297
{
298
#if ENABLE(INSPECTOR)
298
#if ENABLE(INSPECTOR)
299
    if (InspectorController* inspectorController = inspectorControllerForDocument(document))
299
    if (InspectorController* inspectorController = inspectorControllerForDocument(document))
- a/WebCore/page/EventHandler.cpp -2 lines
Lines 1766-1773 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo a/WebCore/page/EventHandler.cpp_sec1
1766
        // If the target node is a text node, dispatch on the parent node - rdar://4196646
1766
        // If the target node is a text node, dispatch on the parent node - rdar://4196646
1767
        if (result && result->isTextNode())
1767
        if (result && result->isTextNode())
1768
            result = result->parentNode();
1768
            result = result->parentNode();
1769
        if (result)
1770
            result = result->shadowAncestorNode();
1771
    }
1769
    }
1772
    m_nodeUnderMouse = result;
1770
    m_nodeUnderMouse = result;
1773
#if ENABLE(SVG)
1771
#if ENABLE(SVG)
- a/WebCore/rendering/RenderTextControlMultiLine.cpp -2 lines
Lines 52-59 void RenderTextControlMultiLine::subtreeHasChanged() a/WebCore/rendering/RenderTextControlMultiLine.cpp_sec1
52
    if (!node()->focused())
52
    if (!node()->focused())
53
        return;
53
        return;
54
54
55
    node()->dispatchEvent(Event::create(eventNames().inputEvent, true, false));
56
57
    if (Frame* frame = this->frame())
55
    if (Frame* frame = this->frame())
58
        frame->editor()->textDidChangeInTextArea(textArea);
56
        frame->editor()->textDidChangeInTextArea(textArea);
59
}
57
}
- a/WebCore/rendering/ShadowElement.h -3 / +3 lines
Lines 43-55 protected: a/WebCore/rendering/ShadowElement.h_sec1
43
    {
43
    {
44
    }
44
    }
45
45
46
    HTMLElement* shadowParent() const { return m_shadowParent; }
46
    HTMLElement* shadowParent() const { return m_shadowParent.get(); }
47
47
48
private:
48
private:
49
    virtual bool isShadowNode() const { return true; }
49
    virtual bool isShadowNode() const { return true; }
50
    virtual ContainerNode* shadowParentNode() { return m_shadowParent; }
50
    virtual ContainerNode* shadowParentNode() { return m_shadowParent.get(); }
51
51
52
    HTMLElement* m_shadowParent;
52
    RefPtr<HTMLElement> m_shadowParent;
53
};
53
};
54
54
55
class ShadowBlockElement : public ShadowElement<HTMLDivElement> {
55
class ShadowBlockElement : public ShadowElement<HTMLDivElement> {
- a/WebCore/rendering/TextControlInnerElements.cpp -1 / +1 lines
Lines 154-160 void TextControlInnerTextElement::defaultEventHandler(Event* event) a/WebCore/rendering/TextControlInnerElements.cpp_sec1
154
        if (shadowAncestor && shadowAncestor != this)
154
        if (shadowAncestor && shadowAncestor != this)
155
            shadowAncestor->defaultEventHandler(event);
155
            shadowAncestor->defaultEventHandler(event);
156
    }
156
    }
157
    if (event->defaultHandled())
157
    if (!event->defaultHandled())
158
        HTMLDivElement::defaultEventHandler(event);
158
        HTMLDivElement::defaultEventHandler(event);
159
}
159
}
160
160
- a/WebCore/svg/SVGElement.cpp -7 lines
Lines 347-359 void SVGElement::updateAnimatedSVGAttribute(const QualifiedName& name) const a/WebCore/svg/SVGElement.cpp_sec1
347
    clearIsSynchronizingSVGAttributes();
347
    clearIsSynchronizingSVGAttributes();
348
}
348
}
349
349
350
ContainerNode* SVGElement::eventParentNode()
351
{
352
    if (ContainerNode* shadowParent = shadowParentNode())
353
        return shadowParent;
354
    return StyledElement::eventParentNode();
355
}
356
357
}
350
}
358
351
359
#endif // ENABLE(SVG)
352
#endif // ENABLE(SVG)
- a/WebCore/svg/SVGElement.h -2 lines
Lines 99-106 namespace WebCore { a/WebCore/svg/SVGElement.h_sec1
99
99
100
        virtual bool isSupported(StringImpl* feature, StringImpl* version) const;
100
        virtual bool isSupported(StringImpl* feature, StringImpl* version) const;
101
101
102
        virtual ContainerNode* eventParentNode();
103
104
        virtual bool needsPendingResourceHandling() const { return true; }
102
        virtual bool needsPendingResourceHandling() const { return true; }
105
        virtual void buildPendingResource() { }
103
        virtual void buildPendingResource() { }
106
104

Return to Bug 46015