Commit c7a0755e authored by robhogan's avatar robhogan Committed by Commit bot

Search correctly for inline ancestors without a sibling when dirtying lineboxes

Fixes a mistake in https://codereview.chromium.org/2486423003 - it should have
checked whether the current child has a previous sibling, not the candidate parent.

Also revert to the original version of the two tests - as the new versions never
fail.

BUG=695378

Review-Url: https://codereview.chromium.org/2828553002
Cr-Commit-Position: refs/heads/master@{#465686}
parent a5a9fddc
<!DOCTYPE html> <!DOCTYPE html>
<script src="../../../resources/ahem.js"></script>
<p>crbug.com/648342: The text should be on two lines.</p> <p>crbug.com/648342: The text should be on two lines.</p>
<div style="width:260px; font-size: 12px; font-family: ahem, sans-serif;"> <div style="width:260px; font-size: 12px; font-family: arial, sans-serif;">
<br><br>Text Text <br> Text Text <br><br>Text Text Text Text Text Text <br> Text Text Text
</div> </div>
<!DOCTYPE html> <!DOCTYPE html>
<script src="../../../resources/ahem.js"></script>
<p>crbug.com/648342: The text should be on two lines.</p> <p>crbug.com/648342: The text should be on two lines.</p>
<div style="width:260px; font-size: 12px; font-family: ahem, sans-serif;"> <div style="width:260px; font-size: 12px; font-family: arial, sans-serif;">
<span></span><br><br><span><a><img src="../../../canvas/philip/images/transparent.png" widht="100" height="50" align="right"></a>Text Text Text Text</span><br><span></span> <span></span><br><br><span><a><img src="../../../canvas/philip/images/transparent.png" align="right">Text Text Text Text Text Text Text Text Text</a></span><br><span></span>
</div> </div>
<!DOCTYPE html> <!DOCTYPE html>
<script src="../../../resources/ahem.js"></script>
<p>crbug.com/648342: The text should be on two lines.</p> <p>crbug.com/648342: The text should be on two lines.</p>
<div style="width:260px; font-size: 12px; font-family: ahem, sans-serif;"> <div style="width:260px; font-size: 12px; font-family: arial, sans-serif;">
<br><br>Text Text <br> Text Text <br><br>Text Text Text Text Text Text <br> Text Text Text
</div> </div>
<!DOCTYPE html> <!DOCTYPE html>
<script src="../../../resources/ahem.js"></script>
<p>crbug.com/648342: The text should be on two lines.</p> <p>crbug.com/648342: The text should be on two lines.</p>
<div style="width:260px; font-size: 12px; font-family: ahem, sans-serif;"> <div style="width:260px; font-size: 12px; font-family: arial, sans-serif;">
<br><br><a><img src="../../../canvas/philip/images/transparent.png" widht="100" height="50" align="right"></a>Text Text Text Text <br><br><a><img src="../../../canvas/philip/images/transparent.png" align="right"></a>Text Text Text Text Text Text Text Text Text
</div> </div>
...@@ -289,18 +289,20 @@ void LineBoxList::DirtyLinesFromChangedChild(LineLayoutItem container, ...@@ -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 // 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 // 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 // check our nearest inline ancestor with siblings. If we didn't find a line
// use our parent's first line box. // box, then use our parent's first line box.
RootInlineBox* box = nullptr; RootInlineBox* box = nullptr;
LineLayoutItem curr = child.PreviousSibling(); LineLayoutItem curr = child.PreviousSibling();
if (child.IsFloating() && !curr) { if (child.IsFloating() && !curr) {
LineLayoutInline outer_inline; DCHECK(child.Parent());
for (LineLayoutItem parent = child.Parent(); if (child.Parent().IsLayoutInline()) {
parent && parent.IsLayoutInline() && !parent.PreviousSibling(); LineLayoutItem outer_inline = child.Parent();
parent = parent.Parent()) while (outer_inline && !outer_inline.PreviousSibling() &&
outer_inline = LineLayoutInline(parent); outer_inline.Parent().IsLayoutInline())
if (outer_inline) outer_inline = outer_inline.Parent();
curr = outer_inline.PreviousSibling(); if (outer_inline)
curr = outer_inline.PreviousSibling();
}
} }
for (; curr; curr = curr.PreviousSibling()) { for (; curr; curr = curr.PreviousSibling()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment