Secondary windows with height specified in pixels are wrong height (Bug #975)


Added by Doug Reeder about 2 years ago. Updated almost 2 years ago.


Status:Closed Start date:09/09/2015
Priority:Normal Due date:
Assignee:Christophe Chapuis % Done:

100%

Category:Device Specific
Target version:Medici

Description

To reproduce:
1) On Nexus 4, run Testr
2) Select Notifications
3) Tap "Create system popup 16 gridunits tall"; observe that all eight lines of text are displayed.
4) Tap system popup to dismiss.
5) Tap "Create system popup 160px tall"; observe that only four lines of text are displayed.

On a Touchpad, both system popups are the same height. On a Pre 3 running webOS 2.2.4, both system popups are the same height. Thus, if height is specified in pixels, hardware pixels are being used, not CSS pixels, as expected.


History

Updated by Herman van Hazendonk about 2 years ago

That's because on TP 1 GridUnit = 10 pixel, but on N4 1 GridUnit = 18 pixels. So 160 pixels on TP = 16 GridUnits, however 16 GridUnits on N4 are 288 pixels, hence only 4 lines on the N4 with 160 pixels.

The implementation is correct, though it might not do what you would expect.

The "solution" would be to have the pixel value be dynamic for each device, so 160 on TP and 288 for N4.

Normally going forward we wouldn't use hard pixel values for these things anymore. Anywhere where it's still being used it should be converted to GridUnits (i.e. take TP pixel value / 10 and use the GridUnits value that we get). I recently converted the power menu in luna-systemui for this, hence it's now working properly on both N4 and TP ;)

Updated by Doug Reeder about 2 years ago

When Testr is run on a Pre 3 running webOS 2.2.4, the "Create system popup 160px tall" button creates a system popup with all nine lines visible - that is, the popup is 160 device-independent pixels (DIPs) tall (240 physical pixels). [You need to use today's update (https://github.com/webOS-ports/org.webosports.app.testr/pull/23) to Testr for the text to be legible.]

Since webOS interprets the height parameter as DIPs, I think LuneOS should also, for compatability. As gridunits are not available on webOS devices, they are not a solution for apps that run on both.

Updated by Herman van Hazendonk almost 2 years ago

Seems we need to use device pixel ratio as per http://www.quirksmode.org/blog/archives/2012/07/more_about_devi.html

Legacy uses Device Pixel Ratio across all elements in UI AFAIK. So I guess we'd need to apply the device pixel ratio to our "regular" pixels as well when not using Grid Units.

  • Target version set to Medici
  • Assignee set to Christophe Chapuis
  • Status changed from New to In Progress

Updated by Christophe Chapuis almost 2 years ago

Yes, you're right, only the web content is scaled today with a pixel ratio by WebEngine. We should apply that ratio to the height when in pixel units.
This can be easily done here: https://github.com/webOS-ports/luna-webappmanager/blob/master/src/webapplication.cpp#L233

Updated by Herman van Hazendonk almost 2 years ago

Should be solved with https://github.com/webOS-ports/luna-webappmanager/commit/cc385059a224e9139b3445ba9a3da5748a90842a

We need to make sure we have a layoutScale defined for the target device in it's luna-xxxx.conf file for luna-sysmgr.

Updated by Herman van Hazendonk almost 2 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Resolved

Updated by Herman van Hazendonk almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF