Closed
Bug 227567
Opened 21 years ago
Closed 21 years ago
[FIX] displays incorrectly
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: cotton_bill, Assigned: MatsPalmgren_bugz)
References
()
Details
(Keywords: compat)
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
bzbarsky
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6a) Gecko/20031030
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6a) Gecko/20031030
The "footer" div is displayed at the top of the page and obscures the top part
of the page. The "side menu" div is displayed with bottom half of text missing.
Works OK in IE
Reproducible: Always
Steps to Reproduce:
1.request the page
2.
3.
Actual Results:
duff display
Expected Results:
good display!
Comment 1•21 years ago
|
||
> The "footer" div is displayed at the top of the page
It's absolutely positioned, with its top 110px from the top of the page by the
following code:
document.getElementById('footer').style.top=document.getElementById('sidemenu').clientHeight+110
In mozilla the "clientHeight" is 0, since the element is not scrollable... I
assume IE makes clientHeight equal offsetHeight or something when the element is
not scrollable?
(the sidemenu div is likely affected by the same problem, by the way).
Assignee: other → general
Component: Layout → DOM: Mozilla Extensions
OS: Windows XP → All
Hardware: PC → All
Assignee | ||
Comment 2•21 years ago
|
||
The overlap in the sidemenu is the correct rendering. It is the result
of a specified 5px vertical padding on the inline elements (links) in the menu.
http://www.w3.org/TR/CSS21/visudet.html#inline-non-replaced
"The vertical padding, border and margin of an inline, non-replaced box start at
the top and bottom of the content area, not the 'line-height'. But only the
'line-height' is used to calculate the height of the line box."
Assignee | ||
Comment 3•21 years ago
|
||
This was originally fixed for <body> in bug 180552.
I don't see any reason why it shouldn't be fixed for other elements too.
Comment 4•21 years ago
|
||
Mats, does that give us compat with IE as far as clientHeight goes? For
example, what does IE report as the clientHeight for non-positioned
non-scrolling elements? If this is what IE does, the patch looks great!
Assignee | ||
Updated•21 years ago
|
Attachment #136913 -
Attachment is obsolete: true
Assignee | ||
Comment 5•21 years ago
|
||
It seems IE isn't as general as that, it returns zero for anything that isn't
a float or abs.pos. or replaced or table element or <body> or <frameset>.
I have a patch that does that, I just need to test IE a bit more exactly first...
Comment 6•21 years ago
|
||
Aiie. One of these days we'll discover that one of IE's little DOM extensions
is implemented in a sane and consistent fashion and the world will end....
Comment 7•21 years ago
|
||
Is "0" as a return value ever used by anyone? If not, I say "embrace and extend"
and just return the right height all the time. :-)
Assignee | ||
Comment 8•21 years ago
|
||
It's even worse than I described in comment 5, for example <div>X</div>
returns zero but <div style="height:100px">X</div> returns 100. So it seems
it is dependent on non-auto height in some cases (normal flow or relative pos.)
but not in other cases (floats and abs.pos).
Speculation: I think clientHeight/Width in IE returns the dimension of some
sort of internal "view". This is impossible to emulate exactly of course.
Assignee | ||
Comment 9•21 years ago
|
||
This is a compromise that I think will cover most cases in a compatible way...
Assignee | ||
Comment 10•21 years ago
|
||
Oops, didn't mean to remove the NULL check on 'frame'.
Attachment #136940 -
Attachment is obsolete: true
Assignee | ||
Updated•21 years ago
|
Summary: displays incorrectly → [FIX] displays incorrectly
Assignee | ||
Comment 11•21 years ago
|
||
Comment on attachment 136941 [details] [diff] [review]
Patch rev. 3
It returns the right height almost "all the time" as Ian said -
the exception being non-replaced inline elements.
Attachment #136941 -
Flags: review?(bz-vacation)
Comment 12•21 years ago
|
||
> Is "0" as a return value ever used by anyone?
Ian, this is the web. Yes, there are pages that rely on that behavior.
Probably thousands of them. :(
Comment 13•21 years ago
|
||
Comment on attachment 136941 [details] [diff] [review]
Patch rev. 3
I agree that emulating this in all its quirky glory is probably impossible...
Note that the documentation at
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/clientheig
ht.asp is totally useless.
This seems reasonable to me. r=bzbarsky. jst, would you sr?
Attachment #136941 -
Flags: superreview?(jst)
Attachment #136941 -
Flags: review?(bz-vacation)
Attachment #136941 -
Flags: review+
Comment 14•21 years ago
|
||
I find it very hard to believe that anyone is actually depending on that. Can
you show me an example? Do we actually care about those cases? Making ourselves
appear more reliable and less quirky goes a long way towards making authors
prefer Mozilla to IE.
Comment 15•21 years ago
|
||
Ian, I think that's actually what Neil's patch does... returning a clientHeight
for non-replaced inlines would be very odd, imo.
Assignee | ||
Comment 16•21 years ago
|
||
I added the exception for non-replaced inlines for two reasons:
1. this is what IE does (and this bug is about being IE compat)
2. CSS height property does not apply to those elements (so there is a kind
vague symmetry there ;-)
Comment 17•21 years ago
|
||
Yeah, I guess that makes sense.
FWIW, there _is_ a height defined for inline elements, it's the content height.
I'm not 100% sure what offsetHeight gives back, but the height from margin edge
to margin edge of an inline element is well defined. (Vertically at least;
horizontally it should probably be the sum of all the boxes, although who knows.)
But yes, I see the logic of excluding them. I retract my objections. :-)
Updated•21 years ago
|
Attachment #136941 -
Flags: superreview?(jst) → superreview+
Comment 18•21 years ago
|
||
Mats, please poke me for checkin if this gets approved or the tree reopens, ok?
Assignee | ||
Comment 19•21 years ago
|
||
Tree is open, please check it in.
Comment 20•21 years ago
|
||
checked in.
Checking in content/html/content/src/nsGenericHTMLElement.cpp;
/cvsroot/mozilla/content/html/content/src/nsGenericHTMLElement.cpp,v <--
nsGenericHTMLElement.cpp
new revision: 1.458; previous revision: 1.457
done
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 21•21 years ago
|
||
In All-in-One gestures extension, I test clientHeight and clientWidth to check
whether a node is scrollable or not. Should I assume you broke that with the
patch? Is there a way to workaround?
Comment 22•21 years ago
|
||
You can probably test whether client* is equal to offset*; if they are not
equal, you can scroll, no?
Comment 23•21 years ago
|
||
Not so easy when client* doesn't include the borders while offset* (or scroll*
which I use) does.
Comment 24•21 years ago
|
||
So you can just compare offset* to scroll* then, no? See whether they are the same?
In any case, compat with IE on properties introduced by IE is really what we're
aiming for...
Comment 25•21 years ago
|
||
Boris, AFAIK, offset* and scroll* are the same. However, I managed to get the
border values via getComputedStyle and add them to client* before comparing to
offset*. Seems to work though quite hacky.
Updated•12 years ago
|
Component: DOM: Mozilla Extensions → DOM
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•