Title: [136908] trunk/Source/WebCore
- Revision
- 136908
- Author
- [email protected]
- Date
- 2012-12-06 16:33:56 -0800 (Thu, 06 Dec 2012)
Log Message
[CSS Regions] Remove the sanitize mechanism from LineFragmentationData
https://bugs.webkit.org/show_bug.cgi?id=104234
Patch by Andrei Bucur <[email protected]> on 2012-12-06
Reviewed by David Hyatt.
Remove previous work that ensured an invalid region is never returned by the containingRegion getter. After r136793 the blocks always
relayout children if the region chain changes. This means the sanitize() method is only necessary when all the regions are removed.
This case is treated separately in layoutInlineChildren.
Tests: no new functionality, no bug fixed.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::lineWidthForPaginatedLineChanged):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::layoutInlineChildren):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::containingRegion):
(WebCore):
(WebCore::RootInlineBox::setContainingRegion):
* rendering/RootInlineBox.h:
(RootInlineBox):
(WebCore::RootInlineBox::LineFragmentationData::LineFragmentationData):
(LineFragmentationData):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (136907 => 136908)
--- trunk/Source/WebCore/ChangeLog 2012-12-07 00:26:52 UTC (rev 136907)
+++ trunk/Source/WebCore/ChangeLog 2012-12-07 00:33:56 UTC (rev 136908)
@@ -1,3 +1,29 @@
+2012-12-06 Andrei Bucur <[email protected]>
+
+ [CSS Regions] Remove the sanitize mechanism from LineFragmentationData
+ https://bugs.webkit.org/show_bug.cgi?id=104234
+
+ Reviewed by David Hyatt.
+
+ Remove previous work that ensured an invalid region is never returned by the containingRegion getter. After r136793 the blocks always
+ relayout children if the region chain changes. This means the sanitize() method is only necessary when all the regions are removed.
+ This case is treated separately in layoutInlineChildren.
+
+ Tests: no new functionality, no bug fixed.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::lineWidthForPaginatedLineChanged):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::layoutInlineChildren):
+ * rendering/RootInlineBox.cpp:
+ (WebCore::RootInlineBox::containingRegion):
+ (WebCore):
+ (WebCore::RootInlineBox::setContainingRegion):
+ * rendering/RootInlineBox.h:
+ (RootInlineBox):
+ (WebCore::RootInlineBox::LineFragmentationData::LineFragmentationData):
+ (LineFragmentationData):
+
2012-12-06 Kenneth Russell <[email protected]>
Associate URLs with GraphicsContext3D instances created for WebGL
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (136907 => 136908)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-12-07 00:26:52 UTC (rev 136907)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-12-07 00:33:56 UTC (rev 136908)
@@ -7251,11 +7251,8 @@
return false;
RenderRegion* currentRegion = regionAtBlockOffset(rootBox->lineTopWithLeading() + lineDelta);
- // Just bail if we still don't have a region.
- if (!rootBox->hasContainingRegion() && !currentRegion)
- return false;
// Just bail if the region didn't change.
- if (rootBox->hasContainingRegion() && rootBox->containingRegion() == currentRegion)
+ if (rootBox->containingRegion() == currentRegion)
return false;
return rootBox->paginatedLineWidth() != availableLogicalWidthForContent(currentRegion, offsetFromLogicalTopOfFirstPage());
}
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (136907 => 136908)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2012-12-07 00:26:52 UTC (rev 136907)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2012-12-07 00:33:56 UTC (rev 136908)
@@ -1744,9 +1744,11 @@
if (view()->layoutState() && view()->layoutState()->lineGrid() == this)
layoutLineGridBox();
+ bool clearLinesForPagination = firstLineBox() && inRenderFlowThread() && !enclosingRenderFlowThread()->hasRegions();
+
// Figure out if we should clear out our line boxes.
// FIXME: Handle resize eventually!
- bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren;
+ bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren || clearLinesForPagination;
LineLayoutState layoutState(isFullLayout, repaintLogicalTop, repaintLogicalBottom);
if (isFullLayout)
Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (136907 => 136908)
--- trunk/Source/WebCore/rendering/RootInlineBox.cpp 2012-12-07 00:26:52 UTC (rev 136907)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp 2012-12-07 00:33:56 UTC (rev 136908)
@@ -250,30 +250,29 @@
}
}
+RenderRegion* RootInlineBox::containingRegion() const
+{
+ RenderRegion* region = m_fragmentationData ? m_fragmentationData->m_containingRegion : 0;
+
+#ifndef NDEBUG
+ if (region) {
+ RenderFlowThread* flowThread = block()->enclosingRenderFlowThread();
+ const RenderRegionList& regionList = flowThread->renderRegionList();
+ ASSERT(regionList.contains(region));
+ }
+#endif
+
+ return region;
+}
+
void RootInlineBox::setContainingRegion(RenderRegion* region)
{
ASSERT(!isDirty());
ASSERT(block()->inRenderFlowThread());
LineFragmentationData* fragmentationData = ensureLineFragmentationData();
fragmentationData->m_containingRegion = region;
- fragmentationData->m_hasContainingRegion = !!region;
}
-RootInlineBox::LineFragmentationData* RootInlineBox::LineFragmentationData::sanitize(const RenderBlock* block)
-{
- ASSERT(block->inRenderFlowThread());
- if (!m_containingRegion)
- return this;
-
- RenderFlowThread* flowThread = block->enclosingRenderFlowThread();
- const RenderRegionList& regionList = flowThread->renderRegionList();
- // For pointer types the hash function is |safeToCompareToEmptyOrDeleted|. There shouldn't be any problems if m_containingRegion was deleted.
- if (!regionList.contains(m_containingRegion))
- m_containingRegion = 0;
-
- return this;
-}
-
LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache)
{
#if ENABLE(SVG)
Modified: trunk/Source/WebCore/rendering/RootInlineBox.h (136907 => 136908)
--- trunk/Source/WebCore/rendering/RootInlineBox.h 2012-12-07 00:26:52 UTC (rev 136907)
+++ trunk/Source/WebCore/rendering/RootInlineBox.h 2012-12-07 00:33:56 UTC (rev 136908)
@@ -63,8 +63,7 @@
LayoutUnit paginatedLineWidth() const { return m_fragmentationData ? m_fragmentationData->m_paginatedLineWidth : LayoutUnit(0); }
void setPaginatedLineWidth(LayoutUnit width) { ensureLineFragmentationData()->m_paginatedLineWidth = width; }
- RenderRegion* containingRegion() const { return m_fragmentationData ? m_fragmentationData->sanitize(block())->m_containingRegion : 0; }
- bool hasContainingRegion() const { return m_fragmentationData ? m_fragmentationData->m_hasContainingRegion : false; }
+ RenderRegion* containingRegion() const;
void setContainingRegion(RenderRegion*);
LayoutUnit selectionTop() const;
@@ -229,21 +228,16 @@
, m_paginationStrut(0)
, m_paginatedLineWidth(0)
, m_isFirstAfterPageBreak(false)
- , m_hasContainingRegion(false)
{
}
- LineFragmentationData* sanitize(const RenderBlock*);
-
// It should not be assumed the |containingRegion| is always valid.
- // It can also be 0 if the flow has no region chain or an invalid pointer if the region is no longer in the chain.
- // Use |sanitize| to filter an invalid region.
+ // It can also be 0 if the flow has no region chain.
RenderRegion* m_containingRegion;
LayoutUnit m_paginationStrut;
LayoutUnit m_paginatedLineWidth;
- unsigned m_isFirstAfterPageBreak : 1;
- unsigned m_hasContainingRegion : 1; // We need to keep this to differentiate between the case of a void region and an invalid region.
+ bool m_isFirstAfterPageBreak;
};
OwnPtr<LineFragmentationData> m_fragmentationData;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes