.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

RESOLVED FIXED in mozilla10

Status

()

Core
DOM: CSS Object Model
P2
normal
RESOLVED FIXED
12 years ago
6 years ago

People

(Reporter: Donny, Assigned: bz)

Tracking

Trunk
mozilla10
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

12 years ago
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
(Reporter)

Comment 1

12 years ago
Created attachment 206296 [details]
Testcase
Attachment #206296 - Flags: approval1.8.1?
(Reporter)

Updated

12 years ago
Attachment #206296 - Flags: approval1.8.1?

Updated

12 years ago
Component: DOM → DOM: Mozilla Extensions
OS: Windows XP → All
Hardware: PC → All
Assignee: general → nobody
QA Contact: ian → general

Updated

6 years ago
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.
Created attachment 567481 [details] [diff] [review]
Fix client* and scroll* for comboboxes to not consider the dropdown's scrollable area.
Attachment #567481 - Flags: review?(roc)
Assignee: nobody → bzbarsky
Priority: -- → P2
Whiteboard: [need review]
Attachment #567481 - Flags: review?(roc) → 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
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.