Commit 9692e842 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Remove IgnoreFloats() break token mechanism.

This didn't serve any purpose anymore, since fragmentation of
inline-level floats is currently broken (no pun intended). See
crbug.com/915929

Change-Id: Ib852e68daae9d0ebe47f844d7395ae897100d047
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761274Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688511}
parent 92734c6d
...@@ -69,15 +69,6 @@ class CORE_EXPORT NGInlineBreakToken final : public NGBreakToken { ...@@ -69,15 +69,6 @@ class CORE_EXPORT NGInlineBreakToken final : public NGBreakToken {
return flags_ & kIsForcedBreak; return flags_ & kIsForcedBreak;
} }
// When a previously laid out line box didn't fit in the current
// fragmentainer, and we have to lay it out again in the next fragmentainer,
// we need to skip floats associated with that line. The parent block layout
// algorithm will take care of any floats that broke and need to be resumed in
// the next fragmentainer. Dealing with them as part of line layout as well
// would result in duplicate fragments for the floats.
void SetIgnoreFloats() { ignore_floats_ = true; }
bool IgnoreFloats() const { return ignore_floats_; }
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
String ToString() const override; String ToString() const override;
#endif #endif
......
...@@ -981,7 +981,6 @@ unsigned NGInlineLayoutAlgorithm::PositionLeadingFloats( ...@@ -981,7 +981,6 @@ unsigned NGInlineLayoutAlgorithm::PositionLeadingFloats(
NGExclusionSpace* exclusion_space, NGExclusionSpace* exclusion_space,
NGPositionedFloatVector* positioned_floats) { NGPositionedFloatVector* positioned_floats) {
bool is_empty_inline = Node().IsEmptyInline(); bool is_empty_inline = Node().IsEmptyInline();
bool should_ignore_floats = BreakToken() && BreakToken()->IgnoreFloats();
const Vector<NGInlineItem>& items = const Vector<NGInlineItem>& items =
Node().ItemsData(/* is_first_line */ false).items; Node().ItemsData(/* is_first_line */ false).items;
...@@ -996,7 +995,7 @@ unsigned NGInlineLayoutAlgorithm::PositionLeadingFloats( ...@@ -996,7 +995,7 @@ unsigned NGInlineLayoutAlgorithm::PositionLeadingFloats(
break; break;
} }
if (item.Type() != NGInlineItem::kFloating || should_ignore_floats) if (item.Type() != NGInlineItem::kFloating)
continue; continue;
container_builder_.AddAdjoiningObjectTypes( container_builder_.AddAdjoiningObjectTypes(
......
...@@ -203,7 +203,6 @@ NGLineBreaker::NGLineBreaker(NGInlineNode node, ...@@ -203,7 +203,6 @@ NGLineBreaker::NGLineBreaker(NGInlineNode node,
break_iterator_.SetStartOffset(offset_); break_iterator_.SetStartOffset(offset_);
is_after_forced_break_ = break_token->IsForcedBreak(); is_after_forced_break_ = break_token->IsForcedBreak();
items_data_.AssertOffset(item_index_, offset_); items_data_.AssertOffset(item_index_, offset_);
ignore_floats_ = break_token->IgnoreFloats();
} }
// There's a special intrinsic size measure quirk for images that are direct // There's a special intrinsic size measure quirk for images that are direct
...@@ -1305,9 +1304,6 @@ void NGLineBreaker::HandleFloat(const NGInlineItem& item, ...@@ -1305,9 +1304,6 @@ void NGLineBreaker::HandleFloat(const NGInlineItem& item,
return; return;
} }
if (ignore_floats_)
return;
// Make sure we populate the positioned_float inside the |item_result|. // Make sure we populate the positioned_float inside the |item_result|.
if (item_index_ <= handled_leading_floats_index_ && if (item_index_ <= handled_leading_floats_index_ &&
!leading_floats_.IsEmpty()) { !leading_floats_.IsEmpty()) {
......
...@@ -240,8 +240,6 @@ class CORE_EXPORT NGLineBreaker { ...@@ -240,8 +240,6 @@ class CORE_EXPORT NGLineBreaker {
// the next line. // the next line.
bool is_after_forced_break_ = false; bool is_after_forced_break_ = false;
bool ignore_floats_ = false;
// Set in quirks mode when we're not supposed to break inside table cells // Set in quirks mode when we're not supposed to break inside table cells
// between images, and between text and images. // between images, and between text and images.
bool sticky_images_quirk_ = false; bool sticky_images_quirk_ = false;
......
...@@ -129,11 +129,6 @@ void NGBoxFragmentBuilder::AddBreakBeforeLine(int line_number) { ...@@ -129,11 +129,6 @@ void NGBoxFragmentBuilder::AddBreakBeforeLine(int line_number) {
} }
} }
} }
// We need to resume at the right inline location in the next fragment, but
// broken floats, which are resumed and positioned by the parent block layout
// algorithm, need to be ignored by the inline layout algorithm.
To<NGInlineBreakToken>(inline_break_tokens_.back().get())->SetIgnoreFloats();
} }
void NGBoxFragmentBuilder::AddResult(const NGLayoutResult& child_layout_result, void NGBoxFragmentBuilder::AddResult(const NGLayoutResult& child_layout_result,
......
...@@ -71,7 +71,6 @@ class CORE_EXPORT NGBreakToken : public RefCounted<NGBreakToken> { ...@@ -71,7 +71,6 @@ class CORE_EXPORT NGBreakToken : public RefCounted<NGBreakToken> {
type_(type), type_(type),
status_(status), status_(status),
flags_(0), flags_(0),
ignore_floats_(false),
is_break_before_(false), is_break_before_(false),
is_forced_break_(false), is_forced_break_(false),
has_last_resort_break_(false), has_last_resort_break_(false),
...@@ -92,7 +91,6 @@ class CORE_EXPORT NGBreakToken : public RefCounted<NGBreakToken> { ...@@ -92,7 +91,6 @@ class CORE_EXPORT NGBreakToken : public RefCounted<NGBreakToken> {
// defined here to save memory, since that class has no bitfields). // defined here to save memory, since that class has no bitfields).
unsigned flags_ : 2; // NGInlineBreakTokenFlags unsigned flags_ : 2; // NGInlineBreakTokenFlags
unsigned ignore_floats_ : 1;
// The following bitfields are only to be used by NGBlockBreakToken (it's // The following bitfields are only to be used by NGBlockBreakToken (it's
// defined here to save memory, since that class has no bitfields). // defined here to save memory, since that class has no bitfields).
......
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