Closed Bug 1422647 Opened 7 years ago Closed 7 years ago

windows.Window height property should include (or not) the window header

Categories

(WebExtensions :: Untriaged, defect)

57 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 581866

People

(Reporter: michel.gutierrez, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Build ID: 20171123171849

Steps to reproduce:

Some UI components in my add-on are displayed in a popup window and have the ability to send a message to the add-on background which resizes that popup to the proper height so there is no scrollbar nor spare space.




Actual results:

It appears that the window height property that you get with browser.windows.get() for instance and set with browser.windows.update() has different meaning depending on the platform.

On Windows, this height includes the platform window header, so if the popup has a client height of 300 pixels, windows.Window.height has value 340.

On Linux (Xubuntu 16.04), the window header is not taken into account, so for the same popup as before, windows.Window.height is 300.

Not tested on Mac.




Expected results:

This behaviour should be consistent on whatever platform.

A workaround consists of having <html> and <body> styled with height:100%, so document.body.clientHeight is always the actual window client size. When the code wants a specific height, it sends a message to the background containing both the desired size and the current body size. When the background receives the message it queries windows.get() to get the reported height and subtract the received body height, so we know the header height. This delta height is added to the desired height when set using windows.update().
Component: Untriaged → WebExtensions: Untriaged
Product: Firefox → Toolkit
The height property is meant to include any decorations such as the title bar.  This information is hard to get on Linux, see the duplicate bug.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Summary: [WebExtensions] windows.Window height property should include (or not) the window header → windows.Window height property should include (or not) the window header
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.