| 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 "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
| 9 #include "core/css/CSSSyntaxDescriptor.h" | 9 #include "core/css/CSSSyntaxDescriptor.h" |
| 10 #include "core/css/cssom/CSSStyleValue.h" | 10 #include "core/css/cssom/CSSStyleValue.h" |
| 11 #include "platform/bindings/ScriptWrappable.h" | 11 #include "platform/bindings/ScriptWrappable.h" |
| 12 #include "platform/bindings/TraceWrapperMember.h" | 12 #include "platform/bindings/TraceWrapperMember.h" |
| 13 #include "platform/bindings/TraceWrapperV8Reference.h" | 13 #include "platform/bindings/TraceWrapperV8Reference.h" |
| 14 #include "platform/geometry/IntSize.h" | 14 #include "platform/geometry/IntSize.h" |
| 15 #include "platform/heap/Handle.h" | 15 #include "platform/heap/Handle.h" |
| 16 #include "v8/include/v8.h" | 16 #include "v8/include/v8.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class Image; | 20 class Image; |
| 21 class LayoutObject; | |
| 22 class ScriptState; | 21 class ScriptState; |
| 22 class ImageResourceObserver; |
| 23 | 23 |
| 24 // Represents a javascript class registered on the PaintWorkletGlobalScope by | 24 // Represents a javascript class registered on the PaintWorkletGlobalScope by |
| 25 // the author. It will store the properties for invalidation and input argument | 25 // the author. It will store the properties for invalidation and input argument |
| 26 // types as well. | 26 // types as well. |
| 27 class CSSPaintDefinition final | 27 class CSSPaintDefinition final |
| 28 : public GarbageCollectedFinalized<CSSPaintDefinition>, | 28 : public GarbageCollectedFinalized<CSSPaintDefinition>, |
| 29 public TraceWrapperBase { | 29 public TraceWrapperBase { |
| 30 public: | 30 public: |
| 31 static CSSPaintDefinition* Create( | 31 static CSSPaintDefinition* Create( |
| 32 ScriptState*, | 32 ScriptState*, |
| 33 v8::Local<v8::Function> constructor, | 33 v8::Local<v8::Function> constructor, |
| 34 v8::Local<v8::Function> paint, | 34 v8::Local<v8::Function> paint, |
| 35 Vector<CSSPropertyID>&, | 35 Vector<CSSPropertyID>&, |
| 36 Vector<AtomicString>& custom_invalidation_properties, | 36 Vector<AtomicString>& custom_invalidation_properties, |
| 37 Vector<CSSSyntaxDescriptor>& input_argument_types, | 37 Vector<CSSSyntaxDescriptor>& input_argument_types, |
| 38 bool has_alpha); | 38 bool has_alpha); |
| 39 virtual ~CSSPaintDefinition(); | 39 virtual ~CSSPaintDefinition(); |
| 40 | 40 |
| 41 // Invokes the javascript 'paint' callback on an instance of the javascript | 41 // Invokes the javascript 'paint' callback on an instance of the javascript |
| 42 // class. The size given will be the size of the PaintRenderingContext2D | 42 // class. The size given will be the size of the PaintRenderingContext2D |
| 43 // given to the callback. | 43 // given to the callback. |
| 44 // | 44 // |
| 45 // This may return a nullptr (representing an invalid image) if javascript | 45 // This may return a nullptr (representing an invalid image) if javascript |
| 46 // throws an error. | 46 // throws an error. |
| 47 PassRefPtr<Image> Paint(const LayoutObject&, | 47 PassRefPtr<Image> Paint(const ImageResourceObserver&, |
| 48 const IntSize&, | 48 const IntSize&, |
| 49 const CSSStyleValueVector*); | 49 const CSSStyleValueVector*); |
| 50 const Vector<CSSPropertyID>& NativeInvalidationProperties() const { | 50 const Vector<CSSPropertyID>& NativeInvalidationProperties() const { |
| 51 return native_invalidation_properties_; | 51 return native_invalidation_properties_; |
| 52 } | 52 } |
| 53 const Vector<AtomicString>& CustomInvalidationProperties() const { | 53 const Vector<AtomicString>& CustomInvalidationProperties() const { |
| 54 return custom_invalidation_properties_; | 54 return custom_invalidation_properties_; |
| 55 } | 55 } |
| 56 const Vector<CSSSyntaxDescriptor>& InputArgumentTypes() const { | 56 const Vector<CSSSyntaxDescriptor>& InputArgumentTypes() const { |
| 57 return input_argument_types_; | 57 return input_argument_types_; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 Vector<CSSPropertyID> native_invalidation_properties_; | 94 Vector<CSSPropertyID> native_invalidation_properties_; |
| 95 Vector<AtomicString> custom_invalidation_properties_; | 95 Vector<AtomicString> custom_invalidation_properties_; |
| 96 // Input argument types, if applicable. | 96 // Input argument types, if applicable. |
| 97 Vector<CSSSyntaxDescriptor> input_argument_types_; | 97 Vector<CSSSyntaxDescriptor> input_argument_types_; |
| 98 bool has_alpha_; | 98 bool has_alpha_; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace blink | 101 } // namespace blink |
| 102 | 102 |
| 103 #endif // CSSPaintDefinition_h | 103 #endif // CSSPaintDefinition_h |
| OLD | NEW |