| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "sky/engine/core/animation/css/CSSAnimations.h" | 42 #include "sky/engine/core/animation/css/CSSAnimations.h" |
| 43 #include "sky/engine/core/css/CSSCalculationValue.h" | 43 #include "sky/engine/core/css/CSSCalculationValue.h" |
| 44 #include "sky/engine/core/css/CSSFontSelector.h" | 44 #include "sky/engine/core/css/CSSFontSelector.h" |
| 45 #include "sky/engine/core/css/CSSSelector.h" | 45 #include "sky/engine/core/css/CSSSelector.h" |
| 46 #include "sky/engine/core/css/CSSValueList.h" | 46 #include "sky/engine/core/css/CSSValueList.h" |
| 47 #include "sky/engine/core/css/CSSValuePool.h" | 47 #include "sky/engine/core/css/CSSValuePool.h" |
| 48 #include "sky/engine/core/css/ElementRuleCollector.h" | 48 #include "sky/engine/core/css/ElementRuleCollector.h" |
| 49 #include "sky/engine/core/css/FontFace.h" | 49 #include "sky/engine/core/css/FontFace.h" |
| 50 #include "sky/engine/core/css/MediaQueryEvaluator.h" | 50 #include "sky/engine/core/css/MediaQueryEvaluator.h" |
| 51 #include "sky/engine/core/css/RuleSet.h" | 51 #include "sky/engine/core/css/RuleSet.h" |
| 52 #include "sky/engine/core/css/StyleKeyframe.h" | |
| 53 #include "sky/engine/core/css/StylePropertySet.h" | 52 #include "sky/engine/core/css/StylePropertySet.h" |
| 54 #include "sky/engine/core/css/StyleSheetContents.h" | 53 #include "sky/engine/core/css/StyleSheetContents.h" |
| 55 #include "sky/engine/core/css/parser/BisonCSSParser.h" | 54 #include "sky/engine/core/css/parser/BisonCSSParser.h" |
| 56 #include "sky/engine/core/css/resolver/AnimatedStyleBuilder.h" | 55 #include "sky/engine/core/css/resolver/AnimatedStyleBuilder.h" |
| 57 #include "sky/engine/core/css/resolver/MatchResult.h" | 56 #include "sky/engine/core/css/resolver/MatchResult.h" |
| 58 #include "sky/engine/core/css/resolver/SharedStyleFinder.h" | 57 #include "sky/engine/core/css/resolver/SharedStyleFinder.h" |
| 59 #include "sky/engine/core/css/resolver/StyleAdjuster.h" | 58 #include "sky/engine/core/css/resolver/StyleAdjuster.h" |
| 60 #include "sky/engine/core/css/resolver/StyleBuilder.h" | 59 #include "sky/engine/core/css/resolver/StyleBuilder.h" |
| 61 #include "sky/engine/core/css/resolver/StyleResolverState.h" | 60 #include "sky/engine/core/css/resolver/StyleResolverState.h" |
| 62 #include "sky/engine/core/css/resolver/StyleResolverStats.h" | 61 #include "sky/engine/core/css/resolver/StyleResolverStats.h" |
| 63 #include "sky/engine/core/css/resolver/StyleResourceLoader.h" | 62 #include "sky/engine/core/css/resolver/StyleResourceLoader.h" |
| 64 #include "sky/engine/core/dom/NodeRenderStyle.h" | 63 #include "sky/engine/core/dom/NodeRenderStyle.h" |
| 65 #include "sky/engine/core/dom/StyleEngine.h" | 64 #include "sky/engine/core/dom/StyleEngine.h" |
| 66 #include "sky/engine/core/dom/Text.h" | 65 #include "sky/engine/core/dom/Text.h" |
| 67 #include "sky/engine/core/dom/shadow/ElementShadow.h" | 66 #include "sky/engine/core/dom/shadow/ElementShadow.h" |
| 68 #include "sky/engine/core/dom/shadow/ShadowRoot.h" | 67 #include "sky/engine/core/dom/shadow/ShadowRoot.h" |
| 69 #include "sky/engine/core/frame/FrameView.h" | 68 #include "sky/engine/core/frame/FrameView.h" |
| 70 #include "sky/engine/core/frame/LocalFrame.h" | 69 #include "sky/engine/core/frame/LocalFrame.h" |
| 71 #include "sky/engine/core/rendering/RenderView.h" | 70 #include "sky/engine/core/rendering/RenderView.h" |
| 72 #include "sky/engine/core/rendering/style/KeyframeList.h" | |
| 73 #include "sky/engine/wtf/LeakAnnotations.h" | 71 #include "sky/engine/wtf/LeakAnnotations.h" |
| 74 #include "sky/engine/wtf/StdLibExtras.h" | 72 #include "sky/engine/wtf/StdLibExtras.h" |
| 75 | 73 |
| 76 namespace { | 74 namespace { |
| 77 | 75 |
| 78 using namespace blink; | 76 using namespace blink; |
| 79 | 77 |
| 80 void setAnimationUpdateIfNeeded(StyleResolverState& state, Element& element) | 78 void setAnimationUpdateIfNeeded(StyleResolverState& state, Element& element) |
| 81 { | 79 { |
| 82 // If any changes to CSS Animations were detected, stash the update away for
application after the | 80 // If any changes to CSS Animations were detected, stash the update away for
application after the |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 242 |
| 245 setAnimationUpdateIfNeeded(state, *element); | 243 setAnimationUpdateIfNeeded(state, *element); |
| 246 | 244 |
| 247 if (state.style()->hasViewportUnits()) | 245 if (state.style()->hasViewportUnits()) |
| 248 m_document.setHasViewportUnits(); | 246 m_document.setHasViewportUnits(); |
| 249 | 247 |
| 250 // Now return the style. | 248 // Now return the style. |
| 251 return state.takeStyle(); | 249 return state.takeStyle(); |
| 252 } | 250 } |
| 253 | 251 |
| 254 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* element, const
RenderStyle& elementStyle, RenderStyle* parentStyle, const StyleKeyframe* keyfra
me, const AtomicString& animationName) | |
| 255 { | |
| 256 ASSERT(m_document.frame()); | |
| 257 ASSERT(m_document.settings()); | |
| 258 | |
| 259 if (element == m_document.documentElement()) | |
| 260 m_document.setDirectionSetOnDocumentElement(false); | |
| 261 StyleResolverState state(m_document, element, parentStyle); | |
| 262 | |
| 263 MatchResult result; | |
| 264 result.addMatchedProperties(&keyframe->properties()); | |
| 265 | |
| 266 ASSERT(!state.style()); | |
| 267 | |
| 268 // Create the style | |
| 269 state.setStyle(RenderStyle::clone(&elementStyle)); | |
| 270 state.setLineHeightValue(0); | |
| 271 | |
| 272 state.fontBuilder().initForStyleResolve(state.document(), state.style()); | |
| 273 | |
| 274 // We also don't need to bother with animation properties since the only | |
| 275 // relevant one is animation-timing-function and we special-case that in | |
| 276 // CSSAnimations.cpp | |
| 277 bool inheritedOnly = false; | |
| 278 applyMatchedProperties<HighPriorityProperties>(state, result, inheritedOnly)
; | |
| 279 | |
| 280 // If our font got dirtied, go ahead and update it now. | |
| 281 updateFont(state); | |
| 282 | |
| 283 // Line-height is set when we are sure we decided on the font-size | |
| 284 if (state.lineHeightValue()) | |
| 285 StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeig
htValue()); | |
| 286 | |
| 287 // Now do rest of the properties. | |
| 288 applyMatchedProperties<LowPriorityProperties>(state, result, inheritedOnly); | |
| 289 | |
| 290 loadPendingResources(state); | |
| 291 | |
| 292 return state.takeStyle(); | |
| 293 } | |
| 294 | |
| 295 // This function is used by the WebAnimations JavaScript API method animate(). | 252 // This function is used by the WebAnimations JavaScript API method animate(). |
| 296 // FIXME: Remove this when animate() switches away from resolution-dependent par
sing. | 253 // FIXME: Remove this when animate() switches away from resolution-dependent par
sing. |
| 297 PassRefPtr<AnimatableValue> StyleResolver::createAnimatableValueSnapshot(Element
& element, CSSPropertyID property, CSSValue& value) | 254 PassRefPtr<AnimatableValue> StyleResolver::createAnimatableValueSnapshot(Element
& element, CSSPropertyID property, CSSValue& value) |
| 298 { | 255 { |
| 299 RefPtr<RenderStyle> style; | 256 RefPtr<RenderStyle> style; |
| 300 if (element.renderStyle()) | 257 if (element.renderStyle()) |
| 301 style = RenderStyle::clone(element.renderStyle()); | 258 style = RenderStyle::clone(element.renderStyle()); |
| 302 else | 259 else |
| 303 style = RenderStyle::create(); | 260 style = RenderStyle::create(); |
| 304 StyleResolverState state(element.document(), &element); | 261 StyleResolverState state(element.document(), &element); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rTransitions); | 331 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rTransitions); |
| 375 | 332 |
| 376 // Start loading resources used by animations. | 333 // Start loading resources used by animations. |
| 377 loadPendingResources(state); | 334 loadPendingResources(state); |
| 378 | 335 |
| 379 ASSERT(!state.fontBuilder().fontDirty()); | 336 ASSERT(!state.fontBuilder().fontDirty()); |
| 380 | 337 |
| 381 return true; | 338 return true; |
| 382 } | 339 } |
| 383 | 340 |
| 384 void StyleResolver::styleTreeResolveScopedKeyframesRules(const Element* element,
Vector<RawPtr<ScopedStyleResolver>, 8>& resolvers) | |
| 385 { | |
| 386 // Add resolvers for shadow roots hosted by the given element. | |
| 387 if (ShadowRoot* shadowRoot = element->shadowRoot()) | |
| 388 resolvers.append(&shadowRoot->scopedStyleResolver()); | |
| 389 resolvers.append(&element->treeScope().scopedStyleResolver()); | |
| 390 } | |
| 391 | |
| 392 template <StyleResolver::StyleApplicationPass pass> | 341 template <StyleResolver::StyleApplicationPass pass> |
| 393 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Has
hMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolations) | 342 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Has
hMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolations) |
| 394 { | 343 { |
| 395 for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = a
ctiveInterpolations.begin(); iter != activeInterpolations.end(); ++iter) { | 344 for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = a
ctiveInterpolations.begin(); iter != activeInterpolations.end(); ++iter) { |
| 396 CSSPropertyID property = iter->key; | 345 CSSPropertyID property = iter->key; |
| 397 if (!isPropertyForPass<pass>(property)) | 346 if (!isPropertyForPass<pass>(property)) |
| 398 continue; | 347 continue; |
| 399 const StyleInterpolation* interpolation = toStyleInterpolation(iter->val
ue.get()); | 348 const StyleInterpolation* interpolation = toStyleInterpolation(iter->val
ue.get()); |
| 400 interpolation->apply(state); | 349 interpolation->apply(state); |
| 401 } | 350 } |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 break; | 595 break; |
| 647 default: | 596 default: |
| 648 break; | 597 break; |
| 649 } | 598 } |
| 650 StyleBuilder::applyProperty(properties[i].property, state, propertie
s[i].value); | 599 StyleBuilder::applyProperty(properties[i].property, state, propertie
s[i].value); |
| 651 } | 600 } |
| 652 } | 601 } |
| 653 } | 602 } |
| 654 | 603 |
| 655 } // namespace blink | 604 } // namespace blink |
| OLD | NEW |