Commit b72a43b5 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Reduce API surface of physical fragments.

Removes some public methods from NGPhysicalBoxFragment, and
NGPhysicalContainerFragment.

There should be no behaviour change.

Change-Id: Icf7612405b756b44121e223be8ecf24ca47d7151
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1591882Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#656435}
parent 075f401c
......@@ -29,6 +29,11 @@ static_assert(sizeof(NGPhysicalBoxFragment) ==
sizeof(SameSizeAsNGPhysicalBoxFragment),
"NGPhysicalBoxFragment should stay small");
bool HasControlClip(const NGPhysicalBoxFragment& self) {
const LayoutBox* box = ToLayoutBoxOrNull(self.GetLayoutObject());
return box && box->HasControlClip();
}
} // namespace
scoped_refptr<const NGPhysicalBoxFragment> NGPhysicalBoxFragment::Create(
......@@ -74,13 +79,9 @@ NGPhysicalBoxFragment::NGPhysicalBoxFragment(
}
bool NGPhysicalBoxFragment::HasSelfPaintingLayer() const {
return GetLayoutBoxModelObject().HasSelfPaintingLayer();
}
bool NGPhysicalBoxFragment::HasControlClip() const {
const LayoutObject* layout_object = GetLayoutObject();
DCHECK(layout_object);
return layout_object->IsBox() && ToLayoutBox(layout_object)->HasControlClip();
SECURITY_DCHECK(GetLayoutObject() && GetLayoutObject()->IsBoxModelObject());
return (static_cast<LayoutBoxModelObject*>(GetLayoutObject()))
->HasSelfPaintingLayer();
}
LayoutRect NGPhysicalBoxFragment::OverflowClipRect(
......@@ -195,7 +196,7 @@ void NGPhysicalBoxFragment::AddSelfOutlineRects(
}
if (outline_type == NGOutlineType::kIncludeBlockVisualOverflow &&
!HasOverflowClip() && !HasControlClip()) {
!HasOverflowClip() && !HasControlClip(*this)) {
AddOutlineRectsForNormalChildren(outline_rects, additional_offset,
outline_type);
......
......@@ -44,8 +44,6 @@ class CORE_EXPORT NGPhysicalBoxFragment final
bool HasSelfPaintingLayer() const;
bool ChildrenInline() const { return children_inline_; }
bool HasControlClip() const;
PhysicalRect ScrollableOverflow() const;
// TODO(layout-dev): These three methods delegate to legacy layout for now,
......@@ -68,13 +66,6 @@ class CORE_EXPORT NGPhysicalBoxFragment final
UBiDiLevel BidiLevel() const;
scoped_refptr<const NGPhysicalFragment> CloneWithoutOffset() const;
LayoutBoxModelObject& GetLayoutBoxModelObject() const {
SECURITY_DCHECK(GetLayoutObject() && GetLayoutObject()->IsBoxModelObject());
return *static_cast<LayoutBoxModelObject*>(GetLayoutObject());
}
private:
NGPhysicalBoxFragment(NGBoxFragmentBuilder* builder,
WritingMode block_or_line_writing_mode);
......
......@@ -45,14 +45,6 @@ class CORE_EXPORT NGPhysicalContainerFragment : public NGPhysicalFragment {
return ChildLinkList(num_children_, buffer_);
}
void AddOutlineRectsForNormalChildren(Vector<LayoutRect>* outline_rects,
const LayoutPoint& additional_offset,
NGOutlineType outline_type) const;
void AddOutlineRectsForDescendant(const NGLink& descendant,
Vector<LayoutRect>* rects,
const LayoutPoint& additional_offset,
NGOutlineType outline_type) const;
bool HasFloatingDescendants() const { return has_floating_descendants_; }
protected:
......@@ -63,6 +55,14 @@ class CORE_EXPORT NGPhysicalContainerFragment : public NGPhysicalFragment {
NGFragmentType,
unsigned sub_type);
void AddOutlineRectsForNormalChildren(Vector<LayoutRect>* outline_rects,
const LayoutPoint& additional_offset,
NGOutlineType outline_type) const;
void AddOutlineRectsForDescendant(const NGLink& descendant,
Vector<LayoutRect>* rects,
const LayoutPoint& additional_offset,
NGOutlineType outline_type) const;
// Because flexible arrays need to be the last member in a class, the actual
// storage is in the subclass and we just keep a pointer to it here.
const NGLinkStorage* buffer_;
......
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