Commit 2aaf92ed authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[SPv175+] Support partial invalidation for selections

Bug: 732612
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I685af535011500633865953799a6c4ae128ab5e8
Reviewed-on: https://chromium-review.googlesource.com/820043Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523454}
parent 233c85dc
...@@ -86,7 +86,6 @@ crbug.com/771643 virtual/spv175/compositing/squashing/squash-overflow-hidden-scr ...@@ -86,7 +86,6 @@ crbug.com/771643 virtual/spv175/compositing/squashing/squash-overflow-hidden-scr
crbug.com/771643 virtual/spv175/compositing/squashing/squash-with-ancestor-reflection.html [ Failure ] crbug.com/771643 virtual/spv175/compositing/squashing/squash-with-ancestor-reflection.html [ Failure ]
crbug.com/771643 virtual/spv175/compositing/visibility/visibility-image-layers.html [ Failure Pass ] crbug.com/771643 virtual/spv175/compositing/visibility/visibility-image-layers.html [ Failure Pass ]
crbug.com/771643 virtual/spv175/paint/invalidation/offset-change-wrong-invalidation-with-float.html [ Failure ] crbug.com/771643 virtual/spv175/paint/invalidation/offset-change-wrong-invalidation-with-float.html [ Failure ]
crbug.com/771643 virtual/spv175/paint/invalidation/repaint-across-writing-mode-boundary.html [ Failure ]
crbug.com/771643 virtual/spv175/paint/invalidation/compositing/resize-squashing-layer-that-needs-full-repaint.html [ Failure ] crbug.com/771643 virtual/spv175/paint/invalidation/compositing/resize-squashing-layer-that-needs-full-repaint.html [ Failure ]
crbug.com/771643 virtual/spv175/paint/invalidation/compositing/subpixel-offset-scaled-transform-composited.html [ Failure ] crbug.com/771643 virtual/spv175/paint/invalidation/compositing/subpixel-offset-scaled-transform-composited.html [ Failure ]
crbug.com/771643 virtual/spv175/paint/invalidation/forms/select-option-background-color.html [ Failure ] crbug.com/771643 virtual/spv175/paint/invalidation/forms/select-option-background-color.html [ Failure ]
...@@ -97,7 +96,6 @@ crbug.com/771643 virtual/spv175/paint/invalidation/reflection/reflection-repaint ...@@ -97,7 +96,6 @@ crbug.com/771643 virtual/spv175/paint/invalidation/reflection/reflection-repaint
crbug.com/771643 virtual/spv175/paint/invalidation/scroll/repaint-during-scroll-with-zoom.html [ Failure ] crbug.com/771643 virtual/spv175/paint/invalidation/scroll/repaint-during-scroll-with-zoom.html [ Failure ]
crbug.com/771643 virtual/spv175/paint/invalidation/scroll/resize-scrollable-iframe.html [ Failure ] crbug.com/771643 virtual/spv175/paint/invalidation/scroll/resize-scrollable-iframe.html [ Failure ]
crbug.com/771643 virtual/spv175/paint/invalidation/scroll/scroll-descendant-with-cached-cliprects.html [ Failure ] crbug.com/771643 virtual/spv175/paint/invalidation/scroll/scroll-descendant-with-cached-cliprects.html [ Failure ]
crbug.com/771643 virtual/spv175/paint/invalidation/selection/selection-rl.html [ Failure ]
crbug.com/771643 virtual/spv175/paint/invalidation/svg/absolute-sized-content-with-resources.xhtml [ Failure ] crbug.com/771643 virtual/spv175/paint/invalidation/svg/absolute-sized-content-with-resources.xhtml [ Failure ]
crbug.com/771643 virtual/spv175/paint/invalidation/svg/deep-dynamic-updates.svg [ Failure ] crbug.com/771643 virtual/spv175/paint/invalidation/svg/deep-dynamic-updates.svg [ Failure ]
crbug.com/771643 virtual/spv175/paint/invalidation/svg/filter-refresh.svg [ Failure ] crbug.com/771643 virtual/spv175/paint/invalidation/svg/filter-refresh.svg [ Failure ]
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"paintInvalidations": [ "paintInvalidations": [
{ {
"object": "InlineTextBox 'Should have blue, not gray, highlight'", "object": "InlineTextBox 'Should have blue, not gray, highlight'",
"rect": [18, 18, 234, 19], "rect": [18, 18, 233, 19],
"reason": "selection" "reason": "selection"
} }
] ]
......
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "InlineTextBox '\u7B2C\u4E00\u6BB5\u843D paragraph 1'",
"rect": [548, 191, 23, 36],
"reason": "selection"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutText #text",
"reason": "selection"
},
{
"object": "InlineTextBox '\u7B2C\u4E00\u6BB5\u843D paragraph 1'",
"reason": "selection"
}
]
}
...@@ -11,15 +11,15 @@ ...@@ -11,15 +11,15 @@
"rect": [8, 24, 32, 17], "rect": [8, 24, 32, 17],
"reason": "geometry" "reason": "geometry"
}, },
{
"object": "InlineTextBox 'a'",
"rect": [8, 8, 16, 17],
"reason": "selection"
},
{ {
"object": "InlineTextBox '\n'", "object": "InlineTextBox '\n'",
"rect": [24, 8, 16, 16], "rect": [24, 8, 16, 16],
"reason": "appeared" "reason": "appeared"
},
{
"object": "InlineTextBox 'a'",
"rect": [8, 8, 16, 16],
"reason": "selection"
} }
] ]
} }
......
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "InlineTextBox 'Testing both hit testing'",
"rect": [773, 38, 19, 83],
"reason": "selection"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutText #text",
"reason": "selection"
},
{
"object": "InlineTextBox 'Testing both hit testing'",
"reason": "selection"
}
]
}
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
"paintInvalidations": [ "paintInvalidations": [
{ {
"object": "InlineTextBox 'test'", "object": "InlineTextBox 'test'",
"rect": [0, 610, 22, 19], "rect": [0, 610, 21, 19],
"reason": "selection" "reason": "selection"
} }
], ],
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"paintInvalidations": [ "paintInvalidations": [
{ {
"object": "InlineTextBox 'Should have blue, not gray, highlight'", "object": "InlineTextBox 'Should have blue, not gray, highlight'",
"rect": [18, 18, 234, 19], "rect": [18, 18, 233, 19],
"reason": "selection" "reason": "selection"
} }
] ]
......
...@@ -16,35 +16,35 @@ ...@@ -16,35 +16,35 @@
"rect": [0, 0, 800, 600], "rect": [0, 0, 800, 600],
"reason": "appeared" "reason": "appeared"
}, },
{
"object": "InlineTextBox 'text-anchor'",
"rect": [352, 12, 131, 36],
"reason": "selection"
},
{ {
"object": "LayoutSVGText text", "object": "LayoutSVGText text",
"rect": [352, 12, 131, 36], "rect": [352, 12, 131, 36],
"reason": "appeared" "reason": "appeared"
}, },
{ {
"object": "InlineTextBox 'text-anchor'", "object": "LayoutSVGText text",
"rect": [519, 12, 130, 36], "rect": [519, 12, 130, 36],
"reason": "selection" "reason": "appeared"
}, },
{ {
"object": "LayoutSVGText text", "object": "LayoutSVGText text",
"rect": [519, 12, 130, 36], "rect": [186, 12, 130, 36],
"reason": "appeared" "reason": "appeared"
}, },
{ {
"object": "InlineTextBox 'text-anchor'", "object": "InlineTextBox 'text-anchor'",
"rect": [186, 12, 130, 36], "rect": [519, 12, 129, 36],
"reason": "selection" "reason": "selection"
}, },
{ {
"object": "LayoutSVGText text", "object": "InlineTextBox 'text-anchor'",
"rect": [186, 12, 130, 36], "rect": [352, 12, 129, 36],
"reason": "appeared" "reason": "selection"
},
{
"object": "InlineTextBox 'text-anchor'",
"rect": [186, 12, 128, 36],
"reason": "selection"
}, },
{ {
"object": "InlineTextBox '1'", "object": "InlineTextBox '1'",
......
...@@ -294,6 +294,9 @@ class LineLayoutItem { ...@@ -294,6 +294,9 @@ class LineLayoutItem {
} }
LayoutRect VisualRect() const { return layout_object_->VisualRect(); } LayoutRect VisualRect() const { return layout_object_->VisualRect(); }
LayoutRect PartialInvalidationRect() const {
return layout_object_->PartialInvalidationRect();
}
bool IsHashTableDeletedValue() const { bool IsHashTableDeletedValue() const {
return layout_object_ == kHashTableDeletedValue; return layout_object_ == kHashTableDeletedValue;
......
...@@ -95,10 +95,15 @@ String InlineBox::DebugName() const { ...@@ -95,10 +95,15 @@ String InlineBox::DebugName() const {
} }
LayoutRect InlineBox::VisualRect() const { LayoutRect InlineBox::VisualRect() const {
// TODO(chrishtr): tighten these bounds. // TODO(wangxianzhu): tighten it.
return GetLineLayoutItem().VisualRect(); return GetLineLayoutItem().VisualRect();
} }
LayoutRect InlineBox::PartialInvalidationRect() const {
// TODO(wangxianzhu): tighten it.
return GetLineLayoutItem().PartialInvalidationRect();
}
#ifndef NDEBUG #ifndef NDEBUG
void InlineBox::ShowTreeForThis() const { void InlineBox::ShowTreeForThis() const {
GetLineLayoutItem().ShowTreeForThis(); GetLineLayoutItem().ShowTreeForThis();
......
...@@ -138,6 +138,7 @@ class CORE_EXPORT InlineBox : public DisplayItemClient { ...@@ -138,6 +138,7 @@ class CORE_EXPORT InlineBox : public DisplayItemClient {
// DisplayItemClient methods // DisplayItemClient methods
String DebugName() const override; String DebugName() const override;
LayoutRect VisualRect() const override; LayoutRect VisualRect() const override;
LayoutRect PartialInvalidationRect() const override;
bool IsText() const { return bitfields_.IsText(); } bool IsText() const { return bitfields_.IsText(); }
void SetIsText(bool is_text) { bitfields_.SetIsText(is_text); } void SetIsText(bool is_text) { bitfields_.SetIsText(is_text); }
......
...@@ -536,16 +536,20 @@ void ObjectPaintInvalidatorWithContext::InvalidateSelection( ...@@ -536,16 +536,20 @@ void ObjectPaintInvalidatorWithContext::InvalidateSelection(
object_.GetMutableForPainting().SetSelectionVisualRect(new_selection_rect); object_.GetMutableForPainting().SetSelectionVisualRect(new_selection_rect);
if (!full_invalidation) { if (full_invalidation)
// TODO(crbug.com/732612): Implement partial raster invalidation for return;
// selection.
if (!RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) { if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) {
FullyInvalidatePaint(PaintInvalidationReason::kSelection, // PaintController will handle raster invalidation of the partial rect.
old_selection_rect, new_selection_rect); object_.GetMutableForPainting().SetPartialInvalidationRect(
} UnionRect(object_.PartialInvalidationRect(),
context_.painting_layer->SetNeedsRepaint(); UnionRect(new_selection_rect, old_selection_rect)));
object_.InvalidateDisplayItemClients(PaintInvalidationReason::kSelection); } else {
FullyInvalidatePaint(PaintInvalidationReason::kSelection,
old_selection_rect, new_selection_rect);
} }
context_.painting_layer->SetNeedsRepaint();
object_.InvalidateDisplayItemClients(PaintInvalidationReason::kSelection);
} }
DISABLE_CFI_PERF DISABLE_CFI_PERF
...@@ -558,11 +562,6 @@ void ObjectPaintInvalidatorWithContext::InvalidatePartialRect( ...@@ -558,11 +562,6 @@ void ObjectPaintInvalidatorWithContext::InvalidatePartialRect(
if (rect.IsEmpty()) if (rect.IsEmpty())
return; return;
if (reason == PaintInvalidationReason::kNone) {
context_.painting_layer->SetNeedsRepaint();
object_.InvalidateDisplayItemClients(PaintInvalidationReason::kRectangle);
}
context_.MapLocalRectToVisualRectInBacking(object_, rect); context_.MapLocalRectToVisualRectInBacking(object_, rect);
if (rect.IsEmpty()) if (rect.IsEmpty())
return; return;
...@@ -574,6 +573,9 @@ void ObjectPaintInvalidatorWithContext::InvalidatePartialRect( ...@@ -574,6 +573,9 @@ void ObjectPaintInvalidatorWithContext::InvalidatePartialRect(
InvalidatePaintRectangleWithContext(rect, InvalidatePaintRectangleWithContext(rect,
PaintInvalidationReason::kRectangle); PaintInvalidationReason::kRectangle);
} }
context_.painting_layer->SetNeedsRepaint();
object_.InvalidateDisplayItemClients(PaintInvalidationReason::kRectangle);
} }
DISABLE_CFI_PERF DISABLE_CFI_PERF
...@@ -583,13 +585,15 @@ ObjectPaintInvalidatorWithContext::InvalidatePaintWithComputedReason( ...@@ -583,13 +585,15 @@ ObjectPaintInvalidatorWithContext::InvalidatePaintWithComputedReason(
DCHECK(!(context_.subtree_flags & DCHECK(!(context_.subtree_flags &
PaintInvalidatorContext::kSubtreeNoInvalidation)); PaintInvalidatorContext::kSubtreeNoInvalidation));
// This is before InvalidateSelection before the latter will accumulate
// selection visual rects to the partial rect mapped in the former.
InvalidatePartialRect(reason);
// We need to invalidate the selection before checking for whether we are // We need to invalidate the selection before checking for whether we are
// doing a full invalidation. This is because we need to update the previous // doing a full invalidation. This is because we need to update the previous
// selection rect regardless. // selection rect regardless.
InvalidateSelection(reason); InvalidateSelection(reason);
InvalidatePartialRect(reason);
switch (reason) { switch (reason) {
case PaintInvalidationReason::kNone: case PaintInvalidationReason::kNone:
// There are corner cases that the display items need to be invalidated // There are corner cases that the display items need to be invalidated
......
...@@ -910,10 +910,10 @@ void PaintController::GenerateRasterInvalidation( ...@@ -910,10 +910,10 @@ void PaintController::GenerateRasterInvalidation(
return; return;
} }
if (client.GetPaintInvalidationReason() != auto reason = client.GetPaintInvalidationReason();
PaintInvalidationReason::kRectangle && if (reason != PaintInvalidationReason::kRectangle &&
client.GetPaintInvalidationReason() != reason != PaintInvalidationReason::kSelection &&
PaintInvalidationReason::kIncremental) { reason != PaintInvalidationReason::kIncremental) {
GenerateFullRasterInvalidation(chunk, *old_item, *new_item); GenerateFullRasterInvalidation(chunk, *old_item, *new_item);
return; return;
} }
...@@ -921,10 +921,8 @@ void PaintController::GenerateRasterInvalidation( ...@@ -921,10 +921,8 @@ void PaintController::GenerateRasterInvalidation(
GenerateIncrementalRasterInvalidation(chunk, *old_item, *new_item); GenerateIncrementalRasterInvalidation(chunk, *old_item, *new_item);
auto partial_rect = client.PartialInvalidationRect(); auto partial_rect = client.PartialInvalidationRect();
if (!partial_rect.IsEmpty()) { if (!partial_rect.IsEmpty())
AddRasterInvalidation(client, chunk, FloatRect(partial_rect), AddRasterInvalidation(client, chunk, FloatRect(partial_rect), reason);
PaintInvalidationReason::kRectangle);
}
} }
static FloatRect ComputeRightDelta(const FloatPoint& location, static FloatRect ComputeRightDelta(const FloatPoint& location,
......
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