Chromium Code Reviews| 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 24 matching lines...) Expand all Loading... | |
| 35 #include "core/rendering/style/StyleInheritedData.h" | 35 #include "core/rendering/style/StyleInheritedData.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 class FontDescription; | 39 class FontDescription; |
| 40 class RenderRegion; | 40 class RenderRegion; |
| 41 | 41 |
| 42 class StyleResolverState { | 42 class StyleResolverState { |
| 43 WTF_MAKE_NONCOPYABLE(StyleResolverState); | 43 WTF_MAKE_NONCOPYABLE(StyleResolverState); |
| 44 public: | 44 public: |
| 45 StyleResolverState(const Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0); | 45 StyleResolverState(Document*, Element*, RenderStyle* parentStyle = 0, Render Region* regionForStyling = 0); |
| 46 ~StyleResolverState(); | 46 ~StyleResolverState(); |
| 47 | 47 |
| 48 // In FontLoader and CanvasRenderingContext2D, we don't have an element to g rab the document from. | |
| 49 // This is why we have to store the document separately. | |
| 50 Document* document() const { return m_document; } | |
|
dglazkov
2013/08/01 22:19:41
This is where things got a bit funky. StyleResolve
eseidel
2013/08/01 22:53:48
Seems like we should have a bug filed, or some sor
| |
| 48 // These are all just pass-through methods to ElementResolveContext. | 51 // These are all just pass-through methods to ElementResolveContext. |
| 49 Document* document() const { return m_elementContext.document(); } | |
| 50 Element* element() const { return m_elementContext.element(); } | 52 Element* element() const { return m_elementContext.element(); } |
| 51 const ContainerNode* parentNode() const { return m_elementContext.parentNode (); } | 53 const ContainerNode* parentNode() const { return m_elementContext.parentNode (); } |
| 52 const RenderStyle* rootElementStyle() const { return m_elementContext.rootEl ementStyle(); } | 54 const RenderStyle* rootElementStyle() const { return m_elementContext.rootEl ementStyle(); } |
| 53 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt ate(); } | 55 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt ate(); } |
| 54 bool distributedToInsertionPoint() const { return m_elementContext.distribut edToInsertionPoint(); } | 56 bool distributedToInsertionPoint() const { return m_elementContext.distribut edToInsertionPoint(); } |
| 55 | 57 |
| 56 const ElementResolveContext& elementContext() const { return m_elementContex t; } | 58 const ElementResolveContext& elementContext() const { return m_elementContex t; } |
| 57 | 59 |
| 58 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } | 60 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } |
| 59 const RenderStyle* style() const { return m_style.get(); } | 61 const RenderStyle* style() const { return m_style.get(); } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 // width/height/border/padding/... from the RenderStyle -> for SVG these val ues would never scale, | 119 // width/height/border/padding/... from the RenderStyle -> for SVG these val ues would never scale, |
| 118 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific | 120 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific |
| 119 // properties that are NOT allowed to scale within a zoomed SVG document (le tter/word-spacing/font-size). | 121 // properties that are NOT allowed to scale within a zoomed SVG document (le tter/word-spacing/font-size). |
| 120 bool useSVGZoomRules() const { return element() && element()->isSVGElement() ; } | 122 bool useSVGZoomRules() const { return element() && element()->isSVGElement() ; } |
| 121 | 123 |
| 122 private: | 124 private: |
| 123 friend class StyleResolveScope; | 125 friend class StyleResolveScope; |
| 124 | 126 |
| 125 void initElement(Element*); | 127 void initElement(Element*); |
| 126 | 128 |
| 129 Document* m_document; | |
| 127 ElementResolveContext m_elementContext; | 130 ElementResolveContext m_elementContext; |
| 128 | 131 |
| 129 // m_style is the primary output for each element's style resolve. | 132 // m_style is the primary output for each element's style resolve. |
| 130 RefPtr<RenderStyle> m_style; | 133 RefPtr<RenderStyle> m_style; |
| 131 | 134 |
| 132 // m_parentStyle is not always just element->parentNode()->style() | 135 // m_parentStyle is not always just element->parentNode()->style() |
| 133 // so we keep it separate from m_elementContext. | 136 // so we keep it separate from m_elementContext. |
| 134 RefPtr<RenderStyle> m_parentStyle; | 137 RefPtr<RenderStyle> m_parentStyle; |
| 135 | 138 |
| 136 // Required to ASSERT in applyProperties. | 139 // Required to ASSERT in applyProperties. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 150 ElementStyleResources m_elementStyleResources; | 153 ElementStyleResources m_elementStyleResources; |
| 151 // CSSToStyleMap is a pure-logic class and only contains | 154 // CSSToStyleMap is a pure-logic class and only contains |
| 152 // a back-pointer to this object. | 155 // a back-pointer to this object. |
| 153 CSSToStyleMap m_styleMap; | 156 CSSToStyleMap m_styleMap; |
| 154 Vector<AtomicString> m_contentAttrValues; | 157 Vector<AtomicString> m_contentAttrValues; |
| 155 }; | 158 }; |
| 156 | 159 |
| 157 } // namespace WebCore | 160 } // namespace WebCore |
| 158 | 161 |
| 159 #endif // StyleResolverState_h | 162 #endif // StyleResolverState_h |
| OLD | NEW |