| 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 15 matching lines...) Expand all Loading... |
| 26 #include "sky/engine/core/css/resolver/MatchedPropertiesCache.h" | 26 #include "sky/engine/core/css/resolver/MatchedPropertiesCache.h" |
| 27 #include "sky/engine/core/css/resolver/ScopedStyleResolver.h" | 27 #include "sky/engine/core/css/resolver/ScopedStyleResolver.h" |
| 28 #include "sky/engine/platform/heap/Handle.h" | 28 #include "sky/engine/platform/heap/Handle.h" |
| 29 #include "sky/engine/wtf/Deque.h" | 29 #include "sky/engine/wtf/Deque.h" |
| 30 #include "sky/engine/wtf/HashMap.h" | 30 #include "sky/engine/wtf/HashMap.h" |
| 31 #include "sky/engine/wtf/RefPtr.h" | 31 #include "sky/engine/wtf/RefPtr.h" |
| 32 #include "sky/engine/wtf/Vector.h" | 32 #include "sky/engine/wtf/Vector.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 class AnimatableValue; | |
| 37 class CSSValue; | 36 class CSSValue; |
| 38 class Document; | 37 class Document; |
| 39 class Element; | 38 class Element; |
| 40 class ElementRuleCollector; | 39 class ElementRuleCollector; |
| 41 class Interpolation; | 40 class Interpolation; |
| 42 class StylePropertySet; | 41 class StylePropertySet; |
| 43 class StyleResolverStats; | 42 class StyleResolverStats; |
| 44 class MatchResult; | 43 class MatchResult; |
| 45 | 44 |
| 46 const unsigned styleSharingListSize = 15; | 45 const unsigned styleSharingListSize = 15; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 59 | 58 |
| 60 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 59 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
| 61 class StyleResolver final { | 60 class StyleResolver final { |
| 62 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED; | 61 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED; |
| 63 public: | 62 public: |
| 64 explicit StyleResolver(Document&); | 63 explicit StyleResolver(Document&); |
| 65 virtual ~StyleResolver(); | 64 virtual ~StyleResolver(); |
| 66 | 65 |
| 67 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0); | 66 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0); |
| 68 | 67 |
| 69 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(Element&, C
SSPropertyID, CSSValue&); | |
| 70 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(StyleResolv
erState&, CSSPropertyID, CSSValue&); | |
| 71 | |
| 72 PassRefPtr<RenderStyle> defaultStyleForElement(); | 68 PassRefPtr<RenderStyle> defaultStyleForElement(); |
| 73 PassRefPtr<RenderStyle> styleForText(Text*); | 69 PassRefPtr<RenderStyle> styleForText(Text*); |
| 74 | 70 |
| 75 static PassRefPtr<RenderStyle> styleForDocument(Document&); | 71 static PassRefPtr<RenderStyle> styleForDocument(Document&); |
| 76 | 72 |
| 77 // |properties| is an array with |count| elements. | 73 // |properties| is an array with |count| elements. |
| 78 void applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count
, RenderStyle*); | 74 void applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count
, RenderStyle*); |
| 79 | 75 |
| 80 // FIXME: Rename to reflect the purpose, like didChangeFontSize or something
. | 76 // FIXME: Rename to reflect the purpose, like didChangeFontSize or something
. |
| 81 void invalidateMatchedPropertiesCache(); | 77 void invalidateMatchedPropertiesCache(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 void disableStats(); | 90 void disableStats(); |
| 95 void printStats(); | 91 void printStats(); |
| 96 | 92 |
| 97 private: | 93 private: |
| 98 // FIXME: This should probably go away, folded into FontBuilder. | 94 // FIXME: This should probably go away, folded into FontBuilder. |
| 99 void updateFont(StyleResolverState&); | 95 void updateFont(StyleResolverState&); |
| 100 | 96 |
| 101 void matchRules(Element&, ElementRuleCollector&); | 97 void matchRules(Element&, ElementRuleCollector&); |
| 102 | 98 |
| 103 void applyMatchedProperties(StyleResolverState&, const MatchResult&); | 99 void applyMatchedProperties(StyleResolverState&, const MatchResult&); |
| 104 bool applyAnimatedProperties(StyleResolverState&, Element* animatingElement)
; | |
| 105 | 100 |
| 106 enum StyleApplicationPass { | 101 enum StyleApplicationPass { |
| 107 HighPriorityProperties, | 102 HighPriorityProperties, |
| 108 LowPriorityProperties | 103 LowPriorityProperties |
| 109 }; | 104 }; |
| 110 template <StyleResolver::StyleApplicationPass pass> | 105 template <StyleResolver::StyleApplicationPass pass> |
| 111 static inline CSSPropertyID firstCSSPropertyId(); | 106 static inline CSSPropertyID firstCSSPropertyId(); |
| 112 template <StyleResolver::StyleApplicationPass pass> | 107 template <StyleResolver::StyleApplicationPass pass> |
| 113 static inline CSSPropertyID lastCSSPropertyId(); | 108 static inline CSSPropertyID lastCSSPropertyId(); |
| 114 template <StyleResolver::StyleApplicationPass pass> | 109 template <StyleResolver::StyleApplicationPass pass> |
| 115 static inline bool isPropertyForPass(CSSPropertyID); | 110 static inline bool isPropertyForPass(CSSPropertyID); |
| 116 template <StyleApplicationPass pass> | 111 template <StyleApplicationPass pass> |
| 117 void applyMatchedProperties(StyleResolverState&, const MatchResult&, bool in
heritedOnly); | 112 void applyMatchedProperties(StyleResolverState&, const MatchResult&, bool in
heritedOnly); |
| 118 template <StyleApplicationPass pass> | 113 template <StyleApplicationPass pass> |
| 119 void applyProperties(StyleResolverState&, const StylePropertySet* properties
, bool inheritedOnly); | 114 void applyProperties(StyleResolverState&, const StylePropertySet* properties
, bool inheritedOnly); |
| 120 template <StyleApplicationPass pass> | |
| 121 void applyAnimatedProperties(StyleResolverState&, const HashMap<CSSPropertyI
D, RefPtr<Interpolation> >&); | |
| 122 | 115 |
| 123 MatchedPropertiesCache m_matchedPropertiesCache; | 116 MatchedPropertiesCache m_matchedPropertiesCache; |
| 124 | 117 |
| 125 Document& m_document; | 118 Document& m_document; |
| 126 | 119 |
| 127 StyleSharingList m_styleSharingList; | 120 StyleSharingList m_styleSharingList; |
| 128 | 121 |
| 129 OwnPtr<StyleResolverStats> m_styleResolverStats; | 122 OwnPtr<StyleResolverStats> m_styleResolverStats; |
| 130 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; | 123 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; |
| 131 unsigned m_styleResolverStatsSequence; | 124 unsigned m_styleResolverStatsSequence; |
| 132 }; | 125 }; |
| 133 | 126 |
| 134 } // namespace blink | 127 } // namespace blink |
| 135 | 128 |
| 136 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_STYLERESOLVER_H_ | 129 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_STYLERESOLVER_H_ |
| OLD | NEW |