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: third_party/WebKit/Source/core/css/resolver/StyleResolverState.h

Issue 2450093005: Support display: contents for elements, first-line and first-letter pseudos. (Closed)
Patch Set: Support display: contents for elements, first-line and first-letter pseudos. Created 3 years, 10 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. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 class FontDescription; 44 class FontDescription;
45 45
46 class CORE_EXPORT StyleResolverState { 46 class CORE_EXPORT StyleResolverState {
47 STACK_ALLOCATED(); 47 STACK_ALLOCATED();
48 WTF_MAKE_NONCOPYABLE(StyleResolverState); 48 WTF_MAKE_NONCOPYABLE(StyleResolverState);
49 49
50 public: 50 public:
51 StyleResolverState(Document&, 51 StyleResolverState(Document&,
52 const ElementResolveContext&, 52 const ElementResolveContext&,
53 const ComputedStyle* parentStyle); 53 const ComputedStyle* parentStyle,
54 StyleResolverState(Document&, Element*, const ComputedStyle* parentStyle = 0); 54 const ComputedStyle* layoutParentStyle);
55 StyleResolverState(Document&,
56 Element*,
57 const ComputedStyle* parentStyle = nullptr,
58 const ComputedStyle* layoutParentStyle = nullptr);
55 ~StyleResolverState(); 59 ~StyleResolverState();
56 60
57 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to 61 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to
58 // grab the document from. This is why we have to store the document 62 // grab the document from. This is why we have to store the document
59 // separately. 63 // separately.
60 Document& document() const { return *m_document; } 64 Document& document() const { return *m_document; }
61 // These are all just pass-through methods to ElementResolveContext. 65 // These are all just pass-through methods to ElementResolveContext.
62 Element* element() const { return m_elementContext.element(); } 66 Element* element() const { return m_elementContext.element(); }
63 const ContainerNode* parentNode() const { 67 const ContainerNode* parentNode() const {
64 return m_elementContext.parentNode(); 68 return m_elementContext.parentNode();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 void setIsAnimatingCustomProperties(bool value) { 117 void setIsAnimatingCustomProperties(bool value) {
114 m_isAnimatingCustomProperties = value; 118 m_isAnimatingCustomProperties = value;
115 } 119 }
116 120
117 void setParentStyle(PassRefPtr<ComputedStyle> parentStyle) { 121 void setParentStyle(PassRefPtr<ComputedStyle> parentStyle) {
118 m_parentStyle = parentStyle; 122 m_parentStyle = parentStyle;
119 } 123 }
120 const ComputedStyle* parentStyle() const { return m_parentStyle.get(); } 124 const ComputedStyle* parentStyle() const { return m_parentStyle.get(); }
121 ComputedStyle* parentStyle() { return m_parentStyle.get(); } 125 ComputedStyle* parentStyle() { return m_parentStyle.get(); }
122 126
127 void setLayoutParentStyle(PassRefPtr<ComputedStyle> parentStyle) {
128 m_layoutParentStyle = parentStyle;
129 }
130 const ComputedStyle* layoutParentStyle() const {
131 return m_layoutParentStyle.get();
132 }
133
123 // FIXME: These are effectively side-channel "out parameters" for the various 134 // FIXME: These are effectively side-channel "out parameters" for the various
124 // map functions. When we map from CSS to style objects we use this state 135 // map functions. When we map from CSS to style objects we use this state
125 // object to track various meta-data about that mapping (e.g. if it's 136 // object to track various meta-data about that mapping (e.g. if it's
126 // cache-able). We need to move this data off of StyleResolverState and 137 // cache-able). We need to move this data off of StyleResolverState and
127 // closer to the objects it applies to. Possibly separating (immutable) inputs 138 // closer to the objects it applies to. Possibly separating (immutable) inputs
128 // from (mutable) outputs. 139 // from (mutable) outputs.
129 void setApplyPropertyToRegularStyle(bool isApply) { 140 void setApplyPropertyToRegularStyle(bool isApply) {
130 m_applyPropertyToRegularStyle = isApply; 141 m_applyPropertyToRegularStyle = isApply;
131 } 142 }
132 void setApplyPropertyToVisitedLinkStyle(bool isApply) { 143 void setApplyPropertyToVisitedLinkStyle(bool isApply) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 Member<Document> m_document; 220 Member<Document> m_document;
210 221
211 // m_style is the primary output for each element's style resolve. 222 // m_style is the primary output for each element's style resolve.
212 RefPtr<ComputedStyle> m_style; 223 RefPtr<ComputedStyle> m_style;
213 224
214 CSSToLengthConversionData m_cssToLengthConversionData; 225 CSSToLengthConversionData m_cssToLengthConversionData;
215 226
216 // m_parentStyle is not always just ElementResolveContext::parentStyle, 227 // m_parentStyle is not always just ElementResolveContext::parentStyle,
217 // so we keep it separate. 228 // so we keep it separate.
218 RefPtr<ComputedStyle> m_parentStyle; 229 RefPtr<ComputedStyle> m_parentStyle;
230 // This will almost-always be the same that m_parentStyle, except in the
231 // presence of display: contents. This is the style against which we have to
232 // do adjustment.
233 RefPtr<const ComputedStyle> m_layoutParentStyle;
219 234
220 CSSAnimationUpdate m_animationUpdate; 235 CSSAnimationUpdate m_animationUpdate;
221 bool m_isAnimationInterpolationMapReady; 236 bool m_isAnimationInterpolationMapReady;
222 bool m_isAnimatingCustomProperties; 237 bool m_isAnimatingCustomProperties;
223 238
224 bool m_applyPropertyToRegularStyle; 239 bool m_applyPropertyToRegularStyle;
225 bool m_applyPropertyToVisitedLinkStyle; 240 bool m_applyPropertyToVisitedLinkStyle;
226 bool m_hasDirAutoAttribute; 241 bool m_hasDirAutoAttribute;
227 242
228 FontBuilder m_fontBuilder; 243 FontBuilder m_fontBuilder;
229 244
230 std::unique_ptr<CachedUAStyle> m_cachedUAStyle; 245 std::unique_ptr<CachedUAStyle> m_cachedUAStyle;
231 246
232 ElementStyleResources m_elementStyleResources; 247 ElementStyleResources m_elementStyleResources;
233 248
234 HeapHashMap<String, Member<StylePropertySet>> 249 HeapHashMap<String, Member<StylePropertySet>>
235 m_customPropertySetsForApplyAtRule; 250 m_customPropertySetsForApplyAtRule;
236 251
237 mutable HeapHashMap< 252 mutable HeapHashMap<
238 Member<const CSSPendingSubstitutionValue>, 253 Member<const CSSPendingSubstitutionValue>,
239 Member<HeapHashMap<CSSPropertyID, Member<const CSSValue>>>> 254 Member<HeapHashMap<CSSPropertyID, Member<const CSSValue>>>>
240 m_parsedPropertiesForPendingSubstitutionCache; 255 m_parsedPropertiesForPendingSubstitutionCache;
241 }; 256 };
242 257
243 } // namespace blink 258 } // namespace blink
244 259
245 #endif // StyleResolverState_h 260 #endif // StyleResolverState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698