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

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: Adding a mitigation for the perf regression to Element::recalcStyle. 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
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 29 matching lines...) Expand all
40 class RenderRegion; 40 class RenderRegion;
41 41
42 typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap; 42 typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap;
43 typedef HashMap<FilterOperation*, RefPtr<CSSSVGDocumentValue> > PendingSVGDocume ntMap; 43 typedef HashMap<FilterOperation*, RefPtr<CSSSVGDocumentValue> > PendingSVGDocume ntMap;
44 44
45 class StyleResolverState { 45 class StyleResolverState {
46 WTF_MAKE_NONCOPYABLE(StyleResolverState); 46 WTF_MAKE_NONCOPYABLE(StyleResolverState);
47 public: 47 public:
48 StyleResolverState() 48 StyleResolverState()
49 : m_element(0) 49 : m_element(0)
50 , m_childIndex(0)
50 , m_styledElement(0) 51 , m_styledElement(0)
51 , m_parentNode(0) 52 , m_parentNode(0)
52 , m_parentStyle(0) 53 , m_parentStyle(0)
53 , m_rootElementStyle(0) 54 , m_rootElementStyle(0)
54 , m_regionForStyling(0) 55 , m_regionForStyling(0)
55 , m_elementLinkState(NotInsideLink) 56 , m_elementLinkState(NotInsideLink)
56 , m_distributedToInsertionPoint(false) 57 , m_distributedToInsertionPoint(false)
57 , m_elementAffectedByClassRules(false) 58 , m_elementAffectedByClassRules(false)
58 , m_applyPropertyToRegularStyle(true) 59 , m_applyPropertyToRegularStyle(true)
59 , m_applyPropertyToVisitedLinkStyle(false) 60 , m_applyPropertyToVisitedLinkStyle(false)
60 , m_hasPendingShaders(false) 61 , m_hasPendingShaders(false)
61 , m_lineHeightValue(0) 62 , m_lineHeightValue(0)
62 , m_fontDirty(false) 63 , m_fontDirty(false)
63 , m_hasUAAppearance(false) 64 , m_hasUAAppearance(false)
64 , m_backgroundData(BackgroundFillLayer) { } 65 , m_backgroundData(BackgroundFillLayer) { }
65 66
66 public: 67 public:
67 void initElement(Element*); 68 void initElement(Element*, int childIndex);
68 void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0); 69 void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0);
69 void clear(); 70 void clear();
70 71
71 Color colorFromPrimitiveValue(CSSPrimitiveValue*, bool forVisitedLink = fals e) const; 72 Color colorFromPrimitiveValue(CSSPrimitiveValue*, bool forVisitedLink = fals e) const;
72 73
73 Document* document() const { return m_element->document(); } 74 Document* document() const { return m_element->document(); }
74 Element* element() const { return m_element; } 75 Element* element() const { return m_element; }
76 int childIndex() const { return m_childIndex; }
75 Element* styledElement() const { return m_styledElement; } 77 Element* styledElement() const { return m_styledElement; }
76 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } 78 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; }
77 RenderStyle* style() const { return m_style.get(); } 79 RenderStyle* style() const { return m_style.get(); }
78 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } 80 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); }
79 81
80 const ContainerNode* parentNode() const { return m_parentNode; } 82 const ContainerNode* parentNode() const { return m_parentNode; }
81 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p arentStyle; } 83 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p arentStyle; }
82 RenderStyle* parentStyle() const { return m_parentStyle.get(); } 84 RenderStyle* parentStyle() const { return m_parentStyle.get(); }
83 RenderStyle* rootElementStyle() const { return m_rootElementStyle; } 85 RenderStyle* rootElementStyle() const { return m_rootElementStyle; }
84 86
(...skipping 28 matching lines...) Expand all
113 void setFontDescription(const FontDescription& fontDescription) { m_fontDirt y |= m_style->setFontDescription(fontDescription); } 115 void setFontDescription(const FontDescription& fontDescription) { m_fontDirt y |= m_style->setFontDescription(fontDescription); }
114 void setZoom(float f) { m_fontDirty |= m_style->setZoom(f); } 116 void setZoom(float f) { m_fontDirty |= m_style->setZoom(f); }
115 void setEffectiveZoom(float f) { m_fontDirty |= m_style->setEffectiveZoom(f) ; } 117 void setEffectiveZoom(float f) { m_fontDirty |= m_style->setEffectiveZoom(f) ; }
116 void setWritingMode(WritingMode writingMode) { m_fontDirty |= m_style->setWr itingMode(writingMode); } 118 void setWritingMode(WritingMode writingMode) { m_fontDirty |= m_style->setWr itingMode(writingMode); }
117 void setTextOrientation(TextOrientation textOrientation) { m_fontDirty |= m_ style->setTextOrientation(textOrientation); } 119 void setTextOrientation(TextOrientation textOrientation) { m_fontDirty |= m_ style->setTextOrientation(textOrientation); }
118 120
119 bool useSVGZoomRules() const { return m_element && m_element->isSVGElement() ; } 121 bool useSVGZoomRules() const { return m_element && m_element->isSVGElement() ; }
120 122
121 private: 123 private:
122 Element* m_element; 124 Element* m_element;
125 int m_childIndex;
123 RefPtr<RenderStyle> m_style; 126 RefPtr<RenderStyle> m_style;
124 Element* m_styledElement; 127 Element* m_styledElement;
125 ContainerNode* m_parentNode; 128 ContainerNode* m_parentNode;
126 RefPtr<RenderStyle> m_parentStyle; 129 RefPtr<RenderStyle> m_parentStyle;
127 RenderStyle* m_rootElementStyle; 130 RenderStyle* m_rootElementStyle;
128 131
129 // Required to ASSERT in applyProperties. 132 // Required to ASSERT in applyProperties.
130 RenderRegion* m_regionForStyling; 133 RenderRegion* m_regionForStyling;
131 134
132 EInsideLink m_elementLinkState; 135 EInsideLink m_elementLinkState;
(...skipping 13 matching lines...) Expand all
146 149
147 bool m_hasUAAppearance; 150 bool m_hasUAAppearance;
148 BorderData m_borderData; 151 BorderData m_borderData;
149 FillLayer m_backgroundData; 152 FillLayer m_backgroundData;
150 Color m_backgroundColor; 153 Color m_backgroundColor;
151 }; 154 };
152 155
153 } // namespace WebCore 156 } // namespace WebCore
154 157
155 #endif // StyleResolverState_h 158 #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