1/*
2 * Copyright (C) 2010, 2013 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
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.
12 *
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 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.
24 */
25
26#ifndef PlatformCALayerWin_h
27#define PlatformCALayerWin_h
28
29#include "PlatformCALayer.h"
30
31namespace WebCore {
32
33class PlatformCALayerWin final : public PlatformCALayer {
34public:
35    static PassRefPtr<PlatformCALayer> create(LayerType, PlatformCALayerClient*);
36    static PassRefPtr<PlatformCALayer> create(PlatformLayer*, PlatformCALayerClient*);
37
38    ~PlatformCALayerWin();
39
40    virtual void setNeedsDisplay(const FloatRect* dirtyRect = 0) override;
41
42    virtual void copyContentsFromLayer(PlatformCALayer*) override;
43
44    virtual PlatformCALayer* superlayer() const override;
45    virtual void removeFromSuperlayer() override;
46    virtual void setSublayers(const PlatformCALayerList&) override;
47    virtual void removeAllSublayers() override;
48    virtual void appendSublayer(PlatformCALayer*) override;
49    virtual void insertSublayer(PlatformCALayer*, size_t index) override;
50    virtual void replaceSublayer(PlatformCALayer* reference, PlatformCALayer*) override;
51    virtual const PlatformCALayerList* customSublayers() const override { return m_customSublayers.get(); }
52    virtual void adoptSublayers(PlatformCALayer* source) override;
53
54    virtual void addAnimationForKey(const String& key, PlatformCAAnimation*) override;
55    virtual void removeAnimationForKey(const String& key) override;
56    virtual PassRefPtr<PlatformCAAnimation> animationForKey(const String& key) override;
57    virtual void animationStarted(const String& key, CFTimeInterval beginTime) override;
58
59    virtual void setMask(PlatformCALayer*) override;
60
61    virtual bool isOpaque() const override;
62    virtual void setOpaque(bool) override;
63
64    virtual FloatRect bounds() const override;
65    virtual void setBounds(const FloatRect&) override;
66
67    virtual FloatPoint3D position() const override;
68    virtual void setPosition(const FloatPoint3D&) override;
69
70    virtual FloatPoint3D anchorPoint() const override;
71    virtual void setAnchorPoint(const FloatPoint3D&) override;
72
73    virtual TransformationMatrix transform() const override;
74    virtual void setTransform(const TransformationMatrix&) override;
75
76    virtual TransformationMatrix sublayerTransform() const override;
77    virtual void setSublayerTransform(const TransformationMatrix&) override;
78
79    virtual void setHidden(bool) override;
80
81    virtual void setGeometryFlipped(bool) override;
82
83    virtual bool isDoubleSided() const override;
84    virtual void setDoubleSided(bool) override;
85
86    virtual bool masksToBounds() const override;
87    virtual void setMasksToBounds(bool) override;
88
89    virtual bool acceleratesDrawing() const override;
90    virtual void setAcceleratesDrawing(bool) override;
91
92    virtual CFTypeRef contents() const override;
93    virtual void setContents(CFTypeRef) override;
94
95    virtual void setContentsRect(const FloatRect&) override;
96
97    virtual void setMinificationFilter(FilterType) override;
98    virtual void setMagnificationFilter(FilterType) override;
99
100    virtual Color backgroundColor() const override;
101    virtual void setBackgroundColor(const Color&) override;
102
103    virtual void setBorderWidth(float) override;
104
105    virtual void setBorderColor(const Color&) override;
106
107    virtual float opacity() const override;
108    virtual void setOpacity(float) override;
109
110#if ENABLE(CSS_FILTERS)
111    virtual void setFilters(const FilterOperations&) override;
112    static bool filtersCanBeComposited(const FilterOperations&) { return false; }
113    virtual void copyFiltersFrom(const PlatformCALayer*) override;
114#endif
115
116    virtual void setName(const String&) override;
117
118    virtual void setSpeed(float) override;
119
120    virtual void setTimeOffset(CFTimeInterval) override;
121
122    virtual float contentsScale() const override;
123    virtual void setContentsScale(float) override;
124
125    virtual void setEdgeAntialiasingMask(unsigned) override;
126
127    virtual GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
128    virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance customAppearance) override { m_customAppearance = customAppearance; }
129
130    virtual GraphicsLayer::CustomBehavior customBehavior() const override { return m_customBehavior; }
131    virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior) override { m_customBehavior = customBehavior; }
132
133    virtual TiledBacking* tiledBacking() override;
134
135    virtual PlatformCALayer* rootLayer() const override;
136    virtual void setNeedsLayout() override;
137    virtual void setNeedsCommit() override;
138
139#ifndef NDEBUG
140    virtual void printTree() const override;
141#endif
142
143    virtual PassRefPtr<PlatformCALayer> clone(PlatformCALayerClient* owner) const override;
144
145    virtual PassRefPtr<PlatformCALayer> createCompatibleLayer(PlatformCALayer::LayerType, PlatformCALayerClient*) const override;
146
147private:
148    PlatformCALayerWin(LayerType, PlatformLayer*, PlatformCALayerClient* owner);
149
150    HashMap<String, RefPtr<PlatformCAAnimation>> m_animations;
151    std::unique_ptr<PlatformCALayerList> m_customSublayers;
152    GraphicsLayer::CustomAppearance m_customAppearance;
153    GraphicsLayer::CustomBehavior m_customBehavior;
154};
155
156}
157
158#endif // PlatformCALayerWin_h
159