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..43085b849537bf6e536b9917ed9b2d933829e23c 100644 |
--- a/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp |
+++ b/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp |
@@ -289,16 +289,16 @@ 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); |
+ LineLayoutItem parent = child.Parent(); |
mstensho (USE GERRIT)
2017/04/19 11:37:24
|parent| is only needed if child.IsFloating(), so
|
+ if (child.IsFloating() && !curr && parent && parent.IsLayoutInline()) { |
+ LineLayoutItem outer_inline = parent; |
+ while (outer_inline && outer_inline.Parent().IsLayoutInline() && |
+ !outer_inline.PreviousSibling()) |
mstensho (USE GERRIT)
2017/04/19 11:37:24
Could you check !outer_inline.PreviousSibling() BE
|
+ outer_inline = outer_inline.Parent(); |
if (outer_inline) |
curr = outer_inline.PreviousSibling(); |
} |