Open
Bug 481372
Opened 15 years ago
Updated 2 years ago
javascript div offsetHeight reports incorrect values on text resize
Categories
(Core :: Layout, defect)
Tracking
()
UNCONFIRMED
People
(Reporter: mystikan, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 When using Javascript to retrieve the offsetHeight value of a div element, the value returned is correct only if the page magnification is at default. When a user changes the magnification (with [Ctrl][+] or [Ctrl][-]), the reported offsetHeight value is incorrect; it decreases as text size increases or returns inconsistent values as the text size changes. Thus, Web applications relying on accurate reporting of this value will not function correctly in Firefox. Reproducible: Always Steps to Reproduce: 1. Set up a HTML page containing a div element with some text in it. 2. Use Javascript to read the offsetHeight value of this element (var divHeight = document.getElementById('divId').offsetHeight;) 3. Have the user change the page magnification by pressing [Ctrl][+] and [Ctrl][-], and read back the element's offsetHeight value again. Actual Results: Using the demo page at http://www.mystikan.com/bugreport.html to reproduce this error produces the following results: Default page magnification: offsetHeight = 60px (correct value) +1 page magnification: offsetHeight = 57px +2 page magnification: offsetHeight = 56px +3 page magnification: offsetHeight = 54px -1 page magnification: offsetheight = 59px -2 page magnification: offsetheight = 59px -3 page magnification: offsetheight = 62px Expected Results: As the text size increases with page magnification, so too the offsetHeight value of the containing element should increase to reflect the larger size of the element in accomodating the text. Similarly, the offsetHeight value should decrease with decreasing page magnification and text size. This value should show the actual pixel height of the element when read. about:buildconfig Build platform target i686-pc-mingw32 Build tools Compiler Version Compiler flags cl 14.00.50727.762 -GL -wd4624 -wd4952 -TC -nologo -W3 -Gy -Fd$(PDBFILE) cl 14.00.50727.762 -GR- -GL -wd4624 -wd4952 -TP -nologo -Zc:wchar_t- -W3 -Gy -Fd$(PDBFILE) Configure arguments --enable-application=browser --enable-update-channel=release --enable-optimize --disable-debug --disable-tests --enable-update-packaging --enable-official-branding --enable-jemalloc --with-crashreporter-enable-percent=10
Comment 1•15 years ago
|
||
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090303 Minefield/3.2a1pre Seems only to work correctly if I set View > Zoom > Zoom Text Only.
Component: General → Layout
Product: Firefox → Core
QA Contact: general → layout
Version: unspecified → Trunk
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•