| 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 10 matching lines...) Expand all Loading... |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 23 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
| 24 | 24 |
| 25 #include "core/dom/ElementTraversal.h" | 25 #include "core/dom/ElementTraversal.h" |
| 26 #include "core/layout/HitTestResult.h" | 26 #include "core/layout/HitTestResult.h" |
| 27 #include "core/layout/svg/SVGLayoutSupport.h" | 27 #include "core/layout/svg/SVGLayoutSupport.h" |
| 28 #include "core/paint/PaintInfo.h" | 28 #include "core/paint/PaintInfo.h" |
| 29 #include "core/svg/SVGGeometryElement.h" | 29 #include "core/svg/SVGGeometryElement.h" |
| 30 #include "core/svg/SVGUseElement.h" | 30 #include "core/svg/SVGUseElement.h" |
| 31 #include "platform/graphics/paint/PaintRecord.h" |
| 31 #include "platform/graphics/paint/SkPictureBuilder.h" | 32 #include "platform/graphics/paint/SkPictureBuilder.h" |
| 32 #include "third_party/skia/include/core/SkPicture.h" | |
| 33 #include "third_party/skia/include/pathops/SkPathOps.h" | 33 #include "third_party/skia/include/pathops/SkPathOps.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 enum class ClipStrategy { None, Mask, Path }; | 39 enum class ClipStrategy { None, Mask, Path }; |
| 40 | 40 |
| 41 ClipStrategy modifyStrategyForClipPath(const ComputedStyle& style, | 41 ClipStrategy modifyStrategyForClipPath(const ComputedStyle& style, |
| 42 ClipStrategy strategy) { | 42 ClipStrategy strategy) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 transform.translate(referenceBox.x(), referenceBox.y()); | 197 transform.translate(referenceBox.x(), referenceBox.y()); |
| 198 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); | 198 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); |
| 199 clipPath.transform(transform); | 199 clipPath.transform(transform); |
| 200 } | 200 } |
| 201 | 201 |
| 202 // Transform path by animatedLocalTransform. | 202 // Transform path by animatedLocalTransform. |
| 203 clipPath.transform(animatedLocalTransform); | 203 clipPath.transform(animatedLocalTransform); |
| 204 return true; | 204 return true; |
| 205 } | 205 } |
| 206 | 206 |
| 207 sk_sp<const SkPicture> LayoutSVGResourceClipper::createContentPicture() { | 207 sk_sp<const PaintRecord> LayoutSVGResourceClipper::createContentPicture() { |
| 208 ASSERT(frame()); | 208 ASSERT(frame()); |
| 209 if (m_clipContentPicture) | 209 if (m_clipContentPicture) |
| 210 return m_clipContentPicture; | 210 return m_clipContentPicture; |
| 211 | 211 |
| 212 // Using strokeBoundingBox (instead of visualRectInLocalSVGCoordinates) to | 212 // Using strokeBoundingBox (instead of visualRectInLocalSVGCoordinates) to |
| 213 // avoid the intersection with local clips/mask, which may yield incorrect | 213 // avoid the intersection with local clips/mask, which may yield incorrect |
| 214 // results when mixing objectBoundingBox and userSpaceOnUse units | 214 // results when mixing objectBoundingBox and userSpaceOnUse units |
| 215 // (http://crbug.com/294900). | 215 // (http://crbug.com/294900). |
| 216 FloatRect bounds = strokeBoundingBox(); | 216 FloatRect bounds = strokeBoundingBox(); |
| 217 | 217 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 toSVGClipPathElement(element())->calculateTransform( | 303 toSVGClipPathElement(element())->calculateTransform( |
| 304 SVGElement::IncludeMotionTransform); | 304 SVGElement::IncludeMotionTransform); |
| 305 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { | 305 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { |
| 306 transform.translate(referenceBox.x(), referenceBox.y()); | 306 transform.translate(referenceBox.x(), referenceBox.y()); |
| 307 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); | 307 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); |
| 308 } | 308 } |
| 309 return transform.mapRect(m_localClipBounds); | 309 return transform.mapRect(m_localClipBounds); |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace blink | 312 } // namespace blink |
| OLD | NEW |