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

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

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

Powered by Google App Engine
This is Rietveld 408576698