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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #include "core/SVGNames.h" | 26 #include "core/SVGNames.h" |
27 #include "core/dom/ElementTraversal.h" | 27 #include "core/dom/ElementTraversal.h" |
28 #include "core/layout/HitTestResult.h" | 28 #include "core/layout/HitTestResult.h" |
29 #include "core/layout/svg/SVGLayoutSupport.h" | 29 #include "core/layout/svg/SVGLayoutSupport.h" |
30 #include "core/layout/svg/SVGResources.h" | 30 #include "core/layout/svg/SVGResources.h" |
31 #include "core/layout/svg/SVGResourcesCache.h" | 31 #include "core/layout/svg/SVGResourcesCache.h" |
32 #include "core/paint/CompositingRecorder.h" | 32 #include "core/paint/CompositingRecorder.h" |
33 #include "core/paint/PaintInfo.h" | 33 #include "core/paint/PaintInfo.h" |
34 #include "core/paint/TransformRecorder.h" | 34 #include "core/paint/TransformRecorder.h" |
| 35 #include "core/svg/SVGGeometryElement.h" |
35 #include "core/svg/SVGUseElement.h" | 36 #include "core/svg/SVGUseElement.h" |
36 #include "platform/RuntimeEnabledFeatures.h" | 37 #include "platform/RuntimeEnabledFeatures.h" |
37 #include "platform/graphics/paint/ClipPathDisplayItem.h" | 38 #include "platform/graphics/paint/ClipPathDisplayItem.h" |
38 #include "platform/graphics/paint/CompositingDisplayItem.h" | 39 #include "platform/graphics/paint/CompositingDisplayItem.h" |
39 #include "platform/graphics/paint/DisplayItemList.h" | 40 #include "platform/graphics/paint/DisplayItemList.h" |
40 #include "platform/graphics/paint/DrawingDisplayItem.h" | 41 #include "platform/graphics/paint/DrawingDisplayItem.h" |
41 #include "platform/graphics/paint/SkPictureBuilder.h" | 42 #include "platform/graphics/paint/SkPictureBuilder.h" |
42 #include "third_party/skia/include/core/SkPicture.h" | 43 #include "third_party/skia/include/core/SkPicture.h" |
43 | 44 |
44 namespace blink { | 45 namespace blink { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 const ComputedStyle* style = childLayoutObject->style(); | 88 const ComputedStyle* style = childLayoutObject->style(); |
88 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 89 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
89 continue; | 90 continue; |
90 const SVGComputedStyle& svgStyle = style->svgStyle(); | 91 const SVGComputedStyle& svgStyle = style->svgStyle(); |
91 // Current shape in clip-path gets clipped too. Fallback to masking. | 92 // Current shape in clip-path gets clipped too. Fallback to masking. |
92 if (!svgStyle.clipperResource().isEmpty()) | 93 if (!svgStyle.clipperResource().isEmpty()) |
93 return false; | 94 return false; |
94 | 95 |
95 if (clipPath.isEmpty()) { | 96 if (clipPath.isEmpty()) { |
96 // First clip shape. | 97 // First clip shape. |
97 styled->toClipPath(clipPath); | 98 if (isSVGGeometryElement(styled)) |
| 99 toSVGGeometryElement(styled)->toClipPath(clipPath); |
| 100 else if (isSVGUseElement(styled)) |
| 101 toSVGUseElement(styled)->toClipPath(clipPath); |
98 continue; | 102 continue; |
99 } | 103 } |
100 | 104 |
101 if (RuntimeEnabledFeatures::pathOpsSVGClippingEnabled()) { | 105 if (RuntimeEnabledFeatures::pathOpsSVGClippingEnabled()) { |
102 // Attempt to generate a combined clip path, fall back to masking if
not possible. | 106 // Attempt to generate a combined clip path, fall back to masking if
not possible. |
103 Path subPath; | 107 Path subPath; |
104 styled->toClipPath(subPath); | 108 if (isSVGGeometryElement(styled)) |
| 109 toSVGGeometryElement(styled)->toClipPath(clipPath); |
| 110 else if (isSVGUseElement(styled)) |
| 111 toSVGUseElement(styled)->toClipPath(clipPath); |
105 if (!clipPath.unionPath(subPath)) | 112 if (!clipPath.unionPath(subPath)) |
106 return false; | 113 return false; |
107 } else { | 114 } else { |
108 return false; | 115 return false; |
109 } | 116 } |
110 } | 117 } |
111 | 118 |
112 // We are able to represent the clip as a path. Continue with direct clippin
g, | 119 // We are able to represent the clip as a path. Continue with direct clippin
g, |
113 // and transform the content to userspace if necessary. | 120 // and transform the content to userspace if necessary. |
114 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 121 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 AffineTransform transform; | 261 AffineTransform transform; |
255 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 262 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
256 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 263 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
257 return transform.mapRect(m_clipBoundaries); | 264 return transform.mapRect(m_clipBoundaries); |
258 } | 265 } |
259 | 266 |
260 return m_clipBoundaries; | 267 return m_clipBoundaries; |
261 } | 268 } |
262 | 269 |
263 } | 270 } |
OLD | NEW |