Commit 64e0dbe3 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Cleanup |fragment| usages in |PaintObject|

This patch unifies two different access to |box_fragment_|,
one as a field and one as a local variable, in |PaintObject|.

This patch has no behavior changes.

Change-Id: I2075fc9c88e62fafe0575c84a6a1310c2c3f5531
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2557701
Auto-Submit: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830869}
parent 0831d468
......@@ -538,9 +538,9 @@ void NGBoxFragmentPainter::PaintObject(
const PhysicalOffset& paint_offset,
bool suppress_box_decoration_background) {
const PaintPhase paint_phase = paint_info.phase;
const NGPhysicalBoxFragment& physical_box_fragment = PhysicalFragment();
const ComputedStyle& style = box_fragment_.Style();
bool is_visible = IsVisibleToPaint(physical_box_fragment, style);
const NGPhysicalBoxFragment& fragment = PhysicalFragment();
const ComputedStyle& style = fragment.Style();
bool is_visible = IsVisibleToPaint(fragment, style);
if (ShouldPaintSelfBlockBackground(paint_phase)) {
if (is_visible) {
PaintBoxDecorationBackground(paint_info, paint_offset,
......@@ -558,21 +558,20 @@ void NGBoxFragmentPainter::PaintObject(
if (paint_phase == PaintPhase::kForeground) {
if (paint_info.ShouldAddUrlMetadata()) {
NGFragmentPainter(box_fragment_, GetDisplayItemClient())
NGFragmentPainter(fragment, GetDisplayItemClient())
.AddURLRectIfNeeded(paint_info, paint_offset);
}
if (is_visible && box_fragment_.HasExtraMathMLPainting())
NGMathMLPainter(box_fragment_).Paint(paint_info, paint_offset);
if (is_visible && fragment.HasExtraMathMLPainting())
NGMathMLPainter(fragment).Paint(paint_info, paint_offset);
}
// Paint children.
if (paint_phase != PaintPhase::kSelfOutlineOnly &&
(!physical_box_fragment.Children().empty() ||
physical_box_fragment.HasItems() || inline_box_cursor_) &&
(!fragment.Children().empty() || fragment.HasItems() ||
inline_box_cursor_) &&
!paint_info.DescendantPaintingBlocked()) {
if (is_visible && UNLIKELY(paint_phase == PaintPhase::kForeground &&
box_fragment_.IsCSSBox() &&
box_fragment_.Style().HasColumnRule()))
fragment.IsCSSBox() && style.HasColumnRule()))
PaintColumnRules(paint_info, paint_offset);
if (paint_phase != PaintPhase::kFloat) {
......@@ -589,15 +588,15 @@ void NGBoxFragmentPainter::PaintObject(
paint_offset_to_inline_formatting_context,
box_item_->OffsetInContainerBlock(), &descendants);
} else if (items_) {
if (physical_box_fragment.IsBlockFlow()) {
if (fragment.IsBlockFlow()) {
PaintBlockFlowContents(paint_info, paint_offset);
} else {
DCHECK(physical_box_fragment.IsInlineBox());
NGInlineCursor cursor(physical_box_fragment, *items_);
DCHECK(fragment.IsInlineBox());
NGInlineCursor cursor(fragment, *items_);
PaintInlineItems(paint_info.ForDescendants(), paint_offset,
PhysicalOffset(), &cursor);
}
} else if (!physical_box_fragment.IsInlineFormattingContext()) {
} else if (!fragment.IsInlineFormattingContext()) {
PaintBlockChildren(paint_info, paint_offset);
} else if (!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) {
// This is the NGPaintFragment code path. We need the check for
......@@ -624,7 +623,7 @@ void NGBoxFragmentPainter::PaintObject(
// the remaining 50px of #fl - no items (all in-flow content fits in the
// first fragment).
DCHECK(paint_fragment_);
if (physical_box_fragment.IsBlockFlow()) {
if (fragment.IsBlockFlow()) {
PaintBlockFlowContents(paint_info, paint_offset);
} else if (ShouldPaintDescendantOutlines(paint_info.phase)) {
// TODO(kojii): |PaintInlineChildrenOutlines()| should do the work
......@@ -642,13 +641,13 @@ void NGBoxFragmentPainter::PaintObject(
if (paint_phase == PaintPhase::kFloat ||
paint_phase == PaintPhase::kSelectionDragImage ||
paint_phase == PaintPhase::kTextClip) {
if (physical_box_fragment.HasFloatingDescendantsForPaint())
if (fragment.HasFloatingDescendantsForPaint())
PaintFloats(paint_info);
}
}
if (is_visible && ShouldPaintSelfOutline(paint_phase)) {
NGFragmentPainter(box_fragment_, GetDisplayItemClient())
NGFragmentPainter(fragment, GetDisplayItemClient())
.PaintOutline(paint_info, paint_offset);
}
}
......
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