Open
Bug 451997
Opened 18 years ago
Updated 4 years ago
Computed height is not correct for XUL elements containing wrapped text
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
NEW
People
(Reporter: morac, Unassigned)
Details
Attachments
(4 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Build Identifier:
In a number of my extensions, I've noticed that the options (prefWindow/prefPane) window sometimes is cut off on the bottom. I tracked the problem down to having text elements (descriptions, labels, etc) with wrapped text.
The problem is that when the computed height is first calculated, it ignores the text and after the text is added, the height value is wrong. This results in the window being too small even if the sizeToContent function is called.
A work around I've found is to explicitly set the element's height style to the value returned by the document.defaultView.getComputedStyle(x, null).getPropertyValue("height") function call.
Reproducible: Always
Steps to Reproduce:
1. Create an prefWindow/prefPane that contains an element with wrapped text
2. Open it
Actual Results:
Window is not sized correctly
Expected Results:
Window should be sized correctly.
| Reporter | ||
Comment 1•18 years ago
|
||
This is a prefWindow that demonstrates the problem by forcing the text in the label to wrap. There is no difference whether or not the sizeToContent function is called or not. In this example, the label's computed height as displayed in the DOM Inspector is 80px.
| Reporter | ||
Comment 2•18 years ago
|
||
This is the same as the bad.xul file, except that the label's height is explicitly set to it's computed style when the window loads. The label's computed height value in DOM Inspector displays as 96px.
| Reporter | ||
Comment 3•18 years ago
|
||
| Reporter | ||
Comment 4•18 years ago
|
||
Comment 5•18 years ago
|
||
The prefpane (actually its anonymous box) has hidden overflow, which makes it hard for Gecko to propagate size constraints.
| Reporter | ||
Comment 6•18 years ago
|
||
But Gecko does appear to know the sizes since like I mentioned a work around is to explicitly set all the style height of all text elements in the prefpane to their computed style height.
For example this fixes descriptions:
var descriptions = document.getElementsByTagName('description');
for (var i=0; i<descriptions.length; i++) {
descriptions[i].style.height=document.defaultView.getComputedStyle(descriptions[i], null).getPropertyValue("height");
}
Maybe the prefpane onload code should just do this by default?
Guys... despite of the age of this issue, it's still happening to me.
I used the workaround from comment 6 (https://bugzilla.mozilla.org/show_bug.cgi?id=451997#c6) and it fixed the problem.
My xul is this: https://github.com/beltrachi/automatic_dictionary/blob/master/chrome/content/preferences.xul
I don't think that gecko should do the javascript by default. It should render it right by itself.
Comment 8•12 years ago
|
||
This bit me in bug 1069300, and the workaround of setting the height explicitly works.
I'm fairly sure this is XUL-specific. Not sure how hard it'd be to fix, but it sure is annoying. Nominating for the backlog (instead of +'ing outright) because I'm not sure we should take this instead of drumming up noise that it should be fixed by someone who actually knows what's going on here :-)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: firefox-backlog?
OS: Windows XP → All
Hardware: x86 → All
Updated•12 years ago
|
Summary: Computed height is not correct for elements containing wrapped text → Computed height is not correct for XUL elements containing wrapped text
Comment 9•12 years ago
|
||
Not in our backlog, but if we need it fixed we can get it fixed!
Flags: firefox-backlog? → firefox-backlog-
Updated•4 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•