diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index 3d90c07f2ceb..62dbad37ad01 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -268,31 +268,9 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext, // Buttons have some bonus renderer-determined border/padding, // which occupies part of the button's content-box area: - LogicalMargin focusPadding = + const LogicalMargin focusPadding = LogicalMargin(wm, mRenderer.GetAddedButtonBorderAndPadding()); - // See whether out availSize's inline-size is big enough. If it's - // smaller than our intrinsic min iSize, that means that the kid - // wouldn't really fit. In that case, we overflow into our internal - // focuspadding (which other browsers don't have) so that there's a - // little more space for it. - // Note that GetMinISize includes the focusPadding. - nscoord IOverflow = GetMinISize(aButtonReflowState.rendContext) - - aButtonReflowState.ComputedISize(); - nscoord IFocusPadding = focusPadding.IStartEnd(wm); - nscoord focusPaddingReduction = std::min(IFocusPadding, - std::max(IOverflow, 0)); - if (focusPaddingReduction > 0) { - nscoord startReduction = focusPadding.IStart(wm); - if (focusPaddingReduction != IFocusPadding) { - startReduction = NSToCoordRound(startReduction * - (float(focusPaddingReduction) / - float(IFocusPadding))); - } - focusPadding.IStart(wm) -= startReduction; - focusPadding.IEnd(wm) -= focusPaddingReduction - startReduction; - } - // shorthand for a value we need to use in a bunch of places const LogicalMargin& clbp = aButtonReflowState.ComputedLogicalBorderPadding(); @@ -300,8 +278,26 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext, // from the regular border. availSize.ISize(wm) -= focusPadding.IStartEnd(wm); + // See whether out availSize's inline-size is big enough. If it's smaller than + // our intrinsic min iSize, that means that the kid wouldn't really fit; for a + // better look in such cases we adjust the available iSize and our inline-start + // offset to allow the kid to spill start-wards into our padding. LogicalPoint childPos(wm); childPos.I(wm) = focusPadding.IStart(wm) + clbp.IStart(wm); + nscoord extraISize = GetMinISize(aButtonReflowState.rendContext) - + aButtonReflowState.ComputedISize(); + if (extraISize > 0) { + nscoord extraIStart = extraISize / 2; + nscoord extraIEnd = extraISize - extraIStart; + NS_ASSERTION(extraIEnd >=0, "How'd that happen?"); + + // Do not allow the extras to be bigger than the relevant padding + const LogicalMargin& padding = aButtonReflowState.ComputedLogicalPadding(); + extraIStart = std::min(extraIStart, padding.IStart(wm)); + extraIEnd = std::min(extraIEnd, padding.IEnd(wm)); + childPos.I(wm) -= extraIStart; + availSize.ISize(wm) = availSize.ISize(wm) + extraIStart + extraIEnd; + } availSize.ISize(wm) = std::max(availSize.ISize(wm), 0); // Give child a clone of the button's reflow state, with height/width reduced diff --git a/layout/reftests/bugs/491180-1-ref.html b/layout/reftests/bugs/491180-1-ref.html index 2cf61ad16553..f25b10a49f11 100644 --- a/layout/reftests/bugs/491180-1-ref.html +++ b/layout/reftests/bugs/491180-1-ref.html @@ -1,5 +1,5 @@ -
+
Some text
diff --git a/layout/reftests/bugs/491180-2-ref.html b/layout/reftests/bugs/491180-2-ref.html index 2b7a85630dd3..615c709ddcc4 100644 --- a/layout/reftests/bugs/491180-2-ref.html +++ b/layout/reftests/bugs/491180-2-ref.html @@ -1,4 +1,4 @@ -
Some text
+
Some text
diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 6c35a73631bf..a3fd2db9462c 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -152,8 +152,8 @@ random == 99850-1b.html 99850-1-ref.html # bug 471629 == 179596-2.html 179596-2-ref.html == 179596-2.html 179596-2-ref2.html == 179596-2.html 179596-2-ref3.html -!= 180085-1.html 180085-1-ref.html # fix for 180085 reverted in bug 1010675 -!= 180085-2.html 180085-2-ref.html # fix for 180085 reverted in bug 1010675 +== 180085-1.html 180085-1-ref.html +== 180085-2.html 180085-2-ref.html == 185388-1.html 185388-1-ref.html == 186317-1.html 186317-1-ref.html == 192902-1.html 192902-ref.html @@ -527,8 +527,8 @@ random-if(cocoaWidget) == 350506-1.html 350506-1-ref.html == 356774-1.html 356774-1-ref.html == 356775-1.html 356775-1-ref.html == 359869-1.html 359869-1-ref.html -fails-if(OSX) != 359903-1.html 359903-1-ref.html # erosion of padding removed in bug 1010675 # failure is bug 1145589 -!= 359903-2.html 359903-2-ref.html # erosion of padding removed in bug 1010675 +skip-if(B2G||Mulet) == 359903-1.html 359903-1-ref.html # Initial mulet triage: parity with B2G/B2G Desktop +== 359903-2.html 359903-2-ref.html == 360065-1.html 360065-1-ref.html == 360746-1.html 360746-1-ref.html == 360757-1a.html 360757-1-ref.html diff --git a/layout/reftests/forms/button/reftest.list b/layout/reftests/forms/button/reftest.list index 2430dbaf7617..6143c6a4d2b0 100644 --- a/layout/reftests/forms/button/reftest.list +++ b/layout/reftests/forms/button/reftest.list @@ -27,16 +27,3 @@ fails-if(Android||B2G||Mulet) == disabled-1.html disabled-1-ref.html # Initial m != disabled-4.html disabled-4-notref.html != disabled-5.html disabled-5-notref.html != disabled-6.html disabled-6-notref.html - -== width-auto-size-em-ltr.html width-auto-size-em-ltr-ref.html -== width-auto-size-ltr.html width-auto-size-ltr-ref.html -== width-exact-fit-ltr.html width-auto-size-ltr-ref.html -== width-erode-part-focuspadding-ltr.html width-erode-part-focuspadding-ltr-ref.html -== width-erode-all-focuspadding-ltr.html width-erode-all-focuspadding-ltr-ref.html -== width-erode-overflow-focuspadding-ltr.html width-erode-overflow-focuspadding-ltr-ref.html -== width-auto-size-em-rtl.html width-auto-size-em-rtl-ref.html -== width-auto-size-rtl.html width-auto-size-rtl-ref.html -== width-exact-fit-rtl.html width-auto-size-rtl-ref.html -== width-erode-part-focuspadding-rtl.html width-erode-part-focuspadding-rtl-ref.html -== width-erode-all-focuspadding-rtl.html width-erode-all-focuspadding-rtl-ref.html -== width-erode-overflow-focuspadding-rtl.html width-erode-overflow-focuspadding-rtl-ref.html diff --git a/layout/reftests/forms/button/width-auto-size-em-ltr-ref.html b/layout/reftests/forms/button/width-auto-size-em-ltr-ref.html deleted file mode 100644 index 1e7ab40bba78..000000000000 --- a/layout/reftests/forms/button/width-auto-size-em-ltr-ref.html +++ /dev/null @@ -1,19 +0,0 @@ - - - -
diff --git a/layout/reftests/forms/button/width-auto-size-em-ltr.html b/layout/reftests/forms/button/width-auto-size-em-ltr.html deleted file mode 100644 index 3285c3e9551e..000000000000 --- a/layout/reftests/forms/button/width-auto-size-em-ltr.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - diff --git a/layout/reftests/forms/button/width-auto-size-em-rtl-ref.html b/layout/reftests/forms/button/width-auto-size-em-rtl-ref.html deleted file mode 100644 index 1214714744d7..000000000000 --- a/layout/reftests/forms/button/width-auto-size-em-rtl-ref.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - -
diff --git a/layout/reftests/forms/button/width-auto-size-em-rtl.html b/layout/reftests/forms/button/width-auto-size-em-rtl.html deleted file mode 100644 index fb72ef97e9ab..000000000000 --- a/layout/reftests/forms/button/width-auto-size-em-rtl.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/layout/reftests/forms/button/width-auto-size-ltr-ref.html b/layout/reftests/forms/button/width-auto-size-ltr-ref.html deleted file mode 100644 index c1ba89860ef6..000000000000 --- a/layout/reftests/forms/button/width-auto-size-ltr-ref.html +++ /dev/null @@ -1,20 +0,0 @@ - - - -
diff --git a/layout/reftests/forms/button/width-auto-size-ltr.html b/layout/reftests/forms/button/width-auto-size-ltr.html deleted file mode 100644 index c8f3f7d110cd..000000000000 --- a/layout/reftests/forms/button/width-auto-size-ltr.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - diff --git a/layout/reftests/forms/button/width-auto-size-rtl-ref.html b/layout/reftests/forms/button/width-auto-size-rtl-ref.html deleted file mode 100644 index 3e09016dc333..000000000000 --- a/layout/reftests/forms/button/width-auto-size-rtl-ref.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - -
diff --git a/layout/reftests/forms/button/width-auto-size-rtl.html b/layout/reftests/forms/button/width-auto-size-rtl.html deleted file mode 100644 index 7ae3092f94bc..000000000000 --- a/layout/reftests/forms/button/width-auto-size-rtl.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/layout/reftests/forms/button/width-erode-all-focuspadding-ltr-ref.html b/layout/reftests/forms/button/width-erode-all-focuspadding-ltr-ref.html deleted file mode 100644 index c85da00e3ce4..000000000000 --- a/layout/reftests/forms/button/width-erode-all-focuspadding-ltr-ref.html +++ /dev/null @@ -1,20 +0,0 @@ - - - -
diff --git a/layout/reftests/forms/button/width-erode-all-focuspadding-ltr.html b/layout/reftests/forms/button/width-erode-all-focuspadding-ltr.html deleted file mode 100644 index 4978a57e4eb8..000000000000 --- a/layout/reftests/forms/button/width-erode-all-focuspadding-ltr.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/layout/reftests/forms/button/width-erode-all-focuspadding-rtl-ref.html b/layout/reftests/forms/button/width-erode-all-focuspadding-rtl-ref.html deleted file mode 100644 index 762e443f81f3..000000000000 --- a/layout/reftests/forms/button/width-erode-all-focuspadding-rtl-ref.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - -
diff --git a/layout/reftests/forms/button/width-erode-all-focuspadding-rtl.html b/layout/reftests/forms/button/width-erode-all-focuspadding-rtl.html deleted file mode 100644 index d4b028b48e93..000000000000 --- a/layout/reftests/forms/button/width-erode-all-focuspadding-rtl.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/layout/reftests/forms/button/width-erode-overflow-focuspadding-ltr-ref.html b/layout/reftests/forms/button/width-erode-overflow-focuspadding-ltr-ref.html deleted file mode 100644 index 6f7047cce3c7..000000000000 --- a/layout/reftests/forms/button/width-erode-overflow-focuspadding-ltr-ref.html +++ /dev/null @@ -1,20 +0,0 @@ - - - -
diff --git a/layout/reftests/forms/button/width-erode-overflow-focuspadding-ltr.html b/layout/reftests/forms/button/width-erode-overflow-focuspadding-ltr.html deleted file mode 100644 index daecef56e4c3..000000000000 --- a/layout/reftests/forms/button/width-erode-overflow-focuspadding-ltr.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/layout/reftests/forms/button/width-erode-overflow-focuspadding-rtl-ref.html b/layout/reftests/forms/button/width-erode-overflow-focuspadding-rtl-ref.html deleted file mode 100644 index 1b36154cfcab..000000000000 --- a/layout/reftests/forms/button/width-erode-overflow-focuspadding-rtl-ref.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - -
diff --git a/layout/reftests/forms/button/width-erode-overflow-focuspadding-rtl.html b/layout/reftests/forms/button/width-erode-overflow-focuspadding-rtl.html deleted file mode 100644 index b76a3957a53a..000000000000 --- a/layout/reftests/forms/button/width-erode-overflow-focuspadding-rtl.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/layout/reftests/forms/button/width-erode-part-focuspadding-ltr-ref.html b/layout/reftests/forms/button/width-erode-part-focuspadding-ltr-ref.html deleted file mode 100644 index 59cbd020864e..000000000000 --- a/layout/reftests/forms/button/width-erode-part-focuspadding-ltr-ref.html +++ /dev/null @@ -1,20 +0,0 @@ - - - -
diff --git a/layout/reftests/forms/button/width-erode-part-focuspadding-ltr.html b/layout/reftests/forms/button/width-erode-part-focuspadding-ltr.html deleted file mode 100644 index c0d64b279702..000000000000 --- a/layout/reftests/forms/button/width-erode-part-focuspadding-ltr.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/layout/reftests/forms/button/width-erode-part-focuspadding-rtl-ref.html b/layout/reftests/forms/button/width-erode-part-focuspadding-rtl-ref.html deleted file mode 100644 index 0765a673dfb9..000000000000 --- a/layout/reftests/forms/button/width-erode-part-focuspadding-rtl-ref.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - -
diff --git a/layout/reftests/forms/button/width-erode-part-focuspadding-rtl.html b/layout/reftests/forms/button/width-erode-part-focuspadding-rtl.html deleted file mode 100644 index 9b8826938558..000000000000 --- a/layout/reftests/forms/button/width-erode-part-focuspadding-rtl.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/layout/reftests/forms/button/width-exact-fit-ltr.html b/layout/reftests/forms/button/width-exact-fit-ltr.html deleted file mode 100644 index 58db0aa70c98..000000000000 --- a/layout/reftests/forms/button/width-exact-fit-ltr.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/layout/reftests/forms/button/width-exact-fit-rtl.html b/layout/reftests/forms/button/width-exact-fit-rtl.html deleted file mode 100644 index 996a69d83196..000000000000 --- a/layout/reftests/forms/button/width-exact-fit-rtl.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - -