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

Side by Side Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 811843003: replace COMPILE_ASSERT with static_assert in core/rendering/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « Source/core/rendering/style/FillLayer.cpp ('k') | Source/core/rendering/style/StyleBoxData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2011 Adobe Systems Incorporated. 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 #include "platform/geometry/FloatRoundedRect.h" 43 #include "platform/geometry/FloatRoundedRect.h"
44 #include "wtf/MathExtras.h" 44 #include "wtf/MathExtras.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 struct SameSizeAsBorderValue { 48 struct SameSizeAsBorderValue {
49 RGBA32 m_color; 49 RGBA32 m_color;
50 unsigned m_width; 50 unsigned m_width;
51 }; 51 };
52 52
53 COMPILE_ASSERT(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), BorderValue _should_not_grow); 53 static_assert(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), "BorderValue should stay small");
54 54
55 struct SameSizeAsRenderStyle : public RefCounted<SameSizeAsRenderStyle> { 55 struct SameSizeAsRenderStyle : public RefCounted<SameSizeAsRenderStyle> {
56 void* dataRefs[7]; 56 void* dataRefs[7];
57 void* ownPtrs[1]; 57 void* ownPtrs[1];
58 void* dataRefSvgStyle; 58 void* dataRefSvgStyle;
59 59
60 struct InheritedFlags { 60 struct InheritedFlags {
61 unsigned m_bitfields[2]; 61 unsigned m_bitfields[2];
62 } inherited_flags; 62 } inherited_flags;
63 63
64 struct NonInheritedFlags { 64 struct NonInheritedFlags {
65 unsigned m_bitfields[2]; 65 unsigned m_bitfields[2];
66 } noninherited_flags; 66 } noninherited_flags;
67 }; 67 };
68 68
69 COMPILE_ASSERT(sizeof(RenderStyle) == sizeof(SameSizeAsRenderStyle), RenderStyle _should_stay_small); 69 static_assert(sizeof(RenderStyle) == sizeof(SameSizeAsRenderStyle), "RenderStyle should stay small");
70 70
71 inline RenderStyle* defaultStyle() 71 inline RenderStyle* defaultStyle()
72 { 72 {
73 DEFINE_STATIC_REF(RenderStyle, s_defaultStyle, (RenderStyle::createDefaultSt yle())); 73 DEFINE_STATIC_REF(RenderStyle, s_defaultStyle, (RenderStyle::createDefaultSt yle()));
74 return s_defaultStyle; 74 return s_defaultStyle;
75 } 75 }
76 76
77 PassRefPtr<RenderStyle> RenderStyle::create() 77 PassRefPtr<RenderStyle> RenderStyle::create()
78 { 78 {
79 return adoptRef(new RenderStyle()); 79 return adoptRef(new RenderStyle());
(...skipping 22 matching lines...) Expand all
102 : m_box(defaultStyle()->m_box) 102 : m_box(defaultStyle()->m_box)
103 , visual(defaultStyle()->visual) 103 , visual(defaultStyle()->visual)
104 , m_background(defaultStyle()->m_background) 104 , m_background(defaultStyle()->m_background)
105 , surround(defaultStyle()->surround) 105 , surround(defaultStyle()->surround)
106 , rareNonInheritedData(defaultStyle()->rareNonInheritedData) 106 , rareNonInheritedData(defaultStyle()->rareNonInheritedData)
107 , rareInheritedData(defaultStyle()->rareInheritedData) 107 , rareInheritedData(defaultStyle()->rareInheritedData)
108 , inherited(defaultStyle()->inherited) 108 , inherited(defaultStyle()->inherited)
109 , m_svgStyle(defaultStyle()->m_svgStyle) 109 , m_svgStyle(defaultStyle()->m_svgStyle)
110 { 110 {
111 setBitDefaults(); // Would it be faster to copy this from the default style? 111 setBitDefaults(); // Would it be faster to copy this from the default style?
112 COMPILE_ASSERT((sizeof(InheritedFlags) <= 8), InheritedFlags_does_not_grow); 112 static_assert((sizeof(InheritedFlags) <= 8), "InheritedFlags should not grow ");
113 COMPILE_ASSERT((sizeof(NonInheritedFlags) <= 8), NonInheritedFlags_does_not_ grow); 113 static_assert((sizeof(NonInheritedFlags) <= 8), "NonInheritedFlags should no t grow");
114 } 114 }
115 115
116 ALWAYS_INLINE RenderStyle::RenderStyle(DefaultStyleTag) 116 ALWAYS_INLINE RenderStyle::RenderStyle(DefaultStyleTag)
117 { 117 {
118 setBitDefaults(); 118 setBitDefaults();
119 119
120 m_box.init(); 120 m_box.init();
121 visual.init(); 121 visual.init();
122 m_background.init(); 122 m_background.init();
123 surround.init(); 123 surround.init();
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 horizontal || includeLogicalRightEdge); 1674 horizontal || includeLogicalRightEdge);
1675 1675
1676 edges[BSLeft] = BorderEdge(borderLeftWidth(), 1676 edges[BSLeft] = BorderEdge(borderLeftWidth(),
1677 visitedDependentColor(CSSPropertyBorderLeftColor), 1677 visitedDependentColor(CSSPropertyBorderLeftColor),
1678 borderLeftStyle(), 1678 borderLeftStyle(),
1679 borderLeftIsTransparent(), 1679 borderLeftIsTransparent(),
1680 !horizontal || includeLogicalLeftEdge); 1680 !horizontal || includeLogicalLeftEdge);
1681 } 1681 }
1682 1682
1683 } // namespace blink 1683 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/style/FillLayer.cpp ('k') | Source/core/rendering/style/StyleBoxData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698