Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 21012002: Web Animations: Trigger and update CSS Animations backed by the Web Animations model (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix windows build. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 18 matching lines...) Expand all
29 #include "config.h" 29 #include "config.h"
30 #include "core/css/resolver/StyleResolver.h" 30 #include "core/css/resolver/StyleResolver.h"
31 31
32 #include "CSSPropertyNames.h" 32 #include "CSSPropertyNames.h"
33 #include "HTMLNames.h" 33 #include "HTMLNames.h"
34 #include "RuntimeEnabledFeatures.h" 34 #include "RuntimeEnabledFeatures.h"
35 #include "StylePropertyShorthand.h" 35 #include "StylePropertyShorthand.h"
36 #include "core/animation/AnimatableValue.h" 36 #include "core/animation/AnimatableValue.h"
37 #include "core/animation/Animation.h" 37 #include "core/animation/Animation.h"
38 #include "core/animation/DocumentTimeline.h" 38 #include "core/animation/DocumentTimeline.h"
39 #include "core/animation/css/CSSAnimations.h"
39 #include "core/css/CSSCalculationValue.h" 40 #include "core/css/CSSCalculationValue.h"
40 #include "core/css/CSSDefaultStyleSheets.h" 41 #include "core/css/CSSDefaultStyleSheets.h"
41 #include "core/css/CSSFontSelector.h" 42 #include "core/css/CSSFontSelector.h"
42 #include "core/css/CSSKeyframeRule.h" 43 #include "core/css/CSSKeyframeRule.h"
43 #include "core/css/CSSKeyframesRule.h" 44 #include "core/css/CSSKeyframesRule.h"
44 #include "core/css/CSSParser.h" 45 #include "core/css/CSSParser.h"
45 #include "core/css/CSSReflectValue.h" 46 #include "core/css/CSSReflectValue.h"
46 #include "core/css/CSSRuleList.h" 47 #include "core/css/CSSRuleList.h"
47 #include "core/css/CSSSelector.h" 48 #include "core/css/CSSSelector.h"
48 #include "core/css/CSSStyleRule.h" 49 #include "core/css/CSSStyleRule.h"
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 // FIXME: Shouldn't this be on RenderBody::styleDidChange? 617 // FIXME: Shouldn't this be on RenderBody::styleDidChange?
617 if (element->hasTagName(bodyTag)) 618 if (element->hasTagName(bodyTag))
618 document()->textLinkColors().setTextColor(state.style()->visitedDependen tColor(CSSPropertyColor)); 619 document()->textLinkColors().setTextColor(state.style()->visitedDependen tColor(CSSPropertyColor));
619 620
620 // Now return the style. 621 // Now return the style.
621 return state.takeStyle(); 622 return state.takeStyle();
622 } 623 }
623 624
624 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* e, const Render Style* elementStyle, const StyleKeyframe* keyframe, KeyframeValue& keyframeValue ) 625 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* e, const Render Style* elementStyle, const StyleKeyframe* keyframe, KeyframeValue& keyframeValue )
625 { 626 {
627 ASSERT(!RuntimeEnabledFeatures::webAnimationsCSSEnabled());
626 ASSERT(document()->frame()); 628 ASSERT(document()->frame());
627 ASSERT(documentSettings()); 629 ASSERT(documentSettings());
628 630
629 if (e == document()->documentElement()) 631 if (e == document()->documentElement())
630 resetDirectionAndWritingModeOnDocument(document()); 632 resetDirectionAndWritingModeOnDocument(document());
631 StyleResolverState state(document(), e); 633 StyleResolverState state(document(), e);
632 634
633 MatchResult result; 635 MatchResult result;
634 if (keyframe->properties()) 636 if (keyframe->properties())
635 result.addMatchedProperties(keyframe->properties()); 637 result.addMatchedProperties(keyframe->properties());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 if (property != CSSPropertyWebkitAnimationTimingFunction) 681 if (property != CSSPropertyWebkitAnimationTimingFunction)
680 keyframeValue.addProperty(property); 682 keyframeValue.addProperty(property);
681 } 683 }
682 } 684 }
683 685
684 document()->didAccessStyleResolver(); 686 document()->didAccessStyleResolver();
685 687
686 return state.takeStyle(); 688 return state.takeStyle();
687 } 689 }
688 690
689 const StyleRuleKeyframes* StyleResolver::matchScopedKeyframesRule(Element* e, co nst StringImpl* animationName) 691 const StyleRuleKeyframes* StyleResolver::matchScopedKeyframesRule(const Element* e, const StringImpl* animationName)
690 { 692 {
691 if (m_styleTree.hasOnlyScopedResolverForDocument()) 693 if (m_styleTree.hasOnlyScopedResolverForDocument())
692 return m_styleTree.scopedStyleResolverForDocument()->keyframeStylesForAn imation(animationName); 694 return m_styleTree.scopedStyleResolverForDocument()->keyframeStylesForAn imation(animationName);
693 695
694 Vector<ScopedStyleResolver*, 8> stack; 696 Vector<ScopedStyleResolver*, 8> stack;
695 m_styleTree.resolveScopedKeyframesRules(e, stack); 697 m_styleTree.resolveScopedKeyframesRules(e, stack);
696 if (stack.isEmpty()) 698 if (stack.isEmpty())
697 return 0; 699 return 0;
698 700
699 for (size_t i = 0; i < stack.size(); ++i) { 701 for (size_t i = 0; i < stack.size(); ++i) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 if (!hundredPercentKeyframe) { 754 if (!hundredPercentKeyframe) {
753 hundredPercentKeyframe = StyleKeyframe::create().leakRef(); 755 hundredPercentKeyframe = StyleKeyframe::create().leakRef();
754 hundredPercentKeyframe->setKeyText("100%"); 756 hundredPercentKeyframe->setKeyText("100%");
755 } 757 }
756 KeyframeValue keyframeValue(1, 0); 758 KeyframeValue keyframeValue(1, 0);
757 keyframeValue.setStyle(styleForKeyframe(e, elementStyle, hundredPercentK eyframe, keyframeValue)); 759 keyframeValue.setStyle(styleForKeyframe(e, elementStyle, hundredPercentK eyframe, keyframeValue));
758 list.insert(keyframeValue); 760 list.insert(keyframeValue);
759 } 761 }
760 } 762 }
761 763
764 void StyleResolver::resolveKeyframes(Element* element, const StringImpl* name, K eyframeAnimationEffect::KeyframeVector& keyframes)
765 {
Steve Block 2013/08/06 03:57:01 Can we add an ASSERT to make clear that this is us
dstockwell 2013/08/06 05:43:25 Done.
766 const StyleRuleKeyframes* keyframesRule = matchScopedKeyframesRule(element, name);
767 if (!keyframesRule)
768 return;
769
770 // Construct and populate the style for each keyframe
771 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes();
772 for (unsigned i = 0; i < styleKeyframes.size(); ++i) {
773 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get();
774
775 Vector<float> offsets;
776 styleKeyframe->getKeys(offsets);
777 for (size_t j = 0; j < offsets.size(); ++j) {
778 RefPtr<Keyframe> keyframe = Keyframe::create();
779 keyframe->setOffset(offsets[j]);
Steve Block 2013/08/06 03:57:01 It looks like we don't handle multiple keyframes a
dstockwell 2013/08/06 05:43:25 I was addressing this in: https://codereview.chrom
780 const StylePropertySet* properties = styleKeyframe->properties();
781 // FIXME: AnimatableValues should be shared between the keyframes at different offsets.
782 for (unsigned k = 0; k < properties->propertyCount(); k++) {
783 CSSPropertyID property = properties->propertyAt(k).id();
784 // FIXME: CSSValue needs to be resolved.
785 keyframe->setPropertyValue(property, AnimatableValue::create(pro perties->getPropertyCSSValue(property).get()).get());
786 }
787 keyframes.append(keyframe);
788 }
789 }
790
791 // FIXME: If the 0% keyframe is missing, create it (but only if there is at least one other keyframe)
792 // FIXME: If the 100% keyframe is missing, create it (but only if there is a t least one other keyframe)
793 }
794
795 const StylePropertySet* StyleResolver::firstKeyframeStyles(const Element* elemen t, const StringImpl* animationName)
796 {
Steve Block 2013/08/06 03:57:01 Can we add an ASSERT to make clear that this is us
dstockwell 2013/08/06 05:43:25 Done.
797 const StyleRuleKeyframes* keyframesRule = matchScopedKeyframesRule(element, animationName);
798 if (!keyframesRule)
799 return 0;
800
801 // Find the last keyframe at offset 0
802 const StyleKeyframe* firstKeyframe = 0;
803 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes();
804 for (unsigned i = 0; i < styleKeyframes.size(); ++i) {
805 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get();
806
807 Vector<float> offsets;
808 styleKeyframe->getKeys(offsets);
809 for (size_t j = 0; j < offsets.size(); ++j) {
810 if (!offsets[j]) {
811 firstKeyframe = styleKeyframe;
812 break;
813 }
814 }
815 }
816
817 return firstKeyframe ? firstKeyframe->properties() : 0;
818 }
819
820
762 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) 821 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
763 { 822 {
764 ASSERT(document()->frame()); 823 ASSERT(document()->frame());
765 ASSERT(documentSettings()); 824 ASSERT(documentSettings());
766 ASSERT(parentStyle); 825 ASSERT(parentStyle);
767 if (!e) 826 if (!e)
768 return 0; 827 return 0;
769 828
770 if (e == document()->documentElement()) 829 if (e == document()->documentElement())
771 resetDirectionAndWritingModeOnDocument(document()); 830 resetDirectionAndWritingModeOnDocument(document());
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 matchAuthorRules(state.element(), collector, rulesToInclude & EmptyCSSRu les); 1028 matchAuthorRules(state.element(), collector, rulesToInclude & EmptyCSSRu les);
970 } 1029 }
971 1030
972 return collector.matchedRuleList(); 1031 return collector.matchedRuleList();
973 } 1032 }
974 1033
975 // ----------------------------------------------------------------------------- -------- 1034 // ----------------------------------------------------------------------------- --------
976 // this is mostly boring stuff on how to apply a certain rule to the renderstyle ... 1035 // this is mostly boring stuff on how to apply a certain rule to the renderstyle ...
977 1036
978 template <StyleResolver::StyleApplicationPass pass> 1037 template <StyleResolver::StyleApplicationPass pass>
979 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele ment* target, const DocumentTimeline* timeline) 1038 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele ment* target, const DocumentTimeline* timeline, const CSSAnimationUpdate* update )
980 { 1039 {
Steve Block 2013/08/06 03:57:01 Can we add an ASSERT to make clear that this is us
dstockwell 2013/08/06 05:43:25 Done.
981 ASSERT(pass != VariableDefinitions); 1040 ASSERT(pass != VariableDefinitions);
982 ASSERT(pass != AnimationProperties); 1041 ASSERT(pass != AnimationProperties);
1042 if (update && update->styles()) {
1043 bool applyInheritedOnly = false;
1044 bool isImportant = false;
1045 StyleRule* rule = 0;
1046 applyProperties<pass>(state, update->styles(), rule, isImportant, applyI nheritedOnly, PropertyWhitelistNone);
1047 isImportant = true;
1048 applyProperties<pass>(state, update->styles(), rule, isImportant, applyI nheritedOnly, PropertyWhitelistNone);
1049 }
983 AnimationStack* animationStack = timeline->animationStack(target); 1050 AnimationStack* animationStack = timeline->animationStack(target);
984 if (!animationStack) 1051 if (!animationStack)
985 return; 1052 return;
986 const Vector<Animation*>& animations = animationStack->activeAnimations(targ et); 1053 const Vector<Animation*>& animations = animationStack->activeAnimations(targ et);
987 1054
988 for (size_t i = 0; i < animations.size(); ++i) { 1055 for (size_t i = 0; i < animations.size(); ++i) {
989 RefPtr<Animation> animation = animations.at(i); 1056 RefPtr<Animation> animation = animations.at(i);
1057 if (update && update->isFiltered(animation->player()))
1058 continue;
990 const AnimationEffect::CompositableValueMap* compositableValues = animat ion->compositableValues(); 1059 const AnimationEffect::CompositableValueMap* compositableValues = animat ion->compositableValues();
991 for (AnimationEffect::CompositableValueMap::const_iterator iter = compos itableValues->begin(); iter != compositableValues->end(); ++iter) { 1060 for (AnimationEffect::CompositableValueMap::const_iterator iter = compos itableValues->begin(); iter != compositableValues->end(); ++iter) {
992 CSSPropertyID property = iter->key; 1061 CSSPropertyID property = iter->key;
993 if (!isPropertyForPass<pass>(property)) 1062 if (!isPropertyForPass<pass>(property))
994 continue; 1063 continue;
995 RefPtr<AnimatableValue> animatableValue = iter->value->compositeOnto (AnimatableValue::neutralValue()); 1064 RefPtr<AnimatableValue> animatableValue = iter->value->compositeOnto (AnimatableValue::neutralValue());
996 if (animatableValue->isDeferredSnapshot()) 1065 if (animatableValue->isDeferredSnapshot())
997 continue; 1066 continue;
998 RefPtr<CSSValue> cssValue = animatableValue->toCSSValue(); 1067 RefPtr<CSSValue> cssValue = animatableValue->toCSSValue();
999 if (pass == HighPriorityProperties && property == CSSPropertyLineHei ght) 1068 if (pass == HighPriorityProperties && property == CSSPropertyLineHei ght)
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 static unsigned computeMatchedPropertiesHash(const MatchedProperties* properties , unsigned size) 1250 static unsigned computeMatchedPropertiesHash(const MatchedProperties* properties , unsigned size)
1182 { 1251 {
1183 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size ); 1252 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size );
1184 } 1253 }
1185 1254
1186 void StyleResolver::invalidateMatchedPropertiesCache() 1255 void StyleResolver::invalidateMatchedPropertiesCache()
1187 { 1256 {
1188 m_matchedPropertiesCache.clear(); 1257 m_matchedPropertiesCache.clear();
1189 } 1258 }
1190 1259
1260 PassOwnPtr<CSSAnimationUpdate> StyleResolver::calculateCSSAnimationUpdate(StyleR esolverState& state)
1261 {
1262 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
1263 return nullptr;
1264
1265 const Element* element = state.element();
1266 ASSERT(element);
1267
1268 if (!CSSAnimations::needsUpdate(element, state.style()))
1269 return nullptr;
1270
1271 ActiveAnimations* activeAnimations = element->activeAnimations();
1272 const CSSAnimationDataList* animations = state.style()->animations();
1273 const CSSAnimations* cssAnimations = activeAnimations ? activeAnimations->cs sAnimations() : 0;
1274 EDisplay display = state.style()->display();
1275 return CSSAnimations::calculateUpdate(element, display, cssAnimations, anima tions, this);
1276 }
1277
1191 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc hResult& matchResult) 1278 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc hResult& matchResult)
1192 { 1279 {
1193 const Element* element = state.element(); 1280 const Element* element = state.element();
1194 ASSERT(element); 1281 ASSERT(element);
1195 STYLE_STATS_ADD_MATCHED_PROPERTIES_SEARCH(); 1282 STYLE_STATS_ADD_MATCHED_PROPERTIES_SEARCH();
1196 1283
1197 unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash( matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0; 1284 unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash( matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0;
1198 bool applyInheritedOnly = false; 1285 bool applyInheritedOnly = false;
1199 const CachedMatchedProperties* cachedMatchedProperties = 0; 1286 const CachedMatchedProperties* cachedMatchedProperties = 0;
1200 1287
(...skipping 23 matching lines...) Expand all
1224 applyMatchedProperties<VariableDefinitions>(state, matchResult, false, 0, ma tchResult.matchedProperties.size() - 1, applyInheritedOnly); 1311 applyMatchedProperties<VariableDefinitions>(state, matchResult, false, 0, ma tchResult.matchedProperties.size() - 1, applyInheritedOnly);
1225 applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchR esult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedO nly); 1312 applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchR esult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedO nly);
1226 applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchR esult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly) ; 1313 applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchR esult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly) ;
1227 applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchR esult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); 1314 applyMatchedProperties<VariableDefinitions>(state, matchResult, true, matchR esult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
1228 1315
1229 // Apply animation properties in order to apply animation results and trigge r transitions below. 1316 // Apply animation properties in order to apply animation results and trigge r transitions below.
1230 applyMatchedProperties<AnimationProperties>(state, matchResult, false, 0, ma tchResult.matchedProperties.size() - 1, applyInheritedOnly); 1317 applyMatchedProperties<AnimationProperties>(state, matchResult, false, 0, ma tchResult.matchedProperties.size() - 1, applyInheritedOnly);
1231 applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchR esult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedO nly); 1318 applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchR esult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedO nly);
1232 applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchR esult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly) ; 1319 applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchR esult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly) ;
1233 applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchR esult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); 1320 applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchR esult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
1234 // FIXME: animations should be triggered here 1321
1322 OwnPtr<CSSAnimationUpdate> cssAnimationUpdate = calculateCSSAnimationUpdate( state);
1235 1323
1236 // Now we have all of the matched rules in the appropriate order. Walk the r ules and apply 1324 // Now we have all of the matched rules in the appropriate order. Walk the r ules and apply
1237 // high-priority properties first, i.e., those properties that other propert ies depend on. 1325 // high-priority properties first, i.e., those properties that other propert ies depend on.
1238 // The order is (1) high-priority not important, (2) high-priority important , (3) normal not important 1326 // The order is (1) high-priority not important, (2) high-priority important , (3) normal not important
1239 // and (4) normal important. 1327 // and (4) normal important.
1240 state.setLineHeightValue(0); 1328 state.setLineHeightValue(0);
1241 applyMatchedProperties<HighPriorityProperties>(state, matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly); 1329 applyMatchedProperties<HighPriorityProperties>(state, matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
1242 // Animation contributions are processed here because CSS Animations are ove rridable by user !important rules. 1330 // Animation contributions are processed here because CSS Animations are ove rridable by user !important rules.
1243 if (RuntimeEnabledFeatures::webAnimationsEnabled()) 1331 if (RuntimeEnabledFeatures::webAnimationsEnabled() && !applyInheritedOnly)
1244 applyAnimatedProperties<HighPriorityProperties>(state, element, element- >document()->timeline()); 1332 applyAnimatedProperties<HighPriorityProperties>(state, element, element- >document()->timeline(), cssAnimationUpdate.get());
1245 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat chResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherit edOnly); 1333 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat chResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherit edOnly);
1246 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat chResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOn ly); 1334 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat chResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOn ly);
1247 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat chResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); 1335 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat chResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
1248 1336
1249 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->effecti veZoom() != state.style()->effectiveZoom()) { 1337 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->effecti veZoom() != state.style()->effectiveZoom()) {
1250 state.fontBuilder().setFontDirty(true); 1338 state.fontBuilder().setFontDirty(true);
1251 applyInheritedOnly = false; 1339 applyInheritedOnly = false;
1252 } 1340 }
1253 1341
1254 // If our font got dirtied, go ahead and update it now. 1342 // If our font got dirtied, go ahead and update it now.
1255 updateFont(state); 1343 updateFont(state);
1256 1344
1257 // Line-height is set when we are sure we decided on the font-size. 1345 // Line-height is set when we are sure we decided on the font-size.
1258 if (state.lineHeightValue()) 1346 if (state.lineHeightValue())
1259 applyProperty(state, CSSPropertyLineHeight, state.lineHeightValue()); 1347 applyProperty(state, CSSPropertyLineHeight, state.lineHeightValue());
1260 1348
1261 // Many properties depend on the font. If it changes we just apply all prope rties. 1349 // Many properties depend on the font. If it changes we just apply all prope rties.
1262 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDes cription() != state.style()->fontDescription()) 1350 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDes cription() != state.style()->fontDescription())
1263 applyInheritedOnly = false; 1351 applyInheritedOnly = false;
1264 1352
1265 // Now do the normal priority UA properties. 1353 // Now do the normal priority UA properties.
1266 applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, mat chResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); 1354 applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, mat chResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
1267 1355
1268 // Cache the UA properties to pass them to RenderTheme in adjustRenderStyle. 1356 // Cache the UA properties to pass them to RenderTheme in adjustRenderStyle.
1269 state.cacheUserAgentBorderAndBackground(); 1357 state.cacheUserAgentBorderAndBackground();
1270 1358
1271 // Now do the author and user normal priority properties and all the !import ant properties. 1359 // Now do the author and user normal priority properties and all the !import ant properties.
1272 applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, mat chResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyI nheritedOnly); 1360 applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, mat chResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyI nheritedOnly);
1273 if (RuntimeEnabledFeatures::webAnimationsEnabled()) 1361 if (RuntimeEnabledFeatures::webAnimationsEnabled() && !applyInheritedOnly)
1274 applyAnimatedProperties<LowPriorityProperties>(state, element, element-> document()->timeline()); 1362 applyAnimatedProperties<LowPriorityProperties>(state, element, element-> document()->timeline(), cssAnimationUpdate.get());
1275 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc hResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherite dOnly); 1363 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc hResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherite dOnly);
1276 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc hResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnl y); 1364 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc hResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnl y);
1277 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc hResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); 1365 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc hResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
1278 1366
1279 // Start loading resources referenced by this style. 1367 // Start loading resources referenced by this style.
1280 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources()); 1368 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources());
1281 1369
1282 ASSERT(!state.fontBuilder().fontDirty()); 1370 ASSERT(!state.fontBuilder().fontDirty());
1283 1371
1284 #ifdef STYLE_STATS 1372 #ifdef STYLE_STATS
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); 1548 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che);
1461 1549
1462 fprintf(stderr, "Total:\n"); 1550 fprintf(stderr, "Total:\n");
1463 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, 1551 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing,
1464 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); 1552 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache);
1465 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); 1553 fprintf(stderr, "----------------------------------------------------------- ---------------------\n");
1466 } 1554 }
1467 #endif 1555 #endif
1468 1556
1469 } // namespace WebCore 1557 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698