Bug 1076986: make LogicalMargin and LogicalRect's IsEmpty the same as nsMargin and nsRect, r=jfkthame
authorSimon Montagu <smontagu@smontagu.org>
Sat, 04 Oct 2014 23:02:36 -0700
changeset 208835 e2ae0efd508a8d67b31dc567315898046d1de597
parent 208834 41ce29f771b23dc619c2589ef1c30648e16599bb
child 208836 69910e2c2a5dd7389e8d4c14e49c0ceae2a30da2
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjfkthame
bugs1076986
milestone35.0a1
Bug 1076986: make LogicalMargin and LogicalRect's IsEmpty the same as nsMargin and nsRect, r=jfkthame
layout/generic/WritingModes.h
layout/generic/nsLineBox.h
layout/generic/nsLineLayout.cpp
--- a/layout/generic/WritingModes.h
+++ b/layout/generic/WritingModes.h
@@ -963,17 +963,17 @@ public:
     if (aSkipSides.IStart()) {
       IStart() = 0;
     }
     if (aSkipSides.IEnd()) {
       IEnd() = 0;
     }
   }
 
-  bool IsEmpty() const
+  bool IsAllZero() const
   {
     return (mMargin.left == 0 && mMargin.top == 0 &&
             mMargin.right == 0 && mMargin.bottom == 0);
   }
 
   LogicalMargin operator+(const LogicalMargin& aMargin) {
     CHECK_WRITING_MODE(aMargin.GetWritingMode());
     return LogicalMargin(GetWritingMode(),
@@ -1279,16 +1279,21 @@ public:
   nscoord YMost(WritingMode aWritingMode) const
   {
     CHECK_WRITING_MODE(aWritingMode);
     return aWritingMode.IsVertical() ? mRect.XMost() : mRect.YMost();
   }
 
   bool IsEmpty() const
   {
+    return mRect.IsEmpty();
+  }
+
+  bool IsAllZero() const
+  {
     return (mRect.x == 0 && mRect.y == 0 &&
             mRect.width == 0 && mRect.height == 0);
   }
 
   bool IsZeroSize() const
   {
     return (mRect.width == 0 && mRect.height == 0);
   }
--- a/layout/generic/nsLineBox.h
+++ b/layout/generic/nsLineBox.h
@@ -581,17 +581,17 @@ public:
   mozilla::WritingMode mWritingMode;
   nscoord mContainerWidth;
  private:
   mozilla::LogicalRect mBounds;
  public:
   const mozilla::LogicalRect& GetBounds() { return mBounds; }
   nsRect GetPhysicalBounds() const
   {
-    if (mBounds.IsEmpty()) {
+    if (mBounds.IsAllZero()) {
       return nsRect(0, 0, 0, 0);
     }
 
     NS_ASSERTION(mContainerWidth != -1, "mContainerWidth not initialized");
     return mBounds.GetPhysicalRect(mWritingMode, mContainerWidth);
   }
   void SetBounds(mozilla::WritingMode aWritingMode,
                  nscoord aIStart, nscoord aBStart,
--- a/layout/generic/nsLineLayout.cpp
+++ b/layout/generic/nsLineLayout.cpp
@@ -1652,18 +1652,18 @@ nsLineLayout::VerticalAlignFrames(PerSpa
   bool zeroEffectiveSpanBox = false;
   // XXXldb If we really have empty continuations, then all these other
   // checks don't make sense for them.
   // XXXldb This should probably just use nsIFrame::IsSelfEmpty, assuming that
   // it agrees with this code.  (If it doesn't agree, it probably should.)
   if ((emptyContinuation ||
        mPresContext->CompatibilityMode() != eCompatibility_FullStandards) &&
       ((psd == mRootSpan) ||
-       (spanFramePFD->mBorderPadding.IsEmpty() &&
-        spanFramePFD->mMargin.IsEmpty()))) {
+       (spanFramePFD->mBorderPadding.IsAllZero() &&
+        spanFramePFD->mMargin.IsAllZero()))) {
     // This code handles an issue with compatibility with non-css
     // conformant browsers. In particular, there are some cases
     // where the font-size and line-height for a span must be
     // ignored and instead the span must *act* as if it were zero
     // sized. In general, if the span contains any non-compressed
     // text then we don't use this logic.
     // However, this is not propagated outwards, since (in compatibility
     // mode) we don't want big line heights for things like