Closed Bug 1574307 Opened 5 years ago Closed 4 years ago

Implement viewport-fit property into meta viewport

Categories

(Core :: Layout, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla74
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.

Hmm, I couldn't add a spec link into "See Also". :/
https://drafts.csswg.org/css-round-display/#viewport-fit-descriptor

GV doesn't manage WindowManager.LayoutParams.layoutInDisplayCutoutMode, so we need an API to expose this value or notify of this change.

Assignee: nobody → m_kato

I guess that DWU has to return viewport-fit by getViewportInfo, then add GV API to CotnentDelegate.

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.

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).

(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).

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

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.

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.

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.

Per discussing with @hiro, we should add new method to get viewport-fit
instead of adding parameter of nsIDOMWindowUtils.getViewportInfo.

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.

Attachment #9113124 - Attachment description: Bug 1574307 - Part 2. Notify GV of viewport-fit. → Bug 1574307 - Part 4. Notify GV of viewport-fit.
Pushed by m_kato@ga2.so-net.ne.jp:
https://hg.mozilla.org/integration/autoland/rev/1a20594b4fe2
Part 1. Parse viewport-fit in meta element. r=smaug
https://hg.mozilla.org/integration/autoland/rev/1571a382ea47
Part 2. Add nsIDOMWindowUtils.getViewportFitInfo r=smaug
https://hg.mozilla.org/integration/autoland/rev/261b07ad94bb
Part 3. Dispatch DOMMetaViewportFitChanged when viewport-fit is changed. r=smaug,hiro
https://hg.mozilla.org/integration/autoland/rev/4287ea98207d
Part 4. Notify GV of viewport-fit. r=geckoview-reviewers,snorp
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: