| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CSSPaintDefinition_h | 5 #ifndef CSSPaintDefinition_h |
| 6 #define CSSPaintDefinition_h | 6 #define CSSPaintDefinition_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "core/CSSPropertyNames.h" | 9 #include "core/CSSPropertyNames.h" |
| 10 #include "platform/geometry/IntSize.h" | 10 #include "platform/geometry/IntSize.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include <v8.h> | 12 #include <v8.h> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class Image; | 16 class Image; |
| 17 class LayoutObject; |
| 17 class ScriptState; | 18 class ScriptState; |
| 18 | 19 |
| 19 // Represents a javascript class registered on the PaintWorkletGlobalScope by | 20 // Represents a javascript class registered on the PaintWorkletGlobalScope by |
| 20 // the author. | 21 // the author. |
| 21 class CSSPaintDefinition final : public GarbageCollectedFinalized<CSSPaintDefini
tion> { | 22 class CSSPaintDefinition final : public GarbageCollectedFinalized<CSSPaintDefini
tion> { |
| 22 public: | 23 public: |
| 23 static CSSPaintDefinition* create(ScriptState*, v8::Local<v8::Function> cons
tructor, v8::Local<v8::Function> paint, Vector<CSSPropertyID>&, Vector<AtomicStr
ing>& customInvalidationProperties); | 24 static CSSPaintDefinition* create(ScriptState*, v8::Local<v8::Function> cons
tructor, v8::Local<v8::Function> paint, Vector<CSSPropertyID>&, Vector<AtomicStr
ing>& customInvalidationProperties); |
| 24 virtual ~CSSPaintDefinition(); | 25 virtual ~CSSPaintDefinition(); |
| 25 | 26 |
| 26 // Invokes the javascript 'paint' callback on an instance of the javascript | 27 // Invokes the javascript 'paint' callback on an instance of the javascript |
| 27 // class. The size given will be the size of the PaintRenderingContext2D | 28 // class. The size given will be the size of the PaintRenderingContext2D |
| 28 // given to the callback. | 29 // given to the callback. |
| 29 // | 30 // |
| 30 // This may return a nullptr (representing an invalid image) if javascript | 31 // This may return a nullptr (representing an invalid image) if javascript |
| 31 // throws an error. | 32 // throws an error. |
| 32 PassRefPtr<Image> paint(const IntSize&); | 33 PassRefPtr<Image> paint(const LayoutObject&, const IntSize&); |
| 33 const Vector<CSSPropertyID>& nativeInvalidationProperties() const { return m
_nativeInvalidationProperties; } | 34 const Vector<CSSPropertyID>& nativeInvalidationProperties() const { return m
_nativeInvalidationProperties; } |
| 34 const Vector<AtomicString>& customInvalidationProperties() const { return m_
customInvalidationProperties; } | 35 const Vector<AtomicString>& customInvalidationProperties() const { return m_
customInvalidationProperties; } |
| 35 | 36 |
| 36 ScriptState* getScriptState() const { return m_scriptState.get(); } | 37 ScriptState* getScriptState() const { return m_scriptState.get(); } |
| 37 | 38 |
| 38 v8::Local<v8::Function> paintFunctionForTesting(v8::Isolate* isolate) { retu
rn m_paint.newLocal(isolate); } | 39 v8::Local<v8::Function> paintFunctionForTesting(v8::Isolate* isolate) { retu
rn m_paint.newLocal(isolate); } |
| 39 | 40 |
| 40 DEFINE_INLINE_TRACE() { }; | 41 DEFINE_INLINE_TRACE() { }; |
| 41 | 42 |
| 42 private: | 43 private: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 57 | 58 |
| 58 bool m_didCallConstructor; | 59 bool m_didCallConstructor; |
| 59 | 60 |
| 60 Vector<CSSPropertyID> m_nativeInvalidationProperties; | 61 Vector<CSSPropertyID> m_nativeInvalidationProperties; |
| 61 Vector<AtomicString> m_customInvalidationProperties; | 62 Vector<AtomicString> m_customInvalidationProperties; |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace blink | 65 } // namespace blink |
| 65 | 66 |
| 66 #endif // CSSPaintDefinition_h | 67 #endif // CSSPaintDefinition_h |
| OLD | NEW |