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/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 document().view()->updateAllLifecyclePhases(); | 102 document().view()->updateAllLifecyclePhases(); |
103 Element* element = document().getElementById("target"); | 103 Element* element = document().getElementById("target"); |
104 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 104 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
105 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); | 105 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); |
106 ASSERT_TRUE(paintLayer->compositedLayerMapping()); | 106 ASSERT_TRUE(paintLayer->compositedLayerMapping()); |
107 // recomputeInterestRect computes the interest rect; computeInterestRect app
lies the extra setting to paint everything. | 107 // recomputeInterestRect computes the interest rect; computeInterestRect app
lies the extra setting to paint everything. |
108 EXPECT_RECT_EQ(IntRect(0, 0, 200, 4592), recomputeInterestRect(paintLayer->g
raphicsLayerBacking())); | 108 EXPECT_RECT_EQ(IntRect(0, 0, 200, 4592), recomputeInterestRect(paintLayer->g
raphicsLayerBacking())); |
109 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), computeInterestRect(paintLayer->co
mpositedLayerMapping(), paintLayer->graphicsLayerBacking(), IntRect())); | 109 EXPECT_RECT_EQ(IntRect(0, 0, 200, 10000), computeInterestRect(paintLayer->co
mpositedLayerMapping(), paintLayer->graphicsLayerBacking(), IntRect())); |
110 } | 110 } |
111 | 111 |
| 112 TEST_F(CompositedLayerMappingTest, VerticalRightLeftWritingModeDocument) |
| 113 { |
| 114 setBodyInnerHTML("<style>html,body { margin: 0px } html { -webkit-writing-mo
de: vertical-rl}</style> <div id='target' style='width: 10000px; height: 200px;'
></div>"); |
| 115 |
| 116 document().settings()->setMainFrameClipsContent(false); |
| 117 |
| 118 document().view()->updateAllLifecyclePhases(); |
| 119 document().view()->scrollTo(DoublePoint(-5000, 0)); |
| 120 document().view()->updateAllLifecyclePhases(); |
| 121 |
| 122 PaintLayer* paintLayer = document().layoutView()->layer(); |
| 123 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); |
| 124 ASSERT_TRUE(paintLayer->compositedLayerMapping()); |
| 125 // A scroll by -5000px is equivalent to a scroll by (10000 - 5000 - 800)px =
4200px in non-RTL mode. Expanding |
| 126 // the resulting rect by 4000px in each direction yields this result. |
| 127 EXPECT_RECT_EQ(IntRect(200, 0, 8800, 600), recomputeInterestRect(paintLayer-
>graphicsLayerBacking())); |
| 128 } |
112 | 129 |
113 TEST_F(CompositedLayerMappingTest, RotatedInterestRect) | 130 TEST_F(CompositedLayerMappingTest, RotatedInterestRect) |
114 { | 131 { |
115 setBodyInnerHTML( | 132 setBodyInnerHTML( |
116 "<div id='target' style='width: 200px; height: 200px; will-change: trans
form; transform: rotateZ(45deg)'></div>"); | 133 "<div id='target' style='width: 200px; height: 200px; will-change: trans
form; transform: rotateZ(45deg)'></div>"); |
117 | 134 |
118 document().view()->updateAllLifecyclePhases(); | 135 document().view()->updateAllLifecyclePhases(); |
119 Element* element = document().getElementById("target"); | 136 Element* element = document().getElementById("target"); |
120 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 137 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
121 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); | 138 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 // Scroll 3000 pixels down to bring the scrollable area to somewhere in the
middle. | 581 // Scroll 3000 pixels down to bring the scrollable area to somewhere in the
middle. |
565 frameDocument.view()->setScrollPosition(DoublePoint(0.0, 3000.0), Programmat
icScroll); | 582 frameDocument.view()->setScrollPosition(DoublePoint(0.0, 3000.0), Programmat
icScroll); |
566 document().view()->updateAllLifecyclePhases(); | 583 document().view()->updateAllLifecyclePhases(); |
567 | 584 |
568 ASSERT_TRUE(frameDocument.view()->layoutView()->hasLayer()); | 585 ASSERT_TRUE(frameDocument.view()->layoutView()->hasLayer()); |
569 // The width is 485 pixels due to the size of the scrollbar. | 586 // The width is 485 pixels due to the size of the scrollbar. |
570 EXPECT_RECT_EQ(IntRect(0, 0, 500, 7500), recomputeInterestRect(frameDocument
.view()->layoutView()->enclosingLayer()->graphicsLayerBacking())); | 587 EXPECT_RECT_EQ(IntRect(0, 0, 500, 7500), recomputeInterestRect(frameDocument
.view()->layoutView()->enclosingLayer()->graphicsLayerBacking())); |
571 } | 588 } |
572 | 589 |
573 } // namespace blink | 590 } // namespace blink |
OLD | NEW |