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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 { | 144 { |
145 ASSERT(target); | 145 ASSERT(target); |
146 ASSERT(context); | 146 ASSERT(context); |
147 ASSERT(clipperState == ClipperNotApplied); | 147 ASSERT(clipperState == ClipperNotApplied); |
148 ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout()); | 148 ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout()); |
149 | 149 |
150 if (paintInvalidationRect.isEmpty() || m_inClipExpansion) | 150 if (paintInvalidationRect.isEmpty() || m_inClipExpansion) |
151 return false; | 151 return false; |
152 TemporaryChange<bool> inClipExpansionChange(m_inClipExpansion, true); | 152 TemporaryChange<bool> inClipExpansionChange(m_inClipExpansion, true); |
153 | 153 |
154 AffineTransform animatedLocalTransform = toSVGClipPathElement(element())->an
imatedLocalTransform(); | 154 AffineTransform animatedLocalTransform = toSVGClipPathElement(element())->ca
lculateAnimatedLocalTransform(); |
155 // When drawing a clip for non-SVG elements, the CTM does not include the zo
om factor. | 155 // When drawing a clip for non-SVG elements, the CTM does not include the zo
om factor. |
156 // In this case, we need to apply the zoom scale explicitly - but only for c
lips with | 156 // In this case, we need to apply the zoom scale explicitly - but only for c
lips with |
157 // userSpaceOnUse units (the zoom is accounted for objectBoundingBox-resolve
d lengths). | 157 // userSpaceOnUse units (the zoom is accounted for objectBoundingBox-resolve
d lengths). |
158 if (!target->isSVG() && clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_USERS
PACEONUSE) { | 158 if (!target->isSVG() && clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_USERS
PACEONUSE) { |
159 ASSERT(style()); | 159 ASSERT(style()); |
160 animatedLocalTransform.scale(style()->effectiveZoom()); | 160 animatedLocalTransform.scale(style()->effectiveZoom()); |
161 } | 161 } |
162 | 162 |
163 // First, try to apply the clip as a clipPath. | 163 // First, try to apply the clip as a clipPath. |
164 if (tryPathOnlyClipping(context, animatedLocalTransform, targetBoundingBox))
{ | 164 if (tryPathOnlyClipping(context, animatedLocalTransform, targetBoundingBox))
{ |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 RenderObject* renderer = childElement->renderer(); | 301 RenderObject* renderer = childElement->renderer(); |
302 if (!renderer) | 302 if (!renderer) |
303 continue; | 303 continue; |
304 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen
t(*childElement)) | 304 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen
t(*childElement)) |
305 continue; | 305 continue; |
306 RenderStyle* style = renderer->style(); | 306 RenderStyle* style = renderer->style(); |
307 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 307 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
308 continue; | 308 continue; |
309 m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(render
er->paintInvalidationRectInLocalCoordinates())); | 309 m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(render
er->paintInvalidationRectInLocalCoordinates())); |
310 } | 310 } |
311 m_clipBoundaries = toSVGClipPathElement(element())->animatedLocalTransform()
.mapRect(m_clipBoundaries); | 311 m_clipBoundaries = toSVGClipPathElement(element())->calculateAnimatedLocalTr
ansform().mapRect(m_clipBoundaries); |
312 } | 312 } |
313 | 313 |
314 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) | 314 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) |
315 { | 315 { |
316 FloatPoint point = nodeAtPoint; | 316 FloatPoint point = nodeAtPoint; |
317 if (!SVGRenderSupport::pointInClippingArea(this, point)) | 317 if (!SVGRenderSupport::pointInClippingArea(this, point)) |
318 return false; | 318 return false; |
319 | 319 |
320 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 320 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { |
321 AffineTransform transform; | 321 AffineTransform transform; |
322 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 322 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
323 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 323 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
324 point = transform.inverse().mapPoint(point); | 324 point = transform.inverse().mapPoint(point); |
325 } | 325 } |
326 | 326 |
327 AffineTransform animatedLocalTransform = toSVGClipPathElement(element())->an
imatedLocalTransform(); | 327 AffineTransform animatedLocalTransform = toSVGClipPathElement(element())->ca
lculateAnimatedLocalTransform(); |
328 if (!animatedLocalTransform.isInvertible()) | 328 if (!animatedLocalTransform.isInvertible()) |
329 return false; | 329 return false; |
330 | 330 |
331 point = animatedLocalTransform.inverse().mapPoint(point); | 331 point = animatedLocalTransform.inverse().mapPoint(point); |
332 | 332 |
333 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 333 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
334 RenderObject* renderer = childElement->renderer(); | 334 RenderObject* renderer = childElement->renderer(); |
335 if (!renderer) | 335 if (!renderer) |
336 continue; | 336 continue; |
337 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen
t(*childElement)) | 337 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen
t(*childElement)) |
(...skipping 21 matching lines...) Expand all Loading... |
359 AffineTransform transform; | 359 AffineTransform transform; |
360 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 360 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
361 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 361 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
362 return transform.mapRect(m_clipBoundaries); | 362 return transform.mapRect(m_clipBoundaries); |
363 } | 363 } |
364 | 364 |
365 return m_clipBoundaries; | 365 return m_clipBoundaries; |
366 } | 366 } |
367 | 367 |
368 } | 368 } |
OLD | NEW |