Closed Bug 1639086 Opened 4 years ago Closed 4 years ago

Browser html demos are not rendered full width / height

Categories

(GeckoView :: General, defect)

Unspecified
All
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: j, Unassigned)

Details

Kris, we think this might be a layout issue. Can you take a look and let us know where best to send it? Thanks

Flags: needinfo?(ktaeleman)
Flags: needinfo?(ktaeleman) → needinfo?(jnicol)

This issue occurs regardless of whether webrender is enabled, and in fact affects Fennec as far back as I can run it without it crashing immediately.

The page uses window.innerWidth/window.innerHeight to get the window size then adjusts the sphere's coordinates around that. It only reads these values once at startup then caches them for future use.

Adding some printfs to nsGlobalWindowOuter::GetInnerSize() I can see that it returns CSSIntSize(400, 312) at this point. This is smaller than expected. Ignore the height being so small relative to the width, that's because of the virtual keyboard. But I'd expect the width to be larger than that, I believe we usually use a fixed 980 for the viewport width on mobile.

In fact, if I change the test case to repeatedly read window.innerWidth/Height rather than using the cached windowWidth, meaning nsGlobalWindowOuter::GetInnerSize() is called repeatedly, then:
a) I can see the smaller (400, 312) value is returned dozens of times (probably for less than half a second, however), then it starts returning (980, 764) instead.
b) the testcase works as expected once we start returning (980, 764) for the inner size.

In between the last time (400, 312) is returned, and the first time (980, 764) is returned, I see this in the log:

05-22 14:44:58.545  3473  3490 D GeckoViewContent[C]: handleEvent: DOMTitleChanged
05-22 14:44:58.546  3442  3442 I GeckoViewActivity: Content title changed to spheres
05-22 14:44:58.578  3473  3490 E Web Content: [JavaScript Error: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." {file: "http://192.168.0.60:8000/spheres.html" line: 0}]
05-22 14:44:58.582  3473  3490 D GeckoViewContent[C]: handleEvent: MozFirstContentfulPaint

I'm not at all familiar with this code, but can keep digging. Botond, Hiro, do either you have any ideas why we might be returning this smaller window size up until the first contentful paint?

Flags: needinfo?(jnicol)
Flags: needinfo?(hikezoe.birchill)
Flags: needinfo?(botond)

This is probably due to bug 1598487, we don't yet return the same size as Chrome does for window.inner{Width,Height} in cases of minimum-scale is applied.

I will debug the test case later.

Okay, this is not related to bug 1598487. bug 1598487 will make this issue worse. So what happens there is, when the var windowWidth = window.innerWidth (and innerHeight) is called, there is no big elements which bloat the document at all. That means

(In reply to Jamie Nicol [:jnicol] from comment #3)

Adding some printfs to nsGlobalWindowOuter::GetInnerSize() I can see that it returns CSSIntSize(400, 312) at this point.

The value is correct at that point. Then some elements which will bloat up the document size are going to be added after the initial window.inner{Width,Height} were obtained. Then the document size gets bigger than the initial size.

I am unsure what's going on in Chrome but I can see a weird behavior in Chrome's RDM mode when I stopped the initial requestAnimationFrame call (which stops animations), the behavior I can see is that the black-based liner gradient background size varies on every reloading. That implies, even on Chrome, the script is pretty unstable.

I'd say, the site should specify <meta name="viewport" content="width=device-width,initial-scale=1"> to avoid auto initial scale calculations.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Flags: needinfo?(hikezoe.birchill)
Flags: needinfo?(botond)
Resolution: --- → INVALID

I was trying to do a PR to the browserhtml, but unfortunately the repo has been archived (which means I can't make PRs at all).

You need to log in before you can comment on or make changes to this bug.