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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.h

Issue 2200053002: Add TypeTraits template for checking safe bitfields (WIP) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_make_visibility_enum_class_rebase
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/style/ComputedStyle.h
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h
index a66a3f692703a6fc7afc027125741241d2e39597..b5479148d7196c0cd22f259d9c8497f1637b05f0 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -72,6 +72,7 @@
#include "wtf/Forward.h"
#include "wtf/LeakAnnotations.h"
#include "wtf/RefCounted.h"
+#include "wtf/TypeTraits.h"
#include "wtf/Vector.h"
#include <memory>
@@ -186,11 +187,13 @@ protected:
bool operator!=(const InheritedData& other) const { return !(*this == other); }
+ static_assert(IsEnumSafeToStoreInBitfield<EVisibility>::value, "EVisibility is stored in a bitfield on ComputedStyle");
+
unsigned m_emptyCells : 1; // EEmptyCells
unsigned m_captionSide : 2; // ECaptionSide
unsigned m_listStyleType : 7; // EListStyleType
unsigned m_listStylePosition : 1; // EListStylePosition
- unsigned m_visibility : 2; // EVisibility
+ EVisibility m_visibility : 2;
unsigned m_textAlign : 4; // ETextAlign
unsigned m_textTransform : 2; // ETextTransform
unsigned m_textUnderline : 1;
@@ -298,7 +301,7 @@ protected:
m_inheritedData.m_captionSide = initialCaptionSide();
m_inheritedData.m_listStyleType = initialListStyleType();
m_inheritedData.m_listStylePosition = initialListStylePosition();
- m_inheritedData.m_visibility = static_cast<unsigned>(initialVisibility());
+ m_inheritedData.m_visibility = initialVisibility();
m_inheritedData.m_textAlign = initialTextAlign();
m_inheritedData.m_textTransform = initialTextTransform();
m_inheritedData.m_textUnderline = false;
@@ -1470,7 +1473,7 @@ public:
// visibility
static EVisibility initialVisibility() { return EVisibility::Visible; }
EVisibility visibility() const { return static_cast<EVisibility>(m_inheritedData.m_visibility); }
- void setVisibility(EVisibility v) { m_inheritedData.m_visibility = static_cast<unsigned>(v); }
+ void setVisibility(EVisibility v) { m_inheritedData.m_visibility = v; }
// white-space inherited
static EWhiteSpace initialWhiteSpace() { return NORMAL; }
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698