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

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

Issue 2775573002: Generate keyword part of vertical-align property 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // list of associated pseudo styles 198 // list of associated pseudo styles
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() : m_hasViewportUnits(false), m_hasRemUnits(false) {}
209 : m_verticalAlign(static_cast<unsigned>(initialVerticalAlign())),
210 m_hasViewportUnits(false),
211 m_hasRemUnits(false) {}
212 209
213 // Compare computed styles, differences in inherited bits or other flags 210 // Compare computed styles, differences in inherited bits or other flags
214 // should not cause an inequality. 211 // should not cause an inequality.
215 bool operator==(const NonInheritedData& other) const { 212 bool operator==(const NonInheritedData& other) const {
216 // Generated properties are compared in ComputedStyleBase 213 // Generated properties are compared in ComputedStyleBase
217 return m_verticalAlign == other.m_verticalAlign; 214 return true;
218 // Differences in the following fields do not cause inequality: 215 // Differences in the following fields do not cause inequality:
219 // hasViewportUnits 216 // hasViewportUnits
220 // styleType 217 // styleType
221 // pseudoBits 218 // pseudoBits
222 // explicitInheritance 219 // explicitInheritance
223 // unique 220 // unique
224 // emptyState 221 // emptyState
225 // affectedByFocus 222 // affectedByFocus
226 // affectedByHover 223 // affectedByHover
227 // affectedByActive 224 // affectedByActive
228 // affectedByDrag 225 // affectedByDrag
229 // isLink 226 // isLink
230 // isInherited flags 227 // isInherited flags
231 } 228 }
232 229
233 bool operator!=(const NonInheritedData& other) const { 230 bool operator!=(const NonInheritedData& other) const {
234 return !(*this == other); 231 return !(*this == other);
235 } 232 }
236 233
237 unsigned m_verticalAlign : 4; // EVerticalAlign
238
239 // This is set if we used viewport units when resolving a length. 234 // This is set if we used viewport units when resolving a length.
240 // It is mutable so we can pass around const ComputedStyles to resolve 235 // It is mutable so we can pass around const ComputedStyles to resolve
241 // lengths. 236 // lengths.
242 mutable unsigned m_hasViewportUnits : 1; 237 mutable unsigned m_hasViewportUnits : 1;
243 238
244 mutable unsigned m_hasRemUnits : 1; 239 mutable unsigned m_hasRemUnits : 1;
245 240
246 // If you add more style bits here, you will also need to update 241 // If you add more style bits here, you will also need to update
247 // ComputedStyle::copyNonInheritedFromCached() 68 bits 242 // ComputedStyle::copyNonInheritedFromCached() 68 bits
248 } m_nonInheritedData; 243 } m_nonInheritedData;
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 } 1664 }
1670 void setTouchAction(TouchAction t) { 1665 void setTouchAction(TouchAction t) {
1671 SET_VAR(m_rareNonInheritedData, m_touchAction, t); 1666 SET_VAR(m_rareNonInheritedData, m_touchAction, t);
1672 } 1667 }
1673 1668
1674 // vertical-align 1669 // vertical-align
1675 static EVerticalAlign initialVerticalAlign() { 1670 static EVerticalAlign initialVerticalAlign() {
1676 return EVerticalAlign::kBaseline; 1671 return EVerticalAlign::kBaseline;
1677 } 1672 }
1678 EVerticalAlign verticalAlign() const { 1673 EVerticalAlign verticalAlign() const {
1679 return static_cast<EVerticalAlign>(m_nonInheritedData.m_verticalAlign); 1674 return static_cast<EVerticalAlign>(m_verticalAlign);
1680 } 1675 }
1681 const Length& getVerticalAlignLength() const { 1676 const Length& getVerticalAlignLength() const {
1682 return m_box->verticalAlign(); 1677 return m_box->verticalAlign();
1683 } 1678 }
1684 void setVerticalAlign(EVerticalAlign v) { 1679 void setVerticalAlign(EVerticalAlign v) {
1685 m_nonInheritedData.m_verticalAlign = static_cast<unsigned>(v); 1680 m_verticalAlign = static_cast<unsigned>(v);
1686 } 1681 }
1687 void setVerticalAlignLength(const Length& length) { 1682 void setVerticalAlignLength(const Length& length) {
1688 setVerticalAlign(EVerticalAlign::kLength); 1683 setVerticalAlign(EVerticalAlign::kLength);
1689 SET_VAR(m_box, m_verticalAlign, length); 1684 SET_VAR(m_box, m_verticalAlign, length);
1690 } 1685 }
1691 1686
1692 // will-change 1687 // will-change
1693 const Vector<CSSPropertyID>& willChangeProperties() const { 1688 const Vector<CSSPropertyID>& willChangeProperties() const {
1694 return m_rareNonInheritedData->m_willChange->m_properties; 1689 return m_rareNonInheritedData->m_willChange->m_properties;
1695 } 1690 }
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after
3728 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); 3723 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId);
3729 } 3724 }
3730 3725
3731 inline bool ComputedStyle::hasPseudoElementStyle() const { 3726 inline bool ComputedStyle::hasPseudoElementStyle() const {
3732 return m_pseudoBits & ElementPseudoIdMask; 3727 return m_pseudoBits & ElementPseudoIdMask;
3733 } 3728 }
3734 3729
3735 } // namespace blink 3730 } // namespace blink
3736 3731
3737 #endif // ComputedStyle_h 3732 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698