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

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: Again, updating to 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // FIXME(bug 108563): to make it easier to review, these member 127 // FIXME(bug 108563): to make it easier to review, these member
126 // variables are public. However we should add methods to access 128 // variables are public. However we should add methods to access
127 // these variables. 129 // these variables.
128 Element* m_element; 130 Element* m_element;
131 int m_childIndex;
129 RefPtr<RenderStyle> m_style; 132 RefPtr<RenderStyle> m_style;
130 StyledElement* m_styledElement; 133 StyledElement* m_styledElement;
131 ContainerNode* m_parentNode; 134 ContainerNode* m_parentNode;
132 RefPtr<RenderStyle> m_parentStyle; 135 RefPtr<RenderStyle> m_parentStyle;
133 RenderStyle* m_rootElementStyle; 136 RenderStyle* m_rootElementStyle;
134 137
135 // Required to ASSERT in applyProperties. 138 // Required to ASSERT in applyProperties.
136 RenderRegion* m_regionForStyling; 139 RenderRegion* m_regionForStyling;
137 140
138 EInsideLink m_elementLinkState; 141 EInsideLink m_elementLinkState;
(...skipping 13 matching lines...) Expand all
152 155
153 bool m_hasUAAppearance; 156 bool m_hasUAAppearance;
154 BorderData m_borderData; 157 BorderData m_borderData;
155 FillLayer m_backgroundData; 158 FillLayer m_backgroundData;
156 Color m_backgroundColor; 159 Color m_backgroundColor;
157 }; 160 };
158 161
159 } // namespace WebCore 162 } // namespace WebCore
160 163
161 #endif // StyleResolverState_h 164 #endif // StyleResolverState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698