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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 #include "CSSPropertyNames.h" | 25 #include "CSSPropertyNames.h" |
26 | 26 |
27 #include "core/animation/css/CSSAnimations.h" | 27 #include "core/animation/css/CSSAnimations.h" |
28 #include "core/css/CSSSVGDocumentValue.h" | 28 #include "core/css/CSSSVGDocumentValue.h" |
29 #include "core/css/CSSToLengthConversionData.h" | 29 #include "core/css/CSSToLengthConversionData.h" |
30 #include "core/css/resolver/CSSToStyleMap.h" | 30 #include "core/css/resolver/CSSToStyleMap.h" |
31 #include "core/css/resolver/ElementResolveContext.h" | 31 #include "core/css/resolver/ElementResolveContext.h" |
32 #include "core/css/resolver/ElementStyleResources.h" | 32 #include "core/css/resolver/ElementStyleResources.h" |
33 #include "core/css/resolver/FontBuilder.h" | 33 #include "core/css/resolver/FontBuilder.h" |
| 34 #include "core/dom/Document.h" |
34 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
| 36 #include "core/dom/TreeScope.h" |
35 #include "core/rendering/style/CachedUAStyle.h" | 37 #include "core/rendering/style/CachedUAStyle.h" |
36 #include "core/rendering/style/RenderStyle.h" | 38 #include "core/rendering/style/RenderStyle.h" |
37 #include "core/rendering/style/StyleInheritedData.h" | 39 #include "core/rendering/style/StyleInheritedData.h" |
38 | 40 |
39 namespace WebCore { | 41 namespace WebCore { |
40 | 42 |
41 class FontDescription; | 43 class FontDescription; |
42 class RenderRegion; | 44 class RenderRegion; |
43 class StyleRule; | 45 class StyleRule; |
44 | 46 |
45 class StyleResolverState { | 47 class StyleResolverState { |
46 WTF_MAKE_NONCOPYABLE(StyleResolverState); | 48 WTF_MAKE_NONCOPYABLE(StyleResolverState); |
47 public: | 49 public: |
48 StyleResolverState(Document&, Element*, RenderStyle* parentStyle = 0, Render
Region* regionForStyling = 0); | 50 StyleResolverState(TreeScope&, Element*, RenderStyle* parentStyle = 0, Rende
rRegion* regionForStyling = 0); |
49 | 51 |
50 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to
grab the document from. | 52 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to
grab the document from. |
51 // This is why we have to store the document separately. | 53 // This is why we have to store the document separately. |
52 Document& document() const { return m_document; } | 54 Document& document() const { return m_treeScope.document(); } |
| 55 TreeScope& treeScope() const { return m_treeScope; } |
53 // These are all just pass-through methods to ElementResolveContext. | 56 // These are all just pass-through methods to ElementResolveContext. |
54 Element* element() const { return m_elementContext.element(); } | 57 Element* element() const { return m_elementContext.element(); } |
55 const ContainerNode* parentNode() const { return m_elementContext.parentNode
(); } | 58 const ContainerNode* parentNode() const { return m_elementContext.parentNode
(); } |
56 const RenderStyle* rootElementStyle() const { return m_elementContext.rootEl
ementStyle(); } | 59 const RenderStyle* rootElementStyle() const { return m_elementContext.rootEl
ementStyle(); } |
57 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt
ate(); } | 60 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt
ate(); } |
58 bool distributedToInsertionPoint() const { return m_elementContext.distribut
edToInsertionPoint(); } | 61 bool distributedToInsertionPoint() const { return m_elementContext.distribut
edToInsertionPoint(); } |
59 | 62 |
60 const ElementResolveContext& elementContext() const { return m_elementContex
t; } | 63 const ElementResolveContext& elementContext() const { return m_elementContex
t; } |
61 | 64 |
62 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; m_cssToLengt
hConversionData.setStyle(m_style.get()); } | 65 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; m_cssToLengt
hConversionData.setStyle(m_style.get()); } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // need to respect the scaling. RenderBox (the parent class of RenderSVGRoot
) grabs values like | 132 // need to respect the scaling. RenderBox (the parent class of RenderSVGRoot
) grabs values like |
130 // width/height/border/padding/... from the RenderStyle -> for SVG these val
ues would never scale, | 133 // width/height/border/padding/... from the RenderStyle -> for SVG these val
ues would never scale, |
131 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor
of 1.0 for specific | 134 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor
of 1.0 for specific |
132 // properties that are NOT allowed to scale within a zoomed SVG document (le
tter/word-spacing/font-size). | 135 // properties that are NOT allowed to scale within a zoomed SVG document (le
tter/word-spacing/font-size). |
133 bool useSVGZoomRules() const { return element() && element()->isSVGElement()
; } | 136 bool useSVGZoomRules() const { return element() && element()->isSVGElement()
; } |
134 | 137 |
135 private: | 138 private: |
136 friend class StyleResolveScope; | 139 friend class StyleResolveScope; |
137 | 140 |
138 ElementResolveContext m_elementContext; | 141 ElementResolveContext m_elementContext; |
139 Document& m_document; | 142 TreeScope& m_treeScope; |
140 | 143 |
141 // m_style is the primary output for each element's style resolve. | 144 // m_style is the primary output for each element's style resolve. |
142 RefPtr<RenderStyle> m_style; | 145 RefPtr<RenderStyle> m_style; |
143 | 146 |
144 CSSToLengthConversionData m_cssToLengthConversionData; | 147 CSSToLengthConversionData m_cssToLengthConversionData; |
145 | 148 |
146 // m_parentStyle is not always just element->parentNode()->style() | 149 // m_parentStyle is not always just element->parentNode()->style() |
147 // so we keep it separate from m_elementContext. | 150 // so we keep it separate from m_elementContext. |
148 RefPtr<RenderStyle> m_parentStyle; | 151 RefPtr<RenderStyle> m_parentStyle; |
149 | 152 |
(...skipping 18 matching lines...) Expand all Loading... |
168 // a back-pointer to this object. | 171 // a back-pointer to this object. |
169 CSSToStyleMap m_styleMap; | 172 CSSToStyleMap m_styleMap; |
170 Vector<AtomicString> m_contentAttrValues; | 173 Vector<AtomicString> m_contentAttrValues; |
171 | 174 |
172 StyleRule* m_currentRule; | 175 StyleRule* m_currentRule; |
173 }; | 176 }; |
174 | 177 |
175 } // namespace WebCore | 178 } // namespace WebCore |
176 | 179 |
177 #endif // StyleResolverState_h | 180 #endif // StyleResolverState_h |
OLD | NEW |