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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 ASSERT(client); | 59 ASSERT(client); |
60 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); | 60 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); |
61 } | 61 } |
62 | 62 |
63 bool LayoutSVGResourceClipper::calculateClipContentPathIfNeeded() | 63 bool LayoutSVGResourceClipper::calculateClipContentPathIfNeeded() |
64 { | 64 { |
65 if (!m_clipContentPath.isEmpty()) | 65 if (!m_clipContentPath.isEmpty()) |
66 return true; | 66 return true; |
67 | 67 |
68 // If the current clip-path gets clipped itself, we have to fallback to mask
ing. | 68 // If the current clip-path gets clipped itself, we have to fallback to mask
ing. |
69 if (style()->svgStyle().hasClipper()) | 69 if (style()->svgStyle().clipPath()) |
70 return false; | 70 return false; |
71 | 71 |
72 unsigned opCount = 0; | 72 unsigned opCount = 0; |
73 bool usingBuilder = false; | 73 bool usingBuilder = false; |
74 SkOpBuilder clipPathBuilder; | 74 SkOpBuilder clipPathBuilder; |
75 | 75 |
76 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 76 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
77 LayoutObject* childLayoutObject = childElement->layoutObject(); | 77 LayoutObject* childLayoutObject = childElement->layoutObject(); |
78 if (!childLayoutObject) | 78 if (!childLayoutObject) |
79 continue; | 79 continue; |
80 // Only shapes or paths are supported for direct clipping. We need to fa
llback to masking for texts. | 80 // Only shapes or paths are supported for direct clipping. We need to fa
llback to masking for texts. |
81 if (childLayoutObject->isSVGText()) { | 81 if (childLayoutObject->isSVGText()) { |
82 m_clipContentPath.clear(); | 82 m_clipContentPath.clear(); |
83 return false; | 83 return false; |
84 } | 84 } |
85 if (!childElement->isSVGGraphicsElement()) | 85 if (!childElement->isSVGGraphicsElement()) |
86 continue; | 86 continue; |
87 | 87 |
88 const ComputedStyle* style = childLayoutObject->style(); | 88 const ComputedStyle* style = childLayoutObject->style(); |
89 if (!style || style->display() == NONE || (style->visibility() != EVisib
ility::Visible && !isSVGUseElement(*childElement))) | 89 if (!style || style->display() == NONE || (style->visibility() != EVisib
ility::Visible && !isSVGUseElement(*childElement))) |
90 continue; | 90 continue; |
91 | 91 |
92 // Current shape in clip-path gets clipped too. Fallback to masking. | 92 // Current shape in clip-path gets clipped too. Fallback to masking. |
93 if (style->svgStyle().hasClipper()) { | 93 if (style->svgStyle().clipPath()) { |
94 m_clipContentPath.clear(); | 94 m_clipContentPath.clear(); |
95 return false; | 95 return false; |
96 } | 96 } |
97 | 97 |
98 // First clip shape. | 98 // First clip shape. |
99 if (m_clipContentPath.isEmpty()) { | 99 if (m_clipContentPath.isEmpty()) { |
100 if (isSVGGeometryElement(childElement)) | 100 if (isSVGGeometryElement(childElement)) |
101 toSVGGeometryElement(childElement)->toClipPath(m_clipContentPath
); | 101 toSVGGeometryElement(childElement)->toClipPath(m_clipContentPath
); |
102 else if (isSVGUseElement(childElement)) | 102 else if (isSVGUseElement(childElement)) |
103 toSVGUseElement(childElement)->toClipPath(m_clipContentPath); | 103 toSVGUseElement(childElement)->toClipPath(m_clipContentPath); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 AffineTransform transform = toSVGClipPathElement(element())->calculateAnimat
edLocalTransform(); | 276 AffineTransform transform = toSVGClipPathElement(element())->calculateAnimat
edLocalTransform(); |
277 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { | 277 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { |
278 transform.translate(referenceBox.x(), referenceBox.y()); | 278 transform.translate(referenceBox.x(), referenceBox.y()); |
279 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); | 279 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); |
280 } | 280 } |
281 return transform.mapRect(m_localClipBounds); | 281 return transform.mapRect(m_localClipBounds); |
282 } | 282 } |
283 | 283 |
284 } // namespace blink | 284 } // namespace blink |
OLD | NEW |