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

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

Issue 18139007: Remove StyleResolverState::styledElement() since we can just check isHTMLElement() or isSVGElement() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add a comment 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 // ElementResolveContext is immutable and serves as an input to the style resolv e process. 42 // ElementResolveContext is immutable and serves as an input to the style resolv e process.
43 class ElementResolveContext { 43 class ElementResolveContext {
44 public: 44 public:
45 ElementResolveContext() 45 ElementResolveContext()
46 : m_element(0) 46 : m_element(0)
47 , m_styledElement(0)
48 , m_parentNode(0) 47 , m_parentNode(0)
49 , m_rootElementStyle(0) 48 , m_rootElementStyle(0)
50 , m_elementLinkState(NotInsideLink) 49 , m_elementLinkState(NotInsideLink)
51 , m_distributedToInsertionPoint(false) 50 , m_distributedToInsertionPoint(false)
52 , m_resetStyleInheritance(false) 51 , m_resetStyleInheritance(false)
53 { 52 {
54 } 53 }
55 54
56 explicit ElementResolveContext(Element*); 55 explicit ElementResolveContext(Element*);
57 56
58 // FIXME: This should be removed, this exists to avoid changing behavior 57 // FIXME: This should be removed, this exists to avoid changing behavior
59 // while refactoring, but callers should just assign a null context instead. 58 // while refactoring, but callers should just assign a null context instead.
60 // FIXME: This is the only method making this class not immutable! 59 // FIXME: This is the only method making this class not immutable!
61 void deprecatedPartialClear() 60 void deprecatedPartialClear()
62 { 61 {
63 m_element = 0; 62 m_element = 0;
64 m_styledElement = 0;
65 m_parentNode = 0; 63 m_parentNode = 0;
66 } 64 }
67 65
68 Document* document() const { return m_element->document(); } 66 Document* document() const { return m_element->document(); }
69 bool isDocumentElement() const { return m_element && m_element == m_element- >document()->documentElement(); } 67 bool isDocumentElement() const { return m_element && m_element == m_element- >document()->documentElement(); }
70 68
71 Element* element() const { return m_element; } 69 Element* element() const { return m_element; }
72 Element* styledElement() const { return m_styledElement; }
73 const ContainerNode* parentNode() const { return m_parentNode; } 70 const ContainerNode* parentNode() const { return m_parentNode; }
74 RenderStyle* rootElementStyle() const { return m_rootElementStyle; } 71 RenderStyle* rootElementStyle() const { return m_rootElementStyle; }
75 EInsideLink elementLinkState() const { return m_elementLinkState; } 72 EInsideLink elementLinkState() const { return m_elementLinkState; }
76 bool distributedToInsertionPoint() const { return m_distributedToInsertionPo int; } 73 bool distributedToInsertionPoint() const { return m_distributedToInsertionPo int; }
77 bool resetStyleInheritance() const { return m_resetStyleInheritance; } 74 bool resetStyleInheritance() const { return m_resetStyleInheritance; }
78 75
79 private: 76 private:
80 Element* m_element; 77 Element* m_element;
81 Element* m_styledElement;
82 ContainerNode* m_parentNode; 78 ContainerNode* m_parentNode;
83 RenderStyle* m_rootElementStyle; 79 RenderStyle* m_rootElementStyle;
84 EInsideLink m_elementLinkState; 80 EInsideLink m_elementLinkState;
85 bool m_distributedToInsertionPoint; 81 bool m_distributedToInsertionPoint;
86 bool m_resetStyleInheritance; 82 bool m_resetStyleInheritance;
87 }; 83 };
88 84
89 class StyleResolverState { 85 class StyleResolverState {
90 WTF_MAKE_NONCOPYABLE(StyleResolverState); 86 WTF_MAKE_NONCOPYABLE(StyleResolverState);
91 public: 87 public:
92 StyleResolverState() 88 StyleResolverState()
93 : m_regionForStyling(0) 89 : m_regionForStyling(0)
94 , m_applyPropertyToRegularStyle(true) 90 , m_applyPropertyToRegularStyle(true)
95 , m_applyPropertyToVisitedLinkStyle(false) 91 , m_applyPropertyToVisitedLinkStyle(false)
96 , m_lineHeightValue(0) 92 , m_lineHeightValue(0)
97 , m_fontDirty(false) 93 , m_fontDirty(false)
98 , m_styleMap(*this, m_elementStyleResources) 94 , m_styleMap(*this, m_elementStyleResources)
99 { } 95 { }
100 96
101 void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0); 97 void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0);
102 void clear(); 98 void clear();
103 99
104 // These are all just pass-through methods to ElementResolveContext. 100 // These are all just pass-through methods to ElementResolveContext.
105 Document* document() const { return m_elementContext.document(); } 101 Document* document() const { return m_elementContext.document(); }
106 Element* element() const { return m_elementContext.element(); } 102 Element* element() const { return m_elementContext.element(); }
107 Element* styledElement() const { return m_elementContext.styledElement(); }
108 const ContainerNode* parentNode() const { return m_elementContext.parentNode (); } 103 const ContainerNode* parentNode() const { return m_elementContext.parentNode (); }
109 RenderStyle* rootElementStyle() const { return m_elementContext.rootElementS tyle(); } 104 RenderStyle* rootElementStyle() const { return m_elementContext.rootElementS tyle(); }
110 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt ate(); } 105 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt ate(); }
111 bool distributedToInsertionPoint() const { return m_elementContext.distribut edToInsertionPoint(); } 106 bool distributedToInsertionPoint() const { return m_elementContext.distribut edToInsertionPoint(); }
112 107
113 const ElementResolveContext elementContext() const { return m_elementContext ; } 108 const ElementResolveContext elementContext() const { return m_elementContext ; }
114 109
115 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } 110 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; }
116 RenderStyle* style() const { return m_style.get(); } 111 RenderStyle* style() const { return m_style.get(); }
117 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } 112 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 208
214 ElementStyleResources m_elementStyleResources; 209 ElementStyleResources m_elementStyleResources;
215 // CSSToStyleMap is a pure-logic class and only contains 210 // CSSToStyleMap is a pure-logic class and only contains
216 // a back-pointer to this object. 211 // a back-pointer to this object.
217 CSSToStyleMap m_styleMap; 212 CSSToStyleMap m_styleMap;
218 }; 213 };
219 214
220 } // namespace WebCore 215 } // namespace WebCore
221 216
222 #endif // StyleResolverState_h 217 #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