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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 if (oldStyle->display() != newStyle->display() | 182 if (oldStyle->display() != newStyle->display() |
183 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI
RST_LETTER) | 183 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI
RST_LETTER) |
184 || oldStyle->columnSpan() != newStyle->columnSpan() | 184 || oldStyle->columnSpan() != newStyle->columnSpan() |
185 || !oldStyle->contentDataEquivalent(newStyle) | 185 || !oldStyle->contentDataEquivalent(newStyle) |
186 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() | 186 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() |
187 || oldStyle->justifyItems() != newStyle->justifyItems() | 187 || oldStyle->justifyItems() != newStyle->justifyItems() |
188 || oldStyle->alignItems() != newStyle->alignItems()) | 188 || oldStyle->alignItems() != newStyle->alignItems()) |
189 return Reattach; | 189 return Reattach; |
190 | 190 |
191 if (oldStyle->inheritedNotEqual(*newStyle) | 191 if (oldStyle->inheritedNotEqual(*newStyle)) |
192 || oldStyle->hasExplicitlyInheritedProperties() | |
193 || newStyle->hasExplicitlyInheritedProperties()) | |
194 return Inherit; | 192 return Inherit; |
195 | 193 |
196 if (*oldStyle == *newStyle) | 194 if (*oldStyle == *newStyle) |
197 return diffPseudoStyles(*oldStyle, *newStyle); | 195 return diffPseudoStyles(*oldStyle, *newStyle); |
198 | 196 |
| 197 if (oldStyle->hasExplicitlyInheritedProperties()) |
| 198 return Inherit; |
| 199 |
199 return NoInherit; | 200 return NoInherit; |
200 } | 201 } |
201 | 202 |
202 ItemPosition LayoutStyle::resolveAlignment(const LayoutStyle& parentStyle, const
LayoutStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer) | 203 ItemPosition LayoutStyle::resolveAlignment(const LayoutStyle& parentStyle, const
LayoutStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer) |
203 { | 204 { |
204 // The auto keyword computes to the parent's align-items computed value, or
to "stretch", if not set or "auto". | 205 // The auto keyword computes to the parent's align-items computed value, or
to "stretch", if not set or "auto". |
205 if (childStyle.alignSelf() == ItemPositionAuto) | 206 if (childStyle.alignSelf() == ItemPositionAuto) |
206 return (parentStyle.alignItems() == ItemPositionAuto) ? resolvedAutoPosi
tionForRenderer : parentStyle.alignItems(); | 207 return (parentStyle.alignItems() == ItemPositionAuto) ? resolvedAutoPosi
tionForRenderer : parentStyle.alignItems(); |
207 return childStyle.alignSelf(); | 208 return childStyle.alignSelf(); |
208 } | 209 } |
(...skipping 14 matching lines...) Expand all Loading... |
223 setUserModify(currentUserModify); | 224 setUserModify(currentUserModify); |
224 } else { | 225 } else { |
225 rareInheritedData = inheritParent.rareInheritedData; | 226 rareInheritedData = inheritParent.rareInheritedData; |
226 } | 227 } |
227 inherited = inheritParent.inherited; | 228 inherited = inheritParent.inherited; |
228 inherited_flags = inheritParent.inherited_flags; | 229 inherited_flags = inheritParent.inherited_flags; |
229 if (m_svgStyle != inheritParent.m_svgStyle) | 230 if (m_svgStyle != inheritParent.m_svgStyle) |
230 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); | 231 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); |
231 } | 232 } |
232 | 233 |
233 void LayoutStyle::copyNonInheritedFrom(const LayoutStyle& other) | 234 void LayoutStyle::copyNonInheritedFromCached(const LayoutStyle& other) |
234 { | 235 { |
235 m_box = other.m_box; | 236 m_box = other.m_box; |
236 visual = other.visual; | 237 visual = other.visual; |
237 m_background = other.m_background; | 238 m_background = other.m_background; |
238 surround = other.surround; | 239 surround = other.surround; |
239 rareNonInheritedData = other.rareNonInheritedData; | 240 rareNonInheritedData = other.rareNonInheritedData; |
| 241 |
240 // The flags are copied one-by-one because noninherited_flags contains a bun
ch of stuff other than real style data. | 242 // The flags are copied one-by-one because noninherited_flags contains a bun
ch of stuff other than real style data. |
| 243 // See comments for each skipped flag below. |
241 noninherited_flags.effectiveDisplay = other.noninherited_flags.effectiveDisp
lay; | 244 noninherited_flags.effectiveDisplay = other.noninherited_flags.effectiveDisp
lay; |
242 noninherited_flags.originalDisplay = other.noninherited_flags.originalDispla
y; | 245 noninherited_flags.originalDisplay = other.noninherited_flags.originalDispla
y; |
243 noninherited_flags.overflowX = other.noninherited_flags.overflowX; | 246 noninherited_flags.overflowX = other.noninherited_flags.overflowX; |
244 noninherited_flags.overflowY = other.noninherited_flags.overflowY; | 247 noninherited_flags.overflowY = other.noninherited_flags.overflowY; |
245 noninherited_flags.verticalAlign = other.noninherited_flags.verticalAlign; | 248 noninherited_flags.verticalAlign = other.noninherited_flags.verticalAlign; |
246 noninherited_flags.clear = other.noninherited_flags.clear; | 249 noninherited_flags.clear = other.noninherited_flags.clear; |
247 noninherited_flags.position = other.noninherited_flags.position; | 250 noninherited_flags.position = other.noninherited_flags.position; |
248 noninherited_flags.floating = other.noninherited_flags.floating; | 251 noninherited_flags.floating = other.noninherited_flags.floating; |
249 noninherited_flags.tableLayout = other.noninherited_flags.tableLayout; | 252 noninherited_flags.tableLayout = other.noninherited_flags.tableLayout; |
250 noninherited_flags.unicodeBidi = other.noninherited_flags.unicodeBidi; | 253 noninherited_flags.unicodeBidi = other.noninherited_flags.unicodeBidi; |
| 254 noninherited_flags.hasViewportUnits = other.noninherited_flags.hasViewportUn
its; |
251 noninherited_flags.pageBreakBefore = other.noninherited_flags.pageBreakBefor
e; | 255 noninherited_flags.pageBreakBefore = other.noninherited_flags.pageBreakBefor
e; |
252 noninherited_flags.pageBreakAfter = other.noninherited_flags.pageBreakAfter; | 256 noninherited_flags.pageBreakAfter = other.noninherited_flags.pageBreakAfter; |
253 noninherited_flags.pageBreakInside = other.noninherited_flags.pageBreakInsid
e; | 257 noninherited_flags.pageBreakInside = other.noninherited_flags.pageBreakInsid
e; |
254 noninherited_flags.explicitInheritance = other.noninherited_flags.explicitIn
heritance; | 258 |
255 noninherited_flags.hasViewportUnits = other.noninherited_flags.hasViewportUn
its; | 259 // Correctly set during selector matching: |
| 260 // noninherited_flags.styleType |
| 261 // noninherited_flags.pseudoBits |
| 262 |
| 263 // Set correctly while computing style for children: |
| 264 // noninherited_flags.explicitInheritance |
| 265 |
| 266 // unique() styles are not cacheable. |
| 267 ASSERT(!other.noninherited_flags.unique); |
| 268 |
| 269 // The following flags are set during matching before we decide that we get
a |
| 270 // match in the MatchedPropertiesCache which in turn calls this method. The |
| 271 // reason why we don't copy these flags is that they're already correctly se
t |
| 272 // and that they may differ between elements which have the same set of matc
hed |
| 273 // properties. For instance, given the rule: |
| 274 // |
| 275 // :-webkit-any(:hover, :focus) { background-color: green }" |
| 276 // |
| 277 // A hovered element, and a focused element may use the same cached matched |
| 278 // properties here, but the affectedBy flags will be set differently based o
n |
| 279 // the matching order of the :-webkit-any components. |
| 280 // |
| 281 // noninherited_flags.emptyState |
| 282 // noninherited_flags.affectedByFocus |
| 283 // noninherited_flags.affectedByHover |
| 284 // noninherited_flags.affectedByActive |
| 285 // noninherited_flags.affectedByDrag |
| 286 // noninherited_flags.isLink |
| 287 |
256 if (m_svgStyle != other.m_svgStyle) | 288 if (m_svgStyle != other.m_svgStyle) |
257 m_svgStyle.access()->copyNonInheritedFrom(other.m_svgStyle.get()); | 289 m_svgStyle.access()->copyNonInheritedFromCached(other.m_svgStyle.get()); |
258 ASSERT(zoom() == initialZoom()); | 290 ASSERT(zoom() == initialZoom()); |
259 } | 291 } |
260 | 292 |
261 bool LayoutStyle::operator==(const LayoutStyle& o) const | 293 bool LayoutStyle::operator==(const LayoutStyle& o) const |
262 { | 294 { |
263 // compare everything except the pseudoStyle pointer | 295 // compare everything except the pseudoStyle pointer |
264 return inherited_flags == o.inherited_flags | 296 return inherited_flags == o.inherited_flags |
265 && noninherited_flags == o.noninherited_flags | 297 && noninherited_flags == o.noninherited_flags |
266 && m_box == o.m_box | 298 && m_box == o.m_box |
267 && visual == o.visual | 299 && visual == o.visual |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 horizontal || includeLogicalRightEdge); | 1698 horizontal || includeLogicalRightEdge); |
1667 | 1699 |
1668 edges[BSLeft] = BorderEdge(borderLeftWidth(), | 1700 edges[BSLeft] = BorderEdge(borderLeftWidth(), |
1669 visitedDependentColor(CSSPropertyBorderLeftColor), | 1701 visitedDependentColor(CSSPropertyBorderLeftColor), |
1670 borderLeftStyle(), | 1702 borderLeftStyle(), |
1671 borderLeftIsTransparent(), | 1703 borderLeftIsTransparent(), |
1672 !horizontal || includeLogicalLeftEdge); | 1704 !horizontal || includeLogicalLeftEdge); |
1673 } | 1705 } |
1674 | 1706 |
1675 } // namespace blink | 1707 } // namespace blink |
OLD | NEW |