Commit 2576522f authored by Yoichi Osato's avatar Yoichi Osato Committed by Commit Bot

Invalidate LayoutSVGText when descendant LayoutText is invalidated.

We used to invalidate always LayoutSVGText even local selection rect
was empty before inserting early return of L342.
That caused regression that selection in svg text is not invalidated.

This patch fixes the regression by invalidating LayoutSVGText always
as before.

Bug: 897752
Change-Id: I534959ccb461d55d38e85e053c9b9c478b3878b3
Reviewed-on: https://chromium-review.googlesource.com/c/1314019
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606388}
parent 70f678d0
{
"layers": [
{
"name": "Scrolling background of LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "InlineTextBox 'foobar'",
"rect": [23, 0, 23, 14],
"reason": "selection"
}
]
}
]
}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="800" height="600" onload="runRepaintAndPixelTest()">
<script xlink:href="../resources/text-based-repaint.js"/>
<text x="10" y="10" >foobar</text>
<script>
var s = getSelection();
var text = document.querySelector("text");
s.setBaseAndExtent(text.firstChild, 2, text.firstChild, 4);
function repaintTest() {
s.setBaseAndExtent(text.firstChild, 2, text.firstChild, 5);
}
</script>
</svg>
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "InlineTextBox 'foobar'",
"rect": [23, 0, 23, 14],
"reason": "selection"
}
]
}
]
}
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "InlineTextBox 'foobar'",
"rect": [23, 0, 23, 14],
"reason": "selection"
}
]
}
]
}
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "InlineTextBox 'foobar'",
"rect": [22, 0, 23, 14],
"reason": "selection"
}
]
}
]
}
...@@ -336,7 +336,10 @@ PaintInvalidationReason ObjectPaintInvalidatorWithContext::InvalidateSelection( ...@@ -336,7 +336,10 @@ PaintInvalidationReason ObjectPaintInvalidatorWithContext::InvalidateSelection(
if (full_invalidation) if (full_invalidation)
return reason; return reason;
// We should invalidate LayoutSVGText always.
// See layout_selection.cc SetShouldInvalidateIfNeeded for more detail.
if (object_.IsSVGText())
return PaintInvalidationReason::kSelection;
const LayoutRect invalidation_rect = const LayoutRect invalidation_rect =
UnionRect(new_selection_rect, old_selection_rect); UnionRect(new_selection_rect, old_selection_rect);
if (invalidation_rect.IsEmpty()) if (invalidation_rect.IsEmpty())
......
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