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

Unified Diff: third_party/WebKit/Source/core/layout/line/LineBoxList.cpp

Issue 2828553002: Search correctly for inline ancestors without a sibling when dirtying lineboxes (Closed)
Patch Set: bug 695378 Created 3 years, 8 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 | « third_party/WebKit/LayoutTests/fast/block/float/float-should-dirty-line-when-adjacent-to-line-breaks-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/line/LineBoxList.cpp
diff --git a/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp b/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp
index 8cdb236b02d08de27c8c6f7479faa0570dff9945..fedc8b7bee869fad758de752a0d02e1e2655754d 100644
--- a/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp
+++ b/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp
@@ -289,18 +289,20 @@ void LineBoxList::DirtyLinesFromChangedChild(LineLayoutItem container,
// Try to figure out which line box we belong in. First try to find a previous
// line box by examining our siblings. If we are a float inside an inline then
- // check the siblings of our inline parent. If we didn't find a line box, then
- // use our parent's first line box.
+ // check our nearest inline ancestor with siblings. If we didn't find a line
+ // box, then use our parent's first line box.
RootInlineBox* box = nullptr;
LineLayoutItem curr = child.PreviousSibling();
if (child.IsFloating() && !curr) {
- LineLayoutInline outer_inline;
- for (LineLayoutItem parent = child.Parent();
- parent && parent.IsLayoutInline() && !parent.PreviousSibling();
- parent = parent.Parent())
- outer_inline = LineLayoutInline(parent);
- if (outer_inline)
- curr = outer_inline.PreviousSibling();
+ DCHECK(child.Parent());
+ if (child.Parent().IsLayoutInline()) {
+ LineLayoutItem outer_inline = child.Parent();
+ while (outer_inline && !outer_inline.PreviousSibling() &&
+ outer_inline.Parent().IsLayoutInline())
+ outer_inline = outer_inline.Parent();
+ if (outer_inline)
+ curr = outer_inline.PreviousSibling();
+ }
}
for (; curr; curr = curr.PreviousSibling()) {
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/block/float/float-should-dirty-line-when-adjacent-to-line-breaks-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698