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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 | 85 |
86 bool RenderSVGResourceClipper::tryPathOnlyClipping(GraphicsContext* context, | 86 bool RenderSVGResourceClipper::tryPathOnlyClipping(GraphicsContext* context, |
87 const AffineTransform& animatedLocalTransform, const FloatRect& objectBoundi
ngBox) { | 87 const AffineTransform& animatedLocalTransform, const FloatRect& objectBoundi
ngBox) { |
88 // If the current clip-path gets clipped itself, we have to fallback to mask
ing. | 88 // If the current clip-path gets clipped itself, we have to fallback to mask
ing. |
89 if (!style()->svgStyle().clipperResource().isEmpty()) | 89 if (!style()->svgStyle().clipperResource().isEmpty()) |
90 return false; | 90 return false; |
91 WindRule clipRule = RULE_NONZERO; | 91 WindRule clipRule = RULE_NONZERO; |
92 Path clipPath = Path(); | 92 Path clipPath = Path(); |
93 | 93 |
94 for (Element* childElement = ElementTraversal::firstChild(*element()); child
Element; childElement = ElementTraversal::nextSibling(*childElement)) { | 94 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
95 RenderObject* renderer = childElement->renderer(); | 95 RenderObject* renderer = childElement->renderer(); |
96 if (!renderer) | 96 if (!renderer) |
97 continue; | 97 continue; |
98 // Only shapes or paths are supported for direct clipping. We need to fa
llback to masking for texts. | 98 // Only shapes or paths are supported for direct clipping. We need to fa
llback to masking for texts. |
99 if (renderer->isSVGText()) | 99 if (renderer->isSVGText()) |
100 return false; | 100 return false; |
101 if (!childElement->isSVGElement() || !toSVGElement(childElement)->isSVGG
raphicsElement()) | 101 if (!childElement->isSVGGraphicsElement()) |
102 continue; | 102 continue; |
103 SVGGraphicsElement* styled = toSVGGraphicsElement(childElement); | 103 SVGGraphicsElement* styled = toSVGGraphicsElement(childElement); |
104 RenderStyle* style = renderer->style(); | 104 RenderStyle* style = renderer->style(); |
105 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 105 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
106 continue; | 106 continue; |
107 const SVGRenderStyle& svgStyle = style->svgStyle(); | 107 const SVGRenderStyle& svgStyle = style->svgStyle(); |
108 // Current shape in clip-path gets clipped too. Fallback to masking. | 108 // Current shape in clip-path gets clipped too. Fallback to masking. |
109 if (!svgStyle.clipperResource().isEmpty()) | 109 if (!svgStyle.clipperResource().isEmpty()) |
110 return false; | 110 return false; |
111 | 111 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 AffineTransform transform; | 373 AffineTransform transform; |
374 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 374 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
375 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 375 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
376 return transform.mapRect(m_clipBoundaries); | 376 return transform.mapRect(m_clipBoundaries); |
377 } | 377 } |
378 | 378 |
379 return m_clipBoundaries; | 379 return m_clipBoundaries; |
380 } | 380 } |
381 | 381 |
382 } | 382 } |
OLD | NEW |