| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (view) { | 151 if (view) { |
| 152 m_medium = adoptPtr(new MediaQueryEvaluator(&view->frame())); | 152 m_medium = adoptPtr(new MediaQueryEvaluator(&view->frame())); |
| 153 m_printMediaType = equalIgnoringCase(view->mediaType(), MediaTypeNames::
print); | 153 m_printMediaType = equalIgnoringCase(view->mediaType(), MediaTypeNames::
print); |
| 154 } else { | 154 } else { |
| 155 m_medium = adoptPtr(new MediaQueryEvaluator("all")); | 155 m_medium = adoptPtr(new MediaQueryEvaluator("all")); |
| 156 } | 156 } |
| 157 | 157 |
| 158 initWatchedSelectorRules(CSSSelectorWatch::from(document).watchedCallbackSel
ectors()); | 158 initWatchedSelectorRules(CSSSelectorWatch::from(document).watchedCallbackSel
ectors()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void StyleResolver::initWatchedSelectorRules(const WillBeHeapVector<RefPtrWillBe
Member<StyleRule> >& watchedSelectors) | 161 void StyleResolver::initWatchedSelectorRules(const WillBeHeapVector<RefPtrWillBe
Member<StyleRule>>& watchedSelectors) |
| 162 { | 162 { |
| 163 if (!watchedSelectors.size()) | 163 if (!watchedSelectors.size()) |
| 164 return; | 164 return; |
| 165 m_watchedSelectorsRules = RuleSet::create(); | 165 m_watchedSelectorsRules = RuleSet::create(); |
| 166 for (unsigned i = 0; i < watchedSelectors.size(); ++i) | 166 for (unsigned i = 0; i < watchedSelectors.size(); ++i) |
| 167 m_watchedSelectorsRules->addStyleRule(watchedSelectors[i].get(), RuleHas
NoSpecialState); | 167 m_watchedSelectorsRules->addStyleRule(watchedSelectors[i].get(), RuleHas
NoSpecialState); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void StyleResolver::lazyAppendAuthorStyleSheets(unsigned firstNew, const WillBeH
eapVector<RefPtrWillBeMember<CSSStyleSheet> >& styleSheets) | 170 void StyleResolver::lazyAppendAuthorStyleSheets(unsigned firstNew, const WillBeH
eapVector<RefPtrWillBeMember<CSSStyleSheet>>& styleSheets) |
| 171 { | 171 { |
| 172 unsigned size = styleSheets.size(); | 172 unsigned size = styleSheets.size(); |
| 173 for (unsigned i = firstNew; i < size; ++i) | 173 for (unsigned i = firstNew; i < size; ++i) |
| 174 m_pendingStyleSheets.add(styleSheets[i].get()); | 174 m_pendingStyleSheets.add(styleSheets[i].get()); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void StyleResolver::removePendingAuthorStyleSheets(const WillBeHeapVector<RefPtr
WillBeMember<CSSStyleSheet> >& styleSheets) | 177 void StyleResolver::removePendingAuthorStyleSheets(const WillBeHeapVector<RefPtr
WillBeMember<CSSStyleSheet>>& styleSheets) |
| 178 { | 178 { |
| 179 for (unsigned i = 0; i < styleSheets.size(); ++i) | 179 for (unsigned i = 0; i < styleSheets.size(); ++i) |
| 180 m_pendingStyleSheets.remove(styleSheets[i].get()); | 180 m_pendingStyleSheets.remove(styleSheets[i].get()); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void StyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet) | 183 void StyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet) |
| 184 { | 184 { |
| 185 ASSERT(!cssSheet.disabled()); | 185 ASSERT(!cssSheet.disabled()); |
| 186 if (cssSheet.mediaQueries() && !m_medium->eval(cssSheet.mediaQueries(), &m_v
iewportDependentMediaQueryResults)) | 186 if (cssSheet.mediaQueries() && !m_medium->eval(cssSheet.mediaQueries(), &m_v
iewportDependentMediaQueryResults)) |
| 187 return; | 187 return; |
| 188 | 188 |
| 189 TreeScope* treeScope = ScopedStyleResolver::treeScopeFor(document(), &cssShe
et); | 189 TreeScope* treeScope = ScopedStyleResolver::treeScopeFor(document(), &cssShe
et); |
| 190 if (!treeScope) | 190 if (!treeScope) |
| 191 return; | 191 return; |
| 192 | 192 |
| 193 treeScope->ensureScopedStyleResolver().appendCSSStyleSheet(cssSheet, *m_medi
um); | 193 treeScope->ensureScopedStyleResolver().appendCSSStyleSheet(cssSheet, *m_medi
um); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void StyleResolver::appendPendingAuthorStyleSheets() | 196 void StyleResolver::appendPendingAuthorStyleSheets() |
| 197 { | 197 { |
| 198 for (const auto& styleSheet : m_pendingStyleSheets) | 198 for (const auto& styleSheet : m_pendingStyleSheets) |
| 199 appendCSSStyleSheet(*styleSheet); | 199 appendCSSStyleSheet(*styleSheet); |
| 200 | 200 |
| 201 m_pendingStyleSheets.clear(); | 201 m_pendingStyleSheets.clear(); |
| 202 finishAppendAuthorStyleSheets(); | 202 finishAppendAuthorStyleSheets(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void StyleResolver::appendAuthorStyleSheets(const WillBeHeapVector<RefPtrWillBeM
ember<CSSStyleSheet> >& styleSheets) | 205 void StyleResolver::appendAuthorStyleSheets(const WillBeHeapVector<RefPtrWillBeM
ember<CSSStyleSheet>>& styleSheets) |
| 206 { | 206 { |
| 207 // This handles sheets added to the end of the stylesheet list only. In othe
r cases the style resolver | 207 // This handles sheets added to the end of the stylesheet list only. In othe
r cases the style resolver |
| 208 // needs to be reconstructed. To handle insertions too the rule order number
s would need to be updated. | 208 // needs to be reconstructed. To handle insertions too the rule order number
s would need to be updated. |
| 209 for (const auto& styleSheet : styleSheets) | 209 for (const auto& styleSheet : styleSheets) |
| 210 appendCSSStyleSheet(*styleSheet); | 210 appendCSSStyleSheet(*styleSheet); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void StyleResolver::finishAppendAuthorStyleSheets() | 213 void StyleResolver::finishAppendAuthorStyleSheets() |
| 214 { | 214 { |
| 215 collectFeatures(); | 215 collectFeatures(); |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 ASSERT(animatingElement == element || !animatingElement || animatingElement-
>parentOrShadowHostElement() == element); | 980 ASSERT(animatingElement == element || !animatingElement || animatingElement-
>parentOrShadowHostElement() == element); |
| 981 | 981 |
| 982 if (!(animatingElement && animatingElement->hasAnimations()) | 982 if (!(animatingElement && animatingElement->hasAnimations()) |
| 983 && !state.style()->transitions() && !state.style()->animations()) | 983 && !state.style()->transitions() && !state.style()->animations()) |
| 984 return false; | 984 return false; |
| 985 | 985 |
| 986 state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *e
lement, *state.style(), state.parentStyle(), this)); | 986 state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *e
lement, *state.style(), state.parentStyle(), this)); |
| 987 if (!state.animationUpdate()) | 987 if (!state.animationUpdate()) |
| 988 return false; | 988 return false; |
| 989 | 989 |
| 990 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >&
activeInterpolationsForAnimations = state.animationUpdate()->activeInterpolation
sForAnimations(); | 990 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>>& a
ctiveInterpolationsForAnimations = state.animationUpdate()->activeInterpolations
ForAnimations(); |
| 991 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >&
activeInterpolationsForTransitions = state.animationUpdate()->activeInterpolatio
nsForTransitions(); | 991 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>>& a
ctiveInterpolationsForTransitions = state.animationUpdate()->activeInterpolation
sForTransitions(); |
| 992 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsFor
Animations); | 992 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsFor
Animations); |
| 993 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsFor
Transitions); | 993 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsFor
Transitions); |
| 994 | 994 |
| 995 updateFont(state); | 995 updateFont(state); |
| 996 | 996 |
| 997 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForA
nimations); | 997 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForA
nimations); |
| 998 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForT
ransitions); | 998 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForT
ransitions); |
| 999 | 999 |
| 1000 // Start loading resources used by animations. | 1000 // Start loading resources used by animations. |
| 1001 loadPendingResources(state); | 1001 loadPendingResources(state); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1013 resolvers.append(scopedResolver); | 1013 resolvers.append(scopedResolver); |
| 1014 | 1014 |
| 1015 for (size_t i = 0; i < resolvers.size(); ++i) { | 1015 for (size_t i = 0; i < resolvers.size(); ++i) { |
| 1016 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA
nimation(animationName.impl())) | 1016 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA
nimation(animationName.impl())) |
| 1017 return keyframesRule; | 1017 return keyframesRule; |
| 1018 } | 1018 } |
| 1019 return nullptr; | 1019 return nullptr; |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 template <CSSPropertyPriority priority> | 1022 template <CSSPropertyPriority priority> |
| 1023 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Wil
lBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpo
lations) | 1023 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Wil
lBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>>& activeInterpol
ations) |
| 1024 { | 1024 { |
| 1025 for (const auto& interpolationEntry : activeInterpolations) { | 1025 for (const auto& interpolationEntry : activeInterpolations) { |
| 1026 CSSPropertyID property = interpolationEntry.key; | 1026 CSSPropertyID property = interpolationEntry.key; |
| 1027 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) | 1027 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) |
| 1028 continue; | 1028 continue; |
| 1029 const StyleInterpolation* interpolation = toStyleInterpolation(interpola
tionEntry.value.get()); | 1029 const StyleInterpolation* interpolation = toStyleInterpolation(interpola
tionEntry.value.get()); |
| 1030 interpolation->apply(state); | 1030 interpolation->apply(state); |
| 1031 } | 1031 } |
| 1032 } | 1032 } |
| 1033 | 1033 |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 visitor->trace(m_uncommonAttributeRuleSet); | 1515 visitor->trace(m_uncommonAttributeRuleSet); |
| 1516 visitor->trace(m_watchedSelectorsRules); | 1516 visitor->trace(m_watchedSelectorsRules); |
| 1517 visitor->trace(m_treeBoundaryCrossingRules); | 1517 visitor->trace(m_treeBoundaryCrossingRules); |
| 1518 visitor->trace(m_styleSharingLists); | 1518 visitor->trace(m_styleSharingLists); |
| 1519 visitor->trace(m_pendingStyleSheets); | 1519 visitor->trace(m_pendingStyleSheets); |
| 1520 visitor->trace(m_document); | 1520 visitor->trace(m_document); |
| 1521 #endif | 1521 #endif |
| 1522 } | 1522 } |
| 1523 | 1523 |
| 1524 } // namespace blink | 1524 } // namespace blink |
| OLD | NEW |