| Differences between
and this patch
- a/Source/WebCore/ChangeLog +76 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2014-10-01  Brian J. Burg  <burg@cs.washington.edu>
2
3
        Web Replay: EventSender dispatches should be per-Document
4
        https://bugs.webkit.org/show_bug.cgi?id=136051
5
6
        EventSender uses a Timer to asynchronously dispatch the same event to multiple
7
        elements of the same type on a future run loop. However, we previously dispatched events
8
        to elements from any Document rather than the one that requested the event send.
9
10
        This patch changes EventSender to be associated with a single Document. EventSenders
11
        for each Document are lazily allocated. Further per-Document or global optimizations
12
        are possible.
13
14
        This change also lays the groundwork for making EventSender-related DOM events
15
        deterministic during web replay, tracked at <https://webkit.org/b/137090>.
16
17
        No new tests, covered by fast/text/svg-font-trigger-load-event.html.
18
19
        * CMakeLists.txt:
20
        * WebCore.vcxproj/WebCore.vcxproj:
21
        * WebCore.vcxproj/WebCore.vcxproj.filters:
22
        * WebCore.xcodeproj/project.pbxproj:
23
        * dom/DOMAllInOne.cpp:
24
        * dom/Document.cpp:
25
        (WebCore::Document::Document):
26
        (WebCore::Document::implicitClose):
27
        Dispatch pending events for this document only. Rename local variable f to frame.
28
29
        * dom/Document.h:
30
        (WebCore::Document::sharedEventSenders):
31
        * dom/EventSender.h:
32
        (WebCore::EventSender::EventSender):
33
        (WebCore::EventSender::hasPendingEvents):
34
        (WebCore::EventSender<T>::dispatchEventSoon):
35
        (WebCore::EventSender<T>::cancelEvent):
36
        (WebCore::EventSender<T>::dispatchPendingEvents):
37
        (WebCore::EventSender<T>::EventSender): Deleted. The type argument was not necessary.
38
        * dom/SharedEventSenders.cpp: Added. Lazily creates event senders as they are requested.
39
        (WebCore::SharedEventSenders::linkLoadEventSender):
40
        (WebCore::SharedEventSenders::styleLoadEventSender):
41
        (WebCore::SharedEventSenders::imageBeforeloadEventSender):
42
        (WebCore::SharedEventSenders::imageLoadEventSender):
43
        (WebCore::SharedEventSenders::imageErrorEventSender):
44
        * dom/SharedEventSenders.h: Added.
45
        (WebCore::SharedEventSenders::SharedEventSenders):
46
        * html/HTMLLinkElement.cpp:
47
        (WebCore::HTMLLinkElement::~HTMLLinkElement):
48
        (WebCore::HTMLLinkElement::dispatchPendingEvent):
49
        (WebCore::HTMLLinkElement::notifyLoadedSheetAndAllCriticalSubresources):
50
        (WebCore::linkLoadEventSender): Deleted.
51
        (WebCore::HTMLLinkElement::dispatchPendingLoadEvents): Deleted.
52
        * html/HTMLLinkElement.h:
53
        * html/HTMLStyleElement.cpp:
54
        (WebCore::HTMLStyleElement::~HTMLStyleElement):
55
        (WebCore::HTMLStyleElement::dispatchPendingEvent):
56
        (WebCore::HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources):
57
        (WebCore::styleLoadEventSender): Deleted.
58
        (WebCore::HTMLStyleElement::dispatchPendingLoadEvents): Deleted.
59
        * html/HTMLStyleElement.h:
60
        * loader/ImageLoader.cpp:
61
        (WebCore::ImageLoader::beforeLoadEventSender):
62
        (WebCore::ImageLoader::loadEventSender):
63
        (WebCore::ImageLoader::errorEventSender):
64
        (WebCore::ImageLoader::dispatchPendingEvent):
65
        (WebCore::beforeLoadEventSender): Deleted.
66
        (WebCore::loadEventSender): Deleted.
67
        (WebCore::errorEventSender): Deleted.
68
        (WebCore::ImageLoader::dispatchPendingBeforeLoadEvents): Deleted.
69
        (WebCore::ImageLoader::dispatchPendingLoadEvents): Deleted.
70
        (WebCore::ImageLoader::dispatchPendingErrorEvents): Deleted.
71
        * loader/ImageLoader.h:
72
        * xml/parser/XMLDocumentParser.cpp:
73
        (WebCore::XMLDocumentParser::append): Remove an early call to the EventSender for image
74
        beforeload events. This was a performance optimization, but is no longer safe since the
75
        document (and thus the event sender) may not be available in a synchronous document write.
76
1
2014-10-01  Zan Dobersek  <zdobersek@igalia.com>
77
2014-10-01  Zan Dobersek  <zdobersek@igalia.com>
2
78
3
        [TexMap] Sprinkle range-based for-loops in GraphicsLayerTextureMapper, TextureMapperLayer
79
        [TexMap] Sprinkle range-based for-loops in GraphicsLayerTextureMapper, TextureMapperLayer
- a/Source/WebCore/CMakeLists.txt +1 lines
Lines 1437-1442 set(WebCore_SOURCES a/Source/WebCore/CMakeLists.txt_sec1
1437
    dom/SecurityContext.cpp
1437
    dom/SecurityContext.cpp
1438
    dom/SelectorQuery.cpp
1438
    dom/SelectorQuery.cpp
1439
    dom/ShadowRoot.cpp
1439
    dom/ShadowRoot.cpp
1440
    dom/SharedEventSenders.cpp
1440
    dom/SpaceSplitString.cpp
1441
    dom/SpaceSplitString.cpp
1441
    dom/StaticNodeList.cpp
1442
    dom/StaticNodeList.cpp
1442
    dom/StringCallback.cpp
1443
    dom/StringCallback.cpp
- a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj +15 lines
Lines 13776-13781 <?xml version="1.0" encoding="utf-8"?> a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj_sec1
13776
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
13776
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
13777
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
13777
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
13778
    </ClCompile>
13778
    </ClCompile>
13779
    <ClCompile Include="..\dom\SharedEventSenders.cpp">
13780
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
13781
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
13782
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
13783
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
13784
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
13785
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
13786
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
13787
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
13788
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
13789
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
13790
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
13791
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
13792
    </ClCompile>
13779
    <ClCompile Include="..\dom\SpaceSplitString.cpp">
13793
    <ClCompile Include="..\dom\SpaceSplitString.cpp">
13780
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
13794
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
13781
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
13795
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
Lines 20579-20584 <?xml version="1.0" encoding="utf-8"?> a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj_sec2
20579
    <ClInclude Include="..\dom\SecurityContext.h" />
20593
    <ClInclude Include="..\dom\SecurityContext.h" />
20580
    <ClInclude Include="..\dom\SelectorQuery.h" />
20594
    <ClInclude Include="..\dom\SelectorQuery.h" />
20581
    <ClInclude Include="..\dom\SimulatedClickOptions.h" />
20595
    <ClInclude Include="..\dom\SimulatedClickOptions.h" />
20596
    <ClInclude Include="..\dom\SharedEventSenders.h" />
20582
    <ClInclude Include="..\dom\SpaceSplitString.h" />
20597
    <ClInclude Include="..\dom\SpaceSplitString.h" />
20583
    <ClInclude Include="..\dom\StaticHashSetNodeList.h" />
20598
    <ClInclude Include="..\dom\StaticHashSetNodeList.h" />
20584
    <ClInclude Include="..\dom\StaticNodeList.h" />
20599
    <ClInclude Include="..\dom\StaticNodeList.h" />
- a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters +6 lines
Lines 3354-3359 <?xml version="1.0" encoding="utf-8"?> a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters_sec1
3354
    <ClCompile Include="..\dom\SelectorQuery.cpp">
3354
    <ClCompile Include="..\dom\SelectorQuery.cpp">
3355
      <Filter>dom</Filter>
3355
      <Filter>dom</Filter>
3356
    </ClCompile>
3356
    </ClCompile>
3357
    <ClCompile Include="..\dom\SharedEventSenders.cpp">
3358
      <Filter>dom</Filter>
3359
    </ClCompile>
3357
    <ClCompile Include="..\dom\SpaceSplitString.cpp">
3360
    <ClCompile Include="..\dom\SpaceSplitString.cpp">
3358
      <Filter>dom</Filter>
3361
      <Filter>dom</Filter>
3359
    </ClCompile>
3362
    </ClCompile>
Lines 10446-10451 <?xml version="1.0" encoding="utf-8"?> a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters_sec2
10446
    <ClInclude Include="..\dom\SelectorQuery.h">
10449
    <ClInclude Include="..\dom\SelectorQuery.h">
10447
      <Filter>dom</Filter>
10450
      <Filter>dom</Filter>
10448
    </ClInclude>
10451
    </ClInclude>
10452
    <ClInclude Include="..\dom\SharedEventSenders.h">
10453
      <Filter>dom</Filter>
10454
    </ClInclude>
10449
    <ClInclude Include="..\dom\SimulatedClickOptions.h">
10455
    <ClInclude Include="..\dom\SimulatedClickOptions.h">
10450
      <Filter>dom</Filter>
10456
      <Filter>dom</Filter>
10451
    </ClInclude>
10457
    </ClInclude>
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +10 lines
Lines 5512-5517 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
5512
		C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */; };
5512
		C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */; };
5513
		C3CF17A715B0063F00276D39 /* IdTargetObserverRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
5513
		C3CF17A715B0063F00276D39 /* IdTargetObserverRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
5514
		C400D10918F1C8F60090D863 /* EventLoopInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C400D10818F1C8F60090D863 /* EventLoopInput.cpp */; };
5514
		C400D10918F1C8F60090D863 /* EventLoopInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C400D10818F1C8F60090D863 /* EventLoopInput.cpp */; };
5515
		C49474A119A2847C009B3DE8 /* SharedEventSenders.h in Headers */ = {isa = PBXBuildFile; fileRef = C49474A019A2847C009B3DE8 /* SharedEventSenders.h */; };
5516
		C49474A819A2D612009B3DE8 /* EventSender.h in Headers */ = {isa = PBXBuildFile; fileRef = CE5CB1B314EDAB6F00BB2795 /* EventSender.h */; };
5517
		C49474AA19A2E2E5009B3DE8 /* SharedEventSenders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C49474A919A2E2E5009B3DE8 /* SharedEventSenders.cpp */; };
5515
		C4CD629A18383766007EBAF1 /* FrameSnapshotting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */; };
5518
		C4CD629A18383766007EBAF1 /* FrameSnapshotting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */; };
5516
		C4CD629B18383766007EBAF1 /* FrameSnapshotting.h in Headers */ = {isa = PBXBuildFile; fileRef = C4CD629918383766007EBAF1 /* FrameSnapshotting.h */; settings = {ATTRIBUTES = (Private, ); }; };
5519
		C4CD629B18383766007EBAF1 /* FrameSnapshotting.h in Headers */ = {isa = PBXBuildFile; fileRef = C4CD629918383766007EBAF1 /* FrameSnapshotting.h */; settings = {ATTRIBUTES = (Private, ); }; };
5517
		C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50B561412119D23008B46E0 /* GroupSettings.cpp */; };
5520
		C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50B561412119D23008B46E0 /* GroupSettings.cpp */; };
Lines 12925-12930 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
12925
		C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserverRegistry.h; sourceTree = "<group>"; };
12928
		C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserverRegistry.h; sourceTree = "<group>"; };
12926
		C3E61C653A64807A83E76FB8 /* MathMLMencloseElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLMencloseElement.cpp; sourceTree = "<group>"; };
12929
		C3E61C653A64807A83E76FB8 /* MathMLMencloseElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLMencloseElement.cpp; sourceTree = "<group>"; };
12927
		C400D10818F1C8F60090D863 /* EventLoopInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventLoopInput.cpp; sourceTree = "<group>"; };
12930
		C400D10818F1C8F60090D863 /* EventLoopInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventLoopInput.cpp; sourceTree = "<group>"; };
12931
		C49474A019A2847C009B3DE8 /* SharedEventSenders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedEventSenders.h; sourceTree = "<group>"; };
12932
		C49474A919A2E2E5009B3DE8 /* SharedEventSenders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedEventSenders.cpp; sourceTree = "<group>"; };
12928
		C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameSnapshotting.cpp; sourceTree = "<group>"; };
12933
		C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameSnapshotting.cpp; sourceTree = "<group>"; };
12929
		C4CD629918383766007EBAF1 /* FrameSnapshotting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameSnapshotting.h; sourceTree = "<group>"; };
12934
		C4CD629918383766007EBAF1 /* FrameSnapshotting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameSnapshotting.h; sourceTree = "<group>"; };
12930
		C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = "<group>"; };
12935
		C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = "<group>"; };
Lines 22769-22774 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
22769
				E45322AA140CE267005A0F92 /* SelectorQuery.h */,
22774
				E45322AA140CE267005A0F92 /* SelectorQuery.h */,
22770
				A6D169611346B49B000EB770 /* ShadowRoot.cpp */,
22775
				A6D169611346B49B000EB770 /* ShadowRoot.cpp */,
22771
				A6D169631346B4C1000EB770 /* ShadowRoot.h */,
22776
				A6D169631346B4C1000EB770 /* ShadowRoot.h */,
22777
				C49474A919A2E2E5009B3DE8 /* SharedEventSenders.cpp */,
22778
				C49474A019A2847C009B3DE8 /* SharedEventSenders.h */,
22772
				31741AAB16635E45008A5B7E /* SimulatedClickOptions.h */,
22779
				31741AAB16635E45008A5B7E /* SimulatedClickOptions.h */,
22773
				D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */,
22780
				D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */,
22774
				D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */,
22781
				D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */,
Lines 23362-23367 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
23362
				070363E0181A1CDC00C074A5 /* AVAudioCaptureSource.h in Headers */,
23369
				070363E0181A1CDC00C074A5 /* AVAudioCaptureSource.h in Headers */,
23363
				070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */,
23370
				070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */,
23364
				070363E4181A1CDC00C074A5 /* AVMediaCaptureSource.h in Headers */,
23371
				070363E4181A1CDC00C074A5 /* AVMediaCaptureSource.h in Headers */,
23372
				C49474A819A2D612009B3DE8 /* EventSender.h in Headers */,
23365
				CD336F6217F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h in Headers */,
23373
				CD336F6217F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h in Headers */,
23366
				070363E6181A1CDC00C074A5 /* AVVideoCaptureSource.h in Headers */,
23374
				070363E6181A1CDC00C074A5 /* AVVideoCaptureSource.h in Headers */,
23367
				29A812380FBB9C1D00510293 /* AXObjectCache.h in Headers */,
23375
				29A812380FBB9C1D00510293 /* AXObjectCache.h in Headers */,
Lines 26399-26404 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
26399
				85031B4F0A44EFC700F992E0 /* UIEventWithKeyState.h in Headers */,
26407
				85031B4F0A44EFC700F992E0 /* UIEventWithKeyState.h in Headers */,
26400
				AA4739D21757AFEC00E76767 /* UIRequestEvent.h in Headers */,
26408
				AA4739D21757AFEC00E76767 /* UIRequestEvent.h in Headers */,
26401
				9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */,
26409
				9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */,
26410
				C49474A119A2847C009B3DE8 /* SharedEventSenders.h in Headers */,
26402
				A863E2011343412000274926 /* UnicodeBidi.h in Headers */,
26411
				A863E2011343412000274926 /* UnicodeBidi.h in Headers */,
26403
				E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */,
26412
				E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */,
26404
				D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */,
26413
				D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */,
Lines 28064-28069 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
28064
				8931DE5B14C44C44000DC9D2 /* JSBlobCustom.cpp in Sources */,
28073
				8931DE5B14C44C44000DC9D2 /* JSBlobCustom.cpp in Sources */,
28065
				1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */,
28074
				1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */,
28066
				65DF323909D1DE65000BE325 /* JSCanvasGradient.cpp in Sources */,
28075
				65DF323909D1DE65000BE325 /* JSCanvasGradient.cpp in Sources */,
28076
				C49474AA19A2E2E5009B3DE8 /* SharedEventSenders.cpp in Sources */,
28067
				65DF323B09D1DE65000BE325 /* JSCanvasPattern.cpp in Sources */,
28077
				65DF323B09D1DE65000BE325 /* JSCanvasPattern.cpp in Sources */,
28068
				49EED1421051969400099FAB /* JSCanvasRenderingContext.cpp in Sources */,
28078
				49EED1421051969400099FAB /* JSCanvasRenderingContext.cpp in Sources */,
28069
				49EED1441051969400099FAB /* JSCanvasRenderingContext2D.cpp in Sources */,
28079
				49EED1441051969400099FAB /* JSCanvasRenderingContext2D.cpp in Sources */,
- a/Source/WebCore/dom/DOMAllInOne.cpp +1 lines
Lines 124-129 a/Source/WebCore/dom/DOMAllInOne.cpp_sec1
124
#include "SecurityContext.cpp"
124
#include "SecurityContext.cpp"
125
#include "SelectorQuery.cpp"
125
#include "SelectorQuery.cpp"
126
#include "ShadowRoot.cpp"
126
#include "ShadowRoot.cpp"
127
#include "SharedEventSenders.cpp"
127
#include "SpaceSplitString.cpp"
128
#include "SpaceSplitString.cpp"
128
#include "StaticNodeList.cpp"
129
#include "StaticNodeList.cpp"
129
#include "StyledElement.cpp"
130
#include "StyledElement.cpp"
- a/Source/WebCore/dom/Document.cpp -19 / +19 lines
Lines 138-143 a/Source/WebCore/dom/Document.cpp_sec1
138
#include "SelectorQuery.h"
138
#include "SelectorQuery.h"
139
#include "Settings.h"
139
#include "Settings.h"
140
#include "ShadowRoot.h"
140
#include "ShadowRoot.h"
141
#include "SharedEventSenders.h"
141
#include "StyleProperties.h"
142
#include "StyleProperties.h"
142
#include "StyleResolver.h"
143
#include "StyleResolver.h"
143
#include "StyleSheetContents.h"
144
#include "StyleSheetContents.h"
Lines 471-476 Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig a/Source/WebCore/dom/Document.cpp_sec2
471
    , m_sawElementsInKnownNamespaces(false)
472
    , m_sawElementsInKnownNamespaces(false)
472
    , m_isSrcdocDocument(false)
473
    , m_isSrcdocDocument(false)
473
    , m_eventQueue(*this)
474
    , m_eventQueue(*this)
475
    , m_sharedEventSenders(std::make_unique<SharedEventSenders>())
474
    , m_weakFactory(this)
476
    , m_weakFactory(this)
475
#if ENABLE(FULLSCREEN_API)
477
#if ENABLE(FULLSCREEN_API)
476
    , m_areKeysEnabledInFullScreen(0)
478
    , m_areKeysEnabledInFullScreen(0)
Lines 2421-2441 void Document::implicitClose() a/Source/WebCore/dom/Document.cpp_sec3
2421
    //  -When any new HTMLLinkElement is inserted into the document
2423
    //  -When any new HTMLLinkElement is inserted into the document
2422
    // But those add a dynamic component to the favicon that has UI 
2424
    // But those add a dynamic component to the favicon that has UI 
2423
    // ramifications, and we need to decide what is the Right Thing To Do(tm)
2425
    // ramifications, and we need to decide what is the Right Thing To Do(tm)
2424
    Frame* f = frame();
2426
    Frame* frame = this->frame();
2425
    if (f) {
2427
    if (frame) {
2426
        f->loader().icon().startLoader();
2428
        frame->loader().icon().startLoader();
2427
        f->animation().startAnimationsIfNotSuspended(this);
2429
        frame->animation().startAnimationsIfNotSuspended(this);
2428
2429
        // FIXME: We shouldn't be dispatching pending events globally on all Documents here.
2430
        // For now, only do this when there is a Frame, otherwise this could cause JS reentrancy
2431
        // below SVG font parsing, for example. <https://webkit.org/b/136269>
2432
        ImageLoader::dispatchPendingBeforeLoadEvents();
2433
        ImageLoader::dispatchPendingLoadEvents();
2434
        ImageLoader::dispatchPendingErrorEvents();
2435
        HTMLLinkElement::dispatchPendingLoadEvents();
2436
        HTMLStyleElement::dispatchPendingLoadEvents();
2437
    }
2430
    }
2438
2431
2432
    sharedEventSenders().imageBeforeloadEventSender().dispatchPendingEvents();
2433
    sharedEventSenders().imageLoadEventSender().dispatchPendingEvents();
2434
    sharedEventSenders().imageErrorEventSender().dispatchPendingEvents();
2435
2436
    sharedEventSenders().linkLoadEventSender().dispatchPendingEvents();
2437
    sharedEventSenders().styleLoadEventSender().dispatchPendingEvents();
2438
2439
    // To align the HTML load event and the SVGLoad event for the outermost <svg> element, fire it from
2439
    // To align the HTML load event and the SVGLoad event for the outermost <svg> element, fire it from
2440
    // here, instead of doing it from SVGElement::finishedParsingChildren (if externalResourcesRequired="false",
2440
    // here, instead of doing it from SVGElement::finishedParsingChildren (if externalResourcesRequired="false",
2441
    // which is the default, for ='true' its fired at a later time, once all external resources finished loading).
2441
    // which is the default, for ='true' its fired at a later time, once all external resources finished loading).
Lines 2446-2460 void Document::implicitClose() a/Source/WebCore/dom/Document.cpp_sec4
2446
    enqueuePageshowEvent(PageshowEventNotPersisted);
2446
    enqueuePageshowEvent(PageshowEventNotPersisted);
2447
    enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() : SerializedScriptValue::nullValue());
2447
    enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() : SerializedScriptValue::nullValue());
2448
    
2448
    
2449
    if (f)
2449
    if (frame)
2450
        f->loader().handledOnloadEvents();
2450
        frame->loader().handledOnloadEvents();
2451
#ifdef INSTRUMENT_LAYOUT_SCHEDULING
2451
#ifdef INSTRUMENT_LAYOUT_SCHEDULING
2452
    if (!ownerElement())
2452
    if (!ownerElement())
2453
        printf("onload fired at %lld\n", elapsedTime().count());
2453
        printf("onload fired at %lld\n", elapsedTime().count());
2454
#endif
2454
#endif
2455
2455
2456
    // An event handler may have removed the frame
2456
    // An event handler may have removed the frame
2457
    if (!frame()) {
2457
    if (!this->frame()) {
2458
        m_processingLoadEvent = false;
2458
        m_processingLoadEvent = false;
2459
        return;
2459
        return;
2460
    }
2460
    }
Lines 2463-2469 void Document::implicitClose() a/Source/WebCore/dom/Document.cpp_sec5
2463
    // fires. This will improve onload scores, and other browsers do it.
2463
    // fires. This will improve onload scores, and other browsers do it.
2464
    // If they wanna cheat, we can too. -dwh
2464
    // If they wanna cheat, we can too. -dwh
2465
2465
2466
    if (frame()->navigationScheduler().locationChangePending() && elapsedTime() < settings()->layoutInterval()) {
2466
    if (this->frame()->navigationScheduler().locationChangePending() && elapsedTime() < settings()->layoutInterval()) {
2467
        // Just bail out. Before or during the onload we were shifted to another page.
2467
        // Just bail out. Before or during the onload we were shifted to another page.
2468
        // The old i-Bench suite does this. When this happens don't bother painting or laying out.        
2468
        // The old i-Bench suite does this. When this happens don't bother painting or laying out.        
2469
        m_processingLoadEvent = false;
2469
        m_processingLoadEvent = false;
Lines 2471-2477 void Document::implicitClose() a/Source/WebCore/dom/Document.cpp_sec6
2471
        return;
2471
        return;
2472
    }
2472
    }
2473
2473
2474
    frame()->loader().checkCallImplicitClose();
2474
    this->frame()->loader().checkCallImplicitClose();
2475
    
2475
    
2476
    // We used to force a synchronous display and flush here.  This really isn't
2476
    // We used to force a synchronous display and flush here.  This really isn't
2477
    // necessary and can in fact be actively harmful if pages are loading at a rate of > 60fps
2477
    // necessary and can in fact be actively harmful if pages are loading at a rate of > 60fps
Lines 2488-2494 void Document::implicitClose() a/Source/WebCore/dom/Document.cpp_sec7
2488
    m_processingLoadEvent = false;
2488
    m_processingLoadEvent = false;
2489
2489
2490
#if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(EFL)
2490
#if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(EFL)
2491
    if (f && hasLivingRenderTree() && AXObjectCache::accessibilityEnabled()) {
2491
    if (frame && hasLivingRenderTree() && AXObjectCache::accessibilityEnabled()) {
2492
        // The AX cache may have been cleared at this point, but we need to make sure it contains an
2492
        // The AX cache may have been cleared at this point, but we need to make sure it contains an
2493
        // AX object to send the notification to. getOrCreate will make sure that an valid AX object
2493
        // AX object to send the notification to. getOrCreate will make sure that an valid AX object
2494
        // exists in the cache (we ignore the return value because we don't need it here). This is 
2494
        // exists in the cache (we ignore the return value because we don't need it here). This is 
- a/Source/WebCore/dom/Document.h +5 lines
Lines 144-149 class SelectorQueryCache; a/Source/WebCore/dom/Document.h_sec1
144
class SerializedScriptValue;
144
class SerializedScriptValue;
145
class SegmentedString;
145
class SegmentedString;
146
class Settings;
146
class Settings;
147
class SharedEventSenders;
147
class StyleResolver;
148
class StyleResolver;
148
class StyleSheet;
149
class StyleSheet;
149
class StyleSheetContents;
150
class StyleSheetContents;
Lines 1119-1124 public: a/Source/WebCore/dom/Document.h_sec2
1119
    void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject);
1120
    void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject);
1120
    virtual DocumentEventQueue& eventQueue() const override { return m_eventQueue; }
1121
    virtual DocumentEventQueue& eventQueue() const override { return m_eventQueue; }
1121
1122
1123
    SharedEventSenders& sharedEventSenders() const { return *m_sharedEventSenders; }
1124
1122
    WEBCORE_EXPORT void addMediaCanStartListener(MediaCanStartListener*);
1125
    WEBCORE_EXPORT void addMediaCanStartListener(MediaCanStartListener*);
1123
    WEBCORE_EXPORT void removeMediaCanStartListener(MediaCanStartListener*);
1126
    WEBCORE_EXPORT void removeMediaCanStartListener(MediaCanStartListener*);
1124
    MediaCanStartListener* takeAnyMediaCanStartListener();
1127
    MediaCanStartListener* takeAnyMediaCanStartListener();
Lines 1568-1573 private: a/Source/WebCore/dom/Document.h_sec3
1568
    RenderPtr<RenderView> m_renderView;
1571
    RenderPtr<RenderView> m_renderView;
1569
    mutable DocumentEventQueue m_eventQueue;
1572
    mutable DocumentEventQueue m_eventQueue;
1570
1573
1574
    const std::unique_ptr<SharedEventSenders> m_sharedEventSenders;
1575
1571
    WeakPtrFactory<Document> m_weakFactory;
1576
    WeakPtrFactory<Document> m_weakFactory;
1572
1577
1573
    HashSet<MediaCanStartListener*> m_mediaCanStartListeners;
1578
    HashSet<MediaCanStartListener*> m_mediaCanStartListeners;
- a/Source/WebCore/dom/EventSender.h -21 / +22 lines
Lines 1-5 a/Source/WebCore/dom/EventSender.h_sec1
1
/*
1
/*
2
 * Copyright (C) 2012 Apple Inc. All rights reserved.
2
 * Copyright (C) 2012 Apple Inc. All rights reserved.
3
 * Copyright (C) 2014 University of Washington. All rights reserved.
3
 *
4
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
Lines 31-40 a/Source/WebCore/dom/EventSender.h_sec2
31
32
32
namespace WebCore {
33
namespace WebCore {
33
34
34
template<typename T> class EventSender {
35
template <typename T>
36
class EventSender {
35
    WTF_MAKE_NONCOPYABLE(EventSender); WTF_MAKE_FAST_ALLOCATED;
37
    WTF_MAKE_NONCOPYABLE(EventSender); WTF_MAKE_FAST_ALLOCATED;
36
public:
38
public:
37
    explicit EventSender(const AtomicString& eventType);
39
    EventSender(const AtomicString& eventType)
40
        : m_eventType(eventType)
41
        , m_timer(this, &EventSender::timerFired)
42
    {
43
    }
38
44
39
    const AtomicString& eventType() const { return m_eventType; }
45
    const AtomicString& eventType() const { return m_eventType; }
40
    void dispatchEventSoon(T&);
46
    void dispatchEventSoon(T&);
Lines 42-50 public: a/Source/WebCore/dom/EventSender.h_sec3
42
    void dispatchPendingEvents();
48
    void dispatchPendingEvents();
43
49
44
#ifndef NDEBUG
50
#ifndef NDEBUG
45
    bool hasPendingEvents(T& sender) const
51
    bool hasPendingEvents(T& client) const
46
    {
52
    {
47
        return m_dispatchSoonList.find(&sender) != notFound || m_dispatchingList.find(&sender) != notFound;
53
        return m_dispatchSoonList.find(&client) != notFound || m_dispatchingList.find(&client) != notFound;
48
    }
54
    }
49
#endif
55
#endif
50
56
Lines 57-90 private: a/Source/WebCore/dom/EventSender.h_sec4
57
    Vector<T*> m_dispatchingList;
63
    Vector<T*> m_dispatchingList;
58
};
64
};
59
65
60
template<typename T> EventSender<T>::EventSender(const AtomicString& eventType)
66
template <typename T>
61
    : m_eventType(eventType)
67
void EventSender<T>::dispatchEventSoon(T& client)
62
    , m_timer(this, &EventSender::timerFired)
63
{
64
}
65
66
template<typename T> void EventSender<T>::dispatchEventSoon(T& sender)
67
{
68
{
68
    m_dispatchSoonList.append(&sender);
69
    m_dispatchSoonList.append(&client);
69
    if (!m_timer.isActive())
70
    if (!m_timer.isActive())
70
        m_timer.startOneShot(0);
71
        m_timer.startOneShot(0);
71
}
72
}
72
73
73
template<typename T> void EventSender<T>::cancelEvent(T& sender)
74
template<typename T>
75
void EventSender<T>::cancelEvent(T& client)
74
{
76
{
75
    // Remove instances of this sender from both lists.
77
    // Remove instances of this client from both lists.
76
    // Use loops because we allow multiple instances to get into the lists.
78
    // Use loops because we allow multiple instances to get into the lists.
77
    for (auto& event : m_dispatchSoonList) {
79
    for (auto& event : m_dispatchSoonList) {
78
        if (event == &sender)
80
        if (event == &client)
79
            event = nullptr;
81
            event = nullptr;
80
    }
82
    }
81
    for (auto& event : m_dispatchingList) {
83
    for (auto& event : m_dispatchingList) {
82
        if (event == &sender)
84
        if (event == &client)
83
            event = nullptr;
85
            event = nullptr;
84
    }
86
    }
85
}
87
}
86
88
87
template<typename T> void EventSender<T>::dispatchPendingEvents()
89
template<typename T>
90
void EventSender<T>::dispatchPendingEvents()
88
{
91
{
89
    // Need to avoid re-entering this function; if new dispatches are
92
    // Need to avoid re-entering this function; if new dispatches are
90
    // scheduled before the parent finishes processing the list, they
93
    // scheduled before the parent finishes processing the list, they
Lines 94-106 template<typename T> void EventSender<T>::dispatchPendingEvents() a/Source/WebCore/dom/EventSender.h_sec5
94
97
95
    m_timer.stop();
98
    m_timer.stop();
96
99
97
    m_dispatchSoonList.checkConsistency();
98
99
    m_dispatchingList.swap(m_dispatchSoonList);
100
    m_dispatchingList.swap(m_dispatchSoonList);
100
    for (auto& event : m_dispatchingList) {
101
    for (auto& event : m_dispatchingList) {
101
        if (T* sender = event) {
102
        if (T* client = event) {
102
            event = nullptr;
103
            event = nullptr;
103
            sender->dispatchPendingEvent(this);
104
            client->dispatchPendingEvent(*this);
104
        }
105
        }
105
    }
106
    }
106
    m_dispatchingList.clear();
107
    m_dispatchingList.clear();
- a/Source/WebCore/dom/SharedEventSenders.cpp +75 lines
Line 0 a/Source/WebCore/dom/SharedEventSenders.cpp_sec1
1
/*
2
 * Copyright (C) 2014 University of Washington. 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 INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "SharedEventSenders.h"
28
29
#include "HTMLLinkElement.h"
30
#include "HTMLStyleElement.h"
31
#include "ImageLoader.h"
32
33
namespace WebCore {
34
35
EventSender<HTMLLinkElement>& SharedEventSenders::linkLoadEventSender()
36
{
37
    if (!m_linkLoadEventSender)
38
        m_linkLoadEventSender = std::make_unique<EventSender<HTMLLinkElement>>(eventNames().loadEvent);
39
40
    return *m_linkLoadEventSender;
41
}
42
43
EventSender<HTMLStyleElement>& SharedEventSenders::styleLoadEventSender()
44
{
45
    if (!m_styleLoadEventSender)
46
        m_styleLoadEventSender = std::make_unique<EventSender<HTMLStyleElement>>(eventNames().loadEvent);
47
48
    return *m_styleLoadEventSender;
49
}
50
51
EventSender<ImageLoader>& SharedEventSenders::imageBeforeloadEventSender()
52
{
53
    if (!m_imageBeforeloadEventSender)
54
        m_imageBeforeloadEventSender = std::make_unique<EventSender<ImageLoader>>(eventNames().beforeloadEvent);
55
56
    return *m_imageBeforeloadEventSender;
57
}
58
59
EventSender<ImageLoader>& SharedEventSenders::imageLoadEventSender()
60
{
61
    if (!m_imageLoadEventSender)
62
        m_imageLoadEventSender = std::make_unique<EventSender<ImageLoader>>(eventNames().loadEvent);
63
64
    return *m_imageLoadEventSender;
65
}
66
67
EventSender<ImageLoader>& SharedEventSenders::imageErrorEventSender()
68
{
69
    if (!m_imageErrorEventSender)
70
        m_imageErrorEventSender = std::make_unique<EventSender<ImageLoader>>(eventNames().errorEvent);
71
72
    return *m_imageErrorEventSender;
73
}
74
75
} // namespace WebCore
- a/Source/WebCore/dom/SharedEventSenders.h +58 lines
Line 0 a/Source/WebCore/dom/SharedEventSenders.h_sec1
1
/*
2
 * Copyright (C) 2014 University of Washington. 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 INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef SharedEventSenders_h
27
#define SharedEventSenders_h
28
29
#include "EventNames.h"
30
#include "EventSender.h"
31
32
namespace WebCore {
33
34
class HTMLLinkElement;
35
class HTMLStyleElement;
36
class ImageLoader;
37
38
class SharedEventSenders {
39
    WTF_MAKE_NONCOPYABLE(SharedEventSenders); WTF_MAKE_FAST_ALLOCATED;
40
public:
41
    explicit SharedEventSenders() { }
42
43
    EventSender<HTMLLinkElement>& linkLoadEventSender();
44
    EventSender<HTMLStyleElement>& styleLoadEventSender();
45
    EventSender<ImageLoader>& imageBeforeloadEventSender();
46
    EventSender<ImageLoader>& imageLoadEventSender();
47
    EventSender<ImageLoader>& imageErrorEventSender();
48
private:
49
    std::unique_ptr<EventSender<HTMLLinkElement>> m_linkLoadEventSender;
50
    std::unique_ptr<EventSender<HTMLStyleElement>> m_styleLoadEventSender;
51
    std::unique_ptr<EventSender<ImageLoader>> m_imageBeforeloadEventSender;
52
    std::unique_ptr<EventSender<ImageLoader>> m_imageLoadEventSender;
53
    std::unique_ptr<EventSender<ImageLoader>> m_imageErrorEventSender;
54
};
55
56
} // namespace WebCore
57
58
#endif // SharedEventSenders_h
- a/Source/WebCore/html/HTMLLinkElement.cpp -15 / +5 lines
Lines 33-39 a/Source/WebCore/html/HTMLLinkElement.cpp_sec1
33
#include "Document.h"
33
#include "Document.h"
34
#include "DocumentStyleSheetCollection.h"
34
#include "DocumentStyleSheetCollection.h"
35
#include "Event.h"
35
#include "Event.h"
36
#include "EventSender.h"
37
#include "Frame.h"
36
#include "Frame.h"
38
#include "FrameLoader.h"
37
#include "FrameLoader.h"
39
#include "FrameLoaderClient.h"
38
#include "FrameLoaderClient.h"
Lines 47-52 a/Source/WebCore/html/HTMLLinkElement.cpp_sec2
47
#include "RenderStyle.h"
46
#include "RenderStyle.h"
48
#include "SecurityOrigin.h"
47
#include "SecurityOrigin.h"
49
#include "Settings.h"
48
#include "Settings.h"
49
#include "SharedEventSenders.h"
50
#include "StyleInheritedData.h"
50
#include "StyleInheritedData.h"
51
#include "StyleResolveForDocument.h"
51
#include "StyleResolveForDocument.h"
52
#include "StyleSheetContents.h"
52
#include "StyleSheetContents.h"
Lines 57-68 namespace WebCore { a/Source/WebCore/html/HTMLLinkElement.cpp_sec3
57
57
58
using namespace HTMLNames;
58
using namespace HTMLNames;
59
59
60
static LinkEventSender& linkLoadEventSender()
61
{
62
    DEPRECATED_DEFINE_STATIC_LOCAL(LinkEventSender, sharedLoadEventSender, (eventNames().loadEvent));
63
    return sharedLoadEventSender;
64
}
65
66
inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document& document, bool createdByParser)
60
inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document& document, bool createdByParser)
67
    : HTMLElement(tagName, document)
61
    : HTMLElement(tagName, document)
68
    , m_linkLoader(this)
62
    , m_linkLoader(this)
Lines 94-100 HTMLLinkElement::~HTMLLinkElement() a/Source/WebCore/html/HTMLLinkElement.cpp_sec4
94
    if (inDocument())
88
    if (inDocument())
95
        document().styleSheetCollection().removeStyleSheetCandidateNode(*this);
89
        document().styleSheetCollection().removeStyleSheetCandidateNode(*this);
96
90
97
    linkLoadEventSender().cancelEvent(*this);
91
    document().sharedEventSenders().linkLoadEventSender().cancelEvent(*this);
98
}
92
}
99
93
100
void HTMLLinkElement::setDisabledState(bool disabled)
94
void HTMLLinkElement::setDisabledState(bool disabled)
Lines 361-374 bool HTMLLinkElement::sheetLoaded() a/Source/WebCore/html/HTMLLinkElement.cpp_sec5
361
    return false;
355
    return false;
362
}
356
}
363
357
364
void HTMLLinkElement::dispatchPendingLoadEvents()
358
void HTMLLinkElement::dispatchPendingEvent(EventSender<HTMLLinkElement>& eventSender)
365
{
359
{
366
    linkLoadEventSender().dispatchPendingEvents();
360
    ASSERT_UNUSED(eventSender, &eventSender == &document().sharedEventSenders().linkLoadEventSender());
367
}
368
361
369
void HTMLLinkElement::dispatchPendingEvent(LinkEventSender* eventSender)
370
{
371
    ASSERT_UNUSED(eventSender, eventSender == &linkLoadEventSender());
372
    if (m_loadedSheet)
362
    if (m_loadedSheet)
373
        linkLoaded();
363
        linkLoaded();
374
    else
364
    else
Lines 380-386 void HTMLLinkElement::notifyLoadedSheetAndAllCriticalSubresources(bool errorOccu a/Source/WebCore/html/HTMLLinkElement.cpp_sec6
380
    if (m_firedLoad)
370
    if (m_firedLoad)
381
        return;
371
        return;
382
    m_loadedSheet = !errorOccurred;
372
    m_loadedSheet = !errorOccurred;
383
    linkLoadEventSender().dispatchEventSoon(*this);
373
    document().sharedEventSenders().linkLoadEventSender().dispatchEventSoon(*this);
384
    m_firedLoad = true;
374
    m_firedLoad = true;
385
}
375
}
386
376
- a/Source/WebCore/html/HTMLLinkElement.h -3 / +1 lines
Lines 40-46 class HTMLLinkElement; a/Source/WebCore/html/HTMLLinkElement.h_sec1
40
class URL;
40
class URL;
41
41
42
template<typename T> class EventSender;
42
template<typename T> class EventSender;
43
typedef EventSender<HTMLLinkElement> LinkEventSender;
44
43
45
class HTMLLinkElement final : public HTMLElement, public CachedStyleSheetClient, public LinkLoaderClient {
44
class HTMLLinkElement final : public HTMLElement, public CachedStyleSheetClient, public LinkLoaderClient {
46
public:
45
public:
Lines 68-75 public: a/Source/WebCore/html/HTMLLinkElement.h_sec2
68
    void setSizes(const String&);
67
    void setSizes(const String&);
69
    DOMSettableTokenList* sizes() const;
68
    DOMSettableTokenList* sizes() const;
70
69
71
    void dispatchPendingEvent(LinkEventSender*);
70
    void dispatchPendingEvent(EventSender<HTMLLinkElement>&);
72
    static void dispatchPendingLoadEvents();
73
71
74
private:
72
private:
75
    virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
73
    virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
- a/Source/WebCore/html/HTMLStyleElement.cpp -14 / +5 lines
Lines 27-49 a/Source/WebCore/html/HTMLStyleElement.cpp_sec1
27
#include "Attribute.h"
27
#include "Attribute.h"
28
#include "Document.h"
28
#include "Document.h"
29
#include "Event.h"
29
#include "Event.h"
30
#include "EventSender.h"
31
#include "HTMLNames.h"
30
#include "HTMLNames.h"
32
#include "MediaList.h"
31
#include "MediaList.h"
33
#include "RuntimeEnabledFeatures.h"
32
#include "RuntimeEnabledFeatures.h"
34
#include "ScriptableDocumentParser.h"
33
#include "ScriptableDocumentParser.h"
35
#include "ShadowRoot.h"
34
#include "ShadowRoot.h"
35
#include "SharedEventSenders.h"
36
#include "StyleSheetContents.h"
36
#include "StyleSheetContents.h"
37
37
38
namespace WebCore {
38
namespace WebCore {
39
39
40
using namespace HTMLNames;
40
using namespace HTMLNames;
41
41
42
static StyleEventSender& styleLoadEventSender()
43
{
44
    DEPRECATED_DEFINE_STATIC_LOCAL(StyleEventSender, sharedLoadEventSender, (eventNames().loadEvent));
45
    return sharedLoadEventSender;
46
}
47
42
48
inline HTMLStyleElement::HTMLStyleElement(const QualifiedName& tagName, Document& document, bool createdByParser)
43
inline HTMLStyleElement::HTMLStyleElement(const QualifiedName& tagName, Document& document, bool createdByParser)
49
    : HTMLElement(tagName, document)
44
    : HTMLElement(tagName, document)
Lines 60-66 HTMLStyleElement::~HTMLStyleElement() a/Source/WebCore/html/HTMLStyleElement.cpp_sec2
60
    // Therefore we can't ASSERT(m_scopedStyleRegistrationState == NotRegistered).
55
    // Therefore we can't ASSERT(m_scopedStyleRegistrationState == NotRegistered).
61
    m_styleSheetOwner.clearDocumentData(document(), *this);
56
    m_styleSheetOwner.clearDocumentData(document(), *this);
62
57
63
    styleLoadEventSender().cancelEvent(*this);
58
    document().sharedEventSenders().styleLoadEventSender().cancelEvent(*this);
64
}
59
}
65
60
66
PassRefPtr<HTMLStyleElement> HTMLStyleElement::create(const QualifiedName& tagName, Document& document, bool createdByParser)
61
PassRefPtr<HTMLStyleElement> HTMLStyleElement::create(const QualifiedName& tagName, Document& document, bool createdByParser)
Lines 114-127 void HTMLStyleElement::childrenChanged(const ChildChange& change) a/Source/WebCore/html/HTMLStyleElement.cpp_sec3
114
    m_styleSheetOwner.childrenChanged(*this);
109
    m_styleSheetOwner.childrenChanged(*this);
115
}
110
}
116
111
117
void HTMLStyleElement::dispatchPendingLoadEvents()
112
void HTMLStyleElement::dispatchPendingEvent(EventSender<HTMLStyleElement>& eventSender)
118
{
113
{
119
    styleLoadEventSender().dispatchPendingEvents();
114
    ASSERT_UNUSED(eventSender, &eventSender == &document().sharedEventSenders().styleLoadEventSender());
120
}
121
115
122
void HTMLStyleElement::dispatchPendingEvent(StyleEventSender* eventSender)
123
{
124
    ASSERT_UNUSED(eventSender, eventSender == &styleLoadEventSender());
125
    if (m_loadedSheet)
116
    if (m_loadedSheet)
126
        dispatchEvent(Event::create(eventNames().loadEvent, false, false));
117
        dispatchEvent(Event::create(eventNames().loadEvent, false, false));
127
    else
118
    else
Lines 133-139 void HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources(bool errorOcc a/Source/WebCore/html/HTMLStyleElement.cpp_sec4
133
    if (m_firedLoad)
124
    if (m_firedLoad)
134
        return;
125
        return;
135
    m_loadedSheet = !errorOccurred;
126
    m_loadedSheet = !errorOccurred;
136
    styleLoadEventSender().dispatchEventSoon(*this);
127
    document().sharedEventSenders().styleLoadEventSender().dispatchEventSoon(*this);
137
    m_firedLoad = true;
128
    m_firedLoad = true;
138
}
129
}
139
130
- a/Source/WebCore/html/HTMLStyleElement.h -3 / +1 lines
Lines 32-38 class HTMLStyleElement; a/Source/WebCore/html/HTMLStyleElement.h_sec1
32
class StyleSheet;
32
class StyleSheet;
33
33
34
template<typename T> class EventSender;
34
template<typename T> class EventSender;
35
typedef EventSender<HTMLStyleElement> StyleEventSender;
36
35
37
class HTMLStyleElement final : public HTMLElement {
36
class HTMLStyleElement final : public HTMLElement {
38
public:
37
public:
Lines 44-51 public: a/Source/WebCore/html/HTMLStyleElement.h_sec2
44
    bool disabled() const;
43
    bool disabled() const;
45
    void setDisabled(bool);
44
    void setDisabled(bool);
46
45
47
    void dispatchPendingEvent(StyleEventSender*);
46
    void dispatchPendingEvent(EventSender<HTMLStyleElement>&);
48
    static void dispatchPendingLoadEvents();
49
47
50
private:
48
private:
51
    HTMLStyleElement(const QualifiedName&, Document&, bool createdByParser);
49
    HTMLStyleElement(const QualifiedName&, Document&, bool createdByParser);
- a/Source/WebCore/loader/ImageLoader.cpp -28 / +10 lines
Lines 29-35 a/Source/WebCore/loader/ImageLoader.cpp_sec1
29
#include "Document.h"
29
#include "Document.h"
30
#include "Element.h"
30
#include "Element.h"
31
#include "Event.h"
31
#include "Event.h"
32
#include "EventSender.h"
33
#include "Frame.h"
32
#include "Frame.h"
34
#include "HTMLNames.h"
33
#include "HTMLNames.h"
35
#include "HTMLObjectElement.h"
34
#include "HTMLObjectElement.h"
Lines 38-43 a/Source/WebCore/loader/ImageLoader.cpp_sec2
38
#include "RenderImage.h"
37
#include "RenderImage.h"
39
#include "RenderSVGImage.h"
38
#include "RenderSVGImage.h"
40
#include "SecurityOrigin.h"
39
#include "SecurityOrigin.h"
40
#include "SharedEventSenders.h"
41
#include <wtf/NeverDestroyed.h>
41
#include <wtf/NeverDestroyed.h>
42
42
43
#if ENABLE(VIDEO)
43
#if ENABLE(VIDEO)
Lines 63-84 template<> struct ValueCheck<WebCore::ImageLoader*> { a/Source/WebCore/loader/ImageLoader.cpp_sec3
63
63
64
namespace WebCore {
64
namespace WebCore {
65
65
66
static ImageEventSender& beforeLoadEventSender()
66
EventSender<ImageLoader>& ImageLoader::beforeLoadEventSender() const
67
{
67
{
68
    static NeverDestroyed<ImageEventSender> sender(eventNames().beforeloadEvent);
68
    return m_element.document().sharedEventSenders().imageBeforeloadEventSender();
69
    return sender;
70
}
69
}
71
70
72
static ImageEventSender& loadEventSender()
71
EventSender<ImageLoader>& ImageLoader::loadEventSender() const
73
{
72
{
74
    static NeverDestroyed<ImageEventSender> sender(eventNames().loadEvent);
73
    return m_element.document().sharedEventSenders().imageLoadEventSender();
75
    return sender;
76
}
74
}
77
75
78
static ImageEventSender& errorEventSender()
76
EventSender<ImageLoader>& ImageLoader::errorEventSender() const
79
{
77
{
80
    static NeverDestroyed<ImageEventSender> sender(eventNames().errorEvent);
78
    return m_element.document().sharedEventSenders().imageErrorEventSender();
81
    return sender;
82
}
79
}
83
80
84
static inline bool pageIsBeingDismissed(Document& document)
81
static inline bool pageIsBeingDismissed(Document& document)
Lines 379-388 void ImageLoader::timerFired(Timer<ImageLoader>&) a/Source/WebCore/loader/ImageLoader.cpp_sec4
379
    element().deref();
376
    element().deref();
380
}
377
}
381
378
382
void ImageLoader::dispatchPendingEvent(ImageEventSender* eventSender)
379
void ImageLoader::dispatchPendingEvent(EventSender<ImageLoader>& eventSender)
383
{
380
{
384
    ASSERT(eventSender == &beforeLoadEventSender() || eventSender == &loadEventSender() || eventSender == &errorEventSender());
381
    ASSERT(&eventSender == &beforeLoadEventSender() || &eventSender == &loadEventSender() || &eventSender == &errorEventSender());
385
    const AtomicString& eventType = eventSender->eventType();
382
    const AtomicString& eventType = eventSender.eventType();
386
    if (eventType == eventNames().beforeloadEvent)
383
    if (eventType == eventNames().beforeloadEvent)
387
        dispatchPendingBeforeLoadEvent();
384
        dispatchPendingBeforeLoadEvent();
388
    if (eventType == eventNames().loadEvent)
385
    if (eventType == eventNames().loadEvent)
Lines 448-468 void ImageLoader::dispatchPendingErrorEvent() a/Source/WebCore/loader/ImageLoader.cpp_sec5
448
    updatedHasPendingEvent();
445
    updatedHasPendingEvent();
449
}
446
}
450
447
451
void ImageLoader::dispatchPendingBeforeLoadEvents()
452
{
453
    beforeLoadEventSender().dispatchPendingEvents();
454
}
455
456
void ImageLoader::dispatchPendingLoadEvents()
457
{
458
    loadEventSender().dispatchPendingEvents();
459
}
460
461
void ImageLoader::dispatchPendingErrorEvents()
462
{
463
    errorEventSender().dispatchPendingEvents();
464
}
465
466
void ImageLoader::elementDidMoveToNewDocument()
448
void ImageLoader::elementDidMoveToNewDocument()
467
{
449
{
468
    clearFailedLoadURL();
450
    clearFailedLoadURL();
- a/Source/WebCore/loader/ImageLoader.h -5 / +4 lines
Lines 35-41 class ImageLoader; a/Source/WebCore/loader/ImageLoader.h_sec1
35
class RenderImageResource;
35
class RenderImageResource;
36
36
37
template<typename T> class EventSender;
37
template<typename T> class EventSender;
38
typedef EventSender<ImageLoader> ImageEventSender;
39
38
40
class ImageLoader : public CachedImageClient {
39
class ImageLoader : public CachedImageClient {
41
    WTF_MAKE_FAST_ALLOCATED;
40
    WTF_MAKE_FAST_ALLOCATED;
Lines 65-75 public: a/Source/WebCore/loader/ImageLoader.h_sec2
65
    bool hasPendingBeforeLoadEvent() const { return m_hasPendingBeforeLoadEvent; }
64
    bool hasPendingBeforeLoadEvent() const { return m_hasPendingBeforeLoadEvent; }
66
    bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent; }
65
    bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent; }
67
66
68
    void dispatchPendingEvent(ImageEventSender*);
67
    void dispatchPendingEvent(EventSender<ImageLoader>&);
69
68
70
    static void dispatchPendingBeforeLoadEvents();
69
    EventSender<ImageLoader>& beforeLoadEventSender() const;
71
    static void dispatchPendingLoadEvents();
70
    EventSender<ImageLoader>& loadEventSender() const;
72
    static void dispatchPendingErrorEvents();
71
    EventSender<ImageLoader>& errorEventSender() const;
73
72
74
protected:
73
protected:
75
    explicit ImageLoader(Element&);
74
    explicit ImageLoader(Element&);
- a/Source/WebCore/xml/parser/XMLDocumentParser.cpp -3 lines
Lines 120-128 void XMLDocumentParser::append(PassRefPtr<StringImpl> inputSource) a/Source/WebCore/xml/parser/XMLDocumentParser.cpp_sec1
120
    }
120
    }
121
121
122
    doWrite(source.toString());
122
    doWrite(source.toString());
123
124
    // After parsing, go ahead and dispatch image beforeload events.
125
    ImageLoader::dispatchPendingBeforeLoadEvents();
126
}
123
}
127
124
128
void XMLDocumentParser::handleError(XMLErrors::ErrorType type, const char* m, TextPosition position)
125
void XMLDocumentParser::handleError(XMLErrors::ErrorType type, const char* m, TextPosition position)

Return to Bug 136051