Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / core / dom / CompositorProxy.h
blob76a77528854946cd0dc179e31a96c7b2c117af1b
1 // Copyright 2015 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.
5 #ifndef CompositorProxy_h
6 #define CompositorProxy_h
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/DOMMatrix.h"
10 #include "core/dom/Element.h"
11 #include "platform/heap/Handle.h"
12 #include "wtf/PassOwnPtr.h"
13 #include "wtf/PassRefPtr.h"
14 #include "wtf/RefCounted.h"
15 #include "wtf/text/WTFString.h"
17 namespace blink {
19 class DOMMatrix;
20 class ExceptionState;
21 class ExecutionContext;
23 class CompositorProxy final : public GarbageCollectedFinalized<CompositorProxy>, public ScriptWrappable {
24 DEFINE_WRAPPERTYPEINFO();
25 public:
26 static CompositorProxy* create(ExecutionContext*, Element*, const Vector<String>& attributeArray, ExceptionState&);
27 static CompositorProxy* create(uint64_t element, uint32_t attributeFlags);
28 virtual ~CompositorProxy();
30 enum class Attributes {
31 NONE = 0,
32 OPACITY = 1 << 0,
33 SCROLL_LEFT = 1 << 1,
34 SCROLL_TOP = 1 << 2,
35 TOUCH = 1 << 3,
36 TRANSFORM = 1 << 4,
39 DEFINE_INLINE_TRACE()
41 visitor->trace(m_transform);
44 uint64_t elementId() const { return m_elementId; }
45 uint32_t bitfieldsSupported() const { return m_bitfieldsSupported; }
46 bool supports(const String& attribute) const;
48 bool connected() const { return m_connected; }
49 void disconnect();
51 double opacity(ExceptionState&) const;
52 double scrollLeft(ExceptionState&) const;
53 double scrollTop(ExceptionState&) const;
54 DOMMatrix* transform(ExceptionState&) const;
56 void setOpacity(double, ExceptionState&);
57 void setScrollLeft(double, ExceptionState&);
58 void setScrollTop(double, ExceptionState&);
59 void setTransform(DOMMatrix*, ExceptionState&);
61 protected:
62 CompositorProxy(Element&, const Vector<String>& attributeArray);
63 CompositorProxy(uint64_t element, uint32_t attributeFlags);
65 private:
66 bool raiseExceptionIfNotMutable(Attributes, ExceptionState&) const;
68 const uint64_t m_elementId = 0;
69 const uint32_t m_bitfieldsSupported = 0;
70 uint32_t m_mutatedAttributes = 0;
72 double m_opacity = 0;
73 double m_scrollLeft = 0;
74 double m_scrollTop = 0;
75 Member<DOMMatrix> m_transform;
77 bool m_connected = true;
80 } // namespace blink
82 #endif // CompositorProxy_h