Commit 4c0f4e68 authored by Emil A Eklund's avatar Emil A Eklund Committed by Commit Bot

[LayoutNG] Expose block-type information for fragments

Expose whether a fragment has an associated layer on NGPhysicalFragment,
with the implementation defering to the LayoutObject. Aditionally expose
the type of block on NGPhysicalBoxFragment. Both are needed for painting
directly from the LayoutNG fragment tree as it affects the paint order.

Bug: 714962
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: I9f2d123acec104b1c61b9bd1297c49541713ac18
Reviewed-on: https://chromium-review.googlesource.com/827635
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524333}
parent 74d23bac
......@@ -51,6 +51,12 @@ bool NGPhysicalBoxFragment::HasSelfPaintingLayer() const {
BoxType() != kAnonymousBox;
}
bool NGPhysicalBoxFragment::ChildrenInline() const {
const LayoutObject* layout_object = GetLayoutObject();
DCHECK(layout_object);
return layout_object->ChildrenInline();
}
bool NGPhysicalBoxFragment::HasOverflowClip() const {
const LayoutObject* layout_object = GetLayoutObject();
DCHECK(layout_object);
......
......@@ -29,6 +29,7 @@ class CORE_EXPORT NGPhysicalBoxFragment final
const NGBaseline* Baseline(const NGBaselineRequest&) const;
bool HasSelfPaintingLayer() const;
bool ChildrenInline() const;
// True if overflow != 'visible', except for certain boxes that do not allow
// overflow clip; i.e., AllowOverflowClip() returns false.
......
......@@ -208,6 +208,14 @@ Node* NGPhysicalFragment::GetNode() const {
return layout_object_ ? layout_object_->GetNode() : nullptr;
}
bool NGPhysicalFragment::HasLayer() const {
return layout_object_->HasLayer();
}
bool NGPhysicalFragment::IsBlockFlow() const {
return layout_object_ && layout_object_->IsLayoutBlockFlow();
}
bool NGPhysicalFragment::IsPlacedByLayoutNG() const {
// TODO(kojii): Move this to a flag for |LayoutNGBlockFlow::UpdateBlockLayout|
// to set.
......
......@@ -83,6 +83,8 @@ class CORE_EXPORT NGPhysicalFragment
bool IsOutOfFlowPositioned() const {
return BoxType() == NGBoxType::kOutOfFlowPositioned;
}
bool IsBlockFlow() const;
// A box fragment that do not exist in LayoutObject tree. Its LayoutObject is
// co-owned by other fragments.
bool IsAnonymousBox() const { return BoxType() == NGBoxType::kAnonymousBox; }
......@@ -120,6 +122,9 @@ class CORE_EXPORT NGPhysicalFragment
const ComputedStyle& Style() const;
Node* GetNode() const;
// Whether there is a PaintLayer associated with the fragment.
bool HasLayer() const;
// GetLayoutObject should only be used when necessary for compatibility
// with LegacyLayout.
LayoutObject* GetLayoutObject() const { return layout_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