OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Google, Inc. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 SubtreeContentTransformScope(const AffineTransform&); | 123 SubtreeContentTransformScope(const AffineTransform&); |
124 ~SubtreeContentTransformScope(); | 124 ~SubtreeContentTransformScope(); |
125 | 125 |
126 static AffineTransform currentContentTransformation() { return AffineTransfo
rm(s_currentContentTransformation); } | 126 static AffineTransform currentContentTransformation() { return AffineTransfo
rm(s_currentContentTransformation); } |
127 | 127 |
128 private: | 128 private: |
129 static AffineTransform::Transform s_currentContentTransformation; | 129 static AffineTransform::Transform s_currentContentTransformation; |
130 AffineTransform m_savedContentTransformation; | 130 AffineTransform m_savedContentTransformation; |
131 }; | 131 }; |
132 | 132 |
| 133 // The following enumeration is used to optimize cases where the scale is known |
| 134 // to be invariant (see: LayoutSVGContainer::layout and LayoutSVGroot). The |
| 135 // value 'Full' can be used in the general case when the scale change is |
| 136 // unknown, or known to change. |
| 137 enum class SVGTransformChange { |
| 138 None, |
| 139 ScaleInvariant, |
| 140 Full, |
| 141 }; |
| 142 |
| 143 // Helper for computing ("classifying") a change to a transform using the |
| 144 // categoies defined above. |
| 145 class SVGTransformChangeDetector { |
| 146 STACK_ALLOCATED(); |
| 147 public: |
| 148 explicit SVGTransformChangeDetector(const AffineTransform& previous) |
| 149 : m_previousTransform(previous) |
| 150 { |
| 151 } |
| 152 |
| 153 SVGTransformChange computeChange(const AffineTransform& current) |
| 154 { |
| 155 if (m_previousTransform == current) |
| 156 return SVGTransformChange::None; |
| 157 if (scaleReference(m_previousTransform) == scaleReference(current)) |
| 158 return SVGTransformChange::ScaleInvariant; |
| 159 return SVGTransformChange::Full; |
| 160 } |
| 161 |
| 162 private: |
| 163 static std::pair<double, double> scaleReference(const AffineTransform& trans
form) |
| 164 { |
| 165 return std::make_pair(transform.xScaleSquared(), transform.yScaleSquared
()); |
| 166 } |
| 167 AffineTransform m_previousTransform; |
| 168 }; |
| 169 |
133 template <typename LayoutObjectType> | 170 template <typename LayoutObjectType> |
134 bool SVGLayoutSupport::computeHasNonIsolatedBlendingDescendants(const LayoutObje
ctType* object) | 171 bool SVGLayoutSupport::computeHasNonIsolatedBlendingDescendants(const LayoutObje
ctType* object) |
135 { | 172 { |
136 for (LayoutObject* child = object->firstChild(); child; child = child->nextS
ibling()) { | 173 for (LayoutObject* child = object->firstChild(); child; child = child->nextS
ibling()) { |
137 if (child->isBlendingAllowed() && child->style()->hasBlendMode()) | 174 if (child->isBlendingAllowed() && child->style()->hasBlendMode()) |
138 return true; | 175 return true; |
139 if (child->hasNonIsolatedBlendingDescendants() && !willIsolateBlendingDe
scendantsForObject(child)) | 176 if (child->hasNonIsolatedBlendingDescendants() && !willIsolateBlendingDe
scendantsForObject(child)) |
140 return true; | 177 return true; |
141 } | 178 } |
142 return false; | 179 return false; |
143 } | 180 } |
144 | 181 |
145 } // namespace blink | 182 } // namespace blink |
146 | 183 |
147 #endif // SVGLayoutSupport_h | 184 #endif // SVGLayoutSupport_h |
OLD | NEW |