Commit c4a655f4 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Use cached HasBoxDecorationBackground

Querying ComputedStyle::HasBoxDecorationBackground is rather costly, use
the cached value from LayoutObject instead for now and add a TODO.

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I2fc28723066ece5c0059ddd36c0b4e4d641a154f
Reviewed-on: https://chromium-review.googlesource.com/1152509
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579128}
parent 39a2461f
...@@ -61,18 +61,13 @@ void NGInlineBoxFragmentPainter::PaintBackgroundBorderShadow( ...@@ -61,18 +61,13 @@ void NGInlineBoxFragmentPainter::PaintBackgroundBorderShadow(
if (inline_box_fragment_.Style().Visibility() != EVisibility::kVisible) if (inline_box_fragment_.Style().Visibility() != EVisibility::kVisible)
return; return;
// You can use p::first-line to specify a background. If so, the root line // You can use p::first-line to specify a background. If so, the direct child
// boxes for a line may actually have to paint a background. // inline boxes of line boxes may actually have to paint a background.
bool should_paint_box_decoration_background; // TODO(layout-dev): Cache HasBoxDecorationBackground on the fragment like
if (inline_box_fragment_.Parent()) { // we do for LayoutObject. Querying Style each time is too costly.
should_paint_box_decoration_background = bool should_paint_box_decoration_background =
inline_box_fragment_.Style().HasBoxDecorationBackground(); inline_box_fragment_.GetLayoutObject()->HasBoxDecorationBackground() ||
} else { inline_box_fragment_.PhysicalFragment().UsesFirstLineStyle();
// TODO(kojii): Get from fragment once available.
bool is_first_line = false;
should_paint_box_decoration_background =
is_first_line && line_style_ != style_;
}
if (!should_paint_box_decoration_background) if (!should_paint_box_decoration_background)
return; return;
......
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