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

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

Issue 685623005: Add missing reset calls after continue in layoutRunsAndFloatsInRange(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Third attempt 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 | « LayoutTests/fast/html/layout-runs-and-floats-crash-expected.txt ('k') | no next file » | 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 c772e506dd661b0a37c2addde17a6415a3110c2e..c767109eceb31cf16d096eb33c9f35b7255198c2 100644
--- a/Source/core/rendering/RenderBlockLineLayout.cpp
+++ b/Source/core/rendering/RenderBlockLineLayout.cpp
@@ -799,6 +799,8 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState,
LineBreaker lineBreaker(this);
while (!endOfLine.atEnd()) {
+ bool logicalWidthIsAvailable = false;
+
// FIXME: Is this check necessary before the first iteration or can it be moved to the end?
if (checkForEndLineMatch) {
layoutState.setEndLineMatched(matchedEndLine(layoutState, resolver, cleanLineStart, cleanLineBidiStatus));
@@ -881,43 +883,45 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState,
// We have to delete this line, remove all floats that got added, and let line layout re-run.
lineBox->deleteLine();
endOfLine = restartLayoutRunsAndFloatsInRange(oldLogicalHeight, oldLogicalHeight + adjustment, lastFloatFromPreviousLine, resolver, previousEndofLine);
- continue;
+ logicalWidthIsAvailable = true;
+ } else {
+ setLogicalHeight(lineBox->lineBottomWithLeading());
}
-
- setLogicalHeight(lineBox->lineBottomWithLeading());
}
}
}
}
- for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i)
- setStaticPositions(this, lineBreaker.positionedObjects()[i]);
-
- if (!layoutState.lineInfo().isEmpty()) {
- layoutState.lineInfo().setFirstLine(false);
- clearFloats(lineBreaker.clear());
- }
+ if (!logicalWidthIsAvailable) {
+ for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i)
+ setStaticPositions(this, lineBreaker.positionedObjects()[i]);
- if (m_floatingObjects && lastRootBox()) {
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- FloatingObjectSetIterator it = floatingObjectSet.begin();
- FloatingObjectSetIterator end = floatingObjectSet.end();
- if (layoutState.lastFloat()) {
- FloatingObjectSetIterator lastFloatIterator = floatingObjectSet.find(layoutState.lastFloat());
- ASSERT(lastFloatIterator != end);
- ++lastFloatIterator;
- it = lastFloatIterator;
+ if (!layoutState.lineInfo().isEmpty()) {
+ layoutState.lineInfo().setFirstLine(false);
+ clearFloats(lineBreaker.clear());
}
- for (; it != end; ++it) {
- FloatingObject* f = it->get();
- appendFloatingObjectToLastLine(f);
- ASSERT(f->renderer() == 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())
- checkForEndLineMatch = false;
- layoutState.setFloatIndex(layoutState.floatIndex() + 1);
+
+ if (m_floatingObjects && lastRootBox()) {
+ const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+ FloatingObjectSetIterator it = floatingObjectSet.begin();
+ FloatingObjectSetIterator end = floatingObjectSet.end();
+ if (layoutState.lastFloat()) {
+ FloatingObjectSetIterator lastFloatIterator = floatingObjectSet.find(layoutState.lastFloat());
+ ASSERT(lastFloatIterator != end);
+ ++lastFloatIterator;
+ it = lastFloatIterator;
+ }
+ for (; it != end; ++it) {
+ FloatingObject* f = it->get();
+ appendFloatingObjectToLastLine(f);
+ ASSERT(f->renderer() == 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())
+ checkForEndLineMatch = false;
+ layoutState.setFloatIndex(layoutState.floatIndex() + 1);
+ }
+ layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObjectSet.last().get() : 0);
}
- layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObjectSet.last().get() : 0);
}
lineMidpointState.reset();
« no previous file with comments | « LayoutTests/fast/html/layout-runs-and-floats-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698