| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 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 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 6 * Copyright (C) 2012 University of Szeged | 6 * Copyright (C) 2012 University of Szeged |
| 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> | 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 { | 433 { |
| 434 return isSVGPathElement(element) | 434 return isSVGPathElement(element) |
| 435 || isSVGRectElement(element) | 435 || isSVGRectElement(element) |
| 436 || isSVGCircleElement(element) | 436 || isSVGCircleElement(element) |
| 437 || isSVGEllipseElement(element) | 437 || isSVGEllipseElement(element) |
| 438 || isSVGPolygonElement(element) | 438 || isSVGPolygonElement(element) |
| 439 || isSVGPolylineElement(element) | 439 || isSVGPolylineElement(element) |
| 440 || isSVGTextElement(element); | 440 || isSVGTextElement(element); |
| 441 } | 441 } |
| 442 | 442 |
| 443 void SVGUseElement::toClipPath(Path& path) | 443 |
| 444 |
| 445 SVGGeometryElement* SVGUseElement::layoutObjectClipChild(Path& path) const |
| 444 { | 446 { |
| 445 ASSERT(path.isEmpty()); | 447 ASSERT(path.isEmpty()); |
| 446 | 448 |
| 447 Node* n = userAgentShadowRoot()->firstChild(); | 449 if (Node* n = userAgentShadowRoot()->firstChild()) { |
| 448 if (!n || !n->isSVGElement()) | 450 if (n->isSVGElement() && isDirectReference(toSVGElement(*n))) { |
| 449 return; | 451 SVGElement* element = toSVGElement(n); |
| 450 SVGElement& element = toSVGElement(*n); | 452 if (element->isSVGGeometryElement()) { |
| 451 | 453 toSVGGeometryElement(element)->toClipPath(path); |
| 452 if (element.isSVGGraphicsElement()) { | 454 // FIXME: Avoid manual resolution of x/y here. Its potentially h
armful. |
| 453 if (!isDirectReference(element)) { | 455 SVGLengthContext lengthContext(this); |
| 456 path.translate(FloatSize(m_x->currentValue()->value(lengthContex
t), m_y->currentValue()->value(lengthContext))); |
| 457 path.transform(calculateAnimatedLocalTransform()); |
| 458 return toSVGGeometryElement(element); |
| 459 } |
| 460 } else { |
| 454 // Spec: Indirect references are an error (14.3.5) | 461 // Spec: Indirect references are an error (14.3.5) |
| 455 document().accessSVGExtensions().reportError("Not allowed to use ind
irect reference in <clip-path>"); | 462 document().accessSVGExtensions().reportError("Not allowed to use ind
irect reference in <clip-path>"); |
| 456 } else { | |
| 457 toSVGGraphicsElement(element).toClipPath(path); | |
| 458 // FIXME: Avoid manual resolution of x/y here. Its potentially harmf
ul. | |
| 459 SVGLengthContext lengthContext(this); | |
| 460 path.translate(FloatSize(m_x->currentValue()->value(lengthContext),
m_y->currentValue()->value(lengthContext))); | |
| 461 path.transform(calculateAnimatedLocalTransform()); | |
| 462 } | 463 } |
| 463 } | 464 } |
| 464 } | |
| 465 | |
| 466 LayoutObject* SVGUseElement::layoutObjectClipChild() const | |
| 467 { | |
| 468 if (Node* n = userAgentShadowRoot()->firstChild()) { | |
| 469 if (n->isSVGElement() && isDirectReference(toSVGElement(*n))) | |
| 470 return n->layoutObject(); | |
| 471 } | |
| 472 | 465 |
| 473 return nullptr; | 466 return nullptr; |
| 474 } | 467 } |
| 475 | 468 |
| 476 bool SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstan
ce, bool foundUse) | 469 bool SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstan
ce, bool foundUse) |
| 477 { | 470 { |
| 478 ASSERT(target); | 471 ASSERT(target); |
| 479 ASSERT(targetInstance); | 472 ASSERT(targetInstance); |
| 480 | 473 |
| 481 // Spec: If the referenced object is itself a 'use', or if there are 'use' s
ubelements within the referenced | 474 // Spec: If the referenced object is itself a 'use', or if there are 'use' s
ubelements within the referenced |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 | 767 |
| 775 if (m_resource) | 768 if (m_resource) |
| 776 m_resource->removeClient(this); | 769 m_resource->removeClient(this); |
| 777 | 770 |
| 778 m_resource = resource; | 771 m_resource = resource; |
| 779 if (m_resource) | 772 if (m_resource) |
| 780 m_resource->addClient(this); | 773 m_resource->addClient(this); |
| 781 } | 774 } |
| 782 | 775 |
| 783 } | 776 } |
| OLD | NEW |