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

Unified Diff: Source/core/layout/LayoutBlockFlowLine.cpp

Issue 763173003: Convert RenderBlockFlow code to use FloatingObject references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 6 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/layout/LayoutBlockFlow.cpp ('k') | Source/core/layout/line/BreakingContextInlineHeaders.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutBlockFlowLine.cpp
diff --git a/Source/core/layout/LayoutBlockFlowLine.cpp b/Source/core/layout/LayoutBlockFlowLine.cpp
index a8a63c0d13d331f5898467932211a4019c3a46bf..bbc061951f8f317185ebd0ba03dc4d83c6eeb9c8 100644
--- a/Source/core/layout/LayoutBlockFlowLine.cpp
+++ b/Source/core/layout/LayoutBlockFlowLine.cpp
@@ -611,11 +611,11 @@ void LayoutBlockFlow::computeBlockDirectionPositionsForLine(RootInlineBox* lineB
}
}
-void LayoutBlockFlow::appendFloatingObjectToLastLine(FloatingObject* floatingObject)
+void LayoutBlockFlow::appendFloatingObjectToLastLine(FloatingObject& floatingObject)
{
- ASSERT(!floatingObject->originatingLine());
- floatingObject->setOriginatingLine(lastRootBox());
- lastRootBox()->appendFloat(floatingObject->layoutObject());
+ ASSERT(!floatingObject.originatingLine());
+ floatingObject.setOriginatingLine(lastRootBox());
+ lastRootBox()->appendFloat(floatingObject.layoutObject());
}
// This function constructs line boxes for all of the text runs in the resolver and computes their position.
@@ -854,11 +854,11 @@ void LayoutBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState,
it = lastFloatIterator;
}
for (; it != end; ++it) {
- FloatingObject* f = it->get();
- appendFloatingObjectToLastLine(f);
- ASSERT(f->layoutObject() == layoutState.floats()[layoutState.floatIndex()].object);
+ FloatingObject& floatingObject = *it->get();
+ appendFloatingObjectToLastLine(floatingObject);
+ ASSERT(floatingObject.layoutObject() == layoutState.floats()[layoutState.floatIndex()].object);
// If a float's geometry has changed, give up on syncing with clean lines.
- if (layoutState.floats()[layoutState.floatIndex()].rect != f->frameRect())
+ if (layoutState.floats()[layoutState.floatIndex()].rect != floatingObject.frameRect())
checkForEndLineMatch = false;
layoutState.setFloatIndex(layoutState.floatIndex() + 1);
}
@@ -1002,7 +1002,7 @@ void LayoutBlockFlow::linkToEndLineIfNeeded(LineLayoutState& layoutState)
}
for (; it != end; ++it)
- appendFloatingObjectToLastLine(it->get());
+ appendFloatingObjectToLastLine(*it->get());
}
}
@@ -1780,7 +1780,7 @@ bool LayoutBlockFlow::checkPaginationAndFloatsAtEndLine(LineLayoutState& layoutS
const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
FloatingObjectSetIterator end = floatingObjectSet.end();
for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* floatingObject = it->get();
+ const FloatingObject& floatingObject = *it->get();
if (logicalBottomForFloat(floatingObject) >= logicalTop && logicalBottomForFloat(floatingObject) < logicalBottom)
return false;
}
@@ -1954,7 +1954,7 @@ void LayoutBlockFlow::checkLinesForTextOverflow()
}
}
-bool LayoutBlockFlow::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width)
+bool LayoutBlockFlow::positionNewFloatOnLine(FloatingObject& newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width)
{
if (!positionNewFloats(&width))
return false;
@@ -1962,14 +1962,14 @@ bool LayoutBlockFlow::positionNewFloatOnLine(FloatingObject* newFloat, FloatingO
// We only connect floats to lines for pagination purposes if the floats occur at the start of
// the line and the previous line had a hard break (so this line is either the first in the block
// or follows a <br>).
- if (!newFloat->paginationStrut() || !lineInfo.previousLineBrokeCleanly() || !lineInfo.isEmpty())
+ if (!newFloat.paginationStrut() || !lineInfo.previousLineBrokeCleanly() || !lineInfo.isEmpty())
return true;
const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- ASSERT(floatingObjectSet.last() == newFloat);
+ ASSERT(floatingObjectSet.last() == &newFloat);
LayoutUnit floatLogicalTop = logicalTopForFloat(newFloat);
- int paginationStrut = newFloat->paginationStrut();
+ int paginationStrut = newFloat.paginationStrut();
if (floatLogicalTop - paginationStrut != logicalHeight() + lineInfo.floatPaginationStrut())
return true;
@@ -1979,12 +1979,12 @@ bool LayoutBlockFlow::positionNewFloatOnLine(FloatingObject* newFloat, FloatingO
FloatingObjectSetIterator begin = floatingObjectSet.begin();
while (it != begin) {
--it;
- FloatingObject* floatingObject = it->get();
- if (floatingObject == lastFloatFromPreviousLine)
+ FloatingObject& floatingObject = *it->get();
+ if (&floatingObject == lastFloatFromPreviousLine)
break;
if (logicalTopForFloat(floatingObject) == logicalHeight() + lineInfo.floatPaginationStrut()) {
- floatingObject->setPaginationStrut(paginationStrut + floatingObject->paginationStrut());
- LayoutBox* floatBox = floatingObject->layoutObject();
+ floatingObject.setPaginationStrut(paginationStrut + floatingObject.paginationStrut());
+ LayoutBox* floatBox = floatingObject.layoutObject();
setLogicalTopForChild(*floatBox, logicalTopForChild(*floatBox) + marginBeforeForChild(*floatBox) + paginationStrut);
if (floatBox->isLayoutBlock())
floatBox->forceChildLayout();
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.cpp ('k') | Source/core/layout/line/BreakingContextInlineHeaders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698