browser(firefox): added reduced motion emulation (#6618)

This commit is contained in:
Max Schmitt 2021-05-18 21:23:12 +02:00 committed by GitHub
parent 36c0765c98
commit c4a6c2bcab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 522 additions and 30 deletions

View File

@ -1,2 +1,2 @@
1253
Changed: aslushnikov@gmail.com Fri 14 May 2021 21:37:19 PM PDT
1254
Changed: max@schmitt.mx Di 18. Mai 21:21:37 CEST 2021

View File

@ -159,6 +159,7 @@ class TargetRegistry {
target.updateUserAgent();
target.updateTouchOverride();
target.updateColorSchemeOverride();
target.updateReducedMotionOverride();
if (!hasExplicitSize)
target.updateViewportSize();
if (browserContext.videoRecordingOptions)
@ -437,6 +438,14 @@ class PageTarget {
this._linkedBrowser.browsingContext.prefersColorSchemeOverride = this.colorScheme || this._browserContext.colorScheme || 'none';
}
setReducedMotion(reducedMotion) {
this.reducedMotion = fromProtocolReducedMotion(reducedMotion);
this.updateReducedMotionOverride();
}
updateReducedMotionOverride() {
this._linkedBrowser.browsingContext.prefersReducedMotionOverride = this.reducedMotion || this._browserContext.reducedMotion || 'none';
}
async setViewportSize(viewportSize) {
this._viewportSize = viewportSize;
@ -612,6 +621,14 @@ function fromProtocolColorScheme(colorScheme) {
throw new Error('Unknown color scheme: ' + colorScheme);
}
function fromProtocolReducedMotion(reducedMotion) {
if (reducedMotion === 'reduce')
return reducedMotion;
if (reducedMotion === null || reducedMotion === 'no-preference')
return undefined;
throw new Error('Unknown reduced motion: ' + reducedMotion);
}
class BrowserContext {
constructor(registry, browserContextId, removeOnDetach) {
this._registry = registry;
@ -639,6 +656,7 @@ class BrowserContext {
this.defaultUserAgent = null;
this.touchOverride = false;
this.colorScheme = 'none';
this.reducedMotion = 'none';
this.videoRecordingOptions = undefined;
this.scriptsToEvaluateOnNewDocument = [];
this.bindings = [];
@ -652,6 +670,12 @@ class BrowserContext {
page.updateColorSchemeOverride();
}
setReducedMotion(reducedMotion) {
this.reducedMotion = fromProtocolReducedMotion(reducedMotion);
for (const page of this.pages)
page.updateReducedMotionOverride();
}
async destroy() {
if (this.userContextId !== 0) {
ContextualIdentityService.remove(this.userContextId);

View File

@ -69,6 +69,10 @@ const applySetting = {
colorScheme: (colorScheme) => {
frameTree.setColorScheme(colorScheme);
},
reducedMotion: (reducedMotion) => {
frameTree.setReducedMotion(reducedMotion);
},
};
const channel = SimpleChannel.createForMessageManager('content::page', messageManager);

View File

@ -201,6 +201,10 @@ class BrowserHandler {
await this._targetRegistry.browserContextForId(browserContextId).setColorScheme(nullToUndefined(colorScheme));
}
async ['Browser.setReducedMotion']({browserContextId, reducedMotion}) {
await this._targetRegistry.browserContextForId(browserContextId).setReducedMotion(nullToUndefined(reducedMotion));
}
async ['Browser.setVideoRecordingOptions']({browserContextId, dir, width, height, scale}) {
await this._targetRegistry.browserContextForId(browserContextId).setVideoRecordingOptions({dir, width, height, scale});
}

View File

@ -279,8 +279,9 @@ class PageHandler {
return await this._contentPage.send('setFileInputFiles', options);
}
async ['Page.setEmulatedMedia']({colorScheme, type}) {
async ['Page.setEmulatedMedia']({colorScheme, type, reducedMotion}) {
this._pageTarget.setColorScheme(colorScheme || null);
this._pageTarget.setReducedMotion(reducedMotion || null);
this._pageTarget.setEmulatedMedia(type);
}

View File

@ -432,6 +432,12 @@ const Browser = {
colorScheme: t.Nullable(t.Enum(['dark', 'light', 'no-preference'])),
},
},
'setReducedMotion': {
params: {
browserContextId: t.Optional(t.String),
reducedMotion: t.Nullable(t.Enum(['reduce', 'no-preference'])),
},
},
'setVideoRecordingOptions': {
params: {
browserContextId: t.Optional(t.String),
@ -748,6 +754,7 @@ const Page = {
params: {
type: t.Optional(t.Enum(['screen', 'print', ''])),
colorScheme: t.Optional(t.Enum(['dark', 'light', 'no-preference'])),
reducedMotion: t.Optional(t.Enum(['reduce', 'no-preference'])),
},
},
'setCacheDisabled': {

View File

@ -171,8 +171,88 @@ index 040c7b124dec6bb254563bbe74fe50012cb077a3..b4e6b8132786af70e8ad0dce88b67c28
const transportProvider = {
setListener(upgradeListener) {
diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp
index 24daf0c64b332823df7f5da698e35bab8edb72d5..6293aabbad9cb179ebbe8063e03496ca96d8577b 100644
--- a/docshell/base/BrowsingContext.cpp
+++ b/docshell/base/BrowsingContext.cpp
@@ -103,6 +103,13 @@ struct ParamTraits<mozilla::dom::PrefersColorSchemeOverride>
mozilla::dom::PrefersColorSchemeOverride::None,
mozilla::dom::PrefersColorSchemeOverride::EndGuard_> {};
+template <>
+struct ParamTraits<mozilla::dom::PrefersReducedMotionOverride>
+ : public ContiguousEnumSerializer<
+ mozilla::dom::PrefersReducedMotionOverride,
+ mozilla::dom::PrefersReducedMotionOverride::None,
+ mozilla::dom::PrefersReducedMotionOverride::EndGuard_> {};
+
template <>
struct ParamTraits<mozilla::dom::ExplicitActiveStatus>
: public ContiguousEnumSerializer<
@@ -2537,6 +2544,23 @@ void BrowsingContext::DidSet(FieldIndex<IDX_PrefersColorSchemeOverride>,
});
}
+void BrowsingContext::DidSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
+ dom::PrefersReducedMotionOverride aOldValue) {
+ MOZ_ASSERT(IsTop());
+ if (PrefersReducedMotionOverride() == aOldValue) {
+ return;
+ }
+ PreOrderWalk([&](BrowsingContext* aContext) {
+ if (nsIDocShell* shell = aContext->GetDocShell()) {
+ if (nsPresContext* pc = shell->GetPresContext()) {
+ pc->MediaFeatureValuesChanged(
+ {MediaFeatureChangeReason::SystemMetricsChange},
+ MediaFeatureChangePropagation::JustThisDocument);
+ }
+ }
+ });
+}
+
void BrowsingContext::DidSet(FieldIndex<IDX_MediumOverride>,
nsString&& aOldValue) {
MOZ_ASSERT(IsTop());
diff --git a/docshell/base/BrowsingContext.h b/docshell/base/BrowsingContext.h
index fdd1fd88d2bb838ed88a8d49d1c923a7002893ee..6cd085d20da5692435cf7d9faaeeeec3b480ed83 100644
--- a/docshell/base/BrowsingContext.h
+++ b/docshell/base/BrowsingContext.h
@@ -191,6 +191,7 @@ enum class ExplicitActiveStatus : uint8_t {
FIELD(ServiceWorkersTestingEnabled, bool) \
FIELD(MediumOverride, nsString) \
FIELD(PrefersColorSchemeOverride, mozilla::dom::PrefersColorSchemeOverride) \
+ FIELD(PrefersReducedMotionOverride, mozilla::dom::PrefersReducedMotionOverride) \
FIELD(DisplayMode, mozilla::dom::DisplayMode) \
/* True if the top level browsing context owns a main media controller */ \
FIELD(HasMainMediaController, bool) \
@@ -810,6 +811,10 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
return GetPrefersColorSchemeOverride();
}
+ dom::PrefersReducedMotionOverride PrefersReducedMotionOverride() const {
+ return GetPrefersReducedMotionOverride();
+ }
+
protected:
virtual ~BrowsingContext();
BrowsingContext(WindowContext* aParentWindow, BrowsingContextGroup* aGroup,
@@ -917,6 +922,14 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
void DidSet(FieldIndex<IDX_PrefersColorSchemeOverride>,
dom::PrefersColorSchemeOverride aOldValue);
+ bool CanSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
+ dom::PrefersReducedMotionOverride, ContentParent*) {
+ return IsTop();
+ }
+
+ void DidSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
+ dom::PrefersReducedMotionOverride aOldValue);
+
void DidSet(FieldIndex<IDX_MediumOverride>, nsString&& aOldValue);
bool CanSet(FieldIndex<IDX_SuspendMediaWhenInactive>, bool, ContentParent*) {
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index dffed2bfcca2ef93c0ee97129baa30743bf15b9f..de8cbb9884553088354b4f58c77ac5a0c33c37b9 100644
index dffed2bfcca2ef93c0ee97129baa30743bf15b9f..d4b3ef30d2a36f74fb17015b53b3a4d918e43160 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -15,6 +15,12 @@
@ -220,7 +300,7 @@ index dffed2bfcca2ef93c0ee97129baa30743bf15b9f..de8cbb9884553088354b4f58c77ac5a0
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsObjectLoadingContent.h"
@@ -396,6 +406,12 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
@@ -396,6 +406,13 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
mAllowDNSPrefetch(true),
mAllowWindowControl(true),
mCSSErrorReportingEnabled(false),
@ -230,10 +310,11 @@ index dffed2bfcca2ef93c0ee97129baa30743bf15b9f..de8cbb9884553088354b4f58c77ac5a0
+ mForceActiveState(false),
+ mOnlineOverride(nsIDocShell::ONLINE_OVERRIDE_NONE),
+ mColorSchemeOverride(COLOR_SCHEME_OVERRIDE_NONE),
+ mReducedMotionOverride(REDUCED_MOTION_OVERRIDE_NONE),
mAllowAuth(mItemType == typeContent),
mAllowKeywordFixup(false),
mDisableMetaRefreshWhenInactive(false),
@@ -3345,6 +3361,203 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) {
@@ -3345,6 +3362,221 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) {
return NS_OK;
}
@ -432,12 +513,30 @@ index dffed2bfcca2ef93c0ee97129baa30743bf15b9f..de8cbb9884553088354b4f58c77ac5a0
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsDocShell::GetReducedMotionOverride(ReducedMotionOverride* aReducedMotionOverride) {
+ *aReducedMotionOverride = GetRootDocShell()->mReducedMotionOverride;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsDocShell::SetReducedMotionOverride(ReducedMotionOverride aReducedMotionOverride) {
+ mReducedMotionOverride = aReducedMotionOverride;
+ RefPtr<nsPresContext> presContext = GetPresContext();
+ if (presContext) {
+ presContext->MediaFeatureValuesChanged(
+ {MediaFeatureChangeReason::SystemMetricsChange},
+ MediaFeatureChangePropagation::JustThisDocument);
+ }
+ return NS_OK;
+}
+
+// =============== Juggler End =======================
+
NS_IMETHODIMP
nsDocShell::GetIsNavigating(bool* aOut) {
*aOut = mIsNavigating;
@@ -4969,7 +5182,7 @@ nsDocShell::GetVisibility(bool* aVisibility) {
@@ -4969,7 +5201,7 @@ nsDocShell::GetVisibility(bool* aVisibility) {
}
void nsDocShell::ActivenessMaybeChanged() {
@ -446,7 +545,7 @@ index dffed2bfcca2ef93c0ee97129baa30743bf15b9f..de8cbb9884553088354b4f58c77ac5a0
if (RefPtr<PresShell> presShell = GetPresShell()) {
presShell->SetIsActive(isActive);
}
@@ -8708,6 +8921,12 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
@@ -8708,6 +8940,12 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
true, // aForceNoOpener
getter_AddRefs(newBC));
MOZ_ASSERT(!newBC);
@ -459,7 +558,7 @@ index dffed2bfcca2ef93c0ee97129baa30743bf15b9f..de8cbb9884553088354b4f58c77ac5a0
return rv;
}
@@ -12707,6 +12926,9 @@ class OnLinkClickEvent : public Runnable {
@@ -12707,6 +12945,9 @@ class OnLinkClickEvent : public Runnable {
mHandler->OnLinkClickSync(mContent, mLoadState, mNoOpenerImplied,
mTriggeringPrincipal);
}
@ -469,7 +568,7 @@ index dffed2bfcca2ef93c0ee97129baa30743bf15b9f..de8cbb9884553088354b4f58c77ac5a0
return NS_OK;
}
@@ -12793,6 +13015,8 @@ nsresult nsDocShell::OnLinkClick(
@@ -12793,6 +13034,8 @@ nsresult nsDocShell::OnLinkClick(
nsCOMPtr<nsIRunnable> ev =
new OnLinkClickEvent(this, aContent, loadState, noOpenerImplied,
aIsTrusted, aTriggeringPrincipal);
@ -479,7 +578,7 @@ index dffed2bfcca2ef93c0ee97129baa30743bf15b9f..de8cbb9884553088354b4f58c77ac5a0
}
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
index c29b1e05f3620a017156fd93d0928eca5e956859..4d89e1d5d2ebd3115fc06cfb1c7b6c08ea454d6d 100644
index c29b1e05f3620a017156fd93d0928eca5e956859..7ca313920eb5693574de598f7de06fba796d2c77 100644
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -14,6 +14,7 @@
@ -523,7 +622,7 @@ index c29b1e05f3620a017156fd93d0928eca5e956859..4d89e1d5d2ebd3115fc06cfb1c7b6c08
// Handles retrieval of subframe session history for nsDocShell::LoadURI. If a
// load is requested in a subframe of the current DocShell, the subframe
// loadType may need to reflect the loadType of the parent document, or in
@@ -1236,6 +1249,15 @@ class nsDocShell final : public nsDocLoader,
@@ -1236,6 +1249,16 @@ class nsDocShell final : public nsDocLoader,
bool mAllowDNSPrefetch : 1;
bool mAllowWindowControl : 1;
bool mCSSErrorReportingEnabled : 1;
@ -535,12 +634,13 @@ index c29b1e05f3620a017156fd93d0928eca5e956859..4d89e1d5d2ebd3115fc06cfb1c7b6c08
+ RefPtr<nsGeolocationService> mGeolocationServiceOverride;
+ OnlineOverride mOnlineOverride;
+ ColorSchemeOverride mColorSchemeOverride;
+ ReducedMotionOverride mReducedMotionOverride;
+
bool mAllowAuth : 1;
bool mAllowKeywordFixup : 1;
bool mDisableMetaRefreshWhenInactive : 1;
diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl
index d326491a03b83c4015f7bc3c779b0c5909e2db43..21f343bda776cd71212fc728d634dabcbe2d97da 100644
index d326491a03b83c4015f7bc3c779b0c5909e2db43..828271c52ecdcecfc6c06fa9d85ffc19a9dcf28e 100644
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -44,6 +44,7 @@ interface nsIURI;
@ -551,7 +651,7 @@ index d326491a03b83c4015f7bc3c779b0c5909e2db43..21f343bda776cd71212fc728d634dabc
interface nsIEditor;
interface nsIEditingSession;
interface nsIInputStream;
@@ -880,6 +881,35 @@ interface nsIDocShell : nsIDocShellTreeItem
@@ -880,6 +881,42 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
void synchronizeLayoutHistoryState();
@ -582,13 +682,20 @@ index d326491a03b83c4015f7bc3c779b0c5909e2db43..21f343bda776cd71212fc728d634dabc
+ };
+ [infallible] attribute nsIDocShell_ColorSchemeOverride colorSchemeOverride;
+
+ cenum ReducedMotionOverride : 8 {
+ REDUCED_MOTION_OVERRIDE_REDUCE,
+ REDUCED_MOTION_OVERRIDE_NO_PREFERENCE,
+ REDUCED_MOTION_OVERRIDE_NONE, /* This clears the override. */
+ };
+ [infallible] attribute nsIDocShell_ReducedMotionOverride reducedMotionOverride;
+
+ void setGeolocationOverride(in nsIDOMGeoPosition position);
+
/**
* This attempts to save any applicable layout history state (like
* scroll position) in the nsISHEntry. This is normally done
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp
index 93baac5ba84922575d8d334533f553f3ad69cfa0..eb4ae377a31301b2df1d06ed63b331b7ba849c9c 100644
index 93baac5ba84922575d8d334533f553f3ad69cfa0..248207e95ab683af1e4f1fd2d53b7eb7d9a49c69 100644
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -3496,6 +3496,9 @@ void Document::SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages) {
@ -644,6 +751,59 @@ index 93baac5ba84922575d8d334533f553f3ad69cfa0..eb4ae377a31301b2df1d06ed63b331b7
if (aIgnoreRFP == IgnoreRFP::No &&
nsContentUtils::ShouldResistFingerprinting(this)) {
return StylePrefersColorScheme::Light;
@@ -17012,6 +17037,39 @@ StylePrefersColorScheme Document::PrefersColorScheme(
return dark ? StylePrefersColorScheme::Dark : StylePrefersColorScheme::Light;
}
+bool Document::PrefersReducedMotion() const {
+ auto* docShell = static_cast<nsDocShell*>(GetDocShell());
+ nsIDocShell::ReducedMotionOverride reducedMotion;
+ if (docShell && docShell->GetReducedMotionOverride(&reducedMotion) == NS_OK &&
+ reducedMotion != nsIDocShell::REDUCED_MOTION_OVERRIDE_NONE) {
+ switch (reducedMotion) {
+ case nsIDocShell::REDUCED_MOTION_OVERRIDE_REDUCE:
+ return true;
+ case nsIDocShell::REDUCED_MOTION_OVERRIDE_NO_PREFERENCE:
+ return false;
+ case nsIDocShell::REDUCED_MOTION_OVERRIDE_NONE:
+ break;
+ };
+ }
+
+ if (auto* bc = GetBrowsingContext()) {
+ switch (bc->Top()->PrefersReducedMotionOverride()) {
+ case dom::PrefersReducedMotionOverride::Reduce:
+ return true;
+ case dom::PrefersReducedMotionOverride::No_preference:
+ return false;
+ case dom::PrefersReducedMotionOverride::None:
+ case dom::PrefersReducedMotionOverride::EndGuard_:
+ break;
+ }
+ }
+
+ if (nsContentUtils::ShouldResistFingerprinting(this)) {
+ return false;
+ }
+ return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
+}
+
// static
bool Document::UseOverlayScrollbars(const Document* aDocument) {
BrowsingContext* bc = aDocument ? aDocument->GetBrowsingContext() : nullptr;
diff --git a/dom/base/Document.h b/dom/base/Document.h
index 87807e615c6897d92f3f8a7d7409e690c039f72d..54882eb8b82a9727022ca39371a9cc27d2c5ef75 100644
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -4013,6 +4013,8 @@ class Document : public nsINode,
enum class IgnoreRFP { No, Yes };
StylePrefersColorScheme PrefersColorScheme(IgnoreRFP = IgnoreRFP::No) const;
+ bool PrefersReducedMotion() const;
+
// Returns true if we use overlay scrollbars on the system wide or on the
// given document.
static bool UseOverlayScrollbars(const Document* aDocument);
diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp
index 407eecefd4e1cdf58f63714783ecf18cc6e28dce..a479467953fdfb54fb5183ce86794339aa36ca9a 100644
--- a/dom/base/Navigator.cpp
@ -996,6 +1156,36 @@ index b53d2f740b5901e4422fa3af84198dc687c535d9..052d15cccb021540cc9c7dfe5a9337d9
static void ResetTimeZone();
static bool DumpEnabled();
diff --git a/dom/chrome-webidl/BrowsingContext.webidl b/dom/chrome-webidl/BrowsingContext.webidl
index dfdfe724ccc52dd3a95997383a67b296822af2fb..82c1e391ae05d84286723710f4915e435ea6bb38 100644
--- a/dom/chrome-webidl/BrowsingContext.webidl
+++ b/dom/chrome-webidl/BrowsingContext.webidl
@@ -51,6 +51,15 @@ enum PrefersColorSchemeOverride {
"dark",
};
+/**
+ * CSS prefers-reduced-motion values.
+ */
+enum PrefersReducedMotionOverride {
+ "none",
+ "reduce",
+ "no-preference",
+};
+
/**
* Allowed overrides of platform/pref default behaviour for touch events.
*/
@@ -173,6 +182,9 @@ interface BrowsingContext {
// Color-scheme simulation, for DevTools.
[SetterThrows] attribute PrefersColorSchemeOverride prefersColorSchemeOverride;
+ // Reduced-Motion simulation, for DevTools.
+ [SetterThrows] attribute PrefersReducedMotionOverride prefersReducedMotionOverride;
+
/**
* A unique identifier for the browser element that is hosting this
* BrowsingContext tree. Every BrowsingContext in the element's tree will
diff --git a/dom/geolocation/Geolocation.cpp b/dom/geolocation/Geolocation.cpp
index 763192a50cf8dce36eaf1fd2b470c631eecfe65c..436f01a2ca6166f1a97139f1cda7e1832b9df36c 100644
--- a/dom/geolocation/Geolocation.cpp
@ -1667,6 +1857,22 @@ index 77b4c4ea3581e3b66b0b40dae33c807b2d5aefd8..84af4461b9e946122527ac974dc30da5
void updateTimeZone();
void internalResyncICUDefaultTimeZone();
diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
index 445a031b11c6e3c65ed859a03a83a21da88f1472..87e14f7208b5b9348c13dcb07b43e2dff25e4fd9 100644
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -261,10 +261,7 @@ nsAtom* Gecko_MediaFeatures_GetOperatingSystemVersion(
}
bool Gecko_MediaFeatures_PrefersReducedMotion(const Document* aDocument) {
- if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
- return false;
- }
- return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
+ return aDocument->PrefersReducedMotion();
}
StylePrefersColorScheme Gecko_MediaFeatures_PrefersColorScheme(
diff --git a/media/libjpeg/jconfig.h b/media/libjpeg/jconfig.h
index f2723e654098ff27542e1eb16a536c11ad0af617..b0b480551ff7d895dfdeb5a9800874858929c8ba 100644
--- a/media/libjpeg/jconfig.h

View File

@ -1,2 +1,2 @@
1263
Changed: aslushnikov@gmail.com Mon 14 May 2021 21:37:09 PM PDT
1264
Changed: max@schmitt.mx Di 18. Mai 20:50:35 CEST 2021

View File

@ -159,6 +159,7 @@ class TargetRegistry {
target.updateUserAgent();
target.updateTouchOverride();
target.updateColorSchemeOverride();
target.updateReducedMotionOverride();
if (!hasExplicitSize)
target.updateViewportSize();
if (browserContext.videoRecordingOptions)
@ -437,6 +438,14 @@ class PageTarget {
this._linkedBrowser.browsingContext.prefersColorSchemeOverride = this.colorScheme || this._browserContext.colorScheme || 'none';
}
setReducedMotion(reducedMotion) {
this.reducedMotion = fromProtocolReducedMotion(reducedMotion);
this.updateReducedMotionOverride();
}
updateReducedMotionOverride() {
this._linkedBrowser.browsingContext.prefersReducedMotionOverride = this.reducedMotion || this._browserContext.reducedMotion || 'none';
}
async setViewportSize(viewportSize) {
this._viewportSize = viewportSize;
@ -612,6 +621,14 @@ function fromProtocolColorScheme(colorScheme) {
throw new Error('Unknown color scheme: ' + colorScheme);
}
function fromProtocolReducedMotion(reducedMotion) {
if (reducedMotion === 'reduce')
return reducedMotion;
if (reducedMotion === null || reducedMotion === 'no-preference')
return undefined;
throw new Error('Unknown reduced motion: ' + reducedMotion);
}
class BrowserContext {
constructor(registry, browserContextId, removeOnDetach) {
this._registry = registry;
@ -639,6 +656,7 @@ class BrowserContext {
this.defaultUserAgent = null;
this.touchOverride = false;
this.colorScheme = 'none';
this.reducedMotion = 'none';
this.videoRecordingOptions = undefined;
this.scriptsToEvaluateOnNewDocument = [];
this.bindings = [];
@ -652,6 +670,12 @@ class BrowserContext {
page.updateColorSchemeOverride();
}
setReducedMotion(reducedMotion) {
this.reducedMotion = fromProtocolReducedMotion(reducedMotion);
for (const page of this.pages)
page.updateReducedMotionOverride();
}
async destroy() {
if (this.userContextId !== 0) {
ContextualIdentityService.remove(this.userContextId);

View File

@ -69,6 +69,10 @@ const applySetting = {
colorScheme: (colorScheme) => {
frameTree.setColorScheme(colorScheme);
},
reducedMotion: (reducedMotion) => {
frameTree.setReducedMotion(reducedMotion);
},
};
const channel = SimpleChannel.createForMessageManager('content::page', messageManager);

View File

@ -201,6 +201,10 @@ class BrowserHandler {
await this._targetRegistry.browserContextForId(browserContextId).setColorScheme(nullToUndefined(colorScheme));
}
async ['Browser.setReducedMotion']({browserContextId, reducedMotion}) {
await this._targetRegistry.browserContextForId(browserContextId).setReducedMotion(nullToUndefined(reducedMotion));
}
async ['Browser.setVideoRecordingOptions']({browserContextId, dir, width, height, scale}) {
await this._targetRegistry.browserContextForId(browserContextId).setVideoRecordingOptions({dir, width, height, scale});
}

View File

@ -279,8 +279,9 @@ class PageHandler {
return await this._contentPage.send('setFileInputFiles', options);
}
async ['Page.setEmulatedMedia']({colorScheme, type}) {
async ['Page.setEmulatedMedia']({colorScheme, type, reducedMotion}) {
this._pageTarget.setColorScheme(colorScheme || null);
this._pageTarget.setReducedMotion(reducedMotion || null);
this._pageTarget.setEmulatedMedia(type);
}

View File

@ -432,6 +432,12 @@ const Browser = {
colorScheme: t.Nullable(t.Enum(['dark', 'light', 'no-preference'])),
},
},
'setReducedMotion': {
params: {
browserContextId: t.Optional(t.String),
reducedMotion: t.Nullable(t.Enum(['reduce', 'no-preference'])),
},
},
'setVideoRecordingOptions': {
params: {
browserContextId: t.Optional(t.String),
@ -748,6 +754,7 @@ const Page = {
params: {
type: t.Optional(t.Enum(['screen', 'print', ''])),
colorScheme: t.Optional(t.Enum(['dark', 'light', 'no-preference'])),
reducedMotion: t.Optional(t.Enum(['reduce', 'no-preference'])),
},
},
'setCacheDisabled': {

View File

@ -171,8 +171,88 @@ index 040c7b124dec6bb254563bbe74fe50012cb077a3..b4e6b8132786af70e8ad0dce88b67c28
const transportProvider = {
setListener(upgradeListener) {
diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp
index f3292d8ae6da1865847ded8b1c79a80ba8fca70e..cf8fa57ce2363555d10c837c99efd282d515e64b 100644
--- a/docshell/base/BrowsingContext.cpp
+++ b/docshell/base/BrowsingContext.cpp
@@ -105,6 +105,13 @@ struct ParamTraits<mozilla::dom::PrefersColorSchemeOverride>
mozilla::dom::PrefersColorSchemeOverride::None,
mozilla::dom::PrefersColorSchemeOverride::EndGuard_> {};
+template <>
+struct ParamTraits<mozilla::dom::PrefersReducedMotionOverride>
+ : public ContiguousEnumSerializer<
+ mozilla::dom::PrefersReducedMotionOverride,
+ mozilla::dom::PrefersReducedMotionOverride::None,
+ mozilla::dom::PrefersReducedMotionOverride::EndGuard_> {};
+
template <>
struct ParamTraits<mozilla::dom::ExplicitActiveStatus>
: public ContiguousEnumSerializer<
@@ -2637,6 +2644,23 @@ void BrowsingContext::DidSet(FieldIndex<IDX_PrefersColorSchemeOverride>,
});
}
+void BrowsingContext::DidSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
+ dom::PrefersReducedMotionOverride aOldValue) {
+ MOZ_ASSERT(IsTop());
+ if (PrefersReducedMotionOverride() == aOldValue) {
+ return;
+ }
+ PreOrderWalk([&](BrowsingContext* aContext) {
+ if (nsIDocShell* shell = aContext->GetDocShell()) {
+ if (nsPresContext* pc = shell->GetPresContext()) {
+ pc->MediaFeatureValuesChanged(
+ {MediaFeatureChangeReason::SystemMetricsChange},
+ MediaFeatureChangePropagation::JustThisDocument);
+ }
+ }
+ });
+}
+
void BrowsingContext::DidSet(FieldIndex<IDX_MediumOverride>,
nsString&& aOldValue) {
MOZ_ASSERT(IsTop());
diff --git a/docshell/base/BrowsingContext.h b/docshell/base/BrowsingContext.h
index ba3cceb7c9d6bc0014c1abf66d5b19d6d26a45db..d41680af40fe44ba1db2bff5946c902db7373225 100644
--- a/docshell/base/BrowsingContext.h
+++ b/docshell/base/BrowsingContext.h
@@ -191,6 +191,7 @@ enum class ExplicitActiveStatus : uint8_t {
FIELD(ServiceWorkersTestingEnabled, bool) \
FIELD(MediumOverride, nsString) \
FIELD(PrefersColorSchemeOverride, mozilla::dom::PrefersColorSchemeOverride) \
+ FIELD(PrefersReducedMotionOverride, mozilla::dom::PrefersReducedMotionOverride) \
FIELD(DisplayMode, mozilla::dom::DisplayMode) \
/* True if the top level browsing context owns a main media controller */ \
FIELD(HasMainMediaController, bool) \
@@ -847,6 +848,10 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
return GetPrefersColorSchemeOverride();
}
+ dom::PrefersReducedMotionOverride PrefersReducedMotionOverride() const {
+ return GetPrefersReducedMotionOverride();
+ }
+
void FlushSessionStore();
protected:
@@ -961,6 +966,14 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
void DidSet(FieldIndex<IDX_PrefersColorSchemeOverride>,
dom::PrefersColorSchemeOverride aOldValue);
+ bool CanSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
+ dom::PrefersReducedMotionOverride, ContentParent*) {
+ return IsTop();
+ }
+
+ void DidSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
+ dom::PrefersReducedMotionOverride aOldValue);
+
void DidSet(FieldIndex<IDX_MediumOverride>, nsString&& aOldValue);
bool CanSet(FieldIndex<IDX_SuspendMediaWhenInactive>, bool, ContentParent*) {
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index d99ddc3181cf9092633558ac5798f38860ad4f7d..6fbeec60b7ff51e5591c8e8c50e713bc9323603d 100644
index d99ddc3181cf9092633558ac5798f38860ad4f7d..52ff3ddb06b7714469b695b3c894172c33af0c83 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -15,6 +15,12 @@
@ -220,7 +300,7 @@ index d99ddc3181cf9092633558ac5798f38860ad4f7d..6fbeec60b7ff51e5591c8e8c50e713bc
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsObjectLoadingContent.h"
@@ -397,6 +407,12 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
@@ -397,6 +407,13 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
mAllowDNSPrefetch(true),
mAllowWindowControl(true),
mCSSErrorReportingEnabled(false),
@ -230,10 +310,11 @@ index d99ddc3181cf9092633558ac5798f38860ad4f7d..6fbeec60b7ff51e5591c8e8c50e713bc
+ mForceActiveState(false),
+ mOnlineOverride(nsIDocShell::ONLINE_OVERRIDE_NONE),
+ mColorSchemeOverride(COLOR_SCHEME_OVERRIDE_NONE),
+ mReducedMotionOverride(REDUCED_MOTION_OVERRIDE_NONE),
mAllowAuth(mItemType == typeContent),
mAllowKeywordFixup(false),
mDisableMetaRefreshWhenInactive(false),
@@ -3328,6 +3344,203 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) {
@@ -3328,6 +3345,221 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) {
return NS_OK;
}
@ -432,12 +513,30 @@ index d99ddc3181cf9092633558ac5798f38860ad4f7d..6fbeec60b7ff51e5591c8e8c50e713bc
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsDocShell::GetReducedMotionOverride(ReducedMotionOverride* aReducedMotionOverride) {
+ *aReducedMotionOverride = GetRootDocShell()->mReducedMotionOverride;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsDocShell::SetReducedMotionOverride(ReducedMotionOverride aReducedMotionOverride) {
+ mReducedMotionOverride = aReducedMotionOverride;
+ RefPtr<nsPresContext> presContext = GetPresContext();
+ if (presContext) {
+ presContext->MediaFeatureValuesChanged(
+ {MediaFeatureChangeReason::SystemMetricsChange},
+ MediaFeatureChangePropagation::JustThisDocument);
+ }
+ return NS_OK;
+}
+
+// =============== Juggler End =======================
+
NS_IMETHODIMP
nsDocShell::GetIsNavigating(bool* aOut) {
*aOut = mIsNavigating;
@@ -4952,7 +5165,7 @@ nsDocShell::GetVisibility(bool* aVisibility) {
@@ -4952,7 +5184,7 @@ nsDocShell::GetVisibility(bool* aVisibility) {
}
void nsDocShell::ActivenessMaybeChanged() {
@ -446,7 +545,7 @@ index d99ddc3181cf9092633558ac5798f38860ad4f7d..6fbeec60b7ff51e5591c8e8c50e713bc
if (RefPtr<PresShell> presShell = GetPresShell()) {
presShell->SetIsActive(isActive);
}
@@ -8675,6 +8888,12 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
@@ -8675,6 +8907,12 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
true, // aForceNoOpener
getter_AddRefs(newBC));
MOZ_ASSERT(!newBC);
@ -459,7 +558,7 @@ index d99ddc3181cf9092633558ac5798f38860ad4f7d..6fbeec60b7ff51e5591c8e8c50e713bc
return rv;
}
@@ -12691,6 +12910,9 @@ class OnLinkClickEvent : public Runnable {
@@ -12691,6 +12929,9 @@ class OnLinkClickEvent : public Runnable {
mHandler->OnLinkClickSync(mContent, mLoadState, mNoOpenerImplied,
mTriggeringPrincipal);
}
@ -469,7 +568,7 @@ index d99ddc3181cf9092633558ac5798f38860ad4f7d..6fbeec60b7ff51e5591c8e8c50e713bc
return NS_OK;
}
@@ -12769,6 +12991,8 @@ nsresult nsDocShell::OnLinkClick(
@@ -12769,6 +13010,8 @@ nsresult nsDocShell::OnLinkClick(
nsCOMPtr<nsIRunnable> ev =
new OnLinkClickEvent(this, aContent, loadState, noOpenerImplied,
aIsTrusted, aTriggeringPrincipal);
@ -479,7 +578,7 @@ index d99ddc3181cf9092633558ac5798f38860ad4f7d..6fbeec60b7ff51e5591c8e8c50e713bc
}
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
index cde10e9424f0a97cf57ae740e1651731b8d8ac1c..7acba6e28134066a7a3f010e2f8a35cd3646396f 100644
index cde10e9424f0a97cf57ae740e1651731b8d8ac1c..89542ee3def7115b22d36bdb3fb61da308ea3a37 100644
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -14,6 +14,7 @@
@ -523,7 +622,7 @@ index cde10e9424f0a97cf57ae740e1651731b8d8ac1c..7acba6e28134066a7a3f010e2f8a35cd
// Handles retrieval of subframe session history for nsDocShell::LoadURI. If a
// load is requested in a subframe of the current DocShell, the subframe
// loadType may need to reflect the loadType of the parent document, or in
@@ -1232,6 +1245,15 @@ class nsDocShell final : public nsDocLoader,
@@ -1232,6 +1245,16 @@ class nsDocShell final : public nsDocLoader,
bool mAllowDNSPrefetch : 1;
bool mAllowWindowControl : 1;
bool mCSSErrorReportingEnabled : 1;
@ -535,12 +634,13 @@ index cde10e9424f0a97cf57ae740e1651731b8d8ac1c..7acba6e28134066a7a3f010e2f8a35cd
+ RefPtr<nsGeolocationService> mGeolocationServiceOverride;
+ OnlineOverride mOnlineOverride;
+ ColorSchemeOverride mColorSchemeOverride;
+ ReducedMotionOverride mReducedMotionOverride;
+
bool mAllowAuth : 1;
bool mAllowKeywordFixup : 1;
bool mDisableMetaRefreshWhenInactive : 1;
diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl
index dcf0b8c00d70a08fdd5cbe07c30e415968cd9e3e..5fe27677654bb4527b5103a6d01a709fc8688b6b 100644
index dcf0b8c00d70a08fdd5cbe07c30e415968cd9e3e..8ae4de4d5255bbbaa8cd270e50cb320248e35f33 100644
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -44,6 +44,7 @@ interface nsIURI;
@ -551,7 +651,7 @@ index dcf0b8c00d70a08fdd5cbe07c30e415968cd9e3e..5fe27677654bb4527b5103a6d01a709f
interface nsIEditor;
interface nsIEditingSession;
interface nsIInputStream;
@@ -855,6 +856,35 @@ interface nsIDocShell : nsIDocShellTreeItem
@@ -855,6 +856,42 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
void synchronizeLayoutHistoryState();
@ -582,13 +682,20 @@ index dcf0b8c00d70a08fdd5cbe07c30e415968cd9e3e..5fe27677654bb4527b5103a6d01a709f
+ };
+ [infallible] attribute nsIDocShell_ColorSchemeOverride colorSchemeOverride;
+
+ cenum ReducedMotionOverride : 8 {
+ REDUCED_MOTION_OVERRIDE_REDUCE,
+ REDUCED_MOTION_OVERRIDE_NO_PREFERENCE,
+ REDUCED_MOTION_OVERRIDE_NONE, /* This clears the override. */
+ };
+ [infallible] attribute nsIDocShell_ReducedMotionOverride reducedMotionOverride;
+
+ void setGeolocationOverride(in nsIDOMGeoPosition position);
+
/**
* This attempts to save any applicable layout history state (like
* scroll position) in the nsISHEntry. This is normally done
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp
index ce2cbca4b4c5ebb95a0991793131aa53317b862b..7f5a9653f97e3e27c96f8be7cda039f4d2ad5093 100644
index ce2cbca4b4c5ebb95a0991793131aa53317b862b..2a016e0e5f658043c5ea14b0ead95da7ca5c963c 100644
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -3490,6 +3490,9 @@ void Document::SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages) {
@ -644,6 +751,59 @@ index ce2cbca4b4c5ebb95a0991793131aa53317b862b..7f5a9653f97e3e27c96f8be7cda039f4
if (aIgnoreRFP == IgnoreRFP::No &&
nsContentUtils::ShouldResistFingerprinting(this)) {
return StylePrefersColorScheme::Light;
@@ -17111,6 +17136,39 @@ StylePrefersColorScheme Document::PrefersColorScheme(
return dark ? StylePrefersColorScheme::Dark : StylePrefersColorScheme::Light;
}
+bool Document::PrefersReducedMotion() const {
+ auto* docShell = static_cast<nsDocShell*>(GetDocShell());
+ nsIDocShell::ReducedMotionOverride reducedMotion;
+ if (docShell && docShell->GetReducedMotionOverride(&reducedMotion) == NS_OK &&
+ reducedMotion != nsIDocShell::REDUCED_MOTION_OVERRIDE_NONE) {
+ switch (reducedMotion) {
+ case nsIDocShell::REDUCED_MOTION_OVERRIDE_REDUCE:
+ return true;
+ case nsIDocShell::REDUCED_MOTION_OVERRIDE_NO_PREFERENCE:
+ return false;
+ case nsIDocShell::REDUCED_MOTION_OVERRIDE_NONE:
+ break;
+ };
+ }
+
+ if (auto* bc = GetBrowsingContext()) {
+ switch (bc->Top()->PrefersReducedMotionOverride()) {
+ case dom::PrefersReducedMotionOverride::Reduce:
+ return true;
+ case dom::PrefersReducedMotionOverride::No_preference:
+ return false;
+ case dom::PrefersReducedMotionOverride::None:
+ case dom::PrefersReducedMotionOverride::EndGuard_:
+ break;
+ }
+ }
+
+ if (nsContentUtils::ShouldResistFingerprinting(this)) {
+ return false;
+ }
+ return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
+}
+
// static
bool Document::UseOverlayScrollbars(const Document* aDocument) {
BrowsingContext* bc = aDocument ? aDocument->GetBrowsingContext() : nullptr;
diff --git a/dom/base/Document.h b/dom/base/Document.h
index e5bf988011e6fdbcac6d54c596769b15da3077ae..e2c9f12828be70a116e3e74f2fef402a5441e84d 100644
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -3995,6 +3995,8 @@ class Document : public nsINode,
enum class IgnoreRFP { No, Yes };
StylePrefersColorScheme PrefersColorScheme(IgnoreRFP = IgnoreRFP::No) const;
+ bool PrefersReducedMotion() const;
+
// Returns true if we use overlay scrollbars on the system wide or on the
// given document.
static bool UseOverlayScrollbars(const Document* aDocument);
diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp
index b21d872fba4a79c946d0b1501585b911f29d4e94..b2dfdddd9dc2110f9c80b57dfdf98ce8b3583551 100644
--- a/dom/base/Navigator.cpp
@ -996,6 +1156,36 @@ index c47a5a8c78bd28e4a5afa048cd56ad762a7a684f..4007a192ecee88d6246f8245f11278f7
static void ResetTimeZone();
static bool DumpEnabled();
diff --git a/dom/chrome-webidl/BrowsingContext.webidl b/dom/chrome-webidl/BrowsingContext.webidl
index 60c6bf107402fbcdcbc646451b4f92fae4be41d5..9f70659f20f06039ea396af6ac781239218c2ae4 100644
--- a/dom/chrome-webidl/BrowsingContext.webidl
+++ b/dom/chrome-webidl/BrowsingContext.webidl
@@ -52,6 +52,15 @@ enum PrefersColorSchemeOverride {
"dark",
};
+/**
+ * CSS prefers-reduced-motion values.
+ */
+enum PrefersReducedMotionOverride {
+ "none",
+ "reduce",
+ "no-preference",
+};
+
/**
* Allowed overrides of platform/pref default behaviour for touch events.
*/
@@ -175,6 +184,9 @@ interface BrowsingContext {
// Color-scheme simulation, for DevTools.
[SetterThrows] attribute PrefersColorSchemeOverride prefersColorSchemeOverride;
+ // Reduced-Motion simulation, for DevTools.
+ [SetterThrows] attribute PrefersReducedMotionOverride prefersReducedMotionOverride;
+
/**
* A unique identifier for the browser element that is hosting this
* BrowsingContext tree. Every BrowsingContext in the element's tree will
diff --git a/dom/geolocation/Geolocation.cpp b/dom/geolocation/Geolocation.cpp
index 763192a50cf8dce36eaf1fd2b470c631eecfe65c..436f01a2ca6166f1a97139f1cda7e1832b9df36c 100644
--- a/dom/geolocation/Geolocation.cpp
@ -1667,6 +1857,22 @@ index 77b4c4ea3581e3b66b0b40dae33c807b2d5aefd8..84af4461b9e946122527ac974dc30da5
void updateTimeZone();
void internalResyncICUDefaultTimeZone();
diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
index fffe37c359c5ba3a4e8cb4a44256f2c69182885b..8fcd8a1fa3e07f6c712b67247e303e624d316a69 100644
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -246,10 +246,7 @@ nsAtom* Gecko_MediaFeatures_GetOperatingSystemVersion(
}
bool Gecko_MediaFeatures_PrefersReducedMotion(const Document* aDocument) {
- if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
- return false;
- }
- return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
+ return aDocument->PrefersReducedMotion();
}
StylePrefersColorScheme Gecko_MediaFeatures_PrefersColorScheme(
diff --git a/media/libjpeg/jconfig.h b/media/libjpeg/jconfig.h
index f2723e654098ff27542e1eb16a536c11ad0af617..b0b480551ff7d895dfdeb5a9800874858929c8ba 100644
--- a/media/libjpeg/jconfig.h