| 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 CSSPaintImageGenerator_h | 5 #ifndef CSSPaintImageGenerator_h |
| 6 #define CSSPaintImageGenerator_h | 6 #define CSSPaintImageGenerator_h |
| 7 | 7 |
| 8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.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 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class Document; | 15 class Document; |
| 16 class Image; | 16 class Image; |
| 17 class LayoutObject; |
| 17 | 18 |
| 18 // Produces a PaintGeneratedImage from a CSS Paint API callback. | 19 // Produces a PaintGeneratedImage from a CSS Paint API callback. |
| 19 // https://drafts.css-houdini.org/css-paint-api/ | 20 // https://drafts.css-houdini.org/css-paint-api/ |
| 20 class CORE_EXPORT CSSPaintImageGenerator : public GarbageCollectedFinalized<CSSP
aintImageGenerator> { | 21 class CORE_EXPORT CSSPaintImageGenerator : public GarbageCollectedFinalized<CSSP
aintImageGenerator> { |
| 21 public: | 22 public: |
| 22 // This observer is used if the paint worklet doesn't have a javascript | 23 // This observer is used if the paint worklet doesn't have a javascript |
| 23 // class registered with the correct name yet. | 24 // class registered with the correct name yet. |
| 24 // paintImageGeneratorReady is called when the javascript class is | 25 // paintImageGeneratorReady is called when the javascript class is |
| 25 // registered and ready to use. | 26 // registered and ready to use. |
| 26 class Observer : public GarbageCollectedFinalized<Observer> { | 27 class Observer : public GarbageCollectedFinalized<Observer> { |
| 27 public: | 28 public: |
| 28 virtual ~Observer() { }; | 29 virtual ~Observer() { }; |
| 29 virtual void paintImageGeneratorReady() = 0; | 30 virtual void paintImageGeneratorReady() = 0; |
| 30 DEFINE_INLINE_VIRTUAL_TRACE() { } | 31 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 static CSSPaintImageGenerator* create(const String& name, Document&, Observe
r*); | 34 static CSSPaintImageGenerator* create(const String& name, Document&, Observe
r*); |
| 34 virtual ~CSSPaintImageGenerator(); | 35 virtual ~CSSPaintImageGenerator(); |
| 35 | 36 |
| 36 typedef CSSPaintImageGenerator* (*CSSPaintImageGeneratorCreateFunction)(cons
t String&, Document&, Observer*); | 37 typedef CSSPaintImageGenerator* (*CSSPaintImageGeneratorCreateFunction)(cons
t String&, Document&, Observer*); |
| 37 static void init(CSSPaintImageGeneratorCreateFunction); | 38 static void init(CSSPaintImageGeneratorCreateFunction); |
| 38 | 39 |
| 39 // Invokes the CSS Paint API 'paint' callback. May return a nullptr | 40 // Invokes the CSS Paint API 'paint' callback. May return a nullptr |
| 40 // representing an invalid image if an error occurred. | 41 // representing an invalid image if an error occurred. |
| 41 virtual PassRefPtr<Image> paint(const IntSize&) = 0; | 42 virtual PassRefPtr<Image> paint(const LayoutObject&, const IntSize&) = 0; |
| 42 | 43 |
| 43 virtual const Vector<CSSPropertyID>& nativeInvalidationProperties() const =
0; | 44 virtual const Vector<CSSPropertyID>& nativeInvalidationProperties() const =
0; |
| 44 virtual const Vector<AtomicString>& customInvalidationProperties() const = 0
; | 45 virtual const Vector<AtomicString>& customInvalidationProperties() const = 0
; |
| 45 | 46 |
| 46 DEFINE_INLINE_VIRTUAL_TRACE() { } | 47 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 } // namespace blink | 50 } // namespace blink |
| 50 | 51 |
| 51 #endif // CSSPaintImageGenerator_h | 52 #endif // CSSPaintImageGenerator_h |
| OLD | NEW |