| Index: third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h
|
| diff --git a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2eb72712618657f4ed19928372cfec97d2192daa
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h
|
| @@ -0,0 +1,76 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef PaintRenderingContext2D_h
|
| +#define PaintRenderingContext2D_h
|
| +
|
| +#include "bindings/core/v8/ScriptWrappable.h"
|
| +#include "modules/ModulesExport.h"
|
| +#include "modules/canvas2d/BaseRenderingContext2D.h"
|
| +#include "third_party/skia/include/core/SkCanvas.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class CanvasImageSource;
|
| +class Color;
|
| +class ImageBuffer;
|
| +
|
| +class MODULES_EXPORT PaintRenderingContext2D : public BaseRenderingContext2D, public RefCountedWillBeGarbageCollectedFinalized<PaintRenderingContext2D>, public ScriptWrappable {
|
| + DEFINE_WRAPPERTYPEINFO();
|
| + WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaintRenderingContext2D);
|
| + WTF_MAKE_NONCOPYABLE(PaintRenderingContext2D);
|
| + USING_FAST_MALLOC_WILL_BE_REMOVED(PaintRenderingContext2D);
|
| +public:
|
| + static PassRefPtrWillBeRawPtr<PaintRenderingContext2D> create(PassOwnPtr<ImageBuffer> imageBuffer)
|
| + {
|
| + return adoptRefWillBeNoop(new PaintRenderingContext2D(imageBuffer));
|
| + }
|
| +
|
| + // BaseRenderingContext2D
|
| +
|
| + // PaintRenderingContext2D doesn't have any pixel readback so the origin
|
| + // is always clean, and unable to taint it.
|
| + bool originClean() const final { return true; }
|
| + void setOriginTainted() final { }
|
| + bool wouldTaintOrigin(CanvasImageSource*) final { return false; }
|
| +
|
| + int width() const final;
|
| + int height() const final;
|
| +
|
| + bool hasImageBuffer() const final { return m_imageBuffer; }
|
| + ImageBuffer* imageBuffer() const final { return m_imageBuffer.get(); }
|
| +
|
| + bool parseColorOrCurrentColor(Color&, const String& colorString) const final;
|
| +
|
| + SkCanvas* drawingCanvas() const final;
|
| + SkCanvas* existingDrawingCanvas() const final;
|
| + void disableDeferral(DisableDeferralReason) final { }
|
| +
|
| + AffineTransform baseTransform() const final;
|
| +
|
| + void didDraw(const SkIRect& dirtyRect) final;
|
| +
|
| + // TODO(ikilpatrick): We'll need to either only accept resolved filters
|
| + // from a typed-om <filter> object, or use the appropriate style resolution
|
| + // host to determine 'em' units etc in filters. At the moment just pretend
|
| + // that we don't have a filter set.
|
| + bool stateHasFilter() final { return false; }
|
| + SkImageFilter* stateGetFilter() final { return nullptr; }
|
| +
|
| + void validateStateStack() final;
|
| +
|
| + bool hasAlpha() const final { return true; }
|
| +
|
| + // PaintRenderingContext2D cannot lose it's context.
|
| + bool isContextLost() const final { return false; }
|
| +
|
| +private:
|
| + explicit PaintRenderingContext2D(PassOwnPtr<ImageBuffer>);
|
| +
|
| + OwnPtr<ImageBuffer> m_imageBuffer;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // PaintRenderingContext2D_h
|
|
|