Chromium Code Reviews| 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 void SVGUseElement::toClipPath(Path& path) |
|
fs
2015/06/22 10:57:44
const qualify the method?
| |
| 444 { | 444 { |
| 445 ASSERT(path.isEmpty()); | 445 ASSERT(path.isEmpty()); |
| 446 | 446 |
| 447 const SVGGraphicsElement* element = targetGraphicsElementForClipping(); | |
| 448 | |
| 449 if (!element) | |
| 450 return; | |
| 451 | |
| 452 if (element->isSVGGeometryElement()) { | |
| 453 toSVGGeometryElement(*element).toClipPath(path); | |
| 454 // FIXME: Avoid manual resolution of x/y here. Its potentially harmful. | |
| 455 SVGLengthContext lengthContext(this); | |
| 456 path.translate(FloatSize(m_x->currentValue()->value(lengthContext), m_y- >currentValue()->value(lengthContext))); | |
| 457 path.transform(calculateAnimatedLocalTransform()); | |
| 458 } | |
| 459 } | |
| 460 | |
| 461 SVGGraphicsElement* SVGUseElement::targetGraphicsElementForClipping() const | |
| 462 { | |
| 447 Node* n = userAgentShadowRoot()->firstChild(); | 463 Node* n = userAgentShadowRoot()->firstChild(); |
| 448 if (!n || !n->isSVGElement()) | 464 if (!n || !n->isSVGElement()) |
| 449 return; | 465 return nullptr; |
| 466 | |
| 450 SVGElement& element = toSVGElement(*n); | 467 SVGElement& element = toSVGElement(*n); |
| 451 | 468 |
| 452 if (element.isSVGGraphicsElement()) { | 469 if (element.isSVGGraphicsElement()) { |
|
fs
2015/06/22 10:57:44
Suggest you turn this into the negation to flatten
| |
| 470 // Spec: "If a <use> element is a child of a clipPath element, it must d irectly | |
| 471 // reference <path>, <text> or basic shapes elements. Indirect reference s are an | |
| 472 // error and the clipPath element must be ignored." | |
| 473 // http://dev.w3.org/fxtf/css-masking-1/#the-clip-path | |
| 453 if (!isDirectReference(element)) { | 474 if (!isDirectReference(element)) { |
| 475 if (isSVGClipPathElement(element)) | |
|
fs
2015/06/22 10:57:44
There's nothing special with <clipPath> in this ca
| |
| 476 return nullptr; | |
| 454 // Spec: Indirect references are an error (14.3.5) | 477 // Spec: Indirect references are an error (14.3.5) |
| 455 document().accessSVGExtensions().reportError("Not allowed to use ind irect reference in <clip-path>"); | 478 document().accessSVGExtensions().reportError("Not allowed to use ind irect reference in <clip-path>"); |
|
fs
2015/06/22 10:57:44
Add return after this (or the method will still re
| |
| 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 } | 479 } |
| 463 } | |
| 464 } | |
| 465 | 480 |
| 466 LayoutObject* SVGUseElement::layoutObjectClipChild() const | 481 return &toSVGGraphicsElement(element); |
| 467 { | |
| 468 if (Node* n = userAgentShadowRoot()->firstChild()) { | |
| 469 if (n->isSVGElement() && isDirectReference(toSVGElement(*n))) | |
| 470 return n->layoutObject(); | |
| 471 } | 482 } |
| 472 | 483 |
| 473 return nullptr; | 484 return nullptr; |
| 474 } | 485 } |
| 475 | 486 |
| 476 bool SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstan ce, bool foundUse) | 487 bool SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstan ce, bool foundUse) |
| 477 { | 488 { |
| 478 ASSERT(target); | 489 ASSERT(target); |
| 479 ASSERT(targetInstance); | 490 ASSERT(targetInstance); |
| 480 | 491 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 774 | 785 |
| 775 if (m_resource) | 786 if (m_resource) |
| 776 m_resource->removeClient(this); | 787 m_resource->removeClient(this); |
| 777 | 788 |
| 778 m_resource = resource; | 789 m_resource = resource; |
| 779 if (m_resource) | 790 if (m_resource) |
| 780 m_resource->addClient(this); | 791 m_resource->addClient(this); |
| 781 } | 792 } |
| 782 | 793 |
| 783 } | 794 } |
| OLD | NEW |