Bug 1332180 - Early return from shape-outside:url() value in ctor of FloatInfo. r=TYLin
authorXidorn Quan <me@upsuper.org>
Thu, 19 Jan 2017 16:41:19 +1100
changeset 377314 fa590ad0b31c0bfba57af5e9788b9abaa73316e4
parent 377313 fb351cbb958a54870550ab19ec4503362404a69d
child 377315 168ea3e9ff0bad286676173263613703187ab8f1
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTYLin
bugs1332180
milestone53.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 1332180 - Early return from shape-outside:url() value in ctor of FloatInfo. r=TYLin MozReview-Commit-ID: E2nj3DWt1fr
layout/generic/nsFloatManager.cpp
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -684,16 +684,23 @@ nsFloatManager::FloatInfo::FloatInfo(nsI
   MOZ_COUNT_CTOR(nsFloatManager::FloatInfo);
 
   const StyleShapeOutside& shapeOutside = mFrame->StyleDisplay()->mShapeOutside;
 
   if (shapeOutside.GetType() == StyleShapeSourceType::None) {
     return;
   }
 
+  if (shapeOutside.GetType() == StyleShapeSourceType::URL) {
+    // Bug 1265343: Implement 'shape-image-threshold'. Early return
+    // here because shape-outside with url() value doesn't have a
+    // reference box, and GetReferenceBox() asserts that.
+    return;
+  }
+
   // Initialize <shape-box>'s reference rect.
   LogicalRect rect = aMarginRect;
 
   switch (shapeOutside.GetReferenceBox()) {
     case StyleShapeOutsideShapeBox::Content:
       rect.Deflate(aWM, mFrame->GetLogicalUsedPadding(aWM));
       MOZ_FALLTHROUGH;
     case StyleShapeOutsideShapeBox::Padding:
@@ -718,18 +725,16 @@ nsFloatManager::FloatInfo::FloatInfo(nsI
     mShapeInfo = MakeUnique<BoxShapeInfo>(shapeBoxRect, mFrame);
   } else if (shapeOutside.GetType() == StyleShapeSourceType::Shape) {
     StyleBasicShape* const basicShape = shapeOutside.GetBasicShape();
 
     if (basicShape->GetShapeType() == StyleBasicShapeType::Circle) {
       mShapeInfo = MakeUnique<CircleShapeInfo>(basicShape, aLineLeft, aBlockStart,
                                                rect, aWM, aContainerSize);
     }
-  } else if (shapeOutside.GetType() == StyleShapeSourceType::URL) {
-    // Bug 1265343: Implement 'shape-image-threshold'.
   } else {
     MOZ_ASSERT_UNREACHABLE("Unknown StyleShapeSourceType!");
   }
 }
 
 #ifdef NS_BUILD_REFCNT_LOGGING
 nsFloatManager::FloatInfo::FloatInfo(FloatInfo&& aOther)
   : mFrame(Move(aOther.mFrame))