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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 { | 471 { |
| 472 return isSVGPathElement(element) | 472 return isSVGPathElement(element) |
| 473 || isSVGRectElement(element) | 473 || isSVGRectElement(element) |
| 474 || isSVGCircleElement(element) | 474 || isSVGCircleElement(element) |
| 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 bool SVGUseElement::isVisibleGraphicsElementForClipping() | |
| 482 { | |
| 483 Node* n = userAgentShadowRoot()->firstChild(); | |
|
fs
2016/04/19 10:17:27
This should probably just be using targetGraphicsE
hyunjunekim2
2016/04/27 12:18:40
Merged this function. But occurred to console erro
fs
2016/04/27 14:14:39
Personally I'd be fine with just removing this rep
hyunjunekim2
2016/04/29 12:59:08
Done. Remove it.
| |
| 484 if (!n || !n->isSVGElement()) | |
| 485 return false; | |
| 486 | |
| 487 SVGElement& element = toSVGElement(*n); | |
| 488 | |
| 489 const ComputedStyle* style = element.layoutObject() ? element.layoutObject() ->style() : nullptr; | |
| 490 if (style && style->visibility() != VISIBLE) | |
| 491 return false; | |
| 492 | |
| 493 return true; | |
| 494 } | |
| 495 | |
| 481 void SVGUseElement::toClipPath(Path& path) const | 496 void SVGUseElement::toClipPath(Path& path) const |
| 482 { | 497 { |
| 483 ASSERT(path.isEmpty()); | 498 ASSERT(path.isEmpty()); |
| 484 | 499 |
| 485 const SVGGraphicsElement* element = targetGraphicsElementForClipping(); | 500 const SVGGraphicsElement* element = targetGraphicsElementForClipping(); |
| 486 | 501 |
| 487 if (!element || !element->layoutObject()) | 502 if (!element || !element->layoutObject()) |
| 488 return; | 503 return; |
| 489 | 504 |
| 505 const ComputedStyle* style = element->layoutObject() ? element->layoutObject ()->style() : nullptr; | |
|
fs
2016/04/19 10:17:27
element->layoutObject() has already been null-chec
hyunjunekim2
2016/04/27 12:18:40
Done.
| |
| 506 if (style && style->visibility() != VISIBLE) | |
|
fs
2016/04/19 10:17:27
This should be: !style || style->visibility() != V
hyunjunekim2
2016/04/27 12:18:40
Done.
| |
| 507 return; | |
| 508 | |
| 490 if (element->isSVGGeometryElement()) { | 509 if (element->isSVGGeometryElement()) { |
| 491 toSVGGeometryElement(*element).toClipPath(path); | 510 toSVGGeometryElement(*element).toClipPath(path); |
| 492 // FIXME: Avoid manual resolution of x/y here. Its potentially harmful. | 511 // FIXME: Avoid manual resolution of x/y here. Its potentially harmful. |
| 493 SVGLengthContext lengthContext(this); | 512 SVGLengthContext lengthContext(this); |
| 494 path.translate(FloatSize(m_x->currentValue()->value(lengthContext), m_y- >currentValue()->value(lengthContext))); | 513 path.translate(FloatSize(m_x->currentValue()->value(lengthContext), m_y- >currentValue()->value(lengthContext))); |
| 495 path.transform(calculateAnimatedLocalTransform()); | 514 path.transform(calculateAnimatedLocalTransform()); |
| 496 } | 515 } |
| 497 } | 516 } |
| 498 | 517 |
| 499 SVGGraphicsElement* SVGUseElement::targetGraphicsElementForClipping() const | 518 SVGGraphicsElement* SVGUseElement::targetGraphicsElementForClipping() const |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 742 | 761 |
| 743 if (m_resource) | 762 if (m_resource) |
| 744 m_resource->removeClient(this); | 763 m_resource->removeClient(this); |
| 745 | 764 |
| 746 m_resource = resource; | 765 m_resource = resource; |
| 747 if (m_resource) | 766 if (m_resource) |
| 748 m_resource->addClient(this); | 767 m_resource->addClient(this); |
| 749 } | 768 } |
| 750 | 769 |
| 751 } // namespace blink | 770 } // namespace blink |
| OLD | NEW |