bug 1019470 - restore space after list-style-image bullet. r=mats
authorJonathan Kew <jkew@mozilla.com>
Wed, 04 Jun 2014 10:18:52 +0100
changeset 206896 d11e57cde6aa07e0dc4b96ae61b579232b470b22
parent 206789 4faf95ee362021845d3045269d9875283007caed
child 206897 a4e77cc8f619dc3cd2751015e16ddb19c4c3b3cd
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1019470
milestone32.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 1019470 - restore space after list-style-image bullet. r=mats
layout/generic/nsBulletFrame.cpp
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -1536,45 +1536,56 @@ nsBulletFrame::GetDesiredSize(nsPresCont
                               nsHTMLReflowMetrics& aMetrics,
                               float aFontSizeInflation)
 {
   // Reset our padding.  If we need it, we'll set it below.
   mPadding.SizeTo(0, 0, 0, 0);
   
   const nsStyleList* myList = StyleList();
   nscoord ascent;
+  nsRefPtr<nsFontMetrics> fm;
+  nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
+                                        aFontSizeInflation);
 
   RemoveStateBits(BULLET_FRAME_IMAGE_LOADING);
 
   if (myList->GetListStyleImage() && mImageRequest) {
     uint32_t status;
     mImageRequest->GetImageStatus(&status);
     if (status & imgIRequest::STATUS_SIZE_AVAILABLE &&
         !(status & imgIRequest::STATUS_ERROR)) {
       // auto size the image
       aMetrics.Width() = mIntrinsicSize.width;
       aMetrics.SetTopAscent(aMetrics.Height() = mIntrinsicSize.height);
 
+      // Add spacing to the padding.
+      nscoord halfEm = fm->EmHeight() / 2;
+      WritingMode wm = GetWritingMode();
+      if (wm.IsVertical()) {
+        mPadding.bottom += halfEm;
+      } else if (wm.IsBidiLTR()) {
+        mPadding.right += halfEm;
+      } else {
+        mPadding.left += halfEm;
+      }
+
       AddStateBits(BULLET_FRAME_IMAGE_LOADING);
 
       return;
     }
   }
 
   // If we're getting our desired size and don't have an image, reset
   // mIntrinsicSize to (0,0).  Otherwise, if we used to have an image, it
   // changed, and the new one is coming in, but we're reflowing before it's
   // fully there, we'll end up with mIntrinsicSize not matching our size, but
   // won't trigger a reflow in OnStartContainer (because mIntrinsicSize will
   // match the image size).
   mIntrinsicSize.SizeTo(0, 0);
 
-  nsRefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
-                                        aFontSizeInflation);
   nscoord bulletSize;
 
   nsAutoString text;
   switch (myList->mListStyleType) {
     case NS_STYLE_LIST_STYLE_NONE:
       aMetrics.Width() = aMetrics.Height() = 0;
       aMetrics.SetTopAscent(0);
       break;
@@ -1584,17 +1595,17 @@ nsBulletFrame::GetDesiredSize(nsPresCont
     case NS_STYLE_LIST_STYLE_SQUARE: {
       ascent = fm->MaxAscent();
       bulletSize = std::max(nsPresContext::CSSPixelsToAppUnits(MIN_BULLET_SIZE),
                           NSToCoordRound(0.8f * (float(ascent) / 2.0f)));
       mPadding.bottom = NSToCoordRound(float(ascent) / 8.0f);
       aMetrics.Width() = aMetrics.Height() = bulletSize;
       aMetrics.SetTopAscent(bulletSize + mPadding.bottom);
 
-      // Add spacing to the padding
+      // Add spacing to the padding.
       nscoord halfEm = fm->EmHeight() / 2;
       WritingMode wm = GetWritingMode();
       if (wm.IsVertical()) {
         mPadding.bottom += halfEm;
       } else if (wm.IsBidiLTR()) {
         mPadding.right += halfEm;
       } else {
         mPadding.left += halfEm;