| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/layout/compositing/CompositedLayerMapping.h" | 6 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/layout/LayoutBoxModelObject.h" | 9 #include "core/layout/LayoutBoxModelObject.h" |
| 10 #include "core/layout/LayoutTestHelper.h" | 10 #include "core/layout/LayoutTestHelper.h" |
| 11 #include "core/layout/LayoutView.h" |
| 11 #include "core/paint/PaintLayer.h" | 12 #include "core/paint/PaintLayer.h" |
| 12 #include <gtest/gtest.h> | 13 #include <gtest/gtest.h> |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 class CompositedLayerMappingTest : public RenderingTest { | 17 class CompositedLayerMappingTest : public RenderingTest { |
| 17 public: | 18 public: |
| 18 CompositedLayerMappingTest() | 19 CompositedLayerMappingTest() |
| 19 : m_originalSlimmingPaintSynchronizedPaintingEnabled(RuntimeEnabledFeatu
res::slimmingPaintSynchronizedPaintingEnabled()) { } | 20 : m_originalSlimmingPaintSynchronizedPaintingEnabled(RuntimeEnabledFeatu
res::slimmingPaintSynchronizedPaintingEnabled()) { } |
| 20 | 21 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 | 42 |
| 42 void TearDown() override | 43 void TearDown() override |
| 43 { | 44 { |
| 44 GraphicsLayer::setDrawDebugRedFillForTesting(true); | 45 GraphicsLayer::setDrawDebugRedFillForTesting(true); |
| 45 RuntimeEnabledFeatures::setSlimmingPaintSynchronizedPaintingEnabled(m_or
iginalSlimmingPaintSynchronizedPaintingEnabled); | 46 RuntimeEnabledFeatures::setSlimmingPaintSynchronizedPaintingEnabled(m_or
iginalSlimmingPaintSynchronizedPaintingEnabled); |
| 46 } | 47 } |
| 47 | 48 |
| 48 bool m_originalSlimmingPaintSynchronizedPaintingEnabled; | 49 bool m_originalSlimmingPaintSynchronizedPaintingEnabled; |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 static void printRect(IntRect rect) | 52 #define EXPECT_RECT_EQ(expected, actual) \ |
| 52 { | 53 do { \ |
| 53 fprintf(stderr, "[x=%d y=%d maxX=%d maxY=%d]\n", rect.x(), rect.y(), rect.ma
xX(), rect.maxY()); | 54 EXPECT_EQ(expected.x(), actual.x()); \ |
| 54 } | 55 EXPECT_EQ(expected.y(), actual.y()); \ |
| 55 | 56 EXPECT_EQ(expected.width(), actual.width()); \ |
| 56 static bool checkRectsEqual(const IntRect& expected, const IntRect& actual) | 57 EXPECT_EQ(expected.height(), actual.height()); \ |
| 57 { | 58 } while (false) |
| 58 if (expected != actual) { | |
| 59 fprintf(stderr, "Expected: "); | |
| 60 printRect(expected); | |
| 61 fprintf(stderr, "Actual: "); | |
| 62 printRect(actual); | |
| 63 return false; | |
| 64 } | |
| 65 return true; | |
| 66 } | |
| 67 | 59 |
| 68 TEST_F(CompositedLayerMappingTest, SimpleInterestRect) | 60 TEST_F(CompositedLayerMappingTest, SimpleInterestRect) |
| 69 { | 61 { |
| 70 setBodyInnerHTML("<div id='target' style='width: 200px; height: 200px; will-
change: transform'></div>"); | 62 setBodyInnerHTML("<div id='target' style='width: 200px; height: 200px; will-
change: transform'></div>"); |
| 71 | 63 |
| 72 document().view()->updateAllLifecyclePhases(); | 64 document().view()->updateAllLifecyclePhases(); |
| 73 Element* element = document().getElementById("target"); | 65 Element* element = document().getElementById("target"); |
| 74 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 66 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 75 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); | 67 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); |
| 76 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 200, 200), computeInterestRect(pai
ntLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); | 68 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), computeInterestRect(paintLayer->grap
hicsLayerBacking(), paintLayer->layoutObject())); |
| 77 } | 69 } |
| 78 | 70 |
| 79 TEST_F(CompositedLayerMappingTest, TallLayerInterestRect) | 71 TEST_F(CompositedLayerMappingTest, TallLayerInterestRect) |
| 80 { | 72 { |
| 81 setBodyInnerHTML("<div id='target' style='width: 200px; height: 10000px; wil
l-change: transform'></div>"); | 73 setBodyInnerHTML("<div id='target' style='width: 200px; height: 10000px; wil
l-change: transform'></div>"); |
| 82 | 74 |
| 83 document().view()->updateAllLifecyclePhases(); | 75 document().view()->updateAllLifecyclePhases(); |
| 84 Element* element = document().getElementById("target"); | 76 Element* element = document().getElementById("target"); |
| 85 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 77 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 86 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); | 78 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); |
| 87 // Screen-space visible content rect is [8, 8, 200, 600]. Mapping back to lo
cal, adding 4000px in all directions, then | 79 // Screen-space visible content rect is [8, 8, 200, 600]. Mapping back to lo
cal, adding 4000px in all directions, then |
| 88 // clipping, yields this rect. | 80 // clipping, yields this rect. |
| 89 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 200, 4592), computeInterestRect(pa
intLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); | 81 EXPECT_RECT_EQ(IntRect(0, 0, 200, 4592), computeInterestRect(paintLayer->gra
phicsLayerBacking(), paintLayer->layoutObject())); |
| 90 } | 82 } |
| 91 | 83 |
| 92 TEST_F(CompositedLayerMappingTest, RotatedInterestRect) | 84 TEST_F(CompositedLayerMappingTest, RotatedInterestRect) |
| 93 { | 85 { |
| 94 setBodyInnerHTML( | 86 setBodyInnerHTML( |
| 95 "<div id='target' style='width: 200px; height: 200px; will-change: trans
form; transform: rotateZ(45deg)'></div>"); | 87 "<div id='target' style='width: 200px; height: 200px; will-change: trans
form; transform: rotateZ(45deg)'></div>"); |
| 96 | 88 |
| 97 document().view()->updateAllLifecyclePhases(); | 89 document().view()->updateAllLifecyclePhases(); |
| 98 Element* element = document().getElementById("target"); | 90 Element* element = document().getElementById("target"); |
| 99 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 91 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 100 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); | 92 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); |
| 101 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 200, 200), computeInterestRect(pai
ntLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); | 93 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), computeInterestRect(paintLayer->grap
hicsLayerBacking(), paintLayer->layoutObject())); |
| 102 } | 94 } |
| 103 | 95 |
| 104 TEST_F(CompositedLayerMappingTest, 3D90DegRotatedTallInterestRect) | 96 TEST_F(CompositedLayerMappingTest, 3D90DegRotatedTallInterestRect) |
| 105 { | 97 { |
| 106 // It's rotated 90 degrees about the X axis, which means its visual content
rect is empty, and so the interest rect is the | 98 // It's rotated 90 degrees about the X axis, which means its visual content
rect is empty, and so the interest rect is the |
| 107 // default (0, 0, 4000, 4000) intersected with the layer bounds. | 99 // default (0, 0, 4000, 4000) intersected with the layer bounds. |
| 108 setBodyInnerHTML( | 100 setBodyInnerHTML( |
| 109 "<div id='target' style='width: 200px; height: 10000px; will-change: tra
nsform; transform: rotateY(90deg)'></div>"); | 101 "<div id='target' style='width: 200px; height: 10000px; will-change: tra
nsform; transform: rotateY(90deg)'></div>"); |
| 110 | 102 |
| 111 document().view()->updateAllLifecyclePhases(); | 103 document().view()->updateAllLifecyclePhases(); |
| 112 Element* element = document().getElementById("target"); | 104 Element* element = document().getElementById("target"); |
| 113 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 105 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 114 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); | 106 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); |
| 115 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 200, 4000), computeInterestRect(pa
intLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); | 107 EXPECT_RECT_EQ(IntRect(0, 0, 200, 4000), computeInterestRect(paintLayer->gra
phicsLayerBacking(), paintLayer->layoutObject())); |
| 116 } | 108 } |
| 117 | 109 |
| 118 TEST_F(CompositedLayerMappingTest, 3D45DegRotatedTallInterestRect) | 110 TEST_F(CompositedLayerMappingTest, 3D45DegRotatedTallInterestRect) |
| 119 { | 111 { |
| 120 setBodyInnerHTML( | 112 setBodyInnerHTML( |
| 121 "<div id='target' style='width: 200px; height: 10000px; will-change: tra
nsform; transform: rotateY(45deg)'></div>"); | 113 "<div id='target' style='width: 200px; height: 10000px; will-change: tra
nsform; transform: rotateY(45deg)'></div>"); |
| 122 | 114 |
| 123 document().view()->updateAllLifecyclePhases(); | 115 document().view()->updateAllLifecyclePhases(); |
| 124 Element* element = document().getElementById("target"); | 116 Element* element = document().getElementById("target"); |
| 125 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 117 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 126 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); | 118 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); |
| 127 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 200, 4592), computeInterestRect(pa
intLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); | 119 EXPECT_RECT_EQ(IntRect(0, 0, 200, 4592), computeInterestRect(paintLayer->gra
phicsLayerBacking(), paintLayer->layoutObject())); |
| 128 } | 120 } |
| 129 | 121 |
| 130 TEST_F(CompositedLayerMappingTest, RotatedTallInterestRect) | 122 TEST_F(CompositedLayerMappingTest, RotatedTallInterestRect) |
| 131 { | 123 { |
| 132 setBodyInnerHTML( | 124 setBodyInnerHTML( |
| 133 "<div id='target' style='width: 200px; height: 10000px; will-change: tra
nsform; transform: rotateZ(45deg)'></div>"); | 125 "<div id='target' style='width: 200px; height: 10000px; will-change: tra
nsform; transform: rotateZ(45deg)'></div>"); |
| 134 | 126 |
| 135 document().view()->updateAllLifecyclePhases(); | 127 document().view()->updateAllLifecyclePhases(); |
| 136 Element* element = document().getElementById("target"); | 128 Element* element = document().getElementById("target"); |
| 137 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 129 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 138 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); | 130 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); |
| 139 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 200, 4000), computeInterestRect(pa
intLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); | 131 EXPECT_RECT_EQ(IntRect(0, 0, 200, 4000), computeInterestRect(paintLayer->gra
phicsLayerBacking(), paintLayer->layoutObject())); |
| 140 } | 132 } |
| 141 | 133 |
| 142 TEST_F(CompositedLayerMappingTest, WideLayerInterestRect) | 134 TEST_F(CompositedLayerMappingTest, WideLayerInterestRect) |
| 143 { | 135 { |
| 144 setBodyInnerHTML("<div id='target' style='width: 10000px; height: 200px; wil
l-change: transform'></div>"); | 136 setBodyInnerHTML("<div id='target' style='width: 10000px; height: 200px; wil
l-change: transform'></div>"); |
| 145 | 137 |
| 146 document().view()->updateAllLifecyclePhases(); | 138 document().view()->updateAllLifecyclePhases(); |
| 147 Element* element = document().getElementById("target"); | 139 Element* element = document().getElementById("target"); |
| 148 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 140 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 149 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); | 141 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); |
| 150 // Screen-space visible content rect is [8, 8, 800, 200] (the screen is 800x
600). | 142 // Screen-space visible content rect is [8, 8, 800, 200] (the screen is 800x
600). |
| 151 // Mapping back to local, adding 4000px in all directions, then clipping, yi
elds this rect. | 143 // Mapping back to local, adding 4000px in all directions, then clipping, yi
elds this rect. |
| 152 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 4792, 200), computeInterestRect(pa
intLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); | 144 EXPECT_RECT_EQ(IntRect(0, 0, 4792, 200), computeInterestRect(paintLayer->gra
phicsLayerBacking(), paintLayer->layoutObject())); |
| 153 } | 145 } |
| 154 | 146 |
| 155 TEST_F(CompositedLayerMappingTest, FixedPositionInterestRect) | 147 TEST_F(CompositedLayerMappingTest, FixedPositionInterestRect) |
| 156 { | 148 { |
| 157 setBodyInnerHTML( | 149 setBodyInnerHTML( |
| 158 "<div id='target' style='width: 300px; height: 400px; will-change: trans
form; position: fixed; top: 100px; left: 200px;'></div>"); | 150 "<div id='target' style='width: 300px; height: 400px; will-change: trans
form; position: fixed; top: 100px; left: 200px;'></div>"); |
| 159 | 151 |
| 160 document().view()->updateAllLifecyclePhases(); | 152 document().view()->updateAllLifecyclePhases(); |
| 161 Element* element = document().getElementById("target"); | 153 Element* element = document().getElementById("target"); |
| 162 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 154 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 163 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); | 155 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); |
| 164 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 300, 400), computeInterestRect(pai
ntLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); | 156 EXPECT_RECT_EQ(IntRect(0, 0, 300, 400), computeInterestRect(paintLayer->grap
hicsLayerBacking(), paintLayer->layoutObject())); |
| 165 } | 157 } |
| 166 | 158 |
| 167 TEST_F(CompositedLayerMappingTest, LayerOffscreenInterestRect) | 159 TEST_F(CompositedLayerMappingTest, LayerOffscreenInterestRect) |
| 168 { | 160 { |
| 169 setBodyInnerHTML( | 161 setBodyInnerHTML( |
| 170 "<div id='target' style='width: 200px; height: 200px; will-change: trans
form; position: absolute; top: 9000px; left: 0px;'>" | 162 "<div id='target' style='width: 200px; height: 200px; will-change: trans
form; position: absolute; top: 9000px; left: 0px;'>" |
| 171 "</div>"); | 163 "</div>"); |
| 172 | 164 |
| 173 document().view()->updateAllLifecyclePhases(); | 165 document().view()->updateAllLifecyclePhases(); |
| 174 Element* element = document().getElementById("target"); | 166 Element* element = document().getElementById("target"); |
| 175 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 167 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 176 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); | 168 ASSERT_TRUE(!!paintLayer->graphicsLayerBacking()); |
| 177 // Offscreen layers are painted as usual. | 169 // Offscreen layers are painted as usual. |
| 178 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 200, 200), computeInterestRect(pai
ntLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); | 170 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), computeInterestRect(paintLayer->grap
hicsLayerBacking(), paintLayer->layoutObject())); |
| 179 } | 171 } |
| 180 | 172 |
| 181 TEST_F(CompositedLayerMappingTest, ScrollingLayerInterestRect) | 173 TEST_F(CompositedLayerMappingTest, ScrollingLayerInterestRect) |
| 182 { | 174 { |
| 183 setBodyInnerHTML( | 175 setBodyInnerHTML( |
| 184 "<style>div::-webkit-scrollbar{ width: 5px; }</style>" | 176 "<style>div::-webkit-scrollbar{ width: 5px; }</style>" |
| 185 "<div id='target' style='width: 200px; height: 200px; will-change: trans
form; overflow: scroll'>" | 177 "<div id='target' style='width: 200px; height: 200px; will-change: trans
form; overflow: scroll'>" |
| 186 "<div style='width: 100px; height: 10000px'></div></div>"); | 178 "<div style='width: 100px; height: 10000px'></div></div>"); |
| 187 | 179 |
| 188 document().view()->updateAllLifecyclePhases(); | 180 document().view()->updateAllLifecyclePhases(); |
| 189 Element* element = document().getElementById("target"); | 181 Element* element = document().getElementById("target"); |
| 190 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 182 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 191 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); | 183 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); |
| 192 // Offscreen layers are painted as usual. | 184 // Offscreen layers are painted as usual. |
| 193 ASSERT_TRUE(paintLayer->compositedLayerMapping()->scrollingLayer()); | 185 ASSERT_TRUE(paintLayer->compositedLayerMapping()->scrollingLayer()); |
| 194 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 195, 4592), computeInterestRect(pa
intLayer->graphicsLayerBackingForScrolling(), paintLayer->layoutObject()))); | 186 EXPECT_RECT_EQ(IntRect(0, 0, 195, 4592), computeInterestRect(paintLayer->gra
phicsLayerBackingForScrolling(), paintLayer->layoutObject())); |
| 195 } | 187 } |
| 196 | 188 |
| 197 TEST_F(CompositedLayerMappingTest, ClippedBigLayer) | 189 TEST_F(CompositedLayerMappingTest, ClippedBigLayer) |
| 198 { | 190 { |
| 199 setBodyInnerHTML( | 191 setBodyInnerHTML( |
| 200 "<div style='width: 1px; height: 1px; overflow: hidden'>" | 192 "<div style='width: 1px; height: 1px; overflow: hidden'>" |
| 201 "<div id='target' style='width: 10000px; height: 10000px; will-change: t
ransform'></div></div>"); | 193 "<div id='target' style='width: 10000px; height: 10000px; will-change: t
ransform'></div></div>"); |
| 202 | 194 |
| 203 document().view()->updateAllLifecyclePhases(); | 195 document().view()->updateAllLifecyclePhases(); |
| 204 Element* element = document().getElementById("target"); | 196 Element* element = document().getElementById("target"); |
| 205 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); | 197 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la
yer(); |
| 206 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); | 198 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); |
| 207 // Offscreen layers are painted as usual. | 199 // Offscreen layers are painted as usual. |
| 208 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 4001, 4001), computeInterestRect(p
aintLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); | 200 EXPECT_RECT_EQ(IntRect(0, 0, 4001, 4001), computeInterestRect(paintLayer->gr
aphicsLayerBacking(), paintLayer->layoutObject())); |
| 209 } | 201 } |
| 210 | 202 |
| 211 TEST_F(CompositedLayerMappingTest, ClippingMaskLayer) | 203 TEST_F(CompositedLayerMappingTest, ClippingMaskLayer) |
| 212 { | 204 { |
| 213 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 205 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 214 return; | 206 return; |
| 215 | 207 |
| 216 const AtomicString styleWithoutClipping = "backface-visibility: hidden; widt
h: 200px; height: 200px"; | 208 const AtomicString styleWithoutClipping = "backface-visibility: hidden; widt
h: 200px; height: 200px"; |
| 217 const AtomicString styleWithBorderRadius = styleWithoutClipping + "; border-
radius: 10px"; | 209 const AtomicString styleWithBorderRadius = styleWithoutClipping + "; border-
radius: 10px"; |
| 218 const AtomicString styleWithClipPath = styleWithoutClipping + "; -webkit-cli
p-path: inset(10px)"; | 210 const AtomicString styleWithClipPath = styleWithoutClipping + "; -webkit-cli
p-path: inset(10px)"; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 newInterestRect.move(512, 0); | 291 newInterestRect.move(512, 0); |
| 300 EXPECT_FALSE(interestRectChangedEnoughToRepaint(previousInterestRect, newInt
erestRect, layerSize)); | 292 EXPECT_FALSE(interestRectChangedEnoughToRepaint(previousInterestRect, newInt
erestRect, layerSize)); |
| 301 newInterestRect.move(0, 512); | 293 newInterestRect.move(0, 512); |
| 302 EXPECT_FALSE(interestRectChangedEnoughToRepaint(previousInterestRect, newInt
erestRect, layerSize)); | 294 EXPECT_FALSE(interestRectChangedEnoughToRepaint(previousInterestRect, newInt
erestRect, layerSize)); |
| 303 newInterestRect.move(1, 0); | 295 newInterestRect.move(1, 0); |
| 304 EXPECT_TRUE(interestRectChangedEnoughToRepaint(previousInterestRect, newInte
restRect, layerSize)); | 296 EXPECT_TRUE(interestRectChangedEnoughToRepaint(previousInterestRect, newInte
restRect, layerSize)); |
| 305 newInterestRect.move(-1, 1); | 297 newInterestRect.move(-1, 1); |
| 306 EXPECT_TRUE(interestRectChangedEnoughToRepaint(previousInterestRect, newInte
restRect, layerSize)); | 298 EXPECT_TRUE(interestRectChangedEnoughToRepaint(previousInterestRect, newInte
restRect, layerSize)); |
| 307 } | 299 } |
| 308 | 300 |
| 301 TEST_F(CompositedLayerMappingTest, PreviousPaintInterestRectChange) |
| 302 { |
| 303 setBodyInnerHTML( |
| 304 "<style>" |
| 305 " ::-webkit-scrollbar { width: 0; height: 0; }" |
| 306 " body { margin: 0; }" |
| 307 "</style>" |
| 308 "<div id='div' style='width: 100px; height: 10000px'>Text</div>"); |
| 309 |
| 310 document().view()->updateAllLifecyclePhases(); |
| 311 GraphicsLayer* rootScrollingLayer = document().view()->layoutView()->layer()
->graphicsLayerBackingForScrolling(); |
| 312 EXPECT_RECT_EQ(IntRect(0, 0, 800, 4600), rootScrollingLayer->previousInteres
tRect()); |
| 313 |
| 314 const int scrollStep = 200; |
| 315 for (int i = 0; i < 10000 / scrollStep; ++i) { |
| 316 document().view()->scrollBy(IntSize(0, scrollStep), UserScroll); |
| 317 document().view()->updateAllLifecyclePhases(); |
| 318 } |
| 319 |
| 320 EXPECT_RECT_EQ(IntRect(0, 1400, 800, 8600), rootScrollingLayer->previousInte
restRect()); |
| 321 |
| 322 for (int i = 0; i < 10000 / scrollStep; ++i) { |
| 323 document().view()->scrollBy(IntSize(-scrollStep, -scrollStep), UserScrol
l); |
| 324 document().view()->updateAllLifecyclePhases(); |
| 325 } |
| 326 |
| 327 EXPECT_RECT_EQ(IntRect(0, 0, 800, 8600), rootScrollingLayer->previousInteres
tRect()); |
| 328 |
| 329 // Partial invalidation and repaint should not change previous paint interes
t rect. |
| 330 document().getElementById("div")->setTextContent("Change"); |
| 331 document().view()->updateAllLifecyclePhases(); |
| 332 EXPECT_RECT_EQ(IntRect(0, 0, 800, 8600), rootScrollingLayer->previousInteres
tRect()); |
| 333 } |
| 334 |
| 309 } // namespace blink | 335 } // namespace blink |
| OLD | NEW |