Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: Source/core/css/resolver/StyleResolverState.h

Issue 18276003: Avoid N^2 walk placing renderers when building the render tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removing extra parens (whoops) Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 26 matching lines...) Expand all
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() 45 StyleResolverState()
46 : m_element(0) 46 : m_element(0)
47 , m_childIndex(0)
47 , m_styledElement(0) 48 , m_styledElement(0)
48 , m_parentNode(0) 49 , m_parentNode(0)
49 , m_parentStyle(0) 50 , m_parentStyle(0)
50 , m_rootElementStyle(0) 51 , m_rootElementStyle(0)
51 , m_regionForStyling(0) 52 , m_regionForStyling(0)
52 , m_elementLinkState(NotInsideLink) 53 , m_elementLinkState(NotInsideLink)
53 , m_distributedToInsertionPoint(false) 54 , m_distributedToInsertionPoint(false)
54 , m_elementAffectedByClassRules(false) 55 , m_elementAffectedByClassRules(false)
55 , m_applyPropertyToRegularStyle(true) 56 , m_applyPropertyToRegularStyle(true)
56 , m_applyPropertyToVisitedLinkStyle(false) 57 , m_applyPropertyToVisitedLinkStyle(false)
57 , m_lineHeightValue(0) 58 , m_lineHeightValue(0)
58 , m_fontDirty(false) 59 , m_fontDirty(false)
59 , m_styleMap(*this, m_elementStyleResources) 60 , m_styleMap(*this, m_elementStyleResources)
60 { } 61 { }
61 62
62 public: 63 void initForStyleResolve(Document*, Element*, int childIndex = 0, RenderStyl e* parentStyle = 0, RenderRegion* regionForStyling = 0);
63 void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0);
64 void clear(); 64 void clear();
65 65
66 Document* document() const { return m_element->document(); } 66 Document* document() const { return m_element->document(); }
67 Element* element() const { return m_element; } 67 Element* element() const { return m_element; }
68 int childIndex() const { return m_childIndex; }
68 Element* styledElement() const { return m_styledElement; } 69 Element* styledElement() const { return m_styledElement; }
69 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } 70 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; }
70 RenderStyle* style() const { return m_style.get(); } 71 RenderStyle* style() const { return m_style.get(); }
71 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } 72 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); }
72 73
73 const ContainerNode* parentNode() const { return m_parentNode; } 74 const ContainerNode* parentNode() const { return m_parentNode; }
74 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p arentStyle; } 75 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p arentStyle; }
75 RenderStyle* parentStyle() const { return m_parentStyle.get(); } 76 RenderStyle* parentStyle() const { return m_parentStyle.get(); }
76 RenderStyle* rootElementStyle() const { return m_rootElementStyle; } 77 RenderStyle* rootElementStyle() const { return m_rootElementStyle; }
77 78
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // of each individual length value in the render style / tree. CSSPrimitiveV alue::computeLength*() 135 // of each individual length value in the render style / tree. CSSPrimitiveV alue::computeLength*()
135 // multiplies each resolved length with the zoom multiplier - so for SVG we need to disable that. 136 // multiplies each resolved length with the zoom multiplier - so for SVG we need to disable that.
136 // Though all CSS values that can be applied to outermost <svg> elements (wi dth/height/border/padding...) 137 // Though all CSS values that can be applied to outermost <svg> elements (wi dth/height/border/padding...)
137 // need to respect the scaling. RenderBox (the parent class of RenderSVGRoot ) grabs values like 138 // need to respect the scaling. RenderBox (the parent class of RenderSVGRoot ) grabs values like
138 // width/height/border/padding/... from the RenderStyle -> for SVG these val ues would never scale, 139 // width/height/border/padding/... from the RenderStyle -> for SVG these val ues would never scale,
139 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific 140 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific
140 // properties that are NOT allowed to scale within a zoomed SVG document (le tter/word-spacing/font-size). 141 // properties that are NOT allowed to scale within a zoomed SVG document (le tter/word-spacing/font-size).
141 bool useSVGZoomRules() const { return m_element && m_element->isSVGElement() ; } 142 bool useSVGZoomRules() const { return m_element && m_element->isSVGElement() ; }
142 143
143 private: 144 private:
144 void initElement(Element*); 145 void initElement(Element*, int childIndex);
145 146
146 Element* m_element; 147 Element* m_element;
148 int m_childIndex;
147 RefPtr<RenderStyle> m_style; 149 RefPtr<RenderStyle> m_style;
148 Element* m_styledElement; 150 Element* m_styledElement;
149 ContainerNode* m_parentNode; 151 ContainerNode* m_parentNode;
150 RefPtr<RenderStyle> m_parentStyle; 152 RefPtr<RenderStyle> m_parentStyle;
151 RenderStyle* m_rootElementStyle; 153 RenderStyle* m_rootElementStyle;
152 154
153 // Required to ASSERT in applyProperties. 155 // Required to ASSERT in applyProperties.
154 RenderRegion* m_regionForStyling; 156 RenderRegion* m_regionForStyling;
155 157
156 EInsideLink m_elementLinkState; 158 EInsideLink m_elementLinkState;
(...skipping 11 matching lines...) Expand all
168 CachedUAStyle m_cachedUAStyle; 170 CachedUAStyle m_cachedUAStyle;
169 ElementStyleResources m_elementStyleResources; 171 ElementStyleResources m_elementStyleResources;
170 // CSSToStyleMap is a pure-logic class and only contains 172 // CSSToStyleMap is a pure-logic class and only contains
171 // a back-pointer to this object. 173 // a back-pointer to this object.
172 CSSToStyleMap m_styleMap; 174 CSSToStyleMap m_styleMap;
173 }; 175 };
174 176
175 } // namespace WebCore 177 } // namespace WebCore
176 178
177 #endif // StyleResolverState_h 179 #endif // StyleResolverState_h
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | Source/core/css/resolver/StyleResolverState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698