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

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: ScaleAsVector 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
« no previous file with comments | « cc/occlusion_tracker.cc ('k') | cc/overdraw_metrics.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 static inline bool layerImplDrawTransformIsUnknown(const Layer* layer) { return layer->drawTransformIsAnimating(); } 88 static inline bool layerImplDrawTransformIsUnknown(const Layer* layer) { return layer->drawTransformIsAnimating(); }
89 static inline bool layerImplDrawTransformIsUnknown(const LayerImpl*) { return fa lse; } 89 static inline bool layerImplDrawTransformIsUnknown(const LayerImpl*) { return fa lse; }
90 90
91 template<typename LayerType, typename RenderSurfaceType> 91 template<typename LayerType, typename RenderSurfaceType>
92 class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType, RenderSurfaceType> { 92 class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType, RenderSurfaceType> {
93 public: 93 public:
94 TestOcclusionTrackerWithClip(gfx::Rect viewportRect, bool recordMetricsForFr ame = false) 94 TestOcclusionTrackerWithClip(gfx::Rect viewportRect, bool recordMetricsForFr ame = false)
95 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, r ecordMetricsForFrame) 95 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, r ecordMetricsForFrame)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 virtual void TearDown() 193 virtual void TearDown()
194 { 194 {
195 Types::destroyLayer(m_root); 195 Types::destroyLayer(m_root);
196 m_renderSurfaceLayerList.clear(); 196 m_renderSurfaceLayerList.clear();
197 m_renderSurfaceLayerListImpl.clear(); 197 m_renderSurfaceLayerListImpl.clear();
198 m_replicaLayers.clear(); 198 m_replicaLayers.clear();
199 m_maskLayers.clear(); 199 m_maskLayers.clear();
200 LayerTreeHost::setNeedsFilterContext(false); 200 LayerTreeHost::setNeedsFilterContext(false);
201 } 201 }
202 202
203 typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) 203 typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
204 { 204 {
205 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); 205 typename Types::ContentLayerPtrType layer(Types::createContentLayer());
206 typename Types::ContentLayerType* layerPtr = layer.get(); 206 typename Types::ContentLayerType* layerPtr = layer.get();
207 setProperties(layerPtr, transform, position, bounds); 207 setProperties(layerPtr, transform, position, bounds);
208 208
209 DCHECK(!m_root); 209 DCHECK(!m_root);
210 m_root = Types::passLayerPtr(layer); 210 m_root = Types::passLayerPtr(layer);
211 return layerPtr; 211 return layerPtr;
212 } 212 }
213 213
214 typename Types::LayerType* createLayer(typename Types::LayerType* parent, co nst WebTransformationMatrix& transform, const FloatPoint& position, const IntSiz e& bounds) 214 typename Types::LayerType* createLayer(typename Types::LayerType* parent, co nst WebTransformationMatrix& transform, const FloatPoint& position, const gfx::S ize& bounds)
215 { 215 {
216 typename Types::LayerPtrType layer(Types::createLayer()); 216 typename Types::LayerPtrType layer(Types::createLayer());
217 typename Types::LayerType* layerPtr = layer.get(); 217 typename Types::LayerType* layerPtr = layer.get();
218 setProperties(layerPtr, transform, position, bounds); 218 setProperties(layerPtr, transform, position, bounds);
219 parent->addChild(Types::passLayerPtr(layer)); 219 parent->addChild(Types::passLayerPtr(layer));
220 return layerPtr; 220 return layerPtr;
221 } 221 }
222 222
223 typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntS ize& bounds) 223 typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx: :Size& bounds)
224 { 224 {
225 typename Types::LayerType* layer = createLayer(parent, transform, positi on, bounds); 225 typename Types::LayerType* layer = createLayer(parent, transform, positi on, bounds);
226 WebFilterOperations filters; 226 WebFilterOperations filters;
227 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); 227 filters.append(WebFilterOperation::createGrayscaleFilter(0.5));
228 layer->setFilters(filters); 228 layer->setFilters(filters);
229 return layer; 229 return layer;
230 } 230 }
231 231
232 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy pe* parent, const WebTransformationMatrix& transform, const FloatPoint& position , const IntSize& bounds, bool opaque) 232 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy pe* parent, const WebTransformationMatrix& transform, const FloatPoint& position , const gfx::Size& bounds, bool opaque)
233 { 233 {
234 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); 234 typename Types::ContentLayerPtrType layer(Types::createContentLayer());
235 typename Types::ContentLayerType* layerPtr = layer.get(); 235 typename Types::ContentLayerType* layerPtr = layer.get();
236 setProperties(layerPtr, transform, position, bounds); 236 setProperties(layerPtr, transform, position, bounds);
237 237
238 if (m_opaqueLayers) 238 if (m_opaqueLayers)
239 layerPtr->setContentsOpaque(opaque); 239 layerPtr->setContentsOpaque(opaque);
240 else { 240 else {
241 layerPtr->setContentsOpaque(false); 241 layerPtr->setContentsOpaque(false);
242 if (opaque) 242 if (opaque)
243 layerPtr->setOpaqueContentsRect(IntRect(IntPoint(), bounds)); 243 layerPtr->setOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds)) ;
244 else 244 else
245 layerPtr->setOpaqueContentsRect(IntRect()); 245 layerPtr->setOpaqueContentsRect(gfx::Rect());
246 } 246 }
247 247
248 parent->addChild(Types::passLayerPtr(layer)); 248 parent->addChild(Types::passLayerPtr(layer));
249 return layerPtr; 249 return layerPtr;
250 } 250 }
251 251
252 typename Types::LayerType* createReplicaLayer(typename Types::LayerType* own ingLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) 252 typename Types::LayerType* createReplicaLayer(typename Types::LayerType* own ingLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
253 { 253 {
254 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); 254 typename Types::ContentLayerPtrType layer(Types::createContentLayer());
255 typename Types::ContentLayerType* layerPtr = layer.get(); 255 typename Types::ContentLayerType* layerPtr = layer.get();
256 setProperties(layerPtr, transform, position, bounds); 256 setProperties(layerPtr, transform, position, bounds);
257 setReplica(owningLayer, Types::passLayerPtr(layer)); 257 setReplica(owningLayer, Types::passLayerPtr(layer));
258 return layerPtr; 258 return layerPtr;
259 } 259 }
260 260
261 typename Types::LayerType* createMaskLayer(typename Types::LayerType* owning Layer, const IntSize& bounds) 261 typename Types::LayerType* createMaskLayer(typename Types::LayerType* owning Layer, const gfx::Size& bounds)
262 { 262 {
263 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); 263 typename Types::ContentLayerPtrType layer(Types::createContentLayer());
264 typename Types::ContentLayerType* layerPtr = layer.get(); 264 typename Types::ContentLayerType* layerPtr = layer.get();
265 setProperties(layerPtr, identityMatrix, FloatPoint(), bounds); 265 setProperties(layerPtr, identityMatrix, FloatPoint(), bounds);
266 setMask(owningLayer, Types::passLayerPtr(layer)); 266 setMask(owningLayer, Types::passLayerPtr(layer));
267 return layerPtr; 267 return layerPtr;
268 } 268 }
269 269
270 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer Type* parent, const WebTransformationMatrix& transform, const FloatPoint& positi on, const IntSize& bounds, bool opaque) 270 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer Type* parent, const WebTransformationMatrix& transform, const FloatPoint& positi on, const gfx::Size& bounds, bool opaque)
271 { 271 {
272 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra nsform, position, bounds, opaque); 272 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra nsform, position, bounds, opaque);
273 WebFilterOperations filters; 273 WebFilterOperations filters;
274 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); 274 filters.append(WebFilterOperation::createGrayscaleFilter(0.5));
275 layer->setFilters(filters); 275 layer->setFilters(filters);
276 return layer; 276 return layer;
277 } 277 }
278 278
279 void calcDrawEtc(TestContentLayerImpl* root) 279 void calcDrawEtc(TestContentLayerImpl* root)
280 { 280 {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 348 }
349 349
350 void resetLayerIterator() 350 void resetLayerIterator()
351 { 351 {
352 m_layerIterator = m_layerIteratorBegin; 352 m_layerIterator = m_layerIteratorBegin;
353 } 353 }
354 354
355 const WebTransformationMatrix identityMatrix; 355 const WebTransformationMatrix identityMatrix;
356 356
357 private: 357 private:
358 void setBaseProperties(typename Types::LayerType* layer, const WebTransforma tionMatrix& transform, const FloatPoint& position, const IntSize& bounds) 358 void setBaseProperties(typename Types::LayerType* layer, const WebTransforma tionMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
359 { 359 {
360 layer->setTransform(transform); 360 layer->setTransform(transform);
361 layer->setSublayerTransform(WebTransformationMatrix()); 361 layer->setSublayerTransform(WebTransformationMatrix());
362 layer->setAnchorPoint(FloatPoint(0, 0)); 362 layer->setAnchorPoint(FloatPoint(0, 0));
363 layer->setPosition(position); 363 layer->setPosition(position);
364 layer->setBounds(bounds); 364 layer->setBounds(bounds);
365 } 365 }
366 366
367 void setProperties(Layer* layer, const WebTransformationMatrix& transform, c onst FloatPoint& position, const IntSize& bounds) 367 void setProperties(Layer* layer, const WebTransformationMatrix& transform, c onst FloatPoint& position, const gfx::Size& bounds)
368 { 368 {
369 setBaseProperties(layer, transform, position, bounds); 369 setBaseProperties(layer, transform, position, bounds);
370 } 370 }
371 371
372 void setProperties(LayerImpl* layer, const WebTransformationMatrix& transfor m, const FloatPoint& position, const IntSize& bounds) 372 void setProperties(LayerImpl* layer, const WebTransformationMatrix& transfor m, const FloatPoint& position, const gfx::Size& bounds)
373 { 373 {
374 setBaseProperties(layer, transform, position, bounds); 374 setBaseProperties(layer, transform, position, bounds);
375 375
376 layer->setContentBounds(layer->bounds()); 376 layer->setContentBounds(layer->bounds());
377 } 377 }
378 378
379 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer) 379 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer)
380 { 380 {
381 owningLayer->setReplicaLayer(layer.get()); 381 owningLayer->setReplicaLayer(layer.get());
382 m_replicaLayers.push_back(layer); 382 m_replicaLayers.push_back(layer);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ 454 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \
455 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) 455 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName)
456 456
457 template<class Types> 457 template<class Types>
458 class OcclusionTrackerTestIdentityTransforms : public OcclusionTrackerTest<Types > { 458 class OcclusionTrackerTestIdentityTransforms : public OcclusionTrackerTest<Types > {
459 protected: 459 protected:
460 OcclusionTrackerTestIdentityTransforms(bool opaqueLayers) : OcclusionTracker Test<Types>(opaqueLayers) {} 460 OcclusionTrackerTestIdentityTransforms(bool opaqueLayers) : OcclusionTracker Test<Types>(opaqueLayers) {}
461 461
462 void runMyTest() 462 void runMyTest()
463 { 463 {
464 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 464 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
465 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true); 465 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(30, 30), gfx::Size(500, 500), true);
466 this->calcDrawEtc(parent); 466 this->calcDrawEtc(parent);
467 467
468 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 468 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
469 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 469 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
470 470
471 this->visitLayer(layer, occlusion); 471 this->visitLayer(layer, occlusion);
472 this->enterLayer(parent, occlusion); 472 this->enterLayer(parent, occlusion);
473 473
474 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa ce().bounds()); 474 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa ce().bounds());
475 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 475 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { 550 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> {
551 protected: 551 protected:
552 OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<T ypes>(opaqueLayers) {} 552 OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<T ypes>(opaqueLayers) {}
553 void runMyTest() 553 void runMyTest()
554 { 554 {
555 WebTransformationMatrix layerTransform; 555 WebTransformationMatrix layerTransform;
556 layerTransform.translate(250, 250); 556 layerTransform.translate(250, 250);
557 layerTransform.rotate(90); 557 layerTransform.rotate(90);
558 layerTransform.translate(-250, -250); 558 layerTransform.translate(-250, -250);
559 559
560 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 560 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
561 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); 561 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
562 this->calcDrawEtc(parent); 562 this->calcDrawEtc(parent);
563 563
564 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 564 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
565 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 565 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
566 566
567 this->visitLayer(layer, occlusion); 567 this->visitLayer(layer, occlusion);
568 this->enterLayer(parent, occlusion); 568 this->enterLayer(parent, occlusion);
569 569
570 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa ce().bounds()); 570 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa ce().bounds());
571 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 571 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 30 matching lines...) Expand all
602 602
603 template<class Types> 603 template<class Types>
604 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { 604 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> {
605 protected: 605 protected:
606 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {} 606 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {}
607 void runMyTest() 607 void runMyTest()
608 { 608 {
609 WebTransformationMatrix layerTransform; 609 WebTransformationMatrix layerTransform;
610 layerTransform.translate(20, 20); 610 layerTransform.translate(20, 20);
611 611
612 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 612 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
613 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); 613 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
614 this->calcDrawEtc(parent); 614 this->calcDrawEtc(parent);
615 615
616 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 616 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
617 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 617 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
618 618
619 this->visitLayer(layer, occlusion); 619 this->visitLayer(layer, occlusion);
620 this->enterLayer(parent, occlusion); 620 this->enterLayer(parent, occlusion);
621 621
622 EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInScreenSpa ce().bounds()); 622 EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInScreenSpa ce().bounds());
623 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 623 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type s> { 668 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type s> {
669 protected: 669 protected:
670 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {} 670 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {}
671 void runMyTest() 671 void runMyTest()
672 { 672 {
673 WebTransformationMatrix childTransform; 673 WebTransformationMatrix childTransform;
674 childTransform.translate(250, 250); 674 childTransform.translate(250, 250);
675 childTransform.rotate(90); 675 childTransform.rotate(90);
676 childTransform.translate(-250, -250); 676 childTransform.translate(-250, -250);
677 677
678 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 678 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
679 parent->setMasksToBounds(true); 679 parent->setMasksToBounds(true);
680 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), IntSize(500, 500)); 680 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), gfx::Size(500, 500));
681 child->setMasksToBounds(true); 681 child->setMasksToBounds(true);
682 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); 682 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
683 this->calcDrawEtc(parent); 683 this->calcDrawEtc(parent);
684 684
685 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 685 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
686 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 686 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
687 687
688 this->visitLayer(layer, occlusion); 688 this->visitLayer(layer, occlusion);
689 this->enterContributingSurface(child, occlusion); 689 this->enterContributingSurface(child, occlusion);
690 690
691 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa ce().bounds()); 691 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa ce().bounds());
692 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 692 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest<Type s> { 788 class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest<Type s> {
789 protected: 789 protected:
790 OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {} 790 OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {}
791 void runMyTest() 791 void runMyTest()
792 { 792 {
793 WebTransformationMatrix childTransform; 793 WebTransformationMatrix childTransform;
794 childTransform.translate(250, 250); 794 childTransform.translate(250, 250);
795 childTransform.rotate(90); 795 childTransform.rotate(90);
796 childTransform.translate(-250, -250); 796 childTransform.translate(-250, -250);
797 797
798 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 798 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
799 parent->setMasksToBounds(true); 799 parent->setMasksToBounds(true);
800 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), IntSize(500, 500)); 800 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), gfx::Size(500, 500));
801 child->setMasksToBounds(true); 801 child->setMasksToBounds(true);
802 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); 802 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
803 // |child2| makes |parent|'s surface get considered by OcclusionTracker first, instead of |child|'s. This exercises different code in 803 // |child2| makes |parent|'s surface get considered by OcclusionTracker first, instead of |child|'s. This exercises different code in
804 // leaveToTargetRenderSurface, as the target surface has already been se en. 804 // leaveToTargetRenderSurface, as the target surface has already been se en.
805 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true); 805 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, this->identityMatrix, FloatPoint(30, 30), gfx::Size(60, 20), true);
806 this->calcDrawEtc(parent); 806 this->calcDrawEtc(parent);
807 807
808 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 808 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
809 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000)); 809 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000));
810 810
811 this->visitLayer(child2, occlusion); 811 this->visitLayer(child2, occlusion);
812 812
813 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInScreenSpa ce().bounds()); 813 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInScreenSpa ce().bounds());
814 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 814 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
815 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInTargetSur face().bounds()); 815 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
904 void runMyTest() 904 void runMyTest()
905 { 905 {
906 WebTransformationMatrix childTransform; 906 WebTransformationMatrix childTransform;
907 childTransform.translate(250, 250); 907 childTransform.translate(250, 250);
908 childTransform.rotate(95); 908 childTransform.rotate(95);
909 childTransform.translate(-250, -250); 909 childTransform.translate(-250, -250);
910 910
911 WebTransformationMatrix layerTransform; 911 WebTransformationMatrix layerTransform;
912 layerTransform.translate(10, 10); 912 layerTransform.translate(10, 10);
913 913
914 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 914 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
915 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), IntSize(500, 500)); 915 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), gfx::Size(500, 500));
916 child->setMasksToBounds(true); 916 child->setMasksToBounds(true);
917 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , layerTransform, FloatPoint(0, 0), IntSize(500, 500), true); 917 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , layerTransform, FloatPoint(0, 0), gfx::Size(500, 500), true);
918 this->calcDrawEtc(parent); 918 this->calcDrawEtc(parent);
919 919
920 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 920 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
921 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 921 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
922 922
923 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect()); 923 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect());
924 924
925 this->visitLayer(layer, occlusion); 925 this->visitLayer(layer, occlusion);
926 this->enterContributingSurface(child, occlusion); 926 this->enterContributingSurface(child, occlusion);
927 927
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker Test<Types> { 968 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker Test<Types> {
969 protected: 969 protected:
970 OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {} 970 OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {}
971 void runMyTest() 971 void runMyTest()
972 { 972 {
973 WebTransformationMatrix childTransform; 973 WebTransformationMatrix childTransform;
974 childTransform.translate(250, 250); 974 childTransform.translate(250, 250);
975 childTransform.rotate(90); 975 childTransform.rotate(90);
976 childTransform.translate(-250, -250); 976 childTransform.translate(-250, -250);
977 977
978 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 978 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
979 parent->setMasksToBounds(true); 979 parent->setMasksToBounds(true);
980 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), IntSize(500, 500)); 980 typename Types::LayerType* child = this->createLayer(parent, childTransf orm, FloatPoint(30, 30), gfx::Size(500, 500));
981 child->setMasksToBounds(true); 981 child->setMasksToBounds(true);
982 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); 982 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
983 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true); 983 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d, this->identityMatrix, FloatPoint(10, 450), gfx::Size(500, 60), true);
984 this->calcDrawEtc(parent); 984 this->calcDrawEtc(parent);
985 985
986 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 986 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
987 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 987 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
988 988
989 this->visitLayer(layer2, occlusion); 989 this->visitLayer(layer2, occlusion);
990 this->visitLayer(layer1, occlusion); 990 this->visitLayer(layer1, occlusion);
991 this->enterContributingSurface(child, occlusion); 991 this->enterContributingSurface(child, occlusion);
992 992
993 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa ce().bounds()); 993 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
1058 class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTe st<Types> { 1058 class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTe st<Types> {
1059 protected: 1059 protected:
1060 OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : Occlusio nTrackerTest<Types>(opaqueLayers) {} 1060 OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : Occlusio nTrackerTest<Types>(opaqueLayers) {}
1061 void runMyTest() 1061 void runMyTest()
1062 { 1062 {
1063 WebTransformationMatrix childTransform; 1063 WebTransformationMatrix childTransform;
1064 childTransform.translate(250, 250); 1064 childTransform.translate(250, 250);
1065 childTransform.rotate(90); 1065 childTransform.rotate(90);
1066 childTransform.translate(-250, -250); 1066 childTransform.translate(-250, -250);
1067 1067
1068 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 1068 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
1069 parent->setMasksToBounds(true); 1069 parent->setMasksToBounds(true);
1070 typename Types::LayerType* child1 = this->createSurface(parent, childTra nsform, FloatPoint(30, 30), IntSize(10, 10)); 1070 typename Types::LayerType* child1 = this->createSurface(parent, childTra nsform, FloatPoint(30, 30), gfx::Size(10, 10));
1071 typename Types::LayerType* child2 = this->createSurface(parent, childTra nsform, FloatPoint(20, 40), IntSize(10, 10)); 1071 typename Types::LayerType* child2 = this->createSurface(parent, childTra nsform, FloatPoint(20, 40), gfx::Size(10, 10));
1072 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); 1072 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
1073 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); 1073 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
1074 this->calcDrawEtc(parent); 1074 this->calcDrawEtc(parent);
1075 1075
1076 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1076 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1077 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000)); 1077 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000));
1078 1078
1079 this->visitLayer(layer2, occlusion); 1079 this->visitLayer(layer2, occlusion);
1080 this->enterContributingSurface(child2, occlusion); 1080 this->enterContributingSurface(child2, occlusion);
1081 1081
1082 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa ce().bounds()); 1082 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa ce().bounds());
1083 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1083 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 WebTransformationMatrix child1Transform; 1174 WebTransformationMatrix child1Transform;
1175 child1Transform.translate(250, 250); 1175 child1Transform.translate(250, 250);
1176 child1Transform.rotate(-90); 1176 child1Transform.rotate(-90);
1177 child1Transform.translate(-250, -250); 1177 child1Transform.translate(-250, -250);
1178 1178
1179 WebTransformationMatrix child2Transform; 1179 WebTransformationMatrix child2Transform;
1180 child2Transform.translate(250, 250); 1180 child2Transform.translate(250, 250);
1181 child2Transform.rotate(90); 1181 child2Transform.rotate(90);
1182 child2Transform.translate(-250, -250); 1182 child2Transform.translate(-250, -250);
1183 1183
1184 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 1184 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
1185 parent->setMasksToBounds(true); 1185 parent->setMasksToBounds(true);
1186 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr ansform, FloatPoint(30, 20), IntSize(10, 10)); 1186 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr ansform, FloatPoint(30, 20), gfx::Size(10, 10));
1187 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c hild2Transform, FloatPoint(20, 40), IntSize(10, 10), false); 1187 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c hild2Transform, FloatPoint(20, 40), gfx::Size(10, 10), false);
1188 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true); 1188 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, FloatPoint(-10, -20), gfx::Size(510, 510), true);
1189 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); 1189 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
1190 this->calcDrawEtc(parent); 1190 this->calcDrawEtc(parent);
1191 1191
1192 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1192 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1193 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000)); 1193 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000));
1194 1194
1195 this->visitLayer(layer2, occlusion); 1195 this->visitLayer(layer2, occlusion);
1196 this->enterLayer(child2, occlusion); 1196 this->enterLayer(child2, occlusion);
1197 1197
1198 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa ce().bounds()); 1198 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa ce().bounds());
1199 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1199 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> { 1278 class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> {
1279 protected: 1279 protected:
1280 OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types> (opaqueLayers) {} 1280 OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types> (opaqueLayers) {}
1281 void runMyTest() 1281 void runMyTest()
1282 { 1282 {
1283 WebTransformationMatrix layerTransform; 1283 WebTransformationMatrix layerTransform;
1284 layerTransform.translate(250, 250); 1284 layerTransform.translate(250, 250);
1285 layerTransform.rotate(90); 1285 layerTransform.rotate(90);
1286 layerTransform.translate(-250, -250); 1286 layerTransform.translate(-250, -250);
1287 1287
1288 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 1288 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
1289 parent->setMasksToBounds(true); 1289 parent->setMasksToBounds(true);
1290 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p arent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); 1290 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p arent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
1291 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer (parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); 1291 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer (parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
1292 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye r(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); 1292 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye r(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
1293 1293
1294 WebFilterOperations filters; 1294 WebFilterOperations filters;
1295 filters.append(WebFilterOperation::createBlurFilter(10)); 1295 filters.append(WebFilterOperation::createBlurFilter(10));
1296 blurLayer->setFilters(filters); 1296 blurLayer->setFilters(filters);
1297 1297
1298 filters.clear(); 1298 filters.clear();
1299 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); 1299 filters.append(WebFilterOperation::createGrayscaleFilter(0.5));
1300 opaqueLayer->setFilters(filters); 1300 opaqueLayer->setFilters(filters);
1301 1301
1302 filters.clear(); 1302 filters.clear();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 }; 1358 };
1359 1359
1360 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters); 1360 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters);
1361 1361
1362 template<class Types> 1362 template<class Types>
1363 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types > { 1363 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types > {
1364 protected: 1364 protected:
1365 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker Test<Types>(opaqueLayers) {} 1365 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker Test<Types>(opaqueLayers) {}
1366 void runMyTest() 1366 void runMyTest()
1367 { 1367 {
1368 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 1368 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
1369 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); 1369 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
1370 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5 0), IntSize()); 1370 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5 0), gfx::Size());
1371 this->calcDrawEtc(parent); 1371 this->calcDrawEtc(parent);
1372 1372
1373 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1373 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1374 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1374 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1375 1375
1376 this->visitLayer(surface, occlusion); 1376 this->visitLayer(surface, occlusion);
1377 1377
1378 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds()); 1378 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds());
1379 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1379 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1380 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds()); 1380 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds());
1381 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 1381 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
1382 1382
1383 this->visitContributingSurface(surface, occlusion); 1383 this->visitContributingSurface(surface, occlusion);
1384 this->enterLayer(parent, occlusion); 1384 this->enterLayer(parent, occlusion);
1385 1385
1386 // The surface and replica should both be occluding the parent. 1386 // The surface and replica should both be occluding the parent.
1387 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetS urface().bounds()); 1387 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetS urface().bounds());
1388 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); 1388 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
1389 } 1389 }
1390 }; 1390 };
1391 1391
1392 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); 1392 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude);
1393 1393
1394 template<class Types> 1394 template<class Types>
1395 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type s> { 1395 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type s> {
1396 protected: 1396 protected:
1397 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {} 1397 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {}
1398 void runMyTest() 1398 void runMyTest()
1399 { 1399 {
1400 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 170)); 1400 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 170));
1401 parent->setMasksToBounds(true); 1401 parent->setMasksToBounds(true);
1402 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); 1402 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
1403 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5 0), IntSize()); 1403 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5 0), gfx::Size());
1404 this->calcDrawEtc(parent); 1404 this->calcDrawEtc(parent);
1405 1405
1406 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1406 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1407 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1407 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1408 1408
1409 this->visitLayer(surface, occlusion); 1409 this->visitLayer(surface, occlusion);
1410 1410
1411 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds()); 1411 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds());
1412 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1412 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1413 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds()); 1413 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds());
1414 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 1414 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
1415 1415
1416 this->visitContributingSurface(surface, occlusion); 1416 this->visitContributingSurface(surface, occlusion);
1417 this->enterLayer(parent, occlusion); 1417 this->enterLayer(parent, occlusion);
1418 1418
1419 // The surface and replica should both be occluding the parent. 1419 // The surface and replica should both be occluding the parent.
1420 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 70), occlusion.occlusionInTargetSu rface().bounds()); 1420 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 70), occlusion.occlusionInTargetSu rface().bounds());
1421 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); 1421 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
1422 } 1422 }
1423 }; 1423 };
1424 1424
1425 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); 1425 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping);
1426 1426
1427 template<class Types> 1427 template<class Types>
1428 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { 1428 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> {
1429 protected: 1429 protected:
1430 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {} 1430 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {}
1431 void runMyTest() 1431 void runMyTest()
1432 { 1432 {
1433 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 1433 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
1434 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); 1434 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
1435 typename Types::LayerType* replica = this->createReplicaLayer(surface, t his->identityMatrix, FloatPoint(50, 50), IntSize()); 1435 typename Types::LayerType* replica = this->createReplicaLayer(surface, t his->identityMatrix, FloatPoint(50, 50), gfx::Size());
1436 this->createMaskLayer(replica, IntSize(10, 10)); 1436 this->createMaskLayer(replica, gfx::Size(10, 10));
1437 this->calcDrawEtc(parent); 1437 this->calcDrawEtc(parent);
1438 1438
1439 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1439 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1440 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1440 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1441 1441
1442 this->visitLayer(surface, occlusion); 1442 this->visitLayer(surface, occlusion);
1443 1443
1444 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds()); 1444 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa ce().bounds());
1445 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1445 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1446 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds()); 1446 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa ce().bounds());
1447 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 1447 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
1448 1448
1449 this->visitContributingSurface(surface, occlusion); 1449 this->visitContributingSurface(surface, occlusion);
1450 this->enterLayer(parent, occlusion); 1450 this->enterLayer(parent, occlusion);
1451 1451
1452 // The replica should not be occluding the parent, since it has a mask a pplied to it. 1452 // The replica should not be occluding the parent, since it has a mask a pplied to it.
1453 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInTargetSur face().bounds()); 1453 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInTargetSur face().bounds());
1454 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 1454 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
1455 } 1455 }
1456 }; 1456 };
1457 1457
1458 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); 1458 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask);
1459 1459
1460 template<class Types> 1460 template<class Types>
1461 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes t<Types> { 1461 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes t<Types> {
1462 protected: 1462 protected:
1463 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion TrackerTest<Types>(opaqueLayers) {} 1463 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion TrackerTest<Types>(opaqueLayers) {}
1464 void runMyTest() 1464 void runMyTest()
1465 { 1465 {
1466 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1466 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1467 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1467 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1468 this->calcDrawEtc(parent); 1468 this->calcDrawEtc(parent);
1469 1469
1470 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1470 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1471 occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100)); 1471 occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100));
1472 1472
1473 this->enterLayer(layer, occlusion); 1473 this->enterLayer(layer, occlusion);
1474 1474
1475 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); 1475 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
1476 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ; 1476 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ;
1477 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ; 1477 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ;
(...skipping 23 matching lines...) Expand all
1501 }; 1501 };
1502 1502
1503 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild); 1503 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild);
1504 1504
1505 template<class Types> 1505 template<class Types>
1506 class OcclusionTrackerTestViewportRectOutsideChild : public OcclusionTrackerTest <Types> { 1506 class OcclusionTrackerTestViewportRectOutsideChild : public OcclusionTrackerTest <Types> {
1507 protected: 1507 protected:
1508 OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionT rackerTest<Types>(opaqueLayers) {} 1508 OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionT rackerTest<Types>(opaqueLayers) {}
1509 void runMyTest() 1509 void runMyTest()
1510 { 1510 {
1511 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1511 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1512 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1512 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1513 this->calcDrawEtc(parent); 1513 this->calcDrawEtc(parent);
1514 1514
1515 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(200, 100, 100, 100)); 1515 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(200, 100, 100, 100));
1516 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1516 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1517 1517
1518 this->enterLayer(layer, occlusion); 1518 this->enterLayer(layer, occlusion);
1519 1519
1520 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); 1520 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
1521 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ; 1521 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ;
1522 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ; 1522 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ;
(...skipping 23 matching lines...) Expand all
1546 }; 1546 };
1547 1547
1548 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); 1548 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild);
1549 1549
1550 template<class Types> 1550 template<class Types>
1551 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T ypes> { 1551 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T ypes> {
1552 protected: 1552 protected:
1553 OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTra ckerTest<Types>(opaqueLayers) {} 1553 OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTra ckerTest<Types>(opaqueLayers) {}
1554 void runMyTest() 1554 void runMyTest()
1555 { 1555 {
1556 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1556 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1557 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1557 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1558 this->calcDrawEtc(parent); 1558 this->calcDrawEtc(parent);
1559 1559
1560 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1560 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1561 occlusion.setLayerClipRect(gfx::Rect(100, 100, 100, 100)); 1561 occlusion.setLayerClipRect(gfx::Rect(100, 100, 100, 100));
1562 1562
1563 this->enterLayer(layer, occlusion); 1563 this->enterLayer(layer, occlusion);
1564 1564
1565 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); 1565 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
1566 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ; 1566 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ;
1567 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ; 1567 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ;
(...skipping 18 matching lines...) Expand all
1586 }; 1586 };
1587 1587
1588 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild); 1588 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild);
1589 1589
1590 template<class Types> 1590 template<class Types>
1591 class OcclusionTrackerTestViewportRectOverChild : public OcclusionTrackerTest<Ty pes> { 1591 class OcclusionTrackerTestViewportRectOverChild : public OcclusionTrackerTest<Ty pes> {
1592 protected: 1592 protected:
1593 OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrac kerTest<Types>(opaqueLayers) {} 1593 OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrac kerTest<Types>(opaqueLayers) {}
1594 void runMyTest() 1594 void runMyTest()
1595 { 1595 {
1596 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1596 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1597 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1597 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1598 this->calcDrawEtc(parent); 1598 this->calcDrawEtc(parent);
1599 1599
1600 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100)); 1600 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100));
1601 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1601 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1602 1602
1603 this->enterLayer(layer, occlusion); 1603 this->enterLayer(layer, occlusion);
1604 1604
1605 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); 1605 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
1606 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ; 1606 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ;
1607 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ; 1607 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ;
(...skipping 18 matching lines...) Expand all
1626 }; 1626 };
1627 1627
1628 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); 1628 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild);
1629 1629
1630 template<class Types> 1630 template<class Types>
1631 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker Test<Types> { 1631 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker Test<Types> {
1632 protected: 1632 protected:
1633 OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {} 1633 OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {}
1634 void runMyTest() 1634 void runMyTest()
1635 { 1635 {
1636 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1636 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1637 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1637 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1638 this->calcDrawEtc(parent); 1638 this->calcDrawEtc(parent);
1639 1639
1640 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1640 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1641 occlusion.setLayerClipRect(gfx::Rect(50, 50, 200, 200)); 1641 occlusion.setLayerClipRect(gfx::Rect(50, 50, 200, 200));
1642 1642
1643 this->enterLayer(layer, occlusion); 1643 this->enterLayer(layer, occlusion);
1644 1644
1645 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); 1645 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
1646 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)) ); 1646 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)) );
1647 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)) ); 1647 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)) );
(...skipping 22 matching lines...) Expand all
1670 }; 1670 };
1671 1671
1672 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild); 1672 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild);
1673 1673
1674 template<class Types> 1674 template<class Types>
1675 class OcclusionTrackerTestViewportRectPartlyOverChild : public OcclusionTrackerT est<Types> { 1675 class OcclusionTrackerTestViewportRectPartlyOverChild : public OcclusionTrackerT est<Types> {
1676 protected: 1676 protected:
1677 OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : Occlusi onTrackerTest<Types>(opaqueLayers) {} 1677 OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : Occlusi onTrackerTest<Types>(opaqueLayers) {}
1678 void runMyTest() 1678 void runMyTest()
1679 { 1679 {
1680 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1680 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1681 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1681 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1682 this->calcDrawEtc(parent); 1682 this->calcDrawEtc(parent);
1683 1683
1684 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200)); 1684 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200));
1685 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1685 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1686 1686
1687 this->enterLayer(layer, occlusion); 1687 this->enterLayer(layer, occlusion);
1688 1688
1689 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); 1689 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
1690 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)) ); 1690 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)) );
1691 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)) ); 1691 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)) );
(...skipping 22 matching lines...) Expand all
1714 }; 1714 };
1715 1715
1716 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild); 1716 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild);
1717 1717
1718 template<class Types> 1718 template<class Types>
1719 class OcclusionTrackerTestLayerClipRectOverNothing : public OcclusionTrackerTest <Types> { 1719 class OcclusionTrackerTestLayerClipRectOverNothing : public OcclusionTrackerTest <Types> {
1720 protected: 1720 protected:
1721 OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionT rackerTest<Types>(opaqueLayers) {} 1721 OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionT rackerTest<Types>(opaqueLayers) {}
1722 void runMyTest() 1722 void runMyTest()
1723 { 1723 {
1724 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1724 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1725 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1725 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1726 this->calcDrawEtc(parent); 1726 this->calcDrawEtc(parent);
1727 1727
1728 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1728 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1729 occlusion.setLayerClipRect(gfx::Rect(500, 500, 100, 100)); 1729 occlusion.setLayerClipRect(gfx::Rect(500, 500, 100, 100));
1730 1730
1731 this->enterLayer(layer, occlusion); 1731 this->enterLayer(layer, occlusion);
1732 1732
1733 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); 1733 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
1734 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ; 1734 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ;
1735 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ; 1735 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ;
(...skipping 22 matching lines...) Expand all
1758 }; 1758 };
1759 1759
1760 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverNothing); 1760 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverNothing);
1761 1761
1762 template<class Types> 1762 template<class Types>
1763 class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest< Types> { 1763 class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest< Types> {
1764 protected: 1764 protected:
1765 OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTr ackerTest<Types>(opaqueLayers) {} 1765 OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTr ackerTest<Types>(opaqueLayers) {}
1766 void runMyTest() 1766 void runMyTest()
1767 { 1767 {
1768 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1768 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1769 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1769 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1770 this->calcDrawEtc(parent); 1770 this->calcDrawEtc(parent);
1771 1771
1772 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100)); 1772 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100));
1773 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1773 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1774 1774
1775 this->enterLayer(layer, occlusion); 1775 this->enterLayer(layer, occlusion);
1776 1776
1777 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); 1777 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
1778 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ; 1778 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))) ;
1779 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ; 1779 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))) ;
(...skipping 22 matching lines...) Expand all
1802 }; 1802 };
1803 1803
1804 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverNothing); 1804 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverNothing);
1805 1805
1806 template<class Types> 1806 template<class Types>
1807 class OcclusionTrackerTestLayerClipRectForLayerOffOrigin : public OcclusionTrack erTest<Types> { 1807 class OcclusionTrackerTestLayerClipRectForLayerOffOrigin : public OcclusionTrack erTest<Types> {
1808 protected: 1808 protected:
1809 OcclusionTrackerTestLayerClipRectForLayerOffOrigin(bool opaqueLayers) : Occl usionTrackerTest<Types>(opaqueLayers) {} 1809 OcclusionTrackerTestLayerClipRectForLayerOffOrigin(bool opaqueLayers) : Occl usionTrackerTest<Types>(opaqueLayers) {}
1810 void runMyTest() 1810 void runMyTest()
1811 { 1811 {
1812 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1812 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1813 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); 1813 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
1814 this->calcDrawEtc(parent); 1814 this->calcDrawEtc(parent);
1815 1815
1816 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1816 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1817 this->enterLayer(layer, occlusion); 1817 this->enterLayer(layer, occlusion);
1818 1818
1819 // This layer is translated when drawn into its target. So if the clip r ect given from the target surface 1819 // This layer is translated when drawn into its target. So if the clip r ect given from the target surface
1820 // is not in that target space, then after translating these query rects into the target, they will fall outside 1820 // is not in that target space, then after translating these query rects into the target, they will fall outside
1821 // the clip and be considered occluded. 1821 // the clip and be considered occluded.
1822 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); 1822 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
1823 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)) ); 1823 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)) );
1824 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)) ); 1824 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)) );
1825 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100 ))); 1825 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100 )));
1826 } 1826 }
1827 }; 1827 };
1828 1828
1829 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectForLayerOffOrigin); 1829 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectForLayerOffOrigin);
1830 1830
1831 template<class Types> 1831 template<class Types>
1832 class OcclusionTrackerTestOpaqueContentsRegionEmpty : public OcclusionTrackerTes t<Types> { 1832 class OcclusionTrackerTestOpaqueContentsRegionEmpty : public OcclusionTrackerTes t<Types> {
1833 protected: 1833 protected:
1834 OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaqueLayers) : Occlusion TrackerTest<Types>(opaqueLayers) {} 1834 OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaqueLayers) : Occlusion TrackerTest<Types>(opaqueLayers) {}
1835 void runMyTest() 1835 void runMyTest()
1836 { 1836 {
1837 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1837 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1838 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false); 1838 typename Types::ContentLayerType* layer = this->createDrawingSurface(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), false);
1839 this->calcDrawEtc(parent); 1839 this->calcDrawEtc(parent);
1840 1840
1841 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1841 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1842 this->enterLayer(layer, occlusion); 1842 this->enterLayer(layer, occlusion);
1843 1843
1844 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); 1844 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
1845 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)) ); 1845 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)) );
1846 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)) ); 1846 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)) );
1847 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100 ))); 1847 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100 )));
1848 1848
(...skipping 15 matching lines...) Expand all
1864 }; 1864 };
1865 1865
1866 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); 1866 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty);
1867 1867
1868 template<class Types> 1868 template<class Types>
1869 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker Test<Types> { 1869 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker Test<Types> {
1870 protected: 1870 protected:
1871 OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {} 1871 OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {}
1872 void runMyTest() 1872 void runMyTest()
1873 { 1873 {
1874 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1874 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1875 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(100, 100), IntSize(200, 200), false); 1875 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(100, 100), gfx::Size(200, 200), false);
1876 this->calcDrawEtc(parent); 1876 this->calcDrawEtc(parent);
1877 1877
1878 { 1878 {
1879 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1879 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1880 layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100)); 1880 layer->setOpaqueContentsRect(gfx::Rect(0, 0, 100, 100));
1881 1881
1882 this->resetLayerIterator(); 1882 this->resetLayerIterator();
1883 this->visitLayer(layer, occlusion); 1883 this->visitLayer(layer, occlusion);
1884 this->enterLayer(parent, occlusion); 1884 this->enterLayer(parent, occlusion);
1885 1885
1886 EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInS creenSpace().bounds()); 1886 EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInS creenSpace().bounds());
1887 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1887 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1888 1888
1889 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))); 1889 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
1890 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100))); 1890 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
1891 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100 , 100))); 1891 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100 , 100)));
1892 } 1892 }
1893 1893
1894 { 1894 {
1895 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1895 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1896 layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180)); 1896 layer->setOpaqueContentsRect(gfx::Rect(20, 20, 180, 180));
1897 1897
1898 this->resetLayerIterator(); 1898 this->resetLayerIterator();
1899 this->visitLayer(layer, occlusion); 1899 this->visitLayer(layer, occlusion);
1900 this->enterLayer(parent, occlusion); 1900 this->enterLayer(parent, occlusion);
1901 1901
1902 EXPECT_RECT_EQ(gfx::Rect(120, 120, 180, 180), occlusion.occlusionInS creenSpace().bounds()); 1902 EXPECT_RECT_EQ(gfx::Rect(120, 120, 180, 180), occlusion.occlusionInS creenSpace().bounds());
1903 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1903 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1904 1904
1905 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))); 1905 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
1906 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100 , 100))); 1906 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100 , 100)));
1907 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100))); 1907 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
1908 } 1908 }
1909 1909
1910 { 1910 {
1911 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1911 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1912 layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100)); 1912 layer->setOpaqueContentsRect(gfx::Rect(150, 150, 100, 100));
1913 1913
1914 this->resetLayerIterator(); 1914 this->resetLayerIterator();
1915 this->visitLayer(layer, occlusion); 1915 this->visitLayer(layer, occlusion);
1916 this->enterLayer(parent, occlusion); 1916 this->enterLayer(parent, occlusion);
1917 1917
1918 EXPECT_RECT_EQ(gfx::Rect(250, 250, 50, 50), occlusion.occlusionInScr eenSpace().bounds()); 1918 EXPECT_RECT_EQ(gfx::Rect(250, 250, 50, 50), occlusion.occlusionInScr eenSpace().bounds());
1919 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 1919 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
1920 1920
1921 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))); 1921 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
1922 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100 , 100))); 1922 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100 , 100)));
1923 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100 , 100))); 1923 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100 , 100)));
1924 } 1924 }
1925 } 1925 }
1926 }; 1926 };
1927 1927
1928 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty); 1928 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty);
1929 1929
1930 template<class Types> 1930 template<class Types>
1931 class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> { 1931 class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> {
1932 protected: 1932 protected:
1933 OcclusionTrackerTest3dTransform(bool opaqueLayers) : OcclusionTrackerTest<Ty pes>(opaqueLayers) {} 1933 OcclusionTrackerTest3dTransform(bool opaqueLayers) : OcclusionTrackerTest<Ty pes>(opaqueLayers) {}
1934 void runMyTest() 1934 void runMyTest()
1935 { 1935 {
1936 WebTransformationMatrix transform; 1936 WebTransformationMatrix transform;
1937 transform.rotate3d(0, 30, 0); 1937 transform.rotate3d(0, 30, 0);
1938 1938
1939 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1939 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1940 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1940 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1941 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); 1941 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(100, 100), gfx::Size(200, 200), true);
1942 this->calcDrawEtc(parent); 1942 this->calcDrawEtc(parent);
1943 1943
1944 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1944 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1945 this->enterLayer(layer, occlusion); 1945 this->enterLayer(layer, occlusion);
1946 1946
1947 // The layer is rotated in 3d but without preserving 3d, so it only gets resized. 1947 // The layer is rotated in 3d but without preserving 3d, so it only gets resized.
1948 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte ntRect(layer, gfx::Rect(0, 0, 200, 200))); 1948 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte ntRect(layer, gfx::Rect(0, 0, 200, 200)));
1949 } 1949 }
1950 }; 1950 };
1951 1951
(...skipping 10 matching lines...) Expand all
1962 // Because of this, the occlusion tracker cannot assume that a 3d layer occludes 1962 // Because of this, the occlusion tracker cannot assume that a 3d layer occludes
1963 // other layers that have not yet been iterated over. For now, the expec ted 1963 // other layers that have not yet been iterated over. For now, the expec ted
1964 // behavior is that a 3d layer simply does not add any occlusion to the occlusion 1964 // behavior is that a 3d layer simply does not add any occlusion to the occlusion
1965 // tracker. 1965 // tracker.
1966 1966
1967 WebTransformationMatrix translationToFront; 1967 WebTransformationMatrix translationToFront;
1968 translationToFront.translate3d(0, 0, -10); 1968 translationToFront.translate3d(0, 0, -10);
1969 WebTransformationMatrix translationToBack; 1969 WebTransformationMatrix translationToBack;
1970 translationToFront.translate3d(0, 0, -100); 1970 translationToFront.translate3d(0, 0, -100);
1971 1971
1972 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 1972 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
1973 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare nt, translationToBack, FloatPoint(0, 0), IntSize(100, 100), true); 1973 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare nt, translationToBack, FloatPoint(0, 0), gfx::Size(100, 100), true);
1974 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, translationToFront, FloatPoint(50, 50), IntSize(100, 100), true); 1974 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, translationToFront, FloatPoint(50, 50), gfx::Size(100, 100), true);
1975 parent->setPreserves3D(true); 1975 parent->setPreserves3D(true);
1976 1976
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 this->visitLayer(child2, occlusion); 1980 this->visitLayer(child2, occlusion);
1981 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); 1981 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
1982 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); 1982 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
1983 1983
1984 this->visitLayer(child1, occlusion); 1984 this->visitLayer(child1, occlusion);
(...skipping 10 matching lines...) Expand all
1995 protected: 1995 protected:
1996 OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrack erTest<Types>(opaqueLayers) {} 1996 OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrack erTest<Types>(opaqueLayers) {}
1997 void runMyTest() 1997 void runMyTest()
1998 { 1998 {
1999 WebTransformationMatrix transform; 1999 WebTransformationMatrix transform;
2000 transform.translate(150, 150); 2000 transform.translate(150, 150);
2001 transform.applyPerspective(400); 2001 transform.applyPerspective(400);
2002 transform.rotate3d(1, 0, 0, -30); 2002 transform.rotate3d(1, 0, 0, -30);
2003 transform.translate(-150, -150); 2003 transform.translate(-150, -150);
2004 2004
2005 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 2005 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
2006 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); 2006 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
2007 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); 2007 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(100, 100), gfx::Size(200, 200), true);
2008 container->setPreserves3D(true); 2008 container->setPreserves3D(true);
2009 layer->setPreserves3D(true); 2009 layer->setPreserves3D(true);
2010 this->calcDrawEtc(parent); 2010 this->calcDrawEtc(parent);
2011 2011
2012 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2012 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2013 this->enterLayer(layer, occlusion); 2013 this->enterLayer(layer, occlusion);
2014 2014
2015 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte ntRect(layer, gfx::Rect(0, 0, 200, 200))); 2015 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte ntRect(layer, gfx::Rect(0, 0, 200, 200)));
2016 } 2016 }
2017 }; 2017 };
2018 2018
2019 // 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. 2019 // 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.
2020 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransform); 2020 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransform);
2021 2021
2022 template<class Types> 2022 template<class Types>
2023 class OcclusionTrackerTestPerspectiveTransformBehindCamera : public OcclusionTra ckerTest<Types> { 2023 class OcclusionTrackerTestPerspectiveTransformBehindCamera : public OcclusionTra ckerTest<Types> {
2024 protected: 2024 protected:
2025 OcclusionTrackerTestPerspectiveTransformBehindCamera(bool opaqueLayers) : Oc clusionTrackerTest<Types>(opaqueLayers) {} 2025 OcclusionTrackerTestPerspectiveTransformBehindCamera(bool opaqueLayers) : Oc clusionTrackerTest<Types>(opaqueLayers) {}
2026 void runMyTest() 2026 void runMyTest()
2027 { 2027 {
2028 // This test is based on the platform/chromium/compositing/3d-corners.ht ml layout test. 2028 // This test is based on the platform/chromium/compositing/3d-corners.ht ml layout test.
2029 WebTransformationMatrix transform; 2029 WebTransformationMatrix transform;
2030 transform.translate(250, 50); 2030 transform.translate(250, 50);
2031 transform.applyPerspective(10); 2031 transform.applyPerspective(10);
2032 transform.translate(-250, -50); 2032 transform.translate(-250, -50);
2033 transform.translate(250, 50); 2033 transform.translate(250, 50);
2034 transform.rotate3d(1, 0, 0, -167); 2034 transform.rotate3d(1, 0, 0, -167);
2035 transform.translate(-250, -50); 2035 transform.translate(-250, -50);
2036 2036
2037 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(500, 100)); 2037 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(500, 100));
2038 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), IntSize(500, 500)); 2038 typename Types::LayerType* container = this->createLayer(parent, this->i dentityMatrix, FloatPoint(0, 0), gfx::Size(500, 500));
2039 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(0, 0), IntSize(500, 500), true); 2039 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta iner, transform, FloatPoint(0, 0), gfx::Size(500, 500), true);
2040 container->setPreserves3D(true); 2040 container->setPreserves3D(true);
2041 layer->setPreserves3D(true); 2041 layer->setPreserves3D(true);
2042 this->calcDrawEtc(parent); 2042 this->calcDrawEtc(parent);
2043 2043
2044 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2044 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2045 this->enterLayer(layer, occlusion); 2045 this->enterLayer(layer, occlusion);
2046 2046
2047 // The bottom 11 pixel rows of this layer remain visible inside the cont ainer, after translation to the target surface. When translated back, 2047 // The bottom 11 pixel rows of this layer remain visible inside the cont ainer, after translation to the target surface. When translated back,
2048 // this will include many more pixels but must include at least the bott om 11 rows. 2048 // this will include many more pixels but must include at least the bott om 11 rows.
2049 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0, 500, 500)).Contains(gfx::Rect(0, 489, 500, 11))); 2049 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0, 500, 500)).Contains(gfx::Rect(0, 489, 500, 11)));
2050 } 2050 }
2051 }; 2051 };
2052 2052
2053 // 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. 2053 // 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.
2054 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); 2054 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera);
2055 2055
2056 template<class Types> 2056 template<class Types>
2057 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac kerTest<Types> { 2057 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac kerTest<Types> {
2058 protected: 2058 protected:
2059 OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : Occ lusionTrackerTest<Types>(opaqueLayers) {} 2059 OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : Occ lusionTrackerTest<Types>(opaqueLayers) {}
2060 void runMyTest() 2060 void runMyTest()
2061 { 2061 {
2062 WebTransformationMatrix transform; 2062 WebTransformationMatrix transform;
2063 transform.translate(50, 50); 2063 transform.translate(50, 50);
2064 transform.applyPerspective(100); 2064 transform.applyPerspective(100);
2065 transform.translate3d(0, 0, 110); 2065 transform.translate3d(0, 0, 110);
2066 transform.translate(-50, -50); 2066 transform.translate(-50, -50);
2067 2067
2068 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 2068 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
2069 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, transform, FloatPoint(0, 0), IntSize(100, 100), true); 2069 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, transform, FloatPoint(0, 0), gfx::Size(100, 100), true);
2070 parent->setPreserves3D(true); 2070 parent->setPreserves3D(true);
2071 layer->setPreserves3D(true); 2071 layer->setPreserves3D(true);
2072 this->calcDrawEtc(parent); 2072 this->calcDrawEtc(parent);
2073 2073
2074 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2074 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2075 2075
2076 // The |layer| is entirely behind the camera and should not occlude. 2076 // The |layer| is entirely behind the camera and should not occlude.
2077 this->visitLayer(layer, occlusion); 2077 this->visitLayer(layer, occlusion);
2078 this->enterLayer(parent, occlusion); 2078 this->enterLayer(parent, occlusion);
2079 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); 2079 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
2080 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); 2080 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
2081 } 2081 }
2082 }; 2082 };
2083 2083
2084 // 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. 2084 // 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.
2085 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); 2085 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude);
2086 2086
2087 template<class Types> 2087 template<class Types>
2088 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra ckerTest<Types> { 2088 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra ckerTest<Types> {
2089 protected: 2089 protected:
2090 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc clusionTrackerTest<Types>(opaqueLayers) {} 2090 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc clusionTrackerTest<Types>(opaqueLayers) {}
2091 void runMyTest() 2091 void runMyTest()
2092 { 2092 {
2093 WebTransformationMatrix transform; 2093 WebTransformationMatrix transform;
2094 transform.translate(50, 50); 2094 transform.translate(50, 50);
2095 transform.applyPerspective(100); 2095 transform.applyPerspective(100);
2096 transform.translate3d(0, 0, 99); 2096 transform.translate3d(0, 0, 99);
2097 transform.translate(-50, -50); 2097 transform.translate(-50, -50);
2098 2098
2099 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); 2099 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
2100 parent->setMasksToBounds(true); 2100 parent->setMasksToBounds(true);
2101 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, transform, FloatPoint(0, 0), IntSize(100, 100), true); 2101 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, transform, FloatPoint(0, 0), gfx::Size(100, 100), true);
2102 parent->setPreserves3D(true); 2102 parent->setPreserves3D(true);
2103 layer->setPreserves3D(true); 2103 layer->setPreserves3D(true);
2104 this->calcDrawEtc(parent); 2104 this->calcDrawEtc(parent);
2105 2105
2106 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2106 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2107 2107
2108 // This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect. 2108 // This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect.
2109 // Ensure that those pixels don't occlude things outside the clipRect. 2109 // Ensure that those pixels don't occlude things outside the clipRect.
2110 this->visitLayer(layer, occlusion); 2110 this->visitLayer(layer, occlusion);
2111 this->enterLayer(parent, occlusion); 2111 this->enterLayer(parent, occlusion);
2112 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur face().bounds()); 2112 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur face().bounds());
2113 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 2113 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
2114 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInScreenSpa ce().bounds()); 2114 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInScreenSpa ce().bounds());
2115 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2115 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
2116 } 2116 }
2117 }; 2117 };
2118 2118
2119 // 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. 2119 // 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.
2120 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); 2120 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect);
2121 2121
2122 template<class Types> 2122 template<class Types>
2123 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke rTest<Types> { 2123 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke rTest<Types> {
2124 protected: 2124 protected:
2125 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {} 2125 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {}
2126 void runMyTest() 2126 void runMyTest()
2127 { 2127 {
2128 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 2128 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
2129 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2129 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2130 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2130 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2131 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); 2131 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
2132 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); 2132 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
2133 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false); 2133 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), false);
2134 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true); 2134 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(250, 0), gfx::Size(50, 300), true);
2135 2135
2136 addOpacityTransitionToController(*layer->layerAnimationController(), 10, 0, 1, false); 2136 addOpacityTransitionToController(*layer->layerAnimationController(), 10, 0, 1, false);
2137 addOpacityTransitionToController(*surface->layerAnimationController(), 1 0, 0, 1, false); 2137 addOpacityTransitionToController(*surface->layerAnimationController(), 1 0, 0, 1, false);
2138 this->calcDrawEtc(parent); 2138 this->calcDrawEtc(parent);
2139 2139
2140 EXPECT_TRUE(layer->drawOpacityIsAnimating()); 2140 EXPECT_TRUE(layer->drawOpacityIsAnimating());
2141 EXPECT_FALSE(surface->drawOpacityIsAnimating()); 2141 EXPECT_FALSE(surface->drawOpacityIsAnimating());
2142 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); 2142 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating());
2143 2143
2144 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2144 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
(...skipping 26 matching lines...) Expand all
2171 }; 2171 };
2172 2172
2173 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity1OnMainThread); 2173 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity1OnMainThread);
2174 2174
2175 template<class Types> 2175 template<class Types>
2176 class OcclusionTrackerTestAnimationOpacity0OnMainThread : public OcclusionTracke rTest<Types> { 2176 class OcclusionTrackerTestAnimationOpacity0OnMainThread : public OcclusionTracke rTest<Types> {
2177 protected: 2177 protected:
2178 OcclusionTrackerTestAnimationOpacity0OnMainThread(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {} 2178 OcclusionTrackerTestAnimationOpacity0OnMainThread(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {}
2179 void runMyTest() 2179 void runMyTest()
2180 { 2180 {
2181 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 2181 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
2182 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2182 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2183 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2183 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2184 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); 2184 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
2185 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); 2185 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
2186 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false); 2186 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), false);
2187 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true); 2187 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par ent, this->identityMatrix, FloatPoint(250, 0), gfx::Size(50, 300), true);
2188 2188
2189 addOpacityTransitionToController(*layer->layerAnimationController(), 10, 1, 0, false); 2189 addOpacityTransitionToController(*layer->layerAnimationController(), 10, 1, 0, false);
2190 addOpacityTransitionToController(*surface->layerAnimationController(), 1 0, 1, 0, false); 2190 addOpacityTransitionToController(*surface->layerAnimationController(), 1 0, 1, 0, false);
2191 this->calcDrawEtc(parent); 2191 this->calcDrawEtc(parent);
2192 2192
2193 EXPECT_TRUE(layer->drawOpacityIsAnimating()); 2193 EXPECT_TRUE(layer->drawOpacityIsAnimating());
2194 EXPECT_FALSE(surface->drawOpacityIsAnimating()); 2194 EXPECT_FALSE(surface->drawOpacityIsAnimating());
2195 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); 2195 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating());
2196 2196
2197 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2197 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
(...skipping 26 matching lines...) Expand all
2224 }; 2224 };
2225 2225
2226 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity0OnMainThread); 2226 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity0OnMainThread);
2227 2227
2228 template<class Types> 2228 template<class Types>
2229 class OcclusionTrackerTestAnimationTranslateOnMainThread : public OcclusionTrack erTest<Types> { 2229 class OcclusionTrackerTestAnimationTranslateOnMainThread : public OcclusionTrack erTest<Types> {
2230 protected: 2230 protected:
2231 OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : Occl usionTrackerTest<Types>(opaqueLayers) {} 2231 OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : Occl usionTrackerTest<Types>(opaqueLayers) {}
2232 void runMyTest() 2232 void runMyTest()
2233 { 2233 {
2234 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 2234 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
2235 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2235 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2236 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); 2236 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
2237 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); 2237 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye r(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
2238 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); 2238 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay er(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
2239 typename Types::ContentLayerType* surface2 = this->createDrawingSurface( parent, this->identityMatrix, FloatPoint(0, 0), IntSize(50, 300), true); 2239 typename Types::ContentLayerType* surface2 = this->createDrawingSurface( parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(50, 300), true);
2240 2240
2241 addAnimatedTransformToController(*layer->layerAnimationController(), 10, 30, 0); 2241 addAnimatedTransformToController(*layer->layerAnimationController(), 10, 30, 0);
2242 addAnimatedTransformToController(*surface->layerAnimationController(), 1 0, 30, 0); 2242 addAnimatedTransformToController(*surface->layerAnimationController(), 1 0, 30, 0);
2243 addAnimatedTransformToController(*surfaceChild->layerAnimationController (), 10, 30, 0); 2243 addAnimatedTransformToController(*surfaceChild->layerAnimationController (), 10, 30, 0);
2244 this->calcDrawEtc(parent); 2244 this->calcDrawEtc(parent);
2245 2245
2246 EXPECT_TRUE(layer->drawTransformIsAnimating()); 2246 EXPECT_TRUE(layer->drawTransformIsAnimating());
2247 EXPECT_TRUE(layer->screenSpaceTransformIsAnimating()); 2247 EXPECT_TRUE(layer->screenSpaceTransformIsAnimating());
2248 EXPECT_TRUE(surface->renderSurface()->targetSurfaceTransformsAreAnimatin g()); 2248 EXPECT_TRUE(surface->renderSurface()->targetSurfaceTransformsAreAnimatin g());
2249 EXPECT_TRUE(surface->renderSurface()->screenSpaceTransformsAreAnimating( )); 2249 EXPECT_TRUE(surface->renderSurface()->screenSpaceTransformsAreAnimating( ));
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public OcclusionT rackerTest<Types> { 2322 class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public OcclusionT rackerTest<Types> {
2323 protected: 2323 protected:
2324 OcclusionTrackerTestSurfaceOcclusionTranslatesToParent(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2324 OcclusionTrackerTestSurfaceOcclusionTranslatesToParent(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2325 void runMyTest() 2325 void runMyTest()
2326 { 2326 {
2327 WebTransformationMatrix surfaceTransform; 2327 WebTransformationMatrix surfaceTransform;
2328 surfaceTransform.translate(300, 300); 2328 surfaceTransform.translate(300, 300);
2329 surfaceTransform.scale(2); 2329 surfaceTransform.scale(2);
2330 surfaceTransform.translate(-150, -150); 2330 surfaceTransform.translate(-150, -150);
2331 2331
2332 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(500, 500)); 2332 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(500, 500));
2333 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false); 2333 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, surfaceTransform, FloatPoint(0, 0), gfx::Size(300, 300), false);
2334 typename Types::ContentLayerType* surface2 = this->createDrawingSurface( parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false); 2334 typename Types::ContentLayerType* surface2 = this->createDrawingSurface( parent, this->identityMatrix, FloatPoint(50, 50), gfx::Size(300, 300), false);
2335 surface->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); 2335 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
2336 surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); 2336 surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
2337 this->calcDrawEtc(parent); 2337 this->calcDrawEtc(parent);
2338 2338
2339 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2339 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2340 2340
2341 this->visitLayer(surface2, occlusion); 2341 this->visitLayer(surface2, occlusion);
2342 this->visitContributingSurface(surface2, occlusion); 2342 this->visitContributingSurface(surface2, occlusion);
2343 2343
2344 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInScreenS pace().bounds()); 2344 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInScreenS pace().bounds());
2345 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2345 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
2346 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInTargetS urface().bounds()); 2346 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInTargetS urface().bounds());
(...skipping 14 matching lines...) Expand all
2361 }; 2361 };
2362 2362
2363 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent ); 2363 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent );
2364 2364
2365 template<class Types> 2365 template<class Types>
2366 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus ionTrackerTest<Types> { 2366 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus ionTrackerTest<Types> {
2367 protected: 2367 protected:
2368 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers ) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2368 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers ) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2369 void runMyTest() 2369 void runMyTest()
2370 { 2370 {
2371 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); 2371 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
2372 parent->setMasksToBounds(true); 2372 parent->setMasksToBounds(true);
2373 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false); 2373 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 300), false);
2374 surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200)); 2374 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200));
2375 this->calcDrawEtc(parent); 2375 this->calcDrawEtc(parent);
2376 2376
2377 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2377 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2378 2378
2379 this->visitLayer(surface, occlusion); 2379 this->visitLayer(surface, occlusion);
2380 this->visitContributingSurface(surface, occlusion); 2380 this->visitContributingSurface(surface, occlusion);
2381 2381
2382 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInScreenSpa ce().bounds()); 2382 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInScreenSpa ce().bounds());
2383 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2383 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
2384 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInTargetSur face().bounds()); 2384 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInTargetSur face().bounds());
2385 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 2385 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
2386 } 2386 }
2387 }; 2387 };
2388 2388
2389 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip ping); 2389 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip ping);
2390 2390
2391 template<class Types> 2391 template<class Types>
2392 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> { 2392 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> {
2393 protected: 2393 protected:
2394 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {} 2394 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {}
2395 void runMyTest() 2395 void runMyTest()
2396 { 2396 {
2397 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 2397 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
2398 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); 2398 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
2399 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), IntSize(100, 100)); 2399 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), gfx::Size(100, 100));
2400 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true); 2400 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100), true);
2401 this->calcDrawEtc(parent); 2401 this->calcDrawEtc(parent);
2402 2402
2403 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2403 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2404 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2404 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2405 2405
2406 // |topmost| occludes the replica, but not the surface itself. 2406 // |topmost| occludes the replica, but not the surface itself.
2407 this->visitLayer(topmost, occlusion); 2407 this->visitLayer(topmost, occlusion);
2408 2408
2409 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInScreenS pace().bounds()); 2409 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInScreenS pace().bounds());
2410 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2410 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 15 matching lines...) Expand all
2426 }; 2426 };
2427 2427
2428 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded); 2428 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded);
2429 2429
2430 template<class Types> 2430 template<class Types>
2431 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker Test<Types> { 2431 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker Test<Types> {
2432 protected: 2432 protected:
2433 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {} 2433 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {}
2434 void runMyTest() 2434 void runMyTest()
2435 { 2435 {
2436 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 2436 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
2437 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); 2437 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
2438 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), IntSize(100, 100)); 2438 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), gfx::Size(100, 100));
2439 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true); 2439 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 110), true);
2440 this->calcDrawEtc(parent); 2440 this->calcDrawEtc(parent);
2441 2441
2442 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2442 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2443 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2443 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2444 2444
2445 // |topmost| occludes the surface, but not the entire surface's replica. 2445 // |topmost| occludes the surface, but not the entire surface's replica.
2446 this->visitLayer(topmost, occlusion); 2446 this->visitLayer(topmost, occlusion);
2447 2447
2448 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpa ce().bounds()); 2448 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpa ce().bounds());
2449 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2449 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 16 matching lines...) Expand all
2466 }; 2466 };
2467 2467
2468 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded); 2468 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded);
2469 2469
2470 template<class Types> 2470 template<class Types>
2471 class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public Occlusio nTrackerTest<Types> { 2471 class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public Occlusio nTrackerTest<Types> {
2472 protected: 2472 protected:
2473 OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2473 OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2474 void runMyTest() 2474 void runMyTest()
2475 { 2475 {
2476 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 2476 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
2477 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); 2477 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
2478 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), IntSize(100, 100)); 2478 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10 0), gfx::Size(100, 100));
2479 typename Types::LayerType* overSurface = this->createDrawingLayer(parent , this->identityMatrix, FloatPoint(0, 0), IntSize(40, 100), true); 2479 typename Types::LayerType* overSurface = this->createDrawingLayer(parent , this->identityMatrix, FloatPoint(0, 0), gfx::Size(40, 100), true);
2480 typename Types::LayerType* overReplica = this->createDrawingLayer(parent , this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true); 2480 typename Types::LayerType* overReplica = this->createDrawingLayer(parent , this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 100), true);
2481 this->calcDrawEtc(parent); 2481 this->calcDrawEtc(parent);
2482 2482
2483 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2483 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2484 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2484 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2485 2485
2486 // These occlude the surface and replica differently, so we can test eac h one. 2486 // These occlude the surface and replica differently, so we can test eac h one.
2487 this->visitLayer(overReplica, occlusion); 2487 this->visitLayer(overReplica, occlusion);
2488 this->visitLayer(overSurface, occlusion); 2488 this->visitLayer(overSurface, occlusion);
2489 2489
2490 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInScreenSpac e().bounds()); 2490 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInScreenSpac e().bounds());
(...skipping 19 matching lines...) Expand all
2510 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent ly); 2510 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent ly);
2511 2511
2512 template<class Types> 2512 template<class Types>
2513 class OcclusionTrackerTestSurfaceChildOfSurface : public OcclusionTrackerTest<Ty pes> { 2513 class OcclusionTrackerTestSurfaceChildOfSurface : public OcclusionTrackerTest<Ty pes> {
2514 protected: 2514 protected:
2515 OcclusionTrackerTestSurfaceChildOfSurface(bool opaqueLayers) : OcclusionTrac kerTest<Types>(opaqueLayers) {} 2515 OcclusionTrackerTestSurfaceChildOfSurface(bool opaqueLayers) : OcclusionTrac kerTest<Types>(opaqueLayers) {}
2516 void runMyTest() 2516 void runMyTest()
2517 { 2517 {
2518 // This test verifies that the surface cliprect does not end up empty an d clip away the entire unoccluded rect. 2518 // This test verifies that the surface cliprect does not end up empty an d clip away the entire unoccluded rect.
2519 2519
2520 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 2520 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
2521 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); 2521 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
2522 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, FloatPoint(0, 10), IntSize(100, 50), true); 2522 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, FloatPoint(0, 10), gfx::Size(100, 50), true);
2523 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); 2523 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 50), true);
2524 this->calcDrawEtc(parent); 2524 this->calcDrawEtc(parent);
2525 2525
2526 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000)); 2526 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000));
2527 2527
2528 // |topmost| occludes everything partially so we know occlusion is happe ning at all. 2528 // |topmost| occludes everything partially so we know occlusion is happe ning at all.
2529 this->visitLayer(topmost, occlusion); 2529 this->visitLayer(topmost, occlusion);
2530 2530
2531 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInScreenSpac e().bounds()); 2531 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInScreenSpac e().bounds());
2532 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2532 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
2533 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurf ace().bounds()); 2533 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
2569 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface); 2569 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface);
2570 2570
2571 template<class Types> 2571 template<class Types>
2572 class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public OcclusionTr ackerTest<Types> { 2572 class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public OcclusionTr ackerTest<Types> {
2573 protected: 2573 protected:
2574 OcclusionTrackerTestTopmostSurfaceIsClippedToViewport(bool opaqueLayers) : O cclusionTrackerTest<Types>(opaqueLayers) {} 2574 OcclusionTrackerTestTopmostSurfaceIsClippedToViewport(bool opaqueLayers) : O cclusionTrackerTest<Types>(opaqueLayers) {}
2575 void runMyTest() 2575 void runMyTest()
2576 { 2576 {
2577 // This test verifies that the top-most surface is considered occluded o utside of its target's clipRect and outside the viewport rect. 2577 // This test verifies that the top-most surface is considered occluded o utside of its target's clipRect and outside the viewport rect.
2578 2578
2579 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); 2579 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
2580 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); 2580 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
2581 this->calcDrawEtc(parent); 2581 this->calcDrawEtc(parent);
2582 2582
2583 { 2583 {
2584 // Make a viewport rect that is larger than the root layer. 2584 // Make a viewport rect that is larger than the root layer.
2585 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2585 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2586 2586
2587 this->visitLayer(surface, occlusion); 2587 this->visitLayer(surface, occlusion);
2588 2588
2589 // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect. 2589 // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect.
2590 this->enterContributingSurface(surface, occlusion); 2590 this->enterContributingSurface(surface, occlusion);
(...skipping 18 matching lines...) Expand all
2609 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTopmostSurfaceIsClippedToViewport) ; 2609 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTopmostSurfaceIsClippedToViewport) ;
2610 2610
2611 template<class Types> 2611 template<class Types>
2612 class OcclusionTrackerTestSurfaceChildOfClippingSurface : public OcclusionTracke rTest<Types> { 2612 class OcclusionTrackerTestSurfaceChildOfClippingSurface : public OcclusionTracke rTest<Types> {
2613 protected: 2613 protected:
2614 OcclusionTrackerTestSurfaceChildOfClippingSurface(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {} 2614 OcclusionTrackerTestSurfaceChildOfClippingSurface(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {}
2615 void runMyTest() 2615 void runMyTest()
2616 { 2616 {
2617 // This test verifies that the surface cliprect does not end up empty an d clip away the entire unoccluded rect. 2617 // This test verifies that the surface cliprect does not end up empty an d clip away the entire unoccluded rect.
2618 2618
2619 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(80, 200)); 2619 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(80, 200));
2620 parent->setMasksToBounds(true); 2620 parent->setMasksToBounds(true);
2621 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); 2621 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
2622 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false); 2622 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), false);
2623 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); 2623 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 50), true);
2624 this->calcDrawEtc(parent); 2624 this->calcDrawEtc(parent);
2625 2625
2626 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2626 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2627 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2627 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2628 2628
2629 // |topmost| occludes everything partially so we know occlusion is happe ning at all. 2629 // |topmost| occludes everything partially so we know occlusion is happe ning at all.
2630 this->visitLayer(topmost, occlusion); 2630 this->visitLayer(topmost, occlusion);
2631 2631
2632 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace ().bounds()); 2632 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace ().bounds());
2633 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 2633 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2665 protected: 2665 protected:
2666 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLa yers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2666 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLa yers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2667 void runMyTest() 2667 void runMyTest()
2668 { 2668 {
2669 WebTransformationMatrix scaleByHalf; 2669 WebTransformationMatrix scaleByHalf;
2670 scaleByHalf.scale(0.5); 2670 scaleByHalf.scale(0.5);
2671 2671
2672 // Make a surface and its replica, each 50x50, that are completely surro unded by opaque layers which are above them in the z-order. 2672 // Make a surface and its replica, each 50x50, that are completely surro unded by opaque layers which are above them in the z-order.
2673 // 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 2673 // 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
2674 // appears at 50, 50 and the replica at 200, 50. 2674 // appears at 50, 50 and the replica at 200, 50.
2675 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); 2675 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
2676 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); 2676 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
2677 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), IntSize()); 2677 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), gfx::Size());
2678 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true); 2678 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 50), true);
2679 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true); 2679 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(300, 50), true);
2680 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true); 2680 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 50), gfx::Size(50, 50), true);
2681 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true); 2681 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(100, 50), gfx::Size(100, 50), true);
2682 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true); 2682 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(250, 50), gfx::Size(50, 50), true);
2683 2683
2684 // Filters make the layer own a surface. 2684 // Filters make the layer own a surface.
2685 WebFilterOperations filters; 2685 WebFilterOperations filters;
2686 filters.append(WebFilterOperation::createBlurFilter(10)); 2686 filters.append(WebFilterOperation::createBlurFilter(10));
2687 filteredSurface->setBackgroundFilters(filters); 2687 filteredSurface->setBackgroundFilters(filters);
2688 2688
2689 // Save the distance of influence for the blur effect. 2689 // Save the distance of influence for the blur effect.
2690 int outsetTop, outsetRight, outsetBottom, outsetLeft; 2690 int outsetTop, outsetRight, outsetBottom, outsetLeft;
2691 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); 2691 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
2692 2692
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 template<class Types> 2785 template<class Types>
2786 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl usionTrackerTest<Types> { 2786 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl usionTrackerTest<Types> {
2787 protected: 2787 protected:
2788 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2788 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye rs) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2789 void runMyTest() 2789 void runMyTest()
2790 { 2790 {
2791 WebTransformationMatrix scaleByHalf; 2791 WebTransformationMatrix scaleByHalf;
2792 scaleByHalf.scale(0.5); 2792 scaleByHalf.scale(0.5);
2793 2793
2794 // Makes two surfaces that completely cover |parent|. The occlusion both above and below the filters will be reduced by each of them. 2794 // Makes two surfaces that completely cover |parent|. The occlusion both above and below the filters will be reduced by each of them.
2795 typename Types::ContentLayerType* root = this->createRoot(this->identity Matrix, FloatPoint(0, 0), IntSize(75, 75)); 2795 typename Types::ContentLayerType* root = this->createRoot(this->identity Matrix, FloatPoint(0, 0), gfx::Size(75, 75));
2796 typename Types::LayerType* parent = this->createSurface(root, scaleByHal f, FloatPoint(0, 0), IntSize(150, 150)); 2796 typename Types::LayerType* parent = this->createSurface(root, scaleByHal f, FloatPoint(0, 0), gfx::Size(150, 150));
2797 parent->setMasksToBounds(true); 2797 parent->setMasksToBounds(true);
2798 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p arent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false); 2798 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p arent, scaleByHalf, FloatPoint(0, 0), gfx::Size(300, 300), false);
2799 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p arent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false); 2799 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p arent, scaleByHalf, FloatPoint(0, 0), gfx::Size(300, 300), false);
2800 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye r(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(50, 50), true); 2800 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye r(parent, this->identityMatrix, FloatPoint(100, 100), gfx::Size(50, 50), true);
2801 2801
2802 // Filters make the layers own surfaces. 2802 // Filters make the layers own surfaces.
2803 WebFilterOperations filters; 2803 WebFilterOperations filters;
2804 filters.append(WebFilterOperation::createBlurFilter(1)); 2804 filters.append(WebFilterOperation::createBlurFilter(1));
2805 filteredSurface1->setBackgroundFilters(filters); 2805 filteredSurface1->setBackgroundFilters(filters);
2806 filteredSurface2->setBackgroundFilters(filters); 2806 filteredSurface2->setBackgroundFilters(filters);
2807 2807
2808 // Save the distance of influence for the blur effect. 2808 // Save the distance of influence for the blur effect.
2809 int outsetTop, outsetRight, outsetBottom, outsetLeft; 2809 int outsetTop, outsetRight, outsetBottom, outsetLeft;
2810 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); 2810 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
(...skipping 28 matching lines...) Expand all
2839 2839
2840 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio nTwice); 2840 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio nTwice);
2841 2841
2842 template<class Types> 2842 template<class Types>
2843 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p ublic OcclusionTrackerTest<Types> { 2843 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p ublic OcclusionTrackerTest<Types> {
2844 protected: 2844 protected:
2845 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2845 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2846 void runMyTest() 2846 void runMyTest()
2847 { 2847 {
2848 // Make a surface and its replica, each 50x50, that are completely surro unded by opaque layers which are above them in the z-order. 2848 // Make a surface and its replica, each 50x50, that are completely surro unded by opaque layers which are above them in the z-order.
2849 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); 2849 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
2850 // We stick the filtered surface inside a clipping surface so that we ca n make sure the clip is honored when exposing pixels for 2850 // We stick the filtered surface inside a clipping surface so that we ca n make sure the clip is honored when exposing pixels for
2851 // the background filter. 2851 // the background filter.
2852 typename Types::LayerType* clippingSurface = this->createSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 70)); 2852 typename Types::LayerType* clippingSurface = this->createSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 70));
2853 clippingSurface->setMasksToBounds(true); 2853 clippingSurface->setMasksToBounds(true);
2854 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl ippingSurface, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), false) ; 2854 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl ippingSurface, this->identityMatrix, FloatPoint(50, 50), gfx::Size(50, 50), fals e);
2855 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(150, 0), IntSize()); 2855 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(150, 0), gfx::Size());
2856 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true); 2856 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 50), true);
2857 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true); 2857 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(300, 50), true);
2858 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true); 2858 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(0, 50), gfx::Size(50, 50), true);
2859 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true); 2859 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(100, 50), gfx::Size(100, 50), true);
2860 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true); 2860 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa rent, this->identityMatrix, FloatPoint(250, 50), gfx::Size(50, 50), true);
2861 2861
2862 // Filters make the layer own a surface. This filter is large enough tha t it goes outside the bottom of the clippingSurface. 2862 // Filters make the layer own a surface. This filter is large enough tha t it goes outside the bottom of the clippingSurface.
2863 WebFilterOperations filters; 2863 WebFilterOperations filters;
2864 filters.append(WebFilterOperation::createBlurFilter(12)); 2864 filters.append(WebFilterOperation::createBlurFilter(12));
2865 filteredSurface->setBackgroundFilters(filters); 2865 filteredSurface->setBackgroundFilters(filters);
2866 2866
2867 // Save the distance of influence for the blur effect. 2867 // Save the distance of influence for the blur effect.
2868 int outsetTop, outsetRight, outsetBottom, outsetLeft; 2868 int outsetTop, outsetRight, outsetBottom, outsetLeft;
2869 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); 2869 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
2870 2870
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2966 protected: 2966 protected:
2967 OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter(bool opaqueLaye rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2967 OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter(bool opaqueLaye rs) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2968 void runMyTest() 2968 void runMyTest()
2969 { 2969 {
2970 WebTransformationMatrix scaleByHalf; 2970 WebTransformationMatrix scaleByHalf;
2971 scaleByHalf.scale(0.5); 2971 scaleByHalf.scale(0.5);
2972 2972
2973 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye r centered below each. 2973 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye r centered below each.
2974 // 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 2974 // 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
2975 // appears at 50, 50 and the replica at 200, 50. 2975 // appears at 50, 50 and the replica at 200, 50.
2976 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); 2976 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
2977 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(60, 60), IntSize(30, 30), true); 2977 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(60, 60), gfx::Size(30, 30), true);
2978 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(210, 60), IntSize(30, 30), true); 2978 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(210, 60), gfx::Size(30, 30), true);
2979 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); 2979 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
2980 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), IntSize()); 2980 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), gfx::Size());
2981 2981
2982 // Filters make the layer own a surface. 2982 // Filters make the layer own a surface.
2983 WebFilterOperations filters; 2983 WebFilterOperations filters;
2984 filters.append(WebFilterOperation::createBlurFilter(3)); 2984 filters.append(WebFilterOperation::createBlurFilter(3));
2985 filteredSurface->setBackgroundFilters(filters); 2985 filteredSurface->setBackgroundFilters(filters);
2986 2986
2987 this->calcDrawEtc(parent); 2987 this->calcDrawEtc(parent);
2988 2988
2989 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2989 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2990 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2990 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
(...skipping 25 matching lines...) Expand all
3016 protected: 3016 protected:
3017 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 3017 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
3018 void runMyTest() 3018 void runMyTest()
3019 { 3019 {
3020 WebTransformationMatrix scaleByHalf; 3020 WebTransformationMatrix scaleByHalf;
3021 scaleByHalf.scale(0.5); 3021 scaleByHalf.scale(0.5);
3022 3022
3023 // Make a surface and its replica, each 50x50, that are completely occlu ded by opaque layers which are above them in the z-order. 3023 // Make a surface and its replica, each 50x50, that are completely occlu ded by opaque layers which are above them in the z-order.
3024 // 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 3024 // 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
3025 // appears at 50, 50 and the replica at 200, 50. 3025 // appears at 50, 50 and the replica at 200, 50.
3026 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); 3026 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
3027 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); 3027 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
3028 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), IntSize()); 3028 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), gfx::Size());
3029 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), true); 3029 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(50, 50), gfx::Size(50, 50), true);
3030 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(200, 50), IntSize(50, 50), true); 3030 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(200, 50), gfx::Size(50, 50), true);
3031 3031
3032 // Filters make the layer own a surface. 3032 // Filters make the layer own a surface.
3033 WebFilterOperations filters; 3033 WebFilterOperations filters;
3034 filters.append(WebFilterOperation::createBlurFilter(3)); 3034 filters.append(WebFilterOperation::createBlurFilter(3));
3035 filteredSurface->setBackgroundFilters(filters); 3035 filteredSurface->setBackgroundFilters(filters);
3036 3036
3037 this->calcDrawEtc(parent); 3037 this->calcDrawEtc(parent);
3038 3038
3039 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 3039 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
3040 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 3040 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
(...skipping 24 matching lines...) Expand all
3065 protected: 3065 protected:
3066 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 3066 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
3067 void runMyTest() 3067 void runMyTest()
3068 { 3068 {
3069 WebTransformationMatrix scaleByHalf; 3069 WebTransformationMatrix scaleByHalf;
3070 scaleByHalf.scale(0.5); 3070 scaleByHalf.scale(0.5);
3071 3071
3072 // Make a surface and its replica, each 50x50, that are partially occlud ed by opaque layers which are above them in the z-order. 3072 // Make a surface and its replica, each 50x50, that are partially occlud ed by opaque layers which are above them in the z-order.
3073 // 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 3073 // 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
3074 // appears at 50, 50 and the replica at 200, 50. 3074 // appears at 50, 50 and the replica at 200, 50.
3075 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); 3075 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
3076 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); 3076 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
3077 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), IntSize()); 3077 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi nt(300, 0), gfx::Size());
3078 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(70, 50), IntSize(30, 50), true); 3078 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(70, 50), gfx::Size(30, 50), true);
3079 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(200, 50), IntSize(30, 50), true); 3079 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer( parent, this->identityMatrix, FloatPoint(200, 50), gfx::Size(30, 50), true);
3080 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(90, 40), IntSize(10, 10), true); 3080 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(90, 40), gfx::Size(10, 10), true);
3081 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(200, 40), IntSize(10, 10), true); 3081 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer (parent, this->identityMatrix, FloatPoint(200, 40), gfx::Size(10, 10), true);
3082 3082
3083 // Filters make the layer own a surface. 3083 // Filters make the layer own a surface.
3084 WebFilterOperations filters; 3084 WebFilterOperations filters;
3085 filters.append(WebFilterOperation::createBlurFilter(3)); 3085 filters.append(WebFilterOperation::createBlurFilter(3));
3086 filteredSurface->setBackgroundFilters(filters); 3086 filteredSurface->setBackgroundFilters(filters);
3087 3087
3088 // Save the distance of influence for the blur effect. 3088 // Save the distance of influence for the blur effect.
3089 int outsetTop, outsetRight, outsetBottom, outsetLeft; 3089 int outsetTop, outsetRight, outsetBottom, outsetLeft;
3090 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); 3090 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
3091 3091
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3132 }; 3132 };
3133 3133
3134 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte rIsPartiallyOccluded); 3134 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte rIsPartiallyOccluded);
3135 3135
3136 template<class Types> 3136 template<class Types>
3137 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type s> { 3137 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type s> {
3138 protected: 3138 protected:
3139 OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {} 3139 OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {}
3140 void runMyTest() 3140 void runMyTest()
3141 { 3141 {
3142 IntSize trackingSize(100, 100); 3142 gfx::Size trackingSize(100, 100);
3143 IntSize belowTrackingSize(99, 99); 3143 gfx::Size belowTrackingSize(99, 99);
3144 3144
3145 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), IntSize(400, 400)); 3145 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, FloatPoint(0, 0), gfx::Size(400, 400));
3146 typename Types::LayerType* large = this->createDrawingLayer(parent, this ->identityMatrix, FloatPoint(0, 0), trackingSize, true); 3146 typename Types::LayerType* large = this->createDrawingLayer(parent, this ->identityMatrix, FloatPoint(0, 0), trackingSize, true);
3147 typename Types::LayerType* small = this->createDrawingLayer(parent, this ->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true); 3147 typename Types::LayerType* small = this->createDrawingLayer(parent, this ->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true);
3148 this->calcDrawEtc(parent); 3148 this->calcDrawEtc(parent);
3149 3149
3150 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 3150 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
3151 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 3151 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
3152 occlusion.setMinimumTrackingSize(trackingSize); 3152 occlusion.setMinimumTrackingSize(trackingSize);
3153 3153
3154 // The small layer is not tracked because it is too small. 3154 // The small layer is not tracked because it is too small.
3155 this->visitLayer(small, occlusion); 3155 this->visitLayer(small, occlusion);
3156 3156
3157 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds()) ; 3157 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds()) ;
3158 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); 3158 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
3159 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds( )); 3159 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds( ));
3160 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); 3160 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
3161 3161
3162 // The large layer is tracked as it is large enough. 3162 // The large layer is tracked as it is large enough.
3163 this->visitLayer(large, occlusion); 3163 this->visitLayer(large, occlusion);
3164 3164
3165 EXPECT_RECT_EQ(gfx::Rect(IntPoint(), trackingSize), occlusion.occlusionI nScreenSpace().bounds()); 3165 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio nInScreenSpace().bounds());
3166 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); 3166 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
3167 EXPECT_RECT_EQ(gfx::Rect(IntPoint(), trackingSize), occlusion.occlusionI nTargetSurface().bounds()); 3167 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio nInTargetSurface().bounds());
3168 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); 3168 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
3169 } 3169 }
3170 }; 3170 };
3171 3171
3172 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); 3172 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize);
3173 3173
3174 } // namespace 3174 } // namespace
OLDNEW
« no previous file with comments | « cc/occlusion_tracker.cc ('k') | cc/overdraw_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698