2 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef GraphicsLayerClient_h
27 #define GraphicsLayerClient_h
29 #if USE(ACCELERATED_COMPOSITING)
33 class GraphicsContext;
39 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
40 #if USE(TEXTURE_MAPPER)
41 class TextureMapperPlatformLayer;
42 typedef TextureMapperPlatformLayer PlatformLayer;
45 typedef EflLayer PlatformLayer;
46 #endif // USE(TEXTURE_MAPPER)
47 #endif // ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
48 #if ENABLE(TIZEN_ACCELERATED_COMPOSITING)
49 class RenderBoxModelObject;
53 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
54 enum GraphicsLayerPaintingPhaseFlags {
56 enum GraphicsLayerPaintingPhase {
58 GraphicsLayerPaintBackground = (1 << 0),
59 GraphicsLayerPaintForeground = (1 << 1),
60 GraphicsLayerPaintMask = (1 << 2),
61 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
62 GraphicsLayerPaintOverflowContents = (1 << 3),
64 GraphicsLayerPaintAll = (GraphicsLayerPaintBackground | GraphicsLayerPaintForeground | GraphicsLayerPaintMask)
66 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
67 typedef unsigned GraphicsLayerPaintingPhase;
70 enum AnimatedPropertyID {
71 AnimatedPropertyInvalid,
72 AnimatedPropertyWebkitTransform,
73 AnimatedPropertyOpacity,
74 AnimatedPropertyBackgroundColor,
75 AnimatedPropertyWebkitFilter
78 class GraphicsLayerClient {
80 virtual ~GraphicsLayerClient() {}
82 virtual bool shouldUseTileCache(const GraphicsLayer*) const { return false; }
83 virtual bool usingTileCache(const GraphicsLayer*) const { return false; }
85 // Callback for when hardware-accelerated animation started.
86 virtual void notifyAnimationStarted(const GraphicsLayer*, double time) = 0;
88 // Notification that a layer property changed that requires a subsequent call to syncCompositingState()
89 // to appear on the screen.
90 virtual void notifySyncRequired(const GraphicsLayer*) = 0;
92 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) = 0;
93 virtual void didCommitChangesForLayer(const GraphicsLayer*) const { }
95 // Multiplier for backing store size, related to high DPI.
96 virtual float deviceScaleFactor() const { return 1; }
98 virtual float pageScaleFactor() const { return 1; }
100 virtual bool showDebugBorders(const GraphicsLayer*) const = 0;
101 virtual bool showRepaintCounter(const GraphicsLayer*) const = 0;
103 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
104 virtual void platformLayerChanged(GraphicsLayer*, PlatformLayer* oldPlatformLayer, PlatformLayer* newPlatformLayer) = 0;
106 #if ENABLE(TIZEN_ACCELERATED_COMPOSITING)
107 virtual RenderBoxModelObject* renderer() const { return 0; }
110 // RenderLayerBacking overrides this to verify that it is not
111 // currently painting contents. An ASSERT fails, if it is.
112 // This is executed in GraphicsLayer construction and destruction
113 // to verify that we don't create or destroy GraphicsLayers
115 virtual void verifyNotPainting() { }
119 } // namespace WebCore
121 #endif // USE(ACCELERATED_COMPOSITING)
123 #endif // GraphicsLayerClient_h