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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 { | 101 { |
102 setBodyInnerHTML("<div id='target' style='width: 200px; height: 10000px; wil
l-change: transform'></div>"); | 102 setBodyInnerHTML("<div id='target' style='width: 200px; height: 10000px; wil
l-change: transform'></div>"); |
103 | 103 |
104 document().settings()->setMainFrameClipsContent(false); | 104 document().settings()->setMainFrameClipsContent(false); |
105 | 105 |
106 document().view()->updateAllLifecyclePhases(); | 106 document().view()->updateAllLifecyclePhases(); |
107 Element* element = document().getElementById("target"); | 107 Element* element = document().getElementById("target"); |
108 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 108 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
109 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); | 109 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); |
110 ASSERT_TRUE(paintLayer->compositedLayerMapping()); | 110 ASSERT_TRUE(paintLayer->compositedLayerMapping()); |
111 // recomputeInterestRect computes the interest rect; computeInterestRect app
lies the extra setting to paint everything. | 111 // Clipping is disabled in recomputeInterestRect. |
112 EXPECT_RECT_EQ(IntRect(0, 0, 200, 4592), recomputeInterestRect(paintLayer->g
raphicsLayerBacking())); | 112 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), recomputeInterestRect(paintLayer->
graphicsLayerBacking())); |
113 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), computeInterestRect(paintLayer->co
mpositedLayerMapping(), paintLayer->graphicsLayerBacking(), IntRect())); | 113 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), computeInterestRect(paintLayer->co
mpositedLayerMapping(), paintLayer->graphicsLayerBacking(), IntRect())); |
114 } | 114 } |
115 | 115 |
116 TEST_F(CompositedLayerMappingTest, VerticalRightLeftWritingModeDocument) | 116 TEST_F(CompositedLayerMappingTest, VerticalRightLeftWritingModeDocument) |
117 { | 117 { |
118 setBodyInnerHTML("<style>html,body { margin: 0px } html { -webkit-writing-mo
de: vertical-rl}</style> <div id='target' style='width: 10000px; height: 200px;'
></div>"); | 118 setBodyInnerHTML("<style>html,body { margin: 0px } html { -webkit-writing-mo
de: vertical-rl}</style> <div id='target' style='width: 10000px; height: 200px;'
></div>"); |
119 | 119 |
120 document().settings()->setMainFrameClipsContent(false); | |
121 | |
122 document().view()->updateAllLifecyclePhases(); | 120 document().view()->updateAllLifecyclePhases(); |
123 document().view()->setScrollPosition(DoublePoint(-5000, 0), ProgrammaticScro
ll); | 121 document().view()->setScrollPosition(DoublePoint(-5000, 0), ProgrammaticScro
ll); |
124 document().view()->updateAllLifecyclePhases(); | 122 document().view()->updateAllLifecyclePhases(); |
125 | 123 |
126 PaintLayer* paintLayer = document().layoutViewItem().layer(); | 124 PaintLayer* paintLayer = document().layoutViewItem().layer(); |
127 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); | 125 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); |
128 ASSERT_TRUE(paintLayer->compositedLayerMapping()); | 126 ASSERT_TRUE(paintLayer->compositedLayerMapping()); |
129 // A scroll by -5000px is equivalent to a scroll by (10000 - 5000 - 800)px =
4200px in non-RTL mode. Expanding | 127 // A scroll by -5000px is equivalent to a scroll by (10000 - 5000 - 800)px =
4200px in non-RTL mode. Expanding |
130 // the resulting rect by 4000px in each direction yields this result. | 128 // the resulting rect by 4000px in each direction yields this result. |
131 EXPECT_RECT_EQ(IntRect(200, 0, 8800, 600), recomputeInterestRect(paintLayer-
>graphicsLayerBacking())); | 129 EXPECT_RECT_EQ(IntRect(200, 0, 8800, 600), recomputeInterestRect(paintLayer-
>graphicsLayerBacking())); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller1")); | 651 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller1")); |
654 | 652 |
655 // Second scroller cannot paint background into scrolling contents layer bec
ause it has a content-box clip without local attachment. | 653 // Second scroller cannot paint background into scrolling contents layer bec
ause it has a content-box clip without local attachment. |
656 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller2")); | 654 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller2")); |
657 | 655 |
658 // Third scroller can paint background into scrolling contents layer. | 656 // Third scroller can paint background into scrolling contents layer. |
659 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller3")); | 657 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller3")); |
660 } | 658 } |
661 | 659 |
662 } // namespace blink | 660 } // namespace blink |
OLD | NEW |