summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/svg/RenderSVGResourceClipper.h')
-rw-r--r--Source/WebCore/rendering/svg/RenderSVGResourceClipper.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h b/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h
index 31c64b8b7..943e10312 100644
--- a/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h
+++ b/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h
@@ -17,13 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef RenderSVGResourceClipper_h
-#define RenderSVGResourceClipper_h
+#pragma once
-#if ENABLE(SVG)
-#include "GraphicsContext.h"
-#include "ImageBuffer.h"
-#include "IntSize.h"
#include "RenderSVGResourceContainer.h"
#include "SVGClipPathElement.h"
#include "SVGUnitTypes.h"
@@ -32,50 +27,55 @@
namespace WebCore {
-struct ClipperData {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- std::unique_ptr<ImageBuffer> clipMaskImage;
-};
+class GraphicsContext;
+class ImageBuffer;
+
+typedef std::unique_ptr<ImageBuffer> ClipperMaskImage;
class RenderSVGResourceClipper final : public RenderSVGResourceContainer {
public:
- RenderSVGResourceClipper(SVGClipPathElement&, PassRef<RenderStyle>);
+ RenderSVGResourceClipper(SVGClipPathElement&, RenderStyle&&);
virtual ~RenderSVGResourceClipper();
- SVGClipPathElement& clipPathElement() const { return toSVGClipPathElement(nodeForNonAnonymous()); }
+ SVGClipPathElement& clipPathElement() const { return downcast<SVGClipPathElement>(nodeForNonAnonymous()); }
- virtual void removeAllClientsFromCache(bool markForInvalidation = true);
- virtual void removeClientFromCache(RenderObject&, bool markForInvalidation = true);
+ void removeAllClientsFromCache(bool markForInvalidation = true) override;
+ void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override;
- virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override;
+ bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override;
// clipPath can be clipped too, but don't have a boundingBox or repaintRect. So we can't call
// applyResource directly and use the rects from the object, since they are empty for RenderSVGResources
// FIXME: We made applyClippingToContext public because we cannot call applyResource on HTML elements (it asserts on RenderObject::objectBoundingBox)
- bool applyClippingToContext(RenderElement&, const FloatRect&, const FloatRect&, GraphicsContext*);
- virtual FloatRect resourceBoundingBox(const RenderObject&) override;
+ bool applyClippingToContext(RenderElement&, const FloatRect&, const FloatRect&, GraphicsContext&);
+ FloatRect resourceBoundingBox(const RenderObject&) override;
- virtual RenderSVGResourceType resourceType() const { return ClipperResourceType; }
+ RenderSVGResourceType resourceType() const override { return ClipperResourceType; }
bool hitTestClipContent(const FloatRect&, const FloatPoint&);
SVGUnitTypes::SVGUnitType clipPathUnits() const { return clipPathElement().clipPathUnits(); }
- static RenderSVGResourceType s_resourceType;
+protected:
+ bool selfNeedsClientInvalidation() const override { return (everHadLayout() || m_clipper.size()) && selfNeedsLayout(); }
+
private:
void element() const = delete;
- virtual const char* renderName() const override { return "RenderSVGResourceClipper"; }
+ const char* renderName() const override { return "RenderSVGResourceClipper"; }
+ bool isSVGResourceClipper() const override { return true; }
- bool pathOnlyClipping(GraphicsContext*, const AffineTransform&, const FloatRect&);
- bool drawContentIntoMaskImage(ClipperData*, const FloatRect& objectBoundingBox);
+ bool pathOnlyClipping(GraphicsContext&, const AffineTransform&, const FloatRect&);
+ bool drawContentIntoMaskImage(const ClipperMaskImage&, const FloatRect& objectBoundingBox);
void calculateClipContentRepaintRect();
+ ClipperMaskImage& addRendererToClipper(const RenderObject&);
FloatRect m_clipBoundaries;
- HashMap<RenderObject*, std::unique_ptr<ClipperData>> m_clipper;
+ HashMap<const RenderObject*, ClipperMaskImage> m_clipper;
};
}
-#endif
-#endif
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::RenderSVGResourceClipper)
+static bool isType(const WebCore::RenderObject& renderer) { return renderer.isSVGResourceClipper(); }
+static bool isType(const WebCore::RenderSVGResource& resource) { return resource.resourceType() == WebCore::ClipperResourceType; }
+SPECIALIZE_TYPE_TRAITS_END()