Bug 823483 patch 5 - Make (again) percentage width on text inputs make intrinsic minimum width be 0. r?dholbert draft
authorL. David Baron <dbaron@dbaron.org>
Sat, 30 Jan 2016 14:15:18 +1100
changeset 327285 bb79a339eb039c2035e2409b0510c394e5476d9f
parent 327284 99bead8befaea74456d86b7603bc39765ac8c094
child 327286 e41487ceb369157fc0b5569525da11204723dfaa
push id10219
push userdbaron@mozilla.com
push dateSat, 30 Jan 2016 03:15:34 +0000
reviewersdholbert
bugs823483
milestone47.0a1
Bug 823483 patch 5 - Make (again) percentage width on text inputs make intrinsic minimum width be 0. r?dholbert This restores the quirky behavior for text inputs, which was removed by patch 2, but only halfway (for width but not max-width), which matches Chromium and Edge.
layout/base/nsLayoutUtils.cpp
layout/reftests/bugs/reftest.list
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -4539,21 +4539,24 @@ AddIntrinsicSizeOffset(nsRenderingContex
   pctOutsideSize += aOffsets.hPctMargin;
 
   min += coordOutsideSize;
   result = NSCoordSaturatingAdd(result, coordOutsideSize);
   pctTotal += pctOutsideSize;
 
   nscoord size;
   if (aType == nsLayoutUtils::MIN_ISIZE &&
-      (aStyleSize.HasPercent() ||
-       aStyleMaxSize.HasPercent()) &&
-      aFrame->IsFrameOfType(nsIFrame::eReplacedSizing)) {
+      (((aStyleSize.HasPercent() || aStyleMaxSize.HasPercent()) &&
+        aFrame->IsFrameOfType(nsIFrame::eReplacedSizing)) ||
+       (aStyleSize.HasPercent() &&
+        aFrame->GetType() == nsGkAtoms::textInputFrame))) {
     // A percentage width or max-width on replaced elements means they
     // can shrink to 0.
+    // This is also true for percentage widths (but not max-widths) on
+    // text inputs.
     // Note that if this is max-width, this overrides the fixed-width
     // rule in the next condition.
     result = 0; // let |min| handle padding/border/margin
   } else if (GetAbsoluteCoord(aStyleSize, size) ||
              GetIntrinsicCoord(aStyleSize, aRenderingContext, aFrame,
                                PROP_WIDTH, size)) {
     result = nsLayoutUtils::AddPercents(aType, size + coordOutsideSize,
                                         pctOutsideSize);
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -53,17 +53,17 @@ asserts(2) skip-if(!cocoaWidget) HTTP(..
 == 25888-2l-block.html 25888-2l-ref.html
 == 25888-2r-block.html 25888-2r-ref.html
 == 25888-3l-block.html 25888-3l-ref.html
 == 25888-3r-block.html 25888-3r-ref.html
 skip-if(B2G||Mulet) == 28811-1a.html 28811-1-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 fuzzy-if(gtkWidget,6,26200) == 28811-1b.html 28811-1-ref.html  # Bug 1128229
 skip-if(B2G||Mulet) == 28811-2a.html 28811-2-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 fuzzy-if(gtkWidget,6,26200) == 28811-2b.html 28811-2-ref.html  # Bug 1128229
-!= 40596-1a.html 40596-1-ref.html
+== 40596-1a.html 40596-1-ref.html
 != 40596-1b.html 40596-1-ref.html
 != 40596-1c.html 40596-1-ref.html
 != 40596-1d.html 40596-1-ref.html
 != 40596-1e.html 40596-1-ref.html
 != 40596-1f.html 40596-1-ref.html
 != 40596-1g.html 40596-1-ref.html
 != 40596-1h.html 40596-1-ref.html
 != 40596-1i.html 40596-1-ref.html