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 @@
#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/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"
namespace blink {
bool NGOutlineUtils::HasPaintedOutline(const ComputedStyle& style,
const Node* node) {
if (!style.HasOutline() || style.Visibility() != EVisibility::kVisible)
......@@ -21,22 +20,24 @@ bool NGOutlineUtils::HasPaintedOutline(const ComputedStyle& style,
return true;
}
bool NGOutlineUtils::IsInlineOutlineNonpaintingFragment(
const NGPhysicalFragment& physical_fragment) {
bool NGOutlineUtils::ShouldPaintOutline(
const NGPhysicalBoxFragment& physical_fragment) {
const LayoutObject* layout_object = physical_fragment.GetLayoutObject();
if (!layout_object)
return false;
DCHECK(layout_object);
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 continuation root did generate a fragment,
// this fragment should not paint.
// If the |LayoutInline|'s continuation-root generated a fragment, we
// shouldn't paint the outline.
if (layout_object->ContinuationRoot()->FirstInlineFragment())
return true;
return false;
}
if (!layout_object->FirstInlineFragment())
return false;
return &layout_object->FirstInlineFragment()->PhysicalFragment() !=
DCHECK(layout_object->FirstInlineFragment());
return &layout_object->FirstInlineFragment()->PhysicalFragment() ==
&physical_fragment;
}
......
......@@ -12,19 +12,19 @@ namespace blink {
class ComputedStyle;
class Node;
class NGPhysicalFragment;
class NGPhysicalBoxFragment;
class CORE_EXPORT NGOutlineUtils {
STATIC_ONLY(NGOutlineUtils);
public:
static bool HasPaintedOutline(const ComputedStyle& style, const Node* node);
// First fragment paints the entire outline for LayoutInline.
// Returns true if this is the painting fragment.
static bool IsInlineOutlineNonpaintingFragment(
const NGPhysicalFragment& physical_fragment);
// Returns true if this fragment should paint an outline.
//
// Specifically a |LayoutInline| can be split across multiple flows. The
// first fragment produced should paint the outline for *all* fragments.
static bool ShouldPaintOutline(const NGPhysicalBoxFragment&);
};
} // namespace blink
......
......@@ -190,7 +190,7 @@ PhysicalRect NGPhysicalBoxFragment::ComputeSelfInkOverflow() const {
ink_overflow.Expand(style.BoxDecorationOutsets());
if (NGOutlineUtils::HasPaintedOutline(style,
GetLayoutObject()->GetNode()) &&
!NGOutlineUtils::IsInlineOutlineNonpaintingFragment(*this)) {
NGOutlineUtils::ShouldPaintOutline(*this)) {
Vector<PhysicalRect> outline_rects;
// The result rects are in coordinates of this object's border box.
AddSelfOutlineRects(
......@@ -209,7 +209,7 @@ void NGPhysicalBoxFragment::AddSelfOutlineRects(
const PhysicalOffset& additional_offset,
NGOutlineType outline_type,
Vector<PhysicalRect>* outline_rects) const {
if (NGOutlineUtils::IsInlineOutlineNonpaintingFragment(*this))
if (!NGOutlineUtils::ShouldPaintOutline(*this))
return;
const LayoutObject* layout_object = GetLayoutObject();
......
......@@ -158,7 +158,7 @@ void NGPhysicalContainerFragment::AddOutlineRectsForDescendant(
// for its line box which cover the line boxes of this LayoutInline. So
// the LayoutInline needs to add rects for children and continuations
// only.
if (!NGOutlineUtils::IsInlineOutlineNonpaintingFragment(*descendant)) {
if (NGOutlineUtils::ShouldPaintOutline(*descendant_box)) {
descendant_layout_inline->AddOutlineRectsForChildrenAndContinuations(
*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