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

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

Issue 15871005: Avoid N^2 walk placing renderers when building the render tree (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Merging ToT Created 7 years, 6 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 class StyledElement; 43 class StyledElement;
44 44
45 typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap; 45 typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap;
46 typedef HashMap<FilterOperation*, RefPtr<CSSSVGDocumentValue> > PendingSVGDocume ntMap; 46 typedef HashMap<FilterOperation*, RefPtr<CSSSVGDocumentValue> > PendingSVGDocume ntMap;
47 47
48 class StyleResolverState { 48 class StyleResolverState {
49 WTF_MAKE_NONCOPYABLE(StyleResolverState); 49 WTF_MAKE_NONCOPYABLE(StyleResolverState);
50 public: 50 public:
51 StyleResolverState() 51 StyleResolverState()
52 : m_element(0) 52 : m_element(0)
53 , m_childIndex(0)
53 , m_styledElement(0) 54 , m_styledElement(0)
54 , m_parentNode(0) 55 , m_parentNode(0)
55 , m_parentStyle(0) 56 , m_parentStyle(0)
56 , m_rootElementStyle(0) 57 , m_rootElementStyle(0)
57 , m_regionForStyling(0) 58 , m_regionForStyling(0)
58 , m_elementLinkState(NotInsideLink) 59 , m_elementLinkState(NotInsideLink)
59 , m_distributedToInsertionPoint(false) 60 , m_distributedToInsertionPoint(false)
60 , m_elementAffectedByClassRules(false) 61 , m_elementAffectedByClassRules(false)
61 , m_applyPropertyToRegularStyle(true) 62 , m_applyPropertyToRegularStyle(true)
62 , m_applyPropertyToVisitedLinkStyle(false) 63 , m_applyPropertyToVisitedLinkStyle(false)
63 , m_hasPendingShaders(false) 64 , m_hasPendingShaders(false)
64 , m_lineHeightValue(0) 65 , m_lineHeightValue(0)
65 , m_fontDirty(false) 66 , m_fontDirty(false)
66 , m_hasUAAppearance(false) 67 , m_hasUAAppearance(false)
67 , m_backgroundData(BackgroundFillLayer) { } 68 , m_backgroundData(BackgroundFillLayer) { }
68 69
69 public: 70 public:
70 void initElement(Element*); 71 void initElement(Element*, int childIndex);
71 void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0); 72 void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0);
72 void clear(); 73 void clear();
73 74
74 Color colorFromPrimitiveValue(CSSPrimitiveValue*, bool forVisitedLink = fals e) const; 75 Color colorFromPrimitiveValue(CSSPrimitiveValue*, bool forVisitedLink = fals e) const;
75 76
76 Document* document() const { return m_element->document(); } 77 Document* document() const { return m_element->document(); }
77 Element* element() const { return m_element; } 78 Element* element() const { return m_element; }
79 int childIndex() const { return m_childIndex; }
78 StyledElement* styledElement() const { return m_styledElement; } 80 StyledElement* styledElement() const { return m_styledElement; }
79 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } 81 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; }
80 RenderStyle* style() const { return m_style.get(); } 82 RenderStyle* style() const { return m_style.get(); }
81 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } 83 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); }
82 84
83 const ContainerNode* parentNode() const { return m_parentNode; } 85 const ContainerNode* parentNode() const { return m_parentNode; }
84 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p arentStyle; } 86 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p arentStyle; }
85 RenderStyle* parentStyle() const { return m_parentStyle.get(); } 87 RenderStyle* parentStyle() const { return m_parentStyle.get(); }
86 RenderStyle* rootElementStyle() const { return m_rootElementStyle; } 88 RenderStyle* rootElementStyle() const { return m_rootElementStyle; }
87 89
(...skipping 28 matching lines...) Expand all
116 void setFontDescription(const FontDescription& fontDescription) { m_fontDirt y |= m_style->setFontDescription(fontDescription); } 118 void setFontDescription(const FontDescription& fontDescription) { m_fontDirt y |= m_style->setFontDescription(fontDescription); }
117 void setZoom(float f) { m_fontDirty |= m_style->setZoom(f); } 119 void setZoom(float f) { m_fontDirty |= m_style->setZoom(f); }
118 void setEffectiveZoom(float f) { m_fontDirty |= m_style->setEffectiveZoom(f) ; } 120 void setEffectiveZoom(float f) { m_fontDirty |= m_style->setEffectiveZoom(f) ; }
119 void setWritingMode(WritingMode writingMode) { m_fontDirty |= m_style->setWr itingMode(writingMode); } 121 void setWritingMode(WritingMode writingMode) { m_fontDirty |= m_style->setWr itingMode(writingMode); }
120 void setTextOrientation(TextOrientation textOrientation) { m_fontDirty |= m_ style->setTextOrientation(textOrientation); } 122 void setTextOrientation(TextOrientation textOrientation) { m_fontDirty |= m_ style->setTextOrientation(textOrientation); }
121 123
122 bool useSVGZoomRules() const { return m_element && m_element->isSVGElement() ; } 124 bool useSVGZoomRules() const { return m_element && m_element->isSVGElement() ; }
123 125
124 private: 126 private:
125 Element* m_element; 127 Element* m_element;
128 int m_childIndex;
126 RefPtr<RenderStyle> m_style; 129 RefPtr<RenderStyle> m_style;
127 StyledElement* m_styledElement; 130 StyledElement* m_styledElement;
128 ContainerNode* m_parentNode; 131 ContainerNode* m_parentNode;
129 RefPtr<RenderStyle> m_parentStyle; 132 RefPtr<RenderStyle> m_parentStyle;
130 RenderStyle* m_rootElementStyle; 133 RenderStyle* m_rootElementStyle;
131 134
132 // Required to ASSERT in applyProperties. 135 // Required to ASSERT in applyProperties.
133 RenderRegion* m_regionForStyling; 136 RenderRegion* m_regionForStyling;
134 137
135 EInsideLink m_elementLinkState; 138 EInsideLink m_elementLinkState;
(...skipping 13 matching lines...) Expand all
149 152
150 bool m_hasUAAppearance; 153 bool m_hasUAAppearance;
151 BorderData m_borderData; 154 BorderData m_borderData;
152 FillLayer m_backgroundData; 155 FillLayer m_backgroundData;
153 Color m_backgroundColor; 156 Color m_backgroundColor;
154 }; 157 };
155 158
156 } // namespace WebCore 159 } // namespace WebCore
157 160
158 #endif // StyleResolverState_h 161 #endif // StyleResolverState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698