Bug 115141

Summary: input type="file" and type="text" get wrong size
Product: [Applications] konqueror Reporter: hanno
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description hanno 2005-10-26 19:54:27 UTC
Version:            (using KDE KDE 3.4.92)
Installed from:    Gentoo Packages

HTML-Code:
<form>
<input type="file" size="10"><br/>
<input type="text" size="10">
</form>

Both input-fields should have the same size, but the file-field has more than twice the size of the text-field.
According to the html-spec, 
"The width is given in pixels except when  type attribute has the value "text" or "password". In that case, its value refers to the (integer) number of characters."

First, the behaviour for text and file should be the same.
Second, meeting the spec exactly seems to be impossible without fixed-width fonts. But at least 10 Digits should fit in it (in Firefox, it is the case, exactly place for 10 Digits).

http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-size-INPUT
Comment 1 Juan Carlos Torres 2007-01-06 11:40:27 UTC
I can confirm this behavior on Kubuntu 6.10. using KDE 3.5.5.
Firefox 2.0 displays the sizes correctly, and so does Internet Explorer 6 (ies4linux). Strangely enough, Opera 9.02 doesn't seem to get this correct either.
Comment 2 Germain Garand 2007-01-06 18:04:03 UTC
SVN commit 620582 by ggarand:

fix RenderFileButton minmaxwidth calculation

BUG: 115141


 M  +2 -2      render_form.cpp  


--- trunk/KDE/kdelibs/khtml/rendering/render_form.cpp #620581:620582
@@ -843,7 +843,7 @@
     int size = element()->size();
 
     int h = fm.lineSpacing();
-    int w = fm.width( 'x' ) * (size > 0 ? size : 17); // "some"
+    int w = fm.width( 'x' ) * (size > 0 ? size+1 : 17); // "some"
     KLineEdit* edit = static_cast<KUrlRequester*>( m_widget )->lineEdit();
 
     QStyleOption opt;
@@ -852,7 +852,7 @@
                                              &opt,
           QSize(w + 2 + 2, qMax(h, 14) + 2 + 2), edit)
         .expandedTo(QApplication::globalStrut());
-    QSize bs = static_cast<KUrlRequester*>( m_widget )->sizeHint();
+    QSize bs = static_cast<KUrlRequester*>( m_widget )->minimumSizeHint() - edit->minimumSizeHint();
 
     setIntrinsicWidth( s.width() + bs.width() );
     setIntrinsicHeight( qMax(s.height(), bs.height()) );