| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); |
| 272 frame()->view()->setPaintBehavior(oldBehavior | PaintBehaviorRenderingSVGMas
k); | 272 frame()->view()->setPaintBehavior(oldBehavior | PaintBehaviorRenderingSVGMas
k); |
| 273 | 273 |
| 274 for (Element* childElement = ElementTraversal::firstWithin(*element()); chil
dElement; childElement = ElementTraversal::nextSibling(*childElement)) { | 274 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
| 275 RenderObject* renderer = childElement->renderer(); | 275 RenderObject* renderer = childElement->renderer(); |
| 276 if (!childElement->isSVGElement() || !renderer) | 276 if (!renderer) |
| 277 continue; | 277 continue; |
| 278 | 278 |
| 279 RenderStyle* style = renderer->style(); | 279 RenderStyle* style = renderer->style(); |
| 280 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 280 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
| 281 continue; | 281 continue; |
| 282 | 282 |
| 283 WindRule newClipRule = style->svgStyle()->clipRule(); | 283 WindRule newClipRule = style->svgStyle()->clipRule(); |
| 284 bool isUseElement = childElement->hasTagName(SVGNames::useTag); | 284 bool isUseElement = childElement->hasTagName(SVGNames::useTag); |
| 285 if (isUseElement) { | 285 if (isUseElement) { |
| 286 SVGUseElement* useElement = toSVGUseElement(childElement); | 286 SVGUseElement* useElement = toSVGUseElement(childElement); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 304 } | 304 } |
| 305 | 305 |
| 306 frame()->view()->setPaintBehavior(oldBehavior); | 306 frame()->view()->setPaintBehavior(oldBehavior); |
| 307 | 307 |
| 308 return context->endRecording(); | 308 return context->endRecording(); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void RenderSVGResourceClipper::calculateClipContentRepaintRect() | 311 void RenderSVGResourceClipper::calculateClipContentRepaintRect() |
| 312 { | 312 { |
| 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 (Element* childElement = ElementTraversal::firstWithin(*element()); chil
dElement; childElement = ElementTraversal::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 (!childElement->isSVGElement() || !renderer) | 316 if (!renderer) |
| 317 continue; | 317 continue; |
| 318 if (!renderer->isSVGShape() && !renderer->isSVGText() && !childElement->
hasTagName(SVGNames::useTag)) | 318 if (!renderer->isSVGShape() && !renderer->isSVGText() && !childElement->
hasTagName(SVGNames::useTag)) |
| 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->repaintRectInLocalCoordinates())); |
| 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 |
| 334 SVGClipPathElement* clipPathElement = toSVGClipPathElement(element()); | 334 SVGClipPathElement* clipPathElement = toSVGClipPathElement(element()); |
| 335 if (clipPathElement->clipPathUnits()->currentValue()->enumValue() == SVGUnit
Types::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 335 if (clipPathElement->clipPathUnits()->currentValue()->enumValue() == SVGUnit
Types::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { |
| 336 AffineTransform transform; | 336 AffineTransform transform; |
| 337 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 337 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 338 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 338 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 339 point = transform.inverse().mapPoint(point); | 339 point = transform.inverse().mapPoint(point); |
| 340 } | 340 } |
| 341 | 341 |
| 342 point = clipPathElement->animatedLocalTransform().inverse().mapPoint(point); | 342 point = clipPathElement->animatedLocalTransform().inverse().mapPoint(point); |
| 343 | 343 |
| 344 for (Element* childElement = ElementTraversal::firstWithin(*element()); chil
dElement; childElement = ElementTraversal::nextSibling(*childElement)) { | 344 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
| 345 RenderObject* renderer = childElement->renderer(); | 345 RenderObject* renderer = childElement->renderer(); |
| 346 if (!childElement->isSVGElement() || !renderer) | 346 if (!renderer) |
| 347 continue; | 347 continue; |
| 348 if (!renderer->isSVGShape() && !renderer->isSVGText() && !childElement->
hasTagName(SVGNames::useTag)) | 348 if (!renderer->isSVGShape() && !renderer->isSVGText() && !childElement->
hasTagName(SVGNames::useTag)) |
| 349 continue; | 349 continue; |
| 350 IntPoint hitPoint; | 350 IntPoint hitPoint; |
| 351 HitTestResult result(hitPoint); | 351 HitTestResult result(hitPoint); |
| 352 if (renderer->nodeAtFloatPoint(HitTestRequest(HitTestRequest::SVGClipCon
tent | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent), result, p
oint, HitTestForeground)) | 352 if (renderer->nodeAtFloatPoint(HitTestRequest(HitTestRequest::SVGClipCon
tent | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent), result, p
oint, HitTestForeground)) |
| 353 return true; | 353 return true; |
| 354 } | 354 } |
| 355 | 355 |
| 356 return false; | 356 return false; |
| (...skipping 13 matching lines...) Expand all 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 |