| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/compositing/CompositedLayerMapping.h" | 5 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/layout/LayoutBoxModelObject.h" | 8 #include "core/layout/LayoutBoxModelObject.h" |
| 9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
| 10 #include "core/layout/api/LayoutViewItem.h" | 10 #include "core/layout/api/LayoutViewItem.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 { | 95 { |
| 96 setBodyInnerHTML("<div id='target' style='width: 200px; height: 10000px; wil
l-change: transform'></div>"); | 96 setBodyInnerHTML("<div id='target' style='width: 200px; height: 10000px; wil
l-change: transform'></div>"); |
| 97 | 97 |
| 98 document().settings()->setMainFrameClipsContent(false); | 98 document().settings()->setMainFrameClipsContent(false); |
| 99 | 99 |
| 100 document().view()->updateAllLifecyclePhases(); | 100 document().view()->updateAllLifecyclePhases(); |
| 101 Element* element = document().getElementById("target"); | 101 Element* element = document().getElementById("target"); |
| 102 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 102 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 103 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); | 103 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); |
| 104 ASSERT_TRUE(paintLayer->compositedLayerMapping()); | 104 ASSERT_TRUE(paintLayer->compositedLayerMapping()); |
| 105 // recomputeInterestRect computes the interest rect; computeInterestRect app
lies the extra setting to paint everything. | 105 // Clipping is disabled in recomputeInterestRect. |
| 106 EXPECT_RECT_EQ(IntRect(0, 0, 200, 4592), recomputeInterestRect(paintLayer->g
raphicsLayerBacking())); | 106 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), recomputeInterestRect(paintLayer->
graphicsLayerBacking())); |
| 107 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), computeInterestRect(paintLayer->co
mpositedLayerMapping(), paintLayer->graphicsLayerBacking(), IntRect())); | 107 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), computeInterestRect(paintLayer->co
mpositedLayerMapping(), paintLayer->graphicsLayerBacking(), IntRect())); |
| 108 } | 108 } |
| 109 | 109 |
| 110 TEST_F(CompositedLayerMappingTest, VerticalRightLeftWritingModeDocument) | 110 TEST_F(CompositedLayerMappingTest, VerticalRightLeftWritingModeDocument) |
| 111 { | 111 { |
| 112 setBodyInnerHTML("<style>html,body { margin: 0px } html { -webkit-writing-mo
de: vertical-rl}</style> <div id='target' style='width: 10000px; height: 200px;'
></div>"); | 112 setBodyInnerHTML("<style>html,body { margin: 0px } html { -webkit-writing-mo
de: vertical-rl}</style> <div id='target' style='width: 10000px; height: 200px;'
></div>"); |
| 113 | 113 |
| 114 document().settings()->setMainFrameClipsContent(false); | |
| 115 | |
| 116 document().view()->updateAllLifecyclePhases(); | 114 document().view()->updateAllLifecyclePhases(); |
| 117 document().view()->setScrollPosition(DoublePoint(-5000, 0), ProgrammaticScro
ll); | 115 document().view()->setScrollPosition(DoublePoint(-5000, 0), ProgrammaticScro
ll); |
| 118 document().view()->updateAllLifecyclePhases(); | 116 document().view()->updateAllLifecyclePhases(); |
| 119 | 117 |
| 120 PaintLayer* paintLayer = document().layoutViewItem().layer(); | 118 PaintLayer* paintLayer = document().layoutViewItem().layer(); |
| 121 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); | 119 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); |
| 122 ASSERT_TRUE(paintLayer->compositedLayerMapping()); | 120 ASSERT_TRUE(paintLayer->compositedLayerMapping()); |
| 123 // A scroll by -5000px is equivalent to a scroll by (10000 - 5000 - 800)px =
4200px in non-RTL mode. Expanding | 121 // A scroll by -5000px is equivalent to a scroll by (10000 - 5000 - 800)px =
4200px in non-RTL mode. Expanding |
| 124 // the resulting rect by 4000px in each direction yields this result. | 122 // the resulting rect by 4000px in each direction yields this result. |
| 125 EXPECT_RECT_EQ(IntRect(200, 0, 8800, 600), recomputeInterestRect(paintLayer-
>graphicsLayerBacking())); | 123 EXPECT_RECT_EQ(IntRect(200, 0, 8800, 600), recomputeInterestRect(paintLayer-
>graphicsLayerBacking())); |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 negativeCompositedChild->parentNode()->removeChild(negativeCompositedChild); | 618 negativeCompositedChild->parentNode()->removeChild(negativeCompositedChild); |
| 621 document().view()->updateAllLifecyclePhases(); | 619 document().view()->updateAllLifecyclePhases(); |
| 622 | 620 |
| 623 mapping = toLayoutBlock(getLayoutObjectByElementId("container"))->layer()->c
ompositedLayerMapping(); | 621 mapping = toLayoutBlock(getLayoutObjectByElementId("container"))->layer()->c
ompositedLayerMapping(); |
| 624 ASSERT_TRUE(mapping->scrollingContentsLayer()); | 622 ASSERT_TRUE(mapping->scrollingContentsLayer()); |
| 625 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintOverflow
Contents | GraphicsLayerPaintCompositedScroll | GraphicsLayerPaintForeground), m
apping->scrollingContentsLayer()->paintingPhase()); | 623 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintOverflow
Contents | GraphicsLayerPaintCompositedScroll | GraphicsLayerPaintForeground), m
apping->scrollingContentsLayer()->paintingPhase()); |
| 626 EXPECT_FALSE(mapping->foregroundLayer()); | 624 EXPECT_FALSE(mapping->foregroundLayer()); |
| 627 } | 625 } |
| 628 | 626 |
| 629 } // namespace blink | 627 } // namespace blink |
| OLD | NEW |