| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().
matchedProperties.size() - 1; | 337 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().
matchedProperties.size() - 1; |
| 338 | 338 |
| 339 bool applyAuthorStyles = applyAuthorStylesOf(element); | 339 bool applyAuthorStyles = applyAuthorStylesOf(element); |
| 340 if (document().styleEngine()->hasOnlyScopedResolverForDocument()) { | 340 if (document().styleEngine()->hasOnlyScopedResolverForDocument()) { |
| 341 document().scopedStyleResolver()->collectMatchingAuthorRules(collector,
includeEmptyRules, applyAuthorStyles, ignoreCascadeScope); | 341 document().scopedStyleResolver()->collectMatchingAuthorRules(collector,
includeEmptyRules, applyAuthorStyles, ignoreCascadeScope); |
| 342 collector.sortAndTransferMatchedRules(); | 342 collector.sortAndTransferMatchedRules(); |
| 343 return; | 343 return; |
| 344 } | 344 } |
| 345 | 345 |
| 346 Vector<RawPtr<ScopedStyleResolver>, 8> resolvers; | 346 Vector<RawPtr<ScopedStyleResolver>, 8> resolvers; |
| 347 resolveScopedStyles(element, resolvers); | 347 if (ScopedStyleResolver* resolver = element->treeScope().scopedStyleResolver
()) |
| 348 resolvers.append(resolver); |
| 348 | 349 |
| 349 Vector<RawPtr<ScopedStyleResolver>, 8> resolversInShadowTree; | 350 Vector<RawPtr<ScopedStyleResolver>, 8> resolversInShadowTree; |
| 350 collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree); | 351 collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree); |
| 351 if (!resolversInShadowTree.isEmpty()) { | 352 if (!resolversInShadowTree.isEmpty()) { |
| 352 matchAuthorRulesForShadowHost(element, collector, includeEmptyRules, res
olvers, resolversInShadowTree); | 353 matchAuthorRulesForShadowHost(element, collector, includeEmptyRules, res
olvers, resolversInShadowTree); |
| 353 return; | 354 return; |
| 354 } | 355 } |
| 355 | 356 |
| 356 if (resolvers.isEmpty()) | 357 if (resolvers.isEmpty()) |
| 357 return; | 358 return; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rTransitions); | 654 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rTransitions); |
| 654 | 655 |
| 655 // Start loading resources used by animations. | 656 // Start loading resources used by animations. |
| 656 loadPendingResources(state); | 657 loadPendingResources(state); |
| 657 | 658 |
| 658 ASSERT(!state.fontBuilder().fontDirty()); | 659 ASSERT(!state.fontBuilder().fontDirty()); |
| 659 | 660 |
| 660 return true; | 661 return true; |
| 661 } | 662 } |
| 662 | 663 |
| 663 static inline ScopedStyleResolver* scopedResolverFor(const Element* element) | |
| 664 { | |
| 665 for (TreeScope* treeScope = &element->treeScope(); treeScope; treeScope = tr
eeScope->parentTreeScope()) { | |
| 666 if (ScopedStyleResolver* scopedStyleResolver = treeScope->scopedStyleRes
olver()) | |
| 667 return scopedStyleResolver; | |
| 668 } | |
| 669 return 0; | |
| 670 } | |
| 671 | |
| 672 void StyleResolver::resolveScopedStyles(const Element* element, Vector<RawPtr<Sc
opedStyleResolver>, 8>& resolvers) | |
| 673 { | |
| 674 for (ScopedStyleResolver* scopedResolver = scopedResolverFor(element); scope
dResolver; scopedResolver = scopedResolver->parent()) | |
| 675 resolvers.append(scopedResolver); | |
| 676 } | |
| 677 | |
| 678 void StyleResolver::collectScopedResolversForHostedShadowTrees(const Element* el
ement, Vector<RawPtr<ScopedStyleResolver>, 8>& resolvers) | 664 void StyleResolver::collectScopedResolversForHostedShadowTrees(const Element* el
ement, Vector<RawPtr<ScopedStyleResolver>, 8>& resolvers) |
| 679 { | 665 { |
| 680 ElementShadow* shadow = element->shadow(); | 666 ElementShadow* shadow = element->shadow(); |
| 681 if (!shadow) | 667 if (!shadow) |
| 682 return; | 668 return; |
| 683 | 669 |
| 684 // Adding scoped resolver for active shadow roots for shadow host styling. | 670 // Adding scoped resolver for active shadow roots for shadow host styling. |
| 685 if (ShadowRoot* shadowRoot = shadow->shadowRoot()) { | 671 if (ShadowRoot* shadowRoot = shadow->shadowRoot()) { |
| 686 if (shadowRoot->numberOfStyles() > 0) { | 672 if (shadowRoot->numberOfStyles() > 0) { |
| 687 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver(
)) | 673 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver(
)) |
| 688 resolvers.append(resolver); | 674 resolvers.append(resolver); |
| 689 } | 675 } |
| 690 } | 676 } |
| 691 } | 677 } |
| 692 | 678 |
| 693 void StyleResolver::styleTreeResolveScopedKeyframesRules(const Element* element,
Vector<RawPtr<ScopedStyleResolver>, 8>& resolvers) | 679 void StyleResolver::styleTreeResolveScopedKeyframesRules(const Element* element,
Vector<RawPtr<ScopedStyleResolver>, 8>& resolvers) |
| 694 { | 680 { |
| 695 Document& document = element->document(); | |
| 696 TreeScope& treeScope = element->treeScope(); | |
| 697 bool applyAuthorStyles = treeScope.applyAuthorStyles(); | |
| 698 | |
| 699 // Add resolvers for shadow roots hosted by the given element. | 681 // Add resolvers for shadow roots hosted by the given element. |
| 700 collectScopedResolversForHostedShadowTrees(element, resolvers); | 682 collectScopedResolversForHostedShadowTrees(element, resolvers); |
| 701 | 683 |
| 702 // Add resolvers while walking up DOM tree from the given element. | 684 // Add resolvers while walking up DOM tree from the given element. |
| 703 for (ScopedStyleResolver* scopedResolver = scopedResolverFor(element); scope
dResolver; scopedResolver = scopedResolver->parent()) { | 685 if (ScopedStyleResolver* resolver = element->treeScope().scopedStyleResolver
()) |
| 704 if (scopedResolver->treeScope() == treeScope || (applyAuthorStyles && sc
opedResolver->treeScope() == document)) | 686 resolvers.append(resolver); |
| 705 resolvers.append(scopedResolver); | |
| 706 } | |
| 707 } | 687 } |
| 708 | 688 |
| 709 template <StyleResolver::StyleApplicationPass pass> | 689 template <StyleResolver::StyleApplicationPass pass> |
| 710 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Has
hMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolations) | 690 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Has
hMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolations) |
| 711 { | 691 { |
| 712 for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = a
ctiveInterpolations.begin(); iter != activeInterpolations.end(); ++iter) { | 692 for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = a
ctiveInterpolations.begin(); iter != activeInterpolations.end(); ++iter) { |
| 713 CSSPropertyID property = iter->key; | 693 CSSPropertyID property = iter->key; |
| 714 if (!isPropertyForPass<pass>(property)) | 694 if (!isPropertyForPass<pass>(property)) |
| 715 continue; | 695 continue; |
| 716 const StyleInterpolation* interpolation = toStyleInterpolation(iter->val
ue.get()); | 696 const StyleInterpolation* interpolation = toStyleInterpolation(iter->val
ue.get()); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 bool StyleResolver::mediaQueryAffectedByViewportChange() const | 975 bool StyleResolver::mediaQueryAffectedByViewportChange() const |
| 996 { | 976 { |
| 997 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { | 977 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { |
| 998 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression()
) != m_viewportDependentMediaQueryResults[i]->result()) | 978 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression()
) != m_viewportDependentMediaQueryResults[i]->result()) |
| 999 return true; | 979 return true; |
| 1000 } | 980 } |
| 1001 return false; | 981 return false; |
| 1002 } | 982 } |
| 1003 | 983 |
| 1004 } // namespace blink | 984 } // namespace blink |
| OLD | NEW |