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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 return false; | 82 return false; |
83 if (!childElement->isSVGGraphicsElement()) | 83 if (!childElement->isSVGGraphicsElement()) |
84 continue; | 84 continue; |
85 SVGGraphicsElement* styled = toSVGGraphicsElement(childElement); | 85 SVGGraphicsElement* styled = toSVGGraphicsElement(childElement); |
86 const LayoutStyle* style = childLayoutObject->style(); | 86 const ComputedStyle* style = childLayoutObject->style(); |
87 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 87 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
88 continue; | 88 continue; |
89 const SVGLayoutStyle& svgStyle = style->svgStyle(); | 89 const SVGComputedStyle& svgStyle = style->svgStyle(); |
90 // Current shape in clip-path gets clipped too. Fallback to masking. | 90 // Current shape in clip-path gets clipped too. Fallback to masking. |
91 if (!svgStyle.clipperResource().isEmpty()) | 91 if (!svgStyle.clipperResource().isEmpty()) |
92 return false; | 92 return false; |
93 | 93 |
94 if (clipPath.isEmpty()) { | 94 if (clipPath.isEmpty()) { |
95 // First clip shape. | 95 // First clip shape. |
96 styled->toClipPath(clipPath); | 96 styled->toClipPath(clipPath); |
97 clipRule = svgStyle.clipRule(); | 97 clipRule = svgStyle.clipRule(); |
98 clipPath.setWindRule(clipRule); | 98 clipPath.setWindRule(clipRule); |
99 continue; | 99 continue; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 158 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
159 displayItemList = DisplayItemList::create(); | 159 displayItemList = DisplayItemList::create(); |
160 GraphicsContext context(nullptr, displayItemList.get()); | 160 GraphicsContext context(nullptr, displayItemList.get()); |
161 context.beginRecording(bounds); | 161 context.beginRecording(bounds); |
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 LayoutStyle* 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(); | 172 WindRule newClipRule = style->svgStyle().clipRule(); |
173 bool isUseElement = isSVGUseElement(*childElement); | 173 bool isUseElement = isSVGUseElement(*childElement); |
174 if (isUseElement) { | 174 if (isUseElement) { |
175 SVGUseElement& useElement = toSVGUseElement(*childElement); | 175 SVGUseElement& useElement = toSVGUseElement(*childElement); |
176 layoutObject = useElement.layoutObjectClipChild(); | 176 layoutObject = useElement.layoutObjectClipChild(); |
177 if (!layoutObject) | 177 if (!layoutObject) |
178 continue; | 178 continue; |
(...skipping 27 matching lines...) Expand all Loading... |
206 | 206 |
207 void LayoutSVGResourceClipper::calculateClipContentPaintInvalidationRect() | 207 void LayoutSVGResourceClipper::calculateClipContentPaintInvalidationRect() |
208 { | 208 { |
209 // This is a rough heuristic to appraise the clip size and doesn't consider
clip on clip. | 209 // This is a rough heuristic to appraise the clip size and doesn't consider
clip on clip. |
210 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 210 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
211 LayoutObject* layoutObject = childElement->layoutObject(); | 211 LayoutObject* layoutObject = childElement->layoutObject(); |
212 if (!layoutObject) | 212 if (!layoutObject) |
213 continue; | 213 continue; |
214 if (!layoutObject->isSVGShape() && !layoutObject->isSVGText() && !isSVGU
seElement(*childElement)) | 214 if (!layoutObject->isSVGShape() && !layoutObject->isSVGText() && !isSVGU
seElement(*childElement)) |
215 continue; | 215 continue; |
216 const LayoutStyle* style = layoutObject->style(); | 216 const ComputedStyle* style = layoutObject->style(); |
217 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 217 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
218 continue; | 218 continue; |
219 m_clipBoundaries.unite(layoutObject->localToParentTransform().mapRect(la
youtObject->paintInvalidationRectInLocalCoordinates())); | 219 m_clipBoundaries.unite(layoutObject->localToParentTransform().mapRect(la
youtObject->paintInvalidationRectInLocalCoordinates())); |
220 } | 220 } |
221 m_clipBoundaries = toSVGClipPathElement(element())->calculateAnimatedLocalTr
ansform().mapRect(m_clipBoundaries); | 221 m_clipBoundaries = toSVGClipPathElement(element())->calculateAnimatedLocalTr
ansform().mapRect(m_clipBoundaries); |
222 } | 222 } |
223 | 223 |
224 bool LayoutSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) | 224 bool LayoutSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) |
225 { | 225 { |
226 FloatPoint point = nodeAtPoint; | 226 FloatPoint point = nodeAtPoint; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 AffineTransform transform; | 269 AffineTransform transform; |
270 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 270 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
271 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 271 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
272 return transform.mapRect(m_clipBoundaries); | 272 return transform.mapRect(m_clipBoundaries); |
273 } | 273 } |
274 | 274 |
275 return m_clipBoundaries; | 275 return m_clipBoundaries; |
276 } | 276 } |
277 | 277 |
278 } | 278 } |
OLD | NEW |