| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 85 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
| 86 RenderObject* renderer = childElement->renderer(); | 86 RenderObject* renderer = childElement->renderer(); |
| 87 if (!renderer) | 87 if (!renderer) |
| 88 continue; | 88 continue; |
| 89 // Only shapes or paths are supported for direct clipping. We need to fa
llback to masking for texts. | 89 // Only shapes or paths are supported for direct clipping. We need to fa
llback to masking for texts. |
| 90 if (renderer->isSVGText()) | 90 if (renderer->isSVGText()) |
| 91 return false; | 91 return false; |
| 92 if (!childElement->isSVGGraphicsElement()) | 92 if (!childElement->isSVGGraphicsElement()) |
| 93 continue; | 93 continue; |
| 94 SVGGraphicsElement* styled = toSVGGraphicsElement(childElement); | 94 SVGGraphicsElement* styled = toSVGGraphicsElement(childElement); |
| 95 RenderStyle* style = renderer->style(); | 95 const RenderStyle* style = renderer->style(); |
| 96 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 96 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
| 97 continue; | 97 continue; |
| 98 const SVGRenderStyle& svgStyle = style->svgStyle(); | 98 const SVGRenderStyle& svgStyle = style->svgStyle(); |
| 99 // Current shape in clip-path gets clipped too. Fallback to masking. | 99 // Current shape in clip-path gets clipped too. Fallback to masking. |
| 100 if (!svgStyle.clipperResource().isEmpty()) | 100 if (!svgStyle.clipperResource().isEmpty()) |
| 101 return false; | 101 return false; |
| 102 | 102 |
| 103 if (clipPath.isEmpty()) { | 103 if (clipPath.isEmpty()) { |
| 104 // First clip shape. | 104 // First clip shape. |
| 105 styled->toClipPath(clipPath); | 105 styled->toClipPath(clipPath); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and | 259 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and |
| 260 // userSpaceOnUse units (http://crbug.com/294900). | 260 // userSpaceOnUse units (http://crbug.com/294900). |
| 261 FloatRect bounds = strokeBoundingBox(); | 261 FloatRect bounds = strokeBoundingBox(); |
| 262 context->beginRecording(bounds); | 262 context->beginRecording(bounds); |
| 263 | 263 |
| 264 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 264 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
| 265 RenderObject* renderer = childElement->renderer(); | 265 RenderObject* renderer = childElement->renderer(); |
| 266 if (!renderer) | 266 if (!renderer) |
| 267 continue; | 267 continue; |
| 268 | 268 |
| 269 RenderStyle* style = renderer->style(); | 269 const RenderStyle* style = renderer->style(); |
| 270 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 270 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
| 271 continue; | 271 continue; |
| 272 | 272 |
| 273 WindRule newClipRule = style->svgStyle().clipRule(); | 273 WindRule newClipRule = style->svgStyle().clipRule(); |
| 274 bool isUseElement = isSVGUseElement(*childElement); | 274 bool isUseElement = isSVGUseElement(*childElement); |
| 275 if (isUseElement) { | 275 if (isUseElement) { |
| 276 SVGUseElement& useElement = toSVGUseElement(*childElement); | 276 SVGUseElement& useElement = toSVGUseElement(*childElement); |
| 277 renderer = useElement.rendererClipChild(); | 277 renderer = useElement.rendererClipChild(); |
| 278 if (!renderer) | 278 if (!renderer) |
| 279 continue; | 279 continue; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 304 | 304 |
| 305 void RenderSVGResourceClipper::calculateClipContentPaintInvalidationRect() | 305 void RenderSVGResourceClipper::calculateClipContentPaintInvalidationRect() |
| 306 { | 306 { |
| 307 // This is a rough heuristic to appraise the clip size and doesn't consider
clip on clip. | 307 // This is a rough heuristic to appraise the clip size and doesn't consider
clip on clip. |
| 308 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 308 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
| 309 RenderObject* renderer = childElement->renderer(); | 309 RenderObject* renderer = childElement->renderer(); |
| 310 if (!renderer) | 310 if (!renderer) |
| 311 continue; | 311 continue; |
| 312 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen
t(*childElement)) | 312 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen
t(*childElement)) |
| 313 continue; | 313 continue; |
| 314 RenderStyle* style = renderer->style(); | 314 const RenderStyle* style = renderer->style(); |
| 315 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 315 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
| 316 continue; | 316 continue; |
| 317 m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(render
er->paintInvalidationRectInLocalCoordinates())); | 317 m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(render
er->paintInvalidationRectInLocalCoordinates())); |
| 318 } | 318 } |
| 319 m_clipBoundaries = toSVGClipPathElement(element())->calculateAnimatedLocalTr
ansform().mapRect(m_clipBoundaries); | 319 m_clipBoundaries = toSVGClipPathElement(element())->calculateAnimatedLocalTr
ansform().mapRect(m_clipBoundaries); |
| 320 } | 320 } |
| 321 | 321 |
| 322 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) | 322 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) |
| 323 { | 323 { |
| 324 FloatPoint point = nodeAtPoint; | 324 FloatPoint point = nodeAtPoint; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 AffineTransform transform; | 367 AffineTransform transform; |
| 368 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 368 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 369 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 369 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 370 return transform.mapRect(m_clipBoundaries); | 370 return transform.mapRect(m_clipBoundaries); |
| 371 } | 371 } |
| 372 | 372 |
| 373 return m_clipBoundaries; | 373 return m_clipBoundaries; |
| 374 } | 374 } |
| 375 | 375 |
| 376 } | 376 } |
| OLD | NEW |