Commit 2fd549b2 authored by Yoichi Osato's avatar Yoichi Osato Committed by Commit Bot

[LayoutNG] Update NGPaintFragment.VisualRect() including selection

VisualRect() should cover all visual effects including selections on SPVv175
because SPv175 uses VisualRect() instead of LocalSelectionRect() to invalidate selection.
SPv1 also did that and the future SPv175 will do that when the DisplayItemClient
needs full invalidation.

This patch updates ComputeVisualRectInBacking to add selection rect
to NGPaintFragment.VisualRect() for selection invalidating.
Since NGPaintFragment.VisualRect() didn't consider selection rect,
we missed invalidation.
This patch fixes the problem by updating ComputeVisualRectInBacking to compute
whole visual rect which consists of physical_fragment.VisualRect and
NGPaintFragment::ComputeLocalSelectionRect().

ToT:
https://test-results.appspot.com/data/layout_results/linux_layout_tests_layout_ng/5662/layout-test-results/paint/selection/text-selection-newline-across-blocks-actual.png
This patch:
https://test-results.appspot.com/data/layout_results/linux_layout_tests_layout_ng/5710/layout-test-results/paint/selection/text-selection-newline-across-blocks-actual.png

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2;master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: Ie72e3dca922cba0a4c4585cb757156dd543b9bfc
Reviewed-on: https://chromium-review.googlesource.com/1068947Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561802}
parent 6bfaed76
......@@ -255,13 +255,30 @@ LayoutRect PaintInvalidator::ComputeVisualRectInBacking(
object, local_rect, context);
}
// We need update |fragment| visual rect considering selection.
static LayoutRect ComputeLocalVisualRect(const NGPaintFragment& fragment) {
const NGPhysicalFragment& physical_fragment = fragment.PhysicalFragment();
LayoutRect rect = physical_fragment.VisualRectWithContents().ToLayoutRect();
if (!physical_fragment.IsText())
return rect;
const FrameSelection& frame_selection =
fragment.GetLayoutObject()->GetFrame()->Selection();
const LayoutSelectionStatus status =
frame_selection.ComputeLayoutSelectionStatus(fragment);
if (status.start == status.end)
return rect;
NGPhysicalOffsetRect fragment_rect =
fragment.ComputeLocalSelectionRect(status);
fragment_rect.offset += fragment.InlineOffsetToContainerBox();
rect.Unite(fragment_rect.ToLayoutRect());
return rect;
}
LayoutRect PaintInvalidator::ComputeVisualRectInBacking(
const NGPaintFragment& fragment,
const LayoutObject& object,
const PaintInvalidatorContext& context) {
const NGPhysicalFragment& physical_fragment = fragment.PhysicalFragment();
LayoutRect local_rect =
physical_fragment.VisualRectWithContents().ToLayoutRect();
LayoutRect local_rect = ComputeLocalVisualRect(fragment);
bool disable_flip = true;
LayoutRect backing_rect =
MapLocalRectToVisualRectInBacking<LayoutRect, LayoutPoint>(
......
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