Bug 409587 - "input[type="file"] cropped when narrow width specified" [p=kinetik@flim.org (Matthew Gregan) r+sr=roc a1.9=beltzner]
--- 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
+