@@ -592,34 +592,15 @@ void RenderBlock::updateLogicalWidthForAlignment(const ETextAlign& textAlign, Bi
592592 }
593593}
594594
595- static IndentTextOrNot requiresIndent ( bool isFirstLine, bool isAfterHardLineBreak, const RenderStyle& style )
595+ static void updateLogicalInlinePositions (RenderBlockFlow& block, float & lineLogicalLeft, float & lineLogicalRight, float & availableLogicalWidth, bool firstLine, IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight )
596596{
597- IndentTextOrNot shouldIndentText = DoNotIndentText;
598- if (isFirstLine)
599- shouldIndentText = IndentText;
600- #if ENABLE(CSS3_TEXT)
601- else if (isAfterHardLineBreak && style.textIndentLine () == TextIndentEachLine)
602- shouldIndentText = IndentText;
603-
604- if (style.textIndentType () == TextIndentHanging)
605- shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : IndentText;
606- #else
607- UNUSED_PARAM (isAfterHardLineBreak);
608- UNUSED_PARAM (style);
609- #endif
610- return shouldIndentText;
611- }
612-
613- static void updateLogicalInlinePositions (RenderBlockFlow* block, float & lineLogicalLeft, float & lineLogicalRight, float & availableLogicalWidth, bool firstLine, IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight)
614- {
615- LayoutUnit lineLogicalHeight = block->minLineHeightForReplacedRenderer (firstLine, boxLogicalHeight);
616- lineLogicalLeft = block->pixelSnappedLogicalLeftOffsetForLine (block->logicalHeight (), shouldIndentText == IndentText, lineLogicalHeight);
617- lineLogicalRight = block->pixelSnappedLogicalRightOffsetForLine (block->logicalHeight (), shouldIndentText == IndentText, lineLogicalHeight);
597+ LayoutUnit lineLogicalHeight = block.minLineHeightForReplacedRenderer (firstLine, boxLogicalHeight);
598+ lineLogicalLeft = block.pixelSnappedLogicalLeftOffsetForLine (block.logicalHeight (), shouldIndentText == IndentText, lineLogicalHeight);
599+ lineLogicalRight = block.pixelSnappedLogicalRightOffsetForLine (block.logicalHeight (), shouldIndentText == IndentText, lineLogicalHeight);
618600 availableLogicalWidth = lineLogicalRight - lineLogicalLeft;
619601}
620602
621- void RenderBlockFlow::computeInlineDirectionPositionsForLine (RootInlineBox* lineBox, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd,
622- GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& wordMeasurements)
603+ void RenderBlockFlow::computeInlineDirectionPositionsForLine (RootInlineBox* lineBox, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& wordMeasurements)
623604{
624605 ETextAlign textAlign = textAlignmentForLine (!reachedEnd && !lineBox->endsWithBreak ());
625606
@@ -633,7 +614,7 @@ void RenderBlockFlow::computeInlineDirectionPositionsForLine(RootInlineBox* line
633614 float lineLogicalLeft;
634615 float lineLogicalRight;
635616 float availableLogicalWidth;
636- updateLogicalInlinePositions (this , lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, 0 );
617+ updateLogicalInlinePositions (* this , lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, 0 );
637618 bool needsWordSpacing;
638619#if ENABLE(CSS_SHAPES)
639620 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo ();
@@ -669,7 +650,7 @@ void RenderBlockFlow::computeInlineDirectionPositionsForLine(RootInlineBox* line
669650
670651 if (firstRun && firstRun->renderer ().isReplaced ()) {
671652 RenderBox& renderBox = toRenderBox (firstRun->renderer ());
672- updateLogicalInlinePositions (this , lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, renderBox.logicalHeight ());
653+ updateLogicalInlinePositions (* this , lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, renderBox.logicalHeight ());
673654 }
674655
675656 computeInlineDirectionPositionsForSegment (lineBox, lineInfo, textAlign, lineLogicalLeft, availableLogicalWidth, firstRun, trailingSpaceRun, textBoxDataMap, verticalPositionCache, wordMeasurements);
@@ -1996,115 +1977,6 @@ bool RenderBlock::generatesLineBoxesForInlineChild(RenderObject* inlineObj)
19961977 return !it.atEnd ();
19971978}
19981979
1999- InlineIterator LineBreaker::nextLineBreak (InlineBidiResolver& resolver, LineInfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurements)
2000- {
2001- #if !ENABLE(CSS_SHAPES)
2002- return nextSegmentBreak (resolver, lineInfo, renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
2003- #else
2004- ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo ();
2005-
2006- if (!shapeInsideInfo || !shapeInsideInfo->lineOverlapsShapeBounds ())
2007- return nextSegmentBreak (resolver, lineInfo, renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
2008-
2009- InlineIterator end = resolver.position ();
2010- InlineIterator oldEnd = end;
2011-
2012- if (!shapeInsideInfo->hasSegments ()) {
2013- end = nextSegmentBreak (resolver, lineInfo, renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
2014- resolver.setPositionIgnoringNestedIsolates (oldEnd);
2015- return oldEnd;
2016- }
2017-
2018- const SegmentList& segments = shapeInsideInfo->segments ();
2019- SegmentRangeList& segmentRanges = shapeInsideInfo->segmentRanges ();
2020-
2021- for (unsigned i = 0 ; i < segments.size () && !end.atEnd (); i++) {
2022- InlineIterator segmentStart = resolver.position ();
2023- end = nextSegmentBreak (resolver, lineInfo, renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
2024-
2025- ASSERT (segmentRanges.size () == i);
2026- if (resolver.position ().atEnd ()) {
2027- segmentRanges.append (LineSegmentRange (segmentStart, end));
2028- break ;
2029- }
2030- if (resolver.position () == end) {
2031- // Nothing fit this segment
2032- end = segmentStart;
2033- segmentRanges.append (LineSegmentRange (segmentStart, segmentStart));
2034- resolver.setPositionIgnoringNestedIsolates (segmentStart);
2035- } else {
2036- // Note that resolver.position is already skipping some of the white space at the beginning of the line,
2037- // so that's why segmentStart might be different than resolver.position().
2038- LineSegmentRange range (resolver.position (), end);
2039- segmentRanges.append (range);
2040- resolver.setPosition (end, numberOfIsolateAncestors (end));
2041-
2042- if (lineInfo.previousLineBrokeCleanly ()) {
2043- // If we hit a new line break, just stop adding anything to this line.
2044- break ;
2045- }
2046- }
2047- }
2048- resolver.setPositionIgnoringNestedIsolates (oldEnd);
2049- return end;
2050- #endif
2051- }
2052-
2053- InlineIterator LineBreaker::nextSegmentBreak (InlineBidiResolver& resolver, LineInfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurements)
2054- {
2055- reset ();
2056-
2057- ASSERT (resolver.position ().root () == &m_block);
2058-
2059- bool appliedStartWidth = resolver.position ().offset ();
2060-
2061- LineWidth width (m_block, lineInfo.isFirstLine (), requiresIndent (lineInfo.isFirstLine (), lineInfo.previousLineBrokeCleanly (), m_block.style ()));
2062-
2063- skipLeadingWhitespace (resolver, lineInfo, lastFloatFromPreviousLine, width);
2064-
2065- if (resolver.position ().atEnd ())
2066- return resolver.position ();
2067-
2068- BreakingContext context (*this , resolver, lineInfo, width, renderTextInfo, lastFloatFromPreviousLine, appliedStartWidth, m_block);
2069-
2070- while (context.currentObject ()) {
2071- context.initializeForCurrentObject ();
2072- if (context.currentObject ()->isBR ()) {
2073- context.handleBR (m_clear);
2074- } else if (context.currentObject ()->isOutOfFlowPositioned ()) {
2075- context.handleOutOfFlowPositioned (m_positionedObjects);
2076- } else if (context.currentObject ()->isFloating ()) {
2077- context.handleFloat ();
2078- } else if (context.currentObject ()->isRenderInline ()) {
2079- context.handleEmptyInline ();
2080- } else if (context.currentObject ()->isReplaced ()) {
2081- context.handleReplaced ();
2082- } else if (context.currentObject ()->isText ()) {
2083- if (context.handleText (wordMeasurements, m_hyphenated, consecutiveHyphenatedLines)) {
2084- // We've hit a hard text line break. Our line break iterator is updated, so go ahead and early return.
2085- return context.lineBreak ();
2086- }
2087- } else if (context.currentObject ()->isLineBreakOpportunity ())
2088- context.commitLineBreakAtCurrentWidth (context.currentObject ());
2089- else
2090- ASSERT_NOT_REACHED ();
2091-
2092- if (context.atEnd ())
2093- return context.handleEndOfLine ();
2094-
2095- context.commitAndUpdateLineBreakIfNeeded ();
2096-
2097- if (context.atEnd ())
2098- return context.handleEndOfLine ();
2099-
2100- context.increment ();
2101- }
2102-
2103- context.clearLineBreakIfFitsOnLine (true );
2104-
2105- return context.handleEndOfLine ();
2106- }
2107-
21081980void RenderBlockFlow::addOverflowFromInlineChildren ()
21091981{
21101982 if (auto layout = simpleLineLayout ()) {
0 commit comments