- Revision
- 222350
- Author
- an...@apple.com
- Date
- 2017-09-21 14:11:03 -0700 (Thu, 21 Sep 2017)
Log Message
Remove some more code from RenderFlowThread
https://bugs.webkit.org/show_bug.cgi?id=177320
Reviewed by David Hyatt.
More dead code related to named flows.
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::RenderFlowThread):
(WebCore::RenderFlowThread::invalidateRegions):
(WebCore::RenderFlowThread::layout):
(WebCore::RenderFlowThread::logicalWidthChangedInRegionsForBlock):
(WebCore::RenderFlowThread::updateRegionsFlowThreadPortionRect):
(WebCore::RenderFlowThread::addForcedRegionBreak):
(WebCore::RenderFlowThread::offsetFromLogicalTopOfFirstRegion const):
(WebCore::RenderFlowThread::hasCachedOffsetFromLogicalTopOfFirstRegion const): Deleted.
(WebCore::RenderFlowThread::cachedOffsetFromLogicalTopOfFirstRegion const): Deleted.
(WebCore::RenderFlowThread::setOffsetFromLogicalTopOfFirstRegion): Deleted.
(WebCore::RenderFlowThread::clearOffsetFromLogicalTopOfFirstRegion): Deleted.
(WebCore::RenderFlowThread::currentActiveRenderBox const): Deleted.
(WebCore::RenderFlowThread::pushFlowThreadLayoutState): Deleted.
(WebCore::RenderFlowThread::popFlowThreadLayoutState): Deleted.
* rendering/RenderFlowThread.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (222349 => 222350)
--- trunk/Source/WebCore/ChangeLog 2017-09-21 20:58:28 UTC (rev 222349)
+++ trunk/Source/WebCore/ChangeLog 2017-09-21 21:11:03 UTC (rev 222350)
@@ -1,3 +1,29 @@
+2017-09-21 Antti Koivisto <an...@apple.com>
+
+ Remove some more code from RenderFlowThread
+ https://bugs.webkit.org/show_bug.cgi?id=177320
+
+ Reviewed by David Hyatt.
+
+ More dead code related to named flows.
+
+ * rendering/RenderFlowThread.cpp:
+ (WebCore::RenderFlowThread::RenderFlowThread):
+ (WebCore::RenderFlowThread::invalidateRegions):
+ (WebCore::RenderFlowThread::layout):
+ (WebCore::RenderFlowThread::logicalWidthChangedInRegionsForBlock):
+ (WebCore::RenderFlowThread::updateRegionsFlowThreadPortionRect):
+ (WebCore::RenderFlowThread::addForcedRegionBreak):
+ (WebCore::RenderFlowThread::offsetFromLogicalTopOfFirstRegion const):
+ (WebCore::RenderFlowThread::hasCachedOffsetFromLogicalTopOfFirstRegion const): Deleted.
+ (WebCore::RenderFlowThread::cachedOffsetFromLogicalTopOfFirstRegion const): Deleted.
+ (WebCore::RenderFlowThread::setOffsetFromLogicalTopOfFirstRegion): Deleted.
+ (WebCore::RenderFlowThread::clearOffsetFromLogicalTopOfFirstRegion): Deleted.
+ (WebCore::RenderFlowThread::currentActiveRenderBox const): Deleted.
+ (WebCore::RenderFlowThread::pushFlowThreadLayoutState): Deleted.
+ (WebCore::RenderFlowThread::popFlowThreadLayoutState): Deleted.
+ * rendering/RenderFlowThread.h:
+
2017-09-21 Chris Dumez <cdu...@apple.com>
eventInitDict parameter to GamepadEvent constructor should be optional
Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (222349 => 222350)
--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2017-09-21 20:58:28 UTC (rev 222349)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2017-09-21 21:11:03 UTC (rev 222350)
@@ -51,14 +51,11 @@
RenderFlowThread::RenderFlowThread(Document& document, RenderStyle&& style)
: RenderBlockFlow(document, WTFMove(style))
- , m_previousRegionCount(0)
, m_currentRegionMaintainer(nullptr)
, m_regionsInvalidated(false)
, m_regionsHaveUniformLogicalWidth(true)
, m_regionsHaveUniformLogicalHeight(true)
, m_pageLogicalSizeChanged(false)
- , m_layoutPhase(LayoutPhaseMeasureContent)
- , m_needsTwoPhasesLayout(false)
{
setIsRenderFlowThread(true);
}
@@ -102,8 +99,6 @@
void RenderFlowThread::invalidateRegions(MarkingBehavior markingParents)
{
- ASSERT(!inFinalLayoutPhase());
-
if (m_regionsInvalidated) {
ASSERT(selfNeedsLayout());
return;
@@ -165,10 +160,6 @@
m_pageLogicalSizeChanged = m_regionsInvalidated && everHadLayout();
- // It's also possible to need a secondary layout if the overflow computation invalidated the region chain (e.g. overflow: auto scrollbars
- // shrunk some regions) so repropagation is required.
- m_needsTwoPhasesLayout = inOverflowLayoutPhase() && m_regionsInvalidated;
-
validateRegions();
RenderBlockFlow::layout();
@@ -454,13 +445,8 @@
void RenderFlowThread::logicalWidthChangedInRegionsForBlock(const RenderBlock* block, bool& relayoutChildren)
{
- if (!hasValidRegionInfo()) {
- // FIXME: Remove once we stop laying out flow threads without regions.
- // If we had regions but don't any more, relayout the children because the code below
- // can't properly detect this scenario.
- relayoutChildren |= previousRegionCountChanged();
+ if (!hasValidRegionInfo())
return;
- }
auto it = m_regionRangeMap.find(block);
if (it == m_regionRangeMap.end())
@@ -808,11 +794,9 @@
region->setNeedsSimplifiedNormalFlowLayout();
}
-void RenderFlowThread::updateRegionsFlowThreadPortionRect(const RenderRegion* lastRegionWithContent)
+void RenderFlowThread::updateRegionsFlowThreadPortionRect()
{
- ASSERT(!lastRegionWithContent);
LayoutUnit logicalHeight = 0;
- bool emptyRegionsSegment = false;
// FIXME: Optimize not to clear the interval all the time. This implies manually managing the tree nodes lifecycle.
m_regionIntervalTree.clear();
for (auto& region : m_regionList) {
@@ -826,13 +810,7 @@
m_regionIntervalTree.add(RegionIntervalTree::createInterval(logicalHeight, logicalHeight + regionLogicalHeight, region));
logicalHeight += regionLogicalHeight;
-
- // Once we find the last region with content the next regions are considered empty.
- if (lastRegionWithContent == region)
- emptyRegionsSegment = true;
}
-
- ASSERT(!lastRegionWithContent || emptyRegionsSegment);
}
// Even if we require the break to occur at offsetBreakInFlowThread, because regions may have min/max-height values,
@@ -840,13 +818,6 @@
// offsetBreakAdjustment measures the different between the requested break offset and the current break offset.
bool RenderFlowThread::addForcedRegionBreak(const RenderBlock* block, LayoutUnit offsetBreakInFlowThread, RenderBox*, bool, LayoutUnit* offsetBreakAdjustment)
{
- // We take breaks into account for height computation for auto logical height regions
- // only in the layout phase in which we lay out the flows threads unconstrained
- // and we use the content breaks to determine the computed auto height for
- // auto logical height regions.
- if (!inMeasureContentLayoutPhase())
- return false;
-
// We need to update the regions flow thread portion rect because we are going to process
// a break on these regions.
updateRegionsFlowThreadPortionRect();
@@ -894,68 +865,8 @@
return result;
}
-bool RenderFlowThread::hasCachedOffsetFromLogicalTopOfFirstRegion(const RenderBox* box) const
-{
- return m_boxesToOffsetMap.contains(box);
-}
-
-LayoutUnit RenderFlowThread::cachedOffsetFromLogicalTopOfFirstRegion(const RenderBox* box) const
-{
- return m_boxesToOffsetMap.get(box);
-}
-
-void RenderFlowThread::setOffsetFromLogicalTopOfFirstRegion(const RenderBox* box, LayoutUnit offset)
-{
- m_boxesToOffsetMap.set(box, offset);
-}
-
-void RenderFlowThread::clearOffsetFromLogicalTopOfFirstRegion(const RenderBox* box)
-{
- ASSERT(m_boxesToOffsetMap.contains(box));
- m_boxesToOffsetMap.remove(box);
-}
-
-const RenderBox* RenderFlowThread::currentActiveRenderBox() const
-{
- if (m_activeObjectsStack.isEmpty())
- return nullptr;
-
- const RenderObject* currentObject = m_activeObjectsStack.last();
- return is<RenderBox>(*currentObject) ? downcast<RenderBox>(currentObject) : nullptr;
-}
-
-void RenderFlowThread::pushFlowThreadLayoutState(const RenderObject& object)
-{
- m_activeObjectsStack.append(&object);
-
- if (const RenderBox* currentBoxDescendant = currentActiveRenderBox()) {
- LayoutState* layoutState = currentBoxDescendant->view().layoutState();
- if (layoutState && layoutState->isPaginated()) {
- ASSERT(layoutState->m_renderer == currentBoxDescendant);
- LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pageOffset;
- setOffsetFromLogicalTopOfFirstRegion(currentBoxDescendant, currentBoxDescendant->isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width());
- }
- }
-}
-
-void RenderFlowThread::popFlowThreadLayoutState()
-{
- if (const RenderBox* currentBoxDescendant = currentActiveRenderBox()) {
- LayoutState* layoutState = currentBoxDescendant->view().layoutState();
- if (layoutState && layoutState->isPaginated())
- clearOffsetFromLogicalTopOfFirstRegion(currentBoxDescendant);
- }
-
- m_activeObjectsStack.removeLast();
-}
-
LayoutUnit RenderFlowThread::offsetFromLogicalTopOfFirstRegion(const RenderBlock* currentBlock) const
{
- // First check if we cached the offset for the block if it's an ancestor containing block of the box
- // being currently laid out.
- if (hasCachedOffsetFromLogicalTopOfFirstRegion(currentBlock))
- return cachedOffsetFromLogicalTopOfFirstRegion(currentBlock);
-
// As a last resort, take the slow path.
LayoutRect blockRect(0, 0, currentBlock->width(), currentBlock->height());
while (currentBlock && !is<RenderView>(*currentBlock) && !currentBlock->isRenderFlowThread()) {
Modified: trunk/Source/WebCore/rendering/RenderFlowThread.h (222349 => 222350)
--- trunk/Source/WebCore/rendering/RenderFlowThread.h 2017-09-21 20:58:28 UTC (rev 222349)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.h 2017-09-21 21:11:03 UTC (rev 222350)
@@ -125,9 +125,6 @@
RenderRegion* firstRegion() const;
RenderRegion* lastRegion() const;
- bool previousRegionCountChanged() const { return m_previousRegionCount != m_regionList.size(); };
- void updatePreviousRegionCount() { m_previousRegionCount = m_regionList.size(); };
-
virtual void setRegionRangeForBox(const RenderBox&, RenderRegion*, RenderRegion*);
bool getRegionRangeForBox(const RenderBox*, RenderRegion*& startRegion, RenderRegion*& endRegion) const;
bool computedRegionRangeForBox(const RenderBox*, RenderRegion*& startRegion, RenderRegion*& endRegion) const;
@@ -150,24 +147,6 @@
void collectLayerFragments(LayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect);
LayoutRect fragmentsBoundingBox(const LayoutRect& layerBoundingBox);
- // A flow thread goes through different states during layout.
- enum LayoutPhase {
- LayoutPhaseMeasureContent = 0, // The initial phase, used to measure content for the auto-height regions.
- LayoutPhaseConstrained, // In this phase the regions are laid out using the sizes computed in the normal phase.
- LayoutPhaseOverflow, // In this phase the layout overflow is propagated from the content to the regions.
- LayoutPhaseFinal // In case scrollbars have resized the regions, content is laid out one last time to respect the change.
- };
- bool inMeasureContentLayoutPhase() const { return m_layoutPhase == LayoutPhaseMeasureContent; }
- bool inConstrainedLayoutPhase() const { return m_layoutPhase == LayoutPhaseConstrained; }
- bool inOverflowLayoutPhase() const { return m_layoutPhase == LayoutPhaseOverflow; }
- bool inFinalLayoutPhase() const { return m_layoutPhase == LayoutPhaseFinal; }
- void setLayoutPhase(LayoutPhase phase) { m_layoutPhase = phase; }
-
- bool needsTwoPhasesLayout() const { return m_needsTwoPhasesLayout; }
- void clearNeedsTwoPhasesLayout() { m_needsTwoPhasesLayout = false; }
-
- void pushFlowThreadLayoutState(const RenderObject&);
- void popFlowThreadLayoutState();
LayoutUnit offsetFromLogicalTopOfFirstRegion(const RenderBlock*) const;
void clearRenderBoxRegionInfoAndCustomStyle(const RenderBox&, const RenderRegion*, const RenderRegion*, const RenderRegion*, const RenderRegion*);
@@ -223,16 +202,9 @@
void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override;
- void updateRegionsFlowThreadPortionRect(const RenderRegion* = nullptr);
+ void updateRegionsFlowThreadPortionRect();
bool shouldRepaint(const LayoutRect&) const;
- inline bool hasCachedOffsetFromLogicalTopOfFirstRegion(const RenderBox*) const;
- inline LayoutUnit cachedOffsetFromLogicalTopOfFirstRegion(const RenderBox*) const;
- inline void setOffsetFromLogicalTopOfFirstRegion(const RenderBox*, LayoutUnit);
- inline void clearOffsetFromLogicalTopOfFirstRegion(const RenderBox*);
-
- inline const RenderBox* currentActiveRenderBox() const;
-
bool getRegionRangeForBoxFromCachedInfo(const RenderBox*, RenderRegion*& startRegion, RenderRegion*& endRegion) const;
void removeRenderBoxRegionInfo(RenderBox&);
@@ -239,7 +211,6 @@
void removeLineRegionInfo(const RenderBlockFlow&);
RenderRegionList m_regionList;
- unsigned short m_previousRegionCount;
class RenderRegionRange {
public:
@@ -305,12 +276,6 @@
RenderBoxToRegionMap m_breakBeforeToRegionMap;
RenderBoxToRegionMap m_breakAfterToRegionMap;
- typedef Vector<const RenderObject*> RenderObjectStack;
- RenderObjectStack m_activeObjectsStack;
-
- typedef HashMap<const RenderBox*, LayoutUnit> RenderBoxToOffsetMap;
- RenderBoxToOffsetMap m_boxesToOffsetMap;
-
RegionIntervalTree m_regionIntervalTree;
CurrentRenderRegionMaintainer* m_currentRegionMaintainer;
@@ -319,8 +284,6 @@
bool m_regionsHaveUniformLogicalWidth : 1;
bool m_regionsHaveUniformLogicalHeight : 1;
bool m_pageLogicalSizeChanged : 1;
- unsigned m_layoutPhase : 2;
- bool m_needsTwoPhasesLayout : 1;
};
} // namespace WebCore