| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
| 15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
| 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #ifndef SVGResources_h | 20 #ifndef SVGResources_h |
| 21 #define SVGResources_h | 21 #define SVGResources_h |
| 22 | 22 |
| 23 #include "wtf/Allocator.h" | 23 #include "wtf/Allocator.h" |
| 24 #include "wtf/HashSet.h" | 24 #include "wtf/HashSet.h" |
| 25 #include "wtf/Noncopyable.h" | 25 #include "wtf/Noncopyable.h" |
| 26 #include "wtf/OwnPtr.h" | 26 #include "wtf/PtrUtil.h" |
| 27 #include "wtf/PassOwnPtr.h" | 27 #include <memory> |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 | 30 |
| 31 class LayoutObject; | 31 class LayoutObject; |
| 32 class LayoutSVGResourceClipper; | 32 class LayoutSVGResourceClipper; |
| 33 class LayoutSVGResourceContainer; | 33 class LayoutSVGResourceContainer; |
| 34 class LayoutSVGResourceFilter; | 34 class LayoutSVGResourceFilter; |
| 35 class LayoutSVGResourceMarker; | 35 class LayoutSVGResourceMarker; |
| 36 class LayoutSVGResourceMasker; | 36 class LayoutSVGResourceMasker; |
| 37 class LayoutSVGResourcePaintServer; | 37 class LayoutSVGResourcePaintServer; |
| 38 class SVGElement; | 38 class SVGElement; |
| 39 class SVGComputedStyle; | 39 class SVGComputedStyle; |
| 40 | 40 |
| 41 // Holds a set of resources associated with a LayoutObject | 41 // Holds a set of resources associated with a LayoutObject |
| 42 class SVGResources { | 42 class SVGResources { |
| 43 WTF_MAKE_NONCOPYABLE(SVGResources); USING_FAST_MALLOC(SVGResources); | 43 WTF_MAKE_NONCOPYABLE(SVGResources); USING_FAST_MALLOC(SVGResources); |
| 44 public: | 44 public: |
| 45 SVGResources(); | 45 SVGResources(); |
| 46 | 46 |
| 47 static PassOwnPtr<SVGResources> buildResources(const LayoutObject*, const SV
GComputedStyle&); | 47 static std::unique_ptr<SVGResources> buildResources(const LayoutObject*, con
st SVGComputedStyle&); |
| 48 void layoutIfNeeded(); | 48 void layoutIfNeeded(); |
| 49 | 49 |
| 50 static bool supportsMarkers(const SVGElement&); | 50 static bool supportsMarkers(const SVGElement&); |
| 51 | 51 |
| 52 // Ordinary resources | 52 // Ordinary resources |
| 53 LayoutSVGResourceClipper* clipper() const { return m_clipperFilterMaskerData
? m_clipperFilterMaskerData->clipper : 0; } | 53 LayoutSVGResourceClipper* clipper() const { return m_clipperFilterMaskerData
? m_clipperFilterMaskerData->clipper : 0; } |
| 54 LayoutSVGResourceMarker* markerStart() const { return m_markerData ? m_marke
rData->markerStart : 0; } | 54 LayoutSVGResourceMarker* markerStart() const { return m_markerData ? m_marke
rData->markerStart : 0; } |
| 55 LayoutSVGResourceMarker* markerMid() const { return m_markerData ? m_markerD
ata->markerMid : 0; } | 55 LayoutSVGResourceMarker* markerMid() const { return m_markerData ? m_markerD
ata->markerMid : 0; } |
| 56 LayoutSVGResourceMarker* markerEnd() const { return m_markerData ? m_markerD
ata->markerEnd : 0; } | 56 LayoutSVGResourceMarker* markerEnd() const { return m_markerData ? m_markerD
ata->markerEnd : 0; } |
| 57 LayoutSVGResourceMasker* masker() const { return m_clipperFilterMaskerData ?
m_clipperFilterMaskerData->masker : 0; } | 57 LayoutSVGResourceMasker* masker() const { return m_clipperFilterMaskerData ?
m_clipperFilterMaskerData->masker : 0; } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 struct ClipperFilterMaskerData { | 114 struct ClipperFilterMaskerData { |
| 115 USING_FAST_MALLOC(ClipperFilterMaskerData); | 115 USING_FAST_MALLOC(ClipperFilterMaskerData); |
| 116 public: | 116 public: |
| 117 ClipperFilterMaskerData() | 117 ClipperFilterMaskerData() |
| 118 : clipper(nullptr) | 118 : clipper(nullptr) |
| 119 , filter(nullptr) | 119 , filter(nullptr) |
| 120 , masker(nullptr) | 120 , masker(nullptr) |
| 121 { | 121 { |
| 122 } | 122 } |
| 123 | 123 |
| 124 static PassOwnPtr<ClipperFilterMaskerData> create() | 124 static std::unique_ptr<ClipperFilterMaskerData> create() |
| 125 { | 125 { |
| 126 return adoptPtr(new ClipperFilterMaskerData); | 126 return wrapUnique(new ClipperFilterMaskerData); |
| 127 } | 127 } |
| 128 | 128 |
| 129 LayoutSVGResourceClipper* clipper; | 129 LayoutSVGResourceClipper* clipper; |
| 130 LayoutSVGResourceFilter* filter; | 130 LayoutSVGResourceFilter* filter; |
| 131 LayoutSVGResourceMasker* masker; | 131 LayoutSVGResourceMasker* masker; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 // From SVG 1.1 2nd Edition | 134 // From SVG 1.1 2nd Edition |
| 135 // marker: line, path, polygon, polyline | 135 // marker: line, path, polygon, polyline |
| 136 struct MarkerData { | 136 struct MarkerData { |
| 137 USING_FAST_MALLOC(MarkerData); | 137 USING_FAST_MALLOC(MarkerData); |
| 138 public: | 138 public: |
| 139 MarkerData() | 139 MarkerData() |
| 140 : markerStart(nullptr) | 140 : markerStart(nullptr) |
| 141 , markerMid(nullptr) | 141 , markerMid(nullptr) |
| 142 , markerEnd(nullptr) | 142 , markerEnd(nullptr) |
| 143 { | 143 { |
| 144 } | 144 } |
| 145 | 145 |
| 146 static PassOwnPtr<MarkerData> create() | 146 static std::unique_ptr<MarkerData> create() |
| 147 { | 147 { |
| 148 return adoptPtr(new MarkerData); | 148 return wrapUnique(new MarkerData); |
| 149 } | 149 } |
| 150 | 150 |
| 151 LayoutSVGResourceMarker* markerStart; | 151 LayoutSVGResourceMarker* markerStart; |
| 152 LayoutSVGResourceMarker* markerMid; | 152 LayoutSVGResourceMarker* markerMid; |
| 153 LayoutSVGResourceMarker* markerEnd; | 153 LayoutSVGResourceMarker* markerEnd; |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 // From SVG 1.1 2nd Edition | 156 // From SVG 1.1 2nd Edition |
| 157 // fill: 'shapes' and 'text content elements' | 157 // fill: 'shapes' and 'text content elements' |
| 158 // stroke: 'shapes' and 'text content elements' | 158 // stroke: 'shapes' and 'text content elements' |
| 159 // -> circle, ellipse, line, path, polygon, polyline, rect, text, textPath,
tspan | 159 // -> circle, ellipse, line, path, polygon, polyline, rect, text, textPath,
tspan |
| 160 struct FillStrokeData { | 160 struct FillStrokeData { |
| 161 USING_FAST_MALLOC(FillStrokeData); | 161 USING_FAST_MALLOC(FillStrokeData); |
| 162 public: | 162 public: |
| 163 FillStrokeData() | 163 FillStrokeData() |
| 164 : fill(nullptr) | 164 : fill(nullptr) |
| 165 , stroke(nullptr) | 165 , stroke(nullptr) |
| 166 { | 166 { |
| 167 } | 167 } |
| 168 | 168 |
| 169 static PassOwnPtr<FillStrokeData> create() | 169 static std::unique_ptr<FillStrokeData> create() |
| 170 { | 170 { |
| 171 return adoptPtr(new FillStrokeData); | 171 return wrapUnique(new FillStrokeData); |
| 172 } | 172 } |
| 173 | 173 |
| 174 LayoutSVGResourcePaintServer* fill; | 174 LayoutSVGResourcePaintServer* fill; |
| 175 LayoutSVGResourcePaintServer* stroke; | 175 LayoutSVGResourcePaintServer* stroke; |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 OwnPtr<ClipperFilterMaskerData> m_clipperFilterMaskerData; | 178 std::unique_ptr<ClipperFilterMaskerData> m_clipperFilterMaskerData; |
| 179 OwnPtr<MarkerData> m_markerData; | 179 std::unique_ptr<MarkerData> m_markerData; |
| 180 OwnPtr<FillStrokeData> m_fillStrokeData; | 180 std::unique_ptr<FillStrokeData> m_fillStrokeData; |
| 181 LayoutSVGResourceContainer* m_linkedResource; | 181 LayoutSVGResourceContainer* m_linkedResource; |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 } // namespace blink | 184 } // namespace blink |
| 185 | 185 |
| 186 #endif | 186 #endif |
| OLD | NEW |