Commit 850659d4 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Rename IsInlineOutlineNonpaintingFragment to ShouldPaintOutline

Realized it was easier to read this in reverse that what was
happening previously. Probably just as a result of it being moved
away from NGPaintFragment at some point.

Change-Id: I0bc29a0b6868c8c47a69bfdc82cbc8a8c9017eab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1856723
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705270}
parent 97a70e4b
...@@ -5,12 +5,11 @@ ...@@ -5,12 +5,11 @@
#include "third_party/blink/renderer/core/layout/ng/ng_outline_utils.h" #include "third_party/blink/renderer/core/layout/ng/ng_outline_utils.h"
#include "third_party/blink/renderer/core/layout/layout_inline.h" #include "third_party/blink/renderer/core/layout/layout_inline.h"
#include "third_party/blink/renderer/core/paint/ng/ng_paint_fragment.h" #include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h"
#include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/computed_style.h"
namespace blink { namespace blink {
bool NGOutlineUtils::HasPaintedOutline(const ComputedStyle& style, bool NGOutlineUtils::HasPaintedOutline(const ComputedStyle& style,
const Node* node) { const Node* node) {
if (!style.HasOutline() || style.Visibility() != EVisibility::kVisible) if (!style.HasOutline() || style.Visibility() != EVisibility::kVisible)
...@@ -21,22 +20,24 @@ bool NGOutlineUtils::HasPaintedOutline(const ComputedStyle& style, ...@@ -21,22 +20,24 @@ bool NGOutlineUtils::HasPaintedOutline(const ComputedStyle& style,
return true; return true;
} }
bool NGOutlineUtils::IsInlineOutlineNonpaintingFragment( bool NGOutlineUtils::ShouldPaintOutline(
const NGPhysicalFragment& physical_fragment) { const NGPhysicalBoxFragment& physical_fragment) {
const LayoutObject* layout_object = physical_fragment.GetLayoutObject(); const LayoutObject* layout_object = physical_fragment.GetLayoutObject();
if (!layout_object) DCHECK(layout_object);
return false;
if (!layout_object->IsLayoutInline()) if (!layout_object->IsLayoutInline())
return false; return true;
// A |LayoutInline| can be split across multiple objects. The first fragment
// produced should paint the outline for *all* fragments.
if (layout_object->IsElementContinuation()) { if (layout_object->IsElementContinuation()) {
// If continuation root did generate a fragment, // If the |LayoutInline|'s continuation-root generated a fragment, we
// this fragment should not paint. // shouldn't paint the outline.
if (layout_object->ContinuationRoot()->FirstInlineFragment()) if (layout_object->ContinuationRoot()->FirstInlineFragment())
return true; return false;
} }
if (!layout_object->FirstInlineFragment())
return false; DCHECK(layout_object->FirstInlineFragment());
return &layout_object->FirstInlineFragment()->PhysicalFragment() != return &layout_object->FirstInlineFragment()->PhysicalFragment() ==
&physical_fragment; &physical_fragment;
} }
......
...@@ -12,19 +12,19 @@ namespace blink { ...@@ -12,19 +12,19 @@ namespace blink {
class ComputedStyle; class ComputedStyle;
class Node; class Node;
class NGPhysicalFragment; class NGPhysicalBoxFragment;
class CORE_EXPORT NGOutlineUtils { class CORE_EXPORT NGOutlineUtils {
STATIC_ONLY(NGOutlineUtils); STATIC_ONLY(NGOutlineUtils);
public: public:
static bool HasPaintedOutline(const ComputedStyle& style, const Node* node); static bool HasPaintedOutline(const ComputedStyle& style, const Node* node);
// First fragment paints the entire outline for LayoutInline. // Returns true if this fragment should paint an outline.
// Returns true if this is the painting fragment. //
static bool IsInlineOutlineNonpaintingFragment( // Specifically a |LayoutInline| can be split across multiple flows. The
const NGPhysicalFragment& physical_fragment); // first fragment produced should paint the outline for *all* fragments.
static bool ShouldPaintOutline(const NGPhysicalBoxFragment&);
}; };
} // namespace blink } // namespace blink
......
...@@ -190,7 +190,7 @@ PhysicalRect NGPhysicalBoxFragment::ComputeSelfInkOverflow() const { ...@@ -190,7 +190,7 @@ PhysicalRect NGPhysicalBoxFragment::ComputeSelfInkOverflow() const {
ink_overflow.Expand(style.BoxDecorationOutsets()); ink_overflow.Expand(style.BoxDecorationOutsets());
if (NGOutlineUtils::HasPaintedOutline(style, if (NGOutlineUtils::HasPaintedOutline(style,
GetLayoutObject()->GetNode()) && GetLayoutObject()->GetNode()) &&
!NGOutlineUtils::IsInlineOutlineNonpaintingFragment(*this)) { NGOutlineUtils::ShouldPaintOutline(*this)) {
Vector<PhysicalRect> outline_rects; Vector<PhysicalRect> outline_rects;
// The result rects are in coordinates of this object's border box. // The result rects are in coordinates of this object's border box.
AddSelfOutlineRects( AddSelfOutlineRects(
...@@ -209,7 +209,7 @@ void NGPhysicalBoxFragment::AddSelfOutlineRects( ...@@ -209,7 +209,7 @@ void NGPhysicalBoxFragment::AddSelfOutlineRects(
const PhysicalOffset& additional_offset, const PhysicalOffset& additional_offset,
NGOutlineType outline_type, NGOutlineType outline_type,
Vector<PhysicalRect>* outline_rects) const { Vector<PhysicalRect>* outline_rects) const {
if (NGOutlineUtils::IsInlineOutlineNonpaintingFragment(*this)) if (!NGOutlineUtils::ShouldPaintOutline(*this))
return; return;
const LayoutObject* layout_object = GetLayoutObject(); const LayoutObject* layout_object = GetLayoutObject();
......
...@@ -158,7 +158,7 @@ void NGPhysicalContainerFragment::AddOutlineRectsForDescendant( ...@@ -158,7 +158,7 @@ void NGPhysicalContainerFragment::AddOutlineRectsForDescendant(
// for its line box which cover the line boxes of this LayoutInline. So // for its line box which cover the line boxes of this LayoutInline. So
// the LayoutInline needs to add rects for children and continuations // the LayoutInline needs to add rects for children and continuations
// only. // only.
if (!NGOutlineUtils::IsInlineOutlineNonpaintingFragment(*descendant)) { if (NGOutlineUtils::ShouldPaintOutline(*descendant_box)) {
descendant_layout_inline->AddOutlineRectsForChildrenAndContinuations( descendant_layout_inline->AddOutlineRectsForChildrenAndContinuations(
*outline_rects, additional_offset, outline_type); *outline_rects, additional_offset, outline_type);
} }
......
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