| Differences between
and this patch
- a/Source/WebCore/ChangeLog +92 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-07-03  Andrei Bucur  <abucur@adobe.com>
2
3
        [CSS Regions] Fix the lifecycle for the flow objects and their renderers
4
        https://bugs.webkit.org/show_bug.cgi?id=89000
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        This patch adds the concept of a NamedFlowCollection, owned by the document, that keeps track of
9
        all the named flows that exist in the Document. This collection contains a ListHashSet of weak references to
10
        all the existing NamedFlows in the document. This is not a managed set because the CREATED flows are referenced from the renderer and
11
        the NULL flows are only cached, they should be destructible.
12
        Two named flows are considered to be equal if they have the same name.
13
        The class will be used to implement the interface NamedFlowCollection from the Regions spec; this is the reason for the length() and item(index) methods.
14
        I've changed the NamedFlow state to depend on the existence of its renderer. A flow thread that has a renderer will also have a NamedFlow object.
15
        A flow thread without a renderer can have a NamedFlow object, but only in the NULL state. It's possible for a NamedFlow object to jump from the
16
        NULL state to the CREATED state if it was not destroyed (e.g. it was referenced from JS). Keeping track of the NULL state flows that have listeners will be important
17
        so when they go back to the CREATED state, the listeners would still be there.
18
19
        Link to spec: http://www.w3.org/TR/2012/WD-css3-regions-20120503/
20
21
        Tests: The old tests have been modified to take into account the new behavior
22
23
        * CMakeLists.txt:
24
        * GNUmakefile.list.am:
25
        * Target.pri:
26
        * WebCore.gypi:
27
        * WebCore.vcproj/WebCore.vcproj:
28
        * WebCore.xcodeproj/project.pbxproj:
29
        * dom/DOMAllInOne.cpp:
30
        * dom/Document.cpp:
31
        (WebCore::Document::~Document):
32
        (WebCore):
33
        (WebCore::Document::webkitGetFlowByName):
34
        (WebCore::Document::namedFlows):
35
        * dom/Document.h:
36
        (WebCore):
37
        (Document):
38
        * dom/WebKitNamedFlow.cpp:
39
        (WebCore::WebKitNamedFlow::WebKitNamedFlow):
40
        (WebCore::WebKitNamedFlow::~WebKitNamedFlow):
41
        (WebCore::WebKitNamedFlow::create):
42
        (WebCore):
43
        (WebCore::WebKitNamedFlow::name):
44
        (WebCore::WebKitNamedFlow::overset):
45
        (WebCore::nodeInFlowThread):
46
        (WebCore::WebKitNamedFlow::getRegionsByContentNode):
47
        (WebCore::WebKitNamedFlow::getContent):
48
        (WebCore::WebKitNamedFlow::setRenderer):
49
        * dom/WebKitNamedFlow.h:
50
        (WebCore):
51
        (WebKitNamedFlow):
52
        (WebCore::WebKitNamedFlow::getFlowState):
53
        (WebCore::WebKitNamedFlow::switchFlowState):
54
        * dom/WebKitNamedFlowCollection.cpp: Added.
55
        (WebCore):
56
        (WebCore::WebKitNamedFlowCollection::WebKitNamedFlowCollection):
57
        (WebCore::WebKitNamedFlowCollection::length): An O(1) operation
58
        (WebCore::WebKitNamedFlowCollection::item): An O(N) operation
59
        (WebCore::WebKitNamedFlowCollection::flowByName): An O(1) operation
60
        (WebCore::WebKitNamedFlowCollection::ensureNamedFlowInCreatedState): An O(1) operation
61
        (WebCore::WebKitNamedFlowCollection::moveNamedFlowToNullState): An O(1) operation
62
        (WebCore::WebKitNamedFlowCollection::discardNamedFlow): An O(1) operation
63
        (WebCore::WebKitNamedFlowCollection::documentDestroyed):
64
        (WebCore::WebKitNamedFlowCollection::NamedFlowHashFunctions::hash):
65
        (WebCore::WebKitNamedFlowCollection::NamedFlowHashFunctions::equal):
66
        (WebKitNamedFlowCollection::NamedFlowHashFunctions):
67
        (WebCore::WebKitNamedFlowCollection::NamedFlowHashTranslator::hash):
68
        (WebCore::WebKitNamedFlowCollection::NamedFlowHashTranslator::equal):
69
        * dom/WebKitNamedFlowCollection.h: Copied from Source/WebCore/dom/WebKitNamedFlow.h.
70
        (WebCore):
71
        (WebKitNamedFlowCollection):
72
        (WebCore::WebKitNamedFlowCollection::create):
73
        (WebCore::WebKitNamedFlowCollection::document):
74
        * rendering/FlowThreadController.cpp:
75
        (WebCore::FlowThreadController::ensureRenderFlowThreadWithName):
76
        (WebCore::FlowThreadController::removeFlowThread):
77
        (WebCore):
78
        * rendering/FlowThreadController.h:
79
        (FlowThreadController):
80
        * rendering/RenderNamedFlowThread.cpp:
81
        (WebCore::RenderNamedFlowThread::RenderNamedFlowThread):
82
        (WebCore):
83
        (WebCore::RenderNamedFlowThread::~RenderNamedFlowThread):
84
        (WebCore::RenderNamedFlowThread::removeRegionFromThread):
85
        (WebCore::RenderNamedFlowThread::unregisterNamedFlowContentNode):
86
        (WebCore::RenderNamedFlowThread::flowThreadName):
87
        (WebCore::RenderNamedFlowThread::willBeDestroyed):
88
        * rendering/RenderNamedFlowThread.h:
89
        (RenderNamedFlowThread):
90
        (WebCore::RenderNamedFlowThread::contentNodes):
91
        (WebCore::RenderNamedFlowThread::canBeDestroyed):
92
1
2012-07-03  Philip Rogers  <pdr@google.com>
93
2012-07-03  Philip Rogers  <pdr@google.com>
2
94
3
        Fix text positioning with non-bmp characters.
95
        Fix text positioning with non-bmp characters.
- a/Source/WebCore/CMakeLists.txt +1 lines
Lines 669-674 SET(WebCore_SOURCES a/Source/WebCore/CMakeLists.txt_sec1
669
    dom/WebKitAnimationEvent.cpp
669
    dom/WebKitAnimationEvent.cpp
670
    dom/WebKitMutationObserver.cpp
670
    dom/WebKitMutationObserver.cpp
671
    dom/WebKitNamedFlow.cpp
671
    dom/WebKitNamedFlow.cpp
672
    dom/WebKitNamedFlowCollection.cpp
672
    dom/WebKitTransitionEvent.cpp
673
    dom/WebKitTransitionEvent.cpp
673
    dom/WheelEvent.cpp
674
    dom/WheelEvent.cpp
674
    dom/WindowEventContext.cpp
675
    dom/WindowEventContext.cpp
- a/Source/WebCore/GNUmakefile.list.am +2 lines
Lines 2062-2067 webcore_sources += \ a/Source/WebCore/GNUmakefile.list.am_sec1
2062
	Source/WebCore/dom/WebKitMutationObserver.h \
2062
	Source/WebCore/dom/WebKitMutationObserver.h \
2063
	Source/WebCore/dom/WebKitNamedFlow.cpp \
2063
	Source/WebCore/dom/WebKitNamedFlow.cpp \
2064
	Source/WebCore/dom/WebKitNamedFlow.h \
2064
	Source/WebCore/dom/WebKitNamedFlow.h \
2065
	Source/WebCore/dom/WebKitNamedFlowCollection.cpp \
2066
	Source/WebCore/dom/WebKitNamedFlowCollection.h \
2065
	Source/WebCore/dom/WebKitTransitionEvent.cpp \
2067
	Source/WebCore/dom/WebKitTransitionEvent.cpp \
2066
	Source/WebCore/dom/WebKitTransitionEvent.h \
2068
	Source/WebCore/dom/WebKitTransitionEvent.h \
2067
	Source/WebCore/dom/WheelEvent.cpp \
2069
	Source/WebCore/dom/WheelEvent.cpp \
- a/Source/WebCore/Target.pri +2 lines
Lines 632-637 SOURCES += \ a/Source/WebCore/Target.pri_sec1
632
    dom/WebKitAnimationEvent.cpp \
632
    dom/WebKitAnimationEvent.cpp \
633
    dom/WebKitMutationObserver.cpp \
633
    dom/WebKitMutationObserver.cpp \
634
    dom/WebKitNamedFlow.cpp \
634
    dom/WebKitNamedFlow.cpp \
635
    dom/WebKitNamedFlowCollection.cpp \
635
    dom/WebKitTransitionEvent.cpp \
636
    dom/WebKitTransitionEvent.cpp \
636
    dom/WheelEvent.cpp \
637
    dom/WheelEvent.cpp \
637
    dom/WindowEventContext.cpp \
638
    dom/WindowEventContext.cpp \
Lines 1810-1815 HEADERS += \ a/Source/WebCore/Target.pri_sec2
1810
    dom/WebKitAnimationEvent.h \
1811
    dom/WebKitAnimationEvent.h \
1811
    dom/WebKitMutationObserver.h \
1812
    dom/WebKitMutationObserver.h \
1812
    dom/WebKitNamedFlow.h \
1813
    dom/WebKitNamedFlow.h \
1814
    dom/WebKitNamedFlowCollection.h \
1813
    dom/WebKitTransitionEvent.h \
1815
    dom/WebKitTransitionEvent.h \
1814
    dom/WheelEvent.h \
1816
    dom/WheelEvent.h \
1815
    editing/AlternativeTextController.h \
1817
    editing/AlternativeTextController.h \
- a/Source/WebCore/WebCore.gypi +2 lines
Lines 5291-5296 a/Source/WebCore/WebCore.gypi_sec1
5291
            'dom/WebKitMutationObserver.h',
5291
            'dom/WebKitMutationObserver.h',
5292
            'dom/WebKitNamedFlow.cpp',
5292
            'dom/WebKitNamedFlow.cpp',
5293
            'dom/WebKitNamedFlow.h',
5293
            'dom/WebKitNamedFlow.h',
5294
            'dom/WebKitNamedFlowCollection.cpp',
5295
            'dom/WebKitNamedFlowCollection.h',
5294
            'dom/WebKitTransitionEvent.cpp',
5296
            'dom/WebKitTransitionEvent.cpp',
5295
            'dom/WebKitTransitionEvent.h',
5297
            'dom/WebKitTransitionEvent.h',
5296
            'dom/WheelEvent.cpp',
5298
            'dom/WheelEvent.cpp',
- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +56 lines
Lines 54466-54471 a/Source/WebCore/WebCore.vcproj/WebCore.vcproj_sec1
54466
				RelativePath="..\dom\WebKitNamedFlow.h"
54466
				RelativePath="..\dom\WebKitNamedFlow.h"
54467
				>
54467
				>
54468
			</File>
54468
			</File>
54469
		    <File
54470
				RelativePath="..\dom\WebKitNamedFlowCollection.cpp"
54471
				>
54472
				<FileConfiguration
54473
					Name="Debug|Win32"
54474
					ExcludedFromBuild="true"
54475
					>
54476
					<Tool
54477
						Name="VCCLCompilerTool"
54478
					/>
54479
				</FileConfiguration>
54480
				<FileConfiguration
54481
					Name="Release|Win32"
54482
					ExcludedFromBuild="true"
54483
					>
54484
					<Tool
54485
						Name="VCCLCompilerTool"
54486
					/>
54487
				</FileConfiguration>
54488
				<FileConfiguration
54489
					Name="Debug_Cairo_CFLite|Win32"
54490
					ExcludedFromBuild="true"
54491
					>
54492
					<Tool
54493
						Name="VCCLCompilerTool"
54494
					/>
54495
				</FileConfiguration>
54496
				<FileConfiguration
54497
					Name="Release_Cairo_CFLite|Win32"
54498
					ExcludedFromBuild="true"
54499
					>
54500
					<Tool
54501
						Name="VCCLCompilerTool"
54502
					/>
54503
				</FileConfiguration>
54504
				<FileConfiguration
54505
					Name="Debug_All|Win32"
54506
					ExcludedFromBuild="true"
54507
					>
54508
					<Tool
54509
						Name="VCCLCompilerTool"
54510
					/>
54511
				</FileConfiguration>
54512
				<FileConfiguration
54513
					Name="Production|Win32"
54514
					ExcludedFromBuild="true"
54515
					>
54516
					<Tool
54517
						Name="VCCLCompilerTool"
54518
					/>
54519
				</FileConfiguration>
54520
			</File>
54521
			<File
54522
				RelativePath="..\dom\WebKitNamedFlowCollection.h"
54523
				>
54524
			</File>
54469
			<File
54525
			<File
54470
				RelativePath="..\dom\WebKitTransitionEvent.cpp"
54526
				RelativePath="..\dom\WebKitTransitionEvent.cpp"
54471
				>
54527
				>
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj -7 / +15 lines
Lines 281-286 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
281
		0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5026E102BA9660066F39A /* StyleMedia.cpp */; };
281
		0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5026E102BA9660066F39A /* StyleMedia.cpp */; };
282
		0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF5026F102BA96A0066F39A /* StyleMedia.h */; };
282
		0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF5026F102BA96A0066F39A /* StyleMedia.h */; };
283
		10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */; };
283
		10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */; };
284
		12F35EB6158745A40035CB63 /* WebKitNamedFlowCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */; };
285
		12F35EB7158745A40035CB63 /* WebKitNamedFlowCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */; };
284
		1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; };
286
		1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; };
285
		1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
287
		1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
286
		1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403B99609EB13AF00797C7F /* DOMWindow.cpp */; };
288
		1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403B99609EB13AF00797C7F /* DOMWindow.cpp */; };
Lines 1785-1796 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
1785
		6E21C6C01126338500A7BE02 /* GraphicsContext3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */; };
1787
		6E21C6C01126338500A7BE02 /* GraphicsContext3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */; };
1786
		6E21C6C21126339900A7BE02 /* GraphicsContext3DCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */; };
1788
		6E21C6C21126339900A7BE02 /* GraphicsContext3DCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */; };
1787
		6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */; };
1789
		6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */; };
1788
		6E3FAD3814733F4000E42307 /* JSWebGLDepthTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42307 /* JSWebGLDepthTexture.cpp */; };
1789
		6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */; };
1790
		6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */; };
1790
		6E3FAD3914733F4000E42307 /* JSWebGLDepthTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42307 /* JSWebGLDepthTexture.h */; };
1791
		6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */; };
1791
		6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */; };
1792
		6E3FAE8E14733FDB00E42307 /* WebGLDepthTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42307 /* WebGLDepthTexture.cpp */; };
1793
		6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */; };
1792
		6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */; };
1793
		6E3FAD3814733F4000E42307 /* JSWebGLDepthTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42307 /* JSWebGLDepthTexture.cpp */; };
1794
		6E3FAD3914733F4000E42307 /* JSWebGLDepthTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42307 /* JSWebGLDepthTexture.h */; };
1795
		6E3FAE8E14733FDB00E42307 /* WebGLDepthTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42307 /* WebGLDepthTexture.cpp */; };
1794
		6E3FAE8F14733FDB00E42307 /* WebGLDepthTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42307 /* WebGLDepthTexture.h */; };
1796
		6E3FAE8F14733FDB00E42307 /* WebGLDepthTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42307 /* WebGLDepthTexture.h */; };
1795
		6E47E66010B7944B00B186C8 /* WebGLGetInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */; };
1797
		6E47E66010B7944B00B186C8 /* WebGLGetInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */; };
1796
		6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */; };
1798
		6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */; };
Lines 7228-7233 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
7228
		0FF5026F102BA96A0066F39A /* StyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleMedia.h; sourceTree = "<group>"; };
7230
		0FF5026F102BA96A0066F39A /* StyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleMedia.h; sourceTree = "<group>"; };
7229
		0FF50270102BA96A0066F39A /* StyleMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleMedia.idl; sourceTree = "<group>"; };
7231
		0FF50270102BA96A0066F39A /* StyleMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleMedia.idl; sourceTree = "<group>"; };
7230
		10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicURLManager.h; sourceTree = "<group>"; };
7232
		10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicURLManager.h; sourceTree = "<group>"; };
7233
		12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNamedFlowCollection.h; sourceTree = "<group>"; };
7234
		12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitNamedFlowCollection.cpp; sourceTree = "<group>"; };
7231
		1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; };
7235
		1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; };
7232
		1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; };
7236
		1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; };
7233
		1403B99509EB13AF00797C7F /* DOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindow.h; sourceTree = "<group>"; };
7237
		1403B99509EB13AF00797C7F /* DOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindow.h; sourceTree = "<group>"; };
Lines 8884-8897 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
8884
		6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3D.cpp; sourceTree = "<group>"; };
8888
		6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3D.cpp; sourceTree = "<group>"; };
8885
		6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DCG.cpp; sourceTree = "<group>"; };
8889
		6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DCG.cpp; sourceTree = "<group>"; };
8886
		6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLCompressedTextureS3TC.cpp; sourceTree = "<group>"; };
8890
		6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLCompressedTextureS3TC.cpp; sourceTree = "<group>"; };
8887
		6E3FAD3614733F4000E42307 /* JSWebGLDepthTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLDepthTexture.cpp; sourceTree = "<group>"; };
8888
		6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLCompressedTextureS3TC.h; sourceTree = "<group>"; };
8891
		6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLCompressedTextureS3TC.h; sourceTree = "<group>"; };
8889
		6E3FAD3714733F4000E42307 /* JSWebGLDepthTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLDepthTexture.h; sourceTree = "<group>"; };
8890
		6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLCompressedTextureS3TC.cpp; path = canvas/WebGLCompressedTextureS3TC.cpp; sourceTree = "<group>"; };
8892
		6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLCompressedTextureS3TC.cpp; path = canvas/WebGLCompressedTextureS3TC.cpp; sourceTree = "<group>"; };
8891
		6E3FAE8C14733FDB00E42307 /* WebGLDepthTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLDepthTexture.cpp; path = canvas/WebGLDepthTexture.cpp; sourceTree = "<group>"; };
8892
		6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLCompressedTextureS3TC.h; path = canvas/WebGLCompressedTextureS3TC.h; sourceTree = "<group>"; };
8893
		6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLCompressedTextureS3TC.h; path = canvas/WebGLCompressedTextureS3TC.h; sourceTree = "<group>"; };
8893
		6E3FAE8D14733FDB00E42307 /* WebGLDepthTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLDepthTexture.h; path = canvas/WebGLDepthTexture.h; sourceTree = "<group>"; };
8894
		6E3FAE9014733FEA00E42306 /* WebGLCompressedTextureS3TC.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLCompressedTextureS3TC.idl; path = canvas/WebGLCompressedTextureS3TC.idl; sourceTree = "<group>"; };
8894
		6E3FAE9014733FEA00E42306 /* WebGLCompressedTextureS3TC.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLCompressedTextureS3TC.idl; path = canvas/WebGLCompressedTextureS3TC.idl; sourceTree = "<group>"; };
8895
		6E3FAD3614733F4000E42307 /* JSWebGLDepthTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLDepthTexture.cpp; sourceTree = "<group>"; };
8896
		6E3FAD3714733F4000E42307 /* JSWebGLDepthTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLDepthTexture.h; sourceTree = "<group>"; };
8897
		6E3FAE8C14733FDB00E42307 /* WebGLDepthTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLDepthTexture.cpp; path = canvas/WebGLDepthTexture.cpp; sourceTree = "<group>"; };
8898
		6E3FAE8D14733FDB00E42307 /* WebGLDepthTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLDepthTexture.h; path = canvas/WebGLDepthTexture.h; sourceTree = "<group>"; };
8895
		6E3FAE9014733FEA00E42307 /* WebGLDepthTexture.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLDepthTexture.idl; path = canvas/WebGLDepthTexture.idl; sourceTree = "<group>"; };
8899
		6E3FAE9014733FEA00E42307 /* WebGLDepthTexture.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLDepthTexture.idl; path = canvas/WebGLDepthTexture.idl; sourceTree = "<group>"; };
8896
		6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLGetInfo.cpp; path = canvas/WebGLGetInfo.cpp; sourceTree = "<group>"; };
8900
		6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLGetInfo.cpp; path = canvas/WebGLGetInfo.cpp; sourceTree = "<group>"; };
8897
		6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLGetInfo.h; path = canvas/WebGLGetInfo.h; sourceTree = "<group>"; };
8901
		6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLGetInfo.h; path = canvas/WebGLGetInfo.h; sourceTree = "<group>"; };
Lines 21615-21620 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
21615
				93EEC1F709C2877700C515D1 /* WheelEvent.idl */,
21619
				93EEC1F709C2877700C515D1 /* WheelEvent.idl */,
21616
				4123E568127B3041000FEEA7 /* WindowEventContext.cpp */,
21620
				4123E568127B3041000FEEA7 /* WindowEventContext.cpp */,
21617
				4123E567127B3041000FEEA7 /* WindowEventContext.h */,
21621
				4123E567127B3041000FEEA7 /* WindowEventContext.h */,
21622
				12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */,
21623
				12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */,
21618
			);
21624
			);
21619
			path = dom;
21625
			path = dom;
21620
			sourceTree = "<group>";
21626
			sourceTree = "<group>";
Lines 25168-25173 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
25168
				E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
25174
				E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
25169
				977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */,
25175
				977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */,
25170
				FD537353137B651800008DCE /* ZeroPole.h in Headers */,
25176
				FD537353137B651800008DCE /* ZeroPole.h in Headers */,
25177
				12F35EB6158745A40035CB63 /* WebKitNamedFlowCollection.h in Headers */,
25171
				CE7B2DB31586ABAD0098B3FA /* AlternativeTextUIController.h in Headers */,
25178
				CE7B2DB31586ABAD0098B3FA /* AlternativeTextUIController.h in Headers */,
25172
				CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */,
25179
				CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */,
25173
				50987C27157D676D00BDA835 /* CustomFilterGlobalContext.h in Headers */,
25180
				50987C27157D676D00BDA835 /* CustomFilterGlobalContext.h in Headers */,
Lines 28223-28228 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
28223
				E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
28230
				E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
28224
				977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */,
28231
				977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */,
28225
				FD537352137B651800008DCE /* ZeroPole.cpp in Sources */,
28232
				FD537352137B651800008DCE /* ZeroPole.cpp in Sources */,
28233
				12F35EB7158745A40035CB63 /* WebKitNamedFlowCollection.cpp in Sources */,
28226
				9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */,
28234
				9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */,
28227
				CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */,
28235
				CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */,
28228
				CE7B2DB61586ABAD0098B3FA /* TextAlternativeWithRange.mm in Sources */,
28236
				CE7B2DB61586ABAD0098B3FA /* TextAlternativeWithRange.mm in Sources */,
- a/Source/WebCore/dom/DOMAllInOne.cpp +1 lines
Lines 144-149 a/Source/WebCore/dom/DOMAllInOne.cpp_sec1
144
#include "WebKitAnimationEvent.cpp"
144
#include "WebKitAnimationEvent.cpp"
145
#include "WebKitMutationObserver.cpp"
145
#include "WebKitMutationObserver.cpp"
146
#include "WebKitNamedFlow.cpp"
146
#include "WebKitNamedFlow.cpp"
147
#include "WebKitNamedFlowCollection.cpp"
147
#include "WebKitTransitionEvent.cpp"
148
#include "WebKitTransitionEvent.cpp"
148
#include "WheelEvent.cpp"
149
#include "WheelEvent.cpp"
149
#include "WindowEventContext.cpp"
150
#include "WindowEventContext.cpp"
- a/Source/WebCore/dom/Document.cpp -31 / +17 lines
Lines 156-161 a/Source/WebCore/dom/Document.cpp_sec1
156
#include "UndoManager.h"
156
#include "UndoManager.h"
157
#include "UserContentURLPattern.h"
157
#include "UserContentURLPattern.h"
158
#include "WebKitNamedFlow.h"
158
#include "WebKitNamedFlow.h"
159
#include "WebKitNamedFlowCollection.h"
159
#include "XMLDocumentParser.h"
160
#include "XMLDocumentParser.h"
160
#include "XMLHttpRequest.h"
161
#include "XMLHttpRequest.h"
161
#include "XMLNSNames.h"
162
#include "XMLNSNames.h"
Lines 604-609 Document::~Document() a/Source/WebCore/dom/Document.cpp_sec2
604
    if (m_styleSheets)
605
    if (m_styleSheets)
605
        m_styleSheets->documentDestroyed();
606
        m_styleSheets->documentDestroyed();
606
607
608
    if (m_namedFlows)
609
        m_namedFlows->documentDestroyed();
610
607
    if (m_elemSheet)
611
    if (m_elemSheet)
608
        m_elemSheet->clearOwnerNode();
612
        m_elemSheet->clearOwnerNode();
609
    if (m_pageUserSheet)
613
    if (m_pageUserSheet)
Lines 1105-1148 bool Document::cssGridLayoutEnabled() const a/Source/WebCore/dom/Document.cpp_sec3
1105
1109
1106
#if ENABLE(CSS_REGIONS)
1110
#if ENABLE(CSS_REGIONS)
1107
1111
1108
static bool validFlowName(const String& flowName)
1109
{
1110
    if (equalIgnoringCase(flowName, "auto")
1111
        || equalIgnoringCase(flowName, "default")
1112
        || equalIgnoringCase(flowName, "inherit")
1113
        || equalIgnoringCase(flowName, "initial")
1114
        || equalIgnoringCase(flowName, "none"))
1115
        return false;
1116
    return true;
1117
}
1118
1119
PassRefPtr<WebKitNamedFlow> Document::webkitGetFlowByName(const String& flowName)
1112
PassRefPtr<WebKitNamedFlow> Document::webkitGetFlowByName(const String& flowName)
1120
{
1113
{
1121
    return webkitGetFlowByName(flowName, CheckFlowNameForInvalidValues);
1122
}
1123
1124
PassRefPtr<WebKitNamedFlow> Document::webkitGetFlowByName(const String& flowName, FlowNameCheck flowNameCheck)
1125
{
1126
    if (!cssRegionsEnabled() || !renderer())
1114
    if (!cssRegionsEnabled() || !renderer())
1127
        return 0;
1115
        return 0;
1128
1116
    
1129
    if (flowNameCheck == CheckFlowNameForInvalidValues) {
1117
    // It's possible to have pending styles not applied that affect the existing flows.
1130
        if (flowName.isEmpty() || !validFlowName(flowName))
1118
    updateStyleIfNeeded();
1131
            return 0;
1119
    
1132
1120
    return namedFlows()->flowByName(flowName);
1133
        // Make a slower check for invalid flow name.
1134
        CSSParser parser(document());
1135
        if (!parser.parseFlowThread(flowName))
1136
            return 0;
1137
    }
1138
1139
    if (RenderView* view = renderer()->view())
1140
        return view->flowThreadController()->ensureRenderFlowThreadWithName(flowName)->ensureNamedFlow();
1141
    return 0;
1142
}
1121
}
1143
1144
#endif
1122
#endif
1145
1123
1124
WebKitNamedFlowCollection* Document::namedFlows()
1125
{
1126
    if (!m_namedFlows)
1127
        m_namedFlows = WebKitNamedFlowCollection::create(this);
1128
    
1129
    return m_namedFlows.get();
1130
}
1131
1146
PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode& ec)
1132
PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode& ec)
1147
{
1133
{
1148
    String prefix, localName;
1134
    String prefix, localName;
- a/Source/WebCore/dom/Document.h -5 / +5 lines
Lines 137-142 class TextResourceDecoder; a/Source/WebCore/dom/Document.h_sec1
137
class TreeWalker;
137
class TreeWalker;
138
class UndoManager;
138
class UndoManager;
139
class WebKitNamedFlow;
139
class WebKitNamedFlow;
140
class WebKitNamedFlowCollection;
140
class XMLHttpRequest;
141
class XMLHttpRequest;
141
class XPathEvaluator;
142
class XPathEvaluator;
142
class XPathExpression;
143
class XPathExpression;
Lines 328-341 public: a/Source/WebCore/dom/Document.h_sec2
328
329
329
    bool cssRegionsEnabled() const;
330
    bool cssRegionsEnabled() const;
330
#if ENABLE(CSS_REGIONS)
331
#if ENABLE(CSS_REGIONS)
331
    enum FlowNameCheck {
332
        CheckFlowNameForInvalidValues,
333
        DoNotCheckFlowNameForInvalidValues
334
    };
335
    PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&);
332
    PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&);
336
    PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&, FlowNameCheck);
337
#endif
333
#endif
338
334
335
    WebKitNamedFlowCollection* namedFlows();
336
339
    bool regionBasedColumnsEnabled() const;
337
    bool regionBasedColumnsEnabled() const;
340
338
341
    bool cssGridLayoutEnabled() const;
339
    bool cssGridLayoutEnabled() const;
Lines 1499-1504 private: a/Source/WebCore/dom/Document.h_sec3
1499
    bool m_visualUpdatesAllowed;
1497
    bool m_visualUpdatesAllowed;
1500
    Timer<Document> m_visualUpdatesSuppressionTimer;
1498
    Timer<Document> m_visualUpdatesSuppressionTimer;
1501
1499
1500
    RefPtr<WebKitNamedFlowCollection> m_namedFlows;
1501
1502
#ifndef NDEBUG
1502
#ifndef NDEBUG
1503
    bool m_didDispatchViewportPropertiesChanged;
1503
    bool m_didDispatchViewportPropertiesChanged;
1504
#endif
1504
#endif
- a/Source/WebCore/dom/WebKitNamedFlow.cpp -16 / +62 lines
Lines 33-72 a/Source/WebCore/dom/WebKitNamedFlow.cpp_sec1
33
#include "RenderNamedFlowThread.h"
33
#include "RenderNamedFlowThread.h"
34
#include "RenderRegion.h"
34
#include "RenderRegion.h"
35
#include "StaticNodeList.h"
35
#include "StaticNodeList.h"
36
#include "WebKitNamedFlowCollection.h"
36
37
37
namespace WebCore {
38
namespace WebCore {
38
39
39
WebKitNamedFlow::WebKitNamedFlow(RenderNamedFlowThread* parentFlowThread)
40
WebKitNamedFlow::WebKitNamedFlow(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName)
40
: m_parentFlowThread(parentFlowThread)
41
    : m_flowThreadName(flowThreadName)
42
    , m_flowManager(manager)
43
    , m_parentFlowThread(0)
44
    , m_state(FlowStateCreated)
41
{
45
{
42
}
46
}
43
47
44
WebKitNamedFlow::~WebKitNamedFlow()
48
WebKitNamedFlow::~WebKitNamedFlow()
45
{
49
{
50
    // The named flow is not "strong" referenced from anywhere at this time so it shouldn't be reused if the named flow is recreated.
51
    m_flowManager->discardNamedFlow(this);
46
}
52
}
47
53
48
String WebKitNamedFlow::name() const
54
PassRefPtr<WebKitNamedFlow> WebKitNamedFlow::create(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName)
49
{
55
{
50
    return m_parentFlowThread->flowThreadName();
56
    return adoptRef(new WebKitNamedFlow(manager, flowThreadName));
57
}
58
59
const AtomicString& WebKitNamedFlow::name() const
60
{
61
    return m_flowThreadName;
51
}
62
}
52
63
53
bool WebKitNamedFlow::overset() const
64
bool WebKitNamedFlow::overset() const
54
{
65
{
55
    m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets();
66
    if (m_flowManager->document())
56
    return m_parentFlowThread->overset();
67
        m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
68
69
    // The renderer may be destroyed or created after the style update.
70
    // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
71
    return m_parentFlowThread ? m_parentFlowThread->overset() : true;
57
}
72
}
58
73
74
static inline bool nodeInFlowThread(Node* contentNode, RenderNamedFlowThread* flowThread)
75
{
76
    return contentNode->renderer() && contentNode->renderer()->inRenderFlowThread() && flowThread == contentNode->renderer()->enclosingRenderFlowThread();
77
}
78
    
59
PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContentNode(Node* contentNode)
79
PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContentNode(Node* contentNode)
60
{
80
{
81
    Vector<RefPtr<Node> > regionNodes;
82
    
61
    if (!contentNode)
83
    if (!contentNode)
62
        return 0;
84
        return StaticNodeList::adopt(regionNodes);
63
85
64
    m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets();
86
    if (m_flowManager->document())
87
        m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
65
88
66
    Vector<RefPtr<Node> > regionNodes;
89
    // The renderer may be destroyed or created after the style update.
67
    if (contentNode->renderer()
90
    // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
68
        && contentNode->renderer()->inRenderFlowThread()
91
    if (!m_parentFlowThread) 
69
        && m_parentFlowThread == contentNode->renderer()->enclosingRenderFlowThread()) {
92
        return StaticNodeList::adopt(regionNodes);
93
94
    if (nodeInFlowThread(contentNode, m_parentFlowThread)) {
70
        const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
95
        const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
71
        for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
96
        for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
72
            const RenderRegion* renderRegion = *iter;
97
            const RenderRegion* renderRegion = *iter;
Lines 76-97 PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContentNode(Node* contentNode) a/Source/WebCore/dom/WebKitNamedFlow.cpp_sec2
76
                regionNodes.append(renderRegion->node());
101
                regionNodes.append(renderRegion->node());
77
        }
102
        }
78
    }
103
    }
104
79
    return StaticNodeList::adopt(regionNodes);
105
    return StaticNodeList::adopt(regionNodes);
80
}
106
}
81
107
82
PassRefPtr<NodeList> WebKitNamedFlow::getContent()
108
PassRefPtr<NodeList> WebKitNamedFlow::getContent()
83
{
109
{
84
    m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets();
85
86
    Vector<RefPtr<Node> > contentNodes;
110
    Vector<RefPtr<Node> > contentNodes;
87
    for (NamedFlowContentNodes::const_iterator it = m_parentFlowThread->contentNodes().begin(); it != m_parentFlowThread->contentNodes().end(); ++it) {
111
88
        Node* node = const_cast<Node*>(*it);
112
    if (m_flowManager->document())
113
        m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
114
115
    // The renderer may be destroyed or created after the style update.
116
    // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
117
    if (!m_parentFlowThread) 
118
        return StaticNodeList::adopt(contentNodes);
119
120
    NamedFlowContentNodes& contentNodesList = m_parentFlowThread->contentNodes();
121
    for (NamedFlowContentNodes::iterator it = contentNodesList.begin(); it != contentNodesList.end(); ++it) {
122
        Node* node = *it;
89
        ASSERT(node->computedStyle()->flowThread() == m_parentFlowThread->flowThreadName());
123
        ASSERT(node->computedStyle()->flowThread() == m_parentFlowThread->flowThreadName());
90
        contentNodes.append(node);
124
        contentNodes.append(node);
91
    }
125
    }
92
126
93
    return StaticNodeList::adopt(contentNodes);
127
    return StaticNodeList::adopt(contentNodes);
94
}
128
}
129
    
130
void WebKitNamedFlow::setRenderer(RenderNamedFlowThread* parentFlowThread)
131
{
132
    // The named flow can either go from a no_renderer->renderer or renderer->no_renderer state; anything else could indicate a bug.
133
    ASSERT((!m_parentFlowThread && parentFlowThread) || (m_parentFlowThread && !parentFlowThread));
134
135
    m_parentFlowThread = parentFlowThread;
136
137
    // A named flow that loses the renderer is in the "NULL" state.
138
    if (!m_parentFlowThread)
139
        m_flowManager->moveNamedFlowToNullState(this);
140
}
95
141
96
} // namespace WebCore
142
} // namespace WebCore
97
143
- a/Source/WebCore/dom/WebKitNamedFlow.h -6 / +20 lines
Lines 39-63 namespace WebCore { a/Source/WebCore/dom/WebKitNamedFlow.h_sec1
39
39
40
class NodeList;
40
class NodeList;
41
class RenderNamedFlowThread;
41
class RenderNamedFlowThread;
42
class WebKitNamedFlowCollection;
42
43
43
class WebKitNamedFlow : public RefCounted<WebKitNamedFlow> {
44
class WebKitNamedFlow : public RefCounted<WebKitNamedFlow> {
44
public:
45
public:
45
    static PassRefPtr<WebKitNamedFlow> create(RenderNamedFlowThread* parentFlowThread)
46
    static PassRefPtr<WebKitNamedFlow> create(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName);
46
    {
47
        return adoptRef(new WebKitNamedFlow(parentFlowThread));
48
    }
49
47
50
    ~WebKitNamedFlow();
48
    ~WebKitNamedFlow();
51
49
52
    String name() const;
50
    const AtomicString& name() const;
53
    bool overset() const;
51
    bool overset() const;
54
    PassRefPtr<NodeList> getRegionsByContentNode(Node*);
52
    PassRefPtr<NodeList> getRegionsByContentNode(Node*);
55
    PassRefPtr<NodeList> getContent();
53
    PassRefPtr<NodeList> getContent();
56
54
55
    void setRenderer(RenderNamedFlowThread* parentFlowThread);
56
57
    enum FlowState {
58
        FlowStateCreated,
59
        FlowStateNull
60
    };
61
    
62
    FlowState getFlowState() const { return m_state; }
63
    void switchFlowState() { m_state = m_state == FlowStateNull ? FlowStateCreated : FlowStateNull; }
64
    
57
private:
65
private:
58
    WebKitNamedFlow(RenderNamedFlowThread*);
66
    WebKitNamedFlow(PassRefPtr<WebKitNamedFlowCollection>, const AtomicString&);
59
67
68
    // The name of the flow thread as specified in CSS.
69
    AtomicString m_flowThreadName;
70
    
71
    RefPtr<WebKitNamedFlowCollection> m_flowManager;
60
    RenderNamedFlowThread* m_parentFlowThread;
72
    RenderNamedFlowThread* m_parentFlowThread;
73
    
74
    FlowState m_state;
61
};
75
};
62
76
63
}
77
}
- a/Source/WebCore/dom/WebKitNamedFlowCollection.cpp +137 lines
Line 0 a/Source/WebCore/dom/WebKitNamedFlowCollection.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Adobe Systems Incorporated. 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
 *
8
 * 1. Redistributions of source code must retain the above
9
 *    copyright notice, this list of conditions and the following
10
 *    disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above
12
 *    copyright notice, this list of conditions and the following
13
 *    disclaimer in the documentation and/or other materials
14
 *    provided with the distribution.
15
 *
16
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
17
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
20
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25
 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26
 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
 * SUCH DAMAGE.
28
 */
29
30
#include "config.h"
31
#include "WebKitNamedFlowCollection.h"
32
33
#include "Document.h"
34
#include "WebKitNamedFlow.h"
35
36
#include <wtf/text/StringHash.h>
37
#include <wtf/text/WTFString.h>
38
39
namespace WebCore {
40
41
WebKitNamedFlowCollection::WebKitNamedFlowCollection(Document* doc)
42
    : m_document(doc)
43
    , m_createdFlowsCount(0)
44
{
45
}
46
47
unsigned WebKitNamedFlowCollection::length() const
48
{
49
    return m_createdFlowsCount;
50
}
51
52
WebKitNamedFlow* WebKitNamedFlowCollection::item(unsigned index) const
53
{
54
    if (index >= m_createdFlowsCount)
55
        return 0;
56
    
57
    NamedFlowSet::const_iterator end = m_namedFlows.end();
58
    for (NamedFlowSet::const_iterator it = m_namedFlows.begin(); it != end; ++it) {
59
        WebKitNamedFlow* namedFlow = *it;
60
        if (namedFlow->getFlowState() == WebKitNamedFlow::FlowStateCreated) {
61
            if (!index)
62
                return namedFlow;
63
            --index;
64
        }
65
    }
66
    
67
    return 0;
68
}
69
70
WebKitNamedFlow* WebKitNamedFlowCollection::flowByName(const String& flowName)
71
{
72
    NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName);
73
    if (it == m_namedFlows.end() || (*it)->getFlowState() == WebKitNamedFlow::FlowStateNull)
74
        return 0;
75
76
    return *it;
77
}
78
79
PassRefPtr<WebKitNamedFlow> WebKitNamedFlowCollection::ensureNamedFlowInCreatedState(const String& flowName)
80
{
81
    NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName);
82
    if (it != m_namedFlows.end()) {
83
        WebKitNamedFlow* namedFlow = *it;
84
        ASSERT(namedFlow->getFlowState() == WebKitNamedFlow::FlowStateNull);
85
        if (namedFlow->getFlowState() == WebKitNamedFlow::FlowStateNull) {
86
            namedFlow->switchFlowState();
87
            ++m_createdFlowsCount;
88
        }
89
        
90
        return namedFlow;
91
    }
92
    
93
    RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(this, flowName);
94
    m_namedFlows.add(newFlow.get());
95
    ++m_createdFlowsCount;
96
    
97
    return newFlow.release();
98
}
99
100
void WebKitNamedFlowCollection::moveNamedFlowToNullState(WebKitNamedFlow* namedFlow)
101
{
102
    ASSERT(namedFlow->getFlowState() == WebKitNamedFlow::FlowStateCreated);
103
    ASSERT(m_createdFlowsCount > 0);
104
    
105
    namedFlow->switchFlowState();
106
    --m_createdFlowsCount;
107
}
108
109
void WebKitNamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow)
110
{
111
    // The document is not valid anymore so the collection will be destroyed anyway.
112
    if (!m_document)
113
        return;
114
115
    ASSERT(namedFlow->getFlowState() == WebKitNamedFlow::FlowStateNull);
116
    ASSERT(m_namedFlows.contains(namedFlow));
117
118
    m_namedFlows.remove(namedFlow);
119
}
120
121
void WebKitNamedFlowCollection::documentDestroyed()
122
{
123
    m_document = 0;
124
}
125
    
126
struct WebKitNamedFlowCollection::NamedFlowHashFunctions {
127
    static unsigned hash(WebKitNamedFlow* key) { return DefaultHash<String>::Hash::hash(key->name()); }
128
    static bool equal(WebKitNamedFlow* a, WebKitNamedFlow* b) { return a->name() == b->name(); }
129
    static const bool safeToCompareToEmptyOrDeleted = true;
130
};
131
132
struct WebKitNamedFlowCollection::NamedFlowHashTranslator {
133
    static unsigned hash(const String& key) { return DefaultHash<String>::Hash::hash(key); }
134
    static bool equal(WebKitNamedFlow* a, const String& b) { return a->name() == b; }
135
};
136
137
} // namespace WebCore
- a/Source/WebCore/dom/WebKitNamedFlowCollection.h +76 lines
Line 0 a/Source/WebCore/dom/WebKitNamedFlowCollection.h_sec1
1
/*
2
 * Copyright (C) 2012 Adobe Systems Incorporated. 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
 *
8
 * 1. Redistributions of source code must retain the above
9
 *    copyright notice, this list of conditions and the following
10
 *    disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above
12
 *    copyright notice, this list of conditions and the following
13
 *    disclaimer in the documentation and/or other materials
14
 *    provided with the distribution.
15
 *
16
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
17
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
20
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25
 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26
 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
 * SUCH DAMAGE.
28
 */
29
30
#ifndef WebKitNamedFlowCollection_h
31
#define WebKitNamedFlowCollection_h
32
33
#include <wtf/Forward.h>
34
#include <wtf/ListHashSet.h>
35
#include <wtf/PassRefPtr.h>
36
#include <wtf/RefCounted.h>
37
38
namespace WebCore {
39
40
class Document;
41
class WebKitNamedFlow;
42
43
class WebKitNamedFlowCollection : public RefCounted<WebKitNamedFlowCollection> {
44
public:
45
    static PassRefPtr<WebKitNamedFlowCollection> create(Document* doc) { return adoptRef(new WebKitNamedFlowCollection(doc)); }
46
47
    unsigned length() const;
48
    WebKitNamedFlow* item(unsigned index) const;
49
50
    WebKitNamedFlow* flowByName(const String&);
51
    PassRefPtr<WebKitNamedFlow> ensureNamedFlowInCreatedState(const String&);
52
53
    void moveNamedFlowToNullState(WebKitNamedFlow*);
54
    void discardNamedFlow(WebKitNamedFlow*);
55
56
    void documentDestroyed();
57
    
58
    Document* document() const { return m_document; }
59
60
private:
61
    WebKitNamedFlowCollection(Document*);
62
63
    Document* m_document;
64
    
65
    struct NamedFlowHashFunctions;
66
    struct NamedFlowHashTranslator;
67
    
68
    typedef ListHashSet<WebKitNamedFlow*, 1, NamedFlowHashFunctions> NamedFlowSet;
69
70
    unsigned m_createdFlowsCount;
71
    NamedFlowSet m_namedFlows;
72
};
73
74
} // namespace WebCore
75
76
#endif // WebKitNamedFlowCollection_h
- a/Source/WebCore/rendering/FlowThreadController.cpp -1 / +14 lines
Lines 33-38 a/Source/WebCore/rendering/FlowThreadController.cpp_sec1
33
33
34
#include "RenderFlowThread.h"
34
#include "RenderFlowThread.h"
35
#include "RenderNamedFlowThread.h"
35
#include "RenderNamedFlowThread.h"
36
#include "WebKitNamedFlow.h"
37
#include "WebKitNamedFlowCollection.h"
36
#include <wtf/text/AtomicString.h>
38
#include <wtf/text/AtomicString.h>
37
39
38
namespace WebCore {
40
namespace WebCore {
Lines 65-71 RenderNamedFlowThread* FlowThreadController::ensureRenderFlowThreadWithName(cons a/Source/WebCore/rendering/FlowThreadController.cpp_sec2
65
        }
67
        }
66
    }
68
    }
67
69
68
    RenderNamedFlowThread* flowRenderer = new (m_view->renderArena()) RenderNamedFlowThread(m_view->document(), name);
70
    WebKitNamedFlowCollection* namedFlows = m_view->document()->namedFlows();
71
72
    // Sanity check for the absence of a named flow in the "CREATED" state with the same name.
73
    ASSERT(!namedFlows->flowByName(name));
74
75
    RenderNamedFlowThread* flowRenderer = new (m_view->renderArena()) RenderNamedFlowThread(m_view->document(), namedFlows->ensureNamedFlowInCreatedState(name));
69
    flowRenderer->setStyle(RenderFlowThread::createFlowThreadStyle(m_view->style()));
76
    flowRenderer->setStyle(RenderFlowThread::createFlowThreadStyle(m_view->style()));
70
    m_renderNamedFlowThreadList->add(flowRenderer);
77
    m_renderNamedFlowThreadList->add(flowRenderer);
71
78
Lines 122-125 void FlowThreadController::unregisterNamedFlowContentNode(Node* contentNode) a/Source/WebCore/rendering/FlowThreadController.cpp_sec3
122
    m_mapNamedFlowContentNodes.remove(contentNode);
129
    m_mapNamedFlowContentNodes.remove(contentNode);
123
}
130
}
124
131
132
void FlowThreadController::removeFlowThread(RenderNamedFlowThread* flowThread)
133
{
134
    m_renderNamedFlowThreadList->remove(flowThread);
135
    setIsRenderNamedFlowThreadOrderDirty(true);
136
}
137
125
} // namespace WebCore
138
} // namespace WebCore
- a/Source/WebCore/rendering/FlowThreadController.h +2 lines
Lines 64-69 public: a/Source/WebCore/rendering/FlowThreadController.h_sec1
64
64
65
    void registerNamedFlowContentNode(Node*, RenderNamedFlowThread*);
65
    void registerNamedFlowContentNode(Node*, RenderNamedFlowThread*);
66
    void unregisterNamedFlowContentNode(Node*);
66
    void unregisterNamedFlowContentNode(Node*);
67
    
68
    void removeFlowThread(RenderNamedFlowThread*);
67
69
68
protected:
70
protected:
69
    FlowThreadController(RenderView*);
71
    FlowThreadController(RenderView*);
- a/Source/WebCore/rendering/RenderNamedFlowThread.cpp -12 / +28 lines
Lines 33-42 a/Source/WebCore/rendering/RenderNamedFlowThread.cpp_sec1
33
33
34
namespace WebCore {
34
namespace WebCore {
35
35
36
RenderNamedFlowThread::RenderNamedFlowThread(Node* node, const AtomicString& name)
36
RenderNamedFlowThread::RenderNamedFlowThread(Node* node, PassRefPtr<WebKitNamedFlow> namedFlow)
37
    : RenderFlowThread(node)
37
    : RenderFlowThread(node)
38
    , m_flowThreadName(name)
38
    , m_namedFlow(namedFlow)
39
{
39
{
40
    m_namedFlow->setRenderer(this);
41
}
42
43
RenderNamedFlowThread::~RenderNamedFlowThread()
44
{
45
    m_namedFlow->setRenderer(0);
40
}
46
}
41
47
42
const char* RenderNamedFlowThread::renderName() const
48
const char* RenderNamedFlowThread::renderName() const
Lines 44-50 const char* RenderNamedFlowThread::renderName() const a/Source/WebCore/rendering/RenderNamedFlowThread.cpp_sec2
44
    return "RenderNamedFlowThread";
50
    return "RenderNamedFlowThread";
45
}
51
}
46
52
47
48
RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const
53
RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const
49
{
54
{
50
    FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin();
55
    FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin();
Lines 182-191 void RenderNamedFlowThread::removeRegionFromThread(RenderRegion* renderRegion) a/Source/WebCore/rendering/RenderNamedFlowThread.cpp_sec3
182
        removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread());
187
        removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread());
183
    }
188
    }
184
189
190
    if (canBeDestroyed()) {
191
        destroy();
192
        return;
193
    }
194
    
185
    invalidateRegions();
195
    invalidateRegions();
186
}
196
}
187
197
188
189
void RenderNamedFlowThread::checkInvalidRegions()
198
void RenderNamedFlowThread::checkInvalidRegions()
190
{
199
{
191
    for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
200
    for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
Lines 245-258 void RenderNamedFlowThread::pushDependencies(RenderNamedFlowThreadList& list) a/Source/WebCore/rendering/RenderNamedFlowThread.cpp_sec4
245
    }
254
    }
246
}
255
}
247
256
248
WebKitNamedFlow* RenderNamedFlowThread::ensureNamedFlow()
249
{
250
    if (!m_namedFlow)
251
        m_namedFlow = WebKitNamedFlow::create(this);
252
253
    return m_namedFlow.get();
254
}
255
256
// The content nodes list contains those nodes with -webkit-flow-into: flow.
257
// The content nodes list contains those nodes with -webkit-flow-into: flow.
257
// An element with display:none should also be listed among those nodes.
258
// An element with display:none should also be listed among those nodes.
258
// The list of nodes is ordered.
259
// The list of nodes is ordered.
Lines 283-288 void RenderNamedFlowThread::unregisterNamedFlowContentNode(Node* contentNode) a/Source/WebCore/rendering/RenderNamedFlowThread.cpp_sec5
283
    contentNode->clearInNamedFlow();
284
    contentNode->clearInNamedFlow();
284
    m_contentNodes.remove(contentNode);
285
    m_contentNodes.remove(contentNode);
285
286
287
    if (canBeDestroyed())
288
        destroy();
289
}
290
291
const AtomicString& RenderNamedFlowThread::flowThreadName() const
292
{
293
    return m_namedFlow->name();
294
}
295
296
void RenderNamedFlowThread::willBeDestroyed()
297
{
298
    if (!documentBeingDestroyed())
299
        view()->flowThreadController()->removeFlowThread(this);
300
301
    RenderFlowThread::willBeDestroyed();
286
}
302
}
287
303
288
}
304
}
- a/Source/WebCore/rendering/RenderNamedFlowThread.h -7 / +8 lines
Lines 44-52 typedef ListHashSet<Node*> NamedFlowContentNodes; a/Source/WebCore/rendering/RenderNamedFlowThread.h_sec1
44
44
45
class RenderNamedFlowThread : public RenderFlowThread {
45
class RenderNamedFlowThread : public RenderFlowThread {
46
public:
46
public:
47
    RenderNamedFlowThread(Node*, const AtomicString&);
47
    RenderNamedFlowThread(Node*, PassRefPtr<WebKitNamedFlow>);
48
    virtual ~RenderNamedFlowThread();
48
49
49
    AtomicString flowThreadName() const { return m_flowThreadName; }
50
    const AtomicString& flowThreadName() const;
50
51
51
    RenderObject* nextRendererForNode(Node*) const;
52
    RenderObject* nextRendererForNode(Node*) const;
52
    RenderObject* previousRendererForNode(Node*) const;
53
    RenderObject* previousRendererForNode(Node*) const;
Lines 63-74 public: a/Source/WebCore/rendering/RenderNamedFlowThread.h_sec2
63
    virtual void addRegionToThread(RenderRegion*) OVERRIDE;
64
    virtual void addRegionToThread(RenderRegion*) OVERRIDE;
64
    virtual void removeRegionFromThread(RenderRegion*) OVERRIDE;
65
    virtual void removeRegionFromThread(RenderRegion*) OVERRIDE;
65
66
66
    WebKitNamedFlow* ensureNamedFlow();
67
    void registerNamedFlowContentNode(Node*);
67
    void registerNamedFlowContentNode(Node*);
68
    void unregisterNamedFlowContentNode(Node*);
68
    void unregisterNamedFlowContentNode(Node*);
69
    const NamedFlowContentNodes& contentNodes() const { return m_contentNodes; }
69
    NamedFlowContentNodes& contentNodes() { return m_contentNodes; }
70
    bool hasContentNode(Node* contentNode) const { ASSERT(contentNode); return m_contentNodes.contains(contentNode); }
70
    bool hasContentNode(Node* contentNode) const { ASSERT(contentNode); return m_contentNodes.contains(contentNode); }
71
71
72
protected:
73
    virtual void willBeDestroyed() OVERRIDE;
74
72
private:
75
private:
73
    virtual const char* renderName() const OVERRIDE;
76
    virtual const char* renderName() const OVERRIDE;
74
    virtual bool isRenderNamedFlowThread() const OVERRIDE { return true; }
77
    virtual bool isRenderNamedFlowThread() const OVERRIDE { return true; }
Lines 77-87 private: a/Source/WebCore/rendering/RenderNamedFlowThread.h_sec3
77
    void addDependencyOnFlowThread(RenderNamedFlowThread*);
80
    void addDependencyOnFlowThread(RenderNamedFlowThread*);
78
    void removeDependencyOnFlowThread(RenderNamedFlowThread*);
81
    void removeDependencyOnFlowThread(RenderNamedFlowThread*);
79
    void checkInvalidRegions();
82
    void checkInvalidRegions();
83
    inline bool canBeDestroyed() const { return m_regionList.isEmpty() && m_contentNodes.isEmpty(); }
80
84
81
private:
85
private:
82
    // The name of the flow thread as specified in CSS.
83
    AtomicString m_flowThreadName;
84
85
    // Observer flow threads have invalid regions that depend on the state of this thread
86
    // Observer flow threads have invalid regions that depend on the state of this thread
86
    // to re-validate their regions. Keeping a set of observer threads make it easy
87
    // to re-validate their regions. Keeping a set of observer threads make it easy
87
    // to notify them when a region was removed from this flow.
88
    // to notify them when a region was removed from this flow.
- a/LayoutTests/ChangeLog +22 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2012-07-03  Andrei Bucur  <abucur@adobe.com>
2
3
        [CSS Regions] Fix the lifecycle for the flow objects and their renderers
4
        https://bugs.webkit.org/show_bug.cgi?id=89000
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        These tests expected getFlowByName() to return a valid object even for the NULL flows. They've been modified to
9
        reflect the new behavior.
10
11
        * fast/regions/get-regions-by-content-node2-expected.txt:
12
        * fast/regions/get-regions-by-content-node2.html:
13
        * fast/regions/webkit-named-flow-flow-added.html:
14
        * fast/regions/webkit-named-flow-get-content-expected.txt:
15
        * fast/regions/webkit-named-flow-get-content.html:
16
        * fast/regions/webkit-named-flow-invalid-name.html:
17
        * fast/regions/webkit-named-flow-modified-flow.html:
18
        * fast/regions/webkit-named-flow-non-existing-flow.html:
19
        * fast/regions/webkit-named-flow-removed-flow.html:
20
        * platform/chromium-win/fast/regions/region-style-block-background-color2-expected.txt:
21
        * platform/mac/fast/regions/region-style-block-background-color2-expected.txt:
22
1
2012-07-03  Zan Dobersek  <zandobersek@gmail.com>
23
2012-07-03  Zan Dobersek  <zandobersek@gmail.com>
2
24
3
        Unreviewed GTK gardening, updating one baseline modified in r121745
25
        Unreviewed GTK gardening, updating one baseline modified in r121745
- a/LayoutTests/fast/regions/get-regions-by-content-node2-expected.txt -1 / +2 lines
Lines 3-9 Test for 77746: [CSSRegions]Implement NamedFlow::getRegionsByContentNode a/LayoutTests/fast/regions/get-regions-by-content-node2-expected.txt_sec1
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
4
5
5
6
PASS regionList is null
6
PASS regionList is non-null.
7
PASS regionList.length is 0
7
PASS regionList2 is non-null.
8
PASS regionList2 is non-null.
8
PASS regionList2.length is 0
9
PASS regionList2.length is 0
9
PASS regionList != regionList2 is true
10
PASS regionList != regionList2 is true
- a/LayoutTests/fast/regions/get-regions-by-content-node2.html -1 / +2 lines
Lines 27-33 a/LayoutTests/fast/regions/get-regions-by-content-node2.html_sec1
27
            // Getting the regions for a non existant node should return null.
27
            // Getting the regions for a non existant node should return null.
28
            var pElement;
28
            var pElement;
29
            var regionList = namedFlow.getRegionsByContentNode(pElement);
29
            var regionList = namedFlow.getRegionsByContentNode(pElement);
30
            shouldBeNull("regionList");
30
            shouldBeNonNull("regionList");
31
            shouldBeZero("regionList.length");
31
32
32
            // Getting the regions for an element that was not added to the dom should return an empty list.
33
            // Getting the regions for an element that was not added to the dom should return an empty list.
33
            pElement = document.createElement("p");
34
            pElement = document.createElement("p");
- a/LayoutTests/fast/regions/webkit-named-flow-flow-added.html -1 / +1 lines
Lines 43-49 a/LayoutTests/fast/regions/webkit-named-flow-flow-added.html_sec1
43
            function test()
43
            function test()
44
            {
44
            {
45
                namedFlow2 = document.webkitGetFlowByName("flow");
45
                namedFlow2 = document.webkitGetFlowByName("flow");
46
                if (namedFlow && namedFlow2) {
46
                if (!namedFlow && namedFlow2) {
47
                    document.getElementById("result").innerText = "PASS";
47
                    document.getElementById("result").innerText = "PASS";
48
                    document.getElementById("result").className = "pass";
48
                    document.getElementById("result").className = "pass";
49
                }
49
                }
- a/LayoutTests/fast/regions/webkit-named-flow-get-content-expected.txt -5 / +3 lines
Lines 3-12 Test for 90163: [CSSRegions]Rename NamedFlow::contentNodes to NamedFlow::getCont a/LayoutTests/fast/regions/webkit-named-flow-get-content-expected.txt_sec1
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
4
5
5
6
PASS namedFlowContent is non-null.
6
PASS document.webkitGetFlowByName("flow") is null
7
PASS namedFlowContent.length is 0
8
PASS namedFlowContent instanceof NodeList is true
9
PASS namedFlowContent2.length is 0
10
PASS namedFlowContent3.length is 1
7
PASS namedFlowContent3.length is 1
11
PASS namedFlowContent3.item(0).id is "article"
8
PASS namedFlowContent3.item(0).id is "article"
12
PASS namedFlowContent4.length is 1
9
PASS namedFlowContent4.length is 1
Lines 26-37 PASS namedFlowContent10.item(0).id is "article" a/LayoutTests/fast/regions/webkit-named-flow-get-content-expected.txt_sec2
26
PASS namedFlowContent11.length is 5
23
PASS namedFlowContent11.length is 5
27
PASS namedFlowContent12.length is 1
24
PASS namedFlowContent12.length is 1
28
PASS namedFlowContent12.item(0).id is "article"
25
PASS namedFlowContent12.item(0).id is "article"
29
PASS namedFlowContent10.length is 0
30
PASS namedFlowContent11.length is 0
26
PASS namedFlowContent11.length is 0
31
PASS namedFlowContent12.length is 1
27
PASS namedFlowContent12.length is 1
32
PASS namedFlowContent12.item(0).id is "article"
28
PASS namedFlowContent12.item(0).id is "article"
29
PASS document.webkitGetFlowByName("flow2") is null
33
PASS namedFlowContent13.length is 0
30
PASS namedFlowContent13.length is 0
34
PASS namedFlowContent14.length is 0
31
PASS namedFlowContent14.length is 0
32
PASS namedFlowContent15.length is 1
35
PASS successfullyParsed is true
33
PASS successfullyParsed is true
36
34
37
TEST COMPLETE
35
TEST COMPLETE
- a/LayoutTests/fast/regions/webkit-named-flow-get-content.html -20 / +17 lines
Lines 21-38 a/LayoutTests/fast/regions/webkit-named-flow-get-content.html_sec1
21
                window.layoutTestController.dumpAsText();
21
                window.layoutTestController.dumpAsText();
22
            description("Test for 90163: [CSSRegions]Rename NamedFlow::contentNodes to NamedFlow::getContent()");
22
            description("Test for 90163: [CSSRegions]Rename NamedFlow::contentNodes to NamedFlow::getContent()");
23
23
24
            // First time ask for a named flow object, the contentNodes should be empty.
25
            var namedFlowContent = document.webkitGetFlowByName("flow").getContent();
26
            shouldBeNonNull("namedFlowContent");
27
            shouldEvaluateTo("namedFlowContent.length", 0);
28
            shouldBeTrue("namedFlowContent instanceof NodeList");
29
30
            // Add an element that would be collected by the named flow but do not add it to the DOM, the contentNodes should be empty.
24
            // Add an element that would be collected by the named flow but do not add it to the DOM, the contentNodes should be empty.
31
            var article = document.createElement("div");
25
            var article = document.createElement("div");
32
            article.id = "article";
26
            article.id = "article";
33
            article.style.webkitFlowInto = "flow";
27
            article.style.webkitFlowInto = "flow";
34
            var namedFlowContent2 = document.webkitGetFlowByName("flow").getContent();
28
			
35
            shouldEvaluateTo("namedFlowContent2.length", 0);
29
    		shouldBeNull('document.webkitGetFlowByName("flow")');
36
30
37
            // Append the above element to the DOM. It will be collected by the flow, therefore the contentNodes should have 1 element.
31
            // Append the above element to the DOM. It will be collected by the flow, therefore the contentNodes should have 1 element.
38
            document.body.appendChild(article);
32
            document.body.appendChild(article);
Lines 58-65 a/LayoutTests/fast/regions/webkit-named-flow-get-content.html_sec2
58
52
59
            var namedFlowContent5 = document.webkitGetFlowByName("flow").getContent();
53
            var namedFlowContent5 = document.webkitGetFlowByName("flow").getContent();
60
            shouldEvaluateTo("namedFlowContent5.length", 2);
54
            shouldEvaluateTo("namedFlowContent5.length", 2);
61
			shouldBeEqualToString("namedFlowContent5.item(0).id", "article2");
55
            shouldBeEqualToString("namedFlowContent5.item(0).id", "article2");
62
			shouldBeEqualToString("namedFlowContent5.item(1).id", "article");
56
            shouldBeEqualToString("namedFlowContent5.item(1).id", "article");
63
57
64
            // Adding a region element to flow content into should not influence the content nodes collection.
58
            // Adding a region element to flow content into should not influence the content nodes collection.
65
            var regionNode = document.createElement("div");
59
            var regionNode = document.createElement("div");
Lines 89-104 a/LayoutTests/fast/regions/webkit-named-flow-get-content.html_sec3
89
            document.getElementById("article").style.display = "none";
83
            document.getElementById("article").style.display = "none";
90
            var namedFlowContent9 = document.webkitGetFlowByName("flow").getContent();
84
            var namedFlowContent9 = document.webkitGetFlowByName("flow").getContent();
91
            shouldEvaluateTo("namedFlowContent9.length", 3);
85
            shouldEvaluateTo("namedFlowContent9.length", 3);
92
			shouldBeEqualToString("namedFlowContent9.item(0).id", "article2");
86
            shouldBeEqualToString("namedFlowContent9.item(0).id", "article2");
93
			shouldBeEqualToString("namedFlowContent9.item(1).id", "span1");
87
            shouldBeEqualToString("namedFlowContent9.item(1).id", "span1");
94
			shouldBeEqualToString("namedFlowContent9.item(2).id", "article");
88
            shouldBeEqualToString("namedFlowContent9.item(2).id", "article");
95
89
96
            // Take 'article' node from last position and insert it before 'article2'
90
            // Take 'article' node from last position and insert it before 'article2'
97
            article = document.getElementById("article");
91
            article = document.getElementById("article");
98
            document.body.insertBefore(document.body.removeChild(article), article2);
92
            document.body.insertBefore(document.body.removeChild(article), article2);
99
            var namedFlowContent10 = document.webkitGetFlowByName("flow").getContent();
93
            var namedFlowContent10 = document.webkitGetFlowByName("flow").getContent();
100
            shouldEvaluateTo("namedFlowContent10.length", 3);
94
            shouldEvaluateTo("namedFlowContent10.length", 3);
101
			shouldBeEqualToString("namedFlowContent10.item(0).id", "article");
95
            shouldBeEqualToString("namedFlowContent10.item(0).id", "article");
102
96
103
            // Clone 'article2' including its children.
97
            // Clone 'article2' including its children.
104
            var article2Clone = document.getElementById("article2").cloneNode(true);
98
            var article2Clone = document.getElementById("article2").cloneNode(true);
Lines 110-123 a/LayoutTests/fast/regions/webkit-named-flow-get-content.html_sec4
110
            document.body.removeChild(article2Clone);
104
            document.body.removeChild(article2Clone);
111
            var namedFlowContent12 = document.webkitGetFlowByName("flow").getContent();
105
            var namedFlowContent12 = document.webkitGetFlowByName("flow").getContent();
112
            shouldEvaluateTo("namedFlowContent12.length", 1);
106
            shouldEvaluateTo("namedFlowContent12.length", 1);
113
			shouldBeEqualToString("namedFlowContent12.item(0).id", "article");
107
            shouldBeEqualToString("namedFlowContent12.item(0).id", "article");
114
115
            // Get the content nodes for another flow, flow2.
116
            var namedFlowContent10 = document.webkitGetFlowByName("flow2").getContent();
117
            shouldEvaluateTo("namedFlowContent10.length", "0");
118
108
119
            // Move the content node 'article' from named flow 'flow' to named flow 'flow2'
109
            // Move the content node 'article' from named flow 'flow' to named flow 'flow2'
120
            document.getElementById("article").style.webkitFlowInto = "flow2";
110
            document.getElementById("article").style.webkitFlowInto = "flow2";
111
            var flow2 = document.webkitGetFlowByName("flow2");
121
            var namedFlowContent11 = document.webkitGetFlowByName("flow").getContent();
112
            var namedFlowContent11 = document.webkitGetFlowByName("flow").getContent();
122
            var namedFlowContent12 = document.webkitGetFlowByName("flow2").getContent();
113
            var namedFlowContent12 = document.webkitGetFlowByName("flow2").getContent();
123
            shouldEvaluateTo("namedFlowContent11.length", "0");
114
            shouldEvaluateTo("namedFlowContent11.length", "0");
Lines 126-135 a/LayoutTests/fast/regions/webkit-named-flow-get-content.html_sec5
126
117
127
            // Remove the content node from dom, content nodes for both 'flow' and 'flow2' should be empty
118
            // Remove the content node from dom, content nodes for both 'flow' and 'flow2' should be empty
128
            document.body.removeChild(document.getElementById("article"));
119
            document.body.removeChild(document.getElementById("article"));
120
            shouldBeNull('document.webkitGetFlowByName("flow2")');
121
129
            var namedFlowContent13 = document.webkitGetFlowByName("flow").getContent();
122
            var namedFlowContent13 = document.webkitGetFlowByName("flow").getContent();
130
            var namedFlowContent14 = document.webkitGetFlowByName("flow2").getContent();
131
            shouldEvaluateTo("namedFlowContent13.length", "0");
123
            shouldEvaluateTo("namedFlowContent13.length", "0");
124
125
            var namedFlowContent14 = flow2.getContent();
132
            shouldEvaluateTo("namedFlowContent14.length", "0");
126
            shouldEvaluateTo("namedFlowContent14.length", "0");
127
            document.body.appendChild(article);
128
            var namedFlowContent15 = flow2.getContent();
129
            shouldEvaluateTo("namedFlowContent15.length", "1");
133
130
134
            document.getElementById("region").style.visibility = "hidden";
131
            document.getElementById("region").style.visibility = "hidden";
135
        </script>
132
        </script>
- a/LayoutTests/fast/regions/webkit-named-flow-invalid-name.html -2 / +2 lines
Lines 22-30 a/LayoutTests/fast/regions/webkit-named-flow-invalid-name.html_sec1
22
                assert(nullNamedFlow == null, "Named flow for " + arrFlowInvalidNames[i] + " should be null");
22
                assert(nullNamedFlow == null, "Named flow for " + arrFlowInvalidNames[i] + " should be null");
23
            }
23
            }
24
24
25
            // It should be possible to get the named flow object for a valid flow name.
25
            // It should not be possible to get the NamedFlow object for a missing flow.
26
            var namedFlow = document.webkitGetFlowByName("flow");
26
            var namedFlow = document.webkitGetFlowByName("flow");
27
            assert(namedFlow != null, "Named flow for flow should not be null");
27
            assert(namedFlow == null, "Named flow for flow should be null");
28
        </script>
28
        </script>
29
    </body>
29
    </body>
30
</html>
30
</html>
- a/LayoutTests/fast/regions/webkit-named-flow-modified-flow.html -1 / +1 lines
Lines 47-53 a/LayoutTests/fast/regions/webkit-named-flow-modified-flow.html_sec1
47
            {
47
            {
48
                var namedFlow = document.webkitGetFlowByName("flow");
48
                var namedFlow = document.webkitGetFlowByName("flow");
49
                var namedFlow2 = document.webkitGetFlowByName("flow2");
49
                var namedFlow2 = document.webkitGetFlowByName("flow2");
50
                if (namedFlow && namedFlow2) {
50
                if (!namedFlow && namedFlow2) {
51
                    document.getElementById("result").innerText = "PASS";
51
                    document.getElementById("result").innerText = "PASS";
52
                    document.getElementById("result").className = "pass";
52
                    document.getElementById("result").className = "pass";
53
                }
53
                }
- a/LayoutTests/fast/regions/webkit-named-flow-non-existing-flow.html -1 / +1 lines
Lines 29-35 a/LayoutTests/fast/regions/webkit-named-flow-non-existing-flow.html_sec1
29
                layoutTestController.dumpAsText();
29
                layoutTestController.dumpAsText();
30
30
31
            var namedFlow = document.webkitGetFlowByName("flow");
31
            var namedFlow = document.webkitGetFlowByName("flow");
32
            if (namedFlow) {
32
            if (!namedFlow) {
33
                document.getElementById("result").innerText = "PASS";
33
                document.getElementById("result").innerText = "PASS";
34
                document.getElementById("result").className = "pass";
34
                document.getElementById("result").className = "pass";
35
            }
35
            }
- a/LayoutTests/fast/regions/webkit-named-flow-removed-flow.html -1 / +1 lines
Lines 43-49 a/LayoutTests/fast/regions/webkit-named-flow-removed-flow.html_sec1
43
            function test()
43
            function test()
44
            {
44
            {
45
                namedFlow2 = document.webkitGetFlowByName("flow");
45
                namedFlow2 = document.webkitGetFlowByName("flow");
46
                if (namedFlow && namedFlow2) {
46
                if (namedFlow && !namedFlow2) {
47
                    document.getElementById("result").innerText = "PASS";
47
                    document.getElementById("result").innerText = "PASS";
48
                    document.getElementById("result").className = "pass";
48
                    document.getElementById("result").className = "pass";
49
                }
49
                }
- a/LayoutTests/platform/chromium-win/fast/regions/region-style-block-background-color2-expected.txt -1 lines
Lines 29-35 Flow Threads a/LayoutTests/platform/chromium-win/fast/regions/region-style-block-background-color2-expected.txt_sec1
29
              text run at (0,0) width 245: "Green background text styled in region1."
29
              text run at (0,0) width 245: "Green background text styled in region1."
30
  Regions for flow 'flow1'
30
  Regions for flow 'flow1'
31
    RenderRegion {DIV} #region1 region style: 1
31
    RenderRegion {DIV} #region1 region style: 1
32
  Thread with flow-name 'flow2'
33
  Thread with flow-name 'flow3'
32
  Thread with flow-name 'flow3'
34
    layer at (0,0) size 280x80
33
    layer at (0,0) size 280x80
35
      RenderNamedFlowThread at (0,0) size 280x80
34
      RenderNamedFlowThread at (0,0) size 280x80
- a/LayoutTests/platform/mac/fast/regions/region-style-block-background-color2-expected.txt -1 lines
Lines 29-35 Flow Threads a/LayoutTests/platform/mac/fast/regions/region-style-block-background-color2-expected.txt_sec1
29
              text run at (0,0) width 258: "Green background text styled in region1."
29
              text run at (0,0) width 258: "Green background text styled in region1."
30
  Regions for flow 'flow1'
30
  Regions for flow 'flow1'
31
    RenderRegion {DIV} #region1 region style: 1
31
    RenderRegion {DIV} #region1 region style: 1
32
  Thread with flow-name 'flow2'
33
  Thread with flow-name 'flow3'
32
  Thread with flow-name 'flow3'
34
    layer at (0,0) size 280x80
33
    layer at (0,0) size 280x80
35
      RenderNamedFlowThread at (0,0) size 280x80
34
      RenderNamedFlowThread at (0,0) size 280x80

Return to Bug 89000