OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2009 Google, Inc. | 4 * Copyright (C) 2009 Google, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 if (isSVGSwitchElement(*element())) { | 48 if (isSVGSwitchElement(*element())) { |
49 Node* node = child->node(); | 49 Node* node = child->node(); |
50 // Reject non-SVG/non-valid elements. | 50 // Reject non-SVG/non-valid elements. |
51 if (!node->isSVGElement() || !toSVGElement(node)->isValid()) | 51 if (!node->isSVGElement() || !toSVGElement(node)->isValid()) |
52 return false; | 52 return false; |
53 // Reject this child if it isn't the first valid node. | 53 // Reject this child if it isn't the first valid node. |
54 if (hasValidPredecessor(node)) | 54 if (hasValidPredecessor(node)) |
55 return false; | 55 return false; |
56 } else if (isSVGAElement(*element())) { | 56 } else if (isSVGAElement(*element())) { |
57 // http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environm
ent | 57 // http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environm
ent |
58 // The 'a' element may contain any element that its parent may contain, exce
pt itself. | 58 // The 'a' element may contain any element that its parent may contain, |
| 59 // except itself. |
59 if (isSVGAElement(*child->node())) | 60 if (isSVGAElement(*child->node())) |
60 return false; | 61 return false; |
61 if (parent() && parent()->isSVG()) | 62 if (parent() && parent()->isSVG()) |
62 return parent()->isChildAllowed(child, style); | 63 return parent()->isChildAllowed(child, style); |
63 } | 64 } |
64 return LayoutSVGContainer::isChildAllowed(child, style); | 65 return LayoutSVGContainer::isChildAllowed(child, style); |
65 } | 66 } |
66 | 67 |
67 void LayoutSVGTransformableContainer::setNeedsTransformUpdate() { | 68 void LayoutSVGTransformableContainer::setNeedsTransformUpdate() { |
68 setMayNeedPaintInvalidationSubtree(); | 69 setMayNeedPaintInvalidationSubtree(); |
69 m_needsTransformUpdate = true; | 70 m_needsTransformUpdate = true; |
70 } | 71 } |
71 | 72 |
72 SVGTransformChange LayoutSVGTransformableContainer::calculateLocalTransform() { | 73 SVGTransformChange LayoutSVGTransformableContainer::calculateLocalTransform() { |
73 SVGGraphicsElement* element = toSVGGraphicsElement(this->element()); | 74 SVGGraphicsElement* element = toSVGGraphicsElement(this->element()); |
74 ASSERT(element); | 75 ASSERT(element); |
75 | 76 |
76 // If we're either the layoutObject for a <use> element, or for any <g> elemen
t inside the shadow | 77 // If we're either the layoutObject for a <use> element, or for any <g> |
77 // tree, that was created during the use/symbol/svg expansion in SVGUseElement
. These containers | 78 // element inside the shadow tree, that was created during the use/symbol/svg |
78 // need to respect the translations induced by their corresponding use element
s x/y attributes. | 79 // expansion in SVGUseElement. These containers need to respect the |
| 80 // translations induced by their corresponding use elements x/y attributes. |
79 SVGUseElement* useElement = nullptr; | 81 SVGUseElement* useElement = nullptr; |
80 if (isSVGUseElement(*element)) { | 82 if (isSVGUseElement(*element)) { |
81 useElement = toSVGUseElement(element); | 83 useElement = toSVGUseElement(element); |
82 } else if (isSVGGElement(*element) && | 84 } else if (isSVGGElement(*element) && |
83 toSVGGElement(element)->inUseShadowTree()) { | 85 toSVGGElement(element)->inUseShadowTree()) { |
84 SVGElement* correspondingElement = element->correspondingElement(); | 86 SVGElement* correspondingElement = element->correspondingElement(); |
85 if (isSVGUseElement(correspondingElement)) | 87 if (isSVGUseElement(correspondingElement)) |
86 useElement = toSVGUseElement(correspondingElement); | 88 useElement = toSVGUseElement(correspondingElement); |
87 } | 89 } |
88 | 90 |
(...skipping 15 matching lines...) Expand all Loading... |
104 | 106 |
105 SVGTransformChangeDetector changeDetector(m_localTransform); | 107 SVGTransformChangeDetector changeDetector(m_localTransform); |
106 m_localTransform = element->calculateAnimatedLocalTransform(); | 108 m_localTransform = element->calculateAnimatedLocalTransform(); |
107 m_localTransform.translate(m_additionalTranslation.width(), | 109 m_localTransform.translate(m_additionalTranslation.width(), |
108 m_additionalTranslation.height()); | 110 m_additionalTranslation.height()); |
109 m_needsTransformUpdate = false; | 111 m_needsTransformUpdate = false; |
110 return changeDetector.computeChange(m_localTransform); | 112 return changeDetector.computeChange(m_localTransform); |
111 } | 113 } |
112 | 114 |
113 } // namespace blink | 115 } // namespace blink |
OLD | NEW |