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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 , m_elementLinkState(NotInsideLink) | 53 , m_elementLinkState(NotInsideLink) |
| 54 , m_distributedToInsertionPoint(false) | 54 , m_distributedToInsertionPoint(false) |
| 55 , m_elementAffectedByClassRules(false) | 55 , m_elementAffectedByClassRules(false) |
| 56 , m_applyPropertyToRegularStyle(true) | 56 , m_applyPropertyToRegularStyle(true) |
| 57 , m_applyPropertyToVisitedLinkStyle(false) | 57 , m_applyPropertyToVisitedLinkStyle(false) |
| 58 , m_lineHeightValue(0) | 58 , m_lineHeightValue(0) |
| 59 , m_fontDirty(false) | 59 , m_fontDirty(false) |
| 60 , m_styleMap(*this, m_elementStyleResources) | 60 , m_styleMap(*this, m_elementStyleResources) |
| 61 { } | 61 { } |
| 62 | 62 |
| 63 void initForStyleResolve(Document*, Element*, int childIndex = 0, RenderStyl e* parentStyle = 0, RenderRegion* regionForStyling = 0); | 63 public: |
| 64 void clear(); | 64 class ScopedStyleResolution { |
|
dglazkov
2013/07/12 16:45:47
Can we un-nest this?
Jeffrey Yasskin
2013/07/12 19:41:28
Yep, done.
| |
| 65 public: | |
| 66 ScopedStyleResolution(StyleResolverState*, Document*, Element*, int chil dIndex = 0, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0); | |
| 67 ~ScopedStyleResolution(); | |
| 68 private: | |
| 69 StyleResolverState* m_state; | |
| 70 }; | |
| 65 | 71 |
| 66 Document* document() const { return m_element->document(); } | 72 Document* document() const { return m_element->document(); } |
| 67 Element* element() const { return m_element; } | 73 Element* element() const { return m_element; } |
| 68 int childIndex() const { return m_childIndex; } | 74 int childIndex() const { return m_childIndex; } |
| 69 Element* styledElement() const { return m_styledElement; } | 75 Element* styledElement() const { return m_styledElement; } |
| 70 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } | 76 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } |
| 71 RenderStyle* style() const { return m_style.get(); } | 77 RenderStyle* style() const { return m_style.get(); } |
| 72 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } | 78 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } |
| 73 | 79 |
| 74 const ContainerNode* parentNode() const { return m_parentNode; } | 80 const ContainerNode* parentNode() const { return m_parentNode; } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 // of each individual length value in the render style / tree. CSSPrimitiveV alue::computeLength*() | 141 // of each individual length value in the render style / tree. CSSPrimitiveV alue::computeLength*() |
| 136 // multiplies each resolved length with the zoom multiplier - so for SVG we need to disable that. | 142 // multiplies each resolved length with the zoom multiplier - so for SVG we need to disable that. |
| 137 // Though all CSS values that can be applied to outermost <svg> elements (wi dth/height/border/padding...) | 143 // Though all CSS values that can be applied to outermost <svg> elements (wi dth/height/border/padding...) |
| 138 // need to respect the scaling. RenderBox (the parent class of RenderSVGRoot ) grabs values like | 144 // need to respect the scaling. RenderBox (the parent class of RenderSVGRoot ) grabs values like |
| 139 // width/height/border/padding/... from the RenderStyle -> for SVG these val ues would never scale, | 145 // width/height/border/padding/... from the RenderStyle -> for SVG these val ues would never scale, |
| 140 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific | 146 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific |
| 141 // properties that are NOT allowed to scale within a zoomed SVG document (le tter/word-spacing/font-size). | 147 // properties that are NOT allowed to scale within a zoomed SVG document (le tter/word-spacing/font-size). |
| 142 bool useSVGZoomRules() const { return m_element && m_element->isSVGElement() ; } | 148 bool useSVGZoomRules() const { return m_element && m_element->isSVGElement() ; } |
| 143 | 149 |
| 144 private: | 150 private: |
| 151 void initForStyleResolve(Document*, Element*, int childIndex = 0, RenderStyl e* parentStyle = 0, RenderRegion* regionForStyling = 0); | |
| 152 void clear(); | |
| 153 | |
| 145 void initElement(Element*, int childIndex); | 154 void initElement(Element*, int childIndex); |
| 146 | 155 |
| 147 Element* m_element; | 156 Element* m_element; |
| 148 int m_childIndex; | 157 int m_childIndex; |
| 149 RefPtr<RenderStyle> m_style; | 158 RefPtr<RenderStyle> m_style; |
| 150 Element* m_styledElement; | 159 Element* m_styledElement; |
| 151 ContainerNode* m_parentNode; | 160 ContainerNode* m_parentNode; |
| 152 RefPtr<RenderStyle> m_parentStyle; | 161 RefPtr<RenderStyle> m_parentStyle; |
| 153 RenderStyle* m_rootElementStyle; | 162 RenderStyle* m_rootElementStyle; |
| 154 | 163 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 170 CachedUAStyle m_cachedUAStyle; | 179 CachedUAStyle m_cachedUAStyle; |
| 171 ElementStyleResources m_elementStyleResources; | 180 ElementStyleResources m_elementStyleResources; |
| 172 // CSSToStyleMap is a pure-logic class and only contains | 181 // CSSToStyleMap is a pure-logic class and only contains |
| 173 // a back-pointer to this object. | 182 // a back-pointer to this object. |
| 174 CSSToStyleMap m_styleMap; | 183 CSSToStyleMap m_styleMap; |
| 175 }; | 184 }; |
| 176 | 185 |
| 177 } // namespace WebCore | 186 } // namespace WebCore |
| 178 | 187 |
| 179 #endif // StyleResolverState_h | 188 #endif // StyleResolverState_h |
| OLD | NEW |