- Revision
- 151237
- Author
- [email protected]
- Date
- 2013-06-05 14:25:27 -0700 (Wed, 05 Jun 2013)
Log Message
[css exclusions] Clean up ExclusionShapeInsideInfo dynamic removal code
https://bugs.webkit.org/show_bug.cgi?id=116236
Reviewed by David Hyatt.
Instead of keeping the ExclusionShapeInsideInfo around after it has
become stale, we can immediately remove it and just mark descendants
for relayout. This patch removes most of the code added by
https://bugs.webkit.org/show_bug.cgi?id=111029
in favor of this simpler approach.
This patch does not introduce new functionality.
* rendering/ExclusionShapeInsideInfo.h:
(WebCore::ExclusionShapeInsideInfo::ExclusionShapeInsideInfo):
(ExclusionShapeInsideInfo): Remove needsRemoval code.
* rendering/LayoutState.cpp:
(WebCore::LayoutState::LayoutState): Ditto.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange): Remove
needsRemoval code and mark descendants for layout.
(WebCore):
(WebCore::RenderBlock::markShapeInsideDescendantsForLayout): Method to mark
descendants of a shape inside with inline content for layout.
(WebCore::exclusionInfoRequiresRelayout): Remove needsRemoval code.
(WebCore::RenderBlock::updateRegionsAndExclusionsAfterChildLayout): Ditto.
* rendering/RenderBlock.h:
(WebCore::RenderBlock::exclusionShapeInsideInfo): Ditto.
(RenderBlock):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::layoutExclusionShapeInsideInfo): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (151236 => 151237)
--- trunk/Source/WebCore/ChangeLog 2013-06-05 21:20:40 UTC (rev 151236)
+++ trunk/Source/WebCore/ChangeLog 2013-06-05 21:25:27 UTC (rev 151237)
@@ -1,3 +1,37 @@
+2013-06-05 Bear Travis <[email protected]>
+
+ [css exclusions] Clean up ExclusionShapeInsideInfo dynamic removal code
+ https://bugs.webkit.org/show_bug.cgi?id=116236
+
+ Reviewed by David Hyatt.
+
+ Instead of keeping the ExclusionShapeInsideInfo around after it has
+ become stale, we can immediately remove it and just mark descendants
+ for relayout. This patch removes most of the code added by
+ https://bugs.webkit.org/show_bug.cgi?id=111029
+ in favor of this simpler approach.
+
+ This patch does not introduce new functionality.
+
+ * rendering/ExclusionShapeInsideInfo.h:
+ (WebCore::ExclusionShapeInsideInfo::ExclusionShapeInsideInfo):
+ (ExclusionShapeInsideInfo): Remove needsRemoval code.
+ * rendering/LayoutState.cpp:
+ (WebCore::LayoutState::LayoutState): Ditto.
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange): Remove
+ needsRemoval code and mark descendants for layout.
+ (WebCore):
+ (WebCore::RenderBlock::markShapeInsideDescendantsForLayout): Method to mark
+ descendants of a shape inside with inline content for layout.
+ (WebCore::exclusionInfoRequiresRelayout): Remove needsRemoval code.
+ (WebCore::RenderBlock::updateRegionsAndExclusionsAfterChildLayout): Ditto.
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::exclusionShapeInsideInfo): Ditto.
+ (RenderBlock):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::layoutExclusionShapeInsideInfo): Ditto.
+
2013-06-05 Arunprasad Rajkumar <[email protected]>
Avoid multiple copies of inline script & style strings
Modified: trunk/Source/WebCore/rendering/ExclusionShapeInsideInfo.h (151236 => 151237)
--- trunk/Source/WebCore/rendering/ExclusionShapeInsideInfo.h 2013-06-05 21:20:40 UTC (rev 151236)
+++ trunk/Source/WebCore/rendering/ExclusionShapeInsideInfo.h 2013-06-05 21:25:27 UTC (rev 151237)
@@ -70,7 +70,6 @@
virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) OVERRIDE
{
- ASSERT(!needsRemoval());
m_segmentRanges.clear();
return ExclusionShapeInfo<RenderBlock, &RenderStyle::resolvedShapeInside, &ExclusionShape::getIncludedIntervals>::computeSegmentsForLine(lineTop, lineHeight);
}
@@ -98,9 +97,6 @@
void setNeedsLayout(bool value) { m_needsLayout = value; }
bool needsLayout() { return m_needsLayout; }
- void setNeedsRemoval(bool value) { m_needsRemoval = value; }
- bool needsRemoval() { return m_needsRemoval; }
-
protected:
virtual LayoutRect computedShapeLogicalBoundingBox() const OVERRIDE { return computedShape()->shapePaddingLogicalBoundingBox(); }
@@ -108,12 +104,10 @@
ExclusionShapeInsideInfo(const RenderBlock* renderer)
: ExclusionShapeInfo<RenderBlock, &RenderStyle::resolvedShapeInside, &ExclusionShape::getIncludedIntervals> (renderer)
, m_needsLayout(false)
- , m_needsRemoval(false)
{ }
SegmentRangeList m_segmentRanges;
bool m_needsLayout:1;
- bool m_needsRemoval:1;
};
}
Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (151236 => 151237)
--- trunk/Source/WebCore/rendering/LayoutState.cpp 2013-06-05 21:20:40 UTC (rev 151236)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp 2013-06-05 21:25:27 UTC (rev 151237)
@@ -113,15 +113,9 @@
#if ENABLE(CSS_EXCLUSIONS)
if (renderer->isRenderBlock()) {
const RenderBlock* renderBlock = toRenderBlock(renderer);
- m_exclusionShapeInsideInfo = renderBlock->exclusionShapeInsideInfo(RenderBlock::ShapePresentOrRemoved);
- if (m_next->m_exclusionShapeInsideInfo && renderBlock->allowsExclusionShapeInsideInfoSharing()) {
- if (!m_exclusionShapeInsideInfo)
- m_exclusionShapeInsideInfo = m_next->m_exclusionShapeInsideInfo;
- else if (m_exclusionShapeInsideInfo->needsRemoval()) {
- m_exclusionShapeInsideInfo = m_next->m_exclusionShapeInsideInfo;
- m_exclusionShapeInsideInfo->setNeedsLayout(true);
- }
- }
+ m_exclusionShapeInsideInfo = renderBlock->exclusionShapeInsideInfo();
+ if (!m_exclusionShapeInsideInfo && m_next->m_exclusionShapeInsideInfo && renderBlock->allowsExclusionShapeInsideInfoSharing())
+ m_exclusionShapeInsideInfo = m_next->m_exclusionShapeInsideInfo;
}
#endif
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (151236 => 151237)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2013-06-05 21:20:40 UTC (rev 151236)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2013-06-05 21:25:27 UTC (rev 151237)
@@ -1446,14 +1446,30 @@
if (shapeInside == oldShapeInside)
return;
- ExclusionShapeInsideInfo* exclusionShapeInsideInfo;
if (shapeInside) {
- exclusionShapeInsideInfo = ensureExclusionShapeInsideInfo();
+ ExclusionShapeInsideInfo* exclusionShapeInsideInfo = ensureExclusionShapeInsideInfo();
exclusionShapeInsideInfo->dirtyShapeSize();
- exclusionShapeInsideInfo->setNeedsRemoval(false);
- } else if ((exclusionShapeInsideInfo = this->exclusionShapeInsideInfo(ShapePresentOrRemoved)))
- exclusionShapeInsideInfo->setNeedsRemoval(true);
+ } else {
+ setExclusionShapeInsideInfo(nullptr);
+ markShapeInsideDescendantsForLayout();
+ }
}
+
+void RenderBlock::markShapeInsideDescendantsForLayout()
+{
+ if (!everHadLayout())
+ return;
+ if (childrenInline()) {
+ setNeedsLayout(true);
+ return;
+ }
+ for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
+ if (!child->isRenderBlock())
+ continue;
+ RenderBlock* childBlock = toRenderBlock(child);
+ childBlock->markShapeInsideDescendantsForLayout();
+ }
+}
#endif
static inline bool exclusionInfoRequiresRelayout(const RenderBlock* block)
@@ -1461,11 +1477,11 @@
#if !ENABLE(CSS_EXCLUSIONS)
return false;
#else
- ExclusionShapeInsideInfo* info = block->exclusionShapeInsideInfo(RenderBlock::ShapePresentOrRemoved);
+ ExclusionShapeInsideInfo* info = block->exclusionShapeInsideInfo();
if (info)
- info->setNeedsLayout(info->shapeSizeDirty() || info->needsRemoval());
+ info->setNeedsLayout(info->shapeSizeDirty());
else
- info = block->layoutExclusionShapeInsideInfo(RenderBlock::ShapePresentOrRemoved);
+ info = block->layoutExclusionShapeInsideInfo();
return info && info->needsLayout();
#endif
}
@@ -1515,10 +1531,6 @@
void RenderBlock::updateRegionsAndExclusionsAfterChildLayout(RenderFlowThread* flowThread, bool heightChanged)
{
#if ENABLE(CSS_EXCLUSIONS)
- ExclusionShapeInsideInfo* exclusionShapeInsideInfo = this->exclusionShapeInsideInfo(ShapePresentOrRemoved);
- if (exclusionShapeInsideInfo && exclusionShapeInsideInfo->needsRemoval())
- setExclusionShapeInsideInfo(nullptr);
-
// A previous sibling has changed dimension, so we need to relayout the shape with the content
ExclusionShapeInsideInfo* shapeInsideInfo = layoutExclusionShapeInsideInfo();
if (heightChanged && shapeInsideInfo)
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (151236 => 151237)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2013-06-05 21:20:40 UTC (rev 151236)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2013-06-05 21:25:27 UTC (rev 151237)
@@ -453,12 +453,11 @@
return m_rareData->m_shapeInsideInfo.get();
}
- enum ExclusionShapeStatus { ShapePresent, ShapePresentOrRemoved };
- ExclusionShapeInsideInfo* exclusionShapeInsideInfo(ExclusionShapeStatus exclusionShapeStatus = ShapePresent) const
+ ExclusionShapeInsideInfo* exclusionShapeInsideInfo() const
{
if (!m_rareData || !m_rareData->m_shapeInsideInfo)
return 0;
- return ExclusionShapeInsideInfo::isEnabledFor(this) || (exclusionShapeStatus == ShapePresentOrRemoved) ? m_rareData->m_shapeInsideInfo.get() : 0;
+ return ExclusionShapeInsideInfo::isEnabledFor(this) ? m_rareData->m_shapeInsideInfo.get() : 0;
}
void setExclusionShapeInsideInfo(PassOwnPtr<ExclusionShapeInsideInfo> value)
{
@@ -466,7 +465,8 @@
m_rareData = adoptPtr(new RenderBlockRareData(this));
m_rareData->m_shapeInsideInfo = value;
}
- ExclusionShapeInsideInfo* layoutExclusionShapeInsideInfo(ExclusionShapeStatus = ShapePresent) const;
+ void markShapeInsideDescendantsForLayout();
+ ExclusionShapeInsideInfo* layoutExclusionShapeInsideInfo() const;
bool allowsExclusionShapeInsideInfoSharing() const { return !isInline() && !isFloating(); }
#endif
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (151236 => 151237)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2013-06-05 21:20:40 UTC (rev 151236)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2013-06-05 21:25:27 UTC (rev 151237)
@@ -77,11 +77,9 @@
}
#if ENABLE(CSS_EXCLUSIONS)
-ExclusionShapeInsideInfo* RenderBlock::layoutExclusionShapeInsideInfo(ExclusionShapeStatus exclusionShapeStatus) const
+ExclusionShapeInsideInfo* RenderBlock::layoutExclusionShapeInsideInfo() const
{
ExclusionShapeInsideInfo* shapeInsideInfo = view()->layoutState()->exclusionShapeInsideInfo();
- if (shapeInsideInfo && shapeInsideInfo->needsRemoval() && exclusionShapeStatus == ShapePresent)
- shapeInsideInfo = 0;
if (!shapeInsideInfo && flowThreadContainingBlock() && allowsExclusionShapeInsideInfoSharing()) {
// regionAtBlockOffset returns regions like an array first={0,N-1}, second={N,M-1}, ...
@@ -89,7 +87,6 @@
RenderRegion* region = regionAtBlockOffset(offset);
if (region)
shapeInsideInfo = region->exclusionShapeInsideInfo();
- return shapeInsideInfo && shapeInsideInfo->needsRemoval() && exclusionShapeStatus == ShapePresent ? 0 : shapeInsideInfo;
}
return shapeInsideInfo;