| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 238 |
| 239 AffineTransform contentTransformation; | 239 AffineTransform contentTransformation; |
| 240 SVGUnitTypes::SVGUnitType contentUnits = toSVGClipPathElement(element())->cl
ipPathUnits()->currentValue()->enumValue(); | 240 SVGUnitTypes::SVGUnitType contentUnits = toSVGClipPathElement(element())->cl
ipPathUnits()->currentValue()->enumValue(); |
| 241 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 241 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { |
| 242 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox
.y()); | 242 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox
.y()); |
| 243 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB
oundingBox.height()); | 243 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB
oundingBox.height()); |
| 244 context->concatCTM(contentTransformation); | 244 context->concatCTM(contentTransformation); |
| 245 } | 245 } |
| 246 | 246 |
| 247 if (!m_clipContentDisplayList) | 247 if (!m_clipContentDisplayList) |
| 248 m_clipContentDisplayList = asDisplayList(context, contentTransformation)
; | 248 createDisplayList(context, contentTransformation); |
| 249 | 249 |
| 250 ASSERT(m_clipContentDisplayList); | 250 ASSERT(m_clipContentDisplayList); |
| 251 context->drawDisplayList(m_clipContentDisplayList.get()); | 251 context->drawDisplayList(m_clipContentDisplayList.get()); |
| 252 } | 252 } |
| 253 | 253 |
| 254 PassRefPtr<DisplayList> RenderSVGResourceClipper::asDisplayList(GraphicsContext*
context, | 254 void RenderSVGResourceClipper::createDisplayList(GraphicsContext* context, |
| 255 const AffineTransform& contentTransformation) | 255 const AffineTransform& contentTransformation) |
| 256 { | 256 { |
| 257 ASSERT(context); | 257 ASSERT(context); |
| 258 ASSERT(frame()); | 258 ASSERT(frame()); |
| 259 | 259 |
| 260 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection | 260 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection |
| 261 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and | 261 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and |
| 262 // userSpaceOnUse units (http://crbug.com/294900). | 262 // userSpaceOnUse units (http://crbug.com/294900). |
| 263 context->beginRecording(strokeBoundingBox()); | 263 FloatRect bounds = strokeBoundingBox(); |
| 264 m_clipContentDisplayList = DisplayList::create(bounds); |
| 265 context->beginRecording(m_clipContentDisplayList); |
| 264 | 266 |
| 265 // Switch to a paint behavior where all children of this <clipPath> will be
rendered using special constraints: | 267 // Switch to a paint behavior where all children of this <clipPath> will be
rendered using special constraints: |
| 266 // - fill-opacity/stroke-opacity/opacity set to 1 | 268 // - fill-opacity/stroke-opacity/opacity set to 1 |
| 267 // - masker/filter not applied when rendering the children | 269 // - masker/filter not applied when rendering the children |
| 268 // - fill is set to the initial fill paint server (solid, black) | 270 // - fill is set to the initial fill paint server (solid, black) |
| 269 // - stroke is set to the initial stroke paint server (none) | 271 // - stroke is set to the initial stroke paint server (none) |
| 270 PaintBehavior oldBehavior = frame()->view()->paintBehavior(); | 272 PaintBehavior oldBehavior = frame()->view()->paintBehavior(); |
| 271 frame()->view()->setPaintBehavior(oldBehavior | PaintBehaviorRenderingSVGMas
k); | 273 frame()->view()->setPaintBehavior(oldBehavior | PaintBehaviorRenderingSVGMas
k); |
| 272 | 274 |
| 273 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 275 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 297 context->setFillRule(newClipRule); | 299 context->setFillRule(newClipRule); |
| 298 | 300 |
| 299 if (isUseElement) | 301 if (isUseElement) |
| 300 renderer = childElement->renderer(); | 302 renderer = childElement->renderer(); |
| 301 | 303 |
| 302 SVGRenderingContext::renderSubtree(context, renderer, contentTransformat
ion); | 304 SVGRenderingContext::renderSubtree(context, renderer, contentTransformat
ion); |
| 303 } | 305 } |
| 304 | 306 |
| 305 frame()->view()->setPaintBehavior(oldBehavior); | 307 frame()->view()->setPaintBehavior(oldBehavior); |
| 306 | 308 |
| 307 return context->endRecording(); | 309 context->endRecording(); |
| 308 } | 310 } |
| 309 | 311 |
| 310 void RenderSVGResourceClipper::calculateClipContentPaintInvalidationRect() | 312 void RenderSVGResourceClipper::calculateClipContentPaintInvalidationRect() |
| 311 { | 313 { |
| 312 // This is a rough heuristic to appraise the clip size and doesn't consider
clip on clip. | 314 // This is a rough heuristic to appraise the clip size and doesn't consider
clip on clip. |
| 313 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 315 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
| 314 RenderObject* renderer = childElement->renderer(); | 316 RenderObject* renderer = childElement->renderer(); |
| 315 if (!renderer) | 317 if (!renderer) |
| 316 continue; | 318 continue; |
| 317 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen
t(*childElement)) | 319 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen
t(*childElement)) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 AffineTransform transform; | 375 AffineTransform transform; |
| 374 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 376 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 375 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 377 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 376 return transform.mapRect(m_clipBoundaries); | 378 return transform.mapRect(m_clipBoundaries); |
| 377 } | 379 } |
| 378 | 380 |
| 379 return m_clipBoundaries; | 381 return m_clipBoundaries; |
| 380 } | 382 } |
| 381 | 383 |
| 382 } | 384 } |
| OLD | NEW |