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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 15 matching lines...) Expand all
26 #ifndef CompositedLayerMapping_h 26 #ifndef CompositedLayerMapping_h
27 #define CompositedLayerMapping_h 27 #define CompositedLayerMapping_h
28 28
29 #include "core/layout/compositing/GraphicsLayerUpdater.h" 29 #include "core/layout/compositing/GraphicsLayerUpdater.h"
30 #include "core/paint/PaintLayer.h" 30 #include "core/paint/PaintLayer.h"
31 #include "platform/geometry/FloatPoint.h" 31 #include "platform/geometry/FloatPoint.h"
32 #include "platform/geometry/FloatPoint3D.h" 32 #include "platform/geometry/FloatPoint3D.h"
33 #include "platform/graphics/GraphicsLayer.h" 33 #include "platform/graphics/GraphicsLayer.h"
34 #include "platform/graphics/GraphicsLayerClient.h" 34 #include "platform/graphics/GraphicsLayerClient.h"
35 #include "wtf/Allocator.h" 35 #include "wtf/Allocator.h"
36 #include <memory>
36 37
37 namespace blink { 38 namespace blink {
38 39
39 class PaintLayerCompositor; 40 class PaintLayerCompositor;
40 41
41 // A GraphicsLayerPaintInfo contains all the info needed to paint a partial subt ree of Layers into a GraphicsLayer. 42 // A GraphicsLayerPaintInfo contains all the info needed to paint a partial subt ree of Layers into a GraphicsLayer.
42 struct GraphicsLayerPaintInfo { 43 struct GraphicsLayerPaintInfo {
43 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 44 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
44 PaintLayer* paintLayer; 45 PaintLayer* paintLayer;
45 46
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 void updateTransformGeometry(const IntPoint& snappedOffsetFromCompositedAnce stor, const IntRect& relativeCompositingBounds); 248 void updateTransformGeometry(const IntPoint& snappedOffsetFromCompositedAnce stor, const IntRect& relativeCompositingBounds);
248 void updateForegroundLayerGeometry(const FloatSize& relativeCompositingBound sSize, const IntRect& clippingBox); 249 void updateForegroundLayerGeometry(const FloatSize& relativeCompositingBound sSize, const IntRect& clippingBox);
249 void updateBackgroundLayerGeometry(const FloatSize& relativeCompositingBound sSize); 250 void updateBackgroundLayerGeometry(const FloatSize& relativeCompositingBound sSize);
250 void updateReflectionLayerGeometry(Vector<PaintLayer*>& layersNeedingPaintIn validation); 251 void updateReflectionLayerGeometry(Vector<PaintLayer*>& layersNeedingPaintIn validation);
251 void updateScrollingLayerGeometry(const IntRect& localCompositingBounds); 252 void updateScrollingLayerGeometry(const IntRect& localCompositingBounds);
252 void updateChildClippingMaskLayerGeometry(); 253 void updateChildClippingMaskLayerGeometry();
253 254
254 void createPrimaryGraphicsLayer(); 255 void createPrimaryGraphicsLayer();
255 void destroyGraphicsLayers(); 256 void destroyGraphicsLayers();
256 257
257 PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons, SquashingD isallowedReasons = SquashingDisallowedReasonsNone); 258 std::unique_ptr<GraphicsLayer> createGraphicsLayer(CompositingReasons, Squas hingDisallowedReasons = SquashingDisallowedReasonsNone);
258 bool toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>&, bool needsLayer, C ompositingReasons); 259 bool toggleScrollbarLayerIfNeeded(std::unique_ptr<GraphicsLayer>&, bool need sLayer, CompositingReasons);
259 260
260 LayoutBoxModelObject* layoutObject() const { return m_owningLayer.layoutObje ct(); } 261 LayoutBoxModelObject* layoutObject() const { return m_owningLayer.layoutObje ct(); }
261 PaintLayerCompositor* compositor() const { return m_owningLayer.compositor() ; } 262 PaintLayerCompositor* compositor() const { return m_owningLayer.compositor() ; }
262 263
263 void updateInternalHierarchy(); 264 void updateInternalHierarchy();
264 void updatePaintingPhases(); 265 void updatePaintingPhases();
265 bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip); 266 bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip);
266 bool updateChildTransformLayer(bool needsChildTransformLayer); 267 bool updateChildTransformLayer(bool needsChildTransformLayer);
267 bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool n eedsVerticalScrollbarLayer, bool needsScrollCornerLayer, bool needsAncestorClip) ; 268 bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool n eedsVerticalScrollbarLayer, bool needsScrollCornerLayer, bool needsAncestorClip) ;
268 bool updateForegroundLayer(bool needsForegroundLayer); 269 bool updateForegroundLayer(bool needsForegroundLayer);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // | + ... 363 // | + ...
363 // ... 364 // ...
364 // | 365 // |
365 // + B = m_ancestorClippingLayer [+] 366 // + B = m_ancestorClippingLayer [+]
366 // + m_graphicsLayer 367 // + m_graphicsLayer
367 // + ... 368 // + ...
368 // 369 //
369 // In this case B is clipped by another layer that doesn't happen to be its ancestor: A. 370 // In this case B is clipped by another layer that doesn't happen to be its ancestor: A.
370 // So we create an ancestor clipping layer for B, [+], which ensures that B is clipped 371 // So we create an ancestor clipping layer for B, [+], which ensures that B is clipped
371 // as if it had been A's descendant. 372 // as if it had been A's descendant.
372 OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clippe d by an ancestor which is not a stacking context. 373 std::unique_ptr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we a re clipped by an ancestor which is not a stacking context.
373 OwnPtr<GraphicsLayer> m_graphicsLayer; 374 std::unique_ptr<GraphicsLayer> m_graphicsLayer;
374 OwnPtr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipp ing on a stacking context with compositing children. 375 std::unique_ptr<GraphicsLayer> m_childContainmentLayer; // Only used if we h ave clipping on a stacking context with compositing children.
375 OwnPtr<GraphicsLayer> m_childTransformLayer; // Only used if we have perspec tive. 376 std::unique_ptr<GraphicsLayer> m_childTransformLayer; // Only used if we hav e perspective.
376 OwnPtr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using c omposited scrolling. 377 std::unique_ptr<GraphicsLayer> m_scrollingLayer; // Only used if the layer i s using composited scrolling.
377 OwnPtr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling. 378 std::unique_ptr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling.
378 379
379 // This layer is also added to the hierarchy by the RLB, but in a different way than 380 // This layer is also added to the hierarchy by the RLB, but in a different way than
380 // the layers above. It's added to m_graphicsLayer as its mask layer (natura lly) if 381 // the layers above. It's added to m_graphicsLayer as its mask layer (natura lly) if
381 // we have a mask, and isn't part of the typical hierarchy (it has no childr en). 382 // we have a mask, and isn't part of the typical hierarchy (it has no childr en).
382 OwnPtr<GraphicsLayer> m_maskLayer; // Only used if we have a mask. 383 std::unique_ptr<GraphicsLayer> m_maskLayer; // Only used if we have a mask.
383 OwnPtr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to c lip child layers or accelerated contents with border radius or clip-path. 384 std::unique_ptr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-pat h.
384 385
385 // There are two other (optional) layers whose painting is managed by the Co mpositedLayerMapping, 386 // There are two other (optional) layers whose painting is managed by the Co mpositedLayerMapping,
386 // but whose position in the hierarchy is maintained by the PaintLayerCompos itor. These 387 // but whose position in the hierarchy is maintained by the PaintLayerCompos itor. These
387 // are the foreground and background layers. The foreground layer exists if we have composited 388 // are the foreground and background layers. The foreground layer exists if we have composited
388 // descendants with negative z-order. We need the extra layer in this case b ecause the layer 389 // descendants with negative z-order. We need the extra layer in this case b ecause the layer
389 // needs to draw both below (for the background, say) and above (for the nor mal flow content, say) 390 // needs to draw both below (for the background, say) and above (for the nor mal flow content, say)
390 // the negative z-order descendants and this is impossible with a single lay er. The RLC handles 391 // the negative z-order descendants and this is impossible with a single lay er. The RLC handles
391 // inserting m_foregroundLayer in the correct position in our descendant lis t for us (right after 392 // inserting m_foregroundLayer in the correct position in our descendant lis t for us (right after
392 // the neg z-order dsecendants). 393 // the neg z-order dsecendants).
393 // 394 //
394 // The background layer is only created if this is the root layer and our ba ckground is entirely 395 // The background layer is only created if this is the root layer and our ba ckground is entirely
395 // fixed. In this case we want to put the background in a separate composite d layer so that when 396 // fixed. In this case we want to put the background in a separate composite d layer so that when
396 // we scroll, we don't have to re-raster the background into position. This layer is also inserted 397 // we scroll, we don't have to re-raster the background into position. This layer is also inserted
397 // into the tree by the RLC as it gets a special home. This layer becomes a descendant of the 398 // into the tree by the RLC as it gets a special home. This layer becomes a descendant of the
398 // frame clipping layer. That is: 399 // frame clipping layer. That is:
399 // ... 400 // ...
400 // + frame clipping layer 401 // + frame clipping layer
401 // + m_backgroundLayer 402 // + m_backgroundLayer
402 // + frame scrolling layer 403 // + frame scrolling layer
403 // + root content layer 404 // + root content layer
404 // 405 //
405 // With the hierarchy set up like this, the root content layer is able to sc roll without affecting 406 // With the hierarchy set up like this, the root content layer is able to sc roll without affecting
406 // the background layer (or paint invalidation). 407 // the background layer (or paint invalidation).
407 OwnPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately. 408 std::unique_ptr<GraphicsLayer> m_foregroundLayer; // Only used in cases wher e we need to draw the foreground separately.
408 OwnPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately. 409 std::unique_ptr<GraphicsLayer> m_backgroundLayer; // Only used in cases wher e we need to draw the background separately.
409 410
410 OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; 411 std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar;
411 OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; 412 std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar;
412 OwnPtr<GraphicsLayer> m_layerForScrollCorner; 413 std::unique_ptr<GraphicsLayer> m_layerForScrollCorner;
413 414
414 // This layer contains the scrollbar and scroll corner layers and clips them to the border box 415 // This layer contains the scrollbar and scroll corner layers and clips them to the border box
415 // bounds of our LayoutObject. It is usually added to m_graphicsLayer, but m ay be reparented by 416 // bounds of our LayoutObject. It is usually added to m_graphicsLayer, but m ay be reparented by
416 // GraphicsLayerTreeBuilder to ensure that scrollbars appear above scrolling content. 417 // GraphicsLayerTreeBuilder to ensure that scrollbars appear above scrolling content.
417 OwnPtr<GraphicsLayer> m_overflowControlsHostLayer; 418 std::unique_ptr<GraphicsLayer> m_overflowControlsHostLayer;
418 419
419 // The reparented overflow controls sometimes need to be clipped by a non-an cestor. In just the same 420 // The reparented overflow controls sometimes need to be clipped by a non-an cestor. In just the same
420 // way we need an ancestor clipping layer to clip this CLM's internal hierar chy, we add another layer 421 // way we need an ancestor clipping layer to clip this CLM's internal hierar chy, we add another layer
421 // to clip the overflow controls. We could combine this with m_overflowContr olsHostLayer, but that 422 // to clip the overflow controls. We could combine this with m_overflowContr olsHostLayer, but that
422 // would require manually intersecting their clips, and shifting the overflo w controls to compensate 423 // would require manually intersecting their clips, and shifting the overflo w controls to compensate
423 // for this clip's offset. By using a separate layer, the overflow controls can remain ignorant of 424 // for this clip's offset. By using a separate layer, the overflow controls can remain ignorant of
424 // ancestor clipping. 425 // ancestor clipping.
425 OwnPtr<GraphicsLayer> m_overflowControlsAncestorClippingLayer; 426 std::unique_ptr<GraphicsLayer> m_overflowControlsAncestorClippingLayer;
426 427
427 // A squashing CLM has two possible squashing-related structures. 428 // A squashing CLM has two possible squashing-related structures.
428 // 429 //
429 // If m_ancestorClippingLayer is present: 430 // If m_ancestorClippingLayer is present:
430 // 431 //
431 // m_ancestorClippingLayer 432 // m_ancestorClippingLayer
432 // + m_graphicsLayer 433 // + m_graphicsLayer
433 // + m_squashingLayer 434 // + m_squashingLayer
434 // 435 //
435 // If not: 436 // If not:
436 // 437 //
437 // m_squashingContainmentLayer 438 // m_squashingContainmentLayer
438 // + m_graphicsLayer 439 // + m_graphicsLayer
439 // + m_squashingLayer 440 // + m_squashingLayer
440 // 441 //
441 // Stacking children of a squashed layer receive graphics layers that are pa rented to the compositd ancestor of the 442 // Stacking children of a squashed layer receive graphics layers that are pa rented to the compositd ancestor of the
442 // squashed layer (i.e. nearest enclosing composited layer that is not squas hed). 443 // squashed layer (i.e. nearest enclosing composited layer that is not squas hed).
443 OwnPtr<GraphicsLayer> m_squashingContainmentLayer; // Only used if any squas hed layers exist and m_squashingContainmentLayer is not present, to contain the squashed layers as siblings to the rest of the GraphicsLayer tree chunk. 444 std::unique_ptr<GraphicsLayer> m_squashingContainmentLayer; // Only used if any squashed layers exist and m_squashingContainmentLayer is not present, to con tain the squashed layers as siblings to the rest of the GraphicsLayer tree chunk .
444 OwnPtr<GraphicsLayer> m_squashingLayer; // Only used if any squashed layers exist, this is the backing that squashed layers paint into. 445 std::unique_ptr<GraphicsLayer> m_squashingLayer; // Only used if any squashe d layers exist, this is the backing that squashed layers paint into.
445 Vector<GraphicsLayerPaintInfo> m_squashedLayers; 446 Vector<GraphicsLayerPaintInfo> m_squashedLayers;
446 LayoutPoint m_squashingLayerOffsetFromTransformedAncestor; 447 LayoutPoint m_squashingLayerOffsetFromTransformedAncestor;
447 448
448 LayoutRect m_compositedBounds; 449 LayoutRect m_compositedBounds;
449 450
450 LayoutSize m_contentOffsetInCompositingLayer; 451 LayoutSize m_contentOffsetInCompositingLayer;
451 452
452 // We keep track of the scrolling contents offset, so that when it changes w e can notify the ScrollingCoordinator, which 453 // We keep track of the scrolling contents offset, so that when it changes w e can notify the ScrollingCoordinator, which
453 // passes on main-thread scrolling updates to the compositor. 454 // passes on main-thread scrolling updates to the compositor.
454 DoubleSize m_scrollingContentsOffset; 455 DoubleSize m_scrollingContentsOffset;
455 456
456 unsigned m_contentOffsetInCompositingLayerDirty : 1; 457 unsigned m_contentOffsetInCompositingLayerDirty : 1;
457 458
458 unsigned m_pendingUpdateScope : 2; 459 unsigned m_pendingUpdateScope : 2;
459 unsigned m_isMainFrameLayoutViewLayer : 1; 460 unsigned m_isMainFrameLayoutViewLayer : 1;
460 461
461 unsigned m_backgroundLayerPaintsFixedRootBackground : 1; 462 unsigned m_backgroundLayerPaintsFixedRootBackground : 1;
462 unsigned m_scrollingContentsAreEmpty : 1; 463 unsigned m_scrollingContentsAreEmpty : 1;
463 464
464 friend class CompositedLayerMappingTest; 465 friend class CompositedLayerMappingTest;
465 }; 466 };
466 467
467 } // namespace blink 468 } // namespace blink
468 469
469 #endif // CompositedLayerMapping_h 470 #endif // CompositedLayerMapping_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698