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

Unified Diff: sky/engine/core/rendering/RenderBlockLineLayout.cpp

Issue 763043002: Remove RenderBlockLineLayout (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: diff2 Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/rendering/RenderBlockLineLayout.cpp
diff --git a/sky/engine/core/rendering/RenderBlockLineLayout.cpp b/sky/engine/core/rendering/RenderBlockLineLayout.cpp
index 3ce73cb00390ae60f8c140067ebf61645e8e2029..c8eba812db5da214c58d7cff1fdf8060d600dc20 100644
--- a/sky/engine/core/rendering/RenderBlockLineLayout.cpp
+++ b/sky/engine/core/rendering/RenderBlockLineLayout.cpp
@@ -82,7 +82,7 @@ static bool parentIsConstructedOrHaveNext(InlineFlowBox* parentBox)
return false;
}
-InlineFlowBox* RenderBlockFlow::createLineBoxes(RenderObject* obj, const LineInfo& lineInfo, InlineBox* childBox)
+InlineFlowBox* RenderParagraph::createLineBoxes(RenderObject* obj, const LineInfo& lineInfo, InlineBox* childBox)
{
// See if we have an unconstructed line box for this object that is also
// the last item on the line.
@@ -173,7 +173,7 @@ static bool reachedEndOfTextRenderer(const BidiRunList<BidiRun>& bidiRuns)
return endsWithASCIISpaces(renderText->characters16(), pos, length);
}
-RootInlineBox* RenderBlockFlow::constructLine(BidiRunList<BidiRun>& bidiRuns, const LineInfo& lineInfo)
+RootInlineBox* RenderParagraph::constructLine(BidiRunList<BidiRun>& bidiRuns, const LineInfo& lineInfo)
{
ASSERT(bidiRuns.firstRun());
@@ -244,7 +244,7 @@ RootInlineBox* RenderBlockFlow::constructLine(BidiRunList<BidiRun>& bidiRuns, co
return lastRootBox();
}
-ETextAlign RenderBlockFlow::textAlignmentForLine(bool endsWithSoftBreak) const
+ETextAlign RenderParagraph::textAlignmentForLine(bool endsWithSoftBreak) const
{
ETextAlign alignment = style()->textAlign();
if (endsWithSoftBreak)
@@ -279,6 +279,7 @@ ETextAlign RenderBlockFlow::textAlignmentForLine(bool endsWithSoftBreak) const
return alignment;
}
+// Moved to RenderBlockFlow
static void updateLogicalWidthForLeftAlignedBlock(bool isLeftToRightDirection, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float availableLogicalWidth)
{
// The direction of the block should determine what happens with wide lines.
@@ -295,6 +296,7 @@ static void updateLogicalWidthForLeftAlignedBlock(bool isLeftToRightDirection, B
logicalLeft -= (totalLogicalWidth - availableLogicalWidth);
}
+// Moved to RenderBlockFlow
static void updateLogicalWidthForRightAlignedBlock(bool isLeftToRightDirection, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float availableLogicalWidth)
{
// Wide lines spill out of the block based off direction.
@@ -317,6 +319,7 @@ static void updateLogicalWidthForRightAlignedBlock(bool isLeftToRightDirection,
logicalLeft += availableLogicalWidth - totalLogicalWidth;
}
+// Moved to RenderBlockFlow
static void updateLogicalWidthForCenterAlignedBlock(bool isLeftToRightDirection, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float availableLogicalWidth)
{
float trailingSpaceWidth = 0;
@@ -444,6 +447,7 @@ static inline void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun*
}
}
+// Moved to RenderBlockFlow
void RenderBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign, const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, unsigned expansionOpportunityCount)
{
TextDirection direction;
@@ -491,14 +495,14 @@ void RenderBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign
}
}
-static void updateLogicalInlinePositions(RenderBlockFlow* block, float& lineLogicalLeft, float& lineLogicalRight, float& availableLogicalWidth, IndentTextOrNot shouldIndentText)
+static void updateLogicalInlinePositions(RenderParagraph* block, float& lineLogicalLeft, float& lineLogicalRight, float& availableLogicalWidth, IndentTextOrNot shouldIndentText)
{
lineLogicalLeft = block->logicalLeftOffsetForLine(shouldIndentText == IndentText).toFloat();
lineLogicalRight = block->logicalRightOffsetForLine(shouldIndentText == IndentText).toFloat();
availableLogicalWidth = lineLogicalRight - lineLogicalLeft;
}
-void RenderBlockFlow::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd,
+void RenderParagraph::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd,
GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& wordMeasurements)
{
ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWithBreak());
@@ -526,7 +530,7 @@ void RenderBlockFlow::computeInlineDirectionPositionsForLine(RootInlineBox* line
lineBox->placeBoxesInInlineDirection(lineLogicalLeft, needsWordSpacing);
}
-BidiRun* RenderBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBox* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, float& logicalLeft,
+BidiRun* RenderParagraph::computeInlineDirectionPositionsForSegment(RootInlineBox* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, float& logicalLeft,
float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache,
WordMeasurements& wordMeasurements)
{
@@ -590,7 +594,7 @@ BidiRun* RenderBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo
return r;
}
-void RenderBlockFlow::computeBlockDirectionPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap,
+void RenderParagraph::computeBlockDirectionPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap,
VerticalPositionCache& verticalPositionCache)
{
setLogicalHeight(lineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, verticalPositionCache));
@@ -616,7 +620,7 @@ void RenderBlockFlow::computeBlockDirectionPositionsForLine(RootInlineBox* lineB
}
// This function constructs line boxes for all of the text runs in the resolver and computes their position.
-RootInlineBox* RenderBlockFlow::createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, VerticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeasurements& wordMeasurements)
+RootInlineBox* RenderParagraph::createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, VerticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeasurements& wordMeasurements)
{
if (!bidiRuns.runCount())
return 0;
@@ -658,7 +662,7 @@ static void deleteLineRange(LineLayoutState& layoutState, RootInlineBox* startLi
}
}
-void RenderBlockFlow::layoutRunsAndFloats(LineLayoutState& layoutState)
+void RenderParagraph::layoutRunsAndFloats(LineLayoutState& layoutState)
{
// We want to skip ahead to the first dirty line
InlineBidiResolver resolver;
@@ -682,15 +686,7 @@ void RenderBlockFlow::layoutRunsAndFloats(LineLayoutState& layoutState)
markDirtyFloatsForPaintInvalidation(layoutState.floats());
}
-// Before restarting the layout loop with a new logicalHeight, remove all floats that were added and reset the resolver.
-inline const InlineIterator& RenderBlockFlow::restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogicalHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine, InlineBidiResolver& resolver, const InlineIterator& oldEnd)
rafaelw 2014/11/27 19:22:16 dead code
-{
- setLogicalHeight(newLogicalHeight);
- resolver.setPositionIgnoringNestedIsolates(oldEnd);
- return oldEnd;
-}
-
-void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState,
+void RenderParagraph::layoutRunsAndFloatsInRange(LineLayoutState& layoutState,
InlineBidiResolver& resolver, const InlineIterator& cleanLineStart,
const BidiStatus& cleanLineBidiStatus)
{
@@ -784,7 +780,7 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState,
}
}
-void RenderBlockFlow::linkToEndLineIfNeeded(LineLayoutState& layoutState)
+void RenderParagraph::linkToEndLineIfNeeded(LineLayoutState& layoutState)
{
if (layoutState.endLine()) {
if (layoutState.endLineMatched()) {
@@ -805,7 +801,7 @@ void RenderBlockFlow::linkToEndLineIfNeeded(LineLayoutState& layoutState)
}
}
-void RenderBlockFlow::markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& floats)
+void RenderParagraph::markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& floats)
{
size_t floatCount = floats.size();
// Floats that did not have layout did not paint invalidations when we laid them out. They would have
@@ -834,8 +830,8 @@ struct InlineMinMaxIterator {
RenderObject* current;
bool endOfInline;
- InlineMinMaxIterator(RenderObject* p, bool end = false)
- : parent(p), current(p), endOfInline(end)
+ InlineMinMaxIterator(RenderObject* p)
+ : parent(p), current(p), endOfInline(false)
{
}
@@ -939,7 +935,7 @@ static inline LayoutUnit adjustFloatForSubPixelLayout(float value)
// FIXME: This function should be broken into something less monolithic.
// FIXME: The main loop here is very similar to LineBreaker::nextSegmentBreak. They can probably reuse code.
-void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth)
+void RenderParagraph::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
float inlineMax = 0;
float inlineMin = 0;
@@ -956,7 +952,7 @@ void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogical
bool autoWrap, oldAutoWrap;
autoWrap = oldAutoWrap = styleToUse->autoWrap();
- InlineMinMaxIterator childIterator(this);
+ InlineMinMaxIterator childIterator(const_cast<RenderParagraph*>(this));
// Only gets added to the max preffered width once.
bool addedTextIndent = false;
@@ -1190,9 +1186,11 @@ void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogical
updatePreferredWidth(minLogicalWidth, inlineMin);
updatePreferredWidth(maxLogicalWidth, inlineMax);
+
+ maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
}
-void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge)
+void RenderParagraph::layoutChildren(bool relayoutChildren, SubtreeLayoutScope& layoutScope, LayoutUnit& paintInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit beforeEdge, LayoutUnit afterEdge)
{
// Figure out if we should clear out our line boxes.
// FIXME: Handle resize eventually!
@@ -1285,7 +1283,7 @@ void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa
setShouldDoFullPaintInvalidation(true);
}
-void RenderBlockFlow::checkFloatsInCleanLine(RootInlineBox* line, Vector<FloatWithRect>& floats, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByFloat)
+void RenderParagraph::checkFloatsInCleanLine(RootInlineBox* line, Vector<FloatWithRect>& floats, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByFloat)
{
Vector<RenderBox*>* cleanLineFloats = line->floatsPtr();
if (!cleanLineFloats)
@@ -1314,7 +1312,7 @@ void RenderBlockFlow::checkFloatsInCleanLine(RootInlineBox* line, Vector<FloatWi
}
}
-RootInlineBox* RenderBlockFlow::determineStartPosition(LineLayoutState& layoutState, InlineBidiResolver& resolver)
+RootInlineBox* RenderParagraph::determineStartPosition(LineLayoutState& layoutState, InlineBidiResolver& resolver)
{
RootInlineBox* curr = 0;
RootInlineBox* last = 0;
@@ -1395,7 +1393,7 @@ RootInlineBox* RenderBlockFlow::determineStartPosition(LineLayoutState& layoutSt
return curr;
}
-void RenderBlockFlow::determineEndPosition(LineLayoutState& layoutState, RootInlineBox* startLine, InlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStatus)
+void RenderParagraph::determineEndPosition(LineLayoutState& layoutState, RootInlineBox* startLine, InlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStatus)
{
ASSERT(!layoutState.endLine());
size_t floatIndex = layoutState.floatIndex();
@@ -1432,13 +1430,13 @@ void RenderBlockFlow::determineEndPosition(LineLayoutState& layoutState, RootInl
layoutState.setEndLine(last);
}
-bool RenderBlockFlow::checkPaginationAndFloatsAtEndLine(LineLayoutState& layoutState)
+bool RenderParagraph::checkPaginationAndFloatsAtEndLine(LineLayoutState& layoutState)
{
// FIXME(sky): Remove this.
return true;
}
-bool RenderBlockFlow::matchedEndLine(LineLayoutState& layoutState, const InlineBidiResolver& resolver, const InlineIterator& endLineStart, const BidiStatus& endLineStatus)
+bool RenderParagraph::matchedEndLine(LineLayoutState& layoutState, const InlineBidiResolver& resolver, const InlineIterator& endLineStart, const BidiStatus& endLineStatus)
{
if (resolver.position() == endLineStart) {
if (resolver.status() != endLineStatus)
@@ -1474,20 +1472,7 @@ bool RenderBlockFlow::matchedEndLine(LineLayoutState& layoutState, const InlineB
return false;
}
-bool RenderBlockFlow::generatesLineBoxesForInlineChild(RenderObject* inlineObj)
rafaelw 2014/11/27 19:22:16 dead code
-
-{
- ASSERT(inlineObj->parent() == this);
-
- InlineIterator it(this, inlineObj, 0);
- // FIXME: We should pass correct value for WhitespacePosition.
- while (!it.atEnd() && !requiresLineBox(it))
- it.increment();
-
- return !it.atEnd();
-}
-
-void RenderBlockFlow::deleteEllipsisLineBoxes()
+void RenderParagraph::deleteEllipsisLineBoxes()
{
ETextAlign textAlign = style()->textAlign();
bool ltr = style()->isLeftToRightDirection();
@@ -1511,7 +1496,7 @@ void RenderBlockFlow::deleteEllipsisLineBoxes()
}
}
-void RenderBlockFlow::checkLinesForTextOverflow()
+void RenderParagraph::checkLinesForTextOverflow()
{
// Determine the width of the ellipsis using the current font.
// FIXME: CSS3 says this is configurable, also need to use 0x002E (FULL STOP) if horizontal ellipsis is "not renderable"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698