| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 class RuleData; | 57 class RuleData; |
| 58 class Settings; | 58 class Settings; |
| 59 class StyleKeyframe; | 59 class StyleKeyframe; |
| 60 class StylePropertySet; | 60 class StylePropertySet; |
| 61 class StyleResolverStats; | 61 class StyleResolverStats; |
| 62 class StyleRule; | 62 class StyleRule; |
| 63 class StyleRuleKeyframes; | 63 class StyleRuleKeyframes; |
| 64 | 64 |
| 65 class MatchResult; | 65 class MatchResult; |
| 66 | 66 |
| 67 enum StyleSharingBehavior { | |
| 68 AllowStyleSharing, | |
| 69 DisallowStyleSharing, | |
| 70 }; | |
| 71 | |
| 72 enum RuleMatchingBehavior { | |
| 73 MatchAllRules, | |
| 74 MatchAllRulesExcludingSMIL | |
| 75 }; | |
| 76 | |
| 77 const unsigned styleSharingListSize = 15; | 67 const unsigned styleSharingListSize = 15; |
| 78 const unsigned styleSharingMaxDepth = 32; | 68 const unsigned styleSharingMaxDepth = 32; |
| 79 typedef Deque<RawPtr<Element>, styleSharingListSize> StyleSharingList; | 69 typedef Deque<RawPtr<Element>, styleSharingListSize> StyleSharingList; |
| 80 | 70 |
| 81 struct CSSPropertyValue { | 71 struct CSSPropertyValue { |
| 82 STACK_ALLOCATED(); | 72 STACK_ALLOCATED(); |
| 83 public: | 73 public: |
| 84 CSSPropertyValue(CSSPropertyID property, CSSValue* value) | 74 CSSPropertyValue(CSSPropertyID property, CSSValue* value) |
| 85 : property(property), value(value) { } | 75 : property(property), value(value) { } |
| 86 // Stores value=propertySet.getPropertyCSSValue(id).get(). | 76 // Stores value=propertySet.getPropertyCSSValue(id).get(). |
| 87 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); | 77 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); |
| 88 CSSPropertyID property; | 78 CSSPropertyID property; |
| 89 RawPtr<CSSValue> value; | 79 RawPtr<CSSValue> value; |
| 90 }; | 80 }; |
| 91 | 81 |
| 92 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 82 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
| 93 class StyleResolver final { | 83 class StyleResolver final { |
| 94 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED; | 84 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED; |
| 95 public: | 85 public: |
| 96 explicit StyleResolver(Document&); | 86 explicit StyleResolver(Document&); |
| 97 virtual ~StyleResolver(); | 87 virtual ~StyleResolver(); |
| 98 | 88 |
| 99 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0, StyleSharingBehavior = AllowStyleSharing, | 89 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0); |
| 100 RuleMatchingBehavior = MatchAllRules); | |
| 101 | 90 |
| 102 PassRefPtr<RenderStyle> styleForKeyframe(Element*, const RenderStyle&, Rende
rStyle* parentStyle, const StyleKeyframe*, const AtomicString& animationName); | 91 PassRefPtr<RenderStyle> styleForKeyframe(Element*, const RenderStyle&, Rende
rStyle* parentStyle, const StyleKeyframe*, const AtomicString& animationName); |
| 103 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(Element&, C
SSPropertyID, CSSValue&); | 92 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(Element&, C
SSPropertyID, CSSValue&); |
| 104 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(StyleResolv
erState&, CSSPropertyID, CSSValue&); | 93 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(StyleResolv
erState&, CSSPropertyID, CSSValue&); |
| 105 | 94 |
| 106 PassRefPtr<RenderStyle> defaultStyleForElement(); | 95 PassRefPtr<RenderStyle> defaultStyleForElement(); |
| 107 PassRefPtr<RenderStyle> styleForText(Text*); | 96 PassRefPtr<RenderStyle> styleForText(Text*); |
| 108 | 97 |
| 109 static PassRefPtr<RenderStyle> styleForDocument(Document&); | 98 static PassRefPtr<RenderStyle> styleForDocument(Document&); |
| 110 | 99 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // FIXME: This should probably go away, folded into FontBuilder. | 148 // FIXME: This should probably go away, folded into FontBuilder. |
| 160 void updateFont(StyleResolverState&); | 149 void updateFont(StyleResolverState&); |
| 161 | 150 |
| 162 void loadPendingResources(StyleResolverState&); | 151 void loadPendingResources(StyleResolverState&); |
| 163 | 152 |
| 164 void appendCSSStyleSheet(CSSStyleSheet*); | 153 void appendCSSStyleSheet(CSSStyleSheet*); |
| 165 | 154 |
| 166 void matchUARules(ElementRuleCollector&, RuleSet*); | 155 void matchUARules(ElementRuleCollector&, RuleSet*); |
| 167 void matchAuthorRules(Element*, ElementRuleCollector&, bool includeEmptyRule
s); | 156 void matchAuthorRules(Element*, ElementRuleCollector&, bool includeEmptyRule
s); |
| 168 void matchAuthorRulesForShadowHost(Element*, ElementRuleCollector&, bool inc
ludeEmptyRules, Vector<RawPtr<ScopedStyleResolver>, 8>& resolvers, Vector<RawPtr
<ScopedStyleResolver>, 8>& resolversInShadowTree); | 157 void matchAuthorRulesForShadowHost(Element*, ElementRuleCollector&, bool inc
ludeEmptyRules, Vector<RawPtr<ScopedStyleResolver>, 8>& resolvers, Vector<RawPtr
<ScopedStyleResolver>, 8>& resolversInShadowTree); |
| 169 void matchAllRules(StyleResolverState&, ElementRuleCollector&, bool includeS
MILProperties); | 158 void matchAllRules(StyleResolverState&, ElementRuleCollector&); |
| 170 void matchUARules(ElementRuleCollector&); | 159 void matchUARules(ElementRuleCollector&); |
| 171 | 160 |
| 172 void applyMatchedProperties(StyleResolverState&, const MatchResult&); | 161 void applyMatchedProperties(StyleResolverState&, const MatchResult&); |
| 173 bool applyAnimatedProperties(StyleResolverState&, Element* animatingElement)
; | 162 bool applyAnimatedProperties(StyleResolverState&, Element* animatingElement)
; |
| 174 | 163 |
| 175 void collectScopedResolversForHostedShadowTrees(const Element*, Vector<RawPt
r<ScopedStyleResolver>, 8>&); | 164 void collectScopedResolversForHostedShadowTrees(const Element*, Vector<RawPt
r<ScopedStyleResolver>, 8>&); |
| 176 | 165 |
| 177 enum StyleApplicationPass { | 166 enum StyleApplicationPass { |
| 178 HighPriorityProperties, | 167 HighPriorityProperties, |
| 179 LowPriorityProperties | 168 LowPriorityProperties |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; | 202 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; |
| 214 unsigned m_styleResolverStatsSequence; | 203 unsigned m_styleResolverStatsSequence; |
| 215 | 204 |
| 216 // Use only for Internals::updateStyleAndReturnAffectedElementCount. | 205 // Use only for Internals::updateStyleAndReturnAffectedElementCount. |
| 217 unsigned m_accessCount; | 206 unsigned m_accessCount; |
| 218 }; | 207 }; |
| 219 | 208 |
| 220 } // namespace blink | 209 } // namespace blink |
| 221 | 210 |
| 222 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_STYLERESOLVER_H_ | 211 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_STYLERESOLVER_H_ |
| OLD | NEW |