Bug 1455453 - Coalesce calls to mFrame->StyleDisplay() in FloatInfo constructor. draft
authorTing-Yu Lin <aethanyc@gmail.com>
Mon, 11 Jun 2018 22:46:35 +0800
changeset 806742 b56418864906bbb246a810cded1a1481cf042bf9
parent 806725 9941eb8c3b29d152851220b5d9791326c35e1c68
push id112933
push userbmo:aethanyc@gmail.com
push dateMon, 11 Jun 2018 15:30:54 +0000
bugs1455453
milestone62.0a1
Bug 1455453 - Coalesce calls to mFrame->StyleDisplay() in FloatInfo constructor. MozReview-Commit-ID: 2tdsttkO6ig
layout/generic/nsFloatManager.cpp
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -2381,35 +2381,36 @@ nsFloatManager::FloatInfo::FloatInfo(nsI
     // margin box. Therefore, no need to create a shape info if the float's
     // margin box is empty, since a float area can only be smaller than the
     // margin box.
 
     // https://drafts.csswg.org/css-shapes/#relation-to-box-model-and-float-behavior
     return;
   }
 
-  const StyleShapeSource& shapeOutside = mFrame->StyleDisplay()->mShapeOutside;
+  const nsStyleDisplay* styleDisplay = mFrame->StyleDisplay();
+  const StyleShapeSource& shapeOutside = styleDisplay->mShapeOutside;
 
   nscoord shapeMargin = (shapeOutside.GetType() == StyleShapeSourceType::None)
    ? 0
    : nsLayoutUtils::ResolveToLength<true>(
-       mFrame->StyleDisplay()->mShapeMargin,
+       styleDisplay->mShapeMargin,
        LogicalSize(aWM, aContainerSize).ISize(aWM));
 
   switch (shapeOutside.GetType()) {
     case StyleShapeSourceType::None:
       // No need to create shape info.
       return;
 
     case StyleShapeSourceType::URL:
       MOZ_ASSERT_UNREACHABLE("shape-outside doesn't have URL source type!");
       return;
 
     case StyleShapeSourceType::Image: {
-      float shapeImageThreshold = mFrame->StyleDisplay()->mShapeImageThreshold;
+      float shapeImageThreshold = styleDisplay->mShapeImageThreshold;
       mShapeInfo = ShapeInfo::CreateImageShape(shapeOutside.GetShapeImage(),
                                                shapeImageThreshold,
                                                shapeMargin,
                                                mFrame,
                                                aMarginRect,
                                                aWM,
                                                aContainerSize);
       if (!mShapeInfo) {