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