Bug 409587 - "input[type="file"] cropped when narrow width specified" [p=kinetik@flim.org (Matthew Gregan) r+sr=roc a1.9=beltzner]
authorreed@reedloden.com
Mon, 07 Jan 2008 14:18:06 -0800
changeset 9999 ab89ddc74ea74e910680b1c6a1c92c1c850d241c
parent 9998 f0e8297991c45acf52e44aeca47cbe99d8bfb23c
child 10000 f2fd1d5af9965e052c0879692a09131aafd40d5e
push idunknown
push userunknown
push dateunknown
bugs409587
milestone1.9b3pre
Bug 409587 - "input[type="file"] cropped when narrow width specified" [p=kinetik@flim.org (Matthew Gregan) r+sr=roc a1.9=beltzner]
layout/forms/nsFileControlFrame.cpp
layout/reftests/forms/input-file-width-clip-1.html
layout/reftests/forms/input-file-width-clip-ref.html
layout/reftests/forms/reftest.list
layout/reftests/reftest.list
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -537,18 +537,20 @@ nsFileControlFrame::BuildDisplayList(nsD
   // has no effect in others.
   nsDisplayListCollection tempList;
   nsresult rv = nsAreaFrame::BuildDisplayList(aBuilder, aDirtyRect, tempList);
   if (NS_FAILED(rv))
     return rv;
 
   tempList.BorderBackground()->DeleteAll();
 
-  rv = OverflowClip(aBuilder, tempList, aLists,
-                    nsRect(aBuilder->ToReferenceFrame(this), GetSize()));
+  // Clip height only
+  nsRect clipRect(aBuilder->ToReferenceFrame(this), GetSize());
+  clipRect.width = GetOverflowRect().XMost();
+  rv = OverflowClip(aBuilder, tempList, aLists, clipRect);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Disabled file controls don't pass mouse events to their children, so we
   // put an invisible item in the display list above the children
   // just to catch events
   // REVIEW: I'm not sure why we do this, but that's what nsFileControlFrame::
   // GetFrameForPoint was doing
   if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled) && 
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/input-file-width-clip-1.html
@@ -0,0 +1,3 @@
+<div><input type="file" style="width: 5px"></div>
+<div><input type="file" style="width: 500px"></div>
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/input-file-width-clip-ref.html
@@ -0,0 +1,3 @@
+<div style="width: 5px;"><input type="file"></div>
+<div style="width: 500px;"><input type="file"></div>
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/reftest.list
@@ -0,0 +1,1 @@
+== input-file-width-clip-1.html input-file-width-clip-ref.html # bug 409587
--- a/layout/reftests/reftest.list
+++ b/layout/reftests/reftest.list
@@ -79,8 +79,11 @@ include image-region/reftest.list
 include ib-split/reftest.list
 
 # line-breaking
 include line-breaking/reftest.list
 
 # percent-overflow-sizing
 include percent-overflow-sizing/reftest.list
 
+# forms
+include forms/reftest.list
+