Commit a3ddd493 authored by chrishtr@chromium.org's avatar chrishtr@chromium.org

Fix selection invalidation in composited scrollers.

The rects incorrectly included composited scroll offset. They should not, and
instead follow the example set by https://codereview.chromium.org/1287413002.

BUG=524547

Review URL: https://codereview.chromium.org/1315203002

git-svn-id: svn://svn.chromium.org/blink/trunk@201287 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e326e783
......@@ -205,6 +205,8 @@ crbug.com/524859 fast/text/complex-text-opacity.html [ NeedsManualRebaseline ]
# crbug.com/521730 [ Win10 ] fast/text/complex-text-opacity.html [ Failure Timeout Failure Failure ]
crbug.com/524859 transforms/2d/hindi-rotated.html [ NeedsManualRebaseline ]
crbug.com/524547 paint/selection/selection-within-composited-scroller.html [ NeedsRebaseline ]
crbug.com/498539 http/tests/inspector/elements/styles/selector-line.html [ Pass Timeout ]
crbug.com/498539 http/tests/inspector/network/network-datareceived.html [ Pass Timeout ]
crbug.com/498539 [ Win ] inspector/tracing/decode-resize.html [ Failure Timeout ]
......
{
"bounds": [800, 600],
"children": [
{
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"paintInvalidationClients": [
"LayoutBlockFlow HTML",
"LayoutBlockFlow BODY"
],
"children": [
{
"position": [8, 8],
"bounds": [200, 200],
"contentsOpaque": true,
"drawsContent": true,
"backgroundColor": "#D3D3D3",
"repaintRects": [
[0, 160, 21, 19]
],
"paintInvalidationClients": [
"LayoutBlockFlow DIV id='scroller'",
"LayoutBlockFlow DIV id='target'",
"LayoutText #text",
"InlineTextBox 'test'"
],
"children": [
{
"bounds": [185, 185],
"children": [
{
"bounds": [200, 1620],
"shouldFlattenTransform": false,
"drawsContent": true,
"repaintRects": [
[0, 610, 21, 19]
],
"paintInvalidationClients": [
"LayoutBlockFlow DIV id='scroller'",
"LayoutBlockFlow DIV id='target'",
"LayoutText #text",
"InlineTextBox 'test'"
],
"children": [
{
"shouldFlattenTransform": false
}
]
}
]
},
{
"children": [
{
"position": [0, 185],
"bounds": [185, 15],
"drawsContent": true
},
{
"position": [185, 0],
"bounds": [15, 185],
"drawsContent": true
},
{
"position": [185, 185],
"bounds": [15, 15],
"drawsContent": true
}
]
}
]
}
]
}
]
}
<!doctype HTML>
<div id="scroller" style="width: 200px; height: 200px; overflow: scroll; background: lightgray; will-change: transform">
<div style="width: 100px; height: 600px; background: lightblue; margin-bottom: 10px"></div>
<div id="target" style="width: 200px; height: 1000px; background: lightblue; margin-bottom: 10px">test</div>
</div>
<script src="../../fast/repaint/resources/text-based-repaint.js"></script>
<script>
scroller.scrollTop = 450;
function repaintTest() {
var range = document.createRange();
range.selectNode(target);
window.getSelection().addRange(range);
}
onload = runRepaintTest;
</script>
\ No newline at end of file
......@@ -1300,6 +1300,14 @@ inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject
LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation();
LayoutRect newSelectionRect = selectionRectForPaintInvalidation(&paintInvalidationContainer);
// Composited scrolling should not be included in the bounds and position tracking, because the graphics layer backing the scroller
// does not move on scroll.
if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidationContainer != this) {
LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrolledContentOffset());
newSelectionRect.move(inverseOffset);
}
setPreviousSelectionRectForPaintInvalidation(newSelectionRect);
if (RuntimeEnabledFeatures::slimmingPaintEnabled() && shouldInvalidateSelection())
......@@ -1378,6 +1386,7 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(PaintInvalidationS
}
fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBounds, newBounds);
return invalidationReason;
}
......
......@@ -1162,7 +1162,6 @@ protected:
const LayoutRect& oldPaintInvalidationRect, const LayoutPoint& oldPositionFromPaintInvalidationBacking,
const LayoutRect& newPaintInvalidationRect, const LayoutPoint& newPositionFromPaintInvalidationBacking) const;
virtual void incrementallyInvalidatePaint(const LayoutBoxModelObject& paintInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, const LayoutPoint& positionFromPaintInvalidationBacking);
void fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvalidationReason, const LayoutRect& oldBounds, const LayoutRect& newBounds);
virtual bool hasNonCompositedScrollbars() const { return false; }
......@@ -1193,6 +1192,8 @@ protected:
void removeFromLayoutFlowThread();
private:
void fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalidationContainer, PaintInvalidationReason, const LayoutRect& oldBounds, const LayoutRect& newBounds);
const LayoutRect& previousPaintInvalidationRect() const { return m_previousPaintInvalidationRect; }
// Adjusts a paint invalidation rect in the space of |m_previousPaintInvalidationRect| and |m_previousPositionFromPaintInvalidationBacking|
......
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