New issue
Advanced search Search tips

Issue 808950 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Feb 2018
Components:
EstimatedDays: ----
NextAction: 2018-02-28
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Sometimes add a div into window.document.body, although dev tools can show it's width x height, clientWidth, clientHeight are 0

Reported by steelloc...@gmail.com, Feb 5 2018

Issue description

Chrome Version: <From about:version: Google Chrome 66.0.3339.0>
Chrome OS Version: <From about:version: Windows 7 Professional SP1>
<b>Chrome OS Platform: <Make/model of computer running Chrome OS></b>
<b>Network info: <network, encryption type, router model (if known)></b>

Please specify Cr-* of the system to which this bug/feature applies (add
the label below).

Use below code to get system DPI, the width & height of the new created tmpNode sometimes can get correct value(tmpNode.offsetWidth & tmpNode.offsetHeight are 0 however in developer tools, it shows 96 x 96) but sometimes cannot. Same logic always work on Chrome 63&64

var tmpNode = document.createElement("DIV");
tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
document.body.appendChild(tmpNode);
arrDPI[0] = parseInt(tmpNode.offsetWidth);
arrDPI[1] = parseInt(tmpNode.offsetHeight);
tmpNode.parentNode.removeChild(tmpNode);

How frequently does this problem reproduce? (Always, sometimes, hard to
reproduce?)
sometimes

What is the impact to the user, and is there a workaround? If so, what is
it?
Page cannot be rendered, because many dependent code

Please provide any additional information below. Attach a screen shot or
log if possible.
See screenshot

For graphics-related bugs, please copy/paste the contents of the about:gpu
page at the end of this report.

 
Untitled.png
11.4 KB View Download
Sorry, correct my statement.
the width & height of the new created tmpNode sometimes can get correct value but sometimes cannot (tmpNode.offsetWidth & tmpNode.offsetHeight are 0 however in developer tools, it shows 96 x 96)
Components: Blink>Layout
Labels: mp-triage
tmpNode.getBoundingClientRect also returns all 0 after document.body.appendChild(tmpNode);

Comment 5 by e...@chromium.org, Feb 8 2018

Labels: -mp-triage Needs-Feedback
NextAction: 2018-02-28
Unable to reproduce (see attached test case). At what stage of the document lifecycle are you running this script? Is it in the main document or an iframe? Is it offscreen?
issue808950.html
781 bytes View Download

Comment 6 by e...@chromium.org, Feb 22 2018

Status: WontFix (was: Unconfirmed)
Closing due to lack of feedback. Comment to reopen.
The NextAction date has arrived: 2018-02-28

Sign in to add a comment