Commit 2e01a47c authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Clean up LineBoxListPainter AddURLRectsForInlineChildrenRecursively call

AddURLRectsForInlineChildrenRecursively() is currently called from
within LineBoxListPainter::ShouldPaint(), which seems like an odd place
since that's sounds like (and otherwise is) a predicate function.
Hoist the call out of ShouldPaint() and into the callers. Since
PaintBackplate() is only called in the kForcedColorsModeBackplate paint
phase we can drop it in that case.
Also drop the paint phase check in PaintBackplate() since it's caller
already checks it.

Change-Id: I4e28b126138f884dd411d0ef44ef949371173421
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2080429
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745634}
parent 2f9e0c10
...@@ -74,9 +74,7 @@ void BuildBackplate(const InlineFlowBox* box, ...@@ -74,9 +74,7 @@ void BuildBackplate(const InlineFlowBox* box,
} }
} }
} // anonymous namespace void AddURLRectsForInlineChildrenRecursively(
static void AddURLRectsForInlineChildrenRecursively(
const LayoutObject& layout_object, const LayoutObject& layout_object,
const PaintInfo& paint_info, const PaintInfo& paint_info,
const PhysicalOffset& paint_offset) { const PhysicalOffset& paint_offset) {
...@@ -90,6 +88,8 @@ static void AddURLRectsForInlineChildrenRecursively( ...@@ -90,6 +88,8 @@ static void AddURLRectsForInlineChildrenRecursively(
} }
} }
} // anonymous namespace
bool LineBoxListPainter::ShouldPaint(const LayoutBoxModelObject& layout_object, bool LineBoxListPainter::ShouldPaint(const LayoutBoxModelObject& layout_object,
const PaintInfo& paint_info, const PaintInfo& paint_info,
const PhysicalOffset& paint_offset) const { const PhysicalOffset& paint_offset) const {
...@@ -100,12 +100,6 @@ bool LineBoxListPainter::ShouldPaint(const LayoutBoxModelObject& layout_object, ...@@ -100,12 +100,6 @@ bool LineBoxListPainter::ShouldPaint(const LayoutBoxModelObject& layout_object,
DCHECK(layout_object.IsLayoutBlock() || DCHECK(layout_object.IsLayoutBlock() ||
(layout_object.IsLayoutInline() && layout_object.HasLayer())); (layout_object.IsLayoutInline() && layout_object.HasLayer()));
if (paint_info.phase == PaintPhase::kForeground &&
paint_info.ShouldAddUrlMetadata()) {
AddURLRectsForInlineChildrenRecursively(layout_object, paint_info,
paint_offset);
}
// If we have no lines then we have no work to do. // If we have no lines then we have no work to do.
if (!line_box_list_.First()) if (!line_box_list_.First())
return false; return false;
...@@ -128,6 +122,12 @@ void LineBoxListPainter::Paint(const LayoutBoxModelObject& layout_object, ...@@ -128,6 +122,12 @@ void LineBoxListPainter::Paint(const LayoutBoxModelObject& layout_object,
paint_info.phase != PaintPhase::kMask) paint_info.phase != PaintPhase::kMask)
return; return;
if (paint_info.phase == PaintPhase::kForeground &&
paint_info.ShouldAddUrlMetadata()) {
AddURLRectsForInlineChildrenRecursively(layout_object, paint_info,
paint_offset);
}
if (!ShouldPaint(layout_object, paint_info, paint_offset)) if (!ShouldPaint(layout_object, paint_info, paint_offset))
return; return;
...@@ -158,8 +158,9 @@ void LineBoxListPainter::PaintBackplate( ...@@ -158,8 +158,9 @@ void LineBoxListPainter::PaintBackplate(
const LayoutBoxModelObject& layout_object, const LayoutBoxModelObject& layout_object,
const PaintInfo& paint_info, const PaintInfo& paint_info,
const PhysicalOffset& paint_offset) const { const PhysicalOffset& paint_offset) const {
if (paint_info.phase != PaintPhase::kForcedColorsModeBackplate || DCHECK_EQ(paint_info.phase, PaintPhase::kForcedColorsModeBackplate);
!ShouldPaint(layout_object, paint_info, paint_offset))
if (!ShouldPaint(layout_object, paint_info, paint_offset))
return; return;
// Only paint backplates behind text when forced-color-adjust is auto. // Only paint backplates behind text when forced-color-adjust is auto.
......
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