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 26 matching lines...) Expand all Loading... | |
37 #include "core/animation/ElementAnimations.h" | 37 #include "core/animation/ElementAnimations.h" |
38 #include "core/animation/InvalidatableStyleInterpolation.h" | 38 #include "core/animation/InvalidatableStyleInterpolation.h" |
39 #include "core/animation/KeyframeEffect.h" | 39 #include "core/animation/KeyframeEffect.h" |
40 #include "core/animation/StyleInterpolation.h" | 40 #include "core/animation/StyleInterpolation.h" |
41 #include "core/animation/animatable/AnimatableValue.h" | 41 #include "core/animation/animatable/AnimatableValue.h" |
42 #include "core/animation/css/CSSAnimatableValueFactory.h" | 42 #include "core/animation/css/CSSAnimatableValueFactory.h" |
43 #include "core/animation/css/CSSAnimations.h" | 43 #include "core/animation/css/CSSAnimations.h" |
44 #include "core/css/CSSCalculationValue.h" | 44 #include "core/css/CSSCalculationValue.h" |
45 #include "core/css/CSSDefaultStyleSheets.h" | 45 #include "core/css/CSSDefaultStyleSheets.h" |
46 #include "core/css/CSSFontSelector.h" | 46 #include "core/css/CSSFontSelector.h" |
47 #include "core/css/CSSImportRule.h" | |
47 #include "core/css/CSSKeyframeRule.h" | 48 #include "core/css/CSSKeyframeRule.h" |
48 #include "core/css/CSSKeyframesRule.h" | 49 #include "core/css/CSSKeyframesRule.h" |
49 #include "core/css/CSSReflectValue.h" | 50 #include "core/css/CSSReflectValue.h" |
50 #include "core/css/CSSRuleList.h" | 51 #include "core/css/CSSRuleList.h" |
51 #include "core/css/CSSSelector.h" | 52 #include "core/css/CSSSelector.h" |
52 #include "core/css/CSSStyleRule.h" | 53 #include "core/css/CSSStyleRule.h" |
53 #include "core/css/CSSValueList.h" | 54 #include "core/css/CSSValueList.h" |
54 #include "core/css/CSSValuePool.h" | 55 #include "core/css/CSSValuePool.h" |
55 #include "core/css/ElementRuleCollector.h" | 56 #include "core/css/ElementRuleCollector.h" |
56 #include "core/css/FontFace.h" | 57 #include "core/css/FontFace.h" |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
873 collector.setMode(SelectorChecker::CollectingCSSRules); | 874 collector.setMode(SelectorChecker::CollectingCSSRules); |
874 collectPseudoRulesForElement(element, collector, pseudoId, rulesToInclude); | 875 collectPseudoRulesForElement(element, collector, pseudoId, rulesToInclude); |
875 return collector.matchedCSSRuleList(); | 876 return collector.matchedCSSRuleList(); |
876 } | 877 } |
877 | 878 |
878 PassRefPtrWillBeRawPtr<CSSRuleList> StyleResolver::cssRulesForElement(Element* e lement, unsigned rulesToInclude) | 879 PassRefPtrWillBeRawPtr<CSSRuleList> StyleResolver::cssRulesForElement(Element* e lement, unsigned rulesToInclude) |
879 { | 880 { |
880 return pseudoCSSRulesForElement(element, NOPSEUDO, rulesToInclude); | 881 return pseudoCSSRulesForElement(element, NOPSEUDO, rulesToInclude); |
881 } | 882 } |
882 | 883 |
884 PassRefPtrWillBeRawPtr<CSSRuleList> StyleResolver::keyframesRulesForElement(Elem ent* element) | |
885 { | |
886 ASSERT(element); | |
887 RefPtrWillBeRawPtr<StaticCSSRuleList> ruleList = StaticCSSRuleList::create() ; | |
888 | |
889 // TODO(samli): Repeat for all pseudo elements. | |
890 RefPtr<ComputedStyle> style = styleForElement(element); | |
891 if (!style) | |
892 return ruleList; | |
893 const CSSAnimationData* animationData = style->animations(); | |
894 for (size_t i = 0; animationData && i < animationData->nameList().size(); ++ i) { | |
895 AtomicString animationName(animationData->nameList()[i]); | |
896 if (animationName == CSSAnimationData::initialName()) | |
897 continue; | |
898 RefPtrWillBeRawPtr<CSSKeyframesRule> keyframesRule = findCSSKeyframesRul e(element, animationName); | |
899 if (!keyframesRule) | |
900 continue; | |
901 ruleList->rules().append(keyframesRule); | |
902 } | |
903 return ruleList; | |
904 } | |
905 | |
883 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo llector& collector, PseudoId pseudoId, unsigned rulesToInclude) | 906 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo llector& collector, PseudoId pseudoId, unsigned rulesToInclude) |
884 { | 907 { |
885 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); | 908 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); |
886 | 909 |
887 if (rulesToInclude & UAAndUserCSSRules) | 910 if (rulesToInclude & UAAndUserCSSRules) |
888 matchUARules(collector); | 911 matchUARules(collector); |
889 | 912 |
890 if (rulesToInclude & AuthorCSSRules) { | 913 if (rulesToInclude & AuthorCSSRules) { |
891 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); | 914 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); |
892 matchAuthorRules(element, collector, rulesToInclude & EmptyCSSRules); | 915 matchAuthorRules(element, collector, rulesToInclude & EmptyCSSRules); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
946 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe solver()) | 969 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe solver()) |
947 resolvers.append(scopedResolver); | 970 resolvers.append(scopedResolver); |
948 | 971 |
949 for (size_t i = 0; i < resolvers.size(); ++i) { | 972 for (size_t i = 0; i < resolvers.size(); ++i) { |
950 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA nimation(animationName.impl())) | 973 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA nimation(animationName.impl())) |
951 return keyframesRule; | 974 return keyframesRule; |
952 } | 975 } |
953 return nullptr; | 976 return nullptr; |
954 } | 977 } |
955 | 978 |
979 PassRefPtrWillBeRawPtr<CSSKeyframesRule> StyleResolver::findCSSKeyframesRule(con st Element* element, const AtomicString& animationName) | |
980 { | |
981 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; | |
982 collectScopedResolversForHostedShadowTrees(element, resolvers); | |
983 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe solver()) | |
984 resolvers.append(scopedResolver); | |
985 | |
986 for (size_t i = 0; i < resolvers.size(); ++i) { | |
987 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA nimation(animationName.impl())) { | |
988 CSSStyleSheet* styleSheet = resolvers[i]->styleSheetForAnimation(ani mationName.impl()); | |
989 if (!styleSheet) | |
990 continue; | |
991 return CSSKeyframesRule::create(keyframesRule, styleSheet); | |
alancutter (OOO until 2018)
2015/10/27 23:57:30
I'm not happy with how stylesheets are associated
| |
992 } | |
993 } | |
994 return nullptr; | |
995 } | |
996 | |
956 template <CSSPropertyPriority priority> | 997 template <CSSPropertyPriority priority> |
957 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Act iveInterpolationsMap& activeInterpolationsMap) | 998 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Act iveInterpolationsMap& activeInterpolationsMap) |
958 { | 999 { |
959 for (const auto& interpolationsVectorEntry : activeInterpolationsMap) { | 1000 for (const auto& interpolationsVectorEntry : activeInterpolationsMap) { |
960 if (!interpolationsVectorEntry.key.isCSSProperty()) | 1001 if (!interpolationsVectorEntry.key.isCSSProperty()) |
961 continue; | 1002 continue; |
962 CSSPropertyID property = interpolationsVectorEntry.key.cssProperty(); | 1003 CSSPropertyID property = interpolationsVectorEntry.key.cssProperty(); |
963 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) | 1004 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) |
964 continue; | 1005 continue; |
965 const Interpolation& interpolation = *interpolationsVectorEntry.value.fi rst(); | 1006 const Interpolation& interpolation = *interpolationsVectorEntry.value.fi rst(); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1487 visitor->trace(m_watchedSelectorsRules); | 1528 visitor->trace(m_watchedSelectorsRules); |
1488 visitor->trace(m_treeBoundaryCrossingRules); | 1529 visitor->trace(m_treeBoundaryCrossingRules); |
1489 visitor->trace(m_styleResourceLoader); | 1530 visitor->trace(m_styleResourceLoader); |
1490 visitor->trace(m_styleSharingLists); | 1531 visitor->trace(m_styleSharingLists); |
1491 visitor->trace(m_pendingStyleSheets); | 1532 visitor->trace(m_pendingStyleSheets); |
1492 visitor->trace(m_document); | 1533 visitor->trace(m_document); |
1493 #endif | 1534 #endif |
1494 } | 1535 } |
1495 | 1536 |
1496 } // namespace blink | 1537 } // namespace blink |
OLD | NEW |