| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Transform path by animatedLocalTransform. | 163 // Transform path by animatedLocalTransform. |
| 164 clipPath.transform(animatedLocalTransform); | 164 clipPath.transform(animatedLocalTransform); |
| 165 return true; | 165 return true; |
| 166 } | 166 } |
| 167 | 167 |
| 168 sk_sp<const SkPicture> LayoutSVGResourceClipper::createContentPicture() { | 168 sk_sp<const SkPicture> LayoutSVGResourceClipper::createContentPicture() { |
| 169 ASSERT(frame()); | 169 ASSERT(frame()); |
| 170 if (m_clipContentPicture) | 170 if (m_clipContentPicture) |
| 171 return m_clipContentPicture; | 171 return m_clipContentPicture; |
| 172 | 172 |
| 173 // Using strokeBoundingBox (instead of | 173 // Using strokeBoundingBox (instead of visualRectInLocalSVGCoordinates) to |
| 174 // paintInvalidationRectInLocalSVGCoordinates) to avoid the intersection with | 174 // avoid the intersection with local clips/mask, which may yield incorrect |
| 175 // local clips/mask, which may yield incorrect results when mixing | 175 // results when mixing objectBoundingBox and userSpaceOnUse units |
| 176 // objectBoundingBox and userSpaceOnUse units (http://crbug.com/294900). | 176 // (http://crbug.com/294900). |
| 177 FloatRect bounds = strokeBoundingBox(); | 177 FloatRect bounds = strokeBoundingBox(); |
| 178 | 178 |
| 179 SkPictureBuilder pictureBuilder(bounds, nullptr, nullptr); | 179 SkPictureBuilder pictureBuilder(bounds, nullptr, nullptr); |
| 180 | 180 |
| 181 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()); | 181 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()); |
| 182 childElement; | 182 childElement; |
| 183 childElement = Traversal<SVGElement>::nextSibling(*childElement)) { | 183 childElement = Traversal<SVGElement>::nextSibling(*childElement)) { |
| 184 LayoutObject* layoutObject = childElement->layoutObject(); | 184 LayoutObject* layoutObject = childElement->layoutObject(); |
| 185 if (!layoutObject) | 185 if (!layoutObject) |
| 186 continue; | 186 continue; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 if (!style || style->display() == EDisplay::None || | 243 if (!style || style->display() == EDisplay::None || |
| 244 (style->visibility() != EVisibility::Visible && | 244 (style->visibility() != EVisibility::Visible && |
| 245 !isSVGUseElement(*childElement))) | 245 !isSVGUseElement(*childElement))) |
| 246 continue; | 246 continue; |
| 247 if (isSVGUseElement(*childElement) && | 247 if (isSVGUseElement(*childElement) && |
| 248 !toSVGUseElement(*childElement) | 248 !toSVGUseElement(*childElement) |
| 249 .visibleTargetGraphicsElementForClipping()) | 249 .visibleTargetGraphicsElementForClipping()) |
| 250 continue; | 250 continue; |
| 251 | 251 |
| 252 m_localClipBounds.unite(layoutObject->localToSVGParentTransform().mapRect( | 252 m_localClipBounds.unite(layoutObject->localToSVGParentTransform().mapRect( |
| 253 layoutObject->paintInvalidationRectInLocalSVGCoordinates())); | 253 layoutObject->visualRectInLocalSVGCoordinates())); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 bool LayoutSVGResourceClipper::hitTestClipContent( | 257 bool LayoutSVGResourceClipper::hitTestClipContent( |
| 258 const FloatRect& objectBoundingBox, | 258 const FloatRect& objectBoundingBox, |
| 259 const FloatPoint& nodeAtPoint) { | 259 const FloatPoint& nodeAtPoint) { |
| 260 FloatPoint point = nodeAtPoint; | 260 FloatPoint point = nodeAtPoint; |
| 261 if (!SVGLayoutSupport::pointInClippingArea(*this, point)) | 261 if (!SVGLayoutSupport::pointInClippingArea(*this, point)) |
| 262 return false; | 262 return false; |
| 263 | 263 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 AffineTransform transform = | 306 AffineTransform transform = |
| 307 toSVGClipPathElement(element())->calculateAnimatedLocalTransform(); | 307 toSVGClipPathElement(element())->calculateAnimatedLocalTransform(); |
| 308 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { | 308 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { |
| 309 transform.translate(referenceBox.x(), referenceBox.y()); | 309 transform.translate(referenceBox.x(), referenceBox.y()); |
| 310 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); | 310 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); |
| 311 } | 311 } |
| 312 return transform.mapRect(m_localClipBounds); | 312 return transform.mapRect(m_localClipBounds); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace blink | 315 } // namespace blink |
| OLD | NEW |