Commit 11249650 authored by chrishtr's avatar chrishtr Committed by Commit bot

Account for writing-mode flip of the composited element for interest rects.

BUG=581264

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

Cr-Commit-Position: refs/heads/master@{#372117}
parent 1ed4bad4
......@@ -2256,6 +2256,9 @@ IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graph
// Start with the bounds of the graphics layer in the space of the anchor LayoutObject.
FloatRect graphicsLayerBoundsInObjectSpace(graphicsLayerBounds);
graphicsLayerBoundsInObjectSpace.move(offsetFromAnchorLayoutObject);
// The object space means including writing mode flip.
if (anchorLayoutObject->isBox())
toLayoutBox(anchorLayoutObject)->flipForWritingMode(graphicsLayerBoundsInObjectSpace);
// Now map the bounds to its visible content rect in screen space, including applying clips along the way.
LayoutRect visibleContentRect(graphicsLayerBoundsInObjectSpace);
......
......@@ -109,6 +109,23 @@ TEST_F(CompositedLayerMappingTest, TallLayerWholeDocumentInterestRect)
EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), computeInterestRect(paintLayer->compositedLayerMapping(), paintLayer->graphicsLayerBacking(), IntRect()));
}
TEST_F(CompositedLayerMappingTest, VerticalRightLeftWritingModeDocument)
{
setBodyInnerHTML("<style>html,body { margin: 0px } html { -webkit-writing-mode: vertical-rl}</style> <div id='target' style='width: 10000px; height: 200px;'></div>");
document().settings()->setMainFrameClipsContent(false);
document().view()->updateAllLifecyclePhases();
document().view()->scrollTo(DoublePoint(-5000, 0));
document().view()->updateAllLifecyclePhases();
PaintLayer* paintLayer = document().layoutView()->layer();
ASSERT_TRUE(paintLayer->graphicsLayerBacking());
ASSERT_TRUE(paintLayer->compositedLayerMapping());
// A scroll by -5000px is equivalent to a scroll by (10000 - 5000 - 800)px = 4200px in non-RTL mode. Expanding
// the resulting rect by 4000px in each direction yields this result.
EXPECT_RECT_EQ(IntRect(200, 0, 8800, 600), recomputeInterestRect(paintLayer->graphicsLayerBacking()));
}
TEST_F(CompositedLayerMappingTest, RotatedInterestRect)
{
......
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