| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 | 1276 |
| 1277 template <StyleResolver::StyleApplicationPass pass> | 1277 template <StyleResolver::StyleApplicationPass pass> |
| 1278 bool StyleResolver::isPropertyForPass(CSSPropertyID property) | 1278 bool StyleResolver::isPropertyForPass(CSSPropertyID property) |
| 1279 { | 1279 { |
| 1280 return firstCSSPropertyId<pass>() <= property && property <= lastCSSProperty
Id<pass>(); | 1280 return firstCSSPropertyId<pass>() <= property && property <= lastCSSProperty
Id<pass>(); |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 // This method expands the 'all' shorthand property to longhand properties | 1283 // This method expands the 'all' shorthand property to longhand properties |
| 1284 // and applies the expanded longhand properties. | 1284 // and applies the expanded longhand properties. |
| 1285 template <StyleResolver::StyleApplicationPass pass> | 1285 template <StyleResolver::StyleApplicationPass pass> |
| 1286 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
ue) | 1286 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
ue, bool inheritedOnly) |
| 1287 { | 1287 { |
| 1288 bool isUnsetValue = !allValue->isInitialValue() && !allValue->isInheritedVal
ue(); | 1288 bool isUnsetValue = !allValue->isInitialValue() && !allValue->isInheritedVal
ue(); |
| 1289 unsigned startCSSProperty = firstCSSPropertyId<pass>(); | 1289 unsigned startCSSProperty = firstCSSPropertyId<pass>(); |
| 1290 unsigned endCSSProperty = lastCSSPropertyId<pass>(); | 1290 unsigned endCSSProperty = lastCSSPropertyId<pass>(); |
| 1291 | 1291 |
| 1292 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { | 1292 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { |
| 1293 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); | 1293 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); |
| 1294 | 1294 |
| 1295 // StyleBuilder does not allow any expanded shorthands. | 1295 // StyleBuilder does not allow any expanded shorthands. |
| 1296 if (isShorthandProperty(propertyId)) | 1296 if (isShorthandProperty(propertyId)) |
| 1297 continue; | 1297 continue; |
| 1298 | 1298 |
| 1299 // all shorthand spec says: | 1299 // all shorthand spec says: |
| 1300 // The all property is a shorthand that resets all CSS properties | 1300 // The all property is a shorthand that resets all CSS properties |
| 1301 // except direction and unicode-bidi. | 1301 // except direction and unicode-bidi. |
| 1302 // c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand | 1302 // c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand |
| 1303 // We skip applyProperty when a given property is unicode-bidi or | 1303 // We skip applyProperty when a given property is unicode-bidi or |
| 1304 // direction. | 1304 // direction. |
| 1305 if (!CSSProperty::isAffectedByAllProperty(propertyId)) | 1305 if (!CSSProperty::isAffectedByAllProperty(propertyId)) |
| 1306 continue; | 1306 continue; |
| 1307 | 1307 |
| 1308 // When hitting matched properties' cache, only inherited properties wil
l be |
| 1309 // applied. |
| 1310 if (inheritedOnly && !CSSPropertyMetadata::isInheritedProperty(propertyI
d)) |
| 1311 continue; |
| 1312 |
| 1308 CSSValue* value; | 1313 CSSValue* value; |
| 1309 if (!isUnsetValue) { | 1314 if (!isUnsetValue) { |
| 1310 value = allValue; | 1315 value = allValue; |
| 1311 } else { | 1316 } else { |
| 1312 if (CSSPropertyMetadata::isInheritedProperty(propertyId)) | 1317 if (CSSPropertyMetadata::isInheritedProperty(propertyId)) |
| 1313 value = cssValuePool().createInheritedValue().get(); | 1318 value = cssValuePool().createInheritedValue().get(); |
| 1314 else | 1319 else |
| 1315 value = cssValuePool().createExplicitInitialValue().get(); | 1320 value = cssValuePool().createExplicitInitialValue().get(); |
| 1316 } | 1321 } |
| 1317 StyleBuilder::applyProperty(propertyId, state, value); | 1322 StyleBuilder::applyProperty(propertyId, state, value); |
| 1318 } | 1323 } |
| 1319 } | 1324 } |
| 1320 | 1325 |
| 1321 template <StyleResolver::StyleApplicationPass pass> | 1326 template <StyleResolver::StyleApplicationPass pass> |
| 1322 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
tySet* properties, bool isImportant, bool inheritedOnly, PropertyWhitelistType p
ropertyWhitelistType) | 1327 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
tySet* properties, bool isImportant, bool inheritedOnly, PropertyWhitelistType p
ropertyWhitelistType) |
| 1323 { | 1328 { |
| 1324 unsigned propertyCount = properties->propertyCount(); | 1329 unsigned propertyCount = properties->propertyCount(); |
| 1325 for (unsigned i = 0; i < propertyCount; ++i) { | 1330 for (unsigned i = 0; i < propertyCount; ++i) { |
| 1326 StylePropertySet::PropertyReference current = properties->propertyAt(i); | 1331 StylePropertySet::PropertyReference current = properties->propertyAt(i); |
| 1327 if (isImportant != current.isImportant()) | 1332 if (isImportant != current.isImportant()) |
| 1328 continue; | 1333 continue; |
| 1329 | 1334 |
| 1330 CSSPropertyID property = current.id(); | 1335 CSSPropertyID property = current.id(); |
| 1331 if (property == CSSPropertyAll) { | 1336 if (property == CSSPropertyAll) { |
| 1332 applyAllProperty<pass>(state, current.value()); | 1337 applyAllProperty<pass>(state, current.value(), inheritedOnly); |
| 1333 continue; | 1338 continue; |
| 1334 } | 1339 } |
| 1335 | 1340 |
| 1336 if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStylePro
perty(property)) | 1341 if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStylePro
perty(property)) |
| 1337 continue; | 1342 continue; |
| 1338 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir
stLetterStyleProperty(property)) | 1343 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir
stLetterStyleProperty(property)) |
| 1339 continue; | 1344 continue; |
| 1340 | 1345 |
| 1341 if (inheritedOnly && !current.isInherited()) { | 1346 if (inheritedOnly && !current.isInherited()) { |
| 1342 // If the property value is explicitly inherited, we need to apply f
urther non-inherited properties | 1347 // If the property value is explicitly inherited, we need to apply f
urther non-inherited properties |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 visitor->trace(m_uncommonAttributeRuleSet); | 1592 visitor->trace(m_uncommonAttributeRuleSet); |
| 1588 visitor->trace(m_watchedSelectorsRules); | 1593 visitor->trace(m_watchedSelectorsRules); |
| 1589 visitor->trace(m_treeBoundaryCrossingRules); | 1594 visitor->trace(m_treeBoundaryCrossingRules); |
| 1590 visitor->trace(m_styleSharingLists); | 1595 visitor->trace(m_styleSharingLists); |
| 1591 visitor->trace(m_pendingStyleSheets); | 1596 visitor->trace(m_pendingStyleSheets); |
| 1592 visitor->trace(m_document); | 1597 visitor->trace(m_document); |
| 1593 #endif | 1598 #endif |
| 1594 } | 1599 } |
| 1595 | 1600 |
| 1596 } // namespace blink | 1601 } // namespace blink |
| OLD | NEW |