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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 return LayoutSVGContainer::isChildAllowed(child, style); | 66 return LayoutSVGContainer::isChildAllowed(child, style); |
67 } | 67 } |
68 | 68 |
69 void LayoutSVGTransformableContainer::setNeedsTransformUpdate() | 69 void LayoutSVGTransformableContainer::setNeedsTransformUpdate() |
70 { | 70 { |
71 setMayNeedPaintInvalidationSubtree(); | 71 setMayNeedPaintInvalidationSubtree(); |
72 m_needsTransformUpdate = true; | 72 m_needsTransformUpdate = true; |
73 } | 73 } |
74 | 74 |
75 static std::pair<double, double> scaleReference(const AffineTransform& transform
) | 75 SVGTransformChange LayoutSVGTransformableContainer::calculateLocalTransform() |
76 { | |
77 return std::make_pair(transform.xScaleSquared(), transform.yScaleSquared()); | |
78 } | |
79 | |
80 LayoutSVGContainer::TransformChange LayoutSVGTransformableContainer::calculateLo
calTransform() | |
81 { | 76 { |
82 SVGGraphicsElement* element = toSVGGraphicsElement(this->element()); | 77 SVGGraphicsElement* element = toSVGGraphicsElement(this->element()); |
83 ASSERT(element); | 78 ASSERT(element); |
84 | 79 |
85 // If we're either the layoutObject for a <use> element, or for any <g> elem
ent inside the shadow | 80 // If we're either the layoutObject for a <use> element, or for any <g> elem
ent inside the shadow |
86 // tree, that was created during the use/symbol/svg expansion in SVGUseEleme
nt. These containers | 81 // tree, that was created during the use/symbol/svg expansion in SVGUseEleme
nt. These containers |
87 // need to respect the translations induced by their corresponding use eleme
nts x/y attributes. | 82 // need to respect the translations induced by their corresponding use eleme
nts x/y attributes. |
88 SVGUseElement* useElement = nullptr; | 83 SVGUseElement* useElement = nullptr; |
89 if (isSVGUseElement(*element)) { | 84 if (isSVGUseElement(*element)) { |
90 useElement = toSVGUseElement(element); | 85 useElement = toSVGUseElement(element); |
(...skipping 10 matching lines...) Expand all Loading... |
101 useElement->y()->currentValue()->value(lengthContext)); | 96 useElement->y()->currentValue()->value(lengthContext)); |
102 // TODO(fs): Signal this on style update instead. (Since these are | 97 // TODO(fs): Signal this on style update instead. (Since these are |
103 // suppose to be presentation attributes now, this does feel a bit | 98 // suppose to be presentation attributes now, this does feel a bit |
104 // broken...) | 99 // broken...) |
105 if (translation != m_additionalTranslation) | 100 if (translation != m_additionalTranslation) |
106 setNeedsTransformUpdate(); | 101 setNeedsTransformUpdate(); |
107 m_additionalTranslation = translation; | 102 m_additionalTranslation = translation; |
108 } | 103 } |
109 | 104 |
110 if (!m_needsTransformUpdate) | 105 if (!m_needsTransformUpdate) |
111 return TransformChange::None; | 106 return SVGTransformChange::None; |
112 | 107 |
113 std::pair<double, double> oldScale = scaleReference(m_localTransform); | 108 SVGTransformChangeDetector changeDetector(m_localTransform); |
114 m_localTransform = element->calculateAnimatedLocalTransform(); | 109 m_localTransform = element->calculateAnimatedLocalTransform(); |
115 m_localTransform.translate(m_additionalTranslation.width(), m_additionalTran
slation.height()); | 110 m_localTransform.translate(m_additionalTranslation.width(), m_additionalTran
slation.height()); |
116 m_needsTransformUpdate = false; | 111 m_needsTransformUpdate = false; |
117 return scaleReference(m_localTransform) != oldScale | 112 return changeDetector.computeChange(m_localTransform); |
118 ? TransformChange::Full : TransformChange::ScaleInvariant; | |
119 } | 113 } |
120 | 114 |
121 } // namespace blink | 115 } // namespace blink |
OLD | NEW |