Android cutout support for CSS env() safe area insets
Categories
(GeckoView :: General, enhancement, P2)
Tracking
(firefox70 wontfix, firefox71 wontfix, firefox72 wontfix, firefox75 fixed)
People
(Reporter: cpeterson, Assigned: m_kato)
References
Details
(Whiteboard: [geckoview:m1910] [geckoview:m1911] [geckoview:m1912][geckoview:m74])
Attachments
(10 files, 2 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 1•6 years ago
|
||
Assignee | ||
Comment 2•6 years ago
|
||
Reporter | ||
Comment 3•6 years ago
|
||
Comment 4•6 years ago
|
||
Bug 1503455 has been solved, now we can use the APIs for cutout?
Assignee | ||
Comment 5•6 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #4)
Bug 1503455 has been solved, now we can use the APIs for cutout?
Yes, we can use API 28's API.
Reporter | ||
Comment 7•5 years ago
|
||
James says this feature may be important for fullscreen PWAs or for Fenix without a top toolbar.
Reporter | ||
Comment 8•5 years ago
|
||
Gecko support already exists. Someone just needs to connect it to GV.
Reporter | ||
Comment 9•5 years ago
|
||
Bumping from priority P3 to milestone M9 because the Fenix issue is in Fenix's Q4 backlog:
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 11•5 years ago
|
||
Tentatively scheduling for GV's October sprint.
Reporter | ||
Comment 12•5 years ago
|
||
We want to work on this in October.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 13•5 years ago
|
||
No binding interface for safe area implementation. Bug 1462233 uses hardcoded value for safe area.
Comment 14•5 years ago
|
||
Could the safe area be adjusted from the Android Components side? It would be nice to later use this to support transparent navigation bars in addition to transparent status bars down the line.
(In reply to Tiger Oakes from comment #14)
Could the safe area be adjusted from the Android Components side? It would be nice to later use this to support transparent navigation bars in addition to transparent status bars down the line.
Yeah, I think we'd probably implement this by passing a DisplayCutout
[1] (or perhaps an internal type that's similar?) to GeckoDisplay
, with GeckoView
automatically setting the cutouts for the display it's on by default. We could then easily add something to GeckoView
that allowed apps to set additional cutouts or safe areas.
[1] https://developer.android.com/reference/android/view/DisplayCutout
Comment 16•5 years ago
|
||
Each safe area has a single value, so if you override the value given by the system, it's possible that the value is smaller than the system one. I don't think it's a good idea... Or additional areas means adding new env variables?
Assignee | ||
Comment 17•5 years ago
|
||
I am writing prototype...
I think that safe area should be stored in nsIWidget (nsWindow and update it via BrowserParentChild), then stylo can get it from widget. safearea isn't static value (it is updated dynamically via changing View position/size by full screen etc) on Android.
GV side is stored in GeckoSession and GeckoDisplay, then it can update safearea to widget's.
emilio, is there a way to re-calcuate env()
value? CssEnvironment is used at first parsing, but safearea is updated dynamically, so I want ot re-compute env() value. (RebuildAllStyleData won't help it. but my usage is mistake?)
Comment 18•5 years ago
|
||
Can you upload your WIP somehow? env()
is evaluated at computed-value time, just like custom properties, so it should work, afaict.
Assignee | ||
Comment 19•5 years ago
|
||
This is WIP. This works on non-e10s mode only since I don't implement IPC.
And of course, I have to move CSsEnvironment to Gecko's specific implementation since Servo keeps static implementation.
I don't know how to change CssEnvironment to Unparsed state...
Assignee | ||
Updated•5 years ago
|
Comment 20•5 years ago
|
||
Comment 21•5 years ago
|
||
If the suggestions above for some reason don't work, is there any chance you can tell me how to test / debug it, maybe on the emulator?
Assignee | ||
Comment 22•5 years ago
|
||
Thank you emilio.
(In reply to Emilio Cobos Álvarez (:emilio) from comment #20)
I don't have a phone with a notch, so I cannot debug this, but a few thougts:
- Is the prescontext here really for the top level content document? Or do
you need to call it in subdocuments too?- I think conceptually
RecascadeSubtree
should work, but you could try
RestyleSubtree
which is a stronger hint to be 100% sure.- I also think we only want to do this if the page uses the
env()
variables, and ideally we'd only want to restyle the specific elements that
use it, but that can be a followup.
RebuildAllSytles
doesn't reparse env() block. MediaFeatureValuesChangedAllDocuments
can re-parse env().
If the suggestions above for some reason don't work, is there any chance you can tell me how to test / debug it, maybe on the emulator?
Also, to test cutout, create Android 9 image by emulator, then set cutout by "Simulate a display with a cutout" option by developer option. This WIP has GVE fix that is full screen removes system notification area.
Comment 23•5 years ago
|
||
(In reply to Makoto Kato [:m_kato] from comment #22)
RebuildAllSytles
doesn't reparse env() block.MediaFeatureValuesChangedAllDocuments
can re-parse env().
Ah, cool, so it was really about which document you call it on. In non-e10s you're dealing with the root chrome document and the content document. You'd need to invalidate environment variables at least in the top level content document too, yeah.
Reporter | ||
Comment 24•5 years ago
|
||
Rolling over to November sprint.
Assignee | ||
Comment 25•5 years ago
|
||
Current implementation of safe area uses hard coded value.
To implement safe area support on Gecko, I need Gecko specific code for CssEnvironment.
Assignee | ||
Comment 26•5 years ago
|
||
Although CssEnvironment is in Device of media query implementation, some code
creates CssEnvironment instance without Device. So I would like always to use it from Device of media query.
Depends on D52504
Assignee | ||
Comment 27•5 years ago
|
||
CssEnvironment alwasy is in Device, so use Devie as parameter instead of CssEnvironment.
Depends on D52506
Assignee | ||
Comment 28•5 years ago
|
||
Safe area value is stored in nsIWidget for stylo.
Depends on D52507
Assignee | ||
Comment 29•5 years ago
|
||
Add binding to get safe area from Gecko.
Depends on D52508
Assignee | ||
Comment 30•5 years ago
|
||
Safe area may be changed by changing windows size and/or fullscreen mode. So it is observed from
parent process.
Depends on D52509
Assignee | ||
Comment 31•5 years ago
|
||
safe area is changed dynamically by window size is chaged. So if it is changed, we have to re-parse CSS.
Depends on D52510
Assignee | ||
Comment 32•5 years ago
|
||
Depends on D52512
Assignee | ||
Comment 33•5 years ago
|
||
Actually, although GVE supports full screen, but it doesn't disappears system notification area. To check cutout area,
I would like to change it that disappears notifications.
Depends on D52513
Comment 34•5 years ago
|
||
(In reply to Makoto Kato [:m_kato] from comment #33)
Created attachment 9107791 [details]
Bug 1503656 - Part 9. Add full screen support to GVE that notification area and etc are hidden.Actually, although GVE supports full screen, but it doesn't disappears system notification area. To check cutout area,
I would like to change it that disappears notifications.
This should be applied only if there is "viewport-fit=cover" in a meta viewport tag. That's why I added bug 1574307 into the dependency list of this bug.
Assignee | ||
Comment 35•5 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #34)
(In reply to Makoto Kato [:m_kato] from comment #33)
Created attachment 9107791 [details]
Bug 1503656 - Part 9. Add full screen support to GVE that notification area and etc are hidden.Actually, although GVE supports full screen, but it doesn't disappears system notification area. To check cutout area,
I would like to change it that disappears notifications.This should be applied only if there is "viewport-fit=cover" in a meta viewport tag. That's why I added bug 1574307 into the dependency list of this bug.
Thanks, I should abandon this GVE fix from this series. We may add API and/or parameter for fullscreen API.
Comment 36•5 years ago
|
||
One more note; WidgetUtils::DOMWindowToWidget looks apparently fission-incompatible, if it hasn't yet filed for that we should file a new bug. As for media query stuff in fission world, it's probably not yet worked, I've filed bug 1592895 but there may be other issues.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 37•5 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #36)
One more note; WidgetUtils::DOMWindowToWidget looks apparently fission-incompatible, if it hasn't yet filed for that we should file a new bug. As for media query stuff in fission world, it's probably not yet worked, I've filed bug 1592895 but there may be other issues.
bug 1597509 was just filed for this issue.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 38•5 years ago
|
||
Depends on D52512
Updated•5 years ago
|
Comment 39•5 years ago
|
||
Makoto, mind if I land some of the CSS changes here (preserving you as an author of course) so that other contributors don't need to repeat this work in bug 1432090?
Assignee | ||
Comment 40•5 years ago
|
||
Emilio, should I land layout part of this bug with leave-open? Latest 2 patch is DOM/IPC and Android part. So I won't add more layout side patch for this bug.
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 42•5 years ago
|
||
Comment 43•5 years ago
|
||
bugherder |
Comment 44•5 years ago
|
||
Has this issue been fixed?
Comment 45•5 years ago
|
||
Makoto can you please update this issue with details of when the remaining patches might land?
Assignee | ||
Comment 46•5 years ago
|
||
Emilio, what safearea value of embedded document? As long as last week discussion (https://github.com/w3c/csswg-drafts/issues/4670), you have responsive. Is it OK like Blink? (sub document is 0px) since Fenix runs on Android only and Blink doesn't run on iOS.
If sub document is 0px, I guess that we don't care for fission.
Comment 47•5 years ago
|
||
I think it's ok to behave like Blink for now. If the working group reconsiders we can always change the behavior there.
Comment 48•5 years ago
|
||
I don't see any automated test cases in the patch set here. I think we should either have automated tests or do manual QA.
Given that on an Android phone having a cutout region at top of the phone, IIUC the spec, the behavior should be
- Portrait mode on non fullscreen state, safe-area-inset-top should be zero, but on fullscreen mode it's the value of the cutout
- Landscape mode both on fullscreen/non-fullscreen state, safe-area-inset-left should be the cutout region (given that the left side is now the top of the phone)
That's my understandings, but I could be wrong.
Assignee | ||
Comment 49•5 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #48)
I don't see any automated test cases in the patch set here. I think we should either have automated tests or do manual QA.
Given that on an Android phone having a cutout region at top of the phone, IIUC the spec, the behavior should be
- Portrait mode on non fullscreen state, safe-area-inset-top should be zero, but on fullscreen mode it's the value of the cutout
GeckoView side doesn't know whether current web content isn't converted for notch. (hide navigation bar etc). And our test emulator is old version, so no way to add test on Android.
- Landscape mode both on fullscreen/non-fullscreen state, safe-area-inset-left should be the cutout region (given that the left side is now the top of the phone)
It depends on application side. As general, navigation bar etc aren't hidden, so safe-area-insets will be 0. Its behavior for landscape is iOS, not Android.
Assignee | ||
Comment 50•5 years ago
|
||
(In reply to Makoto Kato [:m_kato] from comment #49)
It depends on application side. As general, navigation bar etc aren't hidden, so safe-area-insets will be 0. Its behavior for landscape is iOS, not Android.
LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT maybe iOS like behavior on Android.
Updated•5 years ago
|
Assignee | ||
Comment 51•5 years ago
|
||
Depends on D52513
Comment 52•5 years ago
|
||
Comment 53•5 years ago
|
||
Backed out as requested.
backout: https://hg.mozilla.org/integration/autoland/rev/7f5e7b94428c62ad7d543e0651b063c59e542aba
Comment 54•5 years ago
|
||
Comment 55•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/91b200320416
https://hg.mozilla.org/mozilla-central/rev/85c44fd76dab
https://hg.mozilla.org/mozilla-central/rev/3ba0b7054273
https://hg.mozilla.org/mozilla-central/rev/d155d510d1a1
https://hg.mozilla.org/mozilla-central/rev/ade8355963a2
https://hg.mozilla.org/mozilla-central/rev/e2fb6fc115a4
Assignee | ||
Comment 56•5 years ago
|
||
done.
Updated•5 years ago
|
Updated•3 years ago
|
Description
•