Bug 1293242 - Part 1 - Use the computed preferred height of block in box instead of the minimum height. r=dbaron draft
authorNeil Deakin <neil@mozilla.com>
Sun, 19 Mar 2017 08:09:05 +0000
changeset 581143 eb89ea058fdcfddf3e5328cc11651a4ab84c1507
parent 580912 8e98dab5054dd093a37ba20c62cf0523e484cfbd
child 581144 8ccd0ce86b65416e5c5c1ccf64c1002b99d9f2de
push id59780
push userpaolo.mozmail@amadzone.org
push dateFri, 19 May 2017 09:58:56 +0000
reviewersdbaron
bugs1293242, 413027
milestone55.0a1
Bug 1293242 - Part 1 - Use the computed preferred height of block in box instead of the minimum height. r=dbaron This allows the preferred height of a block in box to be computed better. This affects the storage tab in the developer tools as it contains an inline text element with a large padding; the padding isn't being included in the preferred size. I don't adjust the minimum height computation to minimize code change; there is some discussion of this code in bug 413027. MozReview-Commit-ID: BemwJJxNfH6
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -9723,17 +9723,18 @@ nsFrame::RefreshSizeCache(nsBoxLayoutSta
            metrics->mBlockMinSize.height = lineBounds.height;
 
          count++;
       } while(firstFrame);
     } else {
       metrics->mBlockMinSize.height = desiredSize.Height();
     }
 
-    metrics->mBlockPrefSize.height = metrics->mBlockMinSize.height;
+    metrics->mBlockPrefSize.height = std::max(desiredSize.Height(),
+                                              metrics->mBlockMinSize.height);
 
     if (desiredSize.BlockStartAscent() ==
         ReflowOutput::ASK_FOR_BASELINE) {
       if (!nsLayoutUtils::GetFirstLineBaseline(wm, this,
                                                &metrics->mBlockAscent))
         metrics->mBlockAscent = GetLogicalBaseline(wm);
     } else {
       metrics->mBlockAscent = desiredSize.BlockStartAscent();