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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.h

Issue 2672693002: Moved display property to be generated in ComputedStyleBase. (Closed)
Patch Set: Rebase Created 3 years, 9 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; 199 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles;
200 200
201 DataRef<SVGComputedStyle> m_svgStyle; 201 DataRef<SVGComputedStyle> m_svgStyle;
202 202
203 // !START SYNC!: Keep this in sync with the copy constructor in 203 // !START SYNC!: Keep this in sync with the copy constructor in
204 // ComputedStyle.cpp. 204 // ComputedStyle.cpp.
205 205
206 // don't inherit 206 // don't inherit
207 struct NonInheritedData { 207 struct NonInheritedData {
208 NonInheritedData() 208 NonInheritedData()
209 : m_effectiveDisplay(static_cast<unsigned>(initialDisplay())), 209 : m_originalDisplay(static_cast<unsigned>(initialDisplay())),
210 m_originalDisplay(static_cast<unsigned>(initialDisplay())),
211 m_verticalAlign(static_cast<unsigned>(initialVerticalAlign())), 210 m_verticalAlign(static_cast<unsigned>(initialVerticalAlign())),
212 m_hasViewportUnits(false), 211 m_hasViewportUnits(false),
213 m_hasRemUnits(false) {} 212 m_hasRemUnits(false) {}
214 213
215 // Compare computed styles, differences in inherited bits or other flags 214 // Compare computed styles, differences in inherited bits or other flags
216 // should not cause an inequality. 215 // should not cause an inequality.
217 bool operator==(const NonInheritedData& other) const { 216 bool operator==(const NonInheritedData& other) const {
218 // Generated properties are compared in ComputedStyleBase 217 // Generated properties are compared in ComputedStyleBase
219 return m_effectiveDisplay == other.m_effectiveDisplay && 218 return m_originalDisplay == other.m_originalDisplay &&
220 m_originalDisplay == other.m_originalDisplay &&
221 m_verticalAlign == other.m_verticalAlign; 219 m_verticalAlign == other.m_verticalAlign;
222 // Differences in the following fields do not cause inequality: 220 // Differences in the following fields do not cause inequality:
223 // hasViewportUnits 221 // hasViewportUnits
224 // styleType 222 // styleType
225 // pseudoBits 223 // pseudoBits
226 // explicitInheritance 224 // explicitInheritance
227 // unique 225 // unique
228 // emptyState 226 // emptyState
229 // affectedByFocus 227 // affectedByFocus
230 // affectedByHover 228 // affectedByHover
231 // affectedByActive 229 // affectedByActive
232 // affectedByDrag 230 // affectedByDrag
233 // isLink 231 // isLink
234 // isInherited flags 232 // isInherited flags
235 } 233 }
236 234
237 bool operator!=(const NonInheritedData& other) const { 235 bool operator!=(const NonInheritedData& other) const {
238 return !(*this == other); 236 return !(*this == other);
239 } 237 }
240 238
241 unsigned m_effectiveDisplay : 5; // EDisplay
242 unsigned m_originalDisplay : 5; // EDisplay 239 unsigned m_originalDisplay : 5; // EDisplay
243 unsigned m_verticalAlign : 4; // EVerticalAlign 240 unsigned m_verticalAlign : 4; // EVerticalAlign
244 241
245 // This is set if we used viewport units when resolving a length. 242 // This is set if we used viewport units when resolving a length.
246 // It is mutable so we can pass around const ComputedStyles to resolve 243 // It is mutable so we can pass around const ComputedStyles to resolve
247 // lengths. 244 // lengths.
248 mutable unsigned m_hasViewportUnits : 1; 245 mutable unsigned m_hasViewportUnits : 1;
249 246
250 mutable unsigned m_hasRemUnits : 1; 247 mutable unsigned m_hasRemUnits : 1;
251 248
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 SET_VAR(m_rareNonInheritedData, m_contain, contain); 793 SET_VAR(m_rareNonInheritedData, m_contain, contain);
797 } 794 }
798 795
799 // content 796 // content
800 ContentData* contentData() const { 797 ContentData* contentData() const {
801 return m_rareNonInheritedData->m_content.get(); 798 return m_rareNonInheritedData->m_content.get();
802 } 799 }
803 void setContent(ContentData*); 800 void setContent(ContentData*);
804 801
805 // display 802 // display
806 static EDisplay initialDisplay() { return EDisplay::kInline; }
807 EDisplay display() const {
808 return static_cast<EDisplay>(m_nonInheritedData.m_effectiveDisplay);
809 }
810 EDisplay originalDisplay() const { 803 EDisplay originalDisplay() const {
811 return static_cast<EDisplay>(m_nonInheritedData.m_originalDisplay); 804 return static_cast<EDisplay>(m_nonInheritedData.m_originalDisplay);
812 } 805 }
813 void setDisplay(EDisplay v) {
814 m_nonInheritedData.m_effectiveDisplay = static_cast<unsigned>(v);
815 }
816 void setOriginalDisplay(EDisplay v) { 806 void setOriginalDisplay(EDisplay v) {
817 m_nonInheritedData.m_originalDisplay = static_cast<unsigned>(v); 807 m_nonInheritedData.m_originalDisplay = static_cast<unsigned>(v);
818 } 808 }
819 809
820 // Flex properties. 810 // Flex properties.
821 // flex-basis (aka -webkit-flex-basis) 811 // flex-basis (aka -webkit-flex-basis)
822 static Length initialFlexBasis() { return Length(Auto); } 812 static Length initialFlexBasis() { return Length(Auto); }
823 const Length& flexBasis() const { 813 const Length& flexBasis() const {
824 return m_rareNonInheritedData->m_flexibleBox->m_flexBasis; 814 return m_rareNonInheritedData->m_flexibleBox->m_flexBasis;
825 } 815 }
(...skipping 2923 matching lines...) Expand 10 before | Expand all | Expand 10 after
3749 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); 3739 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId);
3750 } 3740 }
3751 3741
3752 inline bool ComputedStyle::hasPseudoElementStyle() const { 3742 inline bool ComputedStyle::hasPseudoElementStyle() const {
3753 return m_pseudoBits & ElementPseudoIdMask; 3743 return m_pseudoBits & ElementPseudoIdMask;
3754 } 3744 }
3755 3745
3756 } // namespace blink 3746 } // namespace blink
3757 3747
3758 #endif // ComputedStyle_h 3748 #endif // ComputedStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSValueIDMappings.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698