OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 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 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 { | 43 { |
44 visitor->trace(m_x1); | 44 visitor->trace(m_x1); |
45 visitor->trace(m_y1); | 45 visitor->trace(m_y1); |
46 visitor->trace(m_x2); | 46 visitor->trace(m_x2); |
47 visitor->trace(m_y2); | 47 visitor->trace(m_y2); |
48 SVGGeometryElement::trace(visitor); | 48 SVGGeometryElement::trace(visitor); |
49 } | 49 } |
50 | 50 |
51 DEFINE_NODE_FACTORY(SVGLineElement) | 51 DEFINE_NODE_FACTORY(SVGLineElement) |
52 | 52 |
53 bool SVGLineElement::isSupportedAttribute(const QualifiedName& attrName) | |
54 { | |
55 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
56 if (supportedAttributes.isEmpty()) { | |
57 supportedAttributes.add(SVGNames::x1Attr); | |
58 supportedAttributes.add(SVGNames::x2Attr); | |
59 supportedAttributes.add(SVGNames::y1Attr); | |
60 supportedAttributes.add(SVGNames::y2Attr); | |
61 } | |
62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
63 } | |
64 | |
65 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) | 53 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) |
66 { | 54 { |
67 if (!isSupportedAttribute(attrName)) { | |
68 SVGGeometryElement::svgAttributeChanged(attrName); | |
69 return; | |
70 } | |
71 | |
72 SVGElement::InvalidationGuard invalidationGuard(this); | |
73 | |
74 bool isLengthAttribute = attrName == SVGNames::x1Attr | 55 bool isLengthAttribute = attrName == SVGNames::x1Attr |
75 || attrName == SVGNames::y1Attr | 56 || attrName == SVGNames::y1Attr |
76 || attrName == SVGNames::x2Attr | 57 || attrName == SVGNames::x2Attr |
77 || attrName == SVGNames::y2Attr; | 58 || attrName == SVGNames::y2Attr; |
78 | 59 |
79 if (isLengthAttribute) | 60 if (isLengthAttribute) |
80 updateRelativeLengthsInformation(); | 61 updateRelativeLengthsInformation(); |
81 | 62 |
82 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); | 63 if (isLengthAttribute) { |
fs
2015/04/10 14:25:24
Merge blocks.
| |
83 if (!renderer) | 64 SVGElement::InvalidationGuard invalidationGuard(this); |
84 return; | |
85 | 65 |
86 if (isLengthAttribute) { | 66 LayoutSVGShape* object = toLayoutSVGShape(this->layoutObject()); |
87 renderer->setNeedsShapeUpdate(); | 67 if (!object) |
88 markForLayoutAndParentResourceInvalidation(renderer); | 68 return; |
69 | |
70 object->setNeedsShapeUpdate(); | |
71 markForLayoutAndParentResourceInvalidation(object); | |
89 return; | 72 return; |
90 } | 73 } |
91 | 74 |
92 ASSERT_NOT_REACHED(); | 75 SVGGeometryElement::svgAttributeChanged(attrName); |
93 } | 76 } |
94 | 77 |
95 bool SVGLineElement::selfHasRelativeLengths() const | 78 bool SVGLineElement::selfHasRelativeLengths() const |
96 { | 79 { |
97 return m_x1->currentValue()->isRelative() | 80 return m_x1->currentValue()->isRelative() |
98 || m_y1->currentValue()->isRelative() | 81 || m_y1->currentValue()->isRelative() |
99 || m_x2->currentValue()->isRelative() | 82 || m_x2->currentValue()->isRelative() |
100 || m_y2->currentValue()->isRelative(); | 83 || m_y2->currentValue()->isRelative(); |
101 } | 84 } |
102 | 85 |
103 } // namespace blink | 86 } // namespace blink |
OLD | NEW |