Commit f9304249 authored by Robert Hogan's avatar Robert Hogan Committed by Commit Bot

Ensure line-break is on correct object if trailing collapsed whitespace pushes us over line-end

A follow-up to https://codereview.chromium.org/2479333002.

Bug: 641334
Change-Id: If0e92b89422b3f9406d5f8d10fec2d90f83f0e06
Reviewed-on: https://chromium-review.googlesource.com/573500
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488076}
parent aa59f1dd
<div style="width: 5px;">
<img id="makeTaller" style="height: 50px; width: 1px"><img id="removeThis" style="width: 5px; height: 5px;"> <div style="float: left;">foo</div>Pass if no assert in debug.</div>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var removeThis = document.getElementById("removeThis");
removeThis.offsetTop;
removeThis.parentNode.removeChild(removeThis);
;
makeTaller.style.height = '55px';
</script>
...@@ -1516,8 +1516,13 @@ inline void BreakingContext::CommitAndUpdateLineBreakIfNeeded() { ...@@ -1516,8 +1516,13 @@ inline void BreakingContext::CommitAndUpdateLineBreakIfNeeded() {
current_style_->CollapseWhiteSpace()) current_style_->CollapseWhiteSpace())
trailing_objects_.Clear(); trailing_objects_.Clear();
if (!width_.FitsOnLine() && width_.FitsOnLine(0, kExcludeWhitespace) && // If we are going to break before a float on an object that is just
ignoring_spaces_ && next_object_) { // collapsible white space then make sure the line break is moved to
// the float.
if (width_.FitsOnLine(0, kExcludeWhitespace) && next_object_ &&
next_object_.IsFloating() && current_.GetLineLayoutItem().IsText() &&
LineLayoutText(current_.GetLineLayoutItem())
.IsAllCollapsibleWhitespace()) {
width_.Commit(); width_.Commit();
line_break_.MoveToStartOf(next_object_); line_break_.MoveToStartOf(next_object_);
} }
......
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