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

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

Issue 2681833004: Automatically generate EBreakBetween & EBreakInside (Closed)
Patch Set: 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) 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 struct NonInheritedData { 220 struct NonInheritedData {
221 // Compare computed styles, differences in inherited bits or other flags 221 // Compare computed styles, differences in inherited bits or other flags
222 // should not cause an inequality. 222 // should not cause an inequality.
223 bool operator==(const NonInheritedData& other) const { 223 bool operator==(const NonInheritedData& other) const {
224 // Generated properties are compared in ComputedStyleBase 224 // Generated properties are compared in ComputedStyleBase
225 return m_effectiveDisplay == other.m_effectiveDisplay && 225 return m_effectiveDisplay == other.m_effectiveDisplay &&
226 m_originalDisplay == other.m_originalDisplay && 226 m_originalDisplay == other.m_originalDisplay &&
227 m_overflowX == other.m_overflowX && 227 m_overflowX == other.m_overflowX &&
228 m_overflowY == other.m_overflowY && 228 m_overflowY == other.m_overflowY &&
229 m_verticalAlign == other.m_verticalAlign && 229 m_verticalAlign == other.m_verticalAlign &&
230 m_position == other.m_position && 230 m_position == other.m_position;
231 // hasViewportUnits 231 // hasViewportUnits
amoylan 2017/02/08 02:29:45 Formatter was pretty eager to de-indent this // ha
sashab 2017/02/08 02:32:15 Haha, good question... Get rid of them all. They p
shend 2017/02/08 03:32:26 I think the comments were used to explicitly indic
232 m_breakBefore == other.m_breakBefore &&
233 m_breakAfter == other.m_breakAfter &&
234 m_breakInside == other.m_breakInside;
235 // styleType 232 // styleType
236 // pseudoBits 233 // pseudoBits
237 // explicitInheritance 234 // explicitInheritance
238 // unique 235 // unique
239 // emptyState 236 // emptyState
240 // affectedByFocus 237 // affectedByFocus
241 // affectedByHover 238 // affectedByHover
242 // affectedByActive 239 // affectedByActive
243 // affectedByDrag 240 // affectedByDrag
244 // isLink 241 // isLink
(...skipping 11 matching lines...) Expand all
256 unsigned m_verticalAlign : 4; // EVerticalAlign 253 unsigned m_verticalAlign : 4; // EVerticalAlign
257 unsigned m_position : 3; // EPosition 254 unsigned m_position : 3; // EPosition
258 255
259 // This is set if we used viewport units when resolving a length. 256 // This is set if we used viewport units when resolving a length.
260 // It is mutable so we can pass around const ComputedStyles to resolve 257 // It is mutable so we can pass around const ComputedStyles to resolve
261 // lengths. 258 // lengths.
262 mutable unsigned m_hasViewportUnits : 1; 259 mutable unsigned m_hasViewportUnits : 1;
263 260
264 // 32 bits 261 // 32 bits
265 262
266 unsigned m_breakBefore : 4; // EBreakBetween
267 unsigned m_breakAfter : 4; // EBreakBetween
268 unsigned m_breakInside : 2; // EBreakInside
269
270 unsigned m_styleType : 6; // PseudoId 263 unsigned m_styleType : 6; // PseudoId
271 unsigned m_pseudoBits : 8; 264 unsigned m_pseudoBits : 8;
272 unsigned m_explicitInheritance : 1; // Explicitly inherits a non-inherited 265 unsigned m_explicitInheritance : 1; // Explicitly inherits a non-inherited
273 // property 266 // property
274 unsigned m_variableReference : 1; // A non-inherited property references a 267 unsigned m_variableReference : 1; // A non-inherited property references a
275 // variable or @apply is used. 268 // variable or @apply is used.
276 unsigned m_unique : 1; // Style can not be shared. 269 unsigned m_unique : 1; // Style can not be shared.
277 270
278 unsigned m_emptyState : 1; 271 unsigned m_emptyState : 1;
279 272
(...skipping 23 matching lines...) Expand all
303 static_cast<unsigned>(EInsideLink::kNotInsideLink); 296 static_cast<unsigned>(EInsideLink::kNotInsideLink);
304 297
305 m_nonInheritedData.m_effectiveDisplay = 298 m_nonInheritedData.m_effectiveDisplay =
306 m_nonInheritedData.m_originalDisplay = 299 m_nonInheritedData.m_originalDisplay =
307 static_cast<unsigned>(initialDisplay()); 300 static_cast<unsigned>(initialDisplay());
308 m_nonInheritedData.m_overflowX = static_cast<unsigned>(initialOverflowX()); 301 m_nonInheritedData.m_overflowX = static_cast<unsigned>(initialOverflowX());
309 m_nonInheritedData.m_overflowY = static_cast<unsigned>(initialOverflowY()); 302 m_nonInheritedData.m_overflowY = static_cast<unsigned>(initialOverflowY());
310 m_nonInheritedData.m_verticalAlign = 303 m_nonInheritedData.m_verticalAlign =
311 static_cast<unsigned>(initialVerticalAlign()); 304 static_cast<unsigned>(initialVerticalAlign());
312 m_nonInheritedData.m_position = initialPosition(); 305 m_nonInheritedData.m_position = initialPosition();
313 m_nonInheritedData.m_breakBefore =
314 static_cast<unsigned>(initialBreakBefore());
315 m_nonInheritedData.m_breakAfter =
316 static_cast<unsigned>(initialBreakAfter());
317 m_nonInheritedData.m_breakInside =
318 static_cast<unsigned>(initialBreakInside());
319 m_nonInheritedData.m_styleType = PseudoIdNone; 306 m_nonInheritedData.m_styleType = PseudoIdNone;
320 m_nonInheritedData.m_pseudoBits = 0; 307 m_nonInheritedData.m_pseudoBits = 0;
321 m_nonInheritedData.m_explicitInheritance = false; 308 m_nonInheritedData.m_explicitInheritance = false;
322 m_nonInheritedData.m_variableReference = false; 309 m_nonInheritedData.m_variableReference = false;
323 m_nonInheritedData.m_unique = false; 310 m_nonInheritedData.m_unique = false;
324 m_nonInheritedData.m_emptyState = false; 311 m_nonInheritedData.m_emptyState = false;
325 m_nonInheritedData.m_hasViewportUnits = false; 312 m_nonInheritedData.m_hasViewportUnits = false;
326 m_nonInheritedData.m_affectedByFocus = false; 313 m_nonInheritedData.m_affectedByFocus = false;
327 m_nonInheritedData.m_affectedByHover = false; 314 m_nonInheritedData.m_affectedByHover = false;
328 m_nonInheritedData.m_affectedByActive = false; 315 m_nonInheritedData.m_affectedByActive = false;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 } 742 }
756 void setBoxShadow(PassRefPtr<ShadowList>); 743 void setBoxShadow(PassRefPtr<ShadowList>);
757 744
758 // box-sizing (aka -webkit-box-sizing) 745 // box-sizing (aka -webkit-box-sizing)
759 static EBoxSizing initialBoxSizing() { return EBoxSizing::kContentBox; } 746 static EBoxSizing initialBoxSizing() { return EBoxSizing::kContentBox; }
760 EBoxSizing boxSizing() const { return m_box->boxSizing(); } 747 EBoxSizing boxSizing() const { return m_box->boxSizing(); }
761 void setBoxSizing(EBoxSizing s) { 748 void setBoxSizing(EBoxSizing s) {
762 SET_VAR(m_box, m_boxSizing, static_cast<unsigned>(s)); 749 SET_VAR(m_box, m_boxSizing, static_cast<unsigned>(s));
763 } 750 }
764 751
765 // Page break properties.
766 // break-after (shorthand for page-break-after and -webkit-column-break-after)
amoylan 2017/02/08 02:29:45 This is quite interesting. Lost comments. I wonder
sashab 2017/02/08 02:32:15 Move the comments to the CSSProperties json5 file.
amoylan 2017/02/08 02:48:46 Good idea. Done. PTAL.
767 static EBreakBetween initialBreakAfter() { return EBreakBetween::kAuto; }
768 EBreakBetween breakAfter() const {
769 return static_cast<EBreakBetween>(m_nonInheritedData.m_breakAfter);
770 }
771 void setBreakAfter(EBreakBetween b) {
772 m_nonInheritedData.m_breakAfter = static_cast<unsigned>(b);
773 }
774
775 // break-before (shorthand for page-break-before and
776 // -webkit-column-break-before)
777 static EBreakBetween initialBreakBefore() { return EBreakBetween::kAuto; }
778 EBreakBetween breakBefore() const {
779 return static_cast<EBreakBetween>(m_nonInheritedData.m_breakBefore);
780 }
781 void setBreakBefore(EBreakBetween b) {
782 m_nonInheritedData.m_breakBefore = static_cast<unsigned>(b);
783 }
784
785 // break-inside (shorthand for page-break-inside and
786 // -webkit-column-break-inside)
787 static EBreakInside initialBreakInside() { return EBreakInside::kAuto; }
788 EBreakInside breakInside() const {
789 return static_cast<EBreakInside>(m_nonInheritedData.m_breakInside);
790 }
791 void setBreakInside(EBreakInside b) {
792 m_nonInheritedData.m_breakInside = static_cast<unsigned>(b);
793 }
794
795 // clip 752 // clip
796 static LengthBox initialClip() { return LengthBox(); } 753 static LengthBox initialClip() { return LengthBox(); }
797 const LengthBox& clip() const { return m_visual->clip; } 754 const LengthBox& clip() const { return m_visual->clip; }
798 void setClip(const LengthBox& box) { 755 void setClip(const LengthBox& box) {
799 SET_VAR(m_visual, hasAutoClip, false); 756 SET_VAR(m_visual, hasAutoClip, false);
800 SET_VAR(m_visual, clip, box); 757 SET_VAR(m_visual, clip, box);
801 } 758 }
802 bool hasAutoClip() const { return m_visual->hasAutoClip; } 759 bool hasAutoClip() const { return m_visual->hasAutoClip; }
803 void setHasAutoClip() { 760 void setHasAutoClip() {
804 SET_VAR(m_visual, hasAutoClip, true); 761 SET_VAR(m_visual, hasAutoClip, true);
(...skipping 3111 matching lines...) Expand 10 before | Expand all | Expand 10 after
3916 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); 3873 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1);
3917 } 3874 }
3918 3875
3919 inline bool ComputedStyle::hasPseudoElementStyle() const { 3876 inline bool ComputedStyle::hasPseudoElementStyle() const {
3920 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; 3877 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask;
3921 } 3878 }
3922 3879
3923 } // namespace blink 3880 } // namespace blink
3924 3881
3925 #endif // ComputedStyle_h 3882 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698