Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (126960 => 126961)
--- trunk/Source/WebCore/CMakeLists.txt 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/CMakeLists.txt 2012-08-29 06:29:34 UTC (rev 126961)
@@ -2035,7 +2035,6 @@
rendering/RenderFlexibleBox.cpp
rendering/RenderGrid.cpp
rendering/RenderFlowThread.cpp
- rendering/RenderFlowThreadContainer.cpp
rendering/RenderFrame.cpp
rendering/RenderFrameBase.cpp
rendering/RenderFrameSet.cpp
Modified: trunk/Source/WebCore/ChangeLog (126960 => 126961)
--- trunk/Source/WebCore/ChangeLog 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/ChangeLog 2012-08-29 06:29:34 UTC (rev 126961)
@@ -1,3 +1,55 @@
+2012-08-28 Andrei Bucur <[email protected]>
+
+ Layout Test fast/repaint/japanese-rl-selection-repaint-in-regions.html is failing after r126304
+ https://bugs.webkit.org/show_bug.cgi?id=94730
+
+ Reviewed by Adam Barth.
+
+ Having an intermediary node between the named flow renderers and the view may introduce subtle bugs that are hard to track. Also it doesn't fix
+ the pointless destruction of a RenderNamedFlowThread in some special cases (e.g. region->detach, destroy flow thread, region->attach, recreate flow
+ thread).
+ This patch proposes a new way of lazily destroying the renderers for NULL named flows, at layout time. When a renderer has no content nodes or regions
+ attached, its named flow is considered to be in the NULL state. When starting a layout process it is a good time to go through the renderers of the
+ NULL named flows and destroy them.
+
+ Tests: No functional change, the old tests should pass without issues.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/WebKitNamedFlow.cpp:
+ (WebCore::WebKitNamedFlow::getRegionsByContent):
+ (WebCore::WebKitNamedFlow::getRegions):
+ (WebCore::WebKitNamedFlow::setRenderer):
+ * rendering/FlowThreadController.cpp:
+ (WebCore::FlowThreadController::FlowThreadController):
+ (WebCore::FlowThreadController::ensureRenderFlowThreadWithName):
+ (WebCore::FlowThreadController::layoutRenderNamedFlowThreads):
+ * rendering/FlowThreadController.h:
+ (WebCore):
+ (FlowThreadController):
+ * rendering/RenderFlowThreadContainer.cpp: Removed.
+ * rendering/RenderFlowThreadContainer.h: Removed.
+ * rendering/RenderNamedFlowThread.cpp:
+ (WebCore::RenderNamedFlowThread::RenderNamedFlowThread):
+ (WebCore::RenderNamedFlowThread::~RenderNamedFlowThread):
+ (WebCore::RenderNamedFlowThread::addRegionToThread):
+ (WebCore::RenderNamedFlowThread::removeRegionFromThread):
+ (WebCore::RenderNamedFlowThread::registerNamedFlowContentNode):
+ (WebCore::RenderNamedFlowThread::unregisterNamedFlowContentNode):
+ (WebCore::RenderNamedFlowThread::setMarkForDestruction):
+ (WebCore):
+ (WebCore::RenderNamedFlowThread::resetMarkForDestruction):
+ (WebCore::RenderNamedFlowThread::isMarkedForDestruction):
+ * rendering/RenderNamedFlowThread.h:
+ (RenderNamedFlowThread):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::markContainingBlocksForLayout):
+ * rendering/RenderObject.h:
+
2012-08-28 Kenichi Ishibashi <[email protected]>
style->fontMetrics() should be available when setting line-height
Modified: trunk/Source/WebCore/GNUmakefile.list.am (126960 => 126961)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-08-29 06:29:34 UTC (rev 126961)
@@ -4899,8 +4899,6 @@
Source/WebCore/rendering/RenderFlexibleBox.h \
Source/WebCore/rendering/RenderFlowThread.cpp \
Source/WebCore/rendering/RenderFlowThread.h \
- Source/WebCore/rendering/RenderFlowThreadContainer.cpp \
- Source/WebCore/rendering/RenderFlowThreadContainer.h \
Source/WebCore/rendering/RenderFrameBase.cpp \
Source/WebCore/rendering/RenderFrameBase.h \
Source/WebCore/rendering/RenderFrame.cpp \
Modified: trunk/Source/WebCore/Target.pri (126960 => 126961)
--- trunk/Source/WebCore/Target.pri 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/Target.pri 2012-08-29 06:29:34 UTC (rev 126961)
@@ -1120,7 +1120,6 @@
rendering/RenderFileUploadControl.cpp \
rendering/RenderFlexibleBox.cpp \
rendering/RenderFlowThread.cpp \
- rendering/RenderFlowThreadContainer.cpp \
rendering/RenderFrame.cpp \
rendering/RenderFrameBase.cpp \
rendering/RenderFrameSet.cpp \
Modified: trunk/Source/WebCore/WebCore.gypi (126960 => 126961)
--- trunk/Source/WebCore/WebCore.gypi 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/WebCore.gypi 2012-08-29 06:29:34 UTC (rev 126961)
@@ -563,7 +563,6 @@
'rendering/RenderBoxModelObject.h',
'rendering/RenderEmbeddedObject.h',
'rendering/RenderFlowThread.h',
- 'rendering/RenderFlowThreadContainer.h',
'rendering/RenderImage.h',
'rendering/RenderImageResource.h',
'rendering/RenderImageResourceStyleImage.h',
@@ -4728,8 +4727,6 @@
'rendering/RenderFlexibleBox.h',
'rendering/RenderFlowThread.cpp',
'rendering/RenderFlowThread.h',
- 'rendering/RenderFlowThreadContainer.cpp',
- 'rendering/RenderFlowThreadContainer.h',
'rendering/RenderFrame.cpp',
'rendering/RenderFrame.h',
'rendering/RenderFrameBase.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (126960 => 126961)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-08-29 06:29:34 UTC (rev 126961)
@@ -39759,14 +39759,6 @@
>
</File>
<File
- RelativePath="..\rendering\RenderFlowThreadContainer.cpp"
- >
- </File>
- <File
- RelativePath="..\rendering\RenderFlowThreadContainer.h"
- >
- </File>
- <File
RelativePath="..\rendering\svg\RenderForeignObject.cpp"
>
<FileConfiguration
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (126960 => 126961)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-08-29 06:29:34 UTC (rev 126961)
@@ -1700,8 +1700,6 @@
5DFE8F560D16477B0076E937 /* ScheduledAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA378BA0D15F64200B793D6 /* ScheduledAction.cpp */; };
5DFE8F570D16477C0076E937 /* ScheduledAction.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA378BB0D15F64200B793D6 /* ScheduledAction.h */; };
5FC7DC26CFE2563200B85AE4 /* JSEventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 5FC7DC26CFE2563200B85AE5 /* JSEventTarget.h */; };
- 603EA36015DD1D7000E150E6 /* RenderFlowThreadContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 603EA35E15DD1D7000E150E6 /* RenderFlowThreadContainer.cpp */; };
- 603EA36115DD1D7000E150E6 /* RenderFlowThreadContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 603EA35F15DD1D7000E150E6 /* RenderFlowThreadContainer.h */; };
626CDE0E1140424C001E5A68 /* SpatialNavigation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 626CDE0C1140424C001E5A68 /* SpatialNavigation.cpp */; };
626CDE0F1140424C001E5A68 /* SpatialNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 626CDE0D1140424C001E5A68 /* SpatialNavigation.h */; settings = {ATTRIBUTES = (Private, ); }; };
628D214C12131ED10055DCFC /* NetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 628D214B12131ED10055DCFC /* NetworkingContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8859,8 +8857,6 @@
5DB1BC6910715A6400EFAA49 /* TransformSourceLibxslt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransformSourceLibxslt.cpp; sourceTree = "<group>"; };
5DC87EEF11716DF2001C0E6D /* EmptyProtocolDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmptyProtocolDefinitions.h; sourceTree = "<group>"; };
5FC7DC26CFE2563200B85AE5 /* JSEventTarget.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSEventTarget.h; sourceTree = "<group>"; };
- 603EA35E15DD1D7000E150E6 /* RenderFlowThreadContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFlowThreadContainer.cpp; sourceTree = "<group>"; };
- 603EA35F15DD1D7000E150E6 /* RenderFlowThreadContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderFlowThreadContainer.h; sourceTree = "<group>"; };
626CDE0C1140424C001E5A68 /* SpatialNavigation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpatialNavigation.cpp; sourceTree = "<group>"; };
626CDE0D1140424C001E5A68 /* SpatialNavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpatialNavigation.h; sourceTree = "<group>"; };
628D214B12131ED10055DCFC /* NetworkingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkingContext.h; sourceTree = "<group>"; };
@@ -21345,8 +21341,6 @@
53C8298C13D8D92700DE2DEB /* RenderFlexibleBox.h */,
508CCA4E13CF106B003151F3 /* RenderFlowThread.cpp */,
508CCA4D13CF106B003151F3 /* RenderFlowThread.h */,
- 603EA35E15DD1D7000E150E6 /* RenderFlowThreadContainer.cpp */,
- 603EA35F15DD1D7000E150E6 /* RenderFlowThreadContainer.h */,
A871DECC0A1530C700B12A68 /* RenderFrame.cpp */,
A871DECB0A1530C700B12A68 /* RenderFrame.h */,
0FD3080C117CF7E700A791F7 /* RenderFrameBase.cpp */,
@@ -24618,7 +24612,6 @@
066C77310AB603FD00238CC4 /* RenderFileUploadControl.h in Headers */,
53C8298E13D8D92700DE2DEB /* RenderFlexibleBox.h in Headers */,
508CCA4F13CF106B003151F3 /* RenderFlowThread.h in Headers */,
- 603EA36115DD1D7000E150E6 /* RenderFlowThreadContainer.h in Headers */,
A871DED30A1530C700B12A68 /* RenderFrame.h in Headers */,
0FD3080F117CF7E700A791F7 /* RenderFrameBase.h in Headers */,
A871DED10A1530C700B12A68 /* RenderFrameSet.h in Headers */,
@@ -27860,7 +27853,6 @@
066C77300AB603FD00238CC4 /* RenderFileUploadControl.cpp in Sources */,
53C8298D13D8D92700DE2DEB /* RenderFlexibleBox.cpp in Sources */,
508CCA5013CF106B003151F3 /* RenderFlowThread.cpp in Sources */,
- 603EA36015DD1D7000E150E6 /* RenderFlowThreadContainer.cpp in Sources */,
A871DED40A1530C700B12A68 /* RenderFrame.cpp in Sources */,
0FD3080E117CF7E700A791F7 /* RenderFrameBase.cpp in Sources */,
A871DED20A1530C700B12A68 /* RenderFrameSet.cpp in Sources */,
Modified: trunk/Source/WebCore/dom/WebKitNamedFlow.cpp (126960 => 126961)
--- trunk/Source/WebCore/dom/WebKitNamedFlow.cpp 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/dom/WebKitNamedFlow.cpp 2012-08-29 06:29:34 UTC (rev 126961)
@@ -117,7 +117,7 @@
const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
const RenderRegion* renderRegion = *iter;
- // FIXME: Pseudo-elements are not included in the list
+ // FIXME: Pseudo-elements are not included in the list.
if (!renderRegion->isValid() || !renderRegion->node())
continue;
if (m_parentFlowThread->objectInFlowRegion(contentNode->renderer(), renderRegion))
@@ -143,7 +143,7 @@
const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
const RenderRegion* renderRegion = *iter;
- // FIXME: Pseudo-elements are not included in the list
+ // FIXME: Pseudo-elements are not included in the list.
if (!renderRegion->isValid() || !renderRegion->node())
continue;
regionNodes.append(renderRegion->node());
@@ -179,7 +179,7 @@
// The named flow can either go from a no_renderer->renderer or renderer->no_renderer state; anything else could indicate a bug.
ASSERT((!m_parentFlowThread && parentFlowThread) || (m_parentFlowThread && !parentFlowThread));
- // If parentFlowThread is 0, the flow thread will move in the "NULL" state"
+ // If parentFlowThread is 0, the flow thread will move in the "NULL" state.
m_parentFlowThread = parentFlowThread;
}
Modified: trunk/Source/WebCore/rendering/FlowThreadController.cpp (126960 => 126961)
--- trunk/Source/WebCore/rendering/FlowThreadController.cpp 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/rendering/FlowThreadController.cpp 2012-08-29 06:29:34 UTC (rev 126961)
@@ -33,7 +33,6 @@
#include "NamedFlowCollection.h"
#include "RenderFlowThread.h"
-#include "RenderFlowThreadContainer.h"
#include "RenderNamedFlowThread.h"
#include "StyleInheritedData.h"
#include "WebKitNamedFlow.h"
@@ -49,7 +48,6 @@
FlowThreadController::FlowThreadController(RenderView* view)
: m_view(view)
, m_currentRenderFlowThread(0)
- , m_flowThreadContainer(0)
, m_isRenderNamedFlowThreadOrderDirty(false)
{
}
@@ -60,11 +58,6 @@
RenderNamedFlowThread* FlowThreadController::ensureRenderFlowThreadWithName(const AtomicString& name)
{
- if (!m_flowThreadContainer) {
- m_flowThreadContainer = new (m_view->renderArena()) RenderFlowThreadContainer(m_view->document());
- m_flowThreadContainer->setStyle(RenderFlowThread::createFlowThreadStyle(m_view->style()));
- m_view->addChild(m_flowThreadContainer);
- }
if (!m_renderNamedFlowThreadList)
m_renderNamedFlowThreadList = adoptPtr(new RenderNamedFlowThreadList());
else {
@@ -84,8 +77,8 @@
flowRenderer->setStyle(RenderFlowThread::createFlowThreadStyle(m_view->style()));
m_renderNamedFlowThreadList->add(flowRenderer);
- // Keep the flow renderer as a child of RenderFlowThreadContainer.
- m_flowThreadContainer->addChild(flowRenderer);
+ // Keep the flow renderer as a child of RenderView.
+ m_view->addChild(flowRenderer);
setIsRenderNamedFlowThreadOrderDirty(true);
@@ -105,6 +98,23 @@
{
ASSERT(m_renderNamedFlowThreadList);
+ // Remove the left-over flow threads.
+ RenderNamedFlowThreadList toRemoveList;
+ for (RenderNamedFlowThreadList::iterator iter = m_renderNamedFlowThreadList->begin(); iter != m_renderNamedFlowThreadList->end(); ++iter) {
+ RenderNamedFlowThread* flowRenderer = *iter;
+ if (flowRenderer->isMarkedForDestruction())
+ toRemoveList.add(flowRenderer);
+ }
+
+ if (toRemoveList.size() > 0)
+ setIsRenderNamedFlowThreadOrderDirty(true);
+
+ for (RenderNamedFlowThreadList::iterator iter = toRemoveList.begin(); iter != toRemoveList.end(); ++iter) {
+ RenderNamedFlowThread* flowRenderer = *iter;
+ m_renderNamedFlowThreadList->remove(flowRenderer);
+ flowRenderer->destroy();
+ }
+
if (isRenderNamedFlowThreadOrderDirty()) {
// Arrange the thread list according to dependencies.
RenderNamedFlowThreadList sortedList;
@@ -146,10 +156,4 @@
m_mapNamedFlowContentNodes.remove(contentNode);
}
-void FlowThreadController::removeFlowThread(RenderNamedFlowThread* flowThread)
-{
- m_renderNamedFlowThreadList->remove(flowThread);
- setIsRenderNamedFlowThreadOrderDirty(true);
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/FlowThreadController.h (126960 => 126961)
--- trunk/Source/WebCore/rendering/FlowThreadController.h 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/rendering/FlowThreadController.h 2012-08-29 06:29:34 UTC (rev 126961)
@@ -37,7 +37,6 @@
namespace WebCore {
class RenderFlowThread;
-class RenderFlowThreadContainer;
class RenderNamedFlowThread;
typedef ListHashSet<RenderNamedFlowThread*> RenderNamedFlowThreadList;
@@ -66,7 +65,6 @@
void registerNamedFlowContentNode(Node*, RenderNamedFlowThread*);
void unregisterNamedFlowContentNode(Node*);
- void removeFlowThread(RenderNamedFlowThread*);
protected:
FlowThreadController(RenderView*);
@@ -74,7 +72,6 @@
private:
RenderView* m_view;
RenderFlowThread* m_currentRenderFlowThread;
- RenderFlowThreadContainer* m_flowThreadContainer;
bool m_isRenderNamedFlowThreadOrderDirty;
OwnPtr<RenderNamedFlowThreadList> m_renderNamedFlowThreadList;
// maps a content node to its render flow thread.
Deleted: trunk/Source/WebCore/rendering/RenderFlowThreadContainer.cpp (126960 => 126961)
--- trunk/Source/WebCore/rendering/RenderFlowThreadContainer.cpp 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/rendering/RenderFlowThreadContainer.cpp 2012-08-29 06:29:34 UTC (rev 126961)
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- * 2. Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "RenderFlowThreadContainer.h"
-
-namespace WebCore {
-
-RenderFlowThreadContainer::RenderFlowThreadContainer(Node* node)
-: RenderFlowThread(node)
-{
-}
-
-void RenderFlowThreadContainer::layout()
-{
- ASSERT(needsLayout());
- setNeedsLayout(false);
-}
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/rendering/RenderFlowThreadContainer.h (126960 => 126961)
--- trunk/Source/WebCore/rendering/RenderFlowThreadContainer.h 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/rendering/RenderFlowThreadContainer.h 2012-08-29 06:29:34 UTC (rev 126961)
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- * 2. Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef RenderFlowThreadContainer_h
-#define RenderFlowThreadContainer_h
-
-
-#include "RenderFlowThread.h"
-
-namespace WebCore {
-
-class RenderFlowThreadContainer: public RenderFlowThread {
-public:
- RenderFlowThreadContainer(Node*);
- virtual ~RenderFlowThreadContainer() { };
-
- virtual void layout() OVERRIDE;
- virtual bool isRenderFlowThreadContainer() const OVERRIDE { return true; }
-
-private:
- virtual const char* renderName() const { return "RenderFlowThreadContainer"; }
-};
-
-} // namespace WebCore
-
-#endif // RenderFlowThread_h
Modified: trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp (126960 => 126961)
--- trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp 2012-08-29 06:29:34 UTC (rev 126961)
@@ -38,12 +38,12 @@
, m_namedFlow(namedFlow)
, m_regionLayoutUpdateEventTimer(this, &RenderNamedFlowThread::regionLayoutUpdateEventTimerFired)
{
- m_namedFlow->setRenderer(this);
}
RenderNamedFlowThread::~RenderNamedFlowThread()
{
- m_namedFlow->setRenderer(0);
+ // The RenderNamedFlowThread may be destroyed because the document is discarded. Leave the NamedFlow object in a consistent state by calling mark for destruction.
+ setMarkForDestruction();
}
const char* RenderNamedFlowThread::renderName() const
@@ -156,6 +156,8 @@
m_regionList.insertBefore(it, renderRegion);
}
+ resetMarkForDestruction();
+
ASSERT(!renderRegion->isValid());
if (renderRegion->parentNamedFlowThread()) {
if (renderRegion->parentNamedFlowThread()->dependsOn(this)) {
@@ -188,10 +190,8 @@
removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread());
}
- if (canBeDestroyed()) {
- destroy();
- return;
- }
+ if (canBeDestroyed())
+ setMarkForDestruction();
// After removing all the regions in the flow the following layout needs to dispatch the regionLayoutUpdate event
if (m_regionList.isEmpty())
@@ -268,6 +268,8 @@
contentNode->setInNamedFlow();
+ resetMarkForDestruction();
+
// Find the first content node following the new content node.
for (NamedFlowContentNodes::iterator it = m_contentNodes.begin(); it != m_contentNodes.end(); ++it) {
Node* node = *it;
@@ -290,7 +292,7 @@
m_contentNodes.remove(contentNode);
if (canBeDestroyed())
- destroy();
+ setMarkForDestruction();
}
const AtomicString& RenderNamedFlowThread::flowThreadName() const
@@ -298,14 +300,6 @@
return m_namedFlow->name();
}
-void RenderNamedFlowThread::willBeDestroyed()
-{
- if (!documentBeingDestroyed())
- view()->flowThreadController()->removeFlowThread(this);
-
- RenderFlowThread::willBeDestroyed();
-}
-
void RenderNamedFlowThread::dispatchRegionLayoutUpdateEvent()
{
RenderFlowThread::dispatchRegionLayoutUpdateEvent();
@@ -321,4 +315,28 @@
m_namedFlow->dispatchRegionLayoutUpdateEvent();
}
+void RenderNamedFlowThread::setMarkForDestruction()
+{
+ if (m_namedFlow->flowState() == WebKitNamedFlow::FlowStateNull)
+ return;
+
+ m_namedFlow->setRenderer(0);
+ // After this call ends, the renderer can be safely destroyed.
+ // The NamedFlow object may outlive its renderer if it's referenced from a script and may be reatached to one if the named flow is recreated in the stylesheet.
}
+
+void RenderNamedFlowThread::resetMarkForDestruction()
+{
+ if (m_namedFlow->flowState() == WebKitNamedFlow::FlowStateCreated)
+ return;
+
+ m_namedFlow->setRenderer(this);
+}
+
+bool RenderNamedFlowThread::isMarkedForDestruction() const
+{
+ // Flow threads in the "NULL" state can be destroyed.
+ return m_namedFlow->flowState() == WebKitNamedFlow::FlowStateNull;
+}
+
+}
Modified: trunk/Source/WebCore/rendering/RenderNamedFlowThread.h (126960 => 126961)
--- trunk/Source/WebCore/rendering/RenderNamedFlowThread.h 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowThread.h 2012-08-29 06:29:34 UTC (rev 126961)
@@ -69,9 +69,11 @@
void unregisterNamedFlowContentNode(Node*);
const NamedFlowContentNodes& contentNodes() const { return m_contentNodes; }
bool hasContentNode(Node* contentNode) const { ASSERT(contentNode); return m_contentNodes.contains(contentNode); }
+ bool isMarkedForDestruction() const;
protected:
- virtual void willBeDestroyed() OVERRIDE;
+ void setMarkForDestruction();
+ void resetMarkForDestruction();
private:
virtual const char* renderName() const OVERRIDE;
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (126960 => 126961)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2012-08-29 06:29:34 UTC (rev 126961)
@@ -640,9 +640,9 @@
if (!container && !object->isRenderView())
return;
if (!last->isText() && last->style()->hasOutOfFlowPosition()) {
- bool willSkipRelativelyPositionedInlines = !object->isRenderBlock() || object->isAnonymousBlock() || object->isRenderFlowThreadContainer();
- // Skip relatively positioned inlines and anonymous blocks (and the flow threads container) to get to the enclosing RenderBlock.
- while (object && (!object->isRenderBlock() || object->isAnonymousBlock() || object->isRenderFlowThreadContainer()))
+ bool willSkipRelativelyPositionedInlines = !object->isRenderBlock() || object->isAnonymousBlock();
+ // Skip relatively positioned inlines and anonymous blocks to get to the enclosing RenderBlock.
+ while (object && (!object->isRenderBlock() || object->isAnonymousBlock()))
object = object->container();
if (!object || object->posChildNeedsLayout())
return;
Modified: trunk/Source/WebCore/rendering/RenderObject.h (126960 => 126961)
--- trunk/Source/WebCore/rendering/RenderObject.h 2012-08-29 05:54:51 UTC (rev 126960)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2012-08-29 06:29:34 UTC (rev 126961)
@@ -369,7 +369,6 @@
#endif
virtual bool isRenderFlowThread() const { return false; }
- virtual bool isRenderFlowThreadContainer() const { return false; }
virtual bool isRenderNamedFlowThread() const { return false; }
virtual bool isRenderMultiColumnBlock() const { return false; }