diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 564c26d3ae..79147695fa 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -7398,7 +7398,6 @@ nsBlockFrame::ISizeToClearPastFloats(const nsBlockReflowState& aState, LogicalMargin computedMargin = offsetState.ComputedLogicalMargin().ConvertTo(wm, frWM); result.marginIStart = computedMargin.IStart(wm); - result.marginIEnd = computedMargin.IEnd(wm); return result; } diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index 6e92628b35..48c3385ca3 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -320,9 +320,9 @@ public: * care about (which need not be its current mBCoord) */ struct ReplacedElementISizeToClear { - nscoord marginIStart, borderBoxISize, marginIEnd; - nscoord MarginBoxISize() const - { return marginIStart + borderBoxISize + marginIEnd; } + // Note that we care about the inline-start margin but can ignore + // the inline-end margin. + nscoord marginIStart, borderBoxISize; }; static ReplacedElementISizeToClear ISizeToClearPastFloats(const nsBlockReflowState& aState, diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index 88a1b8dad8..344e050f6d 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -315,13 +315,16 @@ nsBlockReflowState::ReplacedBlockFitsInAvailSpace(nsIFrame* aReplacedBlock, nsBlockFrame::ReplacedElementISizeToClear replacedISize = nsBlockFrame::ISizeToClearPastFloats(*this, aFloatAvailableSpace.mRect, aReplacedBlock); + // The inline-start side of the replaced element should be offset by + // the larger of the float intrusion or the replaced element's own + // start margin. The inline-end side is similar, except for Web + // compatibility we ignore the margin. return std::max(aFloatAvailableSpace.mRect.IStart(wm) - mContentArea.IStart(wm), replacedISize.marginIStart) + replacedISize.borderBoxISize + - std::max(mContentArea.IEnd(wm) - - aFloatAvailableSpace.mRect.IEnd(wm), - replacedISize.marginIEnd) <= + (mContentArea.IEnd(wm) - + aFloatAvailableSpace.mRect.IEnd(wm)) <= mContentArea.ISize(wm); } diff --git a/layout/reftests/bugs/1062963-floatmanager-reflow.html b/layout/reftests/bugs/1062963-floatmanager-reflow.html index 85cbb7dd07..1f7bcff88a 100644 --- a/layout/reftests/bugs/1062963-floatmanager-reflow.html +++ b/layout/reftests/bugs/1062963-floatmanager-reflow.html @@ -18,7 +18,7 @@ } .fl, .fr { height: 20px; } - .fl { float: left; width: 56px; } + .fl { float: left; width: 100px; } .fr { float: right; width: 73px; } .t { background: blue; height: 10px; width: 100px; border-spacing: 0; } diff --git a/layout/reftests/bugs/427129-image.html b/layout/reftests/bugs/427129-image.html index 46a5b08a41..5bdfadc3bb 100644 --- a/layout/reftests/bugs/427129-image.html +++ b/layout/reftests/bugs/427129-image.html @@ -137,6 +137,18 @@ +
+
+
+ +
+ +
+
+
+ +
+
@@ -184,6 +196,17 @@
+
+
+
+ +
+ +
+
+
+ +
diff --git a/layout/reftests/bugs/427129-ref.html b/layout/reftests/bugs/427129-ref.html index b48085a5fb..331409e40d 100644 --- a/layout/reftests/bugs/427129-ref.html +++ b/layout/reftests/bugs/427129-ref.html @@ -92,9 +92,15 @@
- -
+
+
+ +
+
+
+ +
+
@@ -126,9 +132,15 @@
- -
+
+
+ +
+
+
+ +
+
diff --git a/layout/reftests/bugs/427129-scrollframe.html b/layout/reftests/bugs/427129-scrollframe.html index 184709878f..a5974e9b88 100644 --- a/layout/reftests/bugs/427129-scrollframe.html +++ b/layout/reftests/bugs/427129-scrollframe.html @@ -137,6 +137,18 @@
+
+
+
+
+
+ +
+
+
+
+
+
@@ -184,6 +196,18 @@
+ +
+
+
+
+
+ +
+
+
+
+
diff --git a/layout/reftests/bugs/427129-table-caption-ref.html b/layout/reftests/bugs/427129-table-caption-ref.html index b84b332421..26cb22d3e1 100644 --- a/layout/reftests/bugs/427129-table-caption-ref.html +++ b/layout/reftests/bugs/427129-table-caption-ref.html @@ -252,7 +252,6 @@
-
@@ -274,7 +273,6 @@
-
@@ -296,7 +294,6 @@
-
@@ -318,8 +315,7 @@
-
-
@@ -340,7 +336,6 @@
-
@@ -362,7 +357,6 @@
-
@@ -584,7 +578,6 @@
-
@@ -609,7 +602,6 @@
-
@@ -634,7 +626,6 @@
-
@@ -657,8 +648,7 @@
-
-
@@ -679,7 +669,6 @@
-
@@ -701,7 +690,6 @@
-
diff --git a/layout/reftests/bugs/427129-table.html b/layout/reftests/bugs/427129-table.html index 7a6ac46a2e..4d0a2de3dd 100644 --- a/layout/reftests/bugs/427129-table.html +++ b/layout/reftests/bugs/427129-table.html @@ -139,6 +139,18 @@
+
+
+
+
+
+ +
+
+
+
+
+
@@ -186,6 +198,18 @@
+ +
+
+
+
+
+ +
+
+
+
+
diff --git a/layout/reftests/floats/bfc-displace-4-ref.html b/layout/reftests/floats/bfc-displace-4-ref.html new file mode 100644 index 0000000000..959f4bbef0 --- /dev/null +++ b/layout/reftests/floats/bfc-displace-4-ref.html @@ -0,0 +1,31 @@ + +Test of block formatting context displacement by floats + + + +
+
+
+
diff --git a/layout/reftests/floats/bfc-displace-4.html b/layout/reftests/floats/bfc-displace-4.html new file mode 100644 index 0000000000..2ff18c691e --- /dev/null +++ b/layout/reftests/floats/bfc-displace-4.html @@ -0,0 +1,35 @@ + +Test of block formatting context displacement by floats + + + + + +
+
+
+
diff --git a/layout/reftests/floats/reftest.list b/layout/reftests/floats/reftest.list index a814b75ef1..acf13378cf 100644 --- a/layout/reftests/floats/reftest.list +++ b/layout/reftests/floats/reftest.list @@ -43,4 +43,5 @@ fails == 345369-2.html 345369-2-ref.html == bfc-displace-2b.html bfc-displace-2b-ref.html == bfc-displace-3a.html bfc-displace-3a-ref.html == bfc-displace-3b.html bfc-displace-3b-ref.html +== bfc-displace-4.html bfc-displace-4-ref.html == bfc-shrink-1.html bfc-shrink-1-ref.html