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

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

Issue 2766973002: Generate nonproperty originalDisplay in ComputedStyleBase. (Closed)
Patch Set: Rebase Created 3 years, 8 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_originalDisplay(static_cast<unsigned>(initialDisplay())), 209 : m_verticalAlign(static_cast<unsigned>(initialVerticalAlign())),
210 m_verticalAlign(static_cast<unsigned>(initialVerticalAlign())),
211 m_hasViewportUnits(false), 210 m_hasViewportUnits(false),
212 m_hasRemUnits(false) {} 211 m_hasRemUnits(false) {}
213 212
214 // Compare computed styles, differences in inherited bits or other flags 213 // Compare computed styles, differences in inherited bits or other flags
215 // should not cause an inequality. 214 // should not cause an inequality.
216 bool operator==(const NonInheritedData& other) const { 215 bool operator==(const NonInheritedData& other) const {
217 // Generated properties are compared in ComputedStyleBase 216 // Generated properties are compared in ComputedStyleBase
218 return m_originalDisplay == other.m_originalDisplay && 217 return m_verticalAlign == other.m_verticalAlign;
219 m_verticalAlign == other.m_verticalAlign;
220 // Differences in the following fields do not cause inequality: 218 // Differences in the following fields do not cause inequality:
221 // hasViewportUnits 219 // hasViewportUnits
222 // styleType 220 // styleType
223 // pseudoBits 221 // pseudoBits
224 // explicitInheritance 222 // explicitInheritance
225 // unique 223 // unique
226 // emptyState 224 // emptyState
227 // affectedByFocus 225 // affectedByFocus
228 // affectedByHover 226 // affectedByHover
229 // affectedByActive 227 // affectedByActive
230 // affectedByDrag 228 // affectedByDrag
231 // isLink 229 // isLink
232 // isInherited flags 230 // isInherited flags
233 } 231 }
234 232
235 bool operator!=(const NonInheritedData& other) const { 233 bool operator!=(const NonInheritedData& other) const {
236 return !(*this == other); 234 return !(*this == other);
237 } 235 }
238 236
239 unsigned m_originalDisplay : 5; // EDisplay
240 unsigned m_verticalAlign : 4; // EVerticalAlign 237 unsigned m_verticalAlign : 4; // EVerticalAlign
241 238
242 // This is set if we used viewport units when resolving a length. 239 // This is set if we used viewport units when resolving a length.
243 // It is mutable so we can pass around const ComputedStyles to resolve 240 // It is mutable so we can pass around const ComputedStyles to resolve
244 // lengths. 241 // lengths.
245 mutable unsigned m_hasViewportUnits : 1; 242 mutable unsigned m_hasViewportUnits : 1;
246 243
247 mutable unsigned m_hasRemUnits : 1; 244 mutable unsigned m_hasRemUnits : 1;
248 245
249 // If you add more style bits here, you will also need to update 246 // If you add more style bits here, you will also need to update
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 void setContain(Containment contain) { 789 void setContain(Containment contain) {
793 SET_VAR(m_rareNonInheritedData, m_contain, contain); 790 SET_VAR(m_rareNonInheritedData, m_contain, contain);
794 } 791 }
795 792
796 // content 793 // content
797 ContentData* contentData() const { 794 ContentData* contentData() const {
798 return m_rareNonInheritedData->m_content.get(); 795 return m_rareNonInheritedData->m_content.get();
799 } 796 }
800 void setContent(ContentData*); 797 void setContent(ContentData*);
801 798
802 // display
803 EDisplay originalDisplay() const {
804 return static_cast<EDisplay>(m_nonInheritedData.m_originalDisplay);
805 }
806 void setOriginalDisplay(EDisplay v) {
807 m_nonInheritedData.m_originalDisplay = static_cast<unsigned>(v);
808 }
809
810 // Flex properties. 799 // Flex properties.
811 // flex-basis (aka -webkit-flex-basis) 800 // flex-basis (aka -webkit-flex-basis)
812 static Length initialFlexBasis() { return Length(Auto); } 801 static Length initialFlexBasis() { return Length(Auto); }
813 const Length& flexBasis() const { 802 const Length& flexBasis() const {
814 return m_rareNonInheritedData->m_flexibleBox->m_flexBasis; 803 return m_rareNonInheritedData->m_flexibleBox->m_flexBasis;
815 } 804 }
816 void setFlexBasis(const Length& length) { 805 void setFlexBasis(const Length& length) {
817 SET_NESTED_VAR(m_rareNonInheritedData, m_flexibleBox, m_flexBasis, length); 806 SET_NESTED_VAR(m_rareNonInheritedData, m_flexibleBox, m_flexBasis, length);
818 } 807 }
819 808
(...skipping 2919 matching lines...) Expand 10 before | Expand all | Expand 10 after
3739 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); 3728 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId);
3740 } 3729 }
3741 3730
3742 inline bool ComputedStyle::hasPseudoElementStyle() const { 3731 inline bool ComputedStyle::hasPseudoElementStyle() const {
3743 return m_pseudoBits & ElementPseudoIdMask; 3732 return m_pseudoBits & ElementPseudoIdMask;
3744 } 3733 }
3745 3734
3746 } // namespace blink 3735 } // namespace blink
3747 3736
3748 #endif // ComputedStyle_h 3737 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698