Source/WebCore/ChangeLog

 12012-06-21 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::Document::~Document):
 33 (WebCore):
 34 (WebCore::Document::webkitGetFlowByName):
 35 (WebCore::Document::namedFlows):
 36 * dom/Document.h:
 37 (WebCore):
 38 (Document):
 39 * dom/WebKitNamedFlow.cpp:
 40 (WebCore::WebKitNamedFlow::WebKitNamedFlow):
 41 (WebCore::WebKitNamedFlow::~WebKitNamedFlow):
 42 (WebCore::WebKitNamedFlow::name):
 43 (WebCore::WebKitNamedFlow::overset):
 44 (WebCore::WebKitNamedFlow::getRegionsByContentNode):
 45 (WebCore::WebKitNamedFlow::contentNodes):
 46 (WebCore):
 47 (WebCore::WebKitNamedFlow::setRenderer):
 48 * dom/WebKitNamedFlow.h:
 49 (WebCore):
 50 (WebCore::WebKitNamedFlow::create):
 51 (WebKitNamedFlow):
 52 (WebCore::WebKitNamedFlow::getFlowState):
 53 (WebCore::WebKitNamedFlow::switchFlowState):
 54 * dom/WebKitNamedFlowCollection.cpp: Added.
 55 (WebCore):
 56 (WebCore::WebKitNamedFlowCollection::WebKitNamedFlowCollection):
 57 (WebCore::WebKitNamedFlowCollection::~WebKitNamedFlowCollection):
 58 (WebCore::WebKitNamedFlowCollection::length): An O(1) operation
 59 (WebCore::WebKitNamedFlowCollection::item): An O(number of CREATED flows) operation
 60 (WebCore::WebKitNamedFlowCollection::getFlowByName): An O(1) operation
 61 (WebCore::WebKitNamedFlowCollection::ensureNamedFlowInCreatedState): An O(1) operation
 62 (WebCore::WebKitNamedFlowCollection::moveNamedFlowToNullState): An O(1) operation
 63 (WebCore::WebKitNamedFlowCollection::discardNamedFlow): An O(1) operation
 64 (WebCore::WebKitNamedFlowCollection::documentDestroyed):
 65 (WebCore::WebKitNamedFlowCollection::NamedFlowHashFunctions::hash):
 66 (WebCore::WebKitNamedFlowCollection::NamedFlowHashFunctions::equal):
 67 (WebKitNamedFlowCollection::NamedFlowHashFunctions):
 68 (WebCore::WebKitNamedFlowCollection::NamedFlowHashTranslator::hash):
 69 (WebCore::WebKitNamedFlowCollection::NamedFlowHashTranslator::equal):
 70 * dom/WebKitNamedFlowCollection.h: Copied from Source/WebCore/dom/WebKitNamedFlow.h.
 71 (WebCore):
 72 (WebKitNamedFlowCollection):
 73 (WebCore::WebKitNamedFlowCollection::create):
 74 (WebCore::WebKitNamedFlowCollection::document):
 75 * rendering/FlowThreadController.cpp:
 76 (WebCore::FlowThreadController::ensureRenderFlowThreadWithName):
 77 (WebCore::FlowThreadController::removeFlowThread):
 78 (WebCore):
 79 * rendering/FlowThreadController.h:
 80 (FlowThreadController):
 81 * rendering/RenderNamedFlowThread.cpp:
 82 (WebCore::RenderNamedFlowThread::RenderNamedFlowThread):
 83 (WebCore):
 84 (WebCore::RenderNamedFlowThread::~RenderNamedFlowThread):
 85 (WebCore::RenderNamedFlowThread::removeRegionFromThread):
 86 (WebCore::RenderNamedFlowThread::unregisterNamedFlowContentNode):
 87 (WebCore::RenderNamedFlowThread::flowThreadName):
 88 (WebCore::RenderNamedFlowThread::willBeDestroyed):
 89 * rendering/RenderNamedFlowThread.h:
 90 (RenderNamedFlowThread):
 91 (WebCore::RenderNamedFlowThread::canBeDestroyed):
 92
1932012-06-22 Ilya Tikhonovsky <loislo@chromium.org>
294
395 Web Inspector: partially instrument DOM Tree native memory.

Source/WebCore/CMakeLists.txt

@@SET(WebCore_SOURCES
666666 dom/WebKitAnimationEvent.cpp
667667 dom/WebKitMutationObserver.cpp
668668 dom/WebKitNamedFlow.cpp
 669 dom/WebKitNamedFlowCollection.cpp
669670 dom/WebKitTransitionEvent.cpp
670671 dom/WheelEvent.cpp
671672 dom/WindowEventContext.cpp

Source/WebCore/GNUmakefile.list.am

@@webcore_sources += \
20392039 Source/WebCore/dom/WebKitMutationObserver.h \
20402040 Source/WebCore/dom/WebKitNamedFlow.cpp \
20412041 Source/WebCore/dom/WebKitNamedFlow.h \
 2042 Source/WebCore/dom/WebKitNamedFlowCollection.cpp \
 2043 Source/WebCore/dom/WebKitNamedFlowCollection.h \
20422044 Source/WebCore/dom/WebKitTransitionEvent.cpp \
20432045 Source/WebCore/dom/WebKitTransitionEvent.h \
20442046 Source/WebCore/dom/WheelEvent.cpp \

Source/WebCore/Target.pri

@@SOURCES += \
630630 dom/WebKitAnimationEvent.cpp \
631631 dom/WebKitMutationObserver.cpp \
632632 dom/WebKitNamedFlow.cpp \
 633 dom/WebKitNamedFlowCollection.cpp \
633634 dom/WebKitTransitionEvent.cpp \
634635 dom/WheelEvent.cpp \
635636 dom/WindowEventContext.cpp \

@@HEADERS += \
18051806 dom/WebKitAnimationEvent.h \
18061807 dom/WebKitMutationObserver.h \
18071808 dom/WebKitNamedFlow.h \
 1809 dom/WebKitNamedFlowCollection.h \
18081810 dom/WebKitTransitionEvent.h \
18091811 dom/WheelEvent.h \
18101812 editing/AlternativeTextController.h \

Source/WebCore/WebCore.gypi

54605460 'dom/WebKitMutationObserver.h',
54615461 'dom/WebKitNamedFlow.cpp',
54625462 'dom/WebKitNamedFlow.h',
 5463 'dom/WebKitNamedFlowCollection.cpp',
 5464 'dom/WebKitNamedFlowCollection.h',
54635465 'dom/WebKitTransitionEvent.cpp',
54645466 'dom/WebKitTransitionEvent.h',
54655467 'dom/WheelEvent.cpp',

Source/WebCore/WebCore.vcproj/WebCore.vcproj

5444254442 RelativePath="..\dom\WebKitNamedFlow.h"
5444354443 >
5444454444 </File>
 54445 <File
 54446 RelativePath="..\dom\WebKitNamedFlowCollection.cpp"
 54447 >
 54448 <FileConfiguration
 54449 Name="Debug|Win32"
 54450 ExcludedFromBuild="true"
 54451 >
 54452 <Tool
 54453 Name="VCCLCompilerTool"
 54454 />
 54455 </FileConfiguration>
 54456 <FileConfiguration
 54457 Name="Release|Win32"
 54458 ExcludedFromBuild="true"
 54459 >
 54460 <Tool
 54461 Name="VCCLCompilerTool"
 54462 />
 54463 </FileConfiguration>
 54464 <FileConfiguration
 54465 Name="Debug_Cairo_CFLite|Win32"
 54466 ExcludedFromBuild="true"
 54467 >
 54468 <Tool
 54469 Name="VCCLCompilerTool"
 54470 />
 54471 </FileConfiguration>
 54472 <FileConfiguration
 54473 Name="Release_Cairo_CFLite|Win32"
 54474 ExcludedFromBuild="true"
 54475 >
 54476 <Tool
 54477 Name="VCCLCompilerTool"
 54478 />
 54479 </FileConfiguration>
 54480 <FileConfiguration
 54481 Name="Debug_All|Win32"
 54482 ExcludedFromBuild="true"
 54483 >
 54484 <Tool
 54485 Name="VCCLCompilerTool"
 54486 />
 54487 </FileConfiguration>
 54488 <FileConfiguration
 54489 Name="Production|Win32"
 54490 ExcludedFromBuild="true"
 54491 >
 54492 <Tool
 54493 Name="VCCLCompilerTool"
 54494 />
 54495 </FileConfiguration>
 54496 </File>
 54497 <File
 54498 RelativePath="..\dom\WebKitNamedFlowCollection.h"
 54499 >
 54500 </File>
5444554501 <File
5444654502 RelativePath="..\dom\WebKitTransitionEvent.cpp"
5444754503 >

Source/WebCore/WebCore.xcodeproj/project.pbxproj

278278 0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5026E102BA9660066F39A /* StyleMedia.cpp */; };
279279 0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF5026F102BA96A0066F39A /* StyleMedia.h */; };
280280 10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */; };
 281 12F35EB6158745A40035CB63 /* WebKitNamedFlowCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */; };
 282 12F35EB7158745A40035CB63 /* WebKitNamedFlowCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */; };
281283 1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; };
282284 1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
283285 1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403B99609EB13AF00797C7F /* DOMWindow.cpp */; };

17801782 6E21C6C01126338500A7BE02 /* GraphicsContext3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */; };
17811783 6E21C6C21126339900A7BE02 /* GraphicsContext3DCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */; };
17821784 6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */; };
1783  6E3FAD3814733F4000E42307 /* JSWebGLDepthTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42307 /* JSWebGLDepthTexture.cpp */; };
17841785 6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */; };
1785  6E3FAD3914733F4000E42307 /* JSWebGLDepthTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42307 /* JSWebGLDepthTexture.h */; };
17861786 6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */; };
1787  6E3FAE8E14733FDB00E42307 /* WebGLDepthTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42307 /* WebGLDepthTexture.cpp */; };
17881787 6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */; };
 1788 6E3FAD3814733F4000E42307 /* JSWebGLDepthTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42307 /* JSWebGLDepthTexture.cpp */; };
 1789 6E3FAD3914733F4000E42307 /* JSWebGLDepthTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42307 /* JSWebGLDepthTexture.h */; };
 1790 6E3FAE8E14733FDB00E42307 /* WebGLDepthTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42307 /* WebGLDepthTexture.cpp */; };
17891791 6E3FAE8F14733FDB00E42307 /* WebGLDepthTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42307 /* WebGLDepthTexture.h */; };
17901792 6E47E66010B7944B00B186C8 /* WebGLGetInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */; };
17911793 6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */; };

72187220 0FF5026F102BA96A0066F39A /* StyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleMedia.h; sourceTree = "<group>"; };
72197221 0FF50270102BA96A0066F39A /* StyleMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleMedia.idl; sourceTree = "<group>"; };
72207222 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicURLManager.h; sourceTree = "<group>"; };
 7223 12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNamedFlowCollection.h; sourceTree = "<group>"; };
 7224 12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitNamedFlowCollection.cpp; sourceTree = "<group>"; };
72217225 1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; };
72227226 1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; };
72237227 1403B99509EB13AF00797C7F /* DOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindow.h; sourceTree = "<group>"; };

88728876 6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3D.cpp; sourceTree = "<group>"; };
88738877 6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DCG.cpp; sourceTree = "<group>"; };
88748878 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLCompressedTextureS3TC.cpp; sourceTree = "<group>"; };
8875  6E3FAD3614733F4000E42307 /* JSWebGLDepthTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLDepthTexture.cpp; sourceTree = "<group>"; };
88768879 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLCompressedTextureS3TC.h; sourceTree = "<group>"; };
8877  6E3FAD3714733F4000E42307 /* JSWebGLDepthTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLDepthTexture.h; sourceTree = "<group>"; };
88788880 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLCompressedTextureS3TC.cpp; path = canvas/WebGLCompressedTextureS3TC.cpp; sourceTree = "<group>"; };
8879  6E3FAE8C14733FDB00E42307 /* WebGLDepthTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLDepthTexture.cpp; path = canvas/WebGLDepthTexture.cpp; sourceTree = "<group>"; };
88808881 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLCompressedTextureS3TC.h; path = canvas/WebGLCompressedTextureS3TC.h; sourceTree = "<group>"; };
8881  6E3FAE8D14733FDB00E42307 /* WebGLDepthTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLDepthTexture.h; path = canvas/WebGLDepthTexture.h; sourceTree = "<group>"; };
88828882 6E3FAE9014733FEA00E42306 /* WebGLCompressedTextureS3TC.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLCompressedTextureS3TC.idl; path = canvas/WebGLCompressedTextureS3TC.idl; sourceTree = "<group>"; };
 8883 6E3FAD3614733F4000E42307 /* JSWebGLDepthTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLDepthTexture.cpp; sourceTree = "<group>"; };
 8884 6E3FAD3714733F4000E42307 /* JSWebGLDepthTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLDepthTexture.h; sourceTree = "<group>"; };
 8885 6E3FAE8C14733FDB00E42307 /* WebGLDepthTexture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLDepthTexture.cpp; path = canvas/WebGLDepthTexture.cpp; sourceTree = "<group>"; };
 8886 6E3FAE8D14733FDB00E42307 /* WebGLDepthTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLDepthTexture.h; path = canvas/WebGLDepthTexture.h; sourceTree = "<group>"; };
88838887 6E3FAE9014733FEA00E42307 /* WebGLDepthTexture.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLDepthTexture.idl; path = canvas/WebGLDepthTexture.idl; sourceTree = "<group>"; };
88848888 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLGetInfo.cpp; path = canvas/WebGLGetInfo.cpp; sourceTree = "<group>"; };
88858889 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLGetInfo.h; path = canvas/WebGLGetInfo.h; sourceTree = "<group>"; };

2159221596 93EEC1F709C2877700C515D1 /* WheelEvent.idl */,
2159321597 4123E568127B3041000FEEA7 /* WindowEventContext.cpp */,
2159421598 4123E567127B3041000FEEA7 /* WindowEventContext.h */,
 21599 12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */,
 21600 12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */,
2159521601 );
2159621602 path = dom;
2159721603 sourceTree = "<group>";

2514625152 CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */,
2514725153 50987C27157D676D00BDA835 /* CustomFilterGlobalContext.h in Headers */,
2514825154 4F32BB1B14FA85E800F6C1A3 /* MemoryInstrumentation.h in Headers */,
 25155 12F35EB6158745A40035CB63 /* WebKitNamedFlowCollection.h in Headers */,
2514925156 );
2515025157 runOnlyForDeploymentPostprocessing = 0;
2515125158 };

2819828205 CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */,
2819928206 CE7B2DB61586ABAD0098B3FA /* TextAlternativeWithRange.mm in Sources */,
2820028207 50987C26157D676D00BDA835 /* CustomFilterGlobalContext.cpp in Sources */,
 28208 12F35EB7158745A40035CB63 /* WebKitNamedFlowCollection.cpp in Sources */,
2820128209 );
2820228210 runOnlyForDeploymentPostprocessing = 0;
2820328211 };

Source/WebCore/dom/DOMAllInOne.cpp

144144#include "WebKitAnimationEvent.cpp"
145145#include "WebKitMutationObserver.cpp"
146146#include "WebKitNamedFlow.cpp"
 147#include "WebKitNamedFlowCollection.cpp"
147148#include "WebKitTransitionEvent.cpp"
148149#include "WheelEvent.cpp"
149150#include "WindowEventContext.cpp"

Source/WebCore/dom/Document.cpp

156156#include "UndoManager.h"
157157#include "UserContentURLPattern.h"
158158#include "WebKitNamedFlow.h"
 159#include "WebKitNamedFlowCollection.h"
159160#include "XMLDocumentParser.h"
160161#include "XMLHttpRequest.h"
161162#include "XMLNSNames.h"

@@Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
495496 , m_scheduledTasksAreSuspended(false)
496497 , m_visualUpdatesAllowed(true)
497498 , m_visualUpdatesSuppressionTimer(this, &Document::visualUpdatesSuppressionTimerFired)
 499 , m_namedFlows(0)
498500#ifndef NDEBUG
499501 , m_didDispatchViewportPropertiesChanged(false)
500502#endif

@@Document::~Document()
617619 if (m_styleSheets)
618620 m_styleSheets->documentDestroyed();
619621
 622 if (m_namedFlows)
 623 m_namedFlows->documentDestroyed();
 624
620625 if (m_elemSheet)
621626 m_elemSheet->clearOwnerNode();
622627 if (m_pageUserSheet)

@@bool Document::cssGridLayoutEnabled() const
11161121
11171122#if ENABLE(CSS_REGIONS)
11181123
1119 static bool validFlowName(const String& flowName)
1120 {
1121  if (equalIgnoringCase(flowName, "auto")
1122  || equalIgnoringCase(flowName, "default")
1123  || equalIgnoringCase(flowName, "inherit")
1124  || equalIgnoringCase(flowName, "initial")
1125  || equalIgnoringCase(flowName, "none"))
1126  return false;
1127  return true;
1128 }
1129 
11301124PassRefPtr<WebKitNamedFlow> Document::webkitGetFlowByName(const String& flowName)
11311125{
1132  return webkitGetFlowByName(flowName, CheckFlowNameForInvalidValues);
1133 }
1134 
1135 PassRefPtr<WebKitNamedFlow> Document::webkitGetFlowByName(const String& flowName, FlowNameCheck flowNameCheck)
1136 {
11371126 if (!cssRegionsEnabled() || !renderer())
11381127 return 0;
1139 
1140  if (flowNameCheck == CheckFlowNameForInvalidValues) {
1141  if (flowName.isEmpty() || !validFlowName(flowName))
1142  return 0;
1143 
1144  // Make a slower check for invalid flow name.
1145  CSSParser parser(document());
1146  if (!parser.parseFlowThread(flowName))
1147  return 0;
1148  }
1149 
1150  if (RenderView* view = renderer()->view())
1151  return view->flowThreadController()->ensureRenderFlowThreadWithName(flowName)->ensureNamedFlow();
1152  return 0;
 1128
 1129 // It's possible to have pending styles not applied that affect the existing flows.
 1130 updateStyleIfNeeded();
 1131
 1132 return namedFlows()->getFlowByName(flowName);
11531133}
1154 
11551134#endif
11561135
 1136WebKitNamedFlowCollection* Document::namedFlows()
 1137{
 1138 if (!m_namedFlows)
 1139 m_namedFlows = WebKitNamedFlowCollection::create(this);
 1140
 1141 return m_namedFlows.get();
 1142}
 1143
11571144PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode& ec)
11581145{
11591146 String prefix, localName;

Source/WebCore/dom/Document.h

@@class TextResourceDecoder;
136136class TreeWalker;
137137class UndoManager;
138138class WebKitNamedFlow;
 139class WebKitNamedFlowCollection;
139140class XMLHttpRequest;
140141class XPathEvaluator;
141142class XPathExpression;

@@public:
327328
328329 bool cssRegionsEnabled() const;
329330#if ENABLE(CSS_REGIONS)
330  enum FlowNameCheck {
331  CheckFlowNameForInvalidValues,
332  DoNotCheckFlowNameForInvalidValues
333  };
334331 PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&);
335  PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&, FlowNameCheck);
336332#endif
337333
 334 WebKitNamedFlowCollection* namedFlows();
 335
338336 bool regionBasedColumnsEnabled() const;
339337
340338 bool cssGridLayoutEnabled() const;

@@private:
14941492 bool m_visualUpdatesAllowed;
14951493 Timer<Document> m_visualUpdatesSuppressionTimer;
14961494
 1495 RefPtr<WebKitNamedFlowCollection> m_namedFlows;
 1496
14971497#ifndef NDEBUG
14981498 bool m_didDispatchViewportPropertiesChanged;
14991499#endif

Source/WebCore/dom/WebKitNamedFlow.cpp

3636
3737namespace WebCore {
3838
39 WebKitNamedFlow::WebKitNamedFlow(RenderNamedFlowThread* parentFlowThread)
40 : m_parentFlowThread(parentFlowThread)
 39WebKitNamedFlow::WebKitNamedFlow(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName)
 40 : m_flowThreadName(flowThreadName)
 41 , m_flowManager(manager)
 42 , m_parentFlowThread(0)
 43 , m_state(FlowStateCreated)
4144{
4245}
4346
4447WebKitNamedFlow::~WebKitNamedFlow()
4548{
 49 // The named flow is not "strong" referenced from anywhere at this time so it shouldn't be reused if the named flow is recreated.
 50 m_flowManager->discardNamedFlow(this);
4651}
4752
4853String WebKitNamedFlow::name() const
4954{
50  return m_parentFlowThread->flowThreadName();
 55 return m_flowThreadName;
5156}
5257
5358bool WebKitNamedFlow::overset() const
5459{
55  m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets();
56  return m_parentFlowThread->overset();
 60 if (m_flowManager->document())
 61 m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
 62
 63 // The renderer may be destroyed or created after the style update.
 64 // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
 65 return m_parentFlowThread ? m_parentFlowThread->overset() : true;
5766}
5867
5968PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContentNode(Node* contentNode)

@@PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContentNode(Node* contentNode)
6170 if (!contentNode)
6271 return 0;
6372
64  m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets();
65 
6673 Vector<RefPtr<Node> > regionNodes;
67  if (contentNode->renderer()
68  && contentNode->renderer()->inRenderFlowThread()
69  && m_parentFlowThread == contentNode->renderer()->enclosingRenderFlowThread()) {
70  const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
71  for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
72  const RenderRegion* renderRegion = *iter;
73  if (!renderRegion->isValid())
74  continue;
75  if (m_parentFlowThread->objectInFlowRegion(contentNode->renderer(), renderRegion))
76  regionNodes.append(renderRegion->node());
 74
 75 if (m_flowManager->document())
 76 m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
 77
 78 // The renderer may be destroyed or created after the style update.
 79 // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
 80 if (m_parentFlowThread) {
 81 if (contentNode->renderer()
 82 && contentNode->renderer()->inRenderFlowThread()
 83 && m_parentFlowThread == contentNode->renderer()->enclosingRenderFlowThread()) {
 84 const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
 85 for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
 86 const RenderRegion* renderRegion = *iter;
 87 if (!renderRegion->isValid())
 88 continue;
 89 if (m_parentFlowThread->objectInFlowRegion(contentNode->renderer(), renderRegion))
 90 regionNodes.append(renderRegion->node());
 91 }
7792 }
7893 }
 94
7995 return StaticNodeList::adopt(regionNodes);
8096}
8197
8298PassRefPtr<NodeList> WebKitNamedFlow::contentNodes() const
8399{
84  m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets();
85 
86100 Vector<RefPtr<Node> > contentNodes;
87  for (NamedFlowContentNodes::const_iterator it = m_parentFlowThread->contentNodes().begin(); it != m_parentFlowThread->contentNodes().end(); ++it) {
88  Node* node = const_cast<Node*>(*it);
89  ASSERT(node->computedStyle()->flowThread() == m_parentFlowThread->flowThreadName());
90  contentNodes.append(node);
 101
 102 if (m_flowManager->document())
 103 m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
 104
 105 // The renderer may be destroyed or created after the style update.
 106 // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
 107 if (m_parentFlowThread) {
 108 const NamedFlowContentNodes& contentNodesList = m_parentFlowThread->contentNodes();
 109 for (NamedFlowContentNodes::const_iterator it = contentNodesList.begin(); it != contentNodesList.end(); ++it) {
 110 Node* node = const_cast<Node*>(*it);
 111 ASSERT(node->computedStyle()->flowThread() == m_parentFlowThread->flowThreadName());
 112 contentNodes.append(node);
 113 }
91114 }
92115
93116 return StaticNodeList::adopt(contentNodes);
94117}
 118
 119void WebKitNamedFlow::setRenderer(RenderNamedFlowThread* parentFlowThread)
 120{
 121 // The named flow can either go from a no_renderer->renderer or renderer->no_renderer state; anything else could indicate a bug.
 122 ASSERT((!m_parentFlowThread && parentFlowThread) || (m_parentFlowThread && !parentFlowThread));
 123
 124 m_parentFlowThread = parentFlowThread;
 125
 126 // A named flow that loses the renderer is in the "NULL" state.
 127 if (!m_parentFlowThread)
 128 m_flowManager->moveNamedFlowToNullState(this);
 129}
95130
96131} // namespace WebCore
97132

Source/WebCore/dom/WebKitNamedFlow.h

3131#define WebKitNamedFlow_h
3232
3333#include <Node.h>
 34#include <WebKitNamedFlowCollection.h>
3435#include <wtf/ListHashSet.h>
3536#include <wtf/RefCounted.h>
3637#include <wtf/RefPtr.h>

@@namespace WebCore {
3940
4041class NodeList;
4142class RenderNamedFlowThread;
 43class WebKitNamedFlowCollection;
4244
4345class WebKitNamedFlow : public RefCounted<WebKitNamedFlow> {
4446public:
45  static PassRefPtr<WebKitNamedFlow> create(RenderNamedFlowThread* parentFlowThread)
 47 static PassRefPtr<WebKitNamedFlow> create(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName)
4648 {
47  return adoptRef(new WebKitNamedFlow(parentFlowThread));
 49 return adoptRef(new WebKitNamedFlow(manager, flowThreadName));
4850 }
4951
5052 ~WebKitNamedFlow();

@@public:
5456 PassRefPtr<NodeList> getRegionsByContentNode(Node*);
5557 PassRefPtr<NodeList> contentNodes() const;
5658
 59 void setRenderer(RenderNamedFlowThread* parentFlowThread);
 60
 61 enum FlowState {
 62 FlowStateCreated,
 63 FlowStateNull
 64 };
 65
 66 FlowState getFlowState() const { return m_state; }
 67 void switchFlowState() { m_state = m_state == FlowStateNull ? FlowStateCreated : FlowStateNull; }
 68
5769private:
58  WebKitNamedFlow(RenderNamedFlowThread*);
 70 WebKitNamedFlow(PassRefPtr<WebKitNamedFlowCollection>, const AtomicString&);
5971
 72 // The name of the flow thread as specified in CSS.
 73 AtomicString m_flowThreadName;
 74
 75 RefPtr<WebKitNamedFlowCollection> m_flowManager;
6076 RenderNamedFlowThread* m_parentFlowThread;
 77
 78 FlowState m_state;
6179};
6280
6381}

Source/WebCore/dom/WebKitNamedFlowCollection.cpp

 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
 39namespace WebCore {
 40
 41WebKitNamedFlowCollection::WebKitNamedFlowCollection(Document* doc)
 42 : m_document(doc)
 43 , m_createdFlowsCount(0)
 44{
 45}
 46
 47WebKitNamedFlowCollection::~WebKitNamedFlowCollection()
 48{
 49}
 50
 51unsigned WebKitNamedFlowCollection::length() const
 52{
 53 return m_createdFlowsCount;
 54}
 55
 56WebKitNamedFlow* WebKitNamedFlowCollection::item(unsigned index) const
 57{
 58 if (index >= m_createdFlowsCount)
 59 return 0;
 60
 61 NamedFlowSet::const_iterator end = m_namedFlows.end();
 62 for (NamedFlowSet::const_iterator it = m_namedFlows.begin(); it != end; ++it) {
 63 WebKitNamedFlow* namedFlow = *it;
 64 if (namedFlow->getFlowState() == WebKitNamedFlow::FlowStateCreated) {
 65 if (!index)
 66 return namedFlow;
 67 --index;
 68 }
 69 }
 70
 71 return 0;
 72}
 73
 74WebKitNamedFlow* WebKitNamedFlowCollection::getFlowByName(const String& flowName)
 75{
 76 NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName);
 77 if (it == m_namedFlows.end() || (*it)->getFlowState() == WebKitNamedFlow::FlowStateNull)
 78 return 0;
 79
 80 return *it;
 81}
 82
 83PassRefPtr<WebKitNamedFlow> WebKitNamedFlowCollection::ensureNamedFlowInCreatedState(const String& flowName)
 84{
 85 NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName);
 86 if (it != m_namedFlows.end()) {
 87 WebKitNamedFlow* namedFlow = *it;
 88 ASSERT(namedFlow->getFlowState() == WebKitNamedFlow::FlowStateNull);
 89 if (namedFlow->getFlowState() == WebKitNamedFlow::FlowStateNull) {
 90 namedFlow->switchFlowState();
 91 ++m_createdFlowsCount;
 92 }
 93
 94 return namedFlow;
 95 }
 96
 97 RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(this, flowName);
 98 m_namedFlows.add(newFlow.get());
 99 ++m_createdFlowsCount;
 100
 101 return newFlow.release();
 102}
 103
 104void WebKitNamedFlowCollection::moveNamedFlowToNullState(WebKitNamedFlow* namedFlow)
 105{
 106 ASSERT(namedFlow->getFlowState() == WebKitNamedFlow::FlowStateCreated);
 107 ASSERT(m_createdFlowsCount > 0);
 108
 109 namedFlow->switchFlowState();
 110 --m_createdFlowsCount;
 111}
 112
 113void WebKitNamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow)
 114{
 115 // The document is not valid anymore so the collection will be destroyed anyway.
 116 if (!m_document)
 117 return;
 118
 119 ASSERT(namedFlow->getFlowState() == WebKitNamedFlow::FlowStateNull);
 120 ASSERT(m_namedFlows.contains(namedFlow));
 121
 122 m_namedFlows.remove(namedFlow);
 123}
 124
 125void WebKitNamedFlowCollection::documentDestroyed()
 126{
 127 m_document = 0;
 128}
 129
 130struct WebKitNamedFlowCollection::NamedFlowHashFunctions {
 131 static unsigned hash(WebKitNamedFlow* key) { return DefaultHash<String>::Hash::hash(key->name()); }
 132 static bool equal(WebKitNamedFlow* a, WebKitNamedFlow* b) { return a->name() == b->name(); }
 133 static const bool safeToCompareToEmptyOrDeleted = true;
 134};
 135
 136struct WebKitNamedFlowCollection::NamedFlowHashTranslator {
 137 static unsigned hash(const String& key) { return DefaultHash<String>::Hash::hash(key); }
 138 static bool equal(WebKitNamedFlow* a, const String& b) { return a->name() == b; }
 139};
 140
 141} // namespace WebCore

Source/WebCore/dom/WebKitNamedFlowCollection.h

 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
 38namespace WebCore {
 39
 40class Document;
 41class WebKitNamedFlow;
 42
 43class WebKitNamedFlowCollection : public RefCounted<WebKitNamedFlowCollection> {
 44public:
 45 static PassRefPtr<WebKitNamedFlowCollection> create(Document* doc) { return adoptRef(new WebKitNamedFlowCollection(doc)); }
 46 ~WebKitNamedFlowCollection();
 47
 48 unsigned length() const;
 49 WebKitNamedFlow* item(unsigned index) const;
 50
 51 WebKitNamedFlow* getFlowByName(const String&);
 52 PassRefPtr<WebKitNamedFlow> ensureNamedFlowInCreatedState(const String&);
 53
 54 void moveNamedFlowToNullState(WebKitNamedFlow*);
 55 void discardNamedFlow(WebKitNamedFlow*);
 56
 57 void documentDestroyed();
 58
 59 Document* document() const { return m_document; }
 60
 61private:
 62 WebKitNamedFlowCollection(Document*);
 63
 64 Document* m_document;
 65
 66 struct NamedFlowHashFunctions;
 67 struct NamedFlowHashTranslator;
 68
 69 typedef ListHashSet<WebKitNamedFlow*, 1, NamedFlowHashFunctions> NamedFlowSet;
 70
 71 unsigned m_createdFlowsCount;
 72 NamedFlowSet m_namedFlows;
 73};
 74
 75} // namespace WebCore
 76
 77#endif // WebKitNamedFlowCollection_h

Source/WebCore/rendering/FlowThreadController.cpp

3333
3434#include "RenderFlowThread.h"
3535#include "RenderNamedFlowThread.h"
 36#include "WebKitNamedFlow.h"
 37#include "WebKitNamedFlowCollection.h"
3638#include <wtf/text/AtomicString.h>
3739
3840namespace WebCore {

@@RenderNamedFlowThread* FlowThreadController::ensureRenderFlowThreadWithName(cons
6567 }
6668 }
6769
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->getFlowByName(name));
 74
 75 RenderNamedFlowThread* flowRenderer = new (m_view->renderArena()) RenderNamedFlowThread(m_view->document(), namedFlows->ensureNamedFlowInCreatedState(name));
6976 flowRenderer->setStyle(RenderFlowThread::createFlowThreadStyle(m_view->style()));
7077 m_renderNamedFlowThreadList->add(flowRenderer);
7178

@@void FlowThreadController::unregisterNamedFlowContentNode(Node* contentNode)
122129 m_mapNamedFlowContentNodes.remove(contentNode);
123130}
124131
 132void FlowThreadController::removeFlowThread(RenderNamedFlowThread* flowThread)
 133{
 134 m_renderNamedFlowThreadList->remove(flowThread);
 135 setIsRenderNamedFlowThreadOrderDirty(true);
 136}
 137
125138} // namespace WebCore

Source/WebCore/rendering/FlowThreadController.h

@@public:
6464
6565 void registerNamedFlowContentNode(Node*, RenderNamedFlowThread*);
6666 void unregisterNamedFlowContentNode(Node*);
 67
 68 void removeFlowThread(RenderNamedFlowThread*);
6769
6870protected:
6971 FlowThreadController(RenderView*);

Source/WebCore/rendering/RenderNamedFlowThread.cpp

3333
3434namespace WebCore {
3535
36 RenderNamedFlowThread::RenderNamedFlowThread(Node* node, const AtomicString& name)
 36RenderNamedFlowThread::RenderNamedFlowThread(Node* node, PassRefPtr<WebKitNamedFlow> namedFlow)
3737 : RenderFlowThread(node)
38  , m_flowThreadName(name)
 38 , m_namedFlow(namedFlow)
3939{
 40 m_namedFlow->setRenderer(this);
 41}
 42
 43RenderNamedFlowThread::~RenderNamedFlowThread()
 44{
 45 m_namedFlow->setRenderer(0);
4046}
4147
4248const char* RenderNamedFlowThread::renderName() const

@@const char* RenderNamedFlowThread::renderName() const
4450 return "RenderNamedFlowThread";
4551}
4652
47 
4853RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const
4954{
5055 FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin();

@@void RenderNamedFlowThread::removeRegionFromThread(RenderRegion* renderRegion)
182187 removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread());
183188 }
184189
 190 if (canBeDestroyed()) {
 191 destroy();
 192 return;
 193 }
 194
185195 invalidateRegions();
186196}
187197
188 
189198void RenderNamedFlowThread::checkInvalidRegions()
190199{
191200 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {

@@void RenderNamedFlowThread::pushDependencies(RenderNamedFlowThreadList& list)
245254 }
246255}
247256
248 WebKitNamedFlow* RenderNamedFlowThread::ensureNamedFlow()
249 {
250  if (!m_namedFlow)
251  m_namedFlow = WebKitNamedFlow::create(this);
252 
253  return m_namedFlow.get();
254 }
255 
256257// The content nodes list contains those nodes with -webkit-flow-into: flow.
257258// An element with display:none should also be listed among those nodes.
258259// The list of nodes is ordered.

@@void RenderNamedFlowThread::unregisterNamedFlowContentNode(Node* contentNode)
283284 contentNode->clearInNamedFlow();
284285 m_contentNodes.remove(contentNode);
285286
 287 if (canBeDestroyed())
 288 destroy();
 289}
 290
 291AtomicString RenderNamedFlowThread::flowThreadName() const
 292{
 293 return m_namedFlow->name();
 294}
 295
 296void RenderNamedFlowThread::willBeDestroyed()
 297{
 298 if (!documentBeingDestroyed())
 299 view()->flowThreadController()->removeFlowThread(this);
 300
 301 RenderFlowThread::willBeDestroyed();
286302}
287303
288304}

Source/WebCore/rendering/RenderNamedFlowThread.h

@@typedef ListHashSet<Node*> NamedFlowContentNodes;
4444
4545class RenderNamedFlowThread : public RenderFlowThread {
4646public:
47  RenderNamedFlowThread(Node*, const AtomicString&);
 47 RenderNamedFlowThread(Node*, PassRefPtr<WebKitNamedFlow>);
 48 virtual ~RenderNamedFlowThread();
4849
49  AtomicString flowThreadName() const { return m_flowThreadName; }
 50 AtomicString flowThreadName() const;
5051
5152 RenderObject* nextRendererForNode(Node*) const;
5253 RenderObject* previousRendererForNode(Node*) const;

@@public:
6364 virtual void addRegionToThread(RenderRegion*) OVERRIDE;
6465 virtual void removeRegionFromThread(RenderRegion*) OVERRIDE;
6566
66  WebKitNamedFlow* ensureNamedFlow();
6767 void registerNamedFlowContentNode(Node*);
6868 void unregisterNamedFlowContentNode(Node*);
6969 const NamedFlowContentNodes& contentNodes() const { return m_contentNodes; }
7070 bool hasContentNode(Node* contentNode) const { ASSERT(contentNode); return m_contentNodes.contains(contentNode); }
7171
 72protected:
 73 virtual void willBeDestroyed() OVERRIDE;
 74
7275private:
7376 virtual const char* renderName() const OVERRIDE;
7477 virtual bool isRenderNamedFlowThread() const OVERRIDE { return true; }

@@private:
7780 void addDependencyOnFlowThread(RenderNamedFlowThread*);
7881 void removeDependencyOnFlowThread(RenderNamedFlowThread*);
7982 void checkInvalidRegions();
 83 inline bool canBeDestroyed() const { return m_regionList.isEmpty() && m_contentNodes.isEmpty(); }
8084
8185private:
82  // The name of the flow thread as specified in CSS.
83  AtomicString m_flowThreadName;
84 
8586 // Observer flow threads have invalid regions that depend on the state of this thread
8687 // to re-validate their regions. Keeping a set of observer threads make it easy
8788 // to notify them when a region was removed from this flow.

LayoutTests/ChangeLog

 12012-06-21 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/webkit-named-flow-content-nodes-expected.txt:
 12 * fast/regions/webkit-named-flow-content-nodes.html:
 13 * fast/regions/webkit-named-flow-flow-added.html:
 14 * fast/regions/webkit-named-flow-invalid-name.html:
 15 * fast/regions/webkit-named-flow-modified-flow.html:
 16 * fast/regions/webkit-named-flow-non-existing-flow.html:
 17 * fast/regions/webkit-named-flow-removed-flow.html:
 18 * platform/chromium-win/fast/regions/region-style-block-background-color2-expected.txt:
 19 * platform/mac/fast/regions/region-style-block-background-color2-expected.txt:
 20
1212012-06-22 Csaba Osztrogonác <ossy@webkit.org>
222
323 [Qt] Unreviewed gardening after r120924.

LayoutTests/fast/regions/webkit-named-flow-content-nodes-expected.txt

@@Test for 80134: [CSSRegions]Implement NamedFlow::contentNodes
33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
44
55
6 PASS namedFlowContentNodes is non-null.
7 PASS namedFlowContentNodes.length is 0
8 PASS namedFlowContentNodes instanceof NodeList is true
9 PASS namedFlowContentNodes2.length is 0
 6PASS document.webkitGetFlowByName("flow") is null
107PASS namedFlowContentNodes3.length is 1
118PASS namedFlowContentNodes3.item(0).id is "article"
129PASS namedFlowContentNodes4.length is 1

@@PASS namedFlowContentNodes10.item(0).id is "article"
2623PASS namedFlowContentNodes11.length is 5
2724PASS namedFlowContentNodes12.length is 1
2825PASS namedFlowContentNodes12.item(0).id is "article"
29 PASS namedFlowContentNodes10.length is 0
3026PASS namedFlowContentNodes11.length is 0
3127PASS namedFlowContentNodes12.length is 1
3228PASS namedFlowContentNodes12.item(0).id is "article"
 29PASS document.webkitGetFlowByName("flow2") is null
3330PASS namedFlowContentNodes13.length is 0
3431PASS namedFlowContentNodes14.length is 0
 32PASS namedFlowContentNodes15.length is 1
3533PASS successfullyParsed is true
3634
3735TEST COMPLETE

LayoutTests/fast/regions/webkit-named-flow-content-nodes.html

2121 window.layoutTestController.dumpAsText();
2222 description("Test for 80134: [CSSRegions]Implement NamedFlow::contentNodes");
2323
24  // First time ask for a named flow object, the contentNodes should be empty.
25  var namedFlowContentNodes = document.webkitGetFlowByName("flow").contentNodes;
26  shouldBeNonNull("namedFlowContentNodes");
27  shouldEvaluateTo("namedFlowContentNodes.length", 0);
28  shouldBeTrue("namedFlowContentNodes instanceof NodeList");
29 
3024 // Add an element that would be collected by the named flow but do not add it to the DOM, the contentNodes should be empty.
3125 var article = document.createElement("div");
3226 article.id = "article";
3327 article.style.webkitFlowInto = "flow";
34  var namedFlowContentNodes2 = document.webkitGetFlowByName("flow").contentNodes;
35  shouldEvaluateTo("namedFlowContentNodes2.length", 0);
 28
 29 shouldBeNull('document.webkitGetFlowByName("flow")');
3630
3731 // Append the above element to the DOM. It will be collected by the flow, therefore the contentNodes should have 1 element.
3832 document.body.appendChild(article);

5852
5953 var namedFlowContentNodes5 = document.webkitGetFlowByName("flow").contentNodes;
6054 shouldEvaluateTo("namedFlowContentNodes5.length", 2);
61  shouldBeEqualToString("namedFlowContentNodes5.item(0).id", "article2");
62  shouldBeEqualToString("namedFlowContentNodes5.item(1).id", "article");
 55 shouldBeEqualToString("namedFlowContentNodes5.item(0).id", "article2");
 56 shouldBeEqualToString("namedFlowContentNodes5.item(1).id", "article");
6357
6458 // Adding a region element to flow content into should not influence the content nodes collection.
6559 var regionNode = document.createElement("div");

8983 document.getElementById("article").style.display = "none";
9084 var namedFlowContentNodes9 = document.webkitGetFlowByName("flow").contentNodes;
9185 shouldEvaluateTo("namedFlowContentNodes9.length", 3);
92  shouldBeEqualToString("namedFlowContentNodes9.item(0).id", "article2");
93  shouldBeEqualToString("namedFlowContentNodes9.item(1).id", "span1");
94  shouldBeEqualToString("namedFlowContentNodes9.item(2).id", "article");
 86 shouldBeEqualToString("namedFlowContentNodes9.item(0).id", "article2");
 87 shouldBeEqualToString("namedFlowContentNodes9.item(1).id", "span1");
 88 shouldBeEqualToString("namedFlowContentNodes9.item(2).id", "article");
9589
9690 // Take 'article' node from last position and insert it before 'article2'
9791 article = document.getElementById("article");
9892 document.body.insertBefore(document.body.removeChild(article), article2);
9993 var namedFlowContentNodes10 = document.webkitGetFlowByName("flow").contentNodes;
10094 shouldEvaluateTo("namedFlowContentNodes10.length", 3);
101  shouldBeEqualToString("namedFlowContentNodes10.item(0).id", "article");
 95 shouldBeEqualToString("namedFlowContentNodes10.item(0).id", "article");
10296
10397 // Clone 'article2' including its children.
10498 var article2Clone = document.getElementById("article2").cloneNode(true);

110104 document.body.removeChild(article2Clone);
111105 var namedFlowContentNodes12 = document.webkitGetFlowByName("flow").contentNodes;
112106 shouldEvaluateTo("namedFlowContentNodes12.length", 1);
113  shouldBeEqualToString("namedFlowContentNodes12.item(0).id", "article");
114 
115  // Get the content nodes for another flow, flow2.
116  var namedFlowContentNodes10 = document.webkitGetFlowByName("flow2").contentNodes;
117  shouldEvaluateTo("namedFlowContentNodes10.length", "0");
 107 shouldBeEqualToString("namedFlowContentNodes12.item(0).id", "article");
118108
119109 // Move the content node 'article' from named flow 'flow' to named flow 'flow2'
120110 document.getElementById("article").style.webkitFlowInto = "flow2";
 111
 112 var flow2 = document.webkitGetFlowByName("flow2");
121113 var namedFlowContentNodes11 = document.webkitGetFlowByName("flow").contentNodes;
122114 var namedFlowContentNodes12 = document.webkitGetFlowByName("flow2").contentNodes;
123115 shouldEvaluateTo("namedFlowContentNodes11.length", "0");

126118
127119 // Remove the content node from dom, content nodes for both 'flow' and 'flow2' should be empty
128120 document.body.removeChild(document.getElementById("article"));
 121 shouldBeNull('document.webkitGetFlowByName("flow2")');
 122
129123 var namedFlowContentNodes13 = document.webkitGetFlowByName("flow").contentNodes;
130  var namedFlowContentNodes14 = document.webkitGetFlowByName("flow2").contentNodes;
131124 shouldEvaluateTo("namedFlowContentNodes13.length", "0");
 125
 126 var namedFlowContentNodes14 = flow2.contentNodes;
132127 shouldEvaluateTo("namedFlowContentNodes14.length", "0");
 128 document.body.appendChild(article);
 129 var namedFlowContentNodes15 = flow2.contentNodes;
 130 shouldEvaluateTo("namedFlowContentNodes15.length", "1");
133131
134132 document.getElementById("region").style.visibility = "hidden";
135133 </script>

LayoutTests/fast/regions/webkit-named-flow-flow-added.html

4343 function test()
4444 {
4545 namedFlow2 = document.webkitGetFlowByName("flow");
46  if (namedFlow && namedFlow2) {
 46 if (!namedFlow && namedFlow2) {
4747 document.getElementById("result").innerText = "PASS";
4848 document.getElementById("result").className = "pass";
4949 }

LayoutTests/fast/regions/webkit-named-flow-invalid-name.html

2222 assert(nullNamedFlow == null, "Named flow for " + arrFlowInvalidNames[i] + " should be null");
2323 }
2424
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.
2626 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");
2828 </script>
2929 </body>
3030</html>

LayoutTests/fast/regions/webkit-named-flow-modified-flow.html

4747 {
4848 var namedFlow = document.webkitGetFlowByName("flow");
4949 var namedFlow2 = document.webkitGetFlowByName("flow2");
50  if (namedFlow && namedFlow2) {
 50 if (!namedFlow && namedFlow2) {
5151 document.getElementById("result").innerText = "PASS";
5252 document.getElementById("result").className = "pass";
5353 }

LayoutTests/fast/regions/webkit-named-flow-non-existing-flow.html

2929 layoutTestController.dumpAsText();
3030
3131 var namedFlow = document.webkitGetFlowByName("flow");
32  if (namedFlow) {
 32 if (!namedFlow) {
3333 document.getElementById("result").innerText = "PASS";
3434 document.getElementById("result").className = "pass";
3535 }

LayoutTests/fast/regions/webkit-named-flow-removed-flow.html

4343 function test()
4444 {
4545 namedFlow2 = document.webkitGetFlowByName("flow");
46  if (namedFlow && namedFlow2) {
 46 if (namedFlow && !namedFlow2) {
4747 document.getElementById("result").innerText = "PASS";
4848 document.getElementById("result").className = "pass";
4949 }

LayoutTests/platform/chromium-win/fast/regions/region-style-block-background-color2-expected.txt

@@Flow Threads
2929 text run at (0,0) width 245: "Green background text styled in region1."
3030 Regions for flow 'flow1'
3131 RenderRegion {DIV} #region1 region style: 1
32  Thread with flow-name 'flow2'
3332 Thread with flow-name 'flow3'
3433 layer at (0,0) size 280x80
3534 RenderNamedFlowThread at (0,0) size 280x80

LayoutTests/platform/mac/fast/regions/region-style-block-background-color2-expected.txt

@@Flow Threads
2929 text run at (0,0) width 258: "Green background text styled in region1."
3030 Regions for flow 'flow1'
3131 RenderRegion {DIV} #region1 region style: 1
32  Thread with flow-name 'flow2'
3332 Thread with flow-name 'flow3'
3433 layer at (0,0) size 280x80
3534 RenderNamedFlowThread at (0,0) size 280x80