Chromium Code Reviews| Index: Source/Platform/chromium/public/WebCompositingReasons.h |
| diff --git a/Source/Platform/chromium/public/WebCompositingReasons.h b/Source/Platform/chromium/public/WebCompositingReasons.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a71f499887c6fbe0ee9fb23848bfa88dab02f51f |
| --- /dev/null |
| +++ b/Source/Platform/chromium/public/WebCompositingReasons.h |
| @@ -0,0 +1,120 @@ |
| +/* |
| + * Copyright (C) 2013 Google Inc. All rights reserved. |
| + * |
| + * Redistribution and use in source and binary forms, with or without |
| + * modification, are permitted provided that the following conditions |
| + * are met: |
| + * 1. Redistributions of source code must retain the above copyright |
| + * notice, this list of conditions and the following disclaimer. |
| + * 2. Redistributions in binary form must reproduce the above copyright |
| + * notice, this list of conditions and the following disclaimer in the |
| + * documentation and/or other materials provided with the distribution. |
| + * |
| + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY |
|
jamesr
2013/05/17 00:10:20
wrong copyright header. Look for an email from da
|
| + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| + */ |
| + |
| +#ifndef WebCompositingReasons_h |
| +#define WebCompositingReasons_h |
| + |
| +#if WEBKIT_IMPLEMENTATION |
| +#include "core/rendering/RenderLayer.h" |
|
jamesr
2013/05/17 00:10:20
we shouldn't do this
|
| +#endif |
| + |
| +// This define will go away after landing both chromium and blink sides. |
| +#define USE_WEB_COMPOSITING_REASONS 1 |
| + |
| +namespace WebKit { |
| + |
| +// This is a clone of CompositingReasons enum in RenderLayer.h, |
| +// with some additional reasons that correspond to the hidden internal |
| +// hierarchies in RenderLayerBacking and GraphicsLayer. |
| +enum { |
| + CompositingReasonUnknown = 0, |
| + CompositingReason3DTransform = 1 << 0, |
| + CompositingReasonVideo = 1 << 1, |
| + CompositingReasonCanvas = 1 << 2, |
| + CompositingReasonPlugin = 1 << 3, |
| + CompositingReasonIFrame = 1 << 4, |
| + CompositingReasonBackfaceVisibilityHidden = 1 << 5, |
| + CompositingReasonAnimation = 1 << 6, |
| + CompositingReasonFilters = 1 << 7, |
| + CompositingReasonPositionFixed = 1 << 8, |
| + CompositingReasonPositionSticky = 1 << 9, |
| + CompositingReasonOverflowScrollingTouch = 1 << 10, |
| + CompositingReasonBlending = 1 << 11, |
| + CompositingReasonAssumedOverlap = 1 << 12, |
| + CompositingReasonOverlap = 1 << 13, |
| + CompositingReasonNegativeZIndexChildren = 1 << 14, |
| + CompositingReasonTransformWithCompositedDescendants = 1 << 15, |
| + CompositingReasonOpacityWithCompositedDescendants = 1 << 16, |
| + CompositingReasonMaskWithCompositedDescendants = 1 << 17, |
| + CompositingReasonReflectionWithCompositedDescendants = 1 << 18, |
| + CompositingReasonFilterWithCompositedDescendants = 1 << 19, |
| + CompositingReasonBlendingWithCompositedDescendants = 1 << 20, |
| + CompositingReasonClipsCompositingDescendants = 1 << 21, |
| + CompositingReasonPerspective = 1 << 22, |
| + CompositingReasonPreserve3D = 1 << 23, |
| + CompositingReasonReflectionOfCompositedParent = 1 << 24, |
| + CompositingReasonRoot = 1 << 25, |
| + CompositingReasonLayerForClip = 1 << 26, |
| + CompositingReasonLayerForDescendantClip = 1 << 27, |
| + CompositingReasonLayerForScrollbar = 1 << 28, |
| + CompositingReasonsLayerForScrollingContainer = 1 << 29, |
| + CompositingReasonsLayerForForeground = 1 << 30 |
| + |
| + // FIXME: Change this enum to a list of 64-bit constants so that we can |
|
jamesr
2013/05/17 00:10:20
An enum is not a signed type, so I'm not sure what
|
| + // handle more than 32 reasons. There are already more than 32 reasons, |
| + // just not yet captured here. |
| +}; |
| + |
| +// It is a typedef to allow bitwise operators to be used without type casts. |
| +typedef unsigned WebCompositingReasons; |
| + |
| +// Aggressively try to catch any mismatch between this enum and the WebCore enum. |
| +#if WEBKIT_IMPLEMENTATION |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonUnknown) == static_cast<unsigned>(WebCore::CompositingReasonNone), WebCompositingReasons_enum_does_not_match_webcore); |
|
jamesr
2013/05/17 00:10:20
no - put these in AssertMatchingEnums
|
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReason3DTransform) == static_cast<unsigned>(WebCore::CompositingReason3DTransform), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonVideo) == static_cast<unsigned>(WebCore::CompositingReasonVideo), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonCanvas) == static_cast<unsigned>(WebCore::CompositingReasonCanvas), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonPlugin) == static_cast<unsigned>(WebCore::CompositingReasonPlugin), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonIFrame) == static_cast<unsigned>(WebCore::CompositingReasonIFrame), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonBackfaceVisibilityHidden) == static_cast<unsigned>(WebCore::CompositingReasonBackfaceVisibilityHidden), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonAnimation) == static_cast<unsigned>(WebCore::CompositingReasonAnimation), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonFilters) == static_cast<unsigned>(WebCore::CompositingReasonFilters), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonPositionFixed) == static_cast<unsigned>(WebCore::CompositingReasonPositionFixed), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonPositionSticky) == static_cast<unsigned>(WebCore::CompositingReasonPositionSticky), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonOverflowScrollingTouch) == static_cast<unsigned>(WebCore::CompositingReasonOverflowScrollingTouch), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonBlending) == static_cast<unsigned>(WebCore::CompositingReasonBlending), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonAssumedOverlap) == static_cast<unsigned>(WebCore::CompositingReasonAssumedOverlap), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonOverlap) == static_cast<unsigned>(WebCore::CompositingReasonOverlap), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonNegativeZIndexChildren) == static_cast<unsigned>(WebCore::CompositingReasonNegativeZIndexChildren), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonTransformWithCompositedDescendants) == static_cast<unsigned>(WebCore::CompositingReasonTransformWithCompositedDescendants), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonOpacityWithCompositedDescendants) == static_cast<unsigned>(WebCore::CompositingReasonOpacityWithCompositedDescendants), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonMaskWithCompositedDescendants) == static_cast<unsigned>(WebCore::CompositingReasonMaskWithCompositedDescendants), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonReflectionWithCompositedDescendants) == static_cast<unsigned>(WebCore::CompositingReasonReflectionWithCompositedDescendants), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonFilterWithCompositedDescendants) == static_cast<unsigned>(WebCore::CompositingReasonFilterWithCompositedDescendants), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonBlendingWithCompositedDescendants) == static_cast<unsigned>(WebCore::CompositingReasonBlendingWithCompositedDescendants), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonClipsCompositingDescendants) == static_cast<unsigned>(WebCore::CompositingReasonClipsCompositingDescendants), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonPerspective) == static_cast<unsigned>(WebCore::CompositingReasonPerspective), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonPreserve3D) == static_cast<unsigned>(WebCore::CompositingReasonPreserve3D), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonReflectionOfCompositedParent) == static_cast<unsigned>(WebCore::CompositingReasonReflectionOfCompositedParent), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonRoot) == static_cast<unsigned>(WebCore::CompositingReasonRoot), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonLayerForClip) == static_cast<unsigned>(WebCore::CompositingReasonLayerForClip), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonLayerForDescendantClip) == static_cast<unsigned>(WebCore::CompositingReasonLayerForDescendantClip), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonLayerForScrollbar) == static_cast<unsigned>(WebCore::CompositingReasonLayerForScrollbar), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonsLayerForScrollingContainer) == static_cast<unsigned>(WebCore::CompositingReasonsLayerForScrollingContainer), WebCompositingReasons_enum_does_not_match_webcore); |
| +COMPILE_ASSERT(static_cast<unsigned>(WebKit::CompositingReasonsLayerForForeground) == static_cast<unsigned>(WebCore::CompositingReasonsLayerForForeground), WebCompositingReasons_enum_does_not_match_webcore); |
| +#endif |
| + |
| +} // namespace WebKit |
| + |
| +#endif // WebCompositingReasons_h |