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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 475 || isSVGEllipseElement(element) | 475 || isSVGEllipseElement(element) |
| 476 || isSVGPolygonElement(element) | 476 || isSVGPolygonElement(element) |
| 477 || isSVGPolylineElement(element) | 477 || isSVGPolylineElement(element) |
| 478 || isSVGTextElement(element); | 478 || isSVGTextElement(element); |
| 479 } | 479 } |
| 480 | 480 |
| 481 void SVGUseElement::toClipPath(Path& path) const | 481 void SVGUseElement::toClipPath(Path& path) const |
| 482 { | 482 { |
| 483 ASSERT(path.isEmpty()); | 483 ASSERT(path.isEmpty()); |
| 484 | 484 |
| 485 const SVGGraphicsElement* element = targetGraphicsElementForClipping(); | 485 const SVGGraphicsElement* element = visibleTargetGraphicsElementForClipping( ); |
| 486 | 486 |
| 487 if (!element || !element->layoutObject()) | 487 if (!element || !element->layoutObject()) |
|
fs
2016/04/27 14:14:40
You should move the second part of this condition
hyunjunekim2
2016/04/29 12:59:09
Done. Moved to visibleTargetGraphicsElementForClip
| |
| 488 return; | 488 return; |
| 489 | 489 |
| 490 if (element->isSVGGeometryElement()) { | 490 if (element->isSVGGeometryElement()) { |
| 491 toSVGGeometryElement(*element).toClipPath(path); | 491 toSVGGeometryElement(*element).toClipPath(path); |
| 492 // FIXME: Avoid manual resolution of x/y here. Its potentially harmful. | 492 // FIXME: Avoid manual resolution of x/y here. Its potentially harmful. |
| 493 SVGLengthContext lengthContext(this); | 493 SVGLengthContext lengthContext(this); |
| 494 path.translate(FloatSize(m_x->currentValue()->value(lengthContext), m_y- >currentValue()->value(lengthContext))); | 494 path.translate(FloatSize(m_x->currentValue()->value(lengthContext), m_y- >currentValue()->value(lengthContext))); |
| 495 path.transform(calculateAnimatedLocalTransform()); | 495 path.transform(calculateAnimatedLocalTransform()); |
| 496 } | 496 } |
| 497 } | 497 } |
| 498 | 498 |
| 499 SVGGraphicsElement* SVGUseElement::targetGraphicsElementForClipping() const | 499 SVGGraphicsElement* SVGUseElement::visibleTargetGraphicsElementForClipping() con st |
| 500 { | 500 { |
| 501 Node* n = userAgentShadowRoot()->firstChild(); | 501 Node* n = userAgentShadowRoot()->firstChild(); |
| 502 if (!n || !n->isSVGElement()) | 502 if (!n || !n->isSVGElement()) |
| 503 return nullptr; | 503 return nullptr; |
| 504 | 504 |
| 505 SVGElement& element = toSVGElement(*n); | 505 SVGElement& element = toSVGElement(*n); |
| 506 | 506 |
| 507 if (!element.isSVGGraphicsElement()) | 507 if (!element.isSVGGraphicsElement()) |
| 508 return nullptr; | 508 return nullptr; |
| 509 | 509 |
| 510 const ComputedStyle* style = element.layoutObject() ? element.layoutObject() ->style() : nullptr; | |
| 511 if (!style || style->visibility() != VISIBLE) | |
| 512 return nullptr; | |
| 513 | |
| 510 // Spec: "If a <use> element is a child of a clipPath element, it must direc tly | 514 // Spec: "If a <use> element is a child of a clipPath element, it must direc tly |
| 511 // reference <path>, <text> or basic shapes elements. Indirect references ar e an | 515 // reference <path>, <text> or basic shapes elements. Indirect references ar e an |
| 512 // error and the clipPath element must be ignored." | 516 // error and the clipPath element must be ignored." |
| 513 // http://dev.w3.org/fxtf/css-masking-1/#the-clip-path | 517 // http://dev.w3.org/fxtf/css-masking-1/#the-clip-path |
| 514 if (!isDirectReference(element)) { | 518 if (!isDirectReference(element)) { |
| 515 // Spec: Indirect references are an error (14.3.5) | 519 // Spec: Indirect references are an error (14.3.5) |
| 516 document().accessSVGExtensions().reportError("Not allowed to use indirec t reference in <clip-path>"); | 520 document().accessSVGExtensions().reportError("Not allowed to use indirec t reference in <clip-path>"); |
| 517 return nullptr; | 521 return nullptr; |
| 518 } | 522 } |
| 519 | 523 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 742 | 746 |
| 743 if (m_resource) | 747 if (m_resource) |
| 744 m_resource->removeClient(this); | 748 m_resource->removeClient(this); |
| 745 | 749 |
| 746 m_resource = resource; | 750 m_resource = resource; |
| 747 if (m_resource) | 751 if (m_resource) |
| 748 m_resource->addClient(this); | 752 m_resource->addClient(this); |
| 749 } | 753 } |
| 750 | 754 |
| 751 } // namespace blink | 755 } // namespace blink |
| OLD | NEW |