Bug 1940052 - Apply fixed position css to Android pip media query r=emilio,twisniewski
Differential Revision: https://phabricator.services.mozilla.com/D246364
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/widget/ScreenManager.h"
|
||||
#include "mozilla/MediaFeatureChange.h"
|
||||
#include "mozilla/NativeKeyBindingsType.h"
|
||||
#include "mozilla/NullPrincipal.h"
|
||||
#include "mozilla/PointerLockManager.h"
|
||||
@@ -1264,6 +1265,11 @@ mozilla::ipc::IPCResult BrowserChild::RecvAndroidPipModeChanged(bool aPipMode) {
|
||||
}
|
||||
mInAndroidPipMode = aPipMode;
|
||||
if (RefPtr<Document> document = GetTopLevelDocument()) {
|
||||
if (nsPresContext* presContext = document->GetPresContext()) {
|
||||
presContext->MediaFeatureValuesChanged(
|
||||
{MediaFeatureChangeReason::DisplayModeChange},
|
||||
MediaFeatureChangePropagation::JustThisDocument);
|
||||
}
|
||||
nsContentUtils::DispatchEventOnlyToChrome(
|
||||
document, document,
|
||||
aPipMode ? u"MozAndroidPipModeEntered"_ns
|
||||
|
||||
@@ -616,6 +616,7 @@ mozilla::PointerCapabilities Gecko_MediaFeatures_AllPointerCapabilities(
|
||||
float Gecko_MediaFeatures_GetDevicePixelRatio(const mozilla::dom::Document*);
|
||||
|
||||
bool Gecko_MediaFeatures_IsResourceDocument(const mozilla::dom::Document*);
|
||||
bool Gecko_MediaFeatures_InAndroidPipMode(const mozilla::dom::Document*);
|
||||
bool Gecko_MediaFeatures_MatchesPlatform(mozilla::StylePlatform);
|
||||
mozilla::StyleGtkThemeFamily Gecko_MediaFeatures_GtkThemeFamily();
|
||||
|
||||
|
||||
@@ -96,6 +96,10 @@ bool Gecko_MediaFeatures_IsResourceDocument(const Document* aDocument) {
|
||||
return aDocument->IsResourceDoc();
|
||||
}
|
||||
|
||||
bool Gecko_MediaFeatures_InAndroidPipMode(const Document* aDocument) {
|
||||
return aDocument->InAndroidPipMode();
|
||||
}
|
||||
|
||||
bool Gecko_MediaFeatures_UseOverlayScrollbars(const Document* aDocument) {
|
||||
nsPresContext* pc = aDocument->GetPresContext();
|
||||
return pc && pc->UseOverlayScrollbars();
|
||||
|
||||
@@ -205,6 +205,27 @@ h6 {
|
||||
margin-block: 2.33em;
|
||||
}
|
||||
|
||||
/* properties from https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/css/fullscreen.css;l=68-83;drc=4670338ccf46aaf26aee2402b0f722106d55b003 */
|
||||
/* stylelint-disable-next-line media-query-no-invalid */
|
||||
@media (-moz-in-android-pip-mode) and -moz-pref("layout.css.android-pip.enabled") {
|
||||
video {
|
||||
position: fixed !important;
|
||||
left: 0 !important;
|
||||
top: 0 !important;
|
||||
margin: 0 !important;
|
||||
min-width: 0 !important;
|
||||
max-width: none !important;
|
||||
min-height: 0 !important;
|
||||
max-height: none !important;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
transform: none !important;
|
||||
|
||||
background-color: black !important;
|
||||
z-index: 2147483647 !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* stylelint-disable-next-line media-query-no-invalid */
|
||||
@media -moz-pref("layout.css.h1-in-section-ua-styles.enabled") {
|
||||
:is(article, aside, nav, section)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const CHROME_ONLY_TOGGLES = [
|
||||
"-moz-is-glyph",
|
||||
"-moz-in-android-pip-mode",
|
||||
"-moz-print-preview",
|
||||
"-moz-scrollbar-start-backward",
|
||||
"-moz-scrollbar-start-forward",
|
||||
|
||||
@@ -10170,6 +10170,12 @@
|
||||
value: @IS_NOT_NIGHTLY_BUILD@
|
||||
mirror: always
|
||||
|
||||
# CSS for android picture-in-picture. See bug 1940052.
|
||||
- name: layout.css.android-pip.enabled
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# The maximum width or height of the cursor we should allow when intersecting
|
||||
# the UI, in CSS pixels.
|
||||
- name: layout.cursor.block.max-size
|
||||
|
||||
@@ -515,6 +515,10 @@ fn eval_moz_is_glyph(context: &Context) -> bool {
|
||||
context.device().document().mIsSVGGlyphsDocument()
|
||||
}
|
||||
|
||||
fn eval_moz_in_android_pip_mode(context: &Context) -> bool {
|
||||
unsafe { bindings::Gecko_MediaFeatures_InAndroidPipMode(context.device().document()) }
|
||||
}
|
||||
|
||||
fn eval_moz_print_preview(context: &Context) -> bool {
|
||||
let is_print_preview = context.device().is_print_preview();
|
||||
if is_print_preview {
|
||||
@@ -653,7 +657,7 @@ macro_rules! lnf_int_feature {
|
||||
/// to support new types in these entries and (2) ensuring that either
|
||||
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
|
||||
/// would be returned by the evaluator function could change.
|
||||
pub static MEDIA_FEATURES: [QueryFeatureDescription; 61] = [
|
||||
pub static MEDIA_FEATURES: [QueryFeatureDescription; 62] = [
|
||||
feature!(
|
||||
atom!("width"),
|
||||
AllowsRanges::Yes,
|
||||
@@ -888,6 +892,12 @@ pub static MEDIA_FEATURES: [QueryFeatureDescription; 61] = [
|
||||
Evaluator::BoolInteger(eval_moz_is_glyph),
|
||||
FeatureFlags::CHROME_AND_UA_ONLY,
|
||||
),
|
||||
feature!(
|
||||
atom!("-moz-in-android-pip-mode"),
|
||||
AllowsRanges::No,
|
||||
Evaluator::BoolInteger(eval_moz_in_android_pip_mode),
|
||||
FeatureFlags::CHROME_AND_UA_ONLY,
|
||||
),
|
||||
feature!(
|
||||
atom!("-moz-is-resource-document"),
|
||||
AllowsRanges::No,
|
||||
|
||||
@@ -55,6 +55,7 @@ STATIC_ATOMS = [
|
||||
Atom("mozsignature", "moz-signature"), # Used by MailNews.
|
||||
Atom("_moz_bullet_font", "-moz-bullet-font"),
|
||||
Atom("_moz_is_glyph", "-moz-is-glyph"),
|
||||
Atom("_moz_in_android_pip_mode", "-moz-in-android-pip-mode"),
|
||||
Atom("_moz_original_size", "_moz_original_size"),
|
||||
Atom("_moz_print_preview", "-moz-print-preview"),
|
||||
Atom("menuactive", "_moz-menuactive"),
|
||||
@@ -2441,6 +2442,7 @@ STATIC_ATOMS = [
|
||||
Atom("layout_css_always_underline_links", "layout.css.always_underline_links"),
|
||||
Atom("layout_css_cached_scrollbar_styles_enabled", "layout.css.cached-scrollbar-styles.enabled"),
|
||||
Atom("layout_css_h1_in_section_ua_styles_enabled", "layout.css.h1-in-section-ua-styles.enabled"),
|
||||
Atom("layout_css_android_pip_enabled", "layout.css.android-pip.enabled"),
|
||||
# Contextual Identity / Containers
|
||||
Atom("usercontextid", "usercontextid"),
|
||||
Atom("geckoViewSessionContextId", "geckoViewSessionContextId"),
|
||||
|
||||
Reference in New Issue
Block a user