Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.cpp ('k') | Source/core/rendering/RenderBox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlockLineLayout.cpp
diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp
index f2b9bed38c58a47b8d2f2f54c48d1012b9e967fa..134ed4e9ab302ad100bd893d27367922b9096a6d 100644
--- a/Source/core/rendering/RenderBlockLineLayout.cpp
+++ b/Source/core/rendering/RenderBlockLineLayout.cpp
@@ -25,10 +25,8 @@
#include "core/rendering/FastTextAutosizer.h"
#include "core/rendering/LayoutRectRecorder.h"
#include "core/rendering/RenderCounter.h"
-#include "core/rendering/RenderFlowThread.h"
#include "core/rendering/RenderLayer.h"
#include "core/rendering/RenderListMarker.h"
-#include "core/rendering/RenderRegion.h"
#include "core/rendering/RenderRubyRun.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/TrailingFloatsRootInlineBox.h"
@@ -1104,9 +1102,6 @@ static inline void pushShapeContentOverflowBelowTheContentBox(RenderBlockFlow* b
void RenderBlockFlow::updateShapeAndSegmentsForCurrentLine(ShapeInsideInfo*& shapeInsideInfo, const LayoutSize& logicalOffsetFromShapeContainer, LineLayoutState& layoutState)
{
- if (layoutState.flowThread())
- return updateShapeAndSegmentsForCurrentLineInFlowThread(shapeInsideInfo, layoutState);
-
if (!shapeInsideInfo)
return;
@@ -1120,87 +1115,6 @@ void RenderBlockFlow::updateShapeAndSegmentsForCurrentLine(ShapeInsideInfo*& sha
pushShapeContentOverflowBelowTheContentBox(this, shapeInsideInfo, lineTop, lineHeight);
}
-void RenderBlockFlow::updateShapeAndSegmentsForCurrentLineInFlowThread(ShapeInsideInfo*& shapeInsideInfo, LineLayoutState& layoutState)
-{
- ASSERT(layoutState.flowThread());
-
- RenderRegion* currentRegion = regionAtBlockOffset(logicalHeight());
- if (!currentRegion || !currentRegion->logicalHeight())
- return;
-
- shapeInsideInfo = currentRegion->shapeInsideInfo();
-
- RenderRegion* nextRegion = 0;
- if (!currentRegion->isLastRegion()) {
- RenderRegionList regionList = layoutState.flowThread()->renderRegionList();
- RenderRegionList::const_iterator it = regionList.find(currentRegion);
- nextRegion = *(++it);
- }
-
- // We only want to deal regions with shapes, so we check if the next region has a shape
- if (!shapeInsideInfo && nextRegion && !nextRegion->shapeInsideInfo())
- return;
-
- LayoutUnit lineHeight = this->lineHeight(layoutState.lineInfo().isFirstLine(), isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
- LayoutUnit logicalLineTopInFlowThread = logicalHeight() + offsetFromLogicalTopOfFirstPage();
- LayoutUnit logicalLineBottomInFlowThread = logicalLineTopInFlowThread + lineHeight;
- LayoutUnit logicalRegionTopInFlowThread = currentRegion->logicalTopForFlowThreadContent();
- LayoutUnit logicalRegionBottomInFlowThread = logicalRegionTopInFlowThread + currentRegion->logicalHeight() - currentRegion->borderAndPaddingBefore() - currentRegion->borderAndPaddingAfter();
-
- LayoutUnit shapeBottomInFlowThread = LayoutUnit::max();
- if (shapeInsideInfo)
- shapeBottomInFlowThread = shapeInsideInfo->shapeLogicalBottom() + currentRegion->logicalTopForFlowThreadContent();
-
- bool lineOverLapsWithShapeBottom = shapeBottomInFlowThread < logicalLineBottomInFlowThread;
- bool lineTopAdjustedIntoNextRegion = layoutState.adjustedLogicalLineTop() >= currentRegion->logicalHeight();
- bool lineOverLapsWithRegionBottom = logicalLineBottomInFlowThread > logicalRegionBottomInFlowThread || lineTopAdjustedIntoNextRegion;
- bool overFlowsToNextRegion = nextRegion && (lineOverLapsWithShapeBottom || lineOverLapsWithRegionBottom);
-
- // If the line is between two shapes/regions we position the line to the top of the next shape/region
- if (overFlowsToNextRegion) {
- ASSERT(currentRegion != nextRegion);
- LayoutUnit deltaToNextRegion = logicalRegionBottomInFlowThread - logicalLineTopInFlowThread;
- setLogicalHeight(logicalHeight() + deltaToNextRegion);
-
- currentRegion = nextRegion;
- shapeInsideInfo = currentRegion->shapeInsideInfo();
-
- logicalLineTopInFlowThread = logicalHeight() + offsetFromLogicalTopOfFirstPage();
- logicalLineBottomInFlowThread = logicalLineTopInFlowThread + lineHeight;
- logicalRegionTopInFlowThread = currentRegion->logicalTopForFlowThreadContent();
- logicalRegionBottomInFlowThread = logicalRegionTopInFlowThread + currentRegion->logicalHeight() - currentRegion->borderAndPaddingBefore() - currentRegion->borderAndPaddingAfter();
-
- if (lineTopAdjustedIntoNextRegion)
- layoutState.setAdjustedLogicalLineTop(0);
- }
-
- if (!shapeInsideInfo)
- return;
-
- bool isFirstLineInRegion = logicalLineBottomInFlowThread <= (logicalRegionTopInFlowThread + lineHeight);
- bool isFirstLineAdjusted = (logicalLineTopInFlowThread - logicalRegionTopInFlowThread) < (layoutState.adjustedLogicalLineTop() - currentRegion->borderAndPaddingBefore());
- // We position the first line to the top of the shape in the region or to the previously adjusted position in the shape
- if (isFirstLineInRegion || isFirstLineAdjusted) {
- LayoutUnit shapeTopOffset = layoutState.adjustedLogicalLineTop();
- if (!shapeTopOffset && (shapeInsideInfo->shapeLogicalTop() > 0))
- shapeTopOffset = shapeInsideInfo->shapeLogicalTop();
-
- LayoutUnit shapePositionInFlowThread = currentRegion->logicalTopForFlowThreadContent() + shapeTopOffset;
- LayoutUnit shapeTopLineTopDelta = shapePositionInFlowThread - logicalLineTopInFlowThread - currentRegion->borderAndPaddingBefore();
-
- setLogicalHeight(logicalHeight() + shapeTopLineTopDelta);
- logicalLineTopInFlowThread += shapeTopLineTopDelta;
- layoutState.setAdjustedLogicalLineTop(0);
- }
-
- LayoutUnit lineTop = logicalLineTopInFlowThread - currentRegion->logicalTopForFlowThreadContent() + currentRegion->borderAndPaddingBefore();
- // FIXME: Shape inside on a region does not yet take into account its padding for nested flow blocks
- shapeInsideInfo->updateSegmentsForLine(LayoutSize(0, lineTop), lineHeight);
-
- if (currentRegion->isLastRegion())
- pushShapeContentOverflowBelowTheContentBox(this, shapeInsideInfo, lineTop, lineHeight);
-}
-
bool RenderBlockFlow::adjustLogicalLineTopAndLogicalHeightIfNeeded(ShapeInsideInfo* shapeInsideInfo, LayoutUnit absoluteLogicalTop, LineLayoutState& layoutState, InlineBidiResolver& resolver, FloatingObject* lastFloatFromPreviousLine, InlineIterator& end, WordMeasurements& wordMeasurements)
{
LayoutUnit adjustedLogicalLineTop = adjustLogicalLineTop(shapeInsideInfo, resolver.position(), end, wordMeasurements);
@@ -1219,11 +1133,6 @@ bool RenderBlockFlow::adjustLogicalLineTopAndLogicalHeightIfNeeded(ShapeInsideIn
LayoutUnit newLogicalHeight = adjustedLogicalLineTop - absoluteLogicalTop;
- if (layoutState.flowThread()) {
- layoutState.setAdjustedLogicalLineTop(adjustedLogicalLineTop);
- newLogicalHeight = logicalHeight();
- }
-
end = restartLayoutRunsAndFloatsInRange(logicalHeight(), newLogicalHeight, lastFloatFromPreviousLine, resolver, end);
return true;
}
@@ -1252,8 +1161,6 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, I
// Begin layout at the logical top of our shape inside.
if (logicalHeight() + logicalOffsetFromShapeContainer.height() < shapeInsideInfo->shapeLogicalTop()) {
LayoutUnit logicalHeight = shapeInsideInfo->shapeLogicalTop() - logicalOffsetFromShapeContainer.height();
- if (layoutState.flowThread())
- logicalHeight -= shapeInsideInfo->owner()->borderAndPaddingBefore();
setLogicalHeight(logicalHeight);
}
}
@@ -1337,7 +1244,7 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, I
if (paginated) {
LayoutUnit adjustment = 0;
- adjustLinePositionForPagination(lineBox, adjustment, layoutState.flowThread());
+ adjustLinePositionForPagination(lineBox, adjustment);
if (adjustment) {
LayoutUnit oldLineWidth = availableLogicalWidthForLine(oldLogicalHeight, layoutState.lineInfo().isFirstLine());
lineBox->adjustBlockDirectionPosition(adjustment);
@@ -1353,9 +1260,6 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, I
setLogicalHeight(lineBox->lineBottomWithLeading());
}
-
- if (layoutState.flowThread())
- updateRegionForLine(lineBox);
}
}
}
@@ -1468,14 +1372,12 @@ void RenderBlockFlow::linkToEndLineIfNeeded(LineLayoutState& layoutState)
line->attachLine();
if (paginated) {
delta -= line->paginationStrut();
- adjustLinePositionForPagination(line, delta, layoutState.flowThread());
+ adjustLinePositionForPagination(line, delta);
}
if (delta) {
layoutState.updateRepaintRangeFromBox(line, delta);
line->adjustBlockDirectionPosition(delta);
}
- if (layoutState.flowThread())
- updateRegionForLine(line);
if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) {
Vector<RenderBox*>::iterator end = cleanLineFloats->end();
for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) {
@@ -1509,12 +1411,10 @@ void RenderBlockFlow::linkToEndLineIfNeeded(LineLayoutState& layoutState)
LayoutUnit blockLogicalHeight = logicalHeight();
trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight, textBoxDataMap, verticalPositionCache);
trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight, blockLogicalHeight, blockLogicalHeight, blockLogicalHeight);
- trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthForContent(blockLogicalHeight));
+ trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthForContent());
LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLayoutOverflow - blockLogicalHeight);
LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVisualOverflow - blockLogicalHeight);
trailingFloatsLineBox->setOverflowFromLogicalRects(logicalLayoutOverflow, logicalVisualOverflow, trailingFloatsLineBox->lineTop(), trailingFloatsLineBox->lineBottom());
- if (layoutState.flowThread())
- updateRegionForLine(trailingFloatsLineBox);
}
const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
@@ -1557,13 +1457,10 @@ void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& re
if (view()->layoutState() && view()->layoutState()->lineGrid() == this)
layoutLineGridBox();
- RenderFlowThread* flowThread = flowThreadContainingBlock();
- bool clearLinesForPagination = firstLineBox() && flowThread && !flowThread->hasRegions();
-
// Figure out if we should clear out our line boxes.
// FIXME: Handle resize eventually!
- bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren || clearLinesForPagination;
- LineLayoutState layoutState(isFullLayout, repaintLogicalTop, repaintLogicalBottom, flowThread);
+ bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren;
+ LineLayoutState layoutState(isFullLayout, repaintLogicalTop, repaintLogicalBottom);
if (isFullLayout)
lineBoxes()->deleteLineBoxes();
@@ -1698,12 +1595,12 @@ RootInlineBox* RenderBlockFlow::determineStartPosition(LineLayoutState& layoutSt
size_t floatIndex = 0;
for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextRootBox()) {
if (paginated) {
- if (lineWidthForPaginatedLineChanged(curr, 0, layoutState.flowThread())) {
+ if (lineWidthForPaginatedLineChanged(curr, 0)) {
curr->markDirty();
break;
}
paginationDelta -= curr->paginationStrut();
- adjustLinePositionForPagination(curr, paginationDelta, layoutState.flowThread());
+ adjustLinePositionForPagination(curr, paginationDelta);
if (paginationDelta) {
if (containsFloats() || !layoutState.floats().isEmpty()) {
// FIXME: Do better eventually. For now if we ever shift because of pagination and floats are present just go to a full layout.
@@ -1714,8 +1611,6 @@ RootInlineBox* RenderBlockFlow::determineStartPosition(LineLayoutState& layoutSt
layoutState.updateRepaintRangeFromBox(curr, paginationDelta);
curr->adjustBlockDirectionPosition(paginationDelta);
}
- if (layoutState.flowThread())
- updateRegionForLine(curr);
}
// If a new float has been inserted before this line or before its last known float, just do a full layout.
@@ -1848,24 +1743,6 @@ bool RenderBlockFlow::checkPaginationAndFloatsAtEndLine(LineLayoutState& layoutS
{
LayoutUnit lineDelta = logicalHeight() - layoutState.endLineLogicalTop();
- bool paginated = view()->layoutState() && view()->layoutState()->isPaginated();
- if (paginated && layoutState.flowThread()) {
- // Check all lines from here to the end, and see if the hypothetical new position for the lines will result
- // in a different available line width.
- for (RootInlineBox* lineBox = layoutState.endLine(); lineBox; lineBox = lineBox->nextRootBox()) {
- if (paginated) {
- // This isn't the real move we're going to do, so don't update the line box's pagination
- // strut yet.
- LayoutUnit oldPaginationStrut = lineBox->paginationStrut();
- lineDelta -= oldPaginationStrut;
- adjustLinePositionForPagination(lineBox, lineDelta, layoutState.flowThread());
- lineBox->setPaginationStrut(oldPaginationStrut);
- }
- if (lineWidthForPaginatedLineChanged(lineBox, lineDelta, layoutState.flowThread()))
- return false;
- }
- }
-
if (!lineDelta || !m_floatingObjects)
return true;
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.cpp ('k') | Source/core/rendering/RenderBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698