Commit ae914819 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Paint multicol container outlines correctly.

Introducing NGPhysicalFragment::IsCSSBox(), to distinguish between
fragments generated from CSS boxes [1] and those generated by the layout
engine to hold CSS box fragments. We have a lot of checks for fragments
not being line boxes before working on the associated LayoutObject, but
we need to do the same for column boxes. This CL only changes
HasLayer(), to fix outline painting, but we could do the same for many
of the other methods here.

Column boxes don't establish layers, so return false. The layout object
that a column box is associated with does establish a layer (for legacy
reasons). The outline code [2] has special-code for layers, but
shouldn't treat each column as establishing a layer.

While we wait for NG column painting to be implemented, we now need to
guard against entering columns when painting a box fragment, and instead
let the paint layer established by the multicol container and the flow
thread drive the painting (like before).

[1] https://www.w3.org/TR/css-display-3/#box-tree
[2] NGPhysicalContainerFragment::AddOutlineRectsForDescendant()

Change-Id: I6fcd753cbed2e5f19560eddf45e903dd58bf4bef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1912713Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715395}
parent 37676e2d
...@@ -273,10 +273,6 @@ Node* NGPhysicalFragment::GetNode() const { ...@@ -273,10 +273,6 @@ Node* NGPhysicalFragment::GetNode() const {
return !IsLineBox() ? layout_object_.GetNode() : nullptr; return !IsLineBox() ? layout_object_.GetNode() : nullptr;
} }
bool NGPhysicalFragment::HasLayer() const {
return !IsLineBox() && layout_object_.HasLayer();
}
PaintLayer* NGPhysicalFragment::Layer() const { PaintLayer* NGPhysicalFragment::Layer() const {
if (!HasLayer()) if (!HasLayer())
return nullptr; return nullptr;
......
...@@ -122,6 +122,19 @@ class CORE_EXPORT NGPhysicalFragment ...@@ -122,6 +122,19 @@ class CORE_EXPORT NGPhysicalFragment
bool IsFloatingOrOutOfFlowPositioned() const { bool IsFloatingOrOutOfFlowPositioned() const {
return IsFloating() || IsOutOfFlowPositioned(); return IsFloating() || IsOutOfFlowPositioned();
} }
// Return true if this fragment corresponds directly to an entry in the CSS
// box tree [1]. Note that anonymous blocks also exist in the CSS box
// tree. Returns false otherwise, i.e. if the fragment is generated by the
// layout engine to contain fragments from CSS boxes (a line or a generated
// fragmentainer [2], in other words). The main signification of this is
// whether we can use the LayoutObject associated with this fragment for all
// purposes.
//
// [1] https://www.w3.org/TR/css-display-3/#box-tree
// [2] https://www.w3.org/TR/css-break-3/#fragmentation-container
bool IsCSSBox() const { return !IsLineBox() && !IsColumnBox(); }
bool IsBlockFlow() const; bool IsBlockFlow() const;
bool IsListMarker() const; bool IsListMarker() const;
...@@ -176,7 +189,7 @@ class CORE_EXPORT NGPhysicalFragment ...@@ -176,7 +189,7 @@ class CORE_EXPORT NGPhysicalFragment
Node* GetNode() const; Node* GetNode() const;
// Whether there is a PaintLayer associated with the fragment. // Whether there is a PaintLayer associated with the fragment.
bool HasLayer() const; bool HasLayer() const { return IsCSSBox() && layout_object_.HasLayer(); }
// The PaintLayer associated with the fragment. // The PaintLayer associated with the fragment.
PaintLayer* Layer() const; PaintLayer* Layer() const;
......
...@@ -495,7 +495,8 @@ void NGBoxFragmentPainter::PaintBlockChildren(const PaintInfo& paint_info) { ...@@ -495,7 +495,8 @@ void NGBoxFragmentPainter::PaintBlockChildren(const PaintInfo& paint_info) {
PaintInfo paint_info_for_descendants = paint_info.ForDescendants(); PaintInfo paint_info_for_descendants = paint_info.ForDescendants();
for (const NGLink& child : box_fragment_.Children()) { for (const NGLink& child : box_fragment_.Children()) {
const NGPhysicalFragment& child_fragment = *child; const NGPhysicalFragment& child_fragment = *child;
if (child_fragment.HasSelfPaintingLayer() || child_fragment.IsFloating()) if (child_fragment.HasSelfPaintingLayer() || child_fragment.IsFloating() ||
child_fragment.IsColumnBox())
continue; continue;
if (child_fragment.Type() == NGPhysicalFragment::kFragmentBox) { if (child_fragment.Type() == NGPhysicalFragment::kFragmentBox) {
...@@ -537,7 +538,7 @@ void NGBoxFragmentPainter::PaintFloatingChildren( ...@@ -537,7 +538,7 @@ void NGBoxFragmentPainter::PaintFloatingChildren(
const PaintInfo& float_paint_info) { const PaintInfo& float_paint_info) {
for (const NGLink& child : container.Children()) { for (const NGLink& child : container.Children()) {
const NGPhysicalFragment& child_fragment = *child; const NGPhysicalFragment& child_fragment = *child;
if (child_fragment.HasSelfPaintingLayer()) if (child_fragment.HasSelfPaintingLayer() || child_fragment.IsColumnBox())
continue; continue;
// Atomic-inlines paint atomically, and shouldn't be traversed. // Atomic-inlines paint atomically, and shouldn't be traversed.
......
...@@ -1133,7 +1133,6 @@ crbug.com/954171 virtual/layout_ng_block_frag/fast/multicol/float-with-margin-mo ...@@ -1133,7 +1133,6 @@ crbug.com/954171 virtual/layout_ng_block_frag/fast/multicol/float-with-margin-mo
crbug.com/954171 virtual/layout_ng_block_frag/fast/multicol/float-with-margin-moved-by-child-line-and-unbreakable.html [ Failure Crash ] crbug.com/954171 virtual/layout_ng_block_frag/fast/multicol/float-with-margin-moved-by-child-line-and-unbreakable.html [ Failure Crash ]
crbug.com/954171 virtual/layout_ng_block_frag/fast/multicol/float-with-margin-moved-by-child-line.html [ Failure Crash ] crbug.com/954171 virtual/layout_ng_block_frag/fast/multicol/float-with-margin-moved-by-child-line.html [ Failure Crash ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/float-with-margin-moved-unbreakable.html [ Failure ] crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/float-with-margin-moved-unbreakable.html [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/focus-outline.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/forced-break-after-block-with-spanner.html [ Failure ] crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/forced-break-after-block-with-spanner.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/forced-break-after-empty-block-after-spanner.html [ Failure ] crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/forced-break-after-empty-block-after-spanner.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/forced-break-after-last-block-before-spanner.html [ Failure ] crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/forced-break-after-last-block-before-spanner.html [ Failure ]
......
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