OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 , surround(o.surround) | 143 , surround(o.surround) |
144 , rareNonInheritedData(o.rareNonInheritedData) | 144 , rareNonInheritedData(o.rareNonInheritedData) |
145 , rareInheritedData(o.rareInheritedData) | 145 , rareInheritedData(o.rareInheritedData) |
146 , inherited(o.inherited) | 146 , inherited(o.inherited) |
147 , m_svgStyle(o.m_svgStyle) | 147 , m_svgStyle(o.m_svgStyle) |
148 , inherited_flags(o.inherited_flags) | 148 , inherited_flags(o.inherited_flags) |
149 , noninherited_flags(o.noninherited_flags) | 149 , noninherited_flags(o.noninherited_flags) |
150 { | 150 { |
151 } | 151 } |
152 | 152 |
153 static StyleRecalcChange comparePseudoStyles(const RenderStyle* oldStyle, const
RenderStyle* newStyle) | 153 static StyleRecalcChange diffPseudoStyles(const RenderStyle* oldStyle, const Ren
derStyle* newStyle) |
154 { | 154 { |
155 // If the pseudoStyles have changed, we want any StyleRecalcChange that is n
ot NoChange | 155 // If the pseudoStyles have changed, we want any StyleRecalcChange that is n
ot NoChange |
156 // because setStyle will do the right thing with anything else. | 156 // because setStyle will do the right thing with anything else. |
157 if (!oldStyle->hasAnyPublicPseudoStyles()) | 157 if (!oldStyle->hasAnyPublicPseudoStyles()) |
158 return NoChange; | 158 return NoChange; |
159 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < FIRST_INTERNAL_PS
EUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { | 159 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < FIRST_INTERNAL_PS
EUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { |
160 if (!oldStyle->hasPseudoStyle(pseudoId)) | 160 if (!oldStyle->hasPseudoStyle(pseudoId)) |
161 continue; | 161 continue; |
162 RenderStyle* newPseudoStyle = newStyle->getCachedPseudoStyle(pseudoId); | 162 RenderStyle* newPseudoStyle = newStyle->getCachedPseudoStyle(pseudoId); |
163 if (!newPseudoStyle) | 163 if (!newPseudoStyle) |
164 return NoInherit; | 164 return NoInherit; |
165 RenderStyle* oldPseudoStyle = oldStyle->getCachedPseudoStyle(pseudoId); | 165 RenderStyle* oldPseudoStyle = oldStyle->getCachedPseudoStyle(pseudoId); |
166 if (oldPseudoStyle && *oldPseudoStyle != *newPseudoStyle) | 166 if (oldPseudoStyle && *oldPseudoStyle != *newPseudoStyle) |
167 return NoInherit; | 167 return NoInherit; |
168 } | 168 } |
169 return NoChange; | 169 return NoChange; |
170 } | 170 } |
171 | 171 |
172 StyleRecalcChange RenderStyle::compare(const RenderStyle* oldStyle, const Render
Style* newStyle) | 172 StyleRecalcChange RenderStyle::stylePropagationDiff(const RenderStyle* oldStyle,
const RenderStyle* newStyle) |
173 { | 173 { |
174 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) | 174 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) |
175 return Reattach; | 175 return Reattach; |
176 | 176 |
177 if (!oldStyle && !newStyle) | 177 if (!oldStyle && !newStyle) |
178 return NoChange; | 178 return NoChange; |
179 | 179 |
180 if (oldStyle->display() != newStyle->display() | 180 if (oldStyle->display() != newStyle->display() |
181 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI
RST_LETTER) | 181 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI
RST_LETTER) |
182 || oldStyle->columnSpan() != newStyle->columnSpan() | 182 || oldStyle->columnSpan() != newStyle->columnSpan() |
183 || oldStyle->specifiesColumns() != newStyle->specifiesColumns() | 183 || oldStyle->specifiesColumns() != newStyle->specifiesColumns() |
184 || !oldStyle->contentDataEquivalent(newStyle) | 184 || !oldStyle->contentDataEquivalent(newStyle) |
185 || oldStyle->hasTextCombine() != newStyle->hasTextCombine()) | 185 || oldStyle->hasTextCombine() != newStyle->hasTextCombine()) |
186 return Reattach; | 186 return Reattach; |
187 | 187 |
188 if (*oldStyle == *newStyle) | 188 if (*oldStyle == *newStyle) |
189 return comparePseudoStyles(oldStyle, newStyle); | 189 return diffPseudoStyles(oldStyle, newStyle); |
190 | 190 |
191 if (oldStyle->inheritedNotEqual(newStyle) | 191 if (oldStyle->inheritedNotEqual(newStyle) |
192 || oldStyle->hasExplicitlyInheritedProperties() | 192 || oldStyle->hasExplicitlyInheritedProperties() |
193 || newStyle->hasExplicitlyInheritedProperties()) | 193 || newStyle->hasExplicitlyInheritedProperties()) |
194 return Inherit; | 194 return Inherit; |
195 | 195 |
196 return NoInherit; | 196 return NoInherit; |
197 } | 197 } |
198 | 198 |
199 void RenderStyle::inheritFrom(const RenderStyle* inheritParent, IsAtShadowBounda
ry isAtShadowBoundary) | 199 void RenderStyle::inheritFrom(const RenderStyle* inheritParent, IsAtShadowBounda
ry isAtShadowBoundary) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 if (width.isIntrinsicOrAuto() | 360 if (width.isIntrinsicOrAuto() |
361 && ((!a.left().isIntrinsicOrAuto() && a.left() != b.left()) | 361 && ((!a.left().isIntrinsicOrAuto() && a.left() != b.left()) |
362 || (!a.right().isIntrinsicOrAuto() && a.right() != b.right()))) | 362 || (!a.right().isIntrinsicOrAuto() && a.right() != b.right()))) |
363 return false; | 363 return false; |
364 | 364 |
365 // One of the units is fixed or percent in both directions and stayed | 365 // One of the units is fixed or percent in both directions and stayed |
366 // that way in the new style. Therefore all we are doing is moving. | 366 // that way in the new style. Therefore all we are doing is moving. |
367 return true; | 367 return true; |
368 } | 368 } |
369 | 369 |
370 StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
textSensitiveProperties) const | 370 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle* other, un
signed& changedContextSensitiveProperties) const |
371 { | 371 { |
372 changedContextSensitiveProperties = ContextSensitivePropertyNone; | 372 changedContextSensitiveProperties = ContextSensitivePropertyNone; |
373 | 373 |
374 // Note, we use .get() on each DataRef below because DataRef::operator== wil
l do a deep | 374 // Note, we use .get() on each DataRef below because DataRef::operator== wil
l do a deep |
375 // compare, which is duplicate work when we're going to compare each propert
y inside | 375 // compare, which is duplicate work when we're going to compare each propert
y inside |
376 // this function anyway. | 376 // this function anyway. |
377 | 377 |
378 StyleDifference svgChange = StyleDifferenceEqual; | 378 StyleDifference svgChange = StyleDifferenceEqual; |
379 if (m_svgStyle.get() != other->m_svgStyle.get()) { | 379 if (m_svgStyle.get() != other->m_svgStyle.get()) { |
380 svgChange = m_svgStyle->diff(other->m_svgStyle.get()); | 380 svgChange = m_svgStyle->diff(other->m_svgStyle.get()); |
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 // right | 1655 // right |
1656 radiiSum = radii.topRight().height() + radii.bottomRight().height(); | 1656 radiiSum = radii.topRight().height() + radii.bottomRight().height(); |
1657 if (radiiSum > rect.height()) | 1657 if (radiiSum > rect.height()) |
1658 factor = std::min(rect.height() / radiiSum, factor); | 1658 factor = std::min(rect.height() / radiiSum, factor); |
1659 | 1659 |
1660 ASSERT(factor <= 1); | 1660 ASSERT(factor <= 1); |
1661 return factor; | 1661 return factor; |
1662 } | 1662 } |
1663 | 1663 |
1664 } // namespace WebCore | 1664 } // namespace WebCore |
OLD | NEW |