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

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

Issue 10869055: Merge 125810 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 4 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 | « LayoutTests/fast/replaced/replaced-last-line-layout-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/RenderBlockLineLayout.cpp
===================================================================
--- Source/WebCore/rendering/RenderBlockLineLayout.cpp (revision 126629)
+++ Source/WebCore/rendering/RenderBlockLineLayout.cpp (working copy)
@@ -1493,8 +1493,13 @@
deleteEllipsisLineBoxes();
if (firstChild()) {
- // layout replaced elements
+ // In full layout mode, clear the line boxes of children upfront. Otherwise,
+ // siblings can run into stale root lineboxes during layout. Then layout
+ // the replaced elements later. In partial layout mode, line boxes are not
+ // deleted and only dirtied. In that case, we can layout the replaced
+ // elements at the same time.
bool hasInlineChild = false;
+ Vector<RenderBox*> replacedChildren;
for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
RenderObject* o = walker.current();
if (!hasInlineChild && o->isInline())
@@ -1514,9 +1519,13 @@
o->containingBlock()->insertPositionedObject(box);
else if (o->isFloating())
layoutState.floats().append(FloatWithRect(box));
- else if (layoutState.isFullLayout() || o->needsLayout()) {
- // Replaced elements
- toRenderBox(o)->dirtyLineBoxes(layoutState.isFullLayout());
+ else if (isFullLayout || o->needsLayout()) {
+ // Replaced element.
+ box->dirtyLineBoxes(isFullLayout);
+ if (isFullLayout)
+ replacedChildren.append(box);
+ else
+ o->layoutIfNeeded();
}
} else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInline())) {
if (!o->isText())
@@ -1527,6 +1536,11 @@
}
}
+ if (replacedChildren.size()) {
+ for (size_t i = 0; i < replacedChildren.size(); i++)
+ replacedChildren[i]->layoutIfNeeded();
+ }
+
layoutRunsAndFloats(layoutState, hasInlineChild);
}
@@ -2286,7 +2300,6 @@
width.addUncommittedWidth(borderPaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox));
} else if (current.m_obj->isReplaced()) {
RenderBox* replacedBox = toRenderBox(current.m_obj);
- replacedBox->layoutIfNeeded();
// Break on replaced elements if either has normal white-space.
if ((autoWrap || RenderStyle::autoWrap(lastWS)) && (!current.m_obj->isImage() || allowImagesToBreak)) {
« no previous file with comments | « LayoutTests/fast/replaced/replaced-last-line-layout-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698