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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
75 bool RenderSVGResourceClipper::applyStatefulResource(RenderObject* object, Graph
icsContext*& context, ClipperContext& clipperContext) | 75 bool RenderSVGResourceClipper::applyStatefulResource(RenderObject* object, Graph
icsContext*& context, ClipperContext& clipperContext) |
76 { | 76 { |
77 ASSERT(object); | 77 ASSERT(object); |
78 ASSERT(context); | 78 ASSERT(context); |
79 | 79 |
80 clearInvalidationMask(); | 80 clearInvalidationMask(); |
81 | 81 |
82 return applyClippingToContext(object, object->objectBoundingBox(), object->r
epaintRectInLocalCoordinates(), context, clipperContext); | 82 return applyClippingToContext(object, object->objectBoundingBox(), object->p
aintInvalidationRectInLocalCoordinates(), context, clipperContext); |
83 } | 83 } |
84 | 84 |
85 bool RenderSVGResourceClipper::tryPathOnlyClipping(GraphicsContext* context, | 85 bool RenderSVGResourceClipper::tryPathOnlyClipping(GraphicsContext* context, |
86 const AffineTransform& animatedLocalTransform, const FloatRect& objectBoundi
ngBox) { | 86 const AffineTransform& animatedLocalTransform, const FloatRect& objectBoundi
ngBox) { |
87 // If the current clip-path gets clipped itself, we have to fallback to mask
ing. | 87 // If the current clip-path gets clipped itself, we have to fallback to mask
ing. |
88 if (!style()->svgStyle()->clipperResource().isEmpty()) | 88 if (!style()->svgStyle()->clipperResource().isEmpty()) |
89 return false; | 89 return false; |
90 WindRule clipRule = RULE_NONZERO; | 90 WindRule clipRule = RULE_NONZERO; |
91 Path clipPath = Path(); | 91 Path clipPath = Path(); |
92 | 92 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 ASSERT(m_clipContentDisplayList); | 251 ASSERT(m_clipContentDisplayList); |
252 context->drawDisplayList(m_clipContentDisplayList.get()); | 252 context->drawDisplayList(m_clipContentDisplayList.get()); |
253 } | 253 } |
254 | 254 |
255 PassRefPtr<DisplayList> RenderSVGResourceClipper::asDisplayList(GraphicsContext*
context, | 255 PassRefPtr<DisplayList> RenderSVGResourceClipper::asDisplayList(GraphicsContext*
context, |
256 const AffineTransform& contentTransformation) | 256 const AffineTransform& contentTransformation) |
257 { | 257 { |
258 ASSERT(context); | 258 ASSERT(context); |
259 ASSERT(frame()); | 259 ASSERT(frame()); |
260 | 260 |
261 // Using strokeBoundingBox (instead of repaintRectInLocalCoordinates) to avo
id the intersection | 261 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection |
262 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and | 262 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and |
263 // userSpaceOnUse units (http://crbug.com/294900). | 263 // userSpaceOnUse units (http://crbug.com/294900). |
264 context->beginRecording(strokeBoundingBox()); | 264 context->beginRecording(strokeBoundingBox()); |
265 | 265 |
266 // Switch to a paint behavior where all children of this <clipPath> will be
rendered using special constraints: | 266 // Switch to a paint behavior where all children of this <clipPath> will be
rendered using special constraints: |
267 // - fill-opacity/stroke-opacity/opacity set to 1 | 267 // - fill-opacity/stroke-opacity/opacity set to 1 |
268 // - masker/filter not applied when rendering the children | 268 // - masker/filter not applied when rendering the children |
269 // - fill is set to the initial fill paint server (solid, black) | 269 // - fill is set to the initial fill paint server (solid, black) |
270 // - stroke is set to the initial stroke paint server (none) | 270 // - stroke is set to the initial stroke paint server (none) |
271 PaintBehavior oldBehavior = frame()->view()->paintBehavior(); | 271 PaintBehavior oldBehavior = frame()->view()->paintBehavior(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // This is a rough heuristic to appraise the clip size and doesn't consider
clip on clip. | 313 // This is a rough heuristic to appraise the clip size and doesn't consider
clip on clip. |
314 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 314 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
315 RenderObject* renderer = childElement->renderer(); | 315 RenderObject* renderer = childElement->renderer(); |
316 if (!renderer) | 316 if (!renderer) |
317 continue; | 317 continue; |
318 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen
t(*childElement)) | 318 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen
t(*childElement)) |
319 continue; | 319 continue; |
320 RenderStyle* style = renderer->style(); | 320 RenderStyle* style = renderer->style(); |
321 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 321 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
322 continue; | 322 continue; |
323 m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(render
er->repaintRectInLocalCoordinates())); | 323 m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(render
er->paintInvalidationRectInLocalCoordinates())); |
324 } | 324 } |
325 m_clipBoundaries = toSVGClipPathElement(element())->animatedLocalTransform()
.mapRect(m_clipBoundaries); | 325 m_clipBoundaries = toSVGClipPathElement(element())->animatedLocalTransform()
.mapRect(m_clipBoundaries); |
326 } | 326 } |
327 | 327 |
328 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) | 328 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
gBox, const FloatPoint& nodeAtPoint) |
329 { | 329 { |
330 FloatPoint point = nodeAtPoint; | 330 FloatPoint point = nodeAtPoint; |
331 if (!SVGRenderSupport::pointInClippingArea(this, point)) | 331 if (!SVGRenderSupport::pointInClippingArea(this, point)) |
332 return false; | 332 return false; |
333 | 333 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 AffineTransform transform; | 370 AffineTransform transform; |
371 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 371 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
372 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 372 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
373 return transform.mapRect(m_clipBoundaries); | 373 return transform.mapRect(m_clipBoundaries); |
374 } | 374 } |
375 | 375 |
376 return m_clipBoundaries; | 376 return m_clipBoundaries; |
377 } | 377 } |
378 | 378 |
379 } | 379 } |
OLD | NEW |