| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "core/css/StylePropertySet.h" | 55 #include "core/css/StylePropertySet.h" |
| 56 #include "core/css/StyleSheetContents.h" | 56 #include "core/css/StyleSheetContents.h" |
| 57 #include "core/css/parser/BisonCSSParser.h" | 57 #include "core/css/parser/BisonCSSParser.h" |
| 58 #include "core/css/resolver/AnimatedStyleBuilder.h" | 58 #include "core/css/resolver/AnimatedStyleBuilder.h" |
| 59 #include "core/css/resolver/MatchResult.h" | 59 #include "core/css/resolver/MatchResult.h" |
| 60 #include "core/css/resolver/MediaQueryResult.h" | 60 #include "core/css/resolver/MediaQueryResult.h" |
| 61 #include "core/css/resolver/SharedStyleFinder.h" | 61 #include "core/css/resolver/SharedStyleFinder.h" |
| 62 #include "core/css/resolver/StyleAdjuster.h" | 62 #include "core/css/resolver/StyleAdjuster.h" |
| 63 #include "core/css/resolver/StyleResolverState.h" | 63 #include "core/css/resolver/StyleResolverState.h" |
| 64 #include "core/css/resolver/StyleResolverStats.h" | 64 #include "core/css/resolver/StyleResolverStats.h" |
| 65 #include "core/css/resolver/ViewportStyleResolver.h" | |
| 66 #include "core/dom/NodeRenderStyle.h" | 65 #include "core/dom/NodeRenderStyle.h" |
| 67 #include "core/dom/StyleEngine.h" | 66 #include "core/dom/StyleEngine.h" |
| 68 #include "core/dom/Text.h" | 67 #include "core/dom/Text.h" |
| 69 #include "core/dom/shadow/ElementShadow.h" | 68 #include "core/dom/shadow/ElementShadow.h" |
| 70 #include "core/dom/shadow/ShadowRoot.h" | 69 #include "core/dom/shadow/ShadowRoot.h" |
| 71 #include "core/frame/FrameView.h" | 70 #include "core/frame/FrameView.h" |
| 72 #include "core/frame/LocalFrame.h" | 71 #include "core/frame/LocalFrame.h" |
| 73 #include "core/rendering/RenderView.h" | 72 #include "core/rendering/RenderView.h" |
| 74 #include "core/rendering/style/KeyframeList.h" | 73 #include "core/rendering/style/KeyframeList.h" |
| 75 #include "platform/RuntimeEnabledFeatures.h" | 74 #include "platform/RuntimeEnabledFeatures.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 95 | 94 |
| 96 static void addFontFaceRule(Document* document, CSSFontSelector* cssFontSelector
, const StyleRuleFontFace* fontFaceRule) | 95 static void addFontFaceRule(Document* document, CSSFontSelector* cssFontSelector
, const StyleRuleFontFace* fontFaceRule) |
| 97 { | 96 { |
| 98 RefPtrWillBeRawPtr<FontFace> fontFace = FontFace::create(document, fontFaceR
ule); | 97 RefPtrWillBeRawPtr<FontFace> fontFace = FontFace::create(document, fontFaceR
ule); |
| 99 if (fontFace) | 98 if (fontFace) |
| 100 cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule, fon
tFace); | 99 cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule, fon
tFace); |
| 101 } | 100 } |
| 102 | 101 |
| 103 StyleResolver::StyleResolver(Document& document) | 102 StyleResolver::StyleResolver(Document& document) |
| 104 : m_document(document) | 103 : m_document(document) |
| 105 , m_viewportStyleResolver(ViewportStyleResolver::create(&document)) | |
| 106 , m_needCollectFeatures(false) | 104 , m_needCollectFeatures(false) |
| 107 , m_printMediaType(false) | 105 , m_printMediaType(false) |
| 108 , m_styleResourceLoader(document.fetcher()) | 106 , m_styleResourceLoader(document.fetcher()) |
| 109 , m_styleSharingDepth(0) | 107 , m_styleSharingDepth(0) |
| 110 , m_styleResolverStatsSequence(0) | 108 , m_styleResolverStatsSequence(0) |
| 111 , m_accessCount(0) | 109 , m_accessCount(0) |
| 112 { | 110 { |
| 113 FrameView* view = document.view(); | 111 FrameView* view = document.view(); |
| 114 if (view) { | 112 if (view) { |
| 115 m_medium = adoptPtr(new MediaQueryEvaluator(&view->frame())); | 113 m_medium = adoptPtr(new MediaQueryEvaluator(&view->frame())); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 for (unsigned i = 0; i < size; ++i) | 162 for (unsigned i = 0; i < size; ++i) |
| 165 appendCSSStyleSheet(styleSheets[i].get()); | 163 appendCSSStyleSheet(styleSheets[i].get()); |
| 166 } | 164 } |
| 167 | 165 |
| 168 void StyleResolver::finishAppendAuthorStyleSheets() | 166 void StyleResolver::finishAppendAuthorStyleSheets() |
| 169 { | 167 { |
| 170 collectFeatures(); | 168 collectFeatures(); |
| 171 | 169 |
| 172 if (document().renderView() && document().renderView()->style()) | 170 if (document().renderView() && document().renderView()->style()) |
| 173 document().renderView()->style()->font().update(document().styleEngine()
->fontSelector()); | 171 document().renderView()->style()->font().update(document().styleEngine()
->fontSelector()); |
| 174 | |
| 175 collectViewportRules(); | |
| 176 } | 172 } |
| 177 | 173 |
| 178 void StyleResolver::resetRuleFeatures() | 174 void StyleResolver::resetRuleFeatures() |
| 179 { | 175 { |
| 180 // Need to recreate RuleFeatureSet. | 176 // Need to recreate RuleFeatureSet. |
| 181 m_features.clear(); | 177 m_features.clear(); |
| 182 m_attributeRuleSet.clear(); | 178 m_attributeRuleSet.clear(); |
| 183 m_needCollectFeatures = true; | 179 m_needCollectFeatures = true; |
| 184 } | 180 } |
| 185 | 181 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 state.fontBuilder().initForStyleResolve(state.document(), state.style()); | 561 state.fontBuilder().initForStyleResolve(state.document(), state.style()); |
| 566 return createAnimatableValueSnapshot(state, property, value); | 562 return createAnimatableValueSnapshot(state, property, value); |
| 567 } | 563 } |
| 568 | 564 |
| 569 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap
shot(StyleResolverState& state, CSSPropertyID property, CSSValue& value) | 565 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap
shot(StyleResolverState& state, CSSPropertyID property, CSSValue& value) |
| 570 { | 566 { |
| 571 StyleBuilder::applyProperty(property, state, &value); | 567 StyleBuilder::applyProperty(property, state, &value); |
| 572 return CSSAnimatableValueFactory::create(property, *state.style()); | 568 return CSSAnimatableValueFactory::create(property, *state.style()); |
| 573 } | 569 } |
| 574 | 570 |
| 575 void StyleResolver::collectViewportRules() | |
| 576 { | |
| 577 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance(
); | |
| 578 viewportStyleResolver()->collectViewportRules(defaultStyleSheets.defaultStyl
e(), ViewportStyleResolver::UserAgentOrigin); | |
| 579 viewportStyleResolver()->collectViewportRules(defaultStyleSheets.defaultView
portStyle(), ViewportStyleResolver::UserAgentOrigin); | |
| 580 | |
| 581 if (ScopedStyleResolver* scopedResolver = document().scopedStyleResolver()) | |
| 582 scopedResolver->collectViewportRulesTo(this); | |
| 583 | |
| 584 viewportStyleResolver()->resolve(); | |
| 585 } | |
| 586 | |
| 587 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() | 571 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() |
| 588 { | 572 { |
| 589 StyleResolverState state(document(), 0); | 573 StyleResolverState state(document(), 0); |
| 590 state.setStyle(RenderStyle::create()); | 574 state.setStyle(RenderStyle::create()); |
| 591 state.fontBuilder().initForStyleResolve(document(), state.style()); | 575 state.fontBuilder().initForStyleResolve(document(), state.style()); |
| 592 state.style()->setLineHeight(RenderStyle::initialLineHeight()); | 576 state.style()->setLineHeight(RenderStyle::initialLineHeight()); |
| 593 state.setLineHeightValue(0); | 577 state.setLineHeightValue(0); |
| 594 state.fontBuilder().setInitial(state.style()->effectiveZoom()); | 578 state.fontBuilder().setInitial(state.style()->effectiveZoom()); |
| 595 state.style()->font().update(document().styleEngine()->fontSelector()); | 579 state.style()->font().update(document().styleEngine()->fontSelector()); |
| 596 return state.takeStyle(); | 580 return state.takeStyle(); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size
); | 849 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size
); |
| 866 } | 850 } |
| 867 | 851 |
| 868 void StyleResolver::invalidateMatchedPropertiesCache() | 852 void StyleResolver::invalidateMatchedPropertiesCache() |
| 869 { | 853 { |
| 870 m_matchedPropertiesCache.clear(); | 854 m_matchedPropertiesCache.clear(); |
| 871 } | 855 } |
| 872 | 856 |
| 873 void StyleResolver::notifyResizeForViewportUnits() | 857 void StyleResolver::notifyResizeForViewportUnits() |
| 874 { | 858 { |
| 875 collectViewportRules(); | |
| 876 m_matchedPropertiesCache.clearViewportDependent(); | 859 m_matchedPropertiesCache.clearViewportDependent(); |
| 877 } | 860 } |
| 878 | 861 |
| 879 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hResult& matchResult) | 862 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hResult& matchResult) |
| 880 { | 863 { |
| 881 const Element* element = state.element(); | 864 const Element* element = state.element(); |
| 882 ASSERT(element); | 865 ASSERT(element); |
| 883 | 866 |
| 884 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyApply); | 867 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyApply); |
| 885 | 868 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 } | 1004 } |
| 1022 return false; | 1005 return false; |
| 1023 } | 1006 } |
| 1024 | 1007 |
| 1025 void StyleResolver::trace(Visitor* visitor) | 1008 void StyleResolver::trace(Visitor* visitor) |
| 1026 { | 1009 { |
| 1027 #if ENABLE(OILPAN) | 1010 #if ENABLE(OILPAN) |
| 1028 visitor->trace(m_keyframesRuleMap); | 1011 visitor->trace(m_keyframesRuleMap); |
| 1029 visitor->trace(m_matchedPropertiesCache); | 1012 visitor->trace(m_matchedPropertiesCache); |
| 1030 visitor->trace(m_viewportDependentMediaQueryResults); | 1013 visitor->trace(m_viewportDependentMediaQueryResults); |
| 1031 visitor->trace(m_viewportStyleResolver); | |
| 1032 visitor->trace(m_features); | 1014 visitor->trace(m_features); |
| 1033 visitor->trace(m_attributeRuleSet); | 1015 visitor->trace(m_attributeRuleSet); |
| 1034 visitor->trace(m_styleSharingLists); | 1016 visitor->trace(m_styleSharingLists); |
| 1035 visitor->trace(m_pendingStyleSheets); | 1017 visitor->trace(m_pendingStyleSheets); |
| 1036 visitor->trace(m_document); | 1018 visitor->trace(m_document); |
| 1037 #endif | 1019 #endif |
| 1038 } | 1020 } |
| 1039 | 1021 |
| 1040 } // namespace blink | 1022 } // namespace blink |
| OLD | NEW |