Index: Source/core/paint/SVGClipPainter.h |
diff --git a/Source/core/paint/SVGClipPainter.h b/Source/core/paint/SVGClipPainter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..36c246aaae9d41a098ce241d3768f94460cae899 |
--- /dev/null |
+++ b/Source/core/paint/SVGClipPainter.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2015 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 SVGClipPainter_h |
+#define SVGClipPainter_h |
+ |
+#include "platform/geometry/FloatRect.h" |
+#include "platform/graphics/paint/DisplayItem.h" |
+ |
+namespace blink { |
+ |
+class AffineTransform; |
+class GraphicsContext; |
+class LayoutObject; |
+class LayoutSVGResourceClipper; |
+ |
+class SVGClipPainter { |
+public: |
+ enum ClipperState { |
+ ClipperNotApplied, |
+ ClipperAppliedPath, |
+ ClipperAppliedMask |
+ }; |
+ |
+ SVGClipPainter(LayoutSVGResourceClipper& clip) : m_clip(clip) { } |
+ |
+ // FIXME: Filters are also stateful resources that could benefit from having their state managed |
+ // on the caller stack instead of the current hashmap. We should look at refactoring these |
+ // into a general interface that can be shared. |
+ bool applyStatefulResource(LayoutObject*, GraphicsContext*, ClipperState&); |
+ void postApplyStatefulResource(LayoutObject*, GraphicsContext*, ClipperState&); |
+ |
+ // clipPath can be clipped too, but don't have a boundingBox or paintInvalidationRect. So we can't call |
+ // applyResource directly and use the rects from the object, since they are empty for LayoutSVGResources |
+ // FIXME: We made applyClippingToContext public because we cannot call applyResource on HTML elements (it asserts on LayoutObject::objectBoundingBox) |
+ bool applyClippingToContext(LayoutObject*, const FloatRect&, const FloatRect&, GraphicsContext*, ClipperState&); |
+ |
+private: |
+ void drawClipMaskContent(GraphicsContext*, DisplayItemClient, const FloatRect&); |
+ |
+ LayoutSVGResourceClipper& m_clip; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // SVGShapePainter_h |