Index: django/forms/widgets.py
===================================================================
--- django/forms/widgets.py	(Revision 8290)
+++ django/forms/widgets.py	(Arbeitskopie)
@@ -345,7 +345,7 @@
         if value is None: value = ''
         final_attrs = self.build_attrs(attrs, name=name)
         output = [u'<select%s>' % flatatt(final_attrs)]
-        options = self.render_options(choices, [value])
+        options, dont_care = self.render_options(choices, [value])
         if options:
             output.append(options)
         output.append('</select>')
@@ -361,15 +361,18 @@
         # Normalize to strings.
         selected_choices = set([force_unicode(v) for v in selected_choices])
         output = []
+        output_length = 0
         for option_value, option_label in chain(self.choices, choices):
+            output_length += 1
             if isinstance(option_label, (list, tuple)):
                 output.append(u'<optgroup label="%s">' % escape(force_unicode(option_value)))
                 for option in option_label:
+                    output_length += 1
                     output.append(render_option(*option))
                 output.append(u'</optgroup>')
             else:
                 output.append(render_option(option_value, option_label))
-        return u'\n'.join(output)
+        return u'\n'.join(output), output_length
 
 class NullBooleanSelect(Select):
     """
@@ -398,9 +401,13 @@
 class SelectMultiple(Select):
     def render(self, name, value, attrs=None, choices=()):
         if value is None: value = []
+        options, options_length = self.render_options(choices, value)
         final_attrs = self.build_attrs(attrs, name=name)
+        # default size attribute for cross-browser consistent rendering 
+        if 'size' not in final_attrs: 
+            # emulate the behaviour of firefox: adjust the size to the number of choices, with an upper boundary 
+            final_attrs['size'] = min(10, max(1, options_length))
         output = [u'<select multiple="multiple"%s>' % flatatt(final_attrs)]
-        options = self.render_options(choices, value)
         if options:
             output.append(options)
         output.append('</select>')
Index: tests/modeltests/model_forms/models.py
===================================================================
--- tests/modeltests/model_forms/models.py	(Revision 8290)
+++ tests/modeltests/model_forms/models.py	(Arbeitskopie)
@@ -342,7 +342,7 @@
 <option value="2">Pending</option>
 <option value="3">Live</option>
 </select></td></tr>
-<tr><th>Categories:</th><td><select multiple="multiple" name="categories">
+<tr><th>Categories:</th><td><select multiple="multiple" name="categories" size="3">
 <option value="1">Entertainment</option>
 <option value="2">It&#39;s a test</option>
 <option value="3">Third test</option>
@@ -398,7 +398,7 @@
 <option value="2">Pending</option>
 <option value="3">Live</option>
 </select></li>
-<li>Categories: <select multiple="multiple" name="categories">
+<li>Categories: <select multiple="multiple" name="categories" size="3">
 <option value="1">Entertainment</option>
 <option value="2">It&#39;s a test</option>
 <option value="3">Third test</option>
@@ -459,7 +459,7 @@
 <option value="2">Pending</option>
 <option value="3">Live</option>
 </select></li>
-<li>Categories: <select multiple="multiple" name="categories">
+<li>Categories: <select multiple="multiple" name="categories" size="3">
 <option value="1" selected="selected">Entertainment</option>
 <option value="2">It&#39;s a test</option>
 <option value="3">Third test</option>
@@ -575,7 +575,7 @@
 <option value="2">Pending</option>
 <option value="3">Live</option>
 </select></li>
-<li>Categories: <select multiple="multiple" name="categories">
+<li>Categories: <select multiple="multiple" name="categories" size="3">
 <option value="1">Entertainment</option>
 <option value="2">It&#39;s a test</option>
 <option value="3">Third</option>
@@ -601,7 +601,7 @@
 <option value="2">Pending</option>
 <option value="3">Live</option>
 </select></li>
-<li>Categories: <select multiple="multiple" name="categories">
+<li>Categories: <select multiple="multiple" name="categories" size="4">
 <option value="1">Entertainment</option>
 <option value="2">It&#39;s a test</option>
 <option value="3">Third</option>
Index: tests/regressiontests/admin_widgets/models.py
===================================================================
--- tests/regressiontests/admin_widgets/models.py	(Revision 8290)
+++ tests/regressiontests/admin_widgets/models.py	(Arbeitskopie)
@@ -41,7 +41,7 @@
 
 >>> w = FilteredSelectMultiple('test', False)
 >>> print conditional_escape(w.render('test', 'test'))
-<select multiple="multiple" name="test">
+<select multiple="multiple" name="test" size="1">
 </select><script type="text/javascript">addEvent(window, "load", function(e) {SelectFilter.init("id_test", "test", 0, "%(ADMIN_MEDIA_PREFIX)s"); });</script>
 <BLANKLINE>
 
Index: tests/regressiontests/forms/extra.py
===================================================================
--- tests/regressiontests/forms/extra.py	(Revision 8290)
+++ tests/regressiontests/forms/extra.py	(Arbeitskopie)
@@ -259,7 +259,7 @@
 >>> w = ComplexMultiWidget()
 >>> print w.render('name', 'some text,JP,2007-04-25 06:24:00')
 <input type="text" name="name_0" value="some text" />
-<select multiple="multiple" name="name_1">
+<select multiple="multiple" name="name_1" size="4">
 <option value="J" selected="selected">John</option>
 <option value="P" selected="selected">Paul</option>
 <option value="G">George</option>
@@ -300,7 +300,7 @@
 >>> f = ComplexFieldForm()
 >>> print f
 <tr><th><label for="id_field1_0">Field1:</label></th><td><input type="text" name="field1_0" id="id_field1_0" />
-<select multiple="multiple" name="field1_1" id="id_field1_1">
+<select multiple="multiple" size="4" name="field1_1" id="id_field1_1">
 <option value="J">John</option>
 <option value="P">Paul</option>
 <option value="G">George</option>
@@ -311,7 +311,7 @@
 >>> f = ComplexFieldForm({'field1_0':'some text','field1_1':['J','P'], 'field1_2_0':'2007-04-25', 'field1_2_1':'06:24:00'})
 >>> print f
 <tr><th><label for="id_field1_0">Field1:</label></th><td><input type="text" name="field1_0" value="some text" id="id_field1_0" />
-<select multiple="multiple" name="field1_1" id="id_field1_1">
+<select multiple="multiple" size="4" name="field1_1" id="id_field1_1">
 <option value="J" selected="selected">John</option>
 <option value="P" selected="selected">Paul</option>
 <option value="G">George</option>
Index: tests/regressiontests/forms/forms.py
===================================================================
--- tests/regressiontests/forms/forms.py	(Revision 8290)
+++ tests/regressiontests/forms/forms.py	(Arbeitskopie)
@@ -476,14 +476,14 @@
 ...     composers = MultipleChoiceField()
 >>> f = SongForm(auto_id=False)
 >>> print f['composers']
-<select multiple="multiple" name="composers">
+<select multiple="multiple" name="composers" size="1">
 </select>
 >>> class SongForm(Form):
 ...     name = CharField()
 ...     composers = MultipleChoiceField(choices=[('J', 'John Lennon'), ('P', 'Paul McCartney')])
 >>> f = SongForm(auto_id=False)
 >>> print f['composers']
-<select multiple="multiple" name="composers">
+<select multiple="multiple" name="composers" size="2">
 <option value="J">John Lennon</option>
 <option value="P">Paul McCartney</option>
 </select>
@@ -491,7 +491,7 @@
 >>> print f['name']
 <input type="text" name="name" value="Yesterday" />
 >>> print f['composers']
-<select multiple="multiple" name="composers">
+<select multiple="multiple" name="composers" size="2">
 <option value="J">John Lennon</option>
 <option value="P" selected="selected">Paul McCartney</option>
 </select>
Index: tests/regressiontests/forms/widgets.py
===================================================================
--- tests/regressiontests/forms/widgets.py	(Revision 8290)
+++ tests/regressiontests/forms/widgets.py	(Arbeitskopie)
@@ -527,21 +527,21 @@
 
 >>> w = SelectMultiple()
 >>> print w.render('beatles', ['J'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
-<select multiple="multiple" name="beatles">
+<select multiple="multiple" name="beatles" size="4">
 <option value="J" selected="selected">John</option>
 <option value="P">Paul</option>
 <option value="G">George</option>
 <option value="R">Ringo</option>
 </select>
 >>> print w.render('beatles', ['J', 'P'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
-<select multiple="multiple" name="beatles">
+<select multiple="multiple" name="beatles" size="4">
 <option value="J" selected="selected">John</option>
 <option value="P" selected="selected">Paul</option>
 <option value="G">George</option>
 <option value="R">Ringo</option>
 </select>
 >>> print w.render('beatles', ['J', 'P', 'R'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
-<select multiple="multiple" name="beatles">
+<select multiple="multiple" name="beatles" size="4">
 <option value="J" selected="selected">John</option>
 <option value="P" selected="selected">Paul</option>
 <option value="G">George</option>
@@ -550,7 +550,7 @@
 
 If the value is None, none of the options are selected:
 >>> print w.render('beatles', None, choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
-<select multiple="multiple" name="beatles">
+<select multiple="multiple" name="beatles" size="4">
 <option value="J">John</option>
 <option value="P">Paul</option>
 <option value="G">George</option>
@@ -559,7 +559,7 @@
 
 If the value corresponds to a label (but not to an option value), none of the options are selected:
 >>> print w.render('beatles', ['John'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
-<select multiple="multiple" name="beatles">
+<select multiple="multiple" name="beatles" size="4">
 <option value="J">John</option>
 <option value="P">Paul</option>
 <option value="G">George</option>
@@ -568,7 +568,7 @@
 
 If multiple values are given, but some of them are not valid, the valid ones are selected:
 >>> print w.render('beatles', ['J', 'G', 'foo'], choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')))
-<select multiple="multiple" name="beatles">
+<select multiple="multiple" name="beatles" size="4">
 <option value="J" selected="selected">John</option>
 <option value="P">Paul</option>
 <option value="G" selected="selected">George</option>
@@ -577,19 +577,19 @@
 
 The value is compared to its str():
 >>> print w.render('nums', [2], choices=[('1', '1'), ('2', '2'), ('3', '3')])
-<select multiple="multiple" name="nums">
+<select multiple="multiple" name="nums" size="3">
 <option value="1">1</option>
 <option value="2" selected="selected">2</option>
 <option value="3">3</option>
 </select>
 >>> print w.render('nums', ['2'], choices=[(1, 1), (2, 2), (3, 3)])
-<select multiple="multiple" name="nums">
+<select multiple="multiple" name="nums" size="3">
 <option value="1">1</option>
 <option value="2" selected="selected">2</option>
 <option value="3">3</option>
 </select>
 >>> print w.render('nums', [2], choices=[(1, 1), (2, 2), (3, 3)])
-<select multiple="multiple" name="nums">
+<select multiple="multiple" name="nums" size="3">
 <option value="1">1</option>
 <option value="2" selected="selected">2</option>
 <option value="3">3</option>
@@ -600,7 +600,7 @@
 ...     for i in range(5):
 ...         yield (i, i)
 >>> print w.render('nums', [2], choices=get_choices())
-<select multiple="multiple" name="nums">
+<select multiple="multiple" name="nums" size="5">
 <option value="0">0</option>
 <option value="1">1</option>
 <option value="2" selected="selected">2</option>
@@ -611,7 +611,7 @@
 You can also pass 'choices' to the constructor:
 >>> w = SelectMultiple(choices=[(1, 1), (2, 2), (3, 3)])
 >>> print w.render('nums', [2])
-<select multiple="multiple" name="nums">
+<select multiple="multiple" name="nums" size="3">
 <option value="1">1</option>
 <option value="2" selected="selected">2</option>
 <option value="3">3</option>
@@ -619,7 +619,7 @@
 
 If 'choices' is passed to both the constructor and render(), then they'll both be in the output:
 >>> print w.render('nums', [2], choices=[(4, 4), (5, 5)])
-<select multiple="multiple" name="nums">
+<select multiple="multiple" name="nums" size="5">
 <option value="1">1</option>
 <option value="2" selected="selected">2</option>
 <option value="3">3</option>
@@ -629,7 +629,7 @@
 
 # Choices are escaped correctly
 >>> print w.render('escape', None, choices=(('bad', 'you & me'), ('good', mark_safe('you &gt; me'))))
-<select multiple="multiple" name="escape">
+<select multiple="multiple" name="escape" size="5">
 <option value="1">1</option>
 <option value="2">2</option>
 <option value="3">3</option>
@@ -639,7 +639,7 @@
 
 # Unicode choices are correctly rendered as HTML
 >>> w.render('nums', ['ŠĐĆŽćžšđ'], choices=[('ŠĐĆŽćžšđ', 'ŠĐabcĆŽćžšđ'), ('ćžšđ', 'abcćžšđ')])
-u'<select multiple="multiple" name="nums">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111" selected="selected">\u0160\u0110abc\u0106\u017d\u0107\u017e\u0161\u0111</option>\n<option value="\u0107\u017e\u0161\u0111">abc\u0107\u017e\u0161\u0111</option>\n</select>'
+u'<select multiple="multiple" name="nums" size="5">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111" selected="selected">\u0160\u0110abc\u0106\u017d\u0107\u017e\u0161\u0111</option>\n<option value="\u0107\u017e\u0161\u0111">abc\u0107\u017e\u0161\u0111</option>\n</select>'
 
 # Test the usage of _has_changed
 >>> w._has_changed(None, None)
@@ -658,7 +658,7 @@
 # Choices can be nested one level in order to create HTML optgroups:
 >>> w.choices = (('outer1', 'Outer 1'), ('Group "1"', (('inner1', 'Inner 1'), ('inner2', 'Inner 2'))))
 >>> print w.render('nestchoice', None)
-<select multiple="multiple" name="nestchoice">
+<select multiple="multiple" name="nestchoice" size="4">
 <option value="outer1">Outer 1</option>
 <optgroup label="Group &quot;1&quot;">
 <option value="inner1">Inner 1</option>
@@ -667,7 +667,7 @@
 </select>
 
 >>> print w.render('nestchoice', ['outer1'])
-<select multiple="multiple" name="nestchoice">
+<select multiple="multiple" name="nestchoice" size="4">
 <option value="outer1" selected="selected">Outer 1</option>
 <optgroup label="Group &quot;1&quot;">
 <option value="inner1">Inner 1</option>
@@ -676,7 +676,7 @@
 </select>
 
 >>> print w.render('nestchoice', ['inner1'])
-<select multiple="multiple" name="nestchoice">
+<select multiple="multiple" name="nestchoice" size="4">
 <option value="outer1">Outer 1</option>
 <optgroup label="Group &quot;1&quot;">
 <option value="inner1" selected="selected">Inner 1</option>
@@ -685,7 +685,7 @@
 </select>
 
 >>> print w.render('nestchoice', ['outer1', 'inner2'])
-<select multiple="multiple" name="nestchoice">
+<select multiple="multiple" name="nestchoice" size="4">
 <option value="outer1" selected="selected">Outer 1</option>
 <optgroup label="Group &quot;1&quot;">
 <option value="inner1">Inner 1</option>
