OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 ClipperState state; | 40 ClipperState state; |
41 }; | 41 }; |
42 | 42 |
43 class RenderSVGResourceClipper FINAL : public RenderSVGResourceContainer { | 43 class RenderSVGResourceClipper FINAL : public RenderSVGResourceContainer { |
44 public: | 44 public: |
45 explicit RenderSVGResourceClipper(SVGClipPathElement*); | 45 explicit RenderSVGResourceClipper(SVGClipPathElement*); |
46 virtual ~RenderSVGResourceClipper(); | 46 virtual ~RenderSVGResourceClipper(); |
47 | 47 |
48 virtual const char* renderName() const { return "RenderSVGResourceClipper";
} | 48 virtual const char* renderName() const OVERRIDE { return "RenderSVGResourceC
lipper"; } |
49 | 49 |
50 virtual void removeAllClientsFromCache(bool markForInvalidation = true); | 50 virtual void removeAllClientsFromCache(bool markForInvalidation = true) OVER
RIDE; |
51 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation =
true); | 51 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation =
true) OVERRIDE; |
52 | 52 |
53 virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, u
nsigned short resourceMode) OVERRIDE FINAL; | 53 virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, u
nsigned short resourceMode) OVERRIDE; |
54 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned sh
ort, const Path*, const RenderSVGShape*) OVERRIDE FINAL; | 54 virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned sh
ort, const Path*, const RenderSVGShape*) OVERRIDE; |
55 | 55 |
56 // FIXME: Filters are also stateful resources that could benefit from having
their state managed | 56 // FIXME: Filters are also stateful resources that could benefit from having
their state managed |
57 // on the caller stack instead of the current hashmap. We should look
at refactoring these | 57 // on the caller stack instead of the current hashmap. We should look
at refactoring these |
58 // into a general interface that can be shared. | 58 // into a general interface that can be shared. |
59 bool applyStatefulResource(RenderObject*, GraphicsContext*&, ClipperContext&
); | 59 bool applyStatefulResource(RenderObject*, GraphicsContext*&, ClipperContext&
); |
60 void postApplyStatefulResource(RenderObject*, GraphicsContext*&, ClipperCont
ext&); | 60 void postApplyStatefulResource(RenderObject*, GraphicsContext*&, ClipperCont
ext&); |
61 | 61 |
62 // clipPath can be clipped too, but don't have a boundingBox or repaintRect.
So we can't call | 62 // clipPath can be clipped too, but don't have a boundingBox or repaintRect.
So we can't call |
63 // applyResource directly and use the rects from the object, since they are
empty for RenderSVGResources | 63 // applyResource directly and use the rects from the object, since they are
empty for RenderSVGResources |
64 // FIXME: We made applyClippingToContext public because we cannot call apply
Resource on HTML elements (it asserts on RenderObject::objectBoundingBox) | 64 // FIXME: We made applyClippingToContext public because we cannot call apply
Resource on HTML elements (it asserts on RenderObject::objectBoundingBox) |
65 bool applyClippingToContext(RenderObject*, const FloatRect&, const FloatRect
&, GraphicsContext*, ClipperContext&); | 65 bool applyClippingToContext(RenderObject*, const FloatRect&, const FloatRect
&, GraphicsContext*, ClipperContext&); |
66 | 66 |
67 FloatRect resourceBoundingBox(RenderObject*); | 67 FloatRect resourceBoundingBox(RenderObject*); |
68 | 68 |
69 virtual RenderSVGResourceType resourceType() const { return s_resourceType;
} | 69 virtual RenderSVGResourceType resourceType() const OVERRIDE { return s_resou
rceType; } |
70 | 70 |
71 bool hitTestClipContent(const FloatRect&, const FloatPoint&); | 71 bool hitTestClipContent(const FloatRect&, const FloatPoint&); |
72 | 72 |
73 SVGUnitTypes::SVGUnitType clipPathUnits() const { return toSVGClipPathElemen
t(element())->clipPathUnitsCurrentValue(); } | 73 SVGUnitTypes::SVGUnitType clipPathUnits() const { return toSVGClipPathElemen
t(element())->clipPathUnitsCurrentValue(); } |
74 | 74 |
75 static const RenderSVGResourceType s_resourceType; | 75 static const RenderSVGResourceType s_resourceType; |
76 private: | 76 private: |
77 bool tryPathOnlyClipping(GraphicsContext*, const AffineTransform&, const Flo
atRect&); | 77 bool tryPathOnlyClipping(GraphicsContext*, const AffineTransform&, const Flo
atRect&); |
78 void drawClipMaskContent(GraphicsContext*, const FloatRect& targetBoundingBo
x); | 78 void drawClipMaskContent(GraphicsContext*, const FloatRect& targetBoundingBo
x); |
79 PassRefPtr<DisplayList> asDisplayList(GraphicsContext*, const AffineTransfor
m&); | 79 PassRefPtr<DisplayList> asDisplayList(GraphicsContext*, const AffineTransfor
m&); |
80 void calculateClipContentRepaintRect(); | 80 void calculateClipContentRepaintRect(); |
81 | 81 |
82 RefPtr<DisplayList> m_clipContentDisplayList; | 82 RefPtr<DisplayList> m_clipContentDisplayList; |
83 FloatRect m_clipBoundaries; | 83 FloatRect m_clipBoundaries; |
84 | 84 |
85 // Reference cycle detection. | 85 // Reference cycle detection. |
86 bool m_inClipExpansion; | 86 bool m_inClipExpansion; |
87 }; | 87 }; |
88 | 88 |
89 DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(RenderSVGResourceClipper, ClipperResourceT
ype); | 89 DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(RenderSVGResourceClipper, ClipperResourceT
ype); |
90 | 90 |
91 } | 91 } |
92 | 92 |
93 #endif | 93 #endif |
OLD | NEW |