Bug 1079314 - Remove the mWritingMode field from logical-coordinate objects in non-debug builds. r=smontagu
☠☠ backed out by 931302c829b4 ☠ ☠
authorJonathan Kew <jkew@mozilla.com>
Wed, 08 Oct 2014 10:32:50 +0100
changeset 232550 b818ba8aabc28188ee0521778ef6712c178ba146
parent 232549 3e40213d4a2175c167406ab80cb5b36f66403ee1
child 232551 1632a36342d4fd4926960144903ccdac12f48f5c
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs1079314
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1079314 - Remove the mWritingMode field from logical-coordinate objects in non-debug builds. r=smontagu
layout/generic/WritingModes.h
layout/tables/nsTableOuterFrame.cpp
--- a/layout/generic/WritingModes.h
+++ b/layout/generic/WritingModes.h
@@ -29,17 +29,17 @@
 // Methods in logical-coordinate classes that take another logical-coordinate
 // object as a parameter should call CHECK_WRITING_MODE on it to verify that
 // the writing modes match.
 // (In some cases, there are internal (private) methods that don't do this;
 // such methods should only be used by other methods that have already checked
 // the writing modes.)
 
 #define CHECK_WRITING_MODE(param) \
-   NS_ASSERTION(param == mWritingMode, "writing-mode mismatch")
+   NS_ASSERTION(param == GetWritingMode(), "writing-mode mismatch")
 
 namespace mozilla {
 // Logical side constants for use in various places.
 enum LogicalSide { eLogicalSideBStart, eLogicalSideBEnd,
                    eLogicalSideIStart, eLogicalSideIEnd };
 
 enum LogicalSideBits {
   eLogicalSideBitsNone   = 0,
@@ -558,17 +558,19 @@ private:
   {
     return mPoint.x;
   }
   nscoord& B() // block-axis
   {
     return mPoint.y;
   }
 
+#ifdef DEBUG
   WritingMode mWritingMode;
+#endif
 
   // We use an nsPoint to hold the coordinates, but reinterpret its .x and .y
   // fields as the inline and block directions. Hence, this is not exposed
   // directly, but only through accessors that will map them according to the
   // writing mode.
   nsPoint mPoint;
 };
 
@@ -678,45 +680,59 @@ public:
    */
   LogicalSize ConvertTo(WritingMode aToMode, WritingMode aFromMode) const
   {
     CHECK_WRITING_MODE(aFromMode);
     return aToMode == aFromMode ?
       *this : LogicalSize(aToMode, GetPhysicalSize(aFromMode));
   }
 
+  /**
+   * Test if a size is (0, 0).
+   */
+  bool IsAllZero() const
+  {
+    return ISize() == 0 && BSize() == 0;
+  }
+
+  /**
+   * Various binary operators on LogicalSize. These are valid ONLY for operands
+   * that share the same writing mode.
+   */
   bool operator==(const LogicalSize& aOther) const
   {
-    return mWritingMode == aOther.mWritingMode && mSize == aOther.mSize;
+    CHECK_WRITING_MODE(aOther.GetWritingMode());
+    return mSize == aOther.mSize;
   }
 
   bool operator!=(const LogicalSize& aOther) const
   {
-    return mWritingMode != aOther.mWritingMode || mSize != aOther.mSize;
+    CHECK_WRITING_MODE(aOther.GetWritingMode());
+    return mSize != aOther.mSize;
   }
 
   LogicalSize operator+(const LogicalSize& aOther) const
   {
     CHECK_WRITING_MODE(aOther.GetWritingMode());
-    return LogicalSize(mWritingMode, ISize() + aOther.ISize(),
-                                     BSize() + aOther.BSize());
+    return LogicalSize(GetWritingMode(), ISize() + aOther.ISize(),
+                                         BSize() + aOther.BSize());
   }
   LogicalSize& operator+=(const LogicalSize& aOther)
   {
     CHECK_WRITING_MODE(aOther.GetWritingMode());
     ISize() += aOther.ISize();
     BSize() += aOther.BSize();
     return *this;
   }
 
   LogicalSize operator-(const LogicalSize& aOther) const
   {
     CHECK_WRITING_MODE(aOther.GetWritingMode());
-    return LogicalSize(mWritingMode, ISize() - aOther.ISize(),
-                                     BSize() - aOther.BSize());
+    return LogicalSize(GetWritingMode(), ISize() - aOther.ISize(),
+                                         BSize() - aOther.BSize());
   }
   LogicalSize& operator-=(const LogicalSize& aOther)
   {
     CHECK_WRITING_MODE(aOther.GetWritingMode());
     ISize() -= aOther.ISize();
     BSize() -= aOther.BSize();
     return *this;
   }
@@ -745,17 +761,19 @@ private:
   {
     return mSize.width;
   }
   nscoord& BSize() // block-size
   {
     return mSize.height;
   }
 
+#ifdef DEBUG
   WritingMode mWritingMode;
+#endif
   nsSize      mSize;
 };
 
 /**
  * Flow-relative margin
  */
 class LogicalMargin {
 public:
@@ -1041,17 +1059,19 @@ private:
   {
     return mMargin.LeftRight();
   }
   nscoord BStartEnd() const // block margins
   {
     return mMargin.TopBottom();
   }
 
+#ifdef DEBUG
   WritingMode mWritingMode;
+#endif
   nsMargin    mMargin;
 };
 
 /**
  * Flow-relative rectangle
  */
 class LogicalRect {
 public:
@@ -1471,15 +1491,17 @@ private:
   {
     return mRect.y;
   }
   nscoord& BSize() // block-size
   {
     return mRect.height;
   }
 
+#ifdef DEBUG
   WritingMode mWritingMode;
+#endif
   nsRect      mRect;
 };
 
 } // namespace mozilla
 
 #endif // WritingModes_h_
--- a/layout/tables/nsTableOuterFrame.cpp
+++ b/layout/tables/nsTableOuterFrame.cpp
@@ -507,18 +507,17 @@ nsTableOuterFrame::ComputeAutoSize(nsRen
                                    const LogicalSize& aCBSize,
                                    nscoord aAvailableISize,
                                    const LogicalSize& aMargin,
                                    const LogicalSize& aBorder,
                                    const LogicalSize& aPadding,
                                    bool aShrinkWrap)
 {
   nscoord kidAvailableWidth = aAvailableISize - aMargin.ISize(aWM);
-  NS_ASSERTION(aBorder == LogicalSize(aWM) &&
-               aPadding == LogicalSize(aWM),
+  NS_ASSERTION(aBorder.IsAllZero() && aPadding.IsAllZero(),
                "Table outer frames cannot have borders or paddings");
 
   // When we're shrink-wrapping, our auto size needs to wrap around the
   // actual size of the table, which (if it is specified as a percent)
   // could be something that is not reflected in our GetMinISize and
   // GetPrefISize.  See bug 349457 for an example.
 
   // XXX The use of aCBSize.GetPhysicalSize(aWM) below is temporary,