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

Side by Side Diff: cc/occlusion_tracker_unittest.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some missed intstuff Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 6
7 #include "cc/occlusion_tracker.h" 7 #include "cc/occlusion_tracker.h"
8 8
9 #include "Region.h" 9 #include "Region.h"
10 #include "cc/layer.h" 10 #include "cc/layer.h"
(...skipping 23 matching lines...) Expand all
34 TestContentLayer() 34 TestContentLayer()
35 : Layer() 35 : Layer()
36 , m_overrideOpaqueContentsRect(false) 36 , m_overrideOpaqueContentsRect(false)
37 { 37 {
38 } 38 }
39 39
40 virtual bool drawsContent() const OVERRIDE { return true; } 40 virtual bool drawsContent() const OVERRIDE { return true; }
41 virtual Region visibleContentOpaqueRegion() const OVERRIDE 41 virtual Region visibleContentOpaqueRegion() const OVERRIDE
42 { 42 {
43 if (m_overrideOpaqueContentsRect) 43 if (m_overrideOpaqueContentsRect)
44 return intersection(m_opaqueContentsRect, visibleContentRect()); 44 return cc::IntRect(gfx::IntersectRects(m_opaqueContentsRect, visible ContentRect()));
45 return Layer::visibleContentOpaqueRegion(); 45 return Layer::visibleContentOpaqueRegion();
46 } 46 }
47 void setOpaqueContentsRect(const IntRect& opaqueContentsRect) 47 void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect)
48 { 48 {
49 m_overrideOpaqueContentsRect = true; 49 m_overrideOpaqueContentsRect = true;
50 m_opaqueContentsRect = opaqueContentsRect; 50 m_opaqueContentsRect = opaqueContentsRect;
51 } 51 }
52 52
53 private: 53 private:
54 virtual ~TestContentLayer() 54 virtual ~TestContentLayer()
55 { 55 {
56 } 56 }
57 57
58 bool m_overrideOpaqueContentsRect; 58 bool m_overrideOpaqueContentsRect;
59 IntRect m_opaqueContentsRect; 59 gfx::Rect m_opaqueContentsRect;
60 }; 60 };
61 61
62 class TestContentLayerImpl : public LayerImpl { 62 class TestContentLayerImpl : public LayerImpl {
63 public: 63 public:
64 TestContentLayerImpl(int id) 64 TestContentLayerImpl(int id)
65 : LayerImpl(id) 65 : LayerImpl(id)
66 , m_overrideOpaqueContentsRect(false) 66 , m_overrideOpaqueContentsRect(false)
67 { 67 {
68 setDrawsContent(true); 68 setDrawsContent(true);
69 } 69 }
70 70
71 virtual Region visibleContentOpaqueRegion() const OVERRIDE 71 virtual Region visibleContentOpaqueRegion() const OVERRIDE
72 { 72 {
73 if (m_overrideOpaqueContentsRect) 73 if (m_overrideOpaqueContentsRect)
74 return intersection(m_opaqueContentsRect, visibleContentRect()); 74 return cc::IntRect(gfx::IntersectRects(m_opaqueContentsRect, visible ContentRect()));
75 return LayerImpl::visibleContentOpaqueRegion(); 75 return LayerImpl::visibleContentOpaqueRegion();
76 } 76 }
77 void setOpaqueContentsRect(const IntRect& opaqueContentsRect) 77 void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect)
78 { 78 {
79 m_overrideOpaqueContentsRect = true; 79 m_overrideOpaqueContentsRect = true;
80 m_opaqueContentsRect = opaqueContentsRect; 80 m_opaqueContentsRect = opaqueContentsRect;
81 } 81 }
82 82
83 private: 83 private:
84 bool m_overrideOpaqueContentsRect; 84 bool m_overrideOpaqueContentsRect;
85 IntRect m_opaqueContentsRect; 85 gfx::Rect m_opaqueContentsRect;
86 }; 86 };
87 87
88 template<typename LayerType, typename RenderSurfaceType> 88 template<typename LayerType, typename RenderSurfaceType>
89 class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType, RenderSurfaceType> { 89 class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType, RenderSurfaceType> {
90 public: 90 public:
91 TestOcclusionTrackerWithClip(gfx::Rect viewportRect, bool recordMetricsForFr ame = false) 91 TestOcclusionTrackerWithClip(gfx::Rect viewportRect, bool recordMetricsForFr ame = false)
92 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, r ecordMetricsForFrame) 92 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, r ecordMetricsForFrame)
93 , m_overrideLayerClipRect(false) 93 , m_overrideLayerClipRect(false)
94 { 94 {
95 } 95 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 virtual void TearDown() 179 virtual void TearDown()
180 { 180 {
181 Types::destroyLayer(m_root); 181 Types::destroyLayer(m_root);
182 m_renderSurfaceLayerList.clear(); 182 m_renderSurfaceLayerList.clear();
183 m_renderSurfaceLayerListImpl.clear(); 183 m_renderSurfaceLayerListImpl.clear();
184 m_replicaLayers.clear(); 184 m_replicaLayers.clear();
185 m_maskLayers.clear(); 185 m_maskLayers.clear();
186 LayerTreeHost::setNeedsFilterContext(false); 186 LayerTreeHost::setNeedsFilterContext(false);
187 } 187 }
188 188
189 typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) 189 typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
190 { 190 {
191 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); 191 typename Types::ContentLayerPtrType layer(Types::createContentLayer());
192 typename Types::ContentLayerType* layerPtr = layer.get(); 192 typename Types::ContentLayerType* layerPtr = layer.get();
193 setProperties(layerPtr, transform, position, bounds); 193 setProperties(layerPtr, transform, position, bounds);
194 194
195 DCHECK(!m_root); 195 DCHECK(!m_root);
196 m_root = Types::passLayerPtr(layer); 196 m_root = Types::passLayerPtr(layer);
197 return layerPtr; 197 return layerPtr;
198 } 198 }
199 199
200 typename Types::LayerType* createLayer(typename Types::LayerType* parent, co nst WebTransformationMatrix& transform, const FloatPoint& position, const IntSiz e& bounds) 200 typename Types::LayerType* createLayer(typename Types::LayerType* parent, co nst WebTransformationMatrix& transform, const FloatPoint& position, const gfx::S ize& bounds)
201 { 201 {
202 typename Types::LayerPtrType layer(Types::createLayer()); 202 typename Types::LayerPtrType layer(Types::createLayer());
203 typename Types::LayerType* layerPtr = layer.get(); 203 typename Types::LayerType* layerPtr = layer.get();
204 setProperties(layerPtr, transform, position, bounds); 204 setProperties(layerPtr, transform, position, bounds);
205 parent->addChild(Types::passLayerPtr(layer)); 205 parent->addChild(Types::passLayerPtr(layer));
206 return layerPtr; 206 return layerPtr;
207 } 207 }
208 208
209 typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntS ize& bounds) 209 typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx: :Size& bounds)
210 { 210 {
211 typename Types::LayerType* layer = createLayer(parent, transform, positi on, bounds); 211 typename Types::LayerType* layer = createLayer(parent, transform, positi on, bounds);
212 WebFilterOperations filters; 212 WebFilterOperations filters;
213 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); 213 filters.append(WebFilterOperation::createGrayscaleFilter(0.5));
214 layer->setFilters(filters); 214 layer->setFilters(filters);
215 return layer; 215 return layer;
216 } 216 }
217 217
218 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy pe* parent, const WebTransformationMatrix& transform, const FloatPoint& position , const IntSize& bounds, bool opaque) 218 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy pe* parent, const WebTransformationMatrix& transform, const FloatPoint& position , const gfx::Size& bounds, bool opaque)
219 { 219 {
220 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); 220 typename Types::ContentLayerPtrType layer(Types::createContentLayer());
221 typename Types::ContentLayerType* layerPtr = layer.get(); 221 typename Types::ContentLayerType* layerPtr = layer.get();
222 setProperties(layerPtr, transform, position, bounds); 222 setProperties(layerPtr, transform, position, bounds);
223 223
224 if (m_opaqueLayers) 224 if (m_opaqueLayers)
225 layerPtr->setContentsOpaque(opaque); 225 layerPtr->setContentsOpaque(opaque);
226 else { 226 else {
227 layerPtr->setContentsOpaque(false); 227 layerPtr->setContentsOpaque(false);
228 if (opaque) 228 if (opaque)
229 layerPtr->setOpaqueContentsRect(IntRect(IntPoint(), bounds)); 229 layerPtr->setOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds)) ;
230 else 230 else
231 layerPtr->setOpaqueContentsRect(IntRect()); 231 layerPtr->setOpaqueContentsRect(gfx::Rect());
232 } 232 }
233 233
234 parent->addChild(Types::passLayerPtr(layer)); 234 parent->addChild(Types::passLayerPtr(layer));
235 return layerPtr; 235 return layerPtr;
236 } 236 }
237 237
238 typename Types::LayerType* createReplicaLayer(typename Types::LayerType* own ingLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) 238 typename Types::LayerType* createReplicaLayer(typename Types::LayerType* own ingLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
239 { 239 {
240 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); 240 typename Types::ContentLayerPtrType layer(Types::createContentLayer());
241 typename Types::ContentLayerType* layerPtr = layer.get(); 241 typename Types::ContentLayerType* layerPtr = layer.get();
242 setProperties(layerPtr, transform, position, bounds); 242 setProperties(layerPtr, transform, position, bounds);
243 setReplica(owningLayer, Types::passLayerPtr(layer)); 243 setReplica(owningLayer, Types::passLayerPtr(layer));
244 return layerPtr; 244 return layerPtr;
245 } 245 }
246 246
247 typename Types::LayerType* createMaskLayer(typename Types::LayerType* owning Layer, const IntSize& bounds) 247 typename Types::LayerType* createMaskLayer(typename Types::LayerType* owning Layer, const gfx::Size& bounds)
248 { 248 {
249 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); 249 typename Types::ContentLayerPtrType layer(Types::createContentLayer());
250 typename Types::ContentLayerType* layerPtr = layer.get(); 250 typename Types::ContentLayerType* layerPtr = layer.get();
251 setProperties(layerPtr, identityMatrix, FloatPoint(), bounds); 251 setProperties(layerPtr, identityMatrix, FloatPoint(), bounds);
252 setMask(owningLayer, Types::passLayerPtr(layer)); 252 setMask(owningLayer, Types::passLayerPtr(layer));
253 return layerPtr; 253 return layerPtr;
254 } 254 }
255 255
256 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer Type* parent, const WebTransformationMatrix& transform, const FloatPoint& positi on, const IntSize& bounds, bool opaque) 256 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer Type* parent, const WebTransformationMatrix& transform, const FloatPoint& positi on, const gfx::Size& bounds, bool opaque)
257 { 257 {
258 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra nsform, position, bounds, opaque); 258 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra nsform, position, bounds, opaque);
259 WebFilterOperations filters; 259 WebFilterOperations filters;
260 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); 260 filters.append(WebFilterOperation::createGrayscaleFilter(0.5));
261 layer->setFilters(filters); 261 layer->setFilters(filters);
262 return layer; 262 return layer;
263 } 263 }
264 264
265 void calcDrawEtc(TestContentLayerImpl* root) 265 void calcDrawEtc(TestContentLayerImpl* root)
266 { 266 {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 334 }
335 335
336 void resetLayerIterator() 336 void resetLayerIterator()
337 { 337 {
338 m_layerIterator = m_layerIteratorBegin; 338 m_layerIterator = m_layerIteratorBegin;
339 } 339 }
340 340
341 const WebTransformationMatrix identityMatrix; 341 const WebTransformationMatrix identityMatrix;
342 342
343 private: 343 private:
344 void setBaseProperties(typename Types::LayerType* layer, const WebTransforma tionMatrix& transform, const FloatPoint& position, const IntSize& bounds) 344 void setBaseProperties(typename Types::LayerType* layer, const WebTransforma tionMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
345 { 345 {
346 layer->setTransform(transform); 346 layer->setTransform(transform);
347 layer->setSublayerTransform(WebTransformationMatrix()); 347 layer->setSublayerTransform(WebTransformationMatrix());
348 layer->setAnchorPoint(FloatPoint(0, 0)); 348 layer->setAnchorPoint(FloatPoint(0, 0));
349 layer->setPosition(position); 349 layer->setPosition(position);
350 layer->setBounds(bounds); 350 layer->setBounds(bounds);
351 } 351 }
352 352
353 void setProperties(Layer* layer, const WebTransformationMatrix& transform, c onst FloatPoint& position, const IntSize& bounds) 353 void setProperties(Layer* layer, const WebTransformationMatrix& transform, c onst FloatPoint& position, const gfx::Size& bounds)
354 { 354 {
355 setBaseProperties(layer, transform, position, bounds); 355 setBaseProperties(layer, transform, position, bounds);
356 } 356 }
357 357
358 void setProperties(LayerImpl* layer, const WebTransformationMatrix& transfor m, const FloatPoint& position, const IntSize& bounds) 358 void setProperties(LayerImpl* layer, const WebTransformationMatrix& transfor m, const FloatPoint& position, const gfx::Size& bounds)
359 { 359 {
360 setBaseProperties(layer, transform, position, bounds); 360 setBaseProperties(layer, transform, position, bounds);
361 361
362 layer->setContentBounds(layer->bounds()); 362 layer->setContentBounds(layer->bounds());
363 } 363 }
364 364
365 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer) 365 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer)
366 { 366 {
367 owningLayer->setReplicaLayer(layer.get()); 367 owningLayer->setReplicaLayer(layer.get());
368 m_replicaLayers.push_back(layer); 368 m_replicaLayers.push_back(layer);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ 440 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \
441 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) 441 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName)
442 442
443 template<class Types> 443 template<class Types>
444 class OcclusionTrackerTestIdentityTransforms : public OcclusionTrackerTest<Types > { 444 class OcclusionTrackerTestIdentityTransforms : public OcclusionTrackerTest<Types > {
445 protected: 445 protected:
446 OcclusionTrackerTestIdentityTransforms(bool opaqueLayers) : OcclusionTracker Test<Types>(opaqueLayers) {} 446 OcclusionTrackerTestIdentityTransforms(bool opaqueLayers) : OcclusionTracker Test<Types>(opaqueLayers) {}
447 447
448 void runMyTest() 448 void runMyTest()
449 { 449 {
450 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 450 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
451 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true); 451 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(30, 30), gfx::Size(500, 500), true);
452 this->calcDrawEtc(parent); 452 this->calcDrawEtc(parent);
453 453
454 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 454 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
455 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 455 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
456 456
457 this->visitLayer(layer, occlusion); 457 this->visitLayer(layer, occlusion);
458 this->enterLayer(parent, occlusion); 458 this->enterLayer(parent, occlusion);
459 459
460 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa ce().bounds()); 460 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa ce().bounds());
461 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 461 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { 494 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> {
495 protected: 495 protected:
496 OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<T ypes>(opaqueLayers) {} 496 OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<T ypes>(opaqueLayers) {}
497 void runMyTest() 497 void runMyTest()
498 { 498 {
499 WebTransformationMatrix layerTransform; 499 WebTransformationMatrix layerTransform;
500 layerTransform.translate(250, 250); 500 layerTransform.translate(250, 250);
501 layerTransform.rotate(90); 501 layerTransform.rotate(90);
502 layerTransform.translate(-250, -250); 502 layerTransform.translate(-250, -250);
503 503
504 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 504 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
505 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); 505 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
506 this->calcDrawEtc(parent); 506 this->calcDrawEtc(parent);
507 507
508 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 508 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
509 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 509 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
510 510
511 this->visitLayer(layer, occlusion); 511 this->visitLayer(layer, occlusion);
512 this->enterLayer(parent, occlusion); 512 this->enterLayer(parent, occlusion);
513 513
514 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa ce().bounds()); 514 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa ce().bounds());
515 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 515 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 30 matching lines...) Expand all
546 546
547 template<class Types> 547 template<class Types>
548 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { 548 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> {
549 protected: 549 protected:
550 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {} 550 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {}
551 void runMyTest() 551 void runMyTest()
552 { 552 {
553 WebTransformationMatrix layerTransform; 553 WebTransformationMatrix layerTransform;
554 layerTransform.translate(20, 20); 554 layerTransform.translate(20, 20);
555 555
556 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 556 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
557 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); 557 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
558 this->calcDrawEtc(parent); 558 this->calcDrawEtc(parent);
559 559
560 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 560 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
561 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 561 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
562 562
563 this->visitLayer(layer, occlusion); 563 this->visitLayer(layer, occlusion);
564 this->enterLayer(parent, occlusion); 564 this->enterLayer(parent, occlusion);
565 565
566 EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInScreenSpa ce().bounds()); 566 EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInScreenSpa ce().bounds());
567 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 567 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type s> { 612 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type s> {
613 protected: 613 protected:
614 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {} 614 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {}
615 void runMyTest() 615 void runMyTest()
616 { 616 {
617 WebTransformationMatrix childTransform; 617 WebTransformationMatrix childTransform;
618 childTransform.translate(250, 250); 618 childTransform.translate(250, 250);
619 childTransform.rotate(90); 619 childTransform.rotate(90);
620 childTransform.translate(-250, -250); 620 childTransform.translate(-250, -250);
621 621
622 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 622 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
623 parent->setMasksToBounds(true); 623 parent->setMasksToBounds(true);
624 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), IntSize(500, 500)); 624 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), gfx::Size(500, 500));
625 child->setMasksToBounds(true); 625 child->setMasksToBounds(true);
626 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); 626 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
627 this->calcDrawEtc(parent); 627 this->calcDrawEtc(parent);
628 628
629 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 629 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
630 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 630 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
631 631
632 this->visitLayer(layer, occlusion); 632 this->visitLayer(layer, occlusion);
633 this->enterContributingSurface(child, occlusion); 633 this->enterContributingSurface(child, occlusion);
634 634
635 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa ce().bounds()); 635 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa ce().bounds());
636 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 636 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest<Type s> { 693 class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest<Type s> {
694 protected: 694 protected:
695 OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {} 695 OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {}
696 void runMyTest() 696 void runMyTest()
697 { 697 {
698 WebTransformationMatrix childTransform; 698 WebTransformationMatrix childTransform;
699 childTransform.translate(250, 250); 699 childTransform.translate(250, 250);
700 childTransform.rotate(90); 700 childTransform.rotate(90);
701 childTransform.translate(-250, -250); 701 childTransform.translate(-250, -250);
702 702
703 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 703 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
704 parent->setMasksToBounds(true); 704 parent->setMasksToBounds(true);
705 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), IntSize(500, 500)); 705 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), gfx::Size(500, 500));
706 child->setMasksToBounds(true); 706 child->setMasksToBounds(true);
707 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); 707 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
708 // |child2| makes |parent|'s surface get considered by OcclusionTracker first, instead of |child|'s. This exercises different code in 708 // |child2| makes |parent|'s surface get considered by OcclusionTracker first, instead of |child|'s. This exercises different code in
709 // leaveToTargetRenderSurface, as the target surface has already been se en. 709 // leaveToTargetRenderSurface, as the target surface has already been se en.
710 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true); 710 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, this->identityMatrix, FloatPoint(30, 30), gfx::Size(60, 20), true);
711 this->calcDrawEtc(parent); 711 this->calcDrawEtc(parent);
712 712
713 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 713 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
714 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000)); 714 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000));
715 715
716 this->visitLayer(child2, occlusion); 716 this->visitLayer(child2, occlusion);
717 717
718 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInScreenSpa ce().bounds()); 718 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInScreenSpa ce().bounds());
719 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 719 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
720 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInTargetSur face().bounds()); 720 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInTargetSur face().bounds());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 void runMyTest() 809 void runMyTest()
810 { 810 {
811 WebTransformationMatrix childTransform; 811 WebTransformationMatrix childTransform;
812 childTransform.translate(250, 250); 812 childTransform.translate(250, 250);
813 childTransform.rotate(95); 813 childTransform.rotate(95);
814 childTransform.translate(-250, -250); 814 childTransform.translate(-250, -250);
815 815
816 WebTransformationMatrix layerTransform; 816 WebTransformationMatrix layerTransform;
817 layerTransform.translate(10, 10); 817 layerTransform.translate(10, 10);
818 818
819 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 819 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
820 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), IntSize(500, 500)); 820 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), gfx::Size(500, 500));
821 child->setMasksToBounds(true); 821 child->setMasksToBounds(true);
822 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , layerTransform, FloatPoint(0, 0), IntSize(500, 500), true); 822 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , layerTransform, FloatPoint(0, 0), gfx::Size(500, 500), true);
823 this->calcDrawEtc(parent); 823 this->calcDrawEtc(parent);
824 824
825 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 825 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
826 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 826 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
827 827
828 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect()); 828 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect());
829 829
830 this->visitLayer(layer, occlusion); 830 this->visitLayer(layer, occlusion);
831 this->enterContributingSurface(child, occlusion); 831 this->enterContributingSurface(child, occlusion);
832 832
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker Test<Types> { 873 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker Test<Types> {
874 protected: 874 protected:
875 OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {} 875 OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {}
876 void runMyTest() 876 void runMyTest()
877 { 877 {
878 WebTransformationMatrix childTransform; 878 WebTransformationMatrix childTransform;
879 childTransform.translate(250, 250); 879 childTransform.translate(250, 250);
880 childTransform.rotate(90); 880 childTransform.rotate(90);
881 childTransform.translate(-250, -250); 881 childTransform.translate(-250, -250);
882 882
883 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 883 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
884 parent->setMasksToBounds(true); 884 parent->setMasksToBounds(true);
885 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), IntSize(500, 500)); 885 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), gfx::Size(500, 500));
886 child->setMasksToBounds(true); 886 child->setMasksToBounds(true);
887 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); 887 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
888 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true); 888 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d, this->identityMatrix, FloatPoint(10, 450), gfx::Size(500, 60), true);
889 this->calcDrawEtc(parent); 889 this->calcDrawEtc(parent);
890 890
891 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 891 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
892 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 892 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
893 893
894 this->visitLayer(layer2, occlusion); 894 this->visitLayer(layer2, occlusion);
895 this->visitLayer(layer1, occlusion); 895 this->visitLayer(layer1, occlusion);
896 this->enterContributingSurface(child, occlusion); 896 this->enterContributingSurface(child, occlusion);
897 897
898 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa ce().bounds()); 898 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa ce().bounds());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTe st<Types> { 963 class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTe st<Types> {
964 protected: 964 protected:
965 OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : Occlusio nTrackerTest<Types>(opaqueLayers) {} 965 OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : Occlusio nTrackerTest<Types>(opaqueLayers) {}
966 void runMyTest() 966 void runMyTest()
967 { 967 {
968 WebTransformationMatrix childTransform; 968 WebTransformationMatrix childTransform;
969 childTransform.translate(250, 250); 969 childTransform.translate(250, 250);
970 childTransform.rotate(90); 970 childTransform.rotate(90);
971 childTransform.translate(-250, -250); 971 childTransform.translate(-250, -250);
972 972
973 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 973 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
974 parent->setMasksToBounds(true); 974 parent->setMasksToBounds(true);
975 typename Types::LayerType* child1 = this->createSurface(parent, childTra nsform, FloatPoint(30, 30), IntSize(10, 10)); 975 typename Types::LayerType* child1 = this->createSurface(parent, childTra nsform, FloatPoint(30, 30), gfx::Size(10, 10));
976 typename Types::LayerType* child2 = this->createSurface(parent, childTra nsform, FloatPoint(20, 40), IntSize(10, 10)); 976 typename Types::LayerType* child2 = this->createSurface(parent, childTra nsform, FloatPoint(20, 40), gfx::Size(10, 10));
977 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); 977 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
978 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); 978 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
979 this->calcDrawEtc(parent); 979 this->calcDrawEtc(parent);
980 980
981 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 981 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
982 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000)); 982 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000));
983 983
984 this->visitLayer(layer2, occlusion); 984 this->visitLayer(layer2, occlusion);
985 this->enterContributingSurface(child2, occlusion); 985 this->enterContributingSurface(child2, occlusion);
986 986
987 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa ce().bounds()); 987 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa ce().bounds());
988 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 988 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 WebTransformationMatrix child1Transform; 1079 WebTransformationMatrix child1Transform;
1080 child1Transform.translate(250, 250); 1080 child1Transform.translate(250, 250);
1081 child1Transform.rotate(-90); 1081 child1Transform.rotate(-90);
1082 child1Transform.translate(-250, -250); 1082 child1Transform.translate(-250, -250);
1083 1083
1084 WebTransformationMatrix child2Transform; 1084 WebTransformationMatrix child2Transform;
1085 child2Transform.translate(250, 250); 1085 child2Transform.translate(250, 250);
1086 child2Transform.rotate(90); 1086 child2Transform.rotate(90);
1087 child2Transform.translate(-250, -250); 1087 child2Transform.translate(-250, -250);
1088 1088
1089 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 1089 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
1090 parent->setMasksToBounds(true); 1090 parent->setMasksToBounds(true);
1091 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr ansform, FloatPoint(30, 20), IntSize(10, 10)); 1091 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr ansform, FloatPoint(30, 20), gfx::Size(10, 10));
1092 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c hild2Transform, FloatPoint(20, 40), IntSize(10, 10), false); 1092 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c hild2Transform, FloatPoint(20, 40), gfx::Size(10, 10), false);
1093 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true); 1093 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, FloatPoint(-10, -20), gfx::Size(510, 510), true);
1094 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); 1094 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
1095 this->calcDrawEtc(parent); 1095 this->calcDrawEtc(parent);
1096 1096
1097 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1097 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1098 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000)); 1098 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000));
1099 1099
1100 this->visitLayer(layer2, occlusion); 1100 this->visitLayer(layer2, occlusion);
1101 this->enterLayer(child2, occlusion); 1101 this->enterLayer(child2, occlusion);
1102 1102
1103 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa ce().bounds()); 1103 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa ce().bounds());
1104 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1104 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> { 1183 class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> {
1184 protected: 1184 protected:
1185 OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types> (opaqueLayers) {} 1185 OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types> (opaqueLayers) {}
1186 void runMyTest() 1186 void runMyTest()
1187 { 1187 {
1188 WebTransformationMatrix layerTransform; 1188 WebTransformationMatrix layerTransform;
1189 layerTransform.translate(250, 250); 1189 layerTransform.translate(250, 250);
1190 layerTransform.rotate(90); 1190 layerTransform.rotate(90);
1191 layerTransform.translate(-250, -250); 1191 layerTransform.translate(-250, -250);
1192 1192
1193 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 1193 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
1194 parent->setMasksToBounds(true); 1194 parent->setMasksToBounds(true);
1195 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p arent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); 1195 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p arent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
1196 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer (parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); 1196 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer (parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
1197 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye r(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); 1197 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye r(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
1198 1198
1199 WebFilterOperations filters; 1199 WebFilterOperations filters;
1200 filters.append(WebFilterOperation::createBlurFilter(10)); 1200 filters.append(WebFilterOperation::createBlurFilter(10));
1201 blurLayer->setFilters(filters); 1201 blurLayer->setFilters(filters);
1202 1202
1203 filters.clear(); 1203 filters.clear();
1204 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); 1204 filters.append(WebFilterOperation::createGrayscaleFilter(0.5));
1205 opaqueLayer->setFilters(filters); 1205 opaqueLayer->setFilters(filters);
1206 1206
1207 filters.clear(); 1207 filters.clear();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 }; 1263 };
1264 1264
1265 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters); 1265 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters);
1266 1266
1267 template<class Types> 1267 template<class Types>
1268 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types > { 1268 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types > {
1269 protected: 1269 protected:
1270 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker Test<Types>(opaqueLayers) {} 1270 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker Test<Types>(opaqueLayers) {}
1271 void runMyTest() 1271 void runMyTest()
1272 { 1272 {
1273 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 1273 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
1274 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); 1274 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
1275 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5 0), IntSize()); 1275 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5 0), gfx::Size());
1276 this->calcDrawEtc(parent); 1276 this->calcDrawEtc(parent);
1277 1277
1278 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1278 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1279 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1279 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1280 1280
1281 this->visitLayer(surface, occlusion); 1281 this->visitLayer(surface, occlusion);
1282 1282
1283 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds()); 1283 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds());
1284 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1284 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1285 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds()); 1285 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds());
1286 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 1286 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
1287 1287
1288 this->visitContributingSurface(surface, occlusion); 1288 this->visitContributingSurface(surface, occlusion);
1289 this->enterLayer(parent, occlusion); 1289 this->enterLayer(parent, occlusion);
1290 1290
1291 // The surface and replica should both be occluding the parent. 1291 // The surface and replica should both be occluding the parent.
1292 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetS urface().bounds()); 1292 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetS urface().bounds());
1293 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); 1293 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
1294 } 1294 }
1295 }; 1295 };
1296 1296
1297 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); 1297 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude);
1298 1298
1299 template<class Types> 1299 template<class Types>
1300 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type s> { 1300 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type s> {
1301 protected: 1301 protected:
1302 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {} 1302 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {}
1303 void runMyTest() 1303 void runMyTest()
1304 { 1304 {
1305 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 170)); 1305 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 170));
1306 parent->setMasksToBounds(true); 1306 parent->setMasksToBounds(true);
1307 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); 1307 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
1308 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5 0), IntSize()); 1308 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5 0), gfx::Size());
1309 this->calcDrawEtc(parent); 1309 this->calcDrawEtc(parent);
1310 1310
1311 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1311 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1312 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1312 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1313 1313
1314 this->visitLayer(surface, occlusion); 1314 this->visitLayer(surface, occlusion);
1315 1315
1316 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds()); 1316 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds());
1317 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1317 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1318 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds()); 1318 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds());
1319 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 1319 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
1320 1320
1321 this->visitContributingSurface(surface, occlusion); 1321 this->visitContributingSurface(surface, occlusion);
1322 this->enterLayer(parent, occlusion); 1322 this->enterLayer(parent, occlusion);
1323 1323
1324 // The surface and replica should both be occluding the parent. 1324 // The surface and replica should both be occluding the parent.
1325 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 70), occlusion.occlusionInTargetSu rface().bounds()); 1325 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 70), occlusion.occlusionInTargetSu rface().bounds());
1326 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); 1326 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
1327 } 1327 }
1328 }; 1328 };
1329 1329
1330 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); 1330 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping);
1331 1331
1332 template<class Types> 1332 template<class Types>
1333 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { 1333 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> {
1334 protected: 1334 protected:
1335 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {} 1335 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {}
1336 void runMyTest() 1336 void runMyTest()
1337 { 1337 {
1338 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 1338 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
1339 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); 1339 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
1340 typename Types::LayerType* replica = this->createReplicaLayer(surface, t his->identityMatrix, FloatPoint(50, 50), IntSize()); 1340 typename Types::LayerType* replica = this->createReplicaLayer(surface, t his->identityMatrix, FloatPoint(50, 50), gfx::Size());
1341 this->createMaskLayer(replica, IntSize(10, 10)); 1341 this->createMaskLayer(replica, gfx::Size(10, 10));
1342 this->calcDrawEtc(parent); 1342 this->calcDrawEtc(parent);
1343 1343
1344 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1344 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1345 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1345 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1346 1346
1347 this->visitLayer(surface, occlusion); 1347 this->visitLayer(surface, occlusion);
1348 1348
1349 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds()); 1349 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds());
1350 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1350 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1351 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds()); 1351 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds());
1352 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 1352 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
1353 1353
1354 this->visitContributingSurface(surface, occlusion); 1354 this->visitContributingSurface(surface, occlusion);
1355 this->enterLayer(parent, occlusion); 1355 this->enterLayer(parent, occlusion);
1356 1356
1357 // The replica should not be occluding the parent, since it has a mask a pplied to it. 1357 // The replica should not be occluding the parent, since it has a mask a pplied to it.
1358 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInTargetSur face().bounds()); 1358 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInTargetSur face().bounds());
1359 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 1359 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
1360 } 1360 }
1361 }; 1361 };
1362 1362
1363 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); 1363 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask);
1364 1364
1365 template<class Types> 1365 template<class Types>
1366 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes t<Types> { 1366 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes t<Types> {
1367 protected: 1367 protected:
1368 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion TrackerTest<Types>(opaqueLayers) {} 1368 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion TrackerTest<Types>(opaqueLayers) {}
1369 void runMyTest() 1369 void runMyTest()
1370 { 1370 {
1371 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1371 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1372 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1372 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1373 this->calcDrawEtc(parent); 1373 this->calcDrawEtc(parent);
1374 1374
1375 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1375 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1376 occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100)); 1376 occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100));
1377 1377
1378 this->enterLayer(layer, occlusion); 1378 this->enterLayer(layer, occlusion);
1379 1379
1380 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100))); 1380 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100)));
1381 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100))); 1381 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100)));
1382 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100))); 1382 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100)));
(...skipping 23 matching lines...) Expand all
1406 }; 1406 };
1407 1407
1408 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild); 1408 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild);
1409 1409
1410 template<class Types> 1410 template<class Types>
1411 class OcclusionTrackerTestViewportRectOutsideChild : public OcclusionTrackerTest <Types> { 1411 class OcclusionTrackerTestViewportRectOutsideChild : public OcclusionTrackerTest <Types> {
1412 protected: 1412 protected:
1413 OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionT rackerTest<Types>(opaqueLayers) {} 1413 OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionT rackerTest<Types>(opaqueLayers) {}
1414 void runMyTest() 1414 void runMyTest()
1415 { 1415 {
1416 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1416 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1417 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1417 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1418 this->calcDrawEtc(parent); 1418 this->calcDrawEtc(parent);
1419 1419
1420 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(200, 100, 100, 100)); 1420 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(200, 100, 100, 100));
1421 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1421 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1422 1422
1423 this->enterLayer(layer, occlusion); 1423 this->enterLayer(layer, occlusion);
1424 1424
1425 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100))); 1425 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100)));
1426 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100))); 1426 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100)));
1427 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100))); 1427 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100)));
(...skipping 23 matching lines...) Expand all
1451 }; 1451 };
1452 1452
1453 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); 1453 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild);
1454 1454
1455 template<class Types> 1455 template<class Types>
1456 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T ypes> { 1456 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T ypes> {
1457 protected: 1457 protected:
1458 OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTra ckerTest<Types>(opaqueLayers) {} 1458 OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTra ckerTest<Types>(opaqueLayers) {}
1459 void runMyTest() 1459 void runMyTest()
1460 { 1460 {
1461 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1461 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1462 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1462 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1463 this->calcDrawEtc(parent); 1463 this->calcDrawEtc(parent);
1464 1464
1465 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1465 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1466 occlusion.setLayerClipRect(gfx::Rect(100, 100, 100, 100)); 1466 occlusion.setLayerClipRect(gfx::Rect(100, 100, 100, 100));
1467 1467
1468 this->enterLayer(layer, occlusion); 1468 this->enterLayer(layer, occlusion);
1469 1469
1470 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100))); 1470 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100)));
1471 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100))); 1471 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100)));
1472 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100))); 1472 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100)));
(...skipping 18 matching lines...) Expand all
1491 }; 1491 };
1492 1492
1493 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild); 1493 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild);
1494 1494
1495 template<class Types> 1495 template<class Types>
1496 class OcclusionTrackerTestViewportRectOverChild : public OcclusionTrackerTest<Ty pes> { 1496 class OcclusionTrackerTestViewportRectOverChild : public OcclusionTrackerTest<Ty pes> {
1497 protected: 1497 protected:
1498 OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrac kerTest<Types>(opaqueLayers) {} 1498 OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrac kerTest<Types>(opaqueLayers) {}
1499 void runMyTest() 1499 void runMyTest()
1500 { 1500 {
1501 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1501 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1502 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1502 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1503 this->calcDrawEtc(parent); 1503 this->calcDrawEtc(parent);
1504 1504
1505 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100)); 1505 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100));
1506 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1506 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1507 1507
1508 this->enterLayer(layer, occlusion); 1508 this->enterLayer(layer, occlusion);
1509 1509
1510 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100))); 1510 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100)));
1511 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100))); 1511 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100)));
1512 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100))); 1512 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100)));
(...skipping 18 matching lines...) Expand all
1531 }; 1531 };
1532 1532
1533 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); 1533 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild);
1534 1534
1535 template<class Types> 1535 template<class Types>
1536 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker Test<Types> { 1536 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker Test<Types> {
1537 protected: 1537 protected:
1538 OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {} 1538 OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {}
1539 void runMyTest() 1539 void runMyTest()
1540 { 1540 {
1541 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1541 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1542 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1542 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1543 this->calcDrawEtc(parent); 1543 this->calcDrawEtc(parent);
1544 1544
1545 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1545 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1546 occlusion.setLayerClipRect(gfx::Rect(50, 50, 200, 200)); 1546 occlusion.setLayerClipRect(gfx::Rect(50, 50, 200, 200));
1547 1547
1548 this->enterLayer(layer, occlusion); 1548 this->enterLayer(layer, occlusion);
1549 1549
1550 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100))); 1550 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100)));
1551 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100))); 1551 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100)));
1552 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100))); 1552 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100)));
(...skipping 22 matching lines...) Expand all
1575 }; 1575 };
1576 1576
1577 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild); 1577 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild);
1578 1578
1579 template<class Types> 1579 template<class Types>
1580 class OcclusionTrackerTestViewportRectPartlyOverChild : public OcclusionTrackerT est<Types> { 1580 class OcclusionTrackerTestViewportRectPartlyOverChild : public OcclusionTrackerT est<Types> {
1581 protected: 1581 protected:
1582 OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : Occlusi onTrackerTest<Types>(opaqueLayers) {} 1582 OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : Occlusi onTrackerTest<Types>(opaqueLayers) {}
1583 void runMyTest() 1583 void runMyTest()
1584 { 1584 {
1585 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1585 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1586 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1586 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1587 this->calcDrawEtc(parent); 1587 this->calcDrawEtc(parent);
1588 1588
1589 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200)); 1589 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200));
1590 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1590 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1591 1591
1592 this->enterLayer(layer, occlusion); 1592 this->enterLayer(layer, occlusion);
1593 1593
1594 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100))); 1594 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100)));
1595 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100))); 1595 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100)));
1596 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100))); 1596 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100)));
(...skipping 22 matching lines...) Expand all
1619 }; 1619 };
1620 1620
1621 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild); 1621 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild);
1622 1622
1623 template<class Types> 1623 template<class Types>
1624 class OcclusionTrackerTestLayerClipRectOverNothing : public OcclusionTrackerTest <Types> { 1624 class OcclusionTrackerTestLayerClipRectOverNothing : public OcclusionTrackerTest <Types> {
1625 protected: 1625 protected:
1626 OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionT rackerTest<Types>(opaqueLayers) {} 1626 OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionT rackerTest<Types>(opaqueLayers) {}
1627 void runMyTest() 1627 void runMyTest()
1628 { 1628 {
1629 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1629 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1630 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1630 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1631 this->calcDrawEtc(parent); 1631 this->calcDrawEtc(parent);
1632 1632
1633 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1633 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1634 occlusion.setLayerClipRect(gfx::Rect(500, 500, 100, 100)); 1634 occlusion.setLayerClipRect(gfx::Rect(500, 500, 100, 100));
1635 1635
1636 this->enterLayer(layer, occlusion); 1636 this->enterLayer(layer, occlusion);
1637 1637
1638 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100))); 1638 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100)));
1639 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100))); 1639 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100)));
1640 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100))); 1640 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100)));
(...skipping 22 matching lines...) Expand all
1663 }; 1663 };
1664 1664
1665 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverNothing); 1665 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverNothing);
1666 1666
1667 template<class Types> 1667 template<class Types>
1668 class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest< Types> { 1668 class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest< Types> {
1669 protected: 1669 protected:
1670 OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTr ackerTest<Types>(opaqueLayers) {} 1670 OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTr ackerTest<Types>(opaqueLayers) {}
1671 void runMyTest() 1671 void runMyTest()
1672 { 1672 {
1673 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1673 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1674 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1674 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1675 this->calcDrawEtc(parent); 1675 this->calcDrawEtc(parent);
1676 1676
1677 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100)); 1677 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100));
1678 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1678 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1679 1679
1680 this->enterLayer(layer, occlusion); 1680 this->enterLayer(layer, occlusion);
1681 1681
1682 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100))); 1682 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100)));
1683 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100))); 1683 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100)));
1684 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100))); 1684 EXPECT_TRUE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100)));
(...skipping 22 matching lines...) Expand all
1707 }; 1707 };
1708 1708
1709 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverNothing); 1709 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverNothing);
1710 1710
1711 template<class Types> 1711 template<class Types>
1712 class OcclusionTrackerTestLayerClipRectForLayerOffOrigin : public OcclusionTrack erTest<Types> { 1712 class OcclusionTrackerTestLayerClipRectForLayerOffOrigin : public OcclusionTrack erTest<Types> {
1713 protected: 1713 protected:
1714 OcclusionTrackerTestLayerClipRectForLayerOffOrigin(bool opaqueLayers) : Occl usionTrackerTest<Types>(opaqueLayers) {} 1714 OcclusionTrackerTestLayerClipRectForLayerOffOrigin(bool opaqueLayers) : Occl usionTrackerTest<Types>(opaqueLayers) {}
1715 void runMyTest() 1715 void runMyTest()
1716 { 1716 {
1717 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1717 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1718 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1718 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1719 this->calcDrawEtc(parent); 1719 this->calcDrawEtc(parent);
1720 1720
1721 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1721 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1722 this->enterLayer(layer, occlusion); 1722 this->enterLayer(layer, occlusion);
1723 1723
1724 // This layer is translated when drawn into its target. So if the clip r ect given from the target surface 1724 // This layer is translated when drawn into its target. So if the clip r ect given from the target surface
1725 // is not in that target space, then after translating these query rects into the target, they will fall outside 1725 // is not in that target space, then after translating these query rects into the target, they will fall outside
1726 // the clip and be considered occluded. 1726 // the clip and be considered occluded.
1727 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100))); 1727 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100)));
1728 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100))); 1728 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100)));
1729 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100))); 1729 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100)));
1730 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 100, 100, 100))); 1730 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 100, 100, 100)));
1731 } 1731 }
1732 }; 1732 };
1733 1733
1734 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectForLayerOffOrigin); 1734 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectForLayerOffOrigin);
1735 1735
1736 template<class Types> 1736 template<class Types>
1737 class OcclusionTrackerTestOpaqueContentsRegionEmpty : public OcclusionTrackerTes t<Types> { 1737 class OcclusionTrackerTestOpaqueContentsRegionEmpty : public OcclusionTrackerTes t<Types> {
1738 protected: 1738 protected:
1739 OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaqueLayers) : Occlusion TrackerTest<Types>(opaqueLayers) {} 1739 OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaqueLayers) : Occlusion TrackerTest<Types>(opaqueLayers) {}
1740 void runMyTest() 1740 void runMyTest()
1741 { 1741 {
1742 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1742 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1743 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false); 1743 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), false);
1744 this->calcDrawEtc(parent); 1744 this->calcDrawEtc(parent);
1745 1745
1746 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1746 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1747 this->enterLayer(layer, occlusion); 1747 this->enterLayer(layer, occlusion);
1748 1748
1749 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100))); 1749 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 0, 100, 100)));
1750 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100))); 1750 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 0, 100, 100)));
1751 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100))); 1751 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(0, 100, 100, 100)));
1752 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 100, 100, 100))); 1752 EXPECT_FALSE(occlusion.occluded(layer, gfx::Rect(100, 100, 100, 100)));
1753 1753
(...skipping 15 matching lines...) Expand all
1769 }; 1769 };
1770 1770
1771 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); 1771 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty);
1772 1772
1773 template<class Types> 1773 template<class Types>
1774 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker Test<Types> { 1774 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker Test<Types> {
1775 protected: 1775 protected:
1776 OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {} 1776 OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {}
1777 void runMyTest() 1777 void runMyTest()
1778 { 1778 {
1779 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1779 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1780 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(100, 100), IntSize(200, 200), false); 1780 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(100, 100), gfx::Size(200, 200), false);
1781 this->calcDrawEtc(parent); 1781 this->calcDrawEtc(parent);
1782 1782
1783 { 1783 {
1784 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1784 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1785 layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100)); 1785 layer->setOpaqueContentsRect(gfx::Rect(0, 0, 100, 100));
1786 1786
1787 this->resetLayerIterator(); 1787 this->resetLayerIterator();
1788 this->visitLayer(layer, occlusion); 1788 this->visitLayer(layer, occlusion);
1789 this->enterLayer(parent, occlusion); 1789 this->enterLayer(parent, occlusion);
1790 1790
1791 EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInS creenSpace().bounds()); 1791 EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInS creenSpace().bounds());
1792 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1792 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1793 1793
1794 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(0, 100, 100, 100)) ); 1794 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(0, 100, 100, 100)) );
1795 EXPECT_TRUE(occlusion.occluded(parent, gfx::Rect(100, 100, 100, 100) )); 1795 EXPECT_TRUE(occlusion.occluded(parent, gfx::Rect(100, 100, 100, 100) ));
1796 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(200, 200, 100, 100 ))); 1796 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(200, 200, 100, 100 )));
1797 } 1797 }
1798 1798
1799 { 1799 {
1800 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1800 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1801 layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180)); 1801 layer->setOpaqueContentsRect(gfx::Rect(20, 20, 180, 180));
1802 1802
1803 this->resetLayerIterator(); 1803 this->resetLayerIterator();
1804 this->visitLayer(layer, occlusion); 1804 this->visitLayer(layer, occlusion);
1805 this->enterLayer(parent, occlusion); 1805 this->enterLayer(parent, occlusion);
1806 1806
1807 EXPECT_RECT_EQ(gfx::Rect(120, 120, 180, 180), occlusion.occlusionInS creenSpace().bounds()); 1807 EXPECT_RECT_EQ(gfx::Rect(120, 120, 180, 180), occlusion.occlusionInS creenSpace().bounds());
1808 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1808 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1809 1809
1810 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(0, 100, 100, 100)) ); 1810 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(0, 100, 100, 100)) );
1811 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(100, 100, 100, 100 ))); 1811 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(100, 100, 100, 100 )));
1812 EXPECT_TRUE(occlusion.occluded(parent, gfx::Rect(200, 200, 100, 100) )); 1812 EXPECT_TRUE(occlusion.occluded(parent, gfx::Rect(200, 200, 100, 100) ));
1813 } 1813 }
1814 1814
1815 { 1815 {
1816 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1816 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1817 layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100)); 1817 layer->setOpaqueContentsRect(gfx::Rect(150, 150, 100, 100));
1818 1818
1819 this->resetLayerIterator(); 1819 this->resetLayerIterator();
1820 this->visitLayer(layer, occlusion); 1820 this->visitLayer(layer, occlusion);
1821 this->enterLayer(parent, occlusion); 1821 this->enterLayer(parent, occlusion);
1822 1822
1823 EXPECT_RECT_EQ(gfx::Rect(250, 250, 50, 50), occlusion.occlusionInScr eenSpace().bounds()); 1823 EXPECT_RECT_EQ(gfx::Rect(250, 250, 50, 50), occlusion.occlusionInScr eenSpace().bounds());
1824 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1824 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1825 1825
1826 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(0, 100, 100, 100)) ); 1826 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(0, 100, 100, 100)) );
1827 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(100, 100, 100, 100 ))); 1827 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(100, 100, 100, 100 )));
1828 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(200, 200, 100, 100 ))); 1828 EXPECT_FALSE(occlusion.occluded(parent, gfx::Rect(200, 200, 100, 100 )));
1829 } 1829 }
1830 } 1830 }
1831 }; 1831 };
1832 1832
1833 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty); 1833 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty);
1834 1834
1835 template<class Types> 1835 template<class Types>
1836 class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> { 1836 class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> {
1837 protected: 1837 protected:
1838 OcclusionTrackerTest3dTransform(bool opaqueLayers) : OcclusionTrackerTest<Ty pes>(opaqueLayers) {} 1838 OcclusionTrackerTest3dTransform(bool opaqueLayers) : OcclusionTrackerTest<Ty pes>(opaqueLayers) {}
1839 void runMyTest() 1839 void runMyTest()
1840 { 1840 {
1841 WebTransformationMatrix transform; 1841 WebTransformationMatrix transform;
1842 transform.rotate3d(0, 30, 0); 1842 transform.rotate3d(0, 30, 0);
1843 1843
1844 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1844 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1845 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1845 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1846 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); 1846 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(100, 100), gfx::Size(200, 200), true);
1847 this->calcDrawEtc(parent); 1847 this->calcDrawEtc(parent);
1848 1848
1849 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1849 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1850 this->enterLayer(layer, occlusion); 1850 this->enterLayer(layer, occlusion);
1851 1851
1852 // The layer is rotated in 3d but without preserving 3d, so it only gets resized. 1852 // The layer is rotated in 3d but without preserving 3d, so it only gets resized.
1853 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedContentRec t(layer, gfx::Rect(0, 0, 200, 200))); 1853 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedContentRec t(layer, gfx::Rect(0, 0, 200, 200)));
1854 } 1854 }
1855 }; 1855 };
1856 1856
(...skipping 10 matching lines...) Expand all
1867 // Because of this, the occlusion tracker cannot assume that a 3d layer occludes 1867 // Because of this, the occlusion tracker cannot assume that a 3d layer occludes
1868 // other layers that have not yet been iterated over. For now, the expec ted 1868 // other layers that have not yet been iterated over. For now, the expec ted
1869 // behavior is that a 3d layer simply does not add any occlusion to the occlusion 1869 // behavior is that a 3d layer simply does not add any occlusion to the occlusion
1870 // tracker. 1870 // tracker.
1871 1871
1872 WebTransformationMatrix translationToFront; 1872 WebTransformationMatrix translationToFront;
1873 translationToFront.translate3d(0, 0, -10); 1873 translationToFront.translate3d(0, 0, -10);
1874 WebTransformationMatrix translationToBack; 1874 WebTransformationMatrix translationToBack;
1875 translationToFront.translate3d(0, 0, -100); 1875 translationToFront.translate3d(0, 0, -100);
1876 1876
1877 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1877 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1878 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare nt, translationToBack, FloatPoint(0, 0), IntSize(100, 100), true); 1878 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare nt, translationToBack, FloatPoint(0, 0), gfx::Size(100, 100), true);
1879 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, translationToFront, FloatPoint(50, 50), IntSize(100, 100), true); 1879 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, translationToFront, FloatPoint(50, 50), gfx::Size(100, 100), true);
1880 parent->setPreserves3D(true); 1880 parent->setPreserves3D(true);
1881 1881
1882 this->calcDrawEtc(parent); 1882 this->calcDrawEtc(parent);
1883 1883
1884 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1884 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1885 this->visitLayer(child2, occlusion); 1885 this->visitLayer(child2, occlusion);
1886 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); 1886 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
1887 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); 1887 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
1888 1888
1889 this->visitLayer(child1, occlusion); 1889 this->visitLayer(child1, occlusion);
(...skipping 10 matching lines...) Expand all
1900 protected: 1900 protected:
1901 OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrack erTest<Types>(opaqueLayers) {} 1901 OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrack erTest<Types>(opaqueLayers) {}
1902 void runMyTest() 1902 void runMyTest()
1903 { 1903 {
1904 WebTransformationMatrix transform; 1904 WebTransformationMatrix transform;
1905 transform.translate(150, 150); 1905 transform.translate(150, 150);
1906 transform.applyPerspective(400); 1906 transform.applyPerspective(400);
1907 transform.rotate3d(1, 0, 0, -30); 1907 transform.rotate3d(1, 0, 0, -30);
1908 transform.translate(-150, -150); 1908 transform.translate(-150, -150);
1909 1909
1910 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1910 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1911 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1911 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1912 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); 1912 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(100, 100), gfx::Size(200, 200), true);
1913 container->setPreserves3D(true); 1913 container->setPreserves3D(true);
1914 layer->setPreserves3D(true); 1914 layer->setPreserves3D(true);
1915 this->calcDrawEtc(parent); 1915 this->calcDrawEtc(parent);
1916 1916
1917 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1917 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1918 this->enterLayer(layer, occlusion); 1918 this->enterLayer(layer, occlusion);
1919 1919
1920 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedContentRec t(layer, gfx::Rect(0, 0, 200, 200))); 1920 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedContentRec t(layer, gfx::Rect(0, 0, 200, 200)));
1921 } 1921 }
1922 }; 1922 };
1923 1923
1924 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read. 1924 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read.
1925 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransform); 1925 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransform);
1926 1926
1927 template<class Types> 1927 template<class Types>
1928 class OcclusionTrackerTestPerspectiveTransformBehindCamera : public OcclusionTra ckerTest<Types> { 1928 class OcclusionTrackerTestPerspectiveTransformBehindCamera : public OcclusionTra ckerTest<Types> {
1929 protected: 1929 protected:
1930 OcclusionTrackerTestPerspectiveTransformBehindCamera(bool opaqueLayers) : Oc clusionTrackerTest<Types>(opaqueLayers) {} 1930 OcclusionTrackerTestPerspectiveTransformBehindCamera(bool opaqueLayers) : Oc clusionTrackerTest<Types>(opaqueLayers) {}
1931 void runMyTest() 1931 void runMyTest()
1932 { 1932 {
1933 // This test is based on the platform/chromium/compositing/3d-corners.ht ml layout test. 1933 // This test is based on the platform/chromium/compositing/3d-corners.ht ml layout test.
1934 WebTransformationMatrix transform; 1934 WebTransformationMatrix transform;
1935 transform.translate(250, 50); 1935 transform.translate(250, 50);
1936 transform.applyPerspective(10); 1936 transform.applyPerspective(10);
1937 transform.translate(-250, -50); 1937 transform.translate(-250, -50);
1938 transform.translate(250, 50); 1938 transform.translate(250, 50);
1939 transform.rotate3d(1, 0, 0, -167); 1939 transform.rotate3d(1, 0, 0, -167);
1940 transform.translate(-250, -50); 1940 transform.translate(-250, -50);
1941 1941
1942 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(500, 100)); 1942 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(500, 100));
1943 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), IntSize(500, 500)); 1943 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), gfx::Size(500, 500));
1944 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(0, 0), IntSize(500, 500), true); 1944 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(0, 0), gfx::Size(500, 500), true);
1945 container->setPreserves3D(true); 1945 container->setPreserves3D(true);
1946 layer->setPreserves3D(true); 1946 layer->setPreserves3D(true);
1947 this->calcDrawEtc(parent); 1947 this->calcDrawEtc(parent);
1948 1948
1949 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1949 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1950 this->enterLayer(layer, occlusion); 1950 this->enterLayer(layer, occlusion);
1951 1951
1952 // The bottom 11 pixel rows of this layer remain visible inside the cont ainer, after translation to the target surface. When translated back, 1952 // The bottom 11 pixel rows of this layer remain visible inside the cont ainer, after translation to the target surface. When translated back,
1953 // this will include many more pixels but must include at least the bott om 11 rows. 1953 // this will include many more pixels but must include at least the bott om 11 rows.
1954 EXPECT_TRUE(occlusion.unoccludedContentRect(layer, gfx::Rect(0, 0, 500, 500)).Contains(gfx::Rect(0, 489, 500, 11))); 1954 EXPECT_TRUE(occlusion.unoccludedContentRect(layer, gfx::Rect(0, 0, 500, 500)).Contains(gfx::Rect(0, 489, 500, 11)));
1955 } 1955 }
1956 }; 1956 };
1957 1957
1958 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read. 1958 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read.
1959 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); 1959 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera);
1960 1960
1961 template<class Types> 1961 template<class Types>
1962 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac kerTest<Types> { 1962 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac kerTest<Types> {
1963 protected: 1963 protected:
1964 OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : Occ lusionTrackerTest<Types>(opaqueLayers) {} 1964 OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : Occ lusionTrackerTest<Types>(opaqueLayers) {}
1965 void runMyTest() 1965 void runMyTest()
1966 { 1966 {
1967 WebTransformationMatrix transform; 1967 WebTransformationMatrix transform;
1968 transform.translate(50, 50); 1968 transform.translate(50, 50);
1969 transform.applyPerspective(100); 1969 transform.applyPerspective(100);
1970 transform.translate3d(0, 0, 110); 1970 transform.translate3d(0, 0, 110);
1971 transform.translate(-50, -50); 1971 transform.translate(-50, -50);
1972 1972
1973 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 1973 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
1974 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, transform, FloatPoint(0, 0), IntSize(100, 100), true); 1974 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, transform, FloatPoint(0, 0), gfx::Size(100, 100), true);
1975 parent->setPreserves3D(true); 1975 parent->setPreserves3D(true);
1976 layer->setPreserves3D(true); 1976 layer->setPreserves3D(true);
1977 this->calcDrawEtc(parent); 1977 this->calcDrawEtc(parent);
1978 1978
1979 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1979 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1980 1980
1981 // The |layer| is entirely behind the camera and should not occlude. 1981 // The |layer| is entirely behind the camera and should not occlude.
1982 this->visitLayer(layer, occlusion); 1982 this->visitLayer(layer, occlusion);
1983 this->enterLayer(parent, occlusion); 1983 this->enterLayer(parent, occlusion);
1984 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); 1984 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
1985 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); 1985 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
1986 } 1986 }
1987 }; 1987 };
1988 1988
1989 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read. 1989 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read.
1990 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); 1990 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude);
1991 1991
1992 template<class Types> 1992 template<class Types>
1993 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra ckerTest<Types> { 1993 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra ckerTest<Types> {
1994 protected: 1994 protected:
1995 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc clusionTrackerTest<Types>(opaqueLayers) {} 1995 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc clusionTrackerTest<Types>(opaqueLayers) {}
1996 void runMyTest() 1996 void runMyTest()
1997 { 1997 {
1998 WebTransformationMatrix transform; 1998 WebTransformationMatrix transform;
1999 transform.translate(50, 50); 1999 transform.translate(50, 50);
2000 transform.applyPerspective(100); 2000 transform.applyPerspective(100);
2001 transform.translate3d(0, 0, 99); 2001 transform.translate3d(0, 0, 99);
2002 transform.translate(-50, -50); 2002 transform.translate(-50, -50);
2003 2003
2004 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 2004 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
2005 parent->setMasksToBounds(true); 2005 parent->setMasksToBounds(true);
2006 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, transform, FloatPoint(0, 0), IntSize(100, 100), true); 2006 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, transform, FloatPoint(0, 0), gfx::Size(100, 100), true);
2007 parent->setPreserves3D(true); 2007 parent->setPreserves3D(true);
2008 layer->setPreserves3D(true); 2008 layer->setPreserves3D(true);
2009 this->calcDrawEtc(parent); 2009 this->calcDrawEtc(parent);
2010 2010
2011 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2011 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2012 2012
2013 // This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect. 2013 // This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect.
2014 // Ensure that those pixels don't occlude things outside the clipRect. 2014 // Ensure that those pixels don't occlude things outside the clipRect.
2015 this->visitLayer(layer, occlusion); 2015 this->visitLayer(layer, occlusion);
2016 this->enterLayer(parent, occlusion); 2016 this->enterLayer(parent, occlusion);
2017 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur face().bounds()); 2017 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur face().bounds());
2018 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 2018 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
2019 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInScreenSpa ce().bounds()); 2019 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInScreenSpa ce().bounds());
2020 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2020 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
2021 } 2021 }
2022 }; 2022 };
2023 2023
2024 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read. 2024 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read.
2025 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); 2025 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect);
2026 2026
2027 template<class Types> 2027 template<class Types>
2028 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke rTest<Types> { 2028 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke rTest<Types> {
2029 protected: 2029 protected:
2030 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {} 2030 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {}
2031 void runMyTest() 2031 void runMyTest()
2032 { 2032 {
2033 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 2033 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
2034 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2034 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2035 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2035 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2036 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); 2036 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
2037 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); 2037 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
2038 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false); 2038 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), false);
2039 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true); 2039 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(250, 0), gfx::Size(50, 300), true);
2040 2040
2041 addOpacityTransitionToController(*layer->layerAnimationController(), 10, 0, 1, false); 2041 addOpacityTransitionToController(*layer->layerAnimationController(), 10, 0, 1, false);
2042 addOpacityTransitionToController(*surface->layerAnimationController(), 1 0, 0, 1, false); 2042 addOpacityTransitionToController(*surface->layerAnimationController(), 1 0, 0, 1, false);
2043 this->calcDrawEtc(parent); 2043 this->calcDrawEtc(parent);
2044 2044
2045 EXPECT_TRUE(layer->drawOpacityIsAnimating()); 2045 EXPECT_TRUE(layer->drawOpacityIsAnimating());
2046 EXPECT_FALSE(surface->drawOpacityIsAnimating()); 2046 EXPECT_FALSE(surface->drawOpacityIsAnimating());
2047 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); 2047 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating());
2048 2048
2049 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2049 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
(...skipping 26 matching lines...) Expand all
2076 }; 2076 };
2077 2077
2078 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity1OnMainThread); 2078 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity1OnMainThread);
2079 2079
2080 template<class Types> 2080 template<class Types>
2081 class OcclusionTrackerTestAnimationOpacity0OnMainThread : public OcclusionTracke rTest<Types> { 2081 class OcclusionTrackerTestAnimationOpacity0OnMainThread : public OcclusionTracke rTest<Types> {
2082 protected: 2082 protected:
2083 OcclusionTrackerTestAnimationOpacity0OnMainThread(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {} 2083 OcclusionTrackerTestAnimationOpacity0OnMainThread(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {}
2084 void runMyTest() 2084 void runMyTest()
2085 { 2085 {
2086 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 2086 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
2087 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2087 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2088 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2088 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2089 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); 2089 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
2090 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); 2090 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
2091 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false); 2091 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), false);
2092 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true); 2092 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(250, 0), gfx::Size(50, 300), true);
2093 2093
2094 addOpacityTransitionToController(*layer->layerAnimationController(), 10, 1, 0, false); 2094 addOpacityTransitionToController(*layer->layerAnimationController(), 10, 1, 0, false);
2095 addOpacityTransitionToController(*surface->layerAnimationController(), 1 0, 1, 0, false); 2095 addOpacityTransitionToController(*surface->layerAnimationController(), 1 0, 1, 0, false);
2096 this->calcDrawEtc(parent); 2096 this->calcDrawEtc(parent);
2097 2097
2098 EXPECT_TRUE(layer->drawOpacityIsAnimating()); 2098 EXPECT_TRUE(layer->drawOpacityIsAnimating());
2099 EXPECT_FALSE(surface->drawOpacityIsAnimating()); 2099 EXPECT_FALSE(surface->drawOpacityIsAnimating());
2100 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); 2100 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating());
2101 2101
2102 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2102 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
(...skipping 26 matching lines...) Expand all
2129 }; 2129 };
2130 2130
2131 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity0OnMainThread); 2131 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity0OnMainThread);
2132 2132
2133 template<class Types> 2133 template<class Types>
2134 class OcclusionTrackerTestAnimationTranslateOnMainThread : public OcclusionTrack erTest<Types> { 2134 class OcclusionTrackerTestAnimationTranslateOnMainThread : public OcclusionTrack erTest<Types> {
2135 protected: 2135 protected:
2136 OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : Occl usionTrackerTest<Types>(opaqueLayers) {} 2136 OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : Occl usionTrackerTest<Types>(opaqueLayers) {}
2137 void runMyTest() 2137 void runMyTest()
2138 { 2138 {
2139 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 2139 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
2140 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2140 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2141 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2141 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2142 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); 2142 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
2143 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); 2143 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
2144 typename Types::ContentLayerType* surface2 = this->createDrawingSurface( parent, this->identityMatrix, FloatPoint(0, 0), IntSize(50, 300), true); 2144 typename Types::ContentLayerType* surface2 = this->createDrawingSurface( parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(50, 300), true);
2145 2145
2146 addAnimatedTransformToController(*layer->layerAnimationController(), 10, 30, 0); 2146 addAnimatedTransformToController(*layer->layerAnimationController(), 10, 30, 0);
2147 addAnimatedTransformToController(*surface->layerAnimationController(), 1 0, 30, 0); 2147 addAnimatedTransformToController(*surface->layerAnimationController(), 1 0, 30, 0);
2148 addAnimatedTransformToController(*surfaceChild->layerAnimationController (), 10, 30, 0); 2148 addAnimatedTransformToController(*surfaceChild->layerAnimationController (), 10, 30, 0);
2149 this->calcDrawEtc(parent); 2149 this->calcDrawEtc(parent);
2150 2150
2151 EXPECT_TRUE(layer->drawTransformIsAnimating()); 2151 EXPECT_TRUE(layer->drawTransformIsAnimating());
2152 EXPECT_TRUE(layer->screenSpaceTransformIsAnimating()); 2152 EXPECT_TRUE(layer->screenSpaceTransformIsAnimating());
2153 EXPECT_TRUE(surface->renderSurface()->targetSurfaceTransformsAreAnimatin g()); 2153 EXPECT_TRUE(surface->renderSurface()->targetSurfaceTransformsAreAnimatin g());
2154 EXPECT_TRUE(surface->renderSurface()->screenSpaceTransformsAreAnimating( )); 2154 EXPECT_TRUE(surface->renderSurface()->screenSpaceTransformsAreAnimating( ));
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public OcclusionT rackerTest<Types> { 2227 class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public OcclusionT rackerTest<Types> {
2228 protected: 2228 protected:
2229 OcclusionTrackerTestSurfaceOcclusionTranslatesToParent(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2229 OcclusionTrackerTestSurfaceOcclusionTranslatesToParent(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2230 void runMyTest() 2230 void runMyTest()
2231 { 2231 {
2232 WebTransformationMatrix surfaceTransform; 2232 WebTransformationMatrix surfaceTransform;
2233 surfaceTransform.translate(300, 300); 2233 surfaceTransform.translate(300, 300);
2234 surfaceTransform.scale(2); 2234 surfaceTransform.scale(2);
2235 surfaceTransform.translate(-150, -150); 2235 surfaceTransform.translate(-150, -150);
2236 2236
2237 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(500, 500)); 2237 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(500, 500));
2238 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false); 2238 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, surfaceTransform, FloatPoint(0, 0), gfx::Size(300, 300), false);
2239 typename Types::ContentLayerType* surface2 = this->createDrawingSurface( parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false); 2239 typename Types::ContentLayerType* surface2 = this->createDrawingSurface( parent, this->identityMatrix, FloatPoint(50, 50), gfx::Size(300, 300), false);
2240 surface->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); 2240 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
2241 surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); 2241 surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
2242 this->calcDrawEtc(parent); 2242 this->calcDrawEtc(parent);
2243 2243
2244 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2244 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2245 2245
2246 this->visitLayer(surface2, occlusion); 2246 this->visitLayer(surface2, occlusion);
2247 this->visitContributingSurface(surface2, occlusion); 2247 this->visitContributingSurface(surface2, occlusion);
2248 2248
2249 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInScreenS pace().bounds()); 2249 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInScreenS pace().bounds());
2250 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2250 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
2251 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInTargetS urface().bounds()); 2251 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInTargetS urface().bounds());
(...skipping 14 matching lines...) Expand all
2266 }; 2266 };
2267 2267
2268 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent ); 2268 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent );
2269 2269
2270 template<class Types> 2270 template<class Types>
2271 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus ionTrackerTest<Types> { 2271 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus ionTrackerTest<Types> {
2272 protected: 2272 protected:
2273 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers ) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2273 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers ) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2274 void runMyTest() 2274 void runMyTest()
2275 { 2275 {
2276 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 2276 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
2277 parent->setMasksToBounds(true); 2277 parent->setMasksToBounds(true);
2278 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false); 2278 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 300), false);
2279 surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200)); 2279 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200));
2280 this->calcDrawEtc(parent); 2280 this->calcDrawEtc(parent);
2281 2281
2282 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2282 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2283 2283
2284 this->visitLayer(surface, occlusion); 2284 this->visitLayer(surface, occlusion);
2285 this->visitContributingSurface(surface, occlusion); 2285 this->visitContributingSurface(surface, occlusion);
2286 2286
2287 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInScreenSpa ce().bounds()); 2287 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInScreenSpa ce().bounds());
2288 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2288 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
2289 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInTargetSur face().bounds()); 2289 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInTargetSur face().bounds());
2290 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 2290 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
2291 } 2291 }
2292 }; 2292 };
2293 2293
2294 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip ping); 2294 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip ping);
2295 2295
2296 template<class Types> 2296 template<class Types>
2297 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> { 2297 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> {
2298 protected: 2298 protected:
2299 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {} 2299 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {}
2300 void runMyTest() 2300 void runMyTest()
2301 { 2301 {
2302 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 2302 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
2303 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); 2303 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
2304 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), IntSize(100, 100)); 2304 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), gfx::Size(100, 100));
2305 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true); 2305 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100), true);
2306 this->calcDrawEtc(parent); 2306 this->calcDrawEtc(parent);
2307 2307
2308 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2308 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2309 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2309 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2310 2310
2311 // |topmost| occludes the replica, but not the surface itself. 2311 // |topmost| occludes the replica, but not the surface itself.
2312 this->visitLayer(topmost, occlusion); 2312 this->visitLayer(topmost, occlusion);
2313 2313
2314 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInScreenS pace().bounds()); 2314 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInScreenS pace().bounds());
2315 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2315 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 15 matching lines...) Expand all
2331 }; 2331 };
2332 2332
2333 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded); 2333 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded);
2334 2334
2335 template<class Types> 2335 template<class Types>
2336 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker Test<Types> { 2336 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker Test<Types> {
2337 protected: 2337 protected:
2338 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {} 2338 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {}
2339 void runMyTest() 2339 void runMyTest()
2340 { 2340 {
2341 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 2341 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
2342 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); 2342 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
2343 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), IntSize(100, 100)); 2343 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), gfx::Size(100, 100));
2344 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true); 2344 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 110), true);
2345 this->calcDrawEtc(parent); 2345 this->calcDrawEtc(parent);
2346 2346
2347 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2347 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2348 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2348 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2349 2349
2350 // |topmost| occludes the surface, but not the entire surface's replica. 2350 // |topmost| occludes the surface, but not the entire surface's replica.
2351 this->visitLayer(topmost, occlusion); 2351 this->visitLayer(topmost, occlusion);
2352 2352
2353 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpa ce().bounds()); 2353 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpa ce().bounds());
2354 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2354 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 16 matching lines...) Expand all
2371 }; 2371 };
2372 2372
2373 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded); 2373 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded);
2374 2374
2375 template<class Types> 2375 template<class Types>
2376 class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public Occlusio nTrackerTest<Types> { 2376 class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public Occlusio nTrackerTest<Types> {
2377 protected: 2377 protected:
2378 OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2378 OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2379 void runMyTest() 2379 void runMyTest()
2380 { 2380 {
2381 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 2381 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
2382 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); 2382 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
2383 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), IntSize(100, 100)); 2383 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), gfx::Size(100, 100));
2384 typename Types::LayerType* overSurface = this->createDrawingLayer(parent , this->identityMatrix, FloatPoint(0, 0), IntSize(40, 100), true); 2384 typename Types::LayerType* overSurface = this->createDrawingLayer(parent , this->identityMatrix, FloatPoint(0, 0), gfx::Size(40, 100), true);
2385 typename Types::LayerType* overReplica = this->createDrawingLayer(parent , this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true); 2385 typename Types::LayerType* overReplica = this->createDrawingLayer(parent , this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 100), true);
2386 this->calcDrawEtc(parent); 2386 this->calcDrawEtc(parent);
2387 2387
2388 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2388 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2389 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2389 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2390 2390
2391 // These occlude the surface and replica differently, so we can test eac h one. 2391 // These occlude the surface and replica differently, so we can test eac h one.
2392 this->visitLayer(overReplica, occlusion); 2392 this->visitLayer(overReplica, occlusion);
2393 this->visitLayer(overSurface, occlusion); 2393 this->visitLayer(overSurface, occlusion);
2394 2394
2395 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInScreenSpac e().bounds()); 2395 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInScreenSpac e().bounds());
(...skipping 19 matching lines...) Expand all
2415 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent ly); 2415 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent ly);
2416 2416
2417 template<class Types> 2417 template<class Types>
2418 class OcclusionTrackerTestSurfaceChildOfSurface : public OcclusionTrackerTest<Ty pes> { 2418 class OcclusionTrackerTestSurfaceChildOfSurface : public OcclusionTrackerTest<Ty pes> {
2419 protected: 2419 protected:
2420 OcclusionTrackerTestSurfaceChildOfSurface(bool opaqueLayers) : OcclusionTrac kerTest<Types>(opaqueLayers) {} 2420 OcclusionTrackerTestSurfaceChildOfSurface(bool opaqueLayers) : OcclusionTrac kerTest<Types>(opaqueLayers) {}
2421 void runMyTest() 2421 void runMyTest()
2422 { 2422 {
2423 // This test verifies that the surface cliprect does not end up empty an d clip away the entire unoccluded rect. 2423 // This test verifies that the surface cliprect does not end up empty an d clip away the entire unoccluded rect.
2424 2424
2425 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 2425 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
2426 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); 2426 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
2427 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, FloatPoint(0, 10), IntSize(100, 50), true); 2427 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, FloatPoint(0, 10), gfx::Size(100, 50), true);
2428 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); 2428 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 50), true);
2429 this->calcDrawEtc(parent); 2429 this->calcDrawEtc(parent);
2430 2430
2431 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000)); 2431 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000));
2432 2432
2433 // |topmost| occludes everything partially so we know occlusion is happe ning at all. 2433 // |topmost| occludes everything partially so we know occlusion is happe ning at all.
2434 this->visitLayer(topmost, occlusion); 2434 this->visitLayer(topmost, occlusion);
2435 2435
2436 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInScreenSpac e().bounds()); 2436 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInScreenSpac e().bounds());
2437 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2437 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
2438 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurf ace().bounds()); 2438 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurf ace().bounds());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface); 2474 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface);
2475 2475
2476 template<class Types> 2476 template<class Types>
2477 class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public OcclusionTr ackerTest<Types> { 2477 class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public OcclusionTr ackerTest<Types> {
2478 protected: 2478 protected:
2479 OcclusionTrackerTestTopmostSurfaceIsClippedToViewport(bool opaqueLayers) : O cclusionTrackerTest<Types>(opaqueLayers) {} 2479 OcclusionTrackerTestTopmostSurfaceIsClippedToViewport(bool opaqueLayers) : O cclusionTrackerTest<Types>(opaqueLayers) {}
2480 void runMyTest() 2480 void runMyTest()
2481 { 2481 {
2482 // This test verifies that the top-most surface is considered occluded o utside of its target's clipRect and outside the viewport rect. 2482 // This test verifies that the top-most surface is considered occluded o utside of its target's clipRect and outside the viewport rect.
2483 2483
2484 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 2484 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
2485 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); 2485 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
2486 this->calcDrawEtc(parent); 2486 this->calcDrawEtc(parent);
2487 2487
2488 { 2488 {
2489 // Make a viewport rect that is larger than the root layer. 2489 // Make a viewport rect that is larger than the root layer.
2490 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2490 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2491 2491
2492 this->visitLayer(surface, occlusion); 2492 this->visitLayer(surface, occlusion);
2493 2493
2494 // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect. 2494 // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect.
2495 this->enterContributingSurface(surface, occlusion); 2495 this->enterContributingSurface(surface, occlusion);
(...skipping 18 matching lines...) Expand all
2514 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTopmostSurfaceIsClippedToViewport) ; 2514 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTopmostSurfaceIsClippedToViewport) ;
2515 2515
2516 template<class Types> 2516 template<class Types>
2517 class OcclusionTrackerTestSurfaceChildOfClippingSurface : public OcclusionTracke rTest<Types> { 2517 class OcclusionTrackerTestSurfaceChildOfClippingSurface : public OcclusionTracke rTest<Types> {
2518 protected: 2518 protected:
2519 OcclusionTrackerTestSurfaceChildOfClippingSurface(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {} 2519 OcclusionTrackerTestSurfaceChildOfClippingSurface(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {}
2520 void runMyTest() 2520 void runMyTest()
2521 { 2521 {
2522 // This test verifies that the surface cliprect does not end up empty an d clip away the entire unoccluded rect. 2522 // This test verifies that the surface cliprect does not end up empty an d clip away the entire unoccluded rect.
2523 2523
2524 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(80, 200)); 2524 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(80, 200));
2525 parent->setMasksToBounds(true); 2525 parent->setMasksToBounds(true);
2526 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); 2526 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
2527 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false); 2527 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), false);
2528 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); 2528 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 50), true);
2529 this->calcDrawEtc(parent); 2529 this->calcDrawEtc(parent);
2530 2530
2531 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2531 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2532 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2532 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2533 2533
2534 // |topmost| occludes everything partially so we know occlusion is happe ning at all. 2534 // |topmost| occludes everything partially so we know occlusion is happe ning at all.
2535 this->visitLayer(topmost, occlusion); 2535 this->visitLayer(topmost, occlusion);
2536 2536
2537 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace ().bounds()); 2537 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace ().bounds());
2538 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2538 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 protected: 2570 protected:
2571 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLa yers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2571 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLa yers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2572 void runMyTest() 2572 void runMyTest()
2573 { 2573 {
2574 WebTransformationMatrix scaleByHalf; 2574 WebTransformationMatrix scaleByHalf;
2575 scaleByHalf.scale(0.5); 2575 scaleByHalf.scale(0.5);
2576 2576
2577 // Make a surface and its replica, each 50x50, that are completely surro unded by opaque layers which are above them in the z-order. 2577 // Make a surface and its replica, each 50x50, that are completely surro unded by opaque layers which are above them in the z-order.
2578 // The surface is scaled to test that the pixel moving is done in the ta rget space, where the background filter is applied, but the surface 2578 // The surface is scaled to test that the pixel moving is done in the ta rget space, where the background filter is applied, but the surface
2579 // appears at 50, 50 and the replica at 200, 50. 2579 // appears at 50, 50 and the replica at 200, 50.
2580 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); 2580 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
2581 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); 2581 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
2582 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), IntSize()); 2582 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), gfx::Size());
2583 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true); 2583 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 50), true);
2584 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true); 2584 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(300, 50), true);
2585 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true); 2585 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 50), gfx::Size(50, 50), true);
2586 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true); 2586 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(100, 50), gfx::Size(100, 50), true);
2587 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true); 2587 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(250, 50), gfx::Size(50, 50), true);
2588 2588
2589 // Filters make the layer own a surface. 2589 // Filters make the layer own a surface.
2590 WebFilterOperations filters; 2590 WebFilterOperations filters;
2591 filters.append(WebFilterOperation::createBlurFilter(10)); 2591 filters.append(WebFilterOperation::createBlurFilter(10));
2592 filteredSurface->setBackgroundFilters(filters); 2592 filteredSurface->setBackgroundFilters(filters);
2593 2593
2594 // Save the distance of influence for the blur effect. 2594 // Save the distance of influence for the blur effect.
2595 int outsetTop, outsetRight, outsetBottom, outsetLeft; 2595 int outsetTop, outsetRight, outsetBottom, outsetLeft;
2596 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); 2596 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
2597 2597
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 template<class Types> 2690 template<class Types>
2691 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl usionTrackerTest<Types> { 2691 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl usionTrackerTest<Types> {
2692 protected: 2692 protected:
2693 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2693 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye rs) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2694 void runMyTest() 2694 void runMyTest()
2695 { 2695 {
2696 WebTransformationMatrix scaleByHalf; 2696 WebTransformationMatrix scaleByHalf;
2697 scaleByHalf.scale(0.5); 2697 scaleByHalf.scale(0.5);
2698 2698
2699 // Makes two surfaces that completely cover |parent|. The occlusion both above and below the filters will be reduced by each of them. 2699 // Makes two surfaces that completely cover |parent|. The occlusion both above and below the filters will be reduced by each of them.
2700 typename Types::ContentLayerType* root = this->createRoot(this->identity Matrix, FloatPoint(0, 0), IntSize(75, 75)); 2700 typename Types::ContentLayerType* root = this->createRoot(this->identity Matrix, FloatPoint(0, 0), gfx::Size(75, 75));
2701 typename Types::LayerType* parent = this->createSurface(root, scaleByHal f, FloatPoint(0, 0), IntSize(150, 150)); 2701 typename Types::LayerType* parent = this->createSurface(root, scaleByHal f, FloatPoint(0, 0), gfx::Size(150, 150));
2702 parent->setMasksToBounds(true); 2702 parent->setMasksToBounds(true);
2703 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p arent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false); 2703 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p arent, scaleByHalf, FloatPoint(0, 0), gfx::Size(300, 300), false);
2704 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p arent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false); 2704 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p arent, scaleByHalf, FloatPoint(0, 0), gfx::Size(300, 300), false);
2705 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye r(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(50, 50), true); 2705 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye r(parent, this->identityMatrix, FloatPoint(100, 100), gfx::Size(50, 50), true);
2706 2706
2707 // Filters make the layers own surfaces. 2707 // Filters make the layers own surfaces.
2708 WebFilterOperations filters; 2708 WebFilterOperations filters;
2709 filters.append(WebFilterOperation::createBlurFilter(1)); 2709 filters.append(WebFilterOperation::createBlurFilter(1));
2710 filteredSurface1->setBackgroundFilters(filters); 2710 filteredSurface1->setBackgroundFilters(filters);
2711 filteredSurface2->setBackgroundFilters(filters); 2711 filteredSurface2->setBackgroundFilters(filters);
2712 2712
2713 // Save the distance of influence for the blur effect. 2713 // Save the distance of influence for the blur effect.
2714 int outsetTop, outsetRight, outsetBottom, outsetLeft; 2714 int outsetTop, outsetRight, outsetBottom, outsetLeft;
2715 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); 2715 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
(...skipping 28 matching lines...) Expand all
2744 2744
2745 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio nTwice); 2745 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio nTwice);
2746 2746
2747 template<class Types> 2747 template<class Types>
2748 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p ublic OcclusionTrackerTest<Types> { 2748 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p ublic OcclusionTrackerTest<Types> {
2749 protected: 2749 protected:
2750 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2750 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2751 void runMyTest() 2751 void runMyTest()
2752 { 2752 {
2753 // Make a surface and its replica, each 50x50, that are completely surro unded by opaque layers which are above them in the z-order. 2753 // Make a surface and its replica, each 50x50, that are completely surro unded by opaque layers which are above them in the z-order.
2754 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); 2754 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
2755 // We stick the filtered surface inside a clipping surface so that we ca n make sure the clip is honored when exposing pixels for 2755 // We stick the filtered surface inside a clipping surface so that we ca n make sure the clip is honored when exposing pixels for
2756 // the background filter. 2756 // the background filter.
2757 typename Types::LayerType* clippingSurface = this->createSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 70)); 2757 typename Types::LayerType* clippingSurface = this->createSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 70));
2758 clippingSurface->setMasksToBounds(true); 2758 clippingSurface->setMasksToBounds(true);
2759 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl ippingSurface, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), false) ; 2759 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl ippingSurface, this->identityMatrix, FloatPoint(50, 50), gfx::Size(50, 50), fals e);
2760 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(150, 0), IntSize()); 2760 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(150, 0), gfx::Size());
2761 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true); 2761 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 50), true);
2762 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true); 2762 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(300, 50), true);
2763 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true); 2763 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 50), gfx::Size(50, 50), true);
2764 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true); 2764 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(100, 50), gfx::Size(100, 50), true);
2765 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true); 2765 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(250, 50), gfx::Size(50, 50), true);
2766 2766
2767 // Filters make the layer own a surface. This filter is large enough tha t it goes outside the bottom of the clippingSurface. 2767 // Filters make the layer own a surface. This filter is large enough tha t it goes outside the bottom of the clippingSurface.
2768 WebFilterOperations filters; 2768 WebFilterOperations filters;
2769 filters.append(WebFilterOperation::createBlurFilter(12)); 2769 filters.append(WebFilterOperation::createBlurFilter(12));
2770 filteredSurface->setBackgroundFilters(filters); 2770 filteredSurface->setBackgroundFilters(filters);
2771 2771
2772 // Save the distance of influence for the blur effect. 2772 // Save the distance of influence for the blur effect.
2773 int outsetTop, outsetRight, outsetBottom, outsetLeft; 2773 int outsetTop, outsetRight, outsetBottom, outsetLeft;
2774 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); 2774 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
2775 2775
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2871 protected: 2871 protected:
2872 OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter(bool opaqueLaye rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2872 OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter(bool opaqueLaye rs) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2873 void runMyTest() 2873 void runMyTest()
2874 { 2874 {
2875 WebTransformationMatrix scaleByHalf; 2875 WebTransformationMatrix scaleByHalf;
2876 scaleByHalf.scale(0.5); 2876 scaleByHalf.scale(0.5);
2877 2877
2878 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye r centered below each. 2878 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye r centered below each.
2879 // The surface is scaled to test that the pixel moving is done in the ta rget space, where the background filter is applied, but the surface 2879 // The surface is scaled to test that the pixel moving is done in the ta rget space, where the background filter is applied, but the surface
2880 // appears at 50, 50 and the replica at 200, 50. 2880 // appears at 50, 50 and the replica at 200, 50.
2881 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); 2881 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
2882 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(60, 60), IntSize(30, 30), true); 2882 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(60, 60), gfx::Size(30, 30), true);
2883 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(210, 60), IntSize(30, 30), true); 2883 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(210, 60), gfx::Size(30, 30), true);
2884 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); 2884 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
2885 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), IntSize()); 2885 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), gfx::Size());
2886 2886
2887 // Filters make the layer own a surface. 2887 // Filters make the layer own a surface.
2888 WebFilterOperations filters; 2888 WebFilterOperations filters;
2889 filters.append(WebFilterOperation::createBlurFilter(3)); 2889 filters.append(WebFilterOperation::createBlurFilter(3));
2890 filteredSurface->setBackgroundFilters(filters); 2890 filteredSurface->setBackgroundFilters(filters);
2891 2891
2892 this->calcDrawEtc(parent); 2892 this->calcDrawEtc(parent);
2893 2893
2894 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2894 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2895 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2895 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
(...skipping 25 matching lines...) Expand all
2921 protected: 2921 protected:
2922 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2922 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2923 void runMyTest() 2923 void runMyTest()
2924 { 2924 {
2925 WebTransformationMatrix scaleByHalf; 2925 WebTransformationMatrix scaleByHalf;
2926 scaleByHalf.scale(0.5); 2926 scaleByHalf.scale(0.5);
2927 2927
2928 // Make a surface and its replica, each 50x50, that are completely occlu ded by opaque layers which are above them in the z-order. 2928 // Make a surface and its replica, each 50x50, that are completely occlu ded by opaque layers which are above them in the z-order.
2929 // The surface is scaled to test that the pixel moving is done in the ta rget space, where the background filter is applied, but the surface 2929 // The surface is scaled to test that the pixel moving is done in the ta rget space, where the background filter is applied, but the surface
2930 // appears at 50, 50 and the replica at 200, 50. 2930 // appears at 50, 50 and the replica at 200, 50.
2931 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); 2931 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
2932 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); 2932 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
2933 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), IntSize()); 2933 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), gfx::Size());
2934 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), true); 2934 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(50, 50), gfx::Size(50, 50), true);
2935 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(200, 50), IntSize(50, 50), true); 2935 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(200, 50), gfx::Size(50, 50), true);
2936 2936
2937 // Filters make the layer own a surface. 2937 // Filters make the layer own a surface.
2938 WebFilterOperations filters; 2938 WebFilterOperations filters;
2939 filters.append(WebFilterOperation::createBlurFilter(3)); 2939 filters.append(WebFilterOperation::createBlurFilter(3));
2940 filteredSurface->setBackgroundFilters(filters); 2940 filteredSurface->setBackgroundFilters(filters);
2941 2941
2942 this->calcDrawEtc(parent); 2942 this->calcDrawEtc(parent);
2943 2943
2944 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2944 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2945 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2945 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
(...skipping 24 matching lines...) Expand all
2970 protected: 2970 protected:
2971 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2971 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2972 void runMyTest() 2972 void runMyTest()
2973 { 2973 {
2974 WebTransformationMatrix scaleByHalf; 2974 WebTransformationMatrix scaleByHalf;
2975 scaleByHalf.scale(0.5); 2975 scaleByHalf.scale(0.5);
2976 2976
2977 // Make a surface and its replica, each 50x50, that are partially occlud ed by opaque layers which are above them in the z-order. 2977 // Make a surface and its replica, each 50x50, that are partially occlud ed by opaque layers which are above them in the z-order.
2978 // The surface is scaled to test that the pixel moving is done in the ta rget space, where the background filter is applied, but the surface 2978 // The surface is scaled to test that the pixel moving is done in the ta rget space, where the background filter is applied, but the surface
2979 // appears at 50, 50 and the replica at 200, 50. 2979 // appears at 50, 50 and the replica at 200, 50.
2980 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); 2980 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
2981 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); 2981 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
2982 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), IntSize()); 2982 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), gfx::Size());
2983 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(70, 50), IntSize(30, 50), true); 2983 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(70, 50), gfx::Size(30, 50), true);
2984 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(200, 50), IntSize(30, 50), true); 2984 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(200, 50), gfx::Size(30, 50), true);
2985 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(90, 40), IntSize(10, 10), true); 2985 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(90, 40), gfx::Size(10, 10), true);
2986 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(200, 40), IntSize(10, 10), true); 2986 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(200, 40), gfx::Size(10, 10), true);
2987 2987
2988 // Filters make the layer own a surface. 2988 // Filters make the layer own a surface.
2989 WebFilterOperations filters; 2989 WebFilterOperations filters;
2990 filters.append(WebFilterOperation::createBlurFilter(3)); 2990 filters.append(WebFilterOperation::createBlurFilter(3));
2991 filteredSurface->setBackgroundFilters(filters); 2991 filteredSurface->setBackgroundFilters(filters);
2992 2992
2993 // Save the distance of influence for the blur effect. 2993 // Save the distance of influence for the blur effect.
2994 int outsetTop, outsetRight, outsetBottom, outsetLeft; 2994 int outsetTop, outsetRight, outsetBottom, outsetLeft;
2995 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); 2995 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
2996 2996
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3037 }; 3037 };
3038 3038
3039 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte rIsPartiallyOccluded); 3039 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte rIsPartiallyOccluded);
3040 3040
3041 template<class Types> 3041 template<class Types>
3042 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type s> { 3042 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type s> {
3043 protected: 3043 protected:
3044 OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {} 3044 OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {}
3045 void runMyTest() 3045 void runMyTest()
3046 { 3046 {
3047 IntSize trackingSize(100, 100); 3047 gfx::Size trackingSize(100, 100);
3048 IntSize belowTrackingSize(99, 99); 3048 gfx::Size belowTrackingSize(99, 99);
3049 3049
3050 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(400, 400)); 3050 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(400, 400));
3051 typename Types::LayerType* large = this->createDrawingLayer(parent, this ->identityMatrix, FloatPoint(0, 0), trackingSize, true); 3051 typename Types::LayerType* large = this->createDrawingLayer(parent, this ->identityMatrix, FloatPoint(0, 0), trackingSize, true);
3052 typename Types::LayerType* small = this->createDrawingLayer(parent, this ->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true); 3052 typename Types::LayerType* small = this->createDrawingLayer(parent, this ->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true);
3053 this->calcDrawEtc(parent); 3053 this->calcDrawEtc(parent);
3054 3054
3055 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 3055 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
3056 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 3056 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
3057 occlusion.setMinimumTrackingSize(trackingSize); 3057 occlusion.setMinimumTrackingSize(trackingSize);
3058 3058
3059 // The small layer is not tracked because it is too small. 3059 // The small layer is not tracked because it is too small.
3060 this->visitLayer(small, occlusion); 3060 this->visitLayer(small, occlusion);
3061 3061
3062 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds()) ; 3062 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds()) ;
3063 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); 3063 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
3064 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds( )); 3064 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds( ));
3065 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); 3065 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
3066 3066
3067 // The large layer is tracked as it is large enough. 3067 // The large layer is tracked as it is large enough.
3068 this->visitLayer(large, occlusion); 3068 this->visitLayer(large, occlusion);
3069 3069
3070 EXPECT_RECT_EQ(gfx::Rect(IntPoint(), trackingSize), occlusion.occlusionI nScreenSpace().bounds()); 3070 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio nInScreenSpace().bounds());
3071 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 3071 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
3072 EXPECT_RECT_EQ(gfx::Rect(IntPoint(), trackingSize), occlusion.occlusionI nTargetSurface().bounds()); 3072 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio nInTargetSurface().bounds());
3073 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 3073 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
3074 } 3074 }
3075 }; 3075 };
3076 3076
3077 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); 3077 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize);
3078 3078
3079 } // namespace 3079 } // namespace
OLDNEW
« cc/layer_tiling_data.cc ('K') | « cc/occlusion_tracker.cc ('k') | cc/overdraw_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698