OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 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 24 matching lines...) Expand all Loading... |
35 virtual ~RenderSVGResourceContainer(); | 35 virtual ~RenderSVGResourceContainer(); |
36 | 36 |
37 virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0; | 37 virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0; |
38 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation =
true) = 0; | 38 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation =
true) = 0; |
39 | 39 |
40 virtual void layout() OVERRIDE; | 40 virtual void layout() OVERRIDE; |
41 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV
ERRIDE FINAL; | 41 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV
ERRIDE FINAL; |
42 | 42 |
43 virtual bool isSVGResourceContainer() const OVERRIDE FINAL { return true; } | 43 virtual bool isSVGResourceContainer() const OVERRIDE FINAL { return true; } |
44 | 44 |
45 template<class Renderer> | |
46 Renderer* cast() | |
47 { | |
48 if (Renderer::s_resourceType == resourceType()) | |
49 return static_cast<Renderer*>(this); | |
50 | |
51 return 0; | |
52 } | |
53 | |
54 static AffineTransform transformOnNonScalingStroke(RenderObject*, const Affi
neTransform& resourceTransform); | 45 static AffineTransform transformOnNonScalingStroke(RenderObject*, const Affi
neTransform& resourceTransform); |
55 | 46 |
56 void idChanged(); | 47 void idChanged(); |
57 void addClientRenderLayer(Node*); | 48 void addClientRenderLayer(Node*); |
58 void addClientRenderLayer(RenderLayer*); | 49 void addClientRenderLayer(RenderLayer*); |
59 void removeClientRenderLayer(RenderLayer*); | 50 void removeClientRenderLayer(RenderLayer*); |
60 | 51 |
61 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = 0); | 52 void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = 0); |
62 | 53 |
63 protected: | 54 protected: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 98 |
108 if (RenderSVGResourceContainer* renderResource = treeScope.document().access
SVGExtensions().resourceById(id)) | 99 if (RenderSVGResourceContainer* renderResource = treeScope.document().access
SVGExtensions().resourceById(id)) |
109 return renderResource; | 100 return renderResource; |
110 | 101 |
111 return 0; | 102 return 0; |
112 } | 103 } |
113 | 104 |
114 template<typename Renderer> | 105 template<typename Renderer> |
115 Renderer* getRenderSVGResourceById(TreeScope& treeScope, const AtomicString& id) | 106 Renderer* getRenderSVGResourceById(TreeScope& treeScope, const AtomicString& id) |
116 { | 107 { |
117 if (RenderSVGResourceContainer* container = getRenderSVGResourceContainerByI
d(treeScope, id)) | 108 if (RenderSVGResourceContainer* container = getRenderSVGResourceContainerByI
d(treeScope, id)) { |
118 return container->cast<Renderer>(); | 109 if (container->resourceType() == Renderer::s_resourceType) |
119 | 110 return static_cast<Renderer*>(container); |
| 111 } |
120 return 0; | 112 return 0; |
121 } | 113 } |
122 | 114 |
123 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceContainer, isSVGResourceContain
er()); | 115 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGResourceContainer, isSVGResourceContain
er()); |
124 | 116 |
125 } | 117 } |
126 | 118 |
127 #endif | 119 #endif |
OLD | NEW |