| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if (!svgStyle->clipperResource().isEmpty()) | 111 if (!svgStyle->clipperResource().isEmpty()) |
| 112 return false; | 112 return false; |
| 113 // Fallback to masking, if there is more than one clipping path. | 113 // Fallback to masking, if there is more than one clipping path. |
| 114 if (clipPath.isEmpty()) { | 114 if (clipPath.isEmpty()) { |
| 115 styled->toClipPath(clipPath); | 115 styled->toClipPath(clipPath); |
| 116 clipRule = svgStyle->clipRule(); | 116 clipRule = svgStyle->clipRule(); |
| 117 } else | 117 } else |
| 118 return false; | 118 return false; |
| 119 } | 119 } |
| 120 // Only one visible shape/path was found. Directly continue clipping and tra
nsform the content to userspace if necessary. | 120 // Only one visible shape/path was found. Directly continue clipping and tra
nsform the content to userspace if necessary. |
| 121 if (static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitType
s::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 121 if (static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue() ==
SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { |
| 122 AffineTransform transform; | 122 AffineTransform transform; |
| 123 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 123 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 124 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 124 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 125 clipPath.transform(transform); | 125 clipPath.transform(transform); |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Transform path by animatedLocalTransform. | 128 // Transform path by animatedLocalTransform. |
| 129 clipPath.transform(animatedLocalTransform); | 129 clipPath.transform(animatedLocalTransform); |
| 130 | 130 |
| 131 // The SVG specification wants us to clip everything, if clip-path doesn't h
ave a child. | 131 // The SVG specification wants us to clip everything, if clip-path doesn't h
ave a child. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 { | 193 { |
| 194 ASSERT(frame()); | 194 ASSERT(frame()); |
| 195 ASSERT(clipperData); | 195 ASSERT(clipperData); |
| 196 ASSERT(clipperData->clipMaskImage); | 196 ASSERT(clipperData->clipMaskImage); |
| 197 | 197 |
| 198 GraphicsContext* maskContext = clipperData->clipMaskImage->context(); | 198 GraphicsContext* maskContext = clipperData->clipMaskImage->context(); |
| 199 ASSERT(maskContext); | 199 ASSERT(maskContext); |
| 200 | 200 |
| 201 AffineTransform maskContentTransformation; | 201 AffineTransform maskContentTransformation; |
| 202 SVGClipPathElement* clipPath = static_cast<SVGClipPathElement*>(node()); | 202 SVGClipPathElement* clipPath = static_cast<SVGClipPathElement*>(node()); |
| 203 if (clipPath->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGB
OX) { | 203 if (clipPath->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJ
ECTBOUNDINGBOX) { |
| 204 maskContentTransformation.translate(objectBoundingBox.x(), objectBoundin
gBox.y()); | 204 maskContentTransformation.translate(objectBoundingBox.x(), objectBoundin
gBox.y()); |
| 205 maskContentTransformation.scaleNonUniform(objectBoundingBox.width(), obj
ectBoundingBox.height()); | 205 maskContentTransformation.scaleNonUniform(objectBoundingBox.width(), obj
ectBoundingBox.height()); |
| 206 maskContext->concatCTM(maskContentTransformation); | 206 maskContext->concatCTM(maskContentTransformation); |
| 207 } | 207 } |
| 208 | 208 |
| 209 // Switch to a paint behavior where all children of this <clipPath> will be
rendered using special constraints: | 209 // Switch to a paint behavior where all children of this <clipPath> will be
rendered using special constraints: |
| 210 // - fill-opacity/stroke-opacity/opacity set to 1 | 210 // - fill-opacity/stroke-opacity/opacity set to 1 |
| 211 // - masker/filter not applied when rendering the children | 211 // - masker/filter not applied when rendering the children |
| 212 // - fill is set to the initial fill paint server (solid, black) | 212 // - fill is set to the initial fill paint server (solid, black) |
| 213 // - stroke is set to the initial stroke paint server (none) | 213 // - stroke is set to the initial stroke paint server (none) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 m_clipBoundaries = static_cast<SVGClipPathElement*>(node())->animatedLocalTr
ansform().mapRect(m_clipBoundaries); | 271 m_clipBoundaries = static_cast<SVGClipPathElement*>(node())->animatedLocalTr
ansform().mapRect(m_clipBoundaries); |
| 272 } | 272 } |
| 273 | 273 |
| 274 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) | 274 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) |
| 275 { | 275 { |
| 276 FloatPoint point = nodeAtPoint; | 276 FloatPoint point = nodeAtPoint; |
| 277 if (!SVGRenderSupport::pointInClippingArea(this, point)) | 277 if (!SVGRenderSupport::pointInClippingArea(this, point)) |
| 278 return false; | 278 return false; |
| 279 | 279 |
| 280 SVGClipPathElement* clipPathElement = static_cast<SVGClipPathElement*>(node(
)); | 280 SVGClipPathElement* clipPathElement = static_cast<SVGClipPathElement*>(node(
)); |
| 281 if (clipPathElement->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBO
UNDINGBOX) { | 281 if (clipPathElement->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_T
YPE_OBJECTBOUNDINGBOX) { |
| 282 AffineTransform transform; | 282 AffineTransform transform; |
| 283 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 283 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 284 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 284 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 285 point = transform.inverse().mapPoint(point); | 285 point = transform.inverse().mapPoint(point); |
| 286 } | 286 } |
| 287 | 287 |
| 288 point = clipPathElement->animatedLocalTransform().inverse().mapPoint(point); | 288 point = clipPathElement->animatedLocalTransform().inverse().mapPoint(point); |
| 289 | 289 |
| 290 for (Node* childNode = node()->firstChild(); childNode; childNode = childNod
e->nextSibling()) { | 290 for (Node* childNode = node()->firstChild(); childNode; childNode = childNod
e->nextSibling()) { |
| 291 RenderObject* renderer = childNode->renderer(); | 291 RenderObject* renderer = childNode->renderer(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 304 | 304 |
| 305 FloatRect RenderSVGResourceClipper::resourceBoundingBox(RenderObject* object) | 305 FloatRect RenderSVGResourceClipper::resourceBoundingBox(RenderObject* object) |
| 306 { | 306 { |
| 307 // Resource was not layouted yet. Give back the boundingBox of the object. | 307 // Resource was not layouted yet. Give back the boundingBox of the object. |
| 308 if (selfNeedsLayout()) | 308 if (selfNeedsLayout()) |
| 309 return object->objectBoundingBox(); | 309 return object->objectBoundingBox(); |
| 310 | 310 |
| 311 if (m_clipBoundaries.isEmpty()) | 311 if (m_clipBoundaries.isEmpty()) |
| 312 calculateClipContentRepaintRect(); | 312 calculateClipContentRepaintRect(); |
| 313 | 313 |
| 314 if (static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitType
s::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 314 if (static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue() ==
SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { |
| 315 FloatRect objectBoundingBox = object->objectBoundingBox(); | 315 FloatRect objectBoundingBox = object->objectBoundingBox(); |
| 316 AffineTransform transform; | 316 AffineTransform transform; |
| 317 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 317 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 318 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 318 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 319 return transform.mapRect(m_clipBoundaries); | 319 return transform.mapRect(m_clipBoundaries); |
| 320 } | 320 } |
| 321 | 321 |
| 322 return m_clipBoundaries; | 322 return m_clipBoundaries; |
| 323 } | 323 } |
| 324 | 324 |
| 325 } | 325 } |
| OLD | NEW |