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) == ...@@ -29,6 +29,11 @@ static_assert(sizeof(NGPhysicalBoxFragment) ==
sizeof(SameSizeAsNGPhysicalBoxFragment), sizeof(SameSizeAsNGPhysicalBoxFragment),
"NGPhysicalBoxFragment should stay small"); "NGPhysicalBoxFragment should stay small");
bool HasControlClip(const NGPhysicalBoxFragment& self) {
const LayoutBox* box = ToLayoutBoxOrNull(self.GetLayoutObject());
return box && box->HasControlClip();
}
} // namespace } // namespace
scoped_refptr<const NGPhysicalBoxFragment> NGPhysicalBoxFragment::Create( scoped_refptr<const NGPhysicalBoxFragment> NGPhysicalBoxFragment::Create(
...@@ -74,13 +79,9 @@ NGPhysicalBoxFragment::NGPhysicalBoxFragment( ...@@ -74,13 +79,9 @@ NGPhysicalBoxFragment::NGPhysicalBoxFragment(
} }
bool NGPhysicalBoxFragment::HasSelfPaintingLayer() const { bool NGPhysicalBoxFragment::HasSelfPaintingLayer() const {
return GetLayoutBoxModelObject().HasSelfPaintingLayer(); SECURITY_DCHECK(GetLayoutObject() && GetLayoutObject()->IsBoxModelObject());
} return (static_cast<LayoutBoxModelObject*>(GetLayoutObject()))
->HasSelfPaintingLayer();
bool NGPhysicalBoxFragment::HasControlClip() const {
const LayoutObject* layout_object = GetLayoutObject();
DCHECK(layout_object);
return layout_object->IsBox() && ToLayoutBox(layout_object)->HasControlClip();
} }
LayoutRect NGPhysicalBoxFragment::OverflowClipRect( LayoutRect NGPhysicalBoxFragment::OverflowClipRect(
...@@ -195,7 +196,7 @@ void NGPhysicalBoxFragment::AddSelfOutlineRects( ...@@ -195,7 +196,7 @@ void NGPhysicalBoxFragment::AddSelfOutlineRects(
} }
if (outline_type == NGOutlineType::kIncludeBlockVisualOverflow && if (outline_type == NGOutlineType::kIncludeBlockVisualOverflow &&
!HasOverflowClip() && !HasControlClip()) { !HasOverflowClip() && !HasControlClip(*this)) {
AddOutlineRectsForNormalChildren(outline_rects, additional_offset, AddOutlineRectsForNormalChildren(outline_rects, additional_offset,
outline_type); outline_type);
......
...@@ -44,8 +44,6 @@ class CORE_EXPORT NGPhysicalBoxFragment final ...@@ -44,8 +44,6 @@ class CORE_EXPORT NGPhysicalBoxFragment final
bool HasSelfPaintingLayer() const; bool HasSelfPaintingLayer() const;
bool ChildrenInline() const { return children_inline_; } bool ChildrenInline() const { return children_inline_; }
bool HasControlClip() const;
PhysicalRect ScrollableOverflow() const; PhysicalRect ScrollableOverflow() const;
// TODO(layout-dev): These three methods delegate to legacy layout for now, // TODO(layout-dev): These three methods delegate to legacy layout for now,
...@@ -68,13 +66,6 @@ class CORE_EXPORT NGPhysicalBoxFragment final ...@@ -68,13 +66,6 @@ class CORE_EXPORT NGPhysicalBoxFragment final
UBiDiLevel BidiLevel() const; UBiDiLevel BidiLevel() const;
scoped_refptr<const NGPhysicalFragment> CloneWithoutOffset() const;
LayoutBoxModelObject& GetLayoutBoxModelObject() const {
SECURITY_DCHECK(GetLayoutObject() && GetLayoutObject()->IsBoxModelObject());
return *static_cast<LayoutBoxModelObject*>(GetLayoutObject());
}
private: private:
NGPhysicalBoxFragment(NGBoxFragmentBuilder* builder, NGPhysicalBoxFragment(NGBoxFragmentBuilder* builder,
WritingMode block_or_line_writing_mode); WritingMode block_or_line_writing_mode);
......
...@@ -45,14 +45,6 @@ class CORE_EXPORT NGPhysicalContainerFragment : public NGPhysicalFragment { ...@@ -45,14 +45,6 @@ class CORE_EXPORT NGPhysicalContainerFragment : public NGPhysicalFragment {
return ChildLinkList(num_children_, buffer_); 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_; } bool HasFloatingDescendants() const { return has_floating_descendants_; }
protected: protected:
...@@ -63,6 +55,14 @@ class CORE_EXPORT NGPhysicalContainerFragment : public NGPhysicalFragment { ...@@ -63,6 +55,14 @@ class CORE_EXPORT NGPhysicalContainerFragment : public NGPhysicalFragment {
NGFragmentType, NGFragmentType,
unsigned sub_type); 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 // 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. // storage is in the subclass and we just keep a pointer to it here.
const NGLinkStorage* buffer_; 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