| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 bool LayoutSVGResourceClipper::asPath(const AffineTransform& animatedLocalTransf
orm, const FloatRect& referenceBox, Path& clipPath) | 140 bool LayoutSVGResourceClipper::asPath(const AffineTransform& animatedLocalTransf
orm, const FloatRect& referenceBox, Path& clipPath) |
| 141 { | 141 { |
| 142 if (!calculateClipContentPathIfNeeded()) | 142 if (!calculateClipContentPathIfNeeded()) |
| 143 return false; | 143 return false; |
| 144 | 144 |
| 145 clipPath = m_clipContentPath; | 145 clipPath = m_clipContentPath; |
| 146 | 146 |
| 147 // We are able to represent the clip as a path. Continue with direct clippin
g, | 147 // We are able to represent the clip as a path. Continue with direct clippin
g, |
| 148 // and transform the content to userspace if necessary. | 148 // and transform the content to userspace if necessary. |
| 149 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 149 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { |
| 150 AffineTransform transform; | 150 AffineTransform transform; |
| 151 transform.translate(referenceBox.x(), referenceBox.y()); | 151 transform.translate(referenceBox.x(), referenceBox.y()); |
| 152 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); | 152 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); |
| 153 clipPath.transform(transform); | 153 clipPath.transform(transform); |
| 154 } | 154 } |
| 155 | 155 |
| 156 // Transform path by animatedLocalTransform. | 156 // Transform path by animatedLocalTransform. |
| 157 clipPath.transform(animatedLocalTransform); | 157 clipPath.transform(animatedLocalTransform); |
| 158 return true; | 158 return true; |
| 159 } | 159 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 m_localClipBounds.unite(layoutObject->localToSVGParentTransform().mapRec
t(layoutObject->paintInvalidationRectInLocalSVGCoordinates())); | 229 m_localClipBounds.unite(layoutObject->localToSVGParentTransform().mapRec
t(layoutObject->paintInvalidationRectInLocalSVGCoordinates())); |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 | 232 |
| 233 bool LayoutSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) | 233 bool LayoutSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) |
| 234 { | 234 { |
| 235 FloatPoint point = nodeAtPoint; | 235 FloatPoint point = nodeAtPoint; |
| 236 if (!SVGLayoutSupport::pointInClippingArea(this, point)) | 236 if (!SVGLayoutSupport::pointInClippingArea(this, point)) |
| 237 return false; | 237 return false; |
| 238 | 238 |
| 239 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 239 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { |
| 240 AffineTransform transform; | 240 AffineTransform transform; |
| 241 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 241 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 242 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 242 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 243 point = transform.inverse().mapPoint(point); | 243 point = transform.inverse().mapPoint(point); |
| 244 } | 244 } |
| 245 | 245 |
| 246 AffineTransform animatedLocalTransform = toSVGClipPathElement(element())->ca
lculateAnimatedLocalTransform(); | 246 AffineTransform animatedLocalTransform = toSVGClipPathElement(element())->ca
lculateAnimatedLocalTransform(); |
| 247 if (!animatedLocalTransform.isInvertible()) | 247 if (!animatedLocalTransform.isInvertible()) |
| 248 return false; | 248 return false; |
| 249 | 249 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 267 FloatRect LayoutSVGResourceClipper::resourceBoundingBox(const LayoutObject* obje
ct) | 267 FloatRect LayoutSVGResourceClipper::resourceBoundingBox(const LayoutObject* obje
ct) |
| 268 { | 268 { |
| 269 // Resource was not layouted yet. Give back the boundingBox of the object. | 269 // Resource was not layouted yet. Give back the boundingBox of the object. |
| 270 if (selfNeedsLayout()) | 270 if (selfNeedsLayout()) |
| 271 return object->objectBoundingBox(); | 271 return object->objectBoundingBox(); |
| 272 | 272 |
| 273 if (m_localClipBounds.isEmpty()) | 273 if (m_localClipBounds.isEmpty()) |
| 274 calculateLocalClipBounds(); | 274 calculateLocalClipBounds(); |
| 275 | 275 |
| 276 AffineTransform transform = toSVGClipPathElement(element())->calculateAnimat
edLocalTransform(); | 276 AffineTransform transform = toSVGClipPathElement(element())->calculateAnimat
edLocalTransform(); |
| 277 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 277 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { |
| 278 FloatRect objectBoundingBox = object->objectBoundingBox(); | 278 FloatRect objectBoundingBox = object->objectBoundingBox(); |
| 279 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 279 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 280 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 280 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 281 } | 281 } |
| 282 | 282 |
| 283 return transform.mapRect(m_localClipBounds); | 283 return transform.mapRect(m_localClipBounds); |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace blink | 286 } // namespace blink |
| OLD | NEW |