Implement viewport-fit property into meta viewport
Categories
(Core :: Layout, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: hiro, Assigned: m_kato)
References
Details
Attachments
(4 files)
I think people who wants display cutout env will not be happy without this viewport-fit.
Reporter | ||
Comment 1•5 years ago
|
||
Hmm, I couldn't add a spec link into "See Also". :/
https://drafts.csswg.org/css-round-display/#viewport-fit-descriptor
Assignee | ||
Comment 2•5 years ago
|
||
GV doesn't manage WindowManager.LayoutParams.layoutInDisplayCutoutMode, so we need an API to expose this value or notify of this change.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 3•5 years ago
|
||
I guess that DWU has to return viewport-fit by getViewportInfo, then add GV API to CotnentDelegate.
Reporter | ||
Comment 4•5 years ago
|
||
viewport-fit is not (only) for fullscreen state it's for normal browsing state. (The spec doesn't mention fullscreen state at all, as far as I can tell). So nsDocumentViewport::GetBounds should return the size depending on viewport-fit, IIUC (or call sites of the function need to tweak the returned value depending on viewport-fit). Presumably nsBaseWidget::mBounds also depends on viewport-fit, thus I guess we need to maintain two different rects somewhere and use either one depending on viewport-fit.
Reporter | ||
Comment 5•5 years ago
|
||
Oh, we are going to maintain insets area in bug 1503656? Then we can just inflate (or deflate) the bounds by the insets values (i.e. we don't need to maintain two different rects). (I am assuming the inflated rect equals to the screen size, but it seems it's device specific, so it might not work as expected).
Assignee | ||
Comment 6•5 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #4)
viewport-fit is not (only) for fullscreen state it's for normal browsing state. (The spec doesn't mention fullscreen state at all, as far as I can tell). So nsDocumentViewport::GetBounds should return the size depending on viewport-fit, IIUC (or call sites of the function need to tweak the returned value depending on viewport-fit). Presumably nsBaseWidget::mBounds also depends on viewport-fit, thus I guess we need to maintain two different rects somewhere and use either one depending on viewport-fit.
Yes, but GV's View doesn't know current state of window. Application can access WindowManager.LayoutParams
(but GV cannot), so we should notify application of viewport-fit change via ContentDelegate. When I look WebKit code as reference, Apple has a API to get viewport value for browser application. Also safe area insets should be calculate by Gecko (Gecko knows position and size).
Assignee | ||
Comment 7•5 years ago
|
||
Assignee | ||
Comment 8•5 years ago
|
||
For safe area insets (cutout) support, CSS Round Display Level 1 [*1] has new viewport value as viewport-fit.
*1 https://drafts.csswg.org/css-round-display/#viewport-fit-descriptor
Assignee | ||
Comment 9•5 years ago
|
||
viewport-fit
is hint that browser application can use cutout area. So we should expose it to GeckoView application.
When meta element is found or changed, ContentDelegate.onMetaviewportFitChange
is called. Even if nothing, it will be called after DOMContentLoaded is fired.
Comment 10•5 years ago
|
||
I'm having trouble to review this since I can't find a spec defining that <meta> could have viewport-fit.
https://drafts.csswg.org/css-device-adapt-1/#viewport-meta doesn't include it.
Reporter | ||
Comment 11•5 years ago
|
||
Unfortunately, as you know, the spec doesn't mention the viewport-fit at all at this moment. I filed a spec issue, https://github.com/w3c/csswg-drafts/issues/4561
For references, this commit is for the parser in Chrome, and this is for the parser in WebKit.
Assignee | ||
Comment 12•5 years ago
|
||
Per discussing with @hiro, we should add new method to get viewport-fit
instead of adding parameter of nsIDOMWindowUtils.getViewportInfo
.
Assignee | ||
Comment 13•5 years ago
|
||
Actually, we have DOMMeta*
event for modifying meta element. But GeckoView wants viewport-fit change only.
@hiro suggests new event that is fired by viewport-fit will be changed. This event doesn't need current viewport-fit value since GeckoView doesn't need current value immediately.
Updated•5 years ago
|
Comment 14•5 years ago
|
||
Comment 15•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1a20594b4fe2
https://hg.mozilla.org/mozilla-central/rev/1571a382ea47
https://hg.mozilla.org/mozilla-central/rev/261b07ad94bb
https://hg.mozilla.org/mozilla-central/rev/4287ea98207d
Description
•