| 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 21 matching lines...) Expand all Loading... |
| 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; | 36 class AnimatableValue; |
| 37 class CSSValue; | 37 class CSSValue; |
| 38 class Document; | 38 class Document; |
| 39 class Element; | 39 class Element; |
| 40 class ElementRuleCollector; | 40 class ElementRuleCollector; |
| 41 class Interpolation; | 41 class Interpolation; |
| 42 class StyleKeyframe; | |
| 43 class StylePropertySet; | 42 class StylePropertySet; |
| 44 class StyleResolverStats; | 43 class StyleResolverStats; |
| 45 class MatchResult; | 44 class MatchResult; |
| 46 | 45 |
| 47 const unsigned styleSharingListSize = 15; | 46 const unsigned styleSharingListSize = 15; |
| 48 typedef Deque<Element*, styleSharingListSize> StyleSharingList; | 47 typedef Deque<Element*, styleSharingListSize> StyleSharingList; |
| 49 | 48 |
| 50 struct CSSPropertyValue { | 49 struct CSSPropertyValue { |
| 51 STACK_ALLOCATED(); | 50 STACK_ALLOCATED(); |
| 52 public: | 51 public: |
| 53 CSSPropertyValue(CSSPropertyID property, CSSValue* value) | 52 CSSPropertyValue(CSSPropertyID property, CSSValue* value) |
| 54 : property(property), value(value) { } | 53 : property(property), value(value) { } |
| 55 // Stores value=propertySet.getPropertyCSSValue(id).get(). | 54 // Stores value=propertySet.getPropertyCSSValue(id).get(). |
| 56 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); | 55 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); |
| 57 CSSPropertyID property; | 56 CSSPropertyID property; |
| 58 RawPtr<CSSValue> value; | 57 RawPtr<CSSValue> value; |
| 59 }; | 58 }; |
| 60 | 59 |
| 61 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 60 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
| 62 class StyleResolver final { | 61 class StyleResolver final { |
| 63 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED; | 62 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED; |
| 64 public: | 63 public: |
| 65 explicit StyleResolver(Document&); | 64 explicit StyleResolver(Document&); |
| 66 virtual ~StyleResolver(); | 65 virtual ~StyleResolver(); |
| 67 | 66 |
| 68 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0); | 67 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0); |
| 69 | 68 |
| 70 PassRefPtr<RenderStyle> styleForKeyframe(Element*, const RenderStyle&, Rende
rStyle* parentStyle, const StyleKeyframe*, const AtomicString& animationName); | |
| 71 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(Element&, C
SSPropertyID, CSSValue&); | 69 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(Element&, C
SSPropertyID, CSSValue&); |
| 72 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(StyleResolv
erState&, CSSPropertyID, CSSValue&); | 70 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(StyleResolv
erState&, CSSPropertyID, CSSValue&); |
| 73 | 71 |
| 74 PassRefPtr<RenderStyle> defaultStyleForElement(); | 72 PassRefPtr<RenderStyle> defaultStyleForElement(); |
| 75 PassRefPtr<RenderStyle> styleForText(Text*); | 73 PassRefPtr<RenderStyle> styleForText(Text*); |
| 76 | 74 |
| 77 static PassRefPtr<RenderStyle> styleForDocument(Document&); | 75 static PassRefPtr<RenderStyle> styleForDocument(Document&); |
| 78 | 76 |
| 79 void styleTreeResolveScopedKeyframesRules(const Element*, Vector<RawPtr<Scop
edStyleResolver>, 8>&); | |
| 80 | |
| 81 // |properties| is an array with |count| elements. | 77 // |properties| is an array with |count| elements. |
| 82 void applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count
, RenderStyle*); | 78 void applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count
, RenderStyle*); |
| 83 | 79 |
| 84 // FIXME: Rename to reflect the purpose, like didChangeFontSize or something
. | 80 // FIXME: Rename to reflect the purpose, like didChangeFontSize or something
. |
| 85 void invalidateMatchedPropertiesCache(); | 81 void invalidateMatchedPropertiesCache(); |
| 86 | 82 |
| 87 void notifyResizeForViewportUnits(); | 83 void notifyResizeForViewportUnits(); |
| 88 | 84 |
| 89 StyleSharingList& styleSharingList() { return m_styleSharingList; } | 85 StyleSharingList& styleSharingList() { return m_styleSharingList; } |
| 90 | 86 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 StyleSharingList m_styleSharingList; | 131 StyleSharingList m_styleSharingList; |
| 136 | 132 |
| 137 OwnPtr<StyleResolverStats> m_styleResolverStats; | 133 OwnPtr<StyleResolverStats> m_styleResolverStats; |
| 138 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; | 134 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; |
| 139 unsigned m_styleResolverStatsSequence; | 135 unsigned m_styleResolverStatsSequence; |
| 140 }; | 136 }; |
| 141 | 137 |
| 142 } // namespace blink | 138 } // namespace blink |
| 143 | 139 |
| 144 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_STYLERESOLVER_H_ | 140 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_STYLERESOLVER_H_ |
| OLD | NEW |