| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "sky/engine/core/css/StylePropertySet.h" | 51 #include "sky/engine/core/css/StylePropertySet.h" |
| 52 #include "sky/engine/core/css/StyleSheetContents.h" | 52 #include "sky/engine/core/css/StyleSheetContents.h" |
| 53 #include "sky/engine/core/css/parser/BisonCSSParser.h" | 53 #include "sky/engine/core/css/parser/BisonCSSParser.h" |
| 54 #include "sky/engine/core/css/resolver/AnimatedStyleBuilder.h" | 54 #include "sky/engine/core/css/resolver/AnimatedStyleBuilder.h" |
| 55 #include "sky/engine/core/css/resolver/MatchResult.h" | 55 #include "sky/engine/core/css/resolver/MatchResult.h" |
| 56 #include "sky/engine/core/css/resolver/SharedStyleFinder.h" | 56 #include "sky/engine/core/css/resolver/SharedStyleFinder.h" |
| 57 #include "sky/engine/core/css/resolver/StyleAdjuster.h" | 57 #include "sky/engine/core/css/resolver/StyleAdjuster.h" |
| 58 #include "sky/engine/core/css/resolver/StyleBuilder.h" | 58 #include "sky/engine/core/css/resolver/StyleBuilder.h" |
| 59 #include "sky/engine/core/css/resolver/StyleResolverState.h" | 59 #include "sky/engine/core/css/resolver/StyleResolverState.h" |
| 60 #include "sky/engine/core/css/resolver/StyleResolverStats.h" | 60 #include "sky/engine/core/css/resolver/StyleResolverStats.h" |
| 61 #include "sky/engine/core/css/resolver/StyleResourceLoader.h" | |
| 62 #include "sky/engine/core/dom/NodeRenderStyle.h" | 61 #include "sky/engine/core/dom/NodeRenderStyle.h" |
| 63 #include "sky/engine/core/dom/StyleEngine.h" | 62 #include "sky/engine/core/dom/StyleEngine.h" |
| 64 #include "sky/engine/core/dom/Text.h" | 63 #include "sky/engine/core/dom/Text.h" |
| 65 #include "sky/engine/core/dom/shadow/ElementShadow.h" | 64 #include "sky/engine/core/dom/shadow/ElementShadow.h" |
| 66 #include "sky/engine/core/dom/shadow/ShadowRoot.h" | 65 #include "sky/engine/core/dom/shadow/ShadowRoot.h" |
| 67 #include "sky/engine/core/frame/FrameView.h" | 66 #include "sky/engine/core/frame/FrameView.h" |
| 68 #include "sky/engine/core/frame/LocalFrame.h" | 67 #include "sky/engine/core/frame/LocalFrame.h" |
| 69 #include "sky/engine/core/rendering/RenderView.h" | 68 #include "sky/engine/core/rendering/RenderView.h" |
| 70 #include "sky/engine/wtf/LeakAnnotations.h" | 69 #include "sky/engine/wtf/LeakAnnotations.h" |
| 71 #include "sky/engine/wtf/StdLibExtras.h" | 70 #include "sky/engine/wtf/StdLibExtras.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 documentStyle->setRTLOrdering(LogicalOrder); | 176 documentStyle->setRTLOrdering(LogicalOrder); |
| 178 documentStyle->setLocale(document.contentLanguage()); | 177 documentStyle->setLocale(document.contentLanguage()); |
| 179 documentStyle->setZIndex(0); | 178 documentStyle->setZIndex(0); |
| 180 documentStyle->setUserModify(READ_ONLY); | 179 documentStyle->setUserModify(READ_ONLY); |
| 181 | 180 |
| 182 document.setupFontBuilder(documentStyle.get()); | 181 document.setupFontBuilder(documentStyle.get()); |
| 183 | 182 |
| 184 return documentStyle.release(); | 183 return documentStyle.release(); |
| 185 } | 184 } |
| 186 | 185 |
| 187 void StyleResolver::loadPendingResources(StyleResolverState& state) | |
| 188 { | |
| 189 StyleResourceLoader loader(m_document.fetcher()); | |
| 190 loader.loadPendingResources(state.style(), state.elementStyleResources()); | |
| 191 } | |
| 192 | |
| 193 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent) | 186 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent) |
| 194 { | 187 { |
| 195 ASSERT(m_document.frame()); | 188 ASSERT(m_document.frame()); |
| 196 ASSERT(m_document.settings()); | 189 ASSERT(m_document.settings()); |
| 197 | 190 |
| 198 StyleResolverState state(m_document, element, defaultParent); | 191 StyleResolverState state(m_document, element, defaultParent); |
| 199 | 192 |
| 200 if (state.parentStyle()) { | 193 if (state.parentStyle()) { |
| 201 SharedStyleFinder styleFinder(state.elementContext(), *this); | 194 SharedStyleFinder styleFinder(state.elementContext(), *this); |
| 202 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) | 195 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo
rAnimations = state.animationUpdate()->activeInterpolationsForAnimations(); | 314 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo
rAnimations = state.animationUpdate()->activeInterpolationsForAnimations(); |
| 322 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo
rTransitions = state.animationUpdate()->activeInterpolationsForTransitions(); | 315 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo
rTransitions = state.animationUpdate()->activeInterpolationsForTransitions(); |
| 323 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF
orAnimations); | 316 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF
orAnimations); |
| 324 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF
orTransitions); | 317 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF
orTransitions); |
| 325 | 318 |
| 326 updateFont(state); | 319 updateFont(state); |
| 327 | 320 |
| 328 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rAnimations); | 321 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rAnimations); |
| 329 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rTransitions); | 322 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rTransitions); |
| 330 | 323 |
| 331 // Start loading resources used by animations. | |
| 332 loadPendingResources(state); | |
| 333 | |
| 334 ASSERT(!state.fontBuilder().fontDirty()); | 324 ASSERT(!state.fontBuilder().fontDirty()); |
| 335 | 325 |
| 336 return true; | 326 return true; |
| 337 } | 327 } |
| 338 | 328 |
| 339 template <StyleResolver::StyleApplicationPass pass> | 329 template <StyleResolver::StyleApplicationPass pass> |
| 340 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Has
hMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolations) | 330 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Has
hMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolations) |
| 341 { | 331 { |
| 342 for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = a
ctiveInterpolations.begin(); iter != activeInterpolations.end(); ++iter) { | 332 for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = a
ctiveInterpolations.begin(); iter != activeInterpolations.end(); ++iter) { |
| 343 CSSPropertyID property = iter->key; | 333 CSSPropertyID property = iter->key; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 // Line-height is set when we are sure we decided on the font-size. | 471 // Line-height is set when we are sure we decided on the font-size. |
| 482 if (state.lineHeightValue()) | 472 if (state.lineHeightValue()) |
| 483 StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeig
htValue()); | 473 StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeig
htValue()); |
| 484 | 474 |
| 485 // Many properties depend on the font. If it changes we just apply all prope
rties. | 475 // Many properties depend on the font. If it changes we just apply all prope
rties. |
| 486 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDes
cription() != state.style()->fontDescription()) | 476 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDes
cription() != state.style()->fontDescription()) |
| 487 applyInheritedOnly = false; | 477 applyInheritedOnly = false; |
| 488 | 478 |
| 489 applyMatchedProperties<LowPriorityProperties>(state, matchResult, applyInher
itedOnly); | 479 applyMatchedProperties<LowPriorityProperties>(state, matchResult, applyInher
itedOnly); |
| 490 | 480 |
| 491 loadPendingResources(state); | |
| 492 | |
| 493 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, state.style(), state.parentStyle())) { | 481 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, state.style(), state.parentStyle())) { |
| 494 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded); | 482 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded); |
| 495 m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHa
sh, matchResult); | 483 m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHa
sh, matchResult); |
| 496 } | 484 } |
| 497 | 485 |
| 498 ASSERT(!state.fontBuilder().fontDirty()); | 486 ASSERT(!state.fontBuilder().fontDirty()); |
| 499 } | 487 } |
| 500 | 488 |
| 501 CSSPropertyValue::CSSPropertyValue(CSSPropertyID id, const StylePropertySet& pro
pertySet) | 489 CSSPropertyValue::CSSPropertyValue(CSSPropertyID id, const StylePropertySet& pro
pertySet) |
| 502 : property(id), value(propertySet.getPropertyCSSValue(id).get()) | 490 : property(id), value(propertySet.getPropertyCSSValue(id).get()) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 break; | 538 break; |
| 551 default: | 539 default: |
| 552 break; | 540 break; |
| 553 } | 541 } |
| 554 StyleBuilder::applyProperty(properties[i].property, state, propertie
s[i].value); | 542 StyleBuilder::applyProperty(properties[i].property, state, propertie
s[i].value); |
| 555 } | 543 } |
| 556 } | 544 } |
| 557 } | 545 } |
| 558 | 546 |
| 559 } // namespace blink | 547 } // namespace blink |
| OLD | NEW |