Bug 1001233 - Convert bullet frame's margin to the block frame's writing mode when positioning bullet. r=smontagu, a=lsblakk
authorJonathan Kew <jkew@mozilla.com>
Tue, 13 May 2014 18:09:27 +0100
changeset 192283 542398357372
parent 192282 b927870d378d
child 192284 41a1653a0199
push id3557
push userryanvm@gmail.com
push date2014-05-14 16:23 +0000
Treeherderresults
reviewerssmontagu, lsblakk
bugs1001233
milestone30.0
Bug 1001233 - Convert bullet frame's margin to the block frame's writing mode when positioning bullet. r=smontagu, a=lsblakk
layout/generic/crashtests/1001233.html
layout/generic/crashtests/crashtests.list
layout/generic/nsBlockFrame.cpp
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/1001233.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+li::-moz-list-bullet {
+  direction: rtl;
+  margin-right: 1em;
+}
+</style>
+</head>
+<body>
+Body
+<ul>
+<li>list item</li>
+</ul>
+</body>
+</html>
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -521,9 +521,10 @@ load 893496-1.html
 load 893523.html
 test-pref(layout.css.sticky.enabled,true) load 914891.html
 test-pref(layout.css.sticky.enabled,true) load 915475.xhtml
 load 943509-1.html
 asserts(4-8) load 944909-1.html
 test-pref(layout.css.sticky.enabled,true) load 949932.html
 load 973701-1.xhtml
 load 973701-2.xhtml
+load 1001233.html
 load outline-on-frameset.xhtml
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -6845,28 +6845,36 @@ nsBlockFrame::ReflowBullet(nsIFrame* aBu
   // the edge of the floats is the content-edge of the block, and place
   // the bullet at a position offset from there by the block's padding,
   // the block's border, and the bullet frame's margin.
 
   // IStart from floatAvailSpace gives us the content/float start edge
   // in the current writing mode. Then we subtract out the start
   // border/padding and the bullet's width and margin to offset the position.
   WritingMode wm = rs.GetWritingMode();
-  LogicalRect logicalFAS(wm, floatAvailSpace, floatAvailSpace.XMost());
+  nscoord containerWidth = floatAvailSpace.XMost();
+  LogicalRect logicalFAS(wm, floatAvailSpace, containerWidth);
+  // Get the bullet's margin, converted to our writing mode so that we can
+  // combine it with other logical values here.
+  WritingMode bulletWM = reflowState.GetWritingMode();
+  LogicalMargin bulletMargin =
+    reflowState.ComputedLogicalMargin().ConvertTo(wm, bulletWM);
   nscoord iStart = logicalFAS.IStart(wm) -
-    rs.ComputedLogicalBorderPadding().IStart(wm)
-    - reflowState.ComputedLogicalMargin().IEnd(wm) - aMetrics.ISize();
+                   rs.ComputedLogicalBorderPadding().IStart(wm) -
+                   bulletMargin.IEnd(wm) -
+                   aMetrics.ISize();
 
   // Approximate the bullets position; vertical alignment will provide
-  // the final vertical location.
+  // the final vertical location. We pass our writing-mode here, because
+  // it may be different from the bullet frame's mode.
   nscoord bStart = logicalFAS.BStart(wm);
-  aBulletFrame->SetRect(LogicalRect(wm, LogicalPoint(wm, iStart, bStart),
-                                    LogicalSize(wm, aMetrics.ISize(),
-                                                aMetrics.BSize())),
-                        floatAvailSpace.XMost());
+  aBulletFrame->SetRect(wm, LogicalRect(wm, LogicalPoint(wm, iStart, bStart),
+                                        LogicalSize(wm, aMetrics.ISize(),
+                                                    aMetrics.BSize())),
+                        containerWidth);
   aBulletFrame->DidReflow(aState.mPresContext, &aState.mReflowState,
                           nsDidReflowStatus::FINISHED);
 }
 
 // This is used to scan frames for any float placeholders, add their
 // floats to the list represented by aList, and remove the
 // floats from whatever list they might be in. We don't search descendants
 // that are float containing blocks.  Floats that or not children of 'this'