| 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 632 |
| 633 if (state.style()->hasViewportUnits()) | 633 if (state.style()->hasViewportUnits()) |
| 634 document().setHasViewportUnits(); | 634 document().setHasViewportUnits(); |
| 635 | 635 |
| 636 // Now return the style. | 636 // Now return the style. |
| 637 return state.takeStyle(); | 637 return state.takeStyle(); |
| 638 } | 638 } |
| 639 | 639 |
| 640 // This function is used by the WebAnimations JavaScript API method animate(). | 640 // This function is used by the WebAnimations JavaScript API method animate(). |
| 641 // FIXME: Remove this when animate() switches away from resolution-dependent par
sing. | 641 // FIXME: Remove this when animate() switches away from resolution-dependent par
sing. |
| 642 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap
shot(Element& element, const ComputedStyle* baseStyle, CSSPropertyID property, C
SSValue* value) | 642 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap
shot(Element& element, const ComputedStyle* baseStyle, CSSPropertyID property, N
ullableCSSValue value) |
| 643 { | 643 { |
| 644 StyleResolverState state(element.document(), &element); | 644 StyleResolverState state(element.document(), &element); |
| 645 state.setStyle(baseStyle ? ComputedStyle::clone(*baseStyle) : ComputedStyle:
:create()); | 645 state.setStyle(baseStyle ? ComputedStyle::clone(*baseStyle) : ComputedStyle:
:create()); |
| 646 return createAnimatableValueSnapshot(state, property, value); | 646 return createAnimatableValueSnapshot(state, property, value); |
| 647 } | 647 } |
| 648 | 648 |
| 649 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap
shot(StyleResolverState& state, CSSPropertyID property, CSSValue* value) | 649 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap
shot(StyleResolverState& state, CSSPropertyID property, NullableCSSValue value) |
| 650 { | 650 { |
| 651 if (value) { | 651 if (value) { |
| 652 StyleBuilder::applyProperty(property, state, value); | 652 StyleBuilder::applyProperty(property, state, *value); |
| 653 state.fontBuilder().createFont(state.document().styleEngine().fontSelect
or(), state.mutableStyleRef()); | 653 state.fontBuilder().createFont(state.document().styleEngine().fontSelect
or(), state.mutableStyleRef()); |
| 654 } | 654 } |
| 655 return CSSAnimatableValueFactory::create(property, *state.style()); | 655 return CSSAnimatableValueFactory::create(property, *state.style()); |
| 656 } | 656 } |
| 657 | 657 |
| 658 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element
* parent, PseudoId pseudoId) | 658 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element
* parent, PseudoId pseudoId) |
| 659 { | 659 { |
| 660 if (pseudoId == FIRST_LETTER) | 660 if (pseudoId == FIRST_LETTER) |
| 661 return FirstLetterPseudoElement::create(parent); | 661 return FirstLetterPseudoElement::create(parent); |
| 662 return PseudoElement::create(parent, pseudoId); | 662 return PseudoElement::create(parent, pseudoId); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 || !settings->textTrackTextColor().isEmpty() | 1146 || !settings->textTrackTextColor().isEmpty() |
| 1147 || !settings->textTrackTextShadow().isEmpty() | 1147 || !settings->textTrackTextShadow().isEmpty() |
| 1148 || !settings->textTrackTextSize().isEmpty()) | 1148 || !settings->textTrackTextSize().isEmpty()) |
| 1149 return true; | 1149 return true; |
| 1150 return false; | 1150 return false; |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 // This method expands the 'all' shorthand property to longhand properties | 1153 // This method expands the 'all' shorthand property to longhand properties |
| 1154 // and applies the expanded longhand properties. | 1154 // and applies the expanded longhand properties. |
| 1155 template <CSSPropertyPriority priority> | 1155 template <CSSPropertyPriority priority> |
| 1156 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
ue, bool inheritedOnly) | 1156 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue allValu
e, bool inheritedOnly) |
| 1157 { | 1157 { |
| 1158 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first(); | 1158 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first(); |
| 1159 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last(); | 1159 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last(); |
| 1160 | 1160 |
| 1161 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { | 1161 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { |
| 1162 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); | 1162 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); |
| 1163 | 1163 |
| 1164 // StyleBuilder does not allow any expanded shorthands. | 1164 // StyleBuilder does not allow any expanded shorthands. |
| 1165 if (isShorthandProperty(propertyId)) | 1165 if (isShorthandProperty(propertyId)) |
| 1166 continue; | 1166 continue; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 if (propertyWhitelistType == PropertyWhitelistCue && (!isValidCueStylePr
operty(property) || shouldIgnoreTextTrackAuthorStyle(document()))) | 1201 if (propertyWhitelistType == PropertyWhitelistCue && (!isValidCueStylePr
operty(property) || shouldIgnoreTextTrackAuthorStyle(document()))) |
| 1202 continue; | 1202 continue; |
| 1203 | 1203 |
| 1204 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir
stLetterStyleProperty(property)) | 1204 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir
stLetterStyleProperty(property)) |
| 1205 continue; | 1205 continue; |
| 1206 | 1206 |
| 1207 if (inheritedOnly && !current.isInherited()) { | 1207 if (inheritedOnly && !current.isInherited()) { |
| 1208 // If the property value is explicitly inherited, we need to apply f
urther non-inherited properties | 1208 // If the property value is explicitly inherited, we need to apply f
urther non-inherited properties |
| 1209 // as they might override the value inherited here. For this reason
we don't allow declarations with | 1209 // as they might override the value inherited here. For this reason
we don't allow declarations with |
| 1210 // explicitly inherited properties to be cached. | 1210 // explicitly inherited properties to be cached. |
| 1211 ASSERT(!current.value()->isInheritedValue()); | 1211 ASSERT(!current.value().isInheritedValue()); |
| 1212 continue; | 1212 continue; |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) | 1215 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) |
| 1216 continue; | 1216 continue; |
| 1217 | 1217 |
| 1218 StyleBuilder::applyProperty(current.id(), state, current.value()); | 1218 StyleBuilder::applyProperty(current.id(), state, current.value()); |
| 1219 } | 1219 } |
| 1220 } | 1220 } |
| 1221 | 1221 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 CSSPropertyLineHeight, | 1395 CSSPropertyLineHeight, |
| 1396 }; | 1396 }; |
| 1397 | 1397 |
| 1398 // TODO(timloh): This is weird, the style is being used as its own parent | 1398 // TODO(timloh): This is weird, the style is being used as its own parent |
| 1399 StyleResolverState state(document(), document().documentElement(), style); | 1399 StyleResolverState state(document(), document().documentElement(), style); |
| 1400 state.setStyle(style); | 1400 state.setStyle(style); |
| 1401 | 1401 |
| 1402 for (CSSPropertyID property : properties) { | 1402 for (CSSPropertyID property : properties) { |
| 1403 if (property == CSSPropertyLineHeight) | 1403 if (property == CSSPropertyLineHeight) |
| 1404 updateFont(state); | 1404 updateFont(state); |
| 1405 StyleBuilder::applyProperty(property, state, propertySet.getPropertyCSSV
alue(property).get()); | 1405 StyleBuilder::applyProperty(property, state, *propertySet.getPropertyCSS
Value(property)); |
| 1406 } | 1406 } |
| 1407 } | 1407 } |
| 1408 | 1408 |
| 1409 void StyleResolver::addMediaQueryResults(const MediaQueryResultList& list) | 1409 void StyleResolver::addMediaQueryResults(const MediaQueryResultList& list) |
| 1410 { | 1410 { |
| 1411 for (size_t i = 0; i < list.size(); ++i) | 1411 for (size_t i = 0; i < list.size(); ++i) |
| 1412 m_viewportDependentMediaQueryResults.append(list[i]); | 1412 m_viewportDependentMediaQueryResults.append(list[i]); |
| 1413 } | 1413 } |
| 1414 | 1414 |
| 1415 bool StyleResolver::mediaQueryAffectedByViewportChange() const | 1415 bool StyleResolver::mediaQueryAffectedByViewportChange() const |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1434 visitor->trace(m_watchedSelectorsRules); | 1434 visitor->trace(m_watchedSelectorsRules); |
| 1435 visitor->trace(m_treeBoundaryCrossingRules); | 1435 visitor->trace(m_treeBoundaryCrossingRules); |
| 1436 visitor->trace(m_styleResourceLoader); | 1436 visitor->trace(m_styleResourceLoader); |
| 1437 visitor->trace(m_styleSharingLists); | 1437 visitor->trace(m_styleSharingLists); |
| 1438 visitor->trace(m_pendingStyleSheets); | 1438 visitor->trace(m_pendingStyleSheets); |
| 1439 visitor->trace(m_document); | 1439 visitor->trace(m_document); |
| 1440 #endif | 1440 #endif |
| 1441 } | 1441 } |
| 1442 | 1442 |
| 1443 } // namespace blink | 1443 } // namespace blink |
| OLD | NEW |