OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
5 * Copyright (C) 2011 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2011 Dirk Schulze <krit@webkit.org> |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 163 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
164 LayoutObject* layoutObject = childElement->layoutObject(); | 164 LayoutObject* layoutObject = childElement->layoutObject(); |
165 if (!layoutObject) | 165 if (!layoutObject) |
166 continue; | 166 continue; |
167 | 167 |
168 const ComputedStyle* style = layoutObject->style(); | 168 const ComputedStyle* style = layoutObject->style(); |
169 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 169 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
170 continue; | 170 continue; |
171 | 171 |
172 WindRule newClipRule = style->svgStyle().clipRule(); | |
173 bool isUseElement = isSVGUseElement(*childElement); | 172 bool isUseElement = isSVGUseElement(*childElement); |
174 if (isUseElement) { | 173 if (isUseElement) { |
175 SVGUseElement& useElement = toSVGUseElement(*childElement); | 174 layoutObject = toSVGUseElement(*childElement).layoutObjectClipChild(
); |
176 layoutObject = useElement.layoutObjectClipChild(); | |
177 if (!layoutObject) | 175 if (!layoutObject) |
178 continue; | 176 continue; |
179 if (!useElement.hasAttribute(SVGNames::clip_ruleAttr)) | |
180 newClipRule = layoutObject->style()->svgStyle().clipRule(); | |
181 } | 177 } |
182 | 178 |
183 // Only shapes, paths and texts are allowed for clipping. | 179 // Only shapes, paths and texts are allowed for clipping. |
184 if (!layoutObject->isSVGShape() && !layoutObject->isSVGText()) | 180 if (!layoutObject->isSVGShape() && !layoutObject->isSVGText()) |
185 continue; | 181 continue; |
186 | 182 |
187 context.setFillRule(newClipRule); | |
188 | |
189 if (isUseElement) | 183 if (isUseElement) |
190 layoutObject = childElement->layoutObject(); | 184 layoutObject = childElement->layoutObject(); |
191 | 185 |
192 // Switch to a paint behavior where all children of this <clipPath> will
be laid out using special constraints: | 186 // Switch to a paint behavior where all children of this <clipPath> will
be laid out using special constraints: |
193 // - fill-opacity/stroke-opacity/opacity set to 1 | 187 // - fill-opacity/stroke-opacity/opacity set to 1 |
194 // - masker/filter not applied when laying out the children | 188 // - masker/filter not applied when laying out the children |
195 // - fill is set to the initial fill paint server (solid, black) | 189 // - fill is set to the initial fill paint server (solid, black) |
196 // - stroke is set to the initial stroke paint server (none) | 190 // - stroke is set to the initial stroke paint server (none) |
197 PaintInfo info(&context, LayoutRect::infiniteIntRect(), PaintPhaseForegr
ound, PaintBehaviorRenderingClipPathAsMask); | 191 PaintInfo info(&context, LayoutRect::infiniteIntRect(), PaintPhaseForegr
ound, PaintBehaviorRenderingClipPathAsMask); |
198 layoutObject->paint(info, IntPoint()); | 192 layoutObject->paint(info, IntPoint()); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 AffineTransform transform; | 263 AffineTransform transform; |
270 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 264 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
271 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 265 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
272 return transform.mapRect(m_clipBoundaries); | 266 return transform.mapRect(m_clipBoundaries); |
273 } | 267 } |
274 | 268 |
275 return m_clipBoundaries; | 269 return m_clipBoundaries; |
276 } | 270 } |
277 | 271 |
278 } | 272 } |
OLD | NEW |