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