Home | History | Annotate | Download | only in rendering
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CompositingReasons_h
      6 #define CompositingReasons_h
      7 
      8 #include "wtf/MathExtras.h"
      9 #include <stdint.h>
     10 
     11 namespace WebCore {
     12 
     13 const uint64_t CompositingReasonNone                                   = 0;
     14 
     15 // Intrinsic reasons that can be known right away by the layer
     16 const uint64_t CompositingReason3DTransform                            = UINT64_C(1) << 0;
     17 const uint64_t CompositingReasonVideo                                  = UINT64_C(1) << 1;
     18 const uint64_t CompositingReasonCanvas                                 = UINT64_C(1) << 2;
     19 const uint64_t CompositingReasonPlugin                                 = UINT64_C(1) << 3;
     20 const uint64_t CompositingReasonIFrame                                 = UINT64_C(1) << 4;
     21 const uint64_t CompositingReasonBackfaceVisibilityHidden               = UINT64_C(1) << 5;
     22 const uint64_t CompositingReasonAnimation                              = UINT64_C(1) << 6;
     23 const uint64_t CompositingReasonFilters                                = UINT64_C(1) << 7;
     24 const uint64_t CompositingReasonPositionFixed                          = UINT64_C(1) << 8;
     25 const uint64_t CompositingReasonPositionSticky                         = UINT64_C(1) << 9;
     26 const uint64_t CompositingReasonOverflowScrollingTouch                 = UINT64_C(1) << 10;
     27 
     28 // Overlap reasons that require knowing what's behind you in paint-order before knowing the answer
     29 const uint64_t CompositingReasonAssumedOverlap                         = UINT64_C(1) << 12;
     30 const uint64_t CompositingReasonOverlap                                = UINT64_C(1) << 13;
     31 const uint64_t CompositingReasonNegativeZIndexChildren                 = UINT64_C(1) << 14;
     32 
     33 // Subtree reasons that require knowing what the status of your subtree is before knowing the answer
     34 const uint64_t CompositingReasonTransformWithCompositedDescendants     = UINT64_C(1) << 15;
     35 const uint64_t CompositingReasonOpacityWithCompositedDescendants       = UINT64_C(1) << 16;
     36 const uint64_t CompositingReasonMaskWithCompositedDescendants          = UINT64_C(1) << 17;
     37 const uint64_t CompositingReasonReflectionWithCompositedDescendants    = UINT64_C(1) << 18;
     38 const uint64_t CompositingReasonFilterWithCompositedDescendants        = UINT64_C(1) << 19;
     39 const uint64_t CompositingReasonBlendingWithCompositedDescendants      = UINT64_C(1) << 20;
     40 const uint64_t CompositingReasonClipsCompositingDescendants            = UINT64_C(1) << 21;
     41 const uint64_t CompositingReasonPerspective                            = UINT64_C(1) << 22;
     42 const uint64_t CompositingReasonPreserve3D                             = UINT64_C(1) << 23;
     43 const uint64_t CompositingReasonReflectionOfCompositedParent           = UINT64_C(1) << 24;
     44 
     45 // The root layer is a special case that may be forced to be a layer, but also it needs to be
     46 // a layer if anything else in the subtree is composited.
     47 const uint64_t CompositingReasonRoot                                   = UINT64_C(1) << 25;
     48 
     49 // CompositedLayerMapping internal hierarchy reasons
     50 const uint64_t CompositingReasonLayerForClip                           = UINT64_C(1) << 26;
     51 const uint64_t CompositingReasonLayerForScrollbar                      = UINT64_C(1) << 27;
     52 const uint64_t CompositingReasonLayerForScrollingContainer             = UINT64_C(1) << 28;
     53 const uint64_t CompositingReasonLayerForForeground                     = UINT64_C(1) << 29;
     54 const uint64_t CompositingReasonLayerForBackground                     = UINT64_C(1) << 30;
     55 const uint64_t CompositingReasonLayerForMask                           = UINT64_C(1) << 31;
     56 
     57 // FIXME: the following compositing reasons need to be re-organized to fit with categories
     58 // used in all the other reasons above.
     59 const uint64_t CompositingReasonOverflowScrollingParent                = UINT64_C(1) << 32;
     60 const uint64_t CompositingReasonOutOfFlowClipping                      = UINT64_C(1) << 33;
     61 
     62 const uint64_t CompositingReasonLayerForVideoOverlay                   = UINT64_C(1) << 34;
     63 const uint64_t CompositingReasonIsolateCompositedDescendants           = UINT64_C(1) << 35;
     64 
     65 // Note: if you add more reasons here, you will need to update WebCompositingReasons as well.
     66 
     67 // Various combinations of compositing reasons are defined here also, for more intutive and faster bitwise logic.
     68 const uint64_t CompositingReasonComboAllDirectReasons =
     69     CompositingReason3DTransform
     70     | CompositingReasonVideo
     71     | CompositingReasonCanvas
     72     | CompositingReasonPlugin
     73     | CompositingReasonIFrame
     74     | CompositingReasonBackfaceVisibilityHidden
     75     | CompositingReasonAnimation
     76     | CompositingReasonFilters
     77     | CompositingReasonPositionFixed
     78     | CompositingReasonPositionSticky
     79     | CompositingReasonOverflowScrollingTouch
     80     | CompositingReasonOverflowScrollingParent
     81     | CompositingReasonOutOfFlowClipping;
     82 
     83 const uint64_t CompositingReasonComboReasonsThatRequireOwnBacking =
     84     CompositingReasonComboAllDirectReasons
     85     | CompositingReasonOverlap
     86     | CompositingReasonAssumedOverlap
     87     | CompositingReasonNegativeZIndexChildren
     88     | CompositingReasonTransformWithCompositedDescendants
     89     | CompositingReasonOpacityWithCompositedDescendants
     90     | CompositingReasonMaskWithCompositedDescendants
     91     | CompositingReasonFilterWithCompositedDescendants
     92     | CompositingReasonBlendingWithCompositedDescendants
     93     | CompositingReasonIsolateCompositedDescendants
     94     | CompositingReasonPreserve3D; // preserve-3d has to create backing store to ensure that 3d-transformed elements intersect.
     95 
     96 const uint64_t CompositingReasonComboAllOverlapReasons =
     97     CompositingReasonOverlap
     98     | CompositingReasonAssumedOverlap;
     99 
    100 typedef uint64_t CompositingReasons;
    101 
    102 
    103 } // namespace WebCore
    104 
    105 #endif // CompositingReasons_h
    106