Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp

Issue 1427843009: Fix crash about mask layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 "<div id='target' style='width: 10000px; height: 10000px; will-change: t ransform'></div></div>"); 201 "<div id='target' style='width: 10000px; height: 10000px; will-change: t ransform'></div></div>");
202 202
203 document().view()->updateAllLifecyclePhases(); 203 document().view()->updateAllLifecyclePhases();
204 Element* element = document().getElementById("target"); 204 Element* element = document().getElementById("target");
205 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la yer(); 205 PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->la yer();
206 ASSERT_TRUE(paintLayer->graphicsLayerBacking()); 206 ASSERT_TRUE(paintLayer->graphicsLayerBacking());
207 // Offscreen layers are painted as usual. 207 // Offscreen layers are painted as usual.
208 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 4001, 4001), computeInterestRect(p aintLayer->graphicsLayerBacking(), paintLayer->layoutObject()))); 208 EXPECT_TRUE(checkRectsEqual(IntRect(0, 0, 4001, 4001), computeInterestRect(p aintLayer->graphicsLayerBacking(), paintLayer->layoutObject())));
209 } 209 }
210 210
211 TEST_F(CompositedLayerMappingTest, ClippingMaskLayer)
212 {
213 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
214 return;
215
216 const AtomicString styleWithoutClipping = "backface-visibility: hidden; widt h: 200px; height: 200px";
217 const AtomicString styleWithBorderRadius = styleWithoutClipping + "; border- radius: 10px";
218 const AtomicString styleWithClipPath = styleWithoutClipping + "; -webkit-cli p-path: inset(10px)";
219
220 setBodyInnerHTML("<video id='video' src='x' style='" + styleWithoutClipping + "'></video>");
221
222 document().view()->updateAllLifecyclePhases();
223 Element* videoElement = document().getElementById("video");
224 GraphicsLayer* graphicsLayer = toLayoutBoxModelObject(videoElement->layoutOb ject())->layer()->graphicsLayerBacking();
225 EXPECT_FALSE(graphicsLayer->maskLayer());
226 EXPECT_FALSE(graphicsLayer->contentsClippingMaskLayer());
227
228 videoElement->setAttribute(HTMLNames::styleAttr, styleWithBorderRadius);
229 document().view()->updateAllLifecyclePhases();
230 EXPECT_FALSE(graphicsLayer->maskLayer());
231 EXPECT_TRUE(graphicsLayer->contentsClippingMaskLayer());
232
233 videoElement->setAttribute(HTMLNames::styleAttr, styleWithClipPath);
234 document().view()->updateAllLifecyclePhases();
235 EXPECT_TRUE(graphicsLayer->maskLayer());
236 EXPECT_FALSE(graphicsLayer->contentsClippingMaskLayer());
237
238 videoElement->setAttribute(HTMLNames::styleAttr, styleWithoutClipping);
239 document().view()->updateAllLifecyclePhases();
240 EXPECT_FALSE(graphicsLayer->maskLayer());
241 EXPECT_FALSE(graphicsLayer->contentsClippingMaskLayer());
242 }
243
211 TEST_F(CompositedLayerMappingTest, InterestRectChangedEnoughToRepaintEmpty) 244 TEST_F(CompositedLayerMappingTest, InterestRectChangedEnoughToRepaintEmpty)
212 { 245 {
213 IntSize layerSize(1000, 1000); 246 IntSize layerSize(1000, 1000);
214 // Both empty means there is nothing to do. 247 // Both empty means there is nothing to do.
215 EXPECT_FALSE(interestRectChangedEnoughToRepaint(IntRect(), IntRect(), layerS ize)); 248 EXPECT_FALSE(interestRectChangedEnoughToRepaint(IntRect(), IntRect(), layerS ize));
216 // Going from empty to non-empty means we must re-record because it could be the first frame after construction or Clear. 249 // Going from empty to non-empty means we must re-record because it could be the first frame after construction or Clear.
217 EXPECT_TRUE(interestRectChangedEnoughToRepaint(IntRect(), IntRect(0, 0, 1, 1 ), layerSize)); 250 EXPECT_TRUE(interestRectChangedEnoughToRepaint(IntRect(), IntRect(0, 0, 1, 1 ), layerSize));
218 // Going from non-empty to empty is not special-cased. 251 // Going from non-empty to empty is not special-cased.
219 EXPECT_FALSE(interestRectChangedEnoughToRepaint(IntRect(0, 0, 1, 1), IntRect (), layerSize)); 252 EXPECT_FALSE(interestRectChangedEnoughToRepaint(IntRect(0, 0, 1, 1), IntRect (), layerSize));
220 } 253 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 EXPECT_FALSE(interestRectChangedEnoughToRepaint(previousInterestRect, newInt erestRect, layerSize)); 300 EXPECT_FALSE(interestRectChangedEnoughToRepaint(previousInterestRect, newInt erestRect, layerSize));
268 newInterestRect.move(0, 512); 301 newInterestRect.move(0, 512);
269 EXPECT_FALSE(interestRectChangedEnoughToRepaint(previousInterestRect, newInt erestRect, layerSize)); 302 EXPECT_FALSE(interestRectChangedEnoughToRepaint(previousInterestRect, newInt erestRect, layerSize));
270 newInterestRect.move(1, 0); 303 newInterestRect.move(1, 0);
271 EXPECT_TRUE(interestRectChangedEnoughToRepaint(previousInterestRect, newInte restRect, layerSize)); 304 EXPECT_TRUE(interestRectChangedEnoughToRepaint(previousInterestRect, newInte restRect, layerSize));
272 newInterestRect.move(-1, 1); 305 newInterestRect.move(-1, 1);
273 EXPECT_TRUE(interestRectChangedEnoughToRepaint(previousInterestRect, newInte restRect, layerSize)); 306 EXPECT_TRUE(interestRectChangedEnoughToRepaint(previousInterestRect, newInte restRect, layerSize));
274 } 307 }
275 308
276 } // namespace blink 309 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698