Chromium Code Reviews| Index: Source/core/rendering/RenderBlockLineLayout.cpp |
| diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp |
| index 6a5513ad5235bfc1ad578bf525f2a28f73d89448..a48562ae0f7403e6f991e3001e066226bfceec0e 100644 |
| --- a/Source/core/rendering/RenderBlockLineLayout.cpp |
| +++ b/Source/core/rendering/RenderBlockLineLayout.cpp |
| @@ -610,35 +610,6 @@ void RenderBlockFlow::computeInlineDirectionPositionsForLine(RootInlineBox* line |
| float availableLogicalWidth; |
| updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, 0); |
| bool needsWordSpacing; |
| - ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo(); |
| - if (shapeInsideInfo && shapeInsideInfo->hasSegments()) { |
| - BidiRun* segmentStart = firstRun; |
| - const SegmentList& segments = shapeInsideInfo->segments(); |
| - float logicalLeft = max<float>(segments[0].logicalLeft, lineLogicalLeft); |
| - float logicalRight = min<float>(segments[0].logicalRight, lineLogicalRight); |
| - float startLogicalLeft = logicalLeft; |
| - float endLogicalRight = logicalLeft; |
| - float minLogicalLeft = logicalLeft; |
| - float maxLogicalRight = logicalLeft; |
| - lineBox->beginPlacingBoxRangesInInlineDirection(logicalLeft); |
| - for (size_t i = 0; i < segments.size(); i++) { |
| - if (i) { |
| - logicalLeft = max<float>(segments[i].logicalLeft, lineLogicalLeft); |
| - logicalRight = min<float>(segments[i].logicalRight, lineLogicalRight); |
| - } |
| - availableLogicalWidth = logicalRight - logicalLeft; |
| - BidiRun* newSegmentStart = computeInlineDirectionPositionsForSegment(lineBox, lineInfo, textAlign, logicalLeft, availableLogicalWidth, segmentStart, trailingSpaceRun, textBoxDataMap, verticalPositionCache, wordMeasurements); |
| - needsWordSpacing = false; |
| - endLogicalRight = lineBox->placeBoxRangeInInlineDirection(segmentStart->m_box, newSegmentStart ? newSegmentStart->m_box : 0, logicalLeft, minLogicalLeft, maxLogicalRight, needsWordSpacing, textBoxDataMap); |
| - if (!newSegmentStart || !newSegmentStart->next()) |
| - break; |
| - ASSERT(newSegmentStart->m_startsSegment); |
| - // Discard the empty segment start marker bidi runs |
| - segmentStart = newSegmentStart->next(); |
| - } |
| - lineBox->endPlacingBoxRangesInInlineDirection(startLogicalLeft, endLogicalRight, minLogicalLeft, maxLogicalRight); |
| - return; |
| - } |
| if (firstRun && firstRun->m_object->isReplaced()) { |
| RenderBox* renderBox = toRenderBox(firstRun->m_object); |
| @@ -859,33 +830,7 @@ static inline bool segmentIsEmpty(const InlineIterator& segmentStart, const Inli |
| static inline void constructBidiRunsForLine(const RenderBlockFlow* block, InlineBidiResolver& topResolver, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& endOfLine, VisualDirectionOverride override, bool previousLineBrokeCleanly, bool isNewUBAParagraph) |
| { |
| - ShapeInsideInfo* shapeInsideInfo = block->layoutShapeInsideInfo(); |
| - if (!shapeInsideInfo || !shapeInsideInfo->hasSegments()) { |
| - constructBidiRunsForSegment(topResolver, bidiRuns, endOfLine, override, previousLineBrokeCleanly, isNewUBAParagraph); |
| - return; |
| - } |
| - |
| - const SegmentRangeList& segmentRanges = shapeInsideInfo->segmentRanges(); |
| - ASSERT(segmentRanges.size()); |
| - |
| - for (size_t i = 0; i < segmentRanges.size(); i++) { |
| - LineSegmentIterator iterator = segmentRanges[i].start; |
| - InlineIterator segmentStart(iterator.root, iterator.object, iterator.offset); |
| - iterator = segmentRanges[i].end; |
| - InlineIterator segmentEnd(iterator.root, iterator.object, iterator.offset); |
| - if (i) { |
| - ASSERT(segmentStart.object()); |
| - BidiRun* segmentMarker = createRun(segmentStart.offset(), segmentStart.offset(), segmentStart.object(), topResolver); |
| - segmentMarker->m_startsSegment = true; |
| - bidiRuns.addRun(segmentMarker); |
| - // Do not collapse midpoints between segments |
| - topResolver.midpointState().setBetweenMidpoints(false); |
| - } |
| - if (!segmentIsEmpty(segmentStart, segmentEnd)) { |
| - topResolver.setPosition(segmentStart, numberOfIsolateAncestors(segmentStart)); |
| - constructBidiRunsForSegment(topResolver, bidiRuns, segmentEnd, override, previousLineBrokeCleanly, isNewUBAParagraph); |
| - } |
| - } |
| + constructBidiRunsForSegment(topResolver, bidiRuns, endOfLine, override, previousLineBrokeCleanly, isNewUBAParagraph); |
|
Bem Jones-Bey (adobe)
2014/03/27 00:09:47
You should remove constructBidiRunsForSegment and
|
| } |
| // This function constructs line boxes for all of the text runs in the resolver and computes their position. |
| @@ -1012,165 +957,6 @@ inline const InlineIterator& RenderBlockFlow::restartLayoutRunsAndFloatsInRange( |
| return oldEnd; |
| } |
| -static inline LayoutUnit adjustLogicalLineTop(ShapeInsideInfo* shapeInsideInfo, InlineIterator start, InlineIterator end, const WordMeasurements& wordMeasurements) |
| -{ |
| - if (!shapeInsideInfo || end != start) |
| - return 0; |
| - |
| - float minWidth = firstPositiveWidth(wordMeasurements); |
| - ASSERT(minWidth || wordMeasurements.isEmpty()); |
| - if (minWidth > 0 && shapeInsideInfo->adjustLogicalLineTop(minWidth)) |
| - return shapeInsideInfo->logicalLineTop(); |
| - |
| - return shapeInsideInfo->shapeLogicalBottom(); |
| -} |
| - |
| -static inline void pushShapeContentOverflowBelowTheContentBox(RenderBlockFlow* block, ShapeInsideInfo* shapeInsideInfo, LayoutUnit lineTop, LayoutUnit lineHeight) |
| -{ |
| - ASSERT(shapeInsideInfo); |
| - |
| - LayoutUnit logicalLineBottom = lineTop + lineHeight; |
| - LayoutUnit shapeLogicalBottom = shapeInsideInfo->shapeLogicalBottom(); |
| - LayoutUnit shapeContainingBlockHeight = shapeInsideInfo->shapeContainingBlockHeight(); |
| - |
| - bool isOverflowPositionedAlready = (shapeContainingBlockHeight - shapeInsideInfo->owner().borderAndPaddingAfter() + lineHeight) <= lineTop; |
| - |
| - // If the last line overlaps with the shape, we don't need the segments anymore |
| - if (lineTop < shapeLogicalBottom && shapeLogicalBottom < logicalLineBottom) |
| - shapeInsideInfo->clearSegments(); |
| - if (logicalLineBottom <= shapeLogicalBottom || !shapeContainingBlockHeight || isOverflowPositionedAlready) |
| - return; |
| - |
| - LayoutUnit newLogicalHeight = block->logicalHeight() + (shapeContainingBlockHeight - (lineTop + shapeInsideInfo->owner().borderAndPaddingAfter())); |
| - block->setLogicalHeight(newLogicalHeight); |
| -} |
| - |
| -void RenderBlockFlow::updateShapeAndSegmentsForCurrentLine(ShapeInsideInfo*& shapeInsideInfo, const LayoutSize& logicalOffsetFromShapeContainer, LineLayoutState& layoutState) |
| -{ |
| - if (layoutState.flowThread()) |
| - return updateShapeAndSegmentsForCurrentLineInFlowThread(shapeInsideInfo, layoutState); |
| - |
| - if (!shapeInsideInfo) |
| - return; |
| - |
| - LayoutUnit lineTop = logicalHeight() + logicalOffsetFromShapeContainer.height(); |
| - LayoutUnit lineLeft = logicalOffsetFromShapeContainer.width(); |
| - LayoutUnit lineHeight = this->lineHeight(layoutState.lineInfo().isFirstLine(), isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); |
| - |
| - // FIXME: Bug 95361: It is possible for a line to grow beyond lineHeight, in which case these segments may be incorrect. |
| - shapeInsideInfo->updateSegmentsForLine(LayoutSize(lineLeft, lineTop), lineHeight); |
| - |
| - 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); |
| - |
| - if (shapeInsideInfo && containsFloats()) { |
| - lastFloatFromPreviousLine = m_floatingObjects->set().last(); |
| - if (!wordMeasurements.size()) { |
| - LayoutUnit floatLogicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(logicalSizeForFloat(lastFloatFromPreviousLine)); |
| - if (logicalHeight() < floatLogicalTopOffset) |
| - adjustedLogicalLineTop = floatLogicalTopOffset; |
| - } |
| - } |
| - |
| - if (!adjustedLogicalLineTop) |
| - return false; |
| - |
| - LayoutUnit newLogicalHeight = adjustedLogicalLineTop - absoluteLogicalTop; |
| - |
| - if (layoutState.flowThread()) { |
| - layoutState.setAdjustedLogicalLineTop(adjustedLogicalLineTop); |
| - newLogicalHeight = logicalHeight(); |
| - } |
| - |
| - end = restartLayoutRunsAndFloatsInRange(logicalHeight(), newLogicalHeight, lastFloatFromPreviousLine, resolver, end); |
| - return true; |
| -} |
| - |
| void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines) |
| { |
| RenderStyle* styleToUse = style(); |
| @@ -1184,22 +970,6 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, I |
| LineBreaker lineBreaker(this); |
| LayoutSize logicalOffsetFromShapeContainer; |
| - ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo(); |
| - if (shapeInsideInfo) { |
| - ASSERT(&shapeInsideInfo->owner() == this || allowsShapeInsideInfoSharing(&shapeInsideInfo->owner())); |
| - if (shapeInsideInfo != this->shapeInsideInfo()) { |
| - // FIXME Bug 100284: If subsequent LayoutStates are pushed, we will have to add |
| - // their offsets from the original shape-inside container. |
| - logicalOffsetFromShapeContainer = logicalOffsetFromShapeAncestorContainer(&shapeInsideInfo->owner()); |
| - } |
| - // 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); |
| - } |
| - } |
| while (!endOfLine.atEnd()) { |
| // FIXME: Is this check necessary before the first iteration or can it be moved to the end? |
| @@ -1220,10 +990,8 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, I |
| bool isNewUBAParagraph = layoutState.lineInfo().previousLineBrokeCleanly(); |
| FloatingObject* lastFloatFromPreviousLine = (containsFloats()) ? m_floatingObjects->set().last() : 0; |
| - updateShapeAndSegmentsForCurrentLine(shapeInsideInfo, logicalOffsetFromShapeContainer, layoutState); |
| - |
| WordMeasurements wordMeasurements; |
| - endOfLine = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements); |
| + endOfLine = lineBreaker.nextSegmentBreak(resolver, layoutState.lineInfo(), renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements); |
|
Bem Jones-Bey (adobe)
2014/03/27 00:09:47
Shouldn't this be nextLineBreak? We shouldn't have
|
| renderTextInfo.m_lineBreakIterator.resetPriorContext(); |
| if (resolver.position().atEnd()) { |
| // FIXME: We shouldn't be creating any runs in nextLineBreak to begin with! |
| @@ -1235,9 +1003,6 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, I |
| break; |
| } |
| - if (adjustLogicalLineTopAndLogicalHeightIfNeeded(shapeInsideInfo, logicalOffsetFromShapeContainer.height(), layoutState, resolver, lastFloatFromPreviousLine, endOfLine, wordMeasurements)) |
| - continue; |
| - |
| ASSERT(endOfLine != resolver.position()); |
| // This is a short-cut for empty lines. |