Commit 2c112e7e authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Restructure nested `if` blocks in |PaintObject|

This patch restructures nested `if` blocks in
|NGBoxFragmentPainter::PaintObject| to reduce the duplicated
code, by checking |paint_phase| first. This makes it easier to
add the support for fragment items.

There is no behavior changes by this change.

Bug: 982194
Change-Id: I8b50db590a729245d647093dc00695fd3db9835a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903235Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713396}
parent c39f3221
......@@ -383,9 +383,9 @@ void NGBoxFragmentPainter::PaintObject(
(!physical_box_fragment.Children().empty() ||
physical_box_fragment.HasItems()) &&
!paint_info.DescendantPaintingBlocked()) {
if (physical_box_fragment.ChildrenInline()) {
DCHECK(paint_fragment_ || PhysicalFragment().HasItems());
if (paint_phase != PaintPhase::kFloat) {
if (paint_phase != PaintPhase::kFloat) {
if (physical_box_fragment.ChildrenInline()) {
DCHECK(paint_fragment_ || PhysicalFragment().HasItems());
if (physical_box_fragment.IsBlockFlow()) {
PaintBlockFlowContents(paint_info, paint_offset);
} else if (ShouldPaintDescendantOutlines(paint_info.phase)) {
......@@ -398,25 +398,17 @@ void NGBoxFragmentPainter::PaintObject(
PaintInlineChildren(paint_fragment_->Children(), paint_info,
paint_offset);
}
}
if (paint_phase == PaintPhase::kFloat ||
paint_phase == PaintPhase::kSelection ||
paint_phase == PaintPhase::kTextClip) {
if (physical_box_fragment.HasFloatingDescendantsForPaint())
PaintFloats(paint_info);
}
} else {
if (paint_phase != PaintPhase::kFloat)
} else {
PaintBlockChildren(paint_info);
if (paint_phase == PaintPhase::kFloat ||
paint_phase == PaintPhase::kSelection ||
paint_phase == PaintPhase::kTextClip) {
if (physical_box_fragment.HasFloatingDescendantsForPaint())
PaintFloats(paint_info);
}
}
if (paint_phase == PaintPhase::kFloat ||
paint_phase == PaintPhase::kSelection ||
paint_phase == PaintPhase::kTextClip) {
if (physical_box_fragment.HasFloatingDescendantsForPaint())
PaintFloats(paint_info);
}
}
if (ShouldPaintSelfOutline(paint_phase)) {
......
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