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

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

Issue 1174053003: Revert of Remove some duplicated code when accounting for floats at line-end (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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.h ('k') | no next file » | 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 7a72556c6adffc96dce70ffea1b62d4ccc6f4389..924b1d52140ee051dd94115e57b832038eeab219 100644
--- a/Source/core/layout/LayoutBlockFlowLine.cpp
+++ b/Source/core/layout/LayoutBlockFlowLine.cpp
@@ -902,8 +902,27 @@
clearFloats(lineBreaker.clear());
}
- if (appendFloatsToEndOfLine(layoutState, true))
- checkForEndLineMatch = false;
+ 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->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())
+ checkForEndLineMatch = false;
+ layoutState.setFloatIndex(layoutState.floatIndex() + 1);
+ }
+ layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObjectSet.last().get() : 0);
+ }
}
lineMidpointState.reset();
@@ -971,37 +990,6 @@
}
clearDidBreakAtLineToAvoidWidow();
-}
-
-bool LayoutBlockFlow::appendFloatsToEndOfLine(LineLayoutState& layoutState, bool updateFloatIndex)
-{
- if (!m_floatingObjects || !lastRootBox())
- return false;
-
- 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;
- }
-
- bool floatChangedSize = false;
- for (; it != end; ++it) {
- FloatingObject* f = it->get();
- appendFloatingObjectToLastLine(f);
- if (updateFloatIndex) {
- ASSERT(f->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())
- floatChangedSize = true;
- layoutState.setFloatIndex(layoutState.floatIndex() + 1);
- }
- }
- layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObjectSet.last().get() : 0);
- return floatChangedSize;
}
void LayoutBlockFlow::linkToEndLineIfNeeded(LineLayoutState& layoutState)
@@ -1038,8 +1026,27 @@
}
}
- if (positionNewFloats())
- appendFloatsToEndOfLine(layoutState, false);
+ if (positionNewFloats() && lastRootBox()) {
+ // In case we have a float on the last line, it might not be positioned up to now.
+ // This has to be done before adding in the bottom border/padding, or the float will
+ // include the padding incorrectly. -dwh
+ 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;
+ }
+ layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObjectSet.last().get() : 0);
+
+ if (it == end)
+ return;
+
+ for (; it != end; ++it)
+ appendFloatingObjectToLastLine(it->get());
+ }
}
void LayoutBlockFlow::markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& floats)
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698