Bug 1449400 part 1 - Move NS_STYLE_* constants from nsStyleStruct.h to ComputedStyle.h. r?emilio draft
authorXidorn Quan <me@upsuper.org>
Thu, 29 Mar 2018 12:58:49 +1100
changeset 774608 86698696c3d8db942b5031ef6c671c7796268007
parent 774520 dd1b1fd532d60aabe183dbea4d208579cfb0744b
child 774609 a1c42220e5070fa4beea438859ab0daec3f3fe7b
push id104449
push userxquan@mozilla.com
push dateThu, 29 Mar 2018 07:23:52 +0000
reviewersemilio
bugs1449400
milestone61.0a1
Bug 1449400 part 1 - Move NS_STYLE_* constants from nsStyleStruct.h to ComputedStyle.h. r?emilio Since ComputedStyle is where they are actually used. This would also allow us to avoid including nsStyleStruct.h from ComputedStyle.h after some header file changes in later patches. MozReview-Commit-ID: 8aBuNO9CRN0
layout/style/ComputedStyle.h
layout/style/nsStyleStruct.h
--- a/layout/style/ComputedStyle.h
+++ b/layout/style/ComputedStyle.h
@@ -14,16 +14,62 @@
 #include "mozilla/Assertions.h"
 #include "mozilla/RestyleLogging.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/ServoUtils.h"
 #include "mozilla/StyleComplexColor.h"
 #include "mozilla/CachedInheritingStyles.h"
 #include "nsCSSAnonBoxes.h"
 
+// Includes nsStyleStructID.
+#include "nsStyleStructFwd.h"
+
+// Bits for each struct.
+// NS_STYLE_INHERIT_BIT defined in nsStyleStructFwd.h
+#define NS_STYLE_INHERIT_MASK              0x000ffffff
+
+// Bits for inherited structs.
+#define NS_STYLE_INHERITED_STRUCT_MASK \
+  ((nsStyleStructID_size_t(1) << nsStyleStructID_Inherited_Count) - 1)
+// Bits for reset structs.
+#define NS_STYLE_RESET_STRUCT_MASK \
+  (((nsStyleStructID_size_t(1) << nsStyleStructID_Reset_Count) - 1) \
+   << nsStyleStructID_Inherited_Count)
+
+// Additional bits for ComputedStyle's mBits:
+// See ComputedStyle::HasTextDecorationLines
+#define NS_STYLE_HAS_TEXT_DECORATION_LINES 0x001000000
+// See ComputedStyle::HasPseudoElementData.
+#define NS_STYLE_HAS_PSEUDO_ELEMENT_DATA   0x002000000
+// See ComputedStyle::RelevantLinkIsVisited
+#define NS_STYLE_RELEVANT_LINK_VISITED     0x004000000
+// See ComputedStyle::IsStyleIfVisited
+#define NS_STYLE_IS_STYLE_IF_VISITED       0x008000000
+// See ComputedStyle::HasChildThatUsesGrandancestorStyle
+#define NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE 0x010000000
+// See ComputedStyle::IsShared
+#define NS_STYLE_IS_SHARED                 0x020000000
+// See ComputedStyle::AssertStructsNotUsedElsewhere
+// (This bit is currently only used in #ifdef DEBUG code.)
+#define NS_STYLE_IS_GOING_AWAY             0x040000000
+// See ComputedStyle::ShouldSuppressLineBreak
+#define NS_STYLE_SUPPRESS_LINEBREAK        0x080000000
+// See ComputedStyle::IsInDisplayNoneSubtree
+#define NS_STYLE_IN_DISPLAY_NONE_SUBTREE   0x100000000
+// See ComputedStyle::FindChildWithRules
+#define NS_STYLE_INELIGIBLE_FOR_SHARING    0x200000000
+// See ComputedStyle::HasChildThatUsesResetStyle
+#define NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE 0x400000000
+// See ComputedStyle::IsTextCombined
+#define NS_STYLE_IS_TEXT_COMBINED          0x800000000
+// Whether a ComputedStyle is a Gecko or Servo context
+#define NS_STYLE_CONTEXT_IS_GECKO          0x1000000000
+// See ComputedStyle::GetPseudoEnum
+#define NS_STYLE_CONTEXT_TYPE_SHIFT        37
+
 class nsAtom;
 class nsPresContext;
 class nsWindowSizes;
 
 namespace mozilla {
 
 enum class CSSPseudoElementType : uint8_t;
 class ComputedStyle;
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -46,62 +46,16 @@ class nsPresContext;
 struct nsStyleVisibility;
 namespace mozilla {
 class ComputedStyle;
 namespace dom {
 class ImageTracker;
 } // namespace dom
 } // namespace mozilla
 
-// Includes nsStyleStructID.
-#include "nsStyleStructFwd.h"
-
-// Bits for each struct.
-// NS_STYLE_INHERIT_BIT defined in nsStyleStructFwd.h
-#define NS_STYLE_INHERIT_MASK              0x000ffffff
-
-// Bits for inherited structs.
-#define NS_STYLE_INHERITED_STRUCT_MASK \
-  ((nsStyleStructID_size_t(1) << nsStyleStructID_Inherited_Count) - 1)
-// Bits for reset structs.
-#define NS_STYLE_RESET_STRUCT_MASK \
-  (((nsStyleStructID_size_t(1) << nsStyleStructID_Reset_Count) - 1) \
-   << nsStyleStructID_Inherited_Count)
-
-// Additional bits for ComputedStyle's mBits:
-// See ComputedStyle::HasTextDecorationLines
-#define NS_STYLE_HAS_TEXT_DECORATION_LINES 0x001000000
-// See ComputedStyle::HasPseudoElementData.
-#define NS_STYLE_HAS_PSEUDO_ELEMENT_DATA   0x002000000
-// See ComputedStyle::RelevantLinkIsVisited
-#define NS_STYLE_RELEVANT_LINK_VISITED     0x004000000
-// See ComputedStyle::IsStyleIfVisited
-#define NS_STYLE_IS_STYLE_IF_VISITED       0x008000000
-// See ComputedStyle::HasChildThatUsesGrandancestorStyle
-#define NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE 0x010000000
-// See ComputedStyle::IsShared
-#define NS_STYLE_IS_SHARED                 0x020000000
-// See ComputedStyle::AssertStructsNotUsedElsewhere
-// (This bit is currently only used in #ifdef DEBUG code.)
-#define NS_STYLE_IS_GOING_AWAY             0x040000000
-// See ComputedStyle::ShouldSuppressLineBreak
-#define NS_STYLE_SUPPRESS_LINEBREAK        0x080000000
-// See ComputedStyle::IsInDisplayNoneSubtree
-#define NS_STYLE_IN_DISPLAY_NONE_SUBTREE   0x100000000
-// See ComputedStyle::FindChildWithRules
-#define NS_STYLE_INELIGIBLE_FOR_SHARING    0x200000000
-// See ComputedStyle::HasChildThatUsesResetStyle
-#define NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE 0x400000000
-// See ComputedStyle::IsTextCombined
-#define NS_STYLE_IS_TEXT_COMBINED          0x800000000
-// Whether a ComputedStyle is a Gecko or Servo context
-#define NS_STYLE_CONTEXT_IS_GECKO          0x1000000000
-// See ComputedStyle::GetPseudoEnum
-#define NS_STYLE_CONTEXT_TYPE_SHIFT        37
-
 namespace mozilla {
 
 struct Position {
   using Coord = nsStyleCoord::CalcValue;
 
   Coord mXPosition, mYPosition;
 
   // Initialize nothing