Closed Bug 320799 Opened 19 years ago Closed 13 years ago

.clientWidth reports different width for two <select> fields of exactly the same width if one has a scrollbar on the dropdown and the other does not

Categories

(Core :: DOM: CSS Object Model, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: mdonatas, Assigned: bzbarsky)

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

It's weird but .clientWidth returns different widths for <select>s that are of the same width. The only difference is number of options in each of them. Testcase speaks for itself.

Reproducible: Always

Steps to Reproduce:

Actual Results:  
Second <select> field has wrong .clientWidth set

Expected Results:  
Correct .clientWidth value for second <select> element
Attached file Testcase
Attachment #206296 - Flags: approval1.8.1?
Attachment #206296 - Flags: approval1.8.1?
Component: DOM → DOM: Mozilla Extensions
OS: Windows XP → All
Hardware: PC → All
Assignee: general → nobody
QA Contact: ian → general
Component: DOM: Mozilla Extensions → DOM: CSS Object Model
QA Contact: general → style-system
This is an interesting case....

The spec says:

  the width of the padding edge (excluding the width of any rendered scrollbar between the
  padding edge and the border edge)

We implement that by getting the frame for the element, calling GetScrollTargetFrame, then using the size of that (minus scrollbar as needed).

For a combobox, the scroll target frame is the dropdown.  And the two selects differ in that one has a scrollbar in the dropdown and the other does not; the scrollbar width is exactly the difference between the two numbers returned.

roc, should we be skipping the GetScrollTargetFrame call for combobox here like we do for menuframes?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: .clientWidth reports different width for two <select> fields of exactly the same width → .clientWidth reports different width for two <select> fields of exactly the same width if one has a scrollbar on the dropdown and the other does not
Or would this confuse other GetScrollFrame callers?
I think that's probably fine. None of the GetScrollFrame callers in nsGenericElement should be expecting to see the popup.
Assignee: nobody → bzbarsky
Priority: -- → P2
Whiteboard: [need review]
https://hg.mozilla.org/integration/mozilla-inbound/rev/56726a8fedea
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla10
https://hg.mozilla.org/mozilla-central/rev/56726a8fedea
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: