| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); | 153 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); |
| 154 clipPath.transform(transform); | 154 clipPath.transform(transform); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Transform path by animatedLocalTransform. | 157 // Transform path by animatedLocalTransform. |
| 158 clipPath.transform(animatedLocalTransform); | 158 clipPath.transform(animatedLocalTransform); |
| 159 return true; | 159 return true; |
| 160 } | 160 } |
| 161 | 161 |
| 162 PassRefPtr<const SkPicture> LayoutSVGResourceClipper::createContentPicture(Affin
eTransform& contentTransformation, const FloatRect& targetBoundingBox, | 162 PassRefPtr<const SkPicture> LayoutSVGResourceClipper::createContentPicture(Affin
eTransform& contentTransformation, const FloatRect& targetBoundingBox, |
| 163 GraphicsContext* context) | 163 GraphicsContext& context) |
| 164 { | 164 { |
| 165 ASSERT(frame()); | 165 ASSERT(frame()); |
| 166 | 166 |
| 167 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 167 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { |
| 168 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox
.y()); | 168 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox
.y()); |
| 169 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB
oundingBox.height()); | 169 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB
oundingBox.height()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 if (m_clipContentPicture) | 172 if (m_clipContentPicture) |
| 173 return m_clipContentPicture; | 173 return m_clipContentPicture; |
| 174 | 174 |
| 175 SubtreeContentTransformScope contentTransformScope(contentTransformation); | 175 SubtreeContentTransformScope contentTransformScope(contentTransformation); |
| 176 | 176 |
| 177 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection | 177 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection |
| 178 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and | 178 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and |
| 179 // userSpaceOnUse units (http://crbug.com/294900). | 179 // userSpaceOnUse units (http://crbug.com/294900). |
| 180 FloatRect bounds = strokeBoundingBox(); | 180 FloatRect bounds = strokeBoundingBox(); |
| 181 | 181 |
| 182 SkPictureBuilder pictureBuilder(bounds, nullptr, context); | 182 SkPictureBuilder pictureBuilder(bounds, nullptr, &context); |
| 183 | 183 |
| 184 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 184 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
| 185 LayoutObject* layoutObject = childElement->layoutObject(); | 185 LayoutObject* layoutObject = childElement->layoutObject(); |
| 186 if (!layoutObject) | 186 if (!layoutObject) |
| 187 continue; | 187 continue; |
| 188 | 188 |
| 189 const ComputedStyle* style = layoutObject->style(); | 189 const ComputedStyle* style = layoutObject->style(); |
| 190 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 190 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
| 191 continue; | 191 continue; |
| 192 | 192 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 206 continue; | 206 continue; |
| 207 | 207 |
| 208 if (isUseElement) | 208 if (isUseElement) |
| 209 layoutObject = childElement->layoutObject(); | 209 layoutObject = childElement->layoutObject(); |
| 210 | 210 |
| 211 // Switch to a paint behavior where all children of this <clipPath> will
be laid out using special constraints: | 211 // Switch to a paint behavior where all children of this <clipPath> will
be laid out using special constraints: |
| 212 // - fill-opacity/stroke-opacity/opacity set to 1 | 212 // - fill-opacity/stroke-opacity/opacity set to 1 |
| 213 // - masker/filter not applied when laying out the children | 213 // - masker/filter not applied when laying out the children |
| 214 // - fill is set to the initial fill paint server (solid, black) | 214 // - fill is set to the initial fill paint server (solid, black) |
| 215 // - stroke is set to the initial stroke paint server (none) | 215 // - stroke is set to the initial stroke paint server (none) |
| 216 PaintInfo info(&pictureBuilder.context(), LayoutRect::infiniteIntRect(),
PaintPhaseForeground, GlobalPaintNormalPhase, PaintLayerPaintingRenderingClipPa
thAsMask); | 216 PaintInfo info(pictureBuilder.context(), LayoutRect::infiniteIntRect(),
PaintPhaseForeground, GlobalPaintNormalPhase, PaintLayerPaintingRenderingClipPat
hAsMask); |
| 217 layoutObject->paint(info, IntPoint()); | 217 layoutObject->paint(info, IntPoint()); |
| 218 } | 218 } |
| 219 | 219 |
| 220 m_clipContentPicture = pictureBuilder.endRecording(); | 220 m_clipContentPicture = pictureBuilder.endRecording(); |
| 221 return m_clipContentPicture; | 221 return m_clipContentPicture; |
| 222 } | 222 } |
| 223 | 223 |
| 224 void LayoutSVGResourceClipper::calculateClipContentPaintInvalidationRect() | 224 void LayoutSVGResourceClipper::calculateClipContentPaintInvalidationRect() |
| 225 { | 225 { |
| 226 // This is a rough heuristic to appraise the clip size and doesn't consider
clip on clip. | 226 // This is a rough heuristic to appraise the clip size and doesn't consider
clip on clip. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 AffineTransform transform; | 286 AffineTransform transform; |
| 287 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 287 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 288 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 288 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 289 return transform.mapRect(m_clipBoundaries); | 289 return transform.mapRect(m_clipBoundaries); |
| 290 } | 290 } |
| 291 | 291 |
| 292 return m_clipBoundaries; | 292 return m_clipBoundaries; |
| 293 } | 293 } |
| 294 | 294 |
| 295 } | 295 } |
| OLD | NEW |