Commit 55c1af17 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Add NGFragmentItem::IsBlockFormattingContextRoot

This is a follow up for r749120 crrev.com/c/2089894

This patch has no behavior changes.

Bug: 982194
Change-Id: I18775e577dae67b90e98ecddb5b28babca1175e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2098165Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749590}
parent 97afa2b0
......@@ -38,6 +38,7 @@ NGFragmentItem::NGFragmentItem(const NGPhysicalTextFragment& text)
// |generated_text_.text_| instead copying, |generated_text_.text = ...|.
new (&generated_text_.text) String(text.Text().ToString());
}
DCHECK(!IsBlockFormattingContextRoot());
}
NGFragmentItem::NGFragmentItem(const NGPhysicalLineBoxFragment& line,
......@@ -50,7 +51,9 @@ NGFragmentItem::NGFragmentItem(const NGPhysicalLineBoxFragment& line,
style_variant_(static_cast<unsigned>(line.StyleVariant())),
is_hidden_for_paint_(false),
text_direction_(static_cast<unsigned>(line.BaseDirection())),
ink_overflow_computed_(false) {}
ink_overflow_computed_(false) {
DCHECK(!IsBlockFormattingContextRoot());
}
NGFragmentItem::NGFragmentItem(const NGPhysicalBoxFragment& box,
TextDirection resolved_direction)
......@@ -61,7 +64,9 @@ NGFragmentItem::NGFragmentItem(const NGPhysicalBoxFragment& box,
style_variant_(static_cast<unsigned>(box.StyleVariant())),
is_hidden_for_paint_(box.IsHiddenForPaint()),
text_direction_(static_cast<unsigned>(resolved_direction)),
ink_overflow_computed_(false) {}
ink_overflow_computed_(false) {
DCHECK_EQ(IsBlockFormattingContextRoot(), box.IsBlockFormattingContextRoot());
}
NGFragmentItem::NGFragmentItem(const NGInlineItem& inline_item,
const PhysicalSize& size)
......@@ -76,6 +81,7 @@ NGFragmentItem::NGFragmentItem(const NGInlineItem& inline_item,
DCHECK_EQ(inline_item.Type(), NGInlineItem::kOpenTag);
DCHECK(layout_object_);
DCHECK(layout_object_->IsLayoutInline());
DCHECK(!IsBlockFormattingContextRoot());
}
NGFragmentItem::~NGFragmentItem() {
......
......@@ -260,6 +260,10 @@ class CORE_EXPORT NGFragmentItem : public DisplayItemClient {
return TextType() == NGTextType::kSymbolMarker;
}
bool IsBlockFormattingContextRoot() const {
return BoxFragment() && !IsInlineBox();
}
const ShapeResultView* TextShapeResult() const;
NGTextOffset TextOffset() const;
unsigned StartOffset() const { return TextOffset().start; }
......
......@@ -34,7 +34,7 @@ NGFragmentChildIterator NGFragmentChildIterator::Descend() const {
const NGFragmentItem* item = current_.cursor_->CurrentItem();
// Descend using the cursor if the current item doesn't establish a new
// formatting context.
if (!item->BoxFragment() || item->IsInlineBox())
if (!item->IsBlockFormattingContextRoot())
return NGFragmentChildIterator(*current_.cursor_);
}
DCHECK(current_.BoxFragment());
......
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