Merge mozilla-inbound to mozilla-central. a=merge

This commit is contained in:
Cosmin Sabou 2019-06-26 06:58:03 +03:00
Родитель 65d67a409f 41b679b6e2
Коммит 2fa3b2ee5b
75 изменённых файлов: 1115 добавлений и 574 удалений

Просмотреть файл

@ -586,6 +586,31 @@ class MarkupContextMenu {
return pasteSubmenu; return pasteSubmenu;
} }
_getPseudoClassSubmenu(isSelectionElement) {
const menu = new Menu();
// Set the pseudo classes
for (const name of PSEUDO_CLASSES) {
const menuitem = new MenuItem({
id: "node-menu-pseudo-" + name.substr(1),
label: name.substr(1),
type: "checkbox",
click: () => this.inspector.togglePseudoClass(name),
});
if (isSelectionElement) {
const checked = this.selection.nodeFront.hasPseudoClassLock(name);
menuitem.checked = checked;
} else {
menuitem.disabled = true;
}
menu.append(menuitem);
}
return menu;
}
_openMenu({ target, screenX = 0, screenY = 0 } = {}) { _openMenu({ target, screenX = 0, screenY = 0 } = {}) {
if (this.selection.isSlotted()) { if (this.selection.isSlotted()) {
// Slotted elements should not show any context menu. // Slotted elements should not show any context menu.
@ -648,24 +673,52 @@ class MarkupContextMenu {
type: "separator", type: "separator",
})); }));
// Set the pseudo classes menu.append(new MenuItem({
for (const name of PSEUDO_CLASSES) { id: "node-menu-useinconsole",
const menuitem = new MenuItem({ label: INSPECTOR_L10N.getStr("inspectorUseInConsole.label"),
id: "node-menu-pseudo-" + name.substr(1), click: () => this._useInConsole(),
label: name.substr(1), }));
type: "checkbox",
click: () => this.inspector.togglePseudoClass(name),
});
if (isSelectionElement) { menu.append(new MenuItem({
const checked = this.selection.nodeFront.hasPseudoClassLock(name); id: "node-menu-showdomproperties",
menuitem.checked = checked; label: INSPECTOR_L10N.getStr("inspectorShowDOMProperties.label"),
} else { click: () => this._showDOMProperties(),
menuitem.disabled = true; }));
this._buildA11YMenuItem(menu);
if (this.selection.nodeFront.customElementLocation) {
menu.append(new MenuItem({
id: "node-menu-jumptodefinition",
label: INSPECTOR_L10N.getStr("inspectorCustomElementDefinition.label"),
click: () => this._jumpToCustomElementDefinition(),
}));
} }
menu.append(menuitem); menu.append(new MenuItem({
} type: "separator",
}));
menu.append(new MenuItem({
label: INSPECTOR_L10N.getStr("inspectorPseudoClassSubmenu.label"),
submenu: this._getPseudoClassSubmenu(isSelectionElement),
}));
menu.append(new MenuItem({
id: "node-menu-screenshotnode",
label: INSPECTOR_L10N.getStr("inspectorScreenshotNode.label"),
disabled: !isScreenshotable,
click: () => this.inspector.screenshotNode().catch(console.error),
}));
menu.append(new MenuItem({
id: "node-menu-scrollnodeintoview",
label: INSPECTOR_L10N.getStr("inspectorScrollNodeIntoView.label"),
accesskey:
INSPECTOR_L10N.getStr("inspectorScrollNodeIntoView.accesskey"),
disabled: !isSelectionElement,
click: () => this.markup.scrollNodeIntoView(),
}));
menu.append(new MenuItem({ menu.append(new MenuItem({
type: "separator", type: "separator",
@ -700,49 +753,6 @@ class MarkupContextMenu {
click: () => this.markup.collapseAll(this.selection.nodeFront), click: () => this.markup.collapseAll(this.selection.nodeFront),
})); }));
menu.append(new MenuItem({
type: "separator",
}));
menu.append(new MenuItem({
id: "node-menu-scrollnodeintoview",
label: INSPECTOR_L10N.getStr("inspectorScrollNodeIntoView.label"),
accesskey:
INSPECTOR_L10N.getStr("inspectorScrollNodeIntoView.accesskey"),
disabled: !isSelectionElement,
click: () => this.markup.scrollNodeIntoView(),
}));
menu.append(new MenuItem({
id: "node-menu-screenshotnode",
label: INSPECTOR_L10N.getStr("inspectorScreenshotNode.label"),
disabled: !isScreenshotable,
click: () => this.inspector.screenshotNode().catch(console.error),
}));
menu.append(new MenuItem({
id: "node-menu-useinconsole",
label: INSPECTOR_L10N.getStr("inspectorUseInConsole.label"),
click: () => this._useInConsole(),
}));
menu.append(new MenuItem({
id: "node-menu-showdomproperties",
label: INSPECTOR_L10N.getStr("inspectorShowDOMProperties.label"),
click: () => this._showDOMProperties(),
}));
if (this.selection.nodeFront.customElementLocation) {
menu.append(new MenuItem({
type: "separator",
}));
menu.append(new MenuItem({
id: "node-menu-jumptodefinition",
label: INSPECTOR_L10N.getStr("inspectorCustomElementDefinition.label"),
click: () => this._jumpToCustomElementDefinition(),
}));
}
this._buildA11YMenuItem(menu);
const nodeLinkMenuItems = this._getNodeLinkMenuItems(); const nodeLinkMenuItems = this._getNodeLinkMenuItems();
if (nodeLinkMenuItems.filter(item => item.visible).length > 0) { if (nodeLinkMenuItems.filter(item => item.visible).length > 0) {
menu.append(new MenuItem({ menu.append(new MenuItem({

Просмотреть файл

@ -290,6 +290,10 @@ inspectorAttributesSubmenu.accesskey=A
inspectorAddAttribute.label=Add Attribute inspectorAddAttribute.label=Add Attribute
inspectorAddAttribute.accesskey=A inspectorAddAttribute.accesskey=A
# LOCALIZATION NOTE (inspectorPseudoClassSubmenu.label): This is the label
# shown in the inspector contextual-menu for the sub-menu of the pseudo-classes.
inspectorPseudoClassSubmenu.label=Change Pseudo-class
# LOCALIZATION NOTE (inspectorSearchHTML.label3): This is the label that is # LOCALIZATION NOTE (inspectorSearchHTML.label3): This is the label that is
# shown as the placeholder for the markup view search in the inspector. # shown as the placeholder for the markup view search in the inspector.
inspectorSearchHTML.label3=Search HTML inspectorSearchHTML.label3=Search HTML

Просмотреть файл

@ -139,6 +139,7 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 1,
#define GC_REQUEST_OBSERVER_TOPIC "child-gc-request" #define GC_REQUEST_OBSERVER_TOPIC "child-gc-request"
#define CC_REQUEST_OBSERVER_TOPIC "child-cc-request" #define CC_REQUEST_OBSERVER_TOPIC "child-cc-request"
#define MEMORY_PRESSURE_OBSERVER_TOPIC "memory-pressure" #define MEMORY_PRESSURE_OBSERVER_TOPIC "memory-pressure"
#define MEMORY_PRESSURE_ONGOING_DATA "low-memory-ongoing"
#define BROADCAST_ALL_WORKERS(_func, ...) \ #define BROADCAST_ALL_WORKERS(_func, ...) \
PR_BEGIN_MACRO \ PR_BEGIN_MACRO \
@ -2199,9 +2200,13 @@ RuntimeService::Observe(nsISupports* aSubject, const char* aTopic,
return NS_OK; return NS_OK;
} }
if (!strcmp(aTopic, MEMORY_PRESSURE_OBSERVER_TOPIC)) { if (!strcmp(aTopic, MEMORY_PRESSURE_OBSERVER_TOPIC)) {
// Don't continue to GC/CC if we are in an ongoing low-memory state since
// its very slow and it likely won't help us anyway.
if (!nsDependentString(aData).EqualsLiteral(MEMORY_PRESSURE_ONGOING_DATA)) {
GarbageCollectAllWorkers(/* shrinking = */ true); GarbageCollectAllWorkers(/* shrinking = */ true);
CycleCollectAllWorkers(); CycleCollectAllWorkers();
MemoryPressureAllWorkers(); MemoryPressureAllWorkers();
}
return NS_OK; return NS_OK;
} }
if (!strcmp(aTopic, NS_IOSERVICE_OFFLINE_STATUS_TOPIC)) { if (!strcmp(aTopic, NS_IOSERVICE_OFFLINE_STATUS_TOPIC)) {

Просмотреть файл

@ -272,7 +272,7 @@ APZCTreeManager::APZCTreeManager(LayersId aRootLayersId)
"layers::APZCTreeManager::APZCTreeManager", "layers::APZCTreeManager::APZCTreeManager",
[self] { self->mFlushObserver = new CheckerboardFlushObserver(self); })); [self] { self->mFlushObserver = new CheckerboardFlushObserver(self); }));
AsyncPanZoomController::InitializeGlobalState(); AsyncPanZoomController::InitializeGlobalState();
mApzcTreeLog.ConditionOnPrefFunction(StaticPrefs::APZPrintTree); mApzcTreeLog.ConditionOnPrefFunction(StaticPrefs::apz_printtree);
#if defined(MOZ_WIDGET_ANDROID) #if defined(MOZ_WIDGET_ANDROID)
if (jni::IsFennec()) { if (jni::IsFennec()) {
mToolbarAnimator = new AndroidDynamicToolbarAnimator(this); mToolbarAnimator = new AndroidDynamicToolbarAnimator(this);
@ -606,7 +606,7 @@ void APZCTreeManager::UpdateFocusState(LayersId aRootLayerTreeId,
const FocusTarget& aFocusTarget) { const FocusTarget& aFocusTarget) {
AssertOnUpdaterThread(); AssertOnUpdaterThread();
if (!StaticPrefs::APZKeyboardEnabled()) { if (!StaticPrefs::apz_keyboard_enabled()) {
return; return;
} }
@ -1319,7 +1319,7 @@ nsEventStatus APZCTreeManager::ReceiveInputEvent(
} }
TargetConfirmationFlags confFlags{hitResult}; TargetConfirmationFlags confFlags{hitResult};
bool apzDragEnabled = StaticPrefs::APZDragEnabled(); bool apzDragEnabled = StaticPrefs::apz_drag_enabled();
if (apzDragEnabled && hitScrollbar) { if (apzDragEnabled && hitScrollbar) {
// If scrollbar dragging is enabled and we hit a scrollbar, wait // If scrollbar dragging is enabled and we hit a scrollbar, wait
// for the main-thread confirmation because it contains drag metrics // for the main-thread confirmation because it contains drag metrics
@ -1544,8 +1544,8 @@ nsEventStatus APZCTreeManager::ReceiveInputEvent(
case KEYBOARD_INPUT: { case KEYBOARD_INPUT: {
// Disable async keyboard scrolling when accessibility.browsewithcaret is // Disable async keyboard scrolling when accessibility.browsewithcaret is
// enabled // enabled
if (!StaticPrefs::APZKeyboardEnabled() || if (!StaticPrefs::apz_keyboard_enabled() ||
StaticPrefs::AccessibilityBrowseWithCaret()) { StaticPrefs::accessibility_browsewithcaret()) {
APZ_KEY_LOG("Skipping key input from invalid prefs\n"); APZ_KEY_LOG("Skipping key input from invalid prefs\n");
return result; return result;
} }
@ -1741,8 +1741,9 @@ nsEventStatus APZCTreeManager::ProcessTouchInput(
// checked are similar to the ones we check for MOUSE_INPUT starting // checked are similar to the ones we check for MOUSE_INPUT starting
// a scrollbar mouse-drag. // a scrollbar mouse-drag.
mInScrollbarTouchDrag = mInScrollbarTouchDrag =
StaticPrefs::APZDragEnabled() && StaticPrefs::APZTouchDragEnabled() && StaticPrefs::apz_drag_enabled() &&
hitScrollbarNode && hitScrollbarNode->IsScrollThumbNode() && StaticPrefs::apz_touch_drag_enabled() && hitScrollbarNode &&
hitScrollbarNode->IsScrollThumbNode() &&
hitScrollbarNode->GetScrollbarData().mThumbIsAsyncDraggable; hitScrollbarNode->GetScrollbarData().mThumbIsAsyncDraggable;
MOZ_ASSERT(touchBehaviors.Length() == aInput.mTouches.Length()); MOZ_ASSERT(touchBehaviors.Length() == aInput.mTouches.Length());
@ -1924,7 +1925,7 @@ void APZCTreeManager::SetupScrollbarDrag(
// Under some conditions, we can confirm the drag block right away. // Under some conditions, we can confirm the drag block right away.
// Otherwise, we have to wait for a main-thread confirmation. // Otherwise, we have to wait for a main-thread confirmation.
if (StaticPrefs::APZDragInitiationEnabled() && if (StaticPrefs::apz_drag_initial_enabled() &&
// check that the scrollbar's target scroll frame is layerized // check that the scrollbar's target scroll frame is layerized
aScrollThumbNode->GetScrollTargetId() == aApzc->GetGuid().mScrollId && aScrollThumbNode->GetScrollTargetId() == aApzc->GetGuid().mScrollId &&
!aApzc->IsScrollInfoLayer()) { !aApzc->IsScrollInfoLayer()) {
@ -2388,7 +2389,7 @@ ParentLayerPoint APZCTreeManager::DispatchFling(
AsyncPanZoomController* aPrev, const FlingHandoffState& aHandoffState) { AsyncPanZoomController* aPrev, const FlingHandoffState& aHandoffState) {
// If immediate handoff is disallowed, do not allow handoff beyond the // If immediate handoff is disallowed, do not allow handoff beyond the
// single APZC that's scrolled by the input block that triggered this fling. // single APZC that's scrolled by the input block that triggered this fling.
if (aHandoffState.mIsHandoff && !StaticPrefs::APZAllowImmediateHandoff() && if (aHandoffState.mIsHandoff && !StaticPrefs::apz_allow_immediate_handoff() &&
aHandoffState.mScrolledApzc == aPrev) { aHandoffState.mScrolledApzc == aPrev) {
FLING_LOG("APZCTM dropping handoff due to disallowed immediate handoff\n"); FLING_LOG("APZCTM dropping handoff due to disallowed immediate handoff\n");
return aHandoffState.mVelocity; return aHandoffState.mVelocity;

Просмотреть файл

@ -65,7 +65,7 @@ nsEventStatus APZInputBridge::ReceiveInputEvent(
// hit testing in a zoomed-in or zoomed-out state. // hit testing in a zoomed-in or zoomed-out state.
// FIXME: bug 1525793 -- this may need to handle zooming or not on a // FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis. // per-document basis.
if (StaticPrefs::APZAllowZooming()) { if (StaticPrefs::apz_allow_zooming()) {
mouseEvent.mIgnoreRootScrollFrame = true; mouseEvent.mIgnoreRootScrollFrame = true;
} }

Просмотреть файл

@ -55,7 +55,7 @@ AndroidSpecificState::AndroidSpecificState() {
AsyncPanZoomAnimation* AndroidSpecificState::CreateFlingAnimation( AsyncPanZoomAnimation* AndroidSpecificState::CreateFlingAnimation(
AsyncPanZoomController& aApzc, const FlingHandoffState& aHandoffState, AsyncPanZoomController& aApzc, const FlingHandoffState& aHandoffState,
float aPLPPI) { float aPLPPI) {
if (StaticPrefs::APZUseChromeFlingPhysics()) { if (StaticPrefs::apz_android_chrome_fling_physics_enabled()) {
return new GenericFlingAnimation<AndroidFlingPhysics>( return new GenericFlingAnimation<AndroidFlingPhysics>(
aApzc, aHandoffState.mChain, aHandoffState.mIsHandoff, aApzc, aHandoffState.mChain, aHandoffState.mIsHandoff,
aHandoffState.mScrolledApzc, aPLPPI); aHandoffState.mScrolledApzc, aPLPPI);
@ -68,7 +68,7 @@ AsyncPanZoomAnimation* AndroidSpecificState::CreateFlingAnimation(
UniquePtr<VelocityTracker> AndroidSpecificState::CreateVelocityTracker( UniquePtr<VelocityTracker> AndroidSpecificState::CreateVelocityTracker(
Axis* aAxis) { Axis* aAxis) {
if (StaticPrefs::APZUseChromeFlingPhysics()) { if (StaticPrefs::apz_android_chrome_fling_physics_enabled()) {
return MakeUnique<AndroidVelocityTracker>(); return MakeUnique<AndroidVelocityTracker>();
} }
return MakeUnique<SimpleVelocityTracker>(aAxis); return MakeUnique<SimpleVelocityTracker>(aAxis);
@ -76,8 +76,9 @@ UniquePtr<VelocityTracker> AndroidSpecificState::CreateVelocityTracker(
/* static */ /* static */
void AndroidSpecificState::InitializeGlobalState() { void AndroidSpecificState::InitializeGlobalState() {
// Not conditioned on StaticPrefs::APZUseChromeFlingPhysics() because // Not conditioned on
// the pref is live. // StaticPrefs::apz_android_chrome_fling_physics_enabled() because the pref
// is live.
AndroidFlingPhysics::InitializeGlobalState(); AndroidFlingPhysics::InitializeGlobalState();
} }
@ -167,8 +168,9 @@ StackScrollerFlingAnimation::StackScrollerFlingAnimation(
// flywheel to kick in, then we need to update the timestamp on the // flywheel to kick in, then we need to update the timestamp on the
// StackScroller because otherwise it might use a stale velocity. // StackScroller because otherwise it might use a stale velocity.
TimeDuration flingDuration = TimeStamp::Now() - state->mLastFling; TimeDuration flingDuration = TimeStamp::Now() - state->mLastFling;
if (flingDuration.ToMilliseconds() < StaticPrefs::APZFlingAccelInterval() && if (flingDuration.ToMilliseconds() <
velocity.Length() >= StaticPrefs::APZFlingAccelMinVelocity()) { StaticPrefs::apz_fling_accel_interval_ms() &&
velocity.Length() >= StaticPrefs::apz_fling_accel_interval_ms()) {
bool unused = false; bool unused = false;
mOverScroller->ComputeScrollOffset(flingDuration.ToMilliseconds(), mOverScroller->ComputeScrollOffset(flingDuration.ToMilliseconds(),
&unused); &unused);
@ -242,9 +244,9 @@ bool StackScrollerFlingAnimation::DoSample(FrameMetrics& aFrameMetrics,
float speed = velocity.Length(); float speed = velocity.Length();
// StaticPrefs::APZFlingStoppedThreshold is only used in tests. // StaticPrefs::apz_fling_stopped_threshold is only used in tests.
if (!shouldContinueFling || if (!shouldContinueFling ||
(speed < StaticPrefs::APZFlingStoppedThreshold())) { (speed < StaticPrefs::apz_fling_stopped_threshold())) {
if (shouldContinueFling) { if (shouldContinueFling) {
// The OverScroller thinks it should continue but the speed is below // The OverScroller thinks it should continue but the speed is below
// the stopping threshold so abort the animation. // the stopping threshold so abort the animation.

Просмотреть файл

@ -33,7 +33,7 @@ const float kDecelerationRate = 2.3582018f;
// Default friction constant in android.view.ViewConfiguration. // Default friction constant in android.view.ViewConfiguration.
static float GetFlingFriction() { static float GetFlingFriction() {
return StaticPrefs::APZChromeFlingPhysicsFriction(); return StaticPrefs::apz_android_chrome_fling_physics_friction();
} }
// Tension lines cross at (GetInflexion(), 1). // Tension lines cross at (GetInflexion(), 1).
@ -41,7 +41,8 @@ static float GetInflexion() {
// Clamp the inflexion to the range [0,1]. Values outside of this range // Clamp the inflexion to the range [0,1]. Values outside of this range
// do not make sense in the physics model, and for negative values the // do not make sense in the physics model, and for negative values the
// approximation used to compute the spline curve does not converge. // approximation used to compute the spline curve does not converge.
const float inflexion = StaticPrefs::APZChromeFlingPhysicsInflexion(); const float inflexion =
StaticPrefs::apz_android_chrome_fling_physics_inflexion();
if (inflexion < 0.0f) { if (inflexion < 0.0f) {
return 0.0f; return 0.0f;
} }
@ -54,7 +55,7 @@ static float GetInflexion() {
// Fling scroll is stopped when the scroll position is |kThresholdForFlingEnd| // Fling scroll is stopped when the scroll position is |kThresholdForFlingEnd|
// pixels or closer from the end. // pixels or closer from the end.
static float GetThresholdForFlingEnd() { static float GetThresholdForFlingEnd() {
return StaticPrefs::APZChromeFlingPhysicsStopThreshold(); return StaticPrefs::apz_android_chrome_fling_physics_stop_threshold();
} }
static double ComputeSplineDeceleration(ParentLayerCoord aVelocity, static double ComputeSplineDeceleration(ParentLayerCoord aVelocity,

Просмотреть файл

@ -251,7 +251,7 @@ Maybe<float> AndroidVelocityTracker::ComputeVelocity(uint32_t aTimestampMs) {
float time[kHistorySize]; float time[kHistorySize];
uint32_t m = 0; uint32_t m = 0;
int index = mHistory.Length() - 1; int index = mHistory.Length() - 1;
const uint32_t horizon = StaticPrefs::APZVelocityRelevanceTime(); const uint32_t horizon = StaticPrefs::apz_velocity_relevance_time_ms();
const auto& newest_movement = mHistory[index]; const auto& newest_movement = mHistory[index];
do { do {

Просмотреть файл

@ -615,7 +615,7 @@ class ZoomAnimation : public AsyncPanZoomAnimation {
const CSSToParentLayerScale2D& aEndZoom) const CSSToParentLayerScale2D& aEndZoom)
: mApzc(aApzc), : mApzc(aApzc),
mTotalDuration(TimeDuration::FromMilliseconds( mTotalDuration(TimeDuration::FromMilliseconds(
StaticPrefs::APZZoomAnimationDuration())), StaticPrefs::apz_zoom_animation_duration_ms())),
mStartOffset(aStartOffset), mStartOffset(aStartOffset),
mStartZoom(aStartZoom), mStartZoom(aStartZoom),
mEndOffset(aEndOffset), mEndOffset(aEndOffset),
@ -815,9 +815,11 @@ void AsyncPanZoomController::InitializeGlobalState() {
gZoomAnimationFunction = gZoomAnimationFunction =
new ComputedTimingFunction(nsTimingFunction(StyleTimingKeyword::Ease)); new ComputedTimingFunction(nsTimingFunction(StyleTimingKeyword::Ease));
ClearOnShutdown(&gZoomAnimationFunction); ClearOnShutdown(&gZoomAnimationFunction);
gVelocityCurveFunction = new ComputedTimingFunction(nsTimingFunction( gVelocityCurveFunction = new ComputedTimingFunction(
StaticPrefs::APZCurveFunctionX1(), StaticPrefs::APZCurveFunctionY1(), nsTimingFunction(StaticPrefs::apz_fling_curve_function_x1(),
StaticPrefs::APZCurveFunctionX2(), StaticPrefs::APZCurveFunctionY2())); StaticPrefs::apz_fling_curve_function_y1(),
StaticPrefs::apz_fling_curve_function_x2(),
StaticPrefs::apz_fling_curve_function_y2()));
ClearOnShutdown(&gVelocityCurveFunction); ClearOnShutdown(&gVelocityCurveFunction);
uint64_t sysmem = PR_GetPhysicalMemorySize(); uint64_t sysmem = PR_GetPhysicalMemorySize();
@ -845,7 +847,7 @@ AsyncPanZoomController::AsyncPanZoomController(
mPanDirRestricted(false), mPanDirRestricted(false),
mPinchLocked(false), mPinchLocked(false),
mPinchEventBuffer(TimeDuration::FromMilliseconds( mPinchEventBuffer(TimeDuration::FromMilliseconds(
StaticPrefs::APZPinchLockBufferMaxAge())), StaticPrefs::apz_pinch_lock_buffer_max_age())),
mZoomConstraints(false, false, mZoomConstraints(false, false,
mScrollMetadata.GetMetrics().GetDevPixelsPerCSSPixel() * mScrollMetadata.GetMetrics().GetDevPixelsPerCSSPixel() *
kViewportMinScale / ParentLayerToScreenScale(1), kViewportMinScale / ParentLayerToScreenScale(1),
@ -938,25 +940,25 @@ float AsyncPanZoomController::GetDPI() const {
} }
ScreenCoord AsyncPanZoomController::GetTouchStartTolerance() const { ScreenCoord AsyncPanZoomController::GetTouchStartTolerance() const {
return (StaticPrefs::APZTouchStartTolerance() * GetDPI()); return (StaticPrefs::apz_touch_start_tolerance() * GetDPI());
} }
ScreenCoord AsyncPanZoomController::GetTouchMoveTolerance() const { ScreenCoord AsyncPanZoomController::GetTouchMoveTolerance() const {
return (StaticPrefs::APZTouchMoveTolerance() * GetDPI()); return (StaticPrefs::apz_touch_move_tolerance() * GetDPI());
} }
ScreenCoord AsyncPanZoomController::GetSecondTapTolerance() const { ScreenCoord AsyncPanZoomController::GetSecondTapTolerance() const {
return (StaticPrefs::APZSecondTapTolerance() * GetDPI()); return (StaticPrefs::apz_second_tap_tolerance() * GetDPI());
} }
/* static */ AsyncPanZoomController::AxisLockMode /* static */ AsyncPanZoomController::AxisLockMode
AsyncPanZoomController::GetAxisLockMode() { AsyncPanZoomController::GetAxisLockMode() {
return static_cast<AxisLockMode>(StaticPrefs::APZAxisLockMode()); return static_cast<AxisLockMode>(StaticPrefs::apz_axis_lock_mode());
} }
/* static */ AsyncPanZoomController::PinchLockMode /* static */ AsyncPanZoomController::PinchLockMode
AsyncPanZoomController::GetPinchLockMode() { AsyncPanZoomController::GetPinchLockMode() {
return static_cast<PinchLockMode>(StaticPrefs::APZPinchLockMode()); return static_cast<PinchLockMode>(StaticPrefs::apz_pinch_lock_mode());
} }
bool AsyncPanZoomController::ArePointerEventsConsumable( bool AsyncPanZoomController::ArePointerEventsConsumable(
@ -1012,7 +1014,7 @@ bool AsyncPanZoomController::ArePointerEventsConsumable(
nsEventStatus AsyncPanZoomController::HandleDragEvent( nsEventStatus AsyncPanZoomController::HandleDragEvent(
const MouseInput& aEvent, const AsyncDragMetrics& aDragMetrics, const MouseInput& aEvent, const AsyncDragMetrics& aDragMetrics,
CSSCoord aInitialThumbPos) { CSSCoord aInitialThumbPos) {
if (!StaticPrefs::APZDragEnabled()) { if (!StaticPrefs::apz_drag_enabled()) {
return nsEventStatus_eIgnore; return nsEventStatus_eIgnore;
} }
@ -1566,7 +1568,7 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(
// content controller, it may want to do something else with this gesture. // content controller, it may want to do something else with this gesture.
// FIXME: bug 1525793 -- this may need to handle zooming or not on a // FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis. // per-document basis.
if (!StaticPrefs::APZAllowZooming()) { if (!StaticPrefs::apz_allow_zooming()) {
if (RefPtr<GeckoContentController> controller = if (RefPtr<GeckoContentController> controller =
GetGeckoContentController()) { GetGeckoContentController()) {
controller->NotifyPinchGesture(aEvent.mType, GetGuid(), 0, controller->NotifyPinchGesture(aEvent.mType, GetGuid(), 0,
@ -1613,7 +1615,7 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
// FIXME: bug 1525793 -- this may need to handle zooming or not on a // FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis. // per-document basis.
if (!StaticPrefs::APZAllowZooming()) { if (!StaticPrefs::apz_allow_zooming()) {
if (RefPtr<GeckoContentController> controller = if (RefPtr<GeckoContentController> controller =
GetGeckoContentController()) { GetGeckoContentController()) {
controller->NotifyPinchGesture( controller->NotifyPinchGesture(
@ -1703,7 +1705,7 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
// We don't want to redraw on every scale, so throttle it. // We don't want to redraw on every scale, so throttle it.
if (!mPinchPaintTimerSet) { if (!mPinchPaintTimerSet) {
const int delay = StaticPrefs::APZScaleRepaintDelay(); const int delay = StaticPrefs::apz_scale_repaint_delay_ms();
if (delay >= 0) { if (delay >= 0) {
if (RefPtr<GeckoContentController> controller = if (RefPtr<GeckoContentController> controller =
GetGeckoContentController()) { GetGeckoContentController()) {
@ -1747,7 +1749,7 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(
// FIXME: bug 1525793 -- this may need to handle zooming or not on a // FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis. // per-document basis.
if (!StaticPrefs::APZAllowZooming()) { if (!StaticPrefs::apz_allow_zooming()) {
if (RefPtr<GeckoContentController> controller = if (RefPtr<GeckoContentController> controller =
GetGeckoContentController()) { GetGeckoContentController()) {
controller->NotifyPinchGesture(aEvent.mType, GetGuid(), 0, controller->NotifyPinchGesture(aEvent.mType, GetGuid(), 0,
@ -1840,9 +1842,10 @@ nsEventStatus AsyncPanZoomController::HandleEndOfPan() {
APZC_LOG("%p starting a fling animation if %f >= %f\n", this, APZC_LOG("%p starting a fling animation if %f >= %f\n", this,
flingVelocity.Length().value, flingVelocity.Length().value,
StaticPrefs::APZFlingMinVelocityThreshold()); StaticPrefs::apz_fling_min_velocity_threshold());
if (flingVelocity.Length() < StaticPrefs::APZFlingMinVelocityThreshold()) { if (flingVelocity.Length() <
StaticPrefs::apz_fling_min_velocity_threshold()) {
// Relieve overscroll now if needed, since we will not transition to a fling // Relieve overscroll now if needed, since we will not transition to a fling
// animation and then an overscroll animation, and relieve it then. // animation and then an overscroll animation, and relieve it then.
GetCurrentInputBlock() GetCurrentInputBlock()
@ -2254,7 +2257,7 @@ bool AsyncPanZoomController::IsContentOfHonouredTargetRightToLeft(
bool AsyncPanZoomController::AllowScrollHandoffInCurrentBlock() const { bool AsyncPanZoomController::AllowScrollHandoffInCurrentBlock() const {
bool result = mInputQueue->AllowScrollHandoff(); bool result = mInputQueue->AllowScrollHandoff();
if (!StaticPrefs::APZAllowImmediateHandoff()) { if (!StaticPrefs::apz_allow_immediate_handoff()) {
if (InputBlockState* currentBlock = GetCurrentInputBlock()) { if (InputBlockState* currentBlock = GetCurrentInputBlock()) {
// Do not allow handoff beyond the first APZC to scroll. // Do not allow handoff beyond the first APZC to scroll.
if (currentBlock->GetScrolledApzc() == this) { if (currentBlock->GetScrolledApzc() == this) {
@ -2930,11 +2933,12 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
this, ScrollDirection::eVertical); this, ScrollDirection::eVertical);
if (GetCurrentTouchBlock()->TouchActionAllowsPanningXY()) { if (GetCurrentTouchBlock()->TouchActionAllowsPanningXY()) {
if (canScrollHorizontal && canScrollVertical) { if (canScrollHorizontal && canScrollVertical) {
if (apz::IsCloseToHorizontal(aAngle, StaticPrefs::APZAxisLockAngle())) { if (apz::IsCloseToHorizontal(aAngle,
StaticPrefs::apz_axis_lock_lock_angle())) {
mY.SetAxisLocked(true); mY.SetAxisLocked(true);
SetState(PANNING_LOCKED_X); SetState(PANNING_LOCKED_X);
} else if (apz::IsCloseToVertical(aAngle, } else if (apz::IsCloseToVertical(
StaticPrefs::APZAxisLockAngle())) { aAngle, StaticPrefs::apz_axis_lock_lock_angle())) {
mX.SetAxisLocked(true); mX.SetAxisLocked(true);
SetState(PANNING_LOCKED_Y); SetState(PANNING_LOCKED_Y);
} else { } else {
@ -2948,8 +2952,8 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
} else if (GetCurrentTouchBlock()->TouchActionAllowsPanningX()) { } else if (GetCurrentTouchBlock()->TouchActionAllowsPanningX()) {
// Using bigger angle for panning to keep behavior consistent // Using bigger angle for panning to keep behavior consistent
// with IE. // with IE.
if (apz::IsCloseToHorizontal(aAngle, if (apz::IsCloseToHorizontal(
StaticPrefs::APZAllowedDirectPanAngle())) { aAngle, StaticPrefs::apz_axis_lock_direct_pan_angle())) {
mY.SetAxisLocked(true); mY.SetAxisLocked(true);
SetState(PANNING_LOCKED_X); SetState(PANNING_LOCKED_X);
mPanDirRestricted = true; mPanDirRestricted = true;
@ -2960,7 +2964,7 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
} }
} else if (GetCurrentTouchBlock()->TouchActionAllowsPanningY()) { } else if (GetCurrentTouchBlock()->TouchActionAllowsPanningY()) {
if (apz::IsCloseToVertical(aAngle, if (apz::IsCloseToVertical(aAngle,
StaticPrefs::APZAllowedDirectPanAngle())) { StaticPrefs::apz_axis_lock_direct_pan_angle())) {
mX.SetAxisLocked(true); mX.SetAxisLocked(true);
SetState(PANNING_LOCKED_Y); SetState(PANNING_LOCKED_Y);
mPanDirRestricted = true; mPanDirRestricted = true;
@ -2993,13 +2997,14 @@ void AsyncPanZoomController::HandlePanning(double aAngle) {
if (!canScrollHorizontal || !canScrollVertical) { if (!canScrollHorizontal || !canScrollVertical) {
SetState(PANNING); SetState(PANNING);
} else if (apz::IsCloseToHorizontal(aAngle, } else if (apz::IsCloseToHorizontal(
StaticPrefs::APZAxisLockAngle())) { aAngle, StaticPrefs::apz_axis_lock_lock_angle())) {
mY.SetAxisLocked(true); mY.SetAxisLocked(true);
if (canScrollHorizontal) { if (canScrollHorizontal) {
SetState(PANNING_LOCKED_X); SetState(PANNING_LOCKED_X);
} }
} else if (apz::IsCloseToVertical(aAngle, StaticPrefs::APZAxisLockAngle())) { } else if (apz::IsCloseToVertical(aAngle,
StaticPrefs::apz_axis_lock_lock_angle())) {
mX.SetAxisLocked(true); mX.SetAxisLocked(true);
if (canScrollVertical) { if (canScrollVertical) {
SetState(PANNING_LOCKED_Y); SetState(PANNING_LOCKED_Y);
@ -3019,19 +3024,20 @@ void AsyncPanZoomController::HandlePanningUpdate(
double angle = atan2(vector.y, vector.x); // range [-pi, pi] double angle = atan2(vector.y, vector.x); // range [-pi, pi]
angle = fabs(angle); // range [0, pi] angle = fabs(angle); // range [0, pi]
float breakThreshold = StaticPrefs::APZAxisBreakoutThreshold() * GetDPI(); float breakThreshold =
StaticPrefs::apz_axis_lock_breakout_threshold() * GetDPI();
if (fabs(aPanDistance.x) > breakThreshold || if (fabs(aPanDistance.x) > breakThreshold ||
fabs(aPanDistance.y) > breakThreshold) { fabs(aPanDistance.y) > breakThreshold) {
if (mState == PANNING_LOCKED_X) { if (mState == PANNING_LOCKED_X) {
if (!apz::IsCloseToHorizontal(angle, if (!apz::IsCloseToHorizontal(
StaticPrefs::APZAxisBreakoutAngle())) { angle, StaticPrefs::apz_axis_lock_breakout_angle())) {
mY.SetAxisLocked(false); mY.SetAxisLocked(false);
SetState(PANNING); SetState(PANNING);
} }
} else if (mState == PANNING_LOCKED_Y) { } else if (mState == PANNING_LOCKED_Y) {
if (!apz::IsCloseToVertical(angle, if (!apz::IsCloseToVertical(
StaticPrefs::APZAxisBreakoutAngle())) { angle, StaticPrefs::apz_axis_lock_breakout_angle())) {
mX.SetAxisLocked(false); mX.SetAxisLocked(false);
SetState(PANNING); SetState(PANNING);
} }
@ -3075,15 +3081,15 @@ void AsyncPanZoomController::HandlePinchLocking() {
if (mPinchLocked) { if (mPinchLocked) {
if (GetPinchLockMode() == PINCH_STICKY) { if (GetPinchLockMode() == PINCH_STICKY) {
ScreenCoord spanBreakoutThreshold = ScreenCoord spanBreakoutThreshold =
StaticPrefs::APZPinchLockSpanBreakoutThreshold() * GetDPI(); StaticPrefs::apz_pinch_lock_span_breakout_threshold() * GetDPI();
mPinchLocked = !(spanDistance > spanBreakoutThreshold); mPinchLocked = !(spanDistance > spanBreakoutThreshold);
} }
} else { } else {
if (GetPinchLockMode() != PINCH_FREE) { if (GetPinchLockMode() != PINCH_FREE) {
ScreenCoord spanLockThreshold = ScreenCoord spanLockThreshold =
StaticPrefs::APZPinchLockSpanLockThreshold() * GetDPI(); StaticPrefs::apz_pinch_lock_span_lock_threshold() * GetDPI();
ScreenCoord scrollLockThreshold = ScreenCoord scrollLockThreshold =
StaticPrefs::APZPinchLockScrollLockThreshold() * GetDPI(); StaticPrefs::apz_pinch_lock_scroll_lock_threshold() * GetDPI();
if (spanDistance < spanLockThreshold && if (spanDistance < spanLockThreshold &&
focusChange.Length() > scrollLockThreshold) { focusChange.Length() > scrollLockThreshold) {
@ -3257,11 +3263,11 @@ void AsyncPanZoomController::OverscrollForPanning(
// configurable factor. If we are already overscrolled, don't check this. // configurable factor. If we are already overscrolled, don't check this.
if (!IsOverscrolled()) { if (!IsOverscrolled()) {
if (aPanDistance.x < if (aPanDistance.x <
StaticPrefs::APZMinPanDistanceRatio() * aPanDistance.y) { StaticPrefs::apz_overscroll_min_pan_distance_ratio() * aPanDistance.y) {
aOverscroll.x = 0; aOverscroll.x = 0;
} }
if (aPanDistance.y < if (aPanDistance.y <
StaticPrefs::APZMinPanDistanceRatio() * aPanDistance.x) { StaticPrefs::apz_overscroll_min_pan_distance_ratio() * aPanDistance.x) {
aOverscroll.y = 0; aOverscroll.y = 0;
} }
} }
@ -3270,7 +3276,7 @@ void AsyncPanZoomController::OverscrollForPanning(
} }
void AsyncPanZoomController::OverscrollBy(ParentLayerPoint& aOverscroll) { void AsyncPanZoomController::OverscrollBy(ParentLayerPoint& aOverscroll) {
if (!StaticPrefs::APZOverscrollEnabled()) { if (!StaticPrefs::apz_overscroll_enabled()) {
return; return;
} }
@ -3337,7 +3343,7 @@ ParentLayerPoint AsyncPanZoomController::AttemptFling(
// that generate events faster than the clock resolution. // that generate events faster than the clock resolution.
ParentLayerPoint velocity = GetVelocityVector(); ParentLayerPoint velocity = GetVelocityVector();
if (!velocity.IsFinite() || if (!velocity.IsFinite() ||
velocity.Length() < StaticPrefs::APZFlingMinVelocityThreshold()) { velocity.Length() < StaticPrefs::apz_fling_min_velocity_threshold()) {
// Relieve overscroll now if needed, since we will not transition to a fling // Relieve overscroll now if needed, since we will not transition to a fling
// animation and then an overscroll animation, and relieve it then. // animation and then an overscroll animation, and relieve it then.
aHandoffState.mChain->SnapBackOverscrolledApzc(this); aHandoffState.mChain->SnapBackOverscrolledApzc(this);
@ -3408,7 +3414,7 @@ void AsyncPanZoomController::HandleFlingOverscroll(
FLING_LOG("APZC %p left with residual velocity %s\n", this, FLING_LOG("APZC %p left with residual velocity %s\n", this,
Stringify(residualVelocity).c_str()); Stringify(residualVelocity).c_str());
if (!IsZero(residualVelocity) && IsPannable() && if (!IsZero(residualVelocity) && IsPannable() &&
StaticPrefs::APZOverscrollEnabled()) { StaticPrefs::apz_overscroll_enabled()) {
// Obey overscroll-behavior. // Obey overscroll-behavior.
RecursiveMutexAutoLock lock(mRecursiveMutex); RecursiveMutexAutoLock lock(mRecursiveMutex);
if (!mX.OverscrollBehaviorAllowsOverscrollEffect()) { if (!mX.OverscrollBehaviorAllowsOverscrollEffect()) {
@ -3666,22 +3672,22 @@ void AsyncPanZoomController::ScaleWithFocus(float aScale,
static CSSSize CalculateDisplayPortSize(const CSSSize& aCompositionSize, static CSSSize CalculateDisplayPortSize(const CSSSize& aCompositionSize,
const CSSPoint& aVelocity) { const CSSPoint& aVelocity) {
bool xIsStationarySpeed = bool xIsStationarySpeed =
fabsf(aVelocity.x) < StaticPrefs::APZMinSkateSpeed(); fabsf(aVelocity.x) < StaticPrefs::apz_min_skate_speed();
bool yIsStationarySpeed = bool yIsStationarySpeed =
fabsf(aVelocity.y) < StaticPrefs::APZMinSkateSpeed(); fabsf(aVelocity.y) < StaticPrefs::apz_min_skate_speed();
float xMultiplier = xIsStationarySpeed float xMultiplier = xIsStationarySpeed
? StaticPrefs::APZXStationarySizeMultiplier() ? StaticPrefs::apz_x_stationary_size_multiplier()
: StaticPrefs::APZXSkateSizeMultiplier(); : StaticPrefs::apz_x_skate_size_multiplier();
float yMultiplier = yIsStationarySpeed float yMultiplier = yIsStationarySpeed
? StaticPrefs::APZYStationarySizeMultiplier() ? StaticPrefs::apz_y_stationary_size_multiplier()
: StaticPrefs::APZYSkateSizeMultiplier(); : StaticPrefs::apz_y_skate_size_multiplier();
if (IsHighMemSystem() && !xIsStationarySpeed) { if (IsHighMemSystem() && !xIsStationarySpeed) {
xMultiplier += StaticPrefs::APZXSkateHighMemAdjust(); xMultiplier += StaticPrefs::apz_x_skate_highmem_adjust();
} }
if (IsHighMemSystem() && !yIsStationarySpeed) { if (IsHighMemSystem() && !yIsStationarySpeed) {
yMultiplier += StaticPrefs::APZYSkateHighMemAdjust(); yMultiplier += StaticPrefs::apz_y_skate_highmem_adjust();
} }
return aCompositionSize * CSSSize(xMultiplier, yMultiplier); return aCompositionSize * CSSSize(xMultiplier, yMultiplier);
@ -3698,8 +3704,8 @@ static CSSSize ExpandDisplayPortToDangerZone(
CSSSize dangerZone(0.0f, 0.0f); CSSSize dangerZone(0.0f, 0.0f);
if (aFrameMetrics.LayersPixelsPerCSSPixel().xScale != 0 && if (aFrameMetrics.LayersPixelsPerCSSPixel().xScale != 0 &&
aFrameMetrics.LayersPixelsPerCSSPixel().yScale != 0) { aFrameMetrics.LayersPixelsPerCSSPixel().yScale != 0) {
dangerZone = LayerSize(StaticPrefs::APZDangerZoneX(), dangerZone = LayerSize(StaticPrefs::apz_danger_zone_x(),
StaticPrefs::APZDangerZoneY()) / StaticPrefs::apz_danger_zone_y()) /
aFrameMetrics.LayersPixelsPerCSSPixel(); aFrameMetrics.LayersPixelsPerCSSPixel();
} }
const CSSSize compositionSize = const CSSSize compositionSize =
@ -3759,7 +3765,7 @@ const ScreenMargin AsyncPanZoomController::CalculatePendingDisplayPort(
displayPortSize = displayPortSize =
ExpandDisplayPortToDangerZone(displayPortSize, aFrameMetrics); ExpandDisplayPortToDangerZone(displayPortSize, aFrameMetrics);
if (StaticPrefs::APZEnlargeDisplayPortWhenClipped()) { if (StaticPrefs::apz_enlarge_displayport_when_clipped()) {
RedistributeDisplayPortExcess(displayPortSize, scrollableRect); RedistributeDisplayPortExcess(displayPortSize, scrollableRect);
} }
@ -3778,7 +3784,7 @@ const ScreenMargin AsyncPanZoomController::CalculatePendingDisplayPort(
// Offset the displayport, depending on how fast we're moving and the // Offset the displayport, depending on how fast we're moving and the
// estimated time it takes to paint, to try to minimise checkerboarding. // estimated time it takes to paint, to try to minimise checkerboarding.
float paintFactor = kDefaultEstimatedPaintDurationMs; float paintFactor = kDefaultEstimatedPaintDurationMs;
displayPort.MoveBy(velocity * paintFactor * StaticPrefs::APZVelocityBias()); displayPort.MoveBy(velocity * paintFactor * StaticPrefs::apz_velocity_bias());
APZC_LOG_FM( APZC_LOG_FM(
aFrameMetrics, aFrameMetrics,
@ -3843,7 +3849,7 @@ bool AsyncPanZoomController::SnapBackIfOverscrolled() {
bool AsyncPanZoomController::IsFlingingFast() const { bool AsyncPanZoomController::IsFlingingFast() const {
RecursiveMutexAutoLock lock(mRecursiveMutex); RecursiveMutexAutoLock lock(mRecursiveMutex);
if (mState == FLING && GetVelocityVector().Length() > if (mState == FLING && GetVelocityVector().Length() >
StaticPrefs::APZFlingStopOnTapThreshold()) { StaticPrefs::apz_fling_stop_on_tap_threshold()) {
APZC_LOG("%p is moving fast\n", this); APZC_LOG("%p is moving fast\n", this);
return true; return true;
} }
@ -4206,7 +4212,7 @@ AsyncPanZoomController::GetCurrentAsyncTransformForFixedAdjustment(
// with apz.allow_zooming enabled). // with apz.allow_zooming enabled).
// FIXME: bug 1525793 -- this may need to handle zooming or not on a // FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis. // per-document basis.
return (StaticPrefs::APZAllowZooming() && Metrics().IsRootContent() && return (StaticPrefs::apz_allow_zooming() && Metrics().IsRootContent() &&
Metrics().GetVisualViewport().Size() <= Metrics().GetVisualViewport().Size() <=
Metrics().GetLayoutViewport().Size()) Metrics().GetLayoutViewport().Size())
? GetCurrentAsyncViewportTransform(aMode) ? GetCurrentAsyncViewportTransform(aMode)
@ -4234,7 +4240,7 @@ LayoutDeviceToParentLayerScale AsyncPanZoomController::GetCurrentPinchZoomScale(
CSSRect AsyncPanZoomController::GetEffectiveLayoutViewport( CSSRect AsyncPanZoomController::GetEffectiveLayoutViewport(
AsyncTransformConsumer aMode) const { AsyncTransformConsumer aMode) const {
if (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) { if (StaticPrefs::apz_frame_delay_enabled() && aMode == eForCompositing) {
return mCompositedLayoutViewport; return mCompositedLayoutViewport;
} }
return Metrics().GetLayoutViewport(); return Metrics().GetLayoutViewport();
@ -4242,7 +4248,7 @@ CSSRect AsyncPanZoomController::GetEffectiveLayoutViewport(
CSSPoint AsyncPanZoomController::GetEffectiveScrollOffset( CSSPoint AsyncPanZoomController::GetEffectiveScrollOffset(
AsyncTransformConsumer aMode) const { AsyncTransformConsumer aMode) const {
if (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) { if (StaticPrefs::apz_frame_delay_enabled() && aMode == eForCompositing) {
return mCompositedScrollOffset; return mCompositedScrollOffset;
} }
return Metrics().GetScrollOffset(); return Metrics().GetScrollOffset();
@ -4250,7 +4256,7 @@ CSSPoint AsyncPanZoomController::GetEffectiveScrollOffset(
CSSToParentLayerScale2D AsyncPanZoomController::GetEffectiveZoom( CSSToParentLayerScale2D AsyncPanZoomController::GetEffectiveZoom(
AsyncTransformConsumer aMode) const { AsyncTransformConsumer aMode) const {
if (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) { if (StaticPrefs::apz_frame_delay_enabled() && aMode == eForCompositing) {
return mCompositedZoom; return mCompositedZoom;
} }
return Metrics().GetZoom(); return Metrics().GetZoom();
@ -4346,7 +4352,7 @@ void AsyncPanZoomController::ReportCheckerboard(const TimeStamp& aSampleTime) {
} }
mLastCheckerboardReport = aSampleTime; mLastCheckerboardReport = aSampleTime;
bool recordTrace = StaticPrefs::APZRecordCheckerboarding(); bool recordTrace = StaticPrefs::apz_record_checkerboarding();
bool forTelemetry = Telemetry::CanRecordExtended(); bool forTelemetry = Telemetry::CanRecordExtended();
uint32_t magnitude = GetCheckerboardMagnitude(); uint32_t magnitude = GetCheckerboardMagnitude();
@ -4375,7 +4381,7 @@ void AsyncPanZoomController::UpdateCheckerboardEvent(
mPotentialCheckerboardTracker.CheckerboardDone(); mPotentialCheckerboardTracker.CheckerboardDone();
if (StaticPrefs::APZRecordCheckerboarding()) { if (StaticPrefs::apz_record_checkerboarding()) {
// if the pref is enabled, also send it to the storage class. it may be // if the pref is enabled, also send it to the storage class. it may be
// chosen for public display on about:checkerboard, the hall of fame for // chosen for public display on about:checkerboard, the hall of fame for
// checkerboard events. // checkerboard events.
@ -4685,7 +4691,8 @@ void AsyncPanZoomController::NotifyLayersUpdated(
// this we need to update mExpectedGeckoMetrics to be the last thing we // this we need to update mExpectedGeckoMetrics to be the last thing we
// know was painted by Gecko. // know was painted by Gecko.
Maybe<CSSPoint> relativeDelta; Maybe<CSSPoint> relativeDelta;
if (StaticPrefs::APZRelativeUpdate() && aLayerMetrics.IsRelative()) { if (StaticPrefs::apz_relative_update_enabled() &&
aLayerMetrics.IsRelative()) {
APZC_LOG("%p relative updating scroll offset from %s by %s\n", this, APZC_LOG("%p relative updating scroll offset from %s by %s\n", this,
ToString(Metrics().GetScrollOffset()).c_str(), ToString(Metrics().GetScrollOffset()).c_str(),
ToString(aLayerMetrics.GetScrollOffset() - ToString(aLayerMetrics.GetScrollOffset() -
@ -4760,7 +4767,8 @@ void AsyncPanZoomController::NotifyLayersUpdated(
// See comment on the similar code in the |if (scrollOffsetUpdated)| block // See comment on the similar code in the |if (scrollOffsetUpdated)| block
// above. // above.
if (StaticPrefs::APZRelativeUpdate() && aLayerMetrics.IsRelative()) { if (StaticPrefs::apz_relative_update_enabled() &&
aLayerMetrics.IsRelative()) {
Metrics().ApplyRelativeSmoothScrollUpdateFrom(aLayerMetrics); Metrics().ApplyRelativeSmoothScrollUpdateFrom(aLayerMetrics);
} else { } else {
Metrics().ApplySmoothScrollUpdateFrom(aLayerMetrics); Metrics().ApplySmoothScrollUpdateFrom(aLayerMetrics);
@ -5297,7 +5305,7 @@ void AsyncPanZoomController::ScrollSnap() {
void AsyncPanZoomController::ScrollSnapToDestination() { void AsyncPanZoomController::ScrollSnapToDestination() {
RecursiveMutexAutoLock lock(mRecursiveMutex); RecursiveMutexAutoLock lock(mRecursiveMutex);
float friction = StaticPrefs::APZFlingFriction(); float friction = StaticPrefs::apz_fling_friction();
ParentLayerPoint velocity(mX.GetVelocity(), mY.GetVelocity()); ParentLayerPoint velocity(mX.GetVelocity(), mY.GetVelocity());
ParentLayerPoint predictedDelta; ParentLayerPoint predictedDelta;
// "-velocity / log(1.0 - friction)" is the integral of the deceleration // "-velocity / log(1.0 - friction)" is the integral of the deceleration

Просмотреть файл

@ -1162,9 +1162,9 @@ class AsyncPanZoomController {
* Returns true if the newly sampled value is different from the previously * Returns true if the newly sampled value is different from the previously
* sampled value. * sampled value.
* *
* (This is only relevant when |StaticPrefs::APZFrameDelayEnabled() == true|. * (This is only relevant when StaticPrefs::apz_frame_delay_enabled() is
* Otherwise, GetCurrentAsyncTransform() always reflects what's stored in * true. Otherwise, GetCurrentAsyncTransform() always reflects what's stored
* |Metrics()| immediately, without any delay.) * in |Metrics()| immediately, without any delay.)
*/ */
bool SampleCompositedAsyncTransform(); bool SampleCompositedAsyncTransform();

Просмотреть файл

@ -25,8 +25,8 @@ class DesktopFlingPhysics {
} }
void Sample(const TimeDuration& aDelta, ParentLayerPoint* aOutVelocity, void Sample(const TimeDuration& aDelta, ParentLayerPoint* aOutVelocity,
ParentLayerPoint* aOutOffset) { ParentLayerPoint* aOutOffset) {
float friction = StaticPrefs::APZFlingFriction(); float friction = StaticPrefs::apz_fling_friction();
float threshold = StaticPrefs::APZFlingStoppedThreshold(); float threshold = StaticPrefs::apz_fling_stopped_threshold();
mVelocity = ParentLayerPoint( mVelocity = ParentLayerPoint(
ApplyFrictionOrCancel(mVelocity.x, aDelta, friction, threshold), ApplyFrictionOrCancel(mVelocity.x, aDelta, friction, threshold),

Просмотреть файл

@ -138,7 +138,7 @@ FocusTarget::FocusTarget(PresShell* aRootPresShell,
// Check if there are key event listeners that could prevent default or change // Check if there are key event listeners that could prevent default or change
// the focus or selection of the page. // the focus or selection of the page.
if (StaticPrefs::APZKeyboardPassiveListeners()) { if (StaticPrefs::apz_keyboard_passive_listeners()) {
mFocusHasKeyEventListeners = mFocusHasKeyEventListeners =
HasListenersForNonPassiveKeyEvents(keyEventTarget.get()); HasListenersForNonPassiveKeyEvents(keyEventTarget.get());
} else { } else {

Просмотреть файл

@ -94,8 +94,8 @@ class GenericFlingAnimation : public AsyncPanZoomAnimation,
bool applyAcceleration = !aFlingIsHandedOff; bool applyAcceleration = !aFlingIsHandedOff;
if (applyAcceleration && !mApzc.mLastFlingTime.IsNull() && if (applyAcceleration && !mApzc.mLastFlingTime.IsNull() &&
(now - mApzc.mLastFlingTime).ToMilliseconds() < (now - mApzc.mLastFlingTime).ToMilliseconds() <
StaticPrefs::APZFlingAccelInterval() && StaticPrefs::apz_fling_accel_interval_ms() &&
velocity.Length() >= StaticPrefs::APZFlingAccelMinVelocity()) { velocity.Length() >= StaticPrefs::apz_fling_accel_min_velocity()) {
if (velocity.x != 0 && if (velocity.x != 0 &&
SameDirection(velocity.x, mApzc.mLastFlingVelocity.x)) { SameDirection(velocity.x, mApzc.mLastFlingVelocity.x)) {
velocity.x = Accelerate(velocity.x, mApzc.mLastFlingVelocity.x); velocity.x = Accelerate(velocity.x, mApzc.mLastFlingVelocity.x);
@ -220,8 +220,8 @@ class GenericFlingAnimation : public AsyncPanZoomAnimation,
} }
static float Accelerate(float aBase, float aSupplemental) { static float Accelerate(float aBase, float aSupplemental) {
return (aBase * StaticPrefs::APZFlingAccelBaseMultiplier()) + return (aBase * StaticPrefs::apz_fling_accel_base_mult()) +
(aSupplemental * StaticPrefs::APZFlingAccelSupplementalMultiplier()); (aSupplemental * StaticPrefs::apz_fling_accel_supplemental_mult());
} }
AsyncPanZoomController& mApzc; AsyncPanZoomController& mApzc;

Просмотреть файл

@ -291,13 +291,13 @@ nsEventStatus GestureEventListener::HandleInputTouchMove() {
// The user has performed a double tap, but not lifted her finger. // The user has performed a double tap, but not lifted her finger.
case GESTURE_SECOND_SINGLE_TOUCH_DOWN: { case GESTURE_SECOND_SINGLE_TOUCH_DOWN: {
// If touch has moved noticeably (within StaticPrefs::APZMaxTapTime()), // If touch has moved noticeably (within StaticPrefs::apz_max_tap_time()),
// change state. // change state.
if (MoveDistanceIsLarge()) { if (MoveDistanceIsLarge()) {
CancelLongTapTimeoutTask(); CancelLongTapTimeoutTask();
CancelMaxTapTimeoutTask(); CancelMaxTapTimeoutTask();
mSingleTapSent = Nothing(); mSingleTapSent = Nothing();
if (!StaticPrefs::APZOneTouchPinchEnabled()) { if (!StaticPrefs::apz_one_touch_pinch_enabled()) {
// If the one-touch-pinch feature is disabled, bail out of the double- // If the one-touch-pinch feature is disabled, bail out of the double-
// tap gesture instead. // tap gesture instead.
SetState(GESTURE_NONE); SetState(GESTURE_NONE);
@ -629,7 +629,7 @@ void GestureEventListener::CreateMaxTapTimeoutTask() {
mMaxTapTimeoutTask = task; mMaxTapTimeoutTask = task;
mAsyncPanZoomController->PostDelayedTask(task.forget(), mAsyncPanZoomController->PostDelayedTask(task.forget(),
StaticPrefs::APZMaxTapTime()); StaticPrefs::apz_max_tap_time());
} }
} // namespace layers } // namespace layers

Просмотреть файл

@ -150,7 +150,7 @@ bool InputBlockState::IsDownchainOf(AsyncPanZoomController* aA,
void InputBlockState::SetScrolledApzc(AsyncPanZoomController* aApzc) { void InputBlockState::SetScrolledApzc(AsyncPanZoomController* aApzc) {
// An input block should only have one scrolled APZC. // An input block should only have one scrolled APZC.
MOZ_ASSERT(!mScrolledApzc || (StaticPrefs::APZAllowImmediateHandoff() MOZ_ASSERT(!mScrolledApzc || (StaticPrefs::apz_allow_immediate_handoff()
? IsDownchainOf(mScrolledApzc, aApzc) ? IsDownchainOf(mScrolledApzc, aApzc)
: mScrolledApzc == aApzc)); : mScrolledApzc == aApzc));
@ -783,8 +783,8 @@ Maybe<ScrollDirection> TouchBlockState::GetBestGuessPanDirection(
angle = fabs(angle); // range [0, pi] angle = fabs(angle); // range [0, pi]
double angleThreshold = TouchActionAllowsPanningXY() double angleThreshold = TouchActionAllowsPanningXY()
? StaticPrefs::APZAxisLockAngle() ? StaticPrefs::apz_axis_lock_lock_angle()
: StaticPrefs::APZAllowedDirectPanAngle(); : StaticPrefs::apz_axis_lock_direct_pan_angle();
if (apz::IsCloseToHorizontal(angle, angleThreshold)) { if (apz::IsCloseToHorizontal(angle, angleThreshold)) {
return Some(ScrollDirection::eHorizontal); return Some(ScrollDirection::eHorizontal);
} }

Просмотреть файл

@ -108,7 +108,7 @@ class InputBlockState : public RefCounted<InputBlockState> {
// The APZC that was actually scrolled by events in this input block. // The APZC that was actually scrolled by events in this input block.
// This is used in configurations where a single input block is only // This is used in configurations where a single input block is only
// allowed to scroll a single APZC (configurations where // allowed to scroll a single APZC (configurations where
// StaticPrefs::APZAllowImmediateHandoff() is false). Set the first time an // StaticPrefs::apz_allow_immediate_handoff() is false). Set the first time an
// input event in this block scrolls an APZC. // input event in this block scrolls an APZC.
RefPtr<AsyncPanZoomController> mScrolledApzc; RefPtr<AsyncPanZoomController> mScrolledApzc;

Просмотреть файл

@ -319,7 +319,7 @@ nsEventStatus InputQueue::ReceiveKeyboardInput(
// If APZ is allowing passive listeners then we must dispatch the event to // If APZ is allowing passive listeners then we must dispatch the event to
// content, otherwise we can consume the event. // content, otherwise we can consume the event.
return StaticPrefs::APZKeyboardPassiveListeners() return StaticPrefs::apz_keyboard_passive_listeners()
? nsEventStatus_eConsumeDoDefault ? nsEventStatus_eConsumeDoDefault
: nsEventStatus_eConsumeNoDefault; : nsEventStatus_eConsumeNoDefault;
} }
@ -552,7 +552,7 @@ void InputQueue::ScheduleMainThreadTimeout(
RefPtr<Runnable> timeoutTask = NewRunnableMethod<uint64_t>( RefPtr<Runnable> timeoutTask = NewRunnableMethod<uint64_t>(
"layers::InputQueue::MainThreadTimeout", this, "layers::InputQueue::MainThreadTimeout", this,
&InputQueue::MainThreadTimeout, aBlock->GetBlockId()); &InputQueue::MainThreadTimeout, aBlock->GetBlockId());
int32_t timeout = StaticPrefs::APZContentResponseTimeout(); int32_t timeout = StaticPrefs::apz_content_response_timeout();
if (timeout == 0) { if (timeout == 0) {
// If the timeout is zero, treat it as a request to ignore any main // If the timeout is zero, treat it as a request to ignore any main
// thread confirmation and unconditionally use fallback behaviour for // thread confirmation and unconditionally use fallback behaviour for

Просмотреть файл

@ -86,7 +86,7 @@ Maybe<float> SimpleVelocityTracker::ComputeVelocity(uint32_t aTimestampMs) {
int count = 0; int count = 0;
for (const auto& e : mVelocityQueue) { for (const auto& e : mVelocityQueue) {
uint32_t timeDelta = (aTimestampMs - e.first); uint32_t timeDelta = (aTimestampMs - e.first);
if (timeDelta < StaticPrefs::APZVelocityRelevanceTime()) { if (timeDelta < StaticPrefs::apz_velocity_relevance_time_ms()) {
count++; count++;
velocity += e.second; velocity += e.second;
} }
@ -103,24 +103,26 @@ void SimpleVelocityTracker::Clear() { mVelocityQueue.Clear(); }
void SimpleVelocityTracker::AddVelocityToQueue(uint32_t aTimestampMs, void SimpleVelocityTracker::AddVelocityToQueue(uint32_t aTimestampMs,
float aVelocity) { float aVelocity) {
mVelocityQueue.AppendElement(std::make_pair(aTimestampMs, aVelocity)); mVelocityQueue.AppendElement(std::make_pair(aTimestampMs, aVelocity));
if (mVelocityQueue.Length() > StaticPrefs::APZMaxVelocityQueueSize()) { if (mVelocityQueue.Length() > StaticPrefs::apz_max_velocity_queue_size()) {
mVelocityQueue.RemoveElementAt(0); mVelocityQueue.RemoveElementAt(0);
} }
} }
float SimpleVelocityTracker::ApplyFlingCurveToVelocity(float aVelocity) const { float SimpleVelocityTracker::ApplyFlingCurveToVelocity(float aVelocity) const {
float newVelocity = aVelocity; float newVelocity = aVelocity;
if (StaticPrefs::APZMaxVelocity() > 0.0f) { if (StaticPrefs::apz_max_velocity_inches_per_ms() > 0.0f) {
bool velocityIsNegative = (newVelocity < 0); bool velocityIsNegative = (newVelocity < 0);
newVelocity = fabs(newVelocity); newVelocity = fabs(newVelocity);
float maxVelocity = mAxis->ToLocalVelocity(StaticPrefs::APZMaxVelocity()); float maxVelocity =
mAxis->ToLocalVelocity(StaticPrefs::apz_max_velocity_inches_per_ms());
newVelocity = std::min(newVelocity, maxVelocity); newVelocity = std::min(newVelocity, maxVelocity);
if (StaticPrefs::APZCurveThreshold() > 0.0f && if (StaticPrefs::apz_fling_curve_threshold_inches_per_ms() > 0.0f &&
StaticPrefs::APZCurveThreshold() < StaticPrefs::APZMaxVelocity()) { StaticPrefs::apz_fling_curve_threshold_inches_per_ms() <
float curveThreshold = StaticPrefs::apz_max_velocity_inches_per_ms()) {
mAxis->ToLocalVelocity(StaticPrefs::APZCurveThreshold()); float curveThreshold = mAxis->ToLocalVelocity(
StaticPrefs::apz_fling_curve_threshold_inches_per_ms());
if (newVelocity > curveThreshold) { if (newVelocity > curveThreshold) {
// here, 0 < curveThreshold < newVelocity <= maxVelocity, so we apply // here, 0 < curveThreshold < newVelocity <= maxVelocity, so we apply
// the curve // the curve

Просмотреть файл

@ -161,7 +161,8 @@ class APZCPinchLockingTester : public APZCPinchTester {
void twoFingerPan() { void twoFingerPan() {
ScreenCoord panDistance = ScreenCoord panDistance =
StaticPrefs::APZPinchLockScrollLockThreshold() * 1.2 * tm->GetDPI(); StaticPrefs::apz_pinch_lock_scroll_lock_threshold() * 1.2 *
tm->GetDPI();
mFocus = ScreenIntPoint((int)(mFocus.x + panDistance), (int)(mFocus.y)); mFocus = ScreenIntPoint((int)(mFocus.x + panDistance), (int)(mFocus.y));
@ -174,7 +175,8 @@ class APZCPinchLockingTester : public APZCPinchTester {
void twoFingerZoom() { void twoFingerZoom() {
float pinchDistance = float pinchDistance =
StaticPrefs::APZPinchLockSpanBreakoutThreshold() * 1.2 * tm->GetDPI(); StaticPrefs::apz_pinch_lock_span_breakout_threshold() * 1.2 *
tm->GetDPI();
float newSpan = mSpan + pinchDistance; float newSpan = mSpan + pinchDistance;
@ -191,7 +193,8 @@ class APZCPinchLockingTester : public APZCPinchTester {
// Send a small scale input to the APZC // Send a small scale input to the APZC
float pinchDistance = float pinchDistance =
StaticPrefs::APZPinchLockSpanBreakoutThreshold() * 0.8 * tm->GetDPI(); StaticPrefs::apz_pinch_lock_span_breakout_threshold() * 0.8 *
tm->GetDPI();
apzc->ReceiveInputEvent( apzc->ReceiveInputEvent(
CreatePinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE, mFocus, CreatePinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE, mFocus,
mSpan + pinchDistance, mSpan, mcc->Time()), mSpan + pinchDistance, mSpan, mcc->Time()),
@ -252,7 +255,7 @@ TEST_F(APZCPinchGestureDetectorTester,
// Since we are preventing the pinch action via touch-action we should not be // Since we are preventing the pinch action via touch-action we should not be
// sending the pinch gesture notifications that would normally be sent when // sending the pinch gesture notifications that would normally be sent when
// APZAllowZooming is false. // apz_allow_zooming is false.
EXPECT_CALL(*mcc, NotifyPinchGesture(_, _, _, _)).Times(0); EXPECT_CALL(*mcc, NotifyPinchGesture(_, _, _, _)).Times(0);
nsTArray<uint32_t> behaviors = {mozilla::layers::AllowedTouchBehavior::NONE, nsTArray<uint32_t> behaviors = {mozilla::layers::AllowedTouchBehavior::NONE,
mozilla::layers::AllowedTouchBehavior::NONE}; mozilla::layers::AllowedTouchBehavior::NONE};
@ -267,7 +270,7 @@ TEST_F(APZCPinchGestureDetectorTester, Pinch_PreventDefault_NoAPZZoom) {
SCOPED_GFX_PREF_BOOL("apz.allow_zooming", false); SCOPED_GFX_PREF_BOOL("apz.allow_zooming", false);
// Since we are preventing the pinch action we should not be sending the pinch // Since we are preventing the pinch action we should not be sending the pinch
// gesture notifications that would normally be sent when APZAllowZooming is // gesture notifications that would normally be sent when apz_allow_zooming is
// false. // false.
EXPECT_CALL(*mcc, NotifyPinchGesture(_, _, _, _)).Times(0); EXPECT_CALL(*mcc, NotifyPinchGesture(_, _, _, _)).Times(0);
@ -435,11 +438,11 @@ TEST_F(APZCPinchGestureDetectorTester, Pinch_APZZoom_Disabled) {
FrameMetrics originalMetrics = GetPinchableFrameMetrics(); FrameMetrics originalMetrics = GetPinchableFrameMetrics();
apzc->SetFrameMetrics(originalMetrics); apzc->SetFrameMetrics(originalMetrics);
// When APZAllowZooming is false, the ZoomConstraintsClient produces // When apz_allow_zooming is false, the ZoomConstraintsClient produces
// ZoomConstraints with mAllowZoom set to false. // ZoomConstraints with mAllowZoom set to false.
MakeApzcUnzoomable(); MakeApzcUnzoomable();
// With APZAllowZooming false, we expect the NotifyPinchGesture function to // With apz_allow_zooming false, we expect the NotifyPinchGesture function to
// get called as the pinch progresses, but the metrics shouldn't change. // get called as the pinch progresses, but the metrics shouldn't change.
EXPECT_CALL(*mcc, EXPECT_CALL(*mcc,
NotifyPinchGesture(PinchGestureInput::PINCHGESTURE_START, NotifyPinchGesture(PinchGestureInput::PINCHGESTURE_START,
@ -474,11 +477,11 @@ TEST_F(APZCPinchGestureDetectorTester, Pinch_NoSpan) {
FrameMetrics originalMetrics = GetPinchableFrameMetrics(); FrameMetrics originalMetrics = GetPinchableFrameMetrics();
apzc->SetFrameMetrics(originalMetrics); apzc->SetFrameMetrics(originalMetrics);
// When APZAllowZooming is false, the ZoomConstraintsClient produces // When apz_allow_zooming is false, the ZoomConstraintsClient produces
// ZoomConstraints with mAllowZoom set to false. // ZoomConstraints with mAllowZoom set to false.
MakeApzcUnzoomable(); MakeApzcUnzoomable();
// With APZAllowZooming false, we expect the NotifyPinchGesture function to // With apz_allow_zooming false, we expect the NotifyPinchGesture function to
// get called as the pinch progresses, but the metrics shouldn't change. // get called as the pinch progresses, but the metrics shouldn't change.
EXPECT_CALL(*mcc, EXPECT_CALL(*mcc,
NotifyPinchGesture(PinchGestureInput::PINCHGESTURE_START, NotifyPinchGesture(PinchGestureInput::PINCHGESTURE_START,

Просмотреть файл

@ -524,6 +524,7 @@ TEST_F(APZScrollHandoffTester, Scrollgrab) {
TEST_F(APZScrollHandoffTester, ScrollgrabFling) { TEST_F(APZScrollHandoffTester, ScrollgrabFling) {
SCOPED_GFX_PREF_FLOAT("apz.fling_min_velocity_threshold", 0.0f); SCOPED_GFX_PREF_FLOAT("apz.fling_min_velocity_threshold", 0.0f);
// Set up the layer tree // Set up the layer tree
CreateScrollgrabLayerTree(); CreateScrollgrabLayerTree();

Просмотреть файл

@ -191,7 +191,7 @@ void CheckerboardReportService::GetReports(
} }
bool CheckerboardReportService::IsRecordingEnabled() const { bool CheckerboardReportService::IsRecordingEnabled() const {
return StaticPrefs::APZRecordCheckerboarding(); return StaticPrefs::apz_record_checkerboarding();
} }
void CheckerboardReportService::SetRecordingEnabled(bool aEnabled) { void CheckerboardReportService::SetRecordingEnabled(bool aEnabled) {

Просмотреть файл

@ -229,8 +229,8 @@ bool SharedFrameMetricsHelper::AboutToCheckerboard(
CSSRect showing = CSSRect showing =
CSSRect(aCompositorMetrics.GetScrollOffset(), CSSRect(aCompositorMetrics.GetScrollOffset(),
aCompositorMetrics.CalculateBoundedCompositedSizeInCssPixels()); aCompositorMetrics.CalculateBoundedCompositedSizeInCssPixels());
showing.Inflate( showing.Inflate(LayerSize(StaticPrefs::apz_danger_zone_x(),
LayerSize(StaticPrefs::APZDangerZoneX(), StaticPrefs::APZDangerZoneY()) / StaticPrefs::apz_danger_zone_y()) /
aCompositorMetrics.LayersPixelsPerCSSPixel()); aCompositorMetrics.LayersPixelsPerCSSPixel());
// Clamp both rects to the scrollable rect, because having either of those // Clamp both rects to the scrollable rect, because having either of those

Просмотреть файл

@ -1487,9 +1487,9 @@ void AsyncCompositionManager::SetFixedLayerMargins(ScreenIntCoord aTop,
} }
ScreenMargin AsyncCompositionManager::GetFixedLayerMargins() const { ScreenMargin AsyncCompositionManager::GetFixedLayerMargins() const {
ScreenMargin result = mFixedLayerMargins; ScreenMargin result = mFixedLayerMargins;
if (StaticPrefs::APZFixedMarginOverrideEnabled()) { if (StaticPrefs::apz_fixed_margin_override_enabled()) {
result.top = StaticPrefs::APZFixedMarginOverrideTop(); result.top = StaticPrefs::apz_fixed_margin_override_top();
result.bottom = StaticPrefs::APZFixedMarginOverrideBottom(); result.bottom = StaticPrefs::apz_fixed_margin_override_bottom();
} }
return result; return result;
} }

Просмотреть файл

@ -509,7 +509,7 @@ void RenderLayers(ContainerT* aContainer, LayerManagerComposite* aManager,
} }
} }
if (StaticPrefs::APZMinimap()) { if (StaticPrefs::apz_minimap_enabled()) {
RenderMinimap(aContainer, sampler, aManager, aClipRect, layer); RenderMinimap(aContainer, sampler, aManager, aClipRect, layer);
} }
} }

Просмотреть файл

@ -31,6 +31,10 @@ struct precache_output
#define ALIGN __attribute__(( aligned (16) )) #define ALIGN __attribute__(( aligned (16) ))
#endif #endif
struct _qcms_transform;
typedef void (*transform_fn_t)(const struct _qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length);
struct _qcms_transform { struct _qcms_transform {
float ALIGN matrix[3][4]; float ALIGN matrix[3][4];
float *input_gamma_table_r; float *input_gamma_table_r;
@ -74,7 +78,7 @@ struct _qcms_transform {
struct precache_output *output_table_g; struct precache_output *output_table_g;
struct precache_output *output_table_b; struct precache_output *output_table_b;
void (*transform_fn)(const struct _qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length); transform_fn_t transform_fn;
}; };
struct matrix { struct matrix {
@ -264,6 +268,32 @@ void precache_release(struct precache_output *p);
bool set_rgb_colorants(qcms_profile *profile, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries); bool set_rgb_colorants(qcms_profile *profile, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries);
bool get_rgb_colorants(struct matrix *colorants, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries); bool get_rgb_colorants(struct matrix *colorants, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries);
void qcms_transform_data_rgb_out_lut(const qcms_transform *transform,
const unsigned char *src,
unsigned char *dest,
size_t length);
void qcms_transform_data_rgba_out_lut(const qcms_transform *transform,
const unsigned char *src,
unsigned char *dest,
size_t length);
void qcms_transform_data_bgra_out_lut(const qcms_transform *transform,
const unsigned char *src,
unsigned char *dest,
size_t length);
void qcms_transform_data_rgb_out_lut_precache(const qcms_transform *transform,
const unsigned char *src,
unsigned char *dest,
size_t length);
void qcms_transform_data_rgba_out_lut_precache(const qcms_transform *transform,
const unsigned char *src,
unsigned char *dest,
size_t length);
void qcms_transform_data_bgra_out_lut_precache(const qcms_transform *transform,
const unsigned char *src,
unsigned char *dest,
size_t length);
void qcms_transform_data_rgb_out_lut_sse2(const qcms_transform *transform, void qcms_transform_data_rgb_out_lut_sse2(const qcms_transform *transform,
const unsigned char *src, const unsigned char *src,
unsigned char *dest, unsigned char *dest,

Просмотреть файл

@ -513,17 +513,17 @@ static void qcms_transform_data_template_lut_precache(const qcms_transform *tran
} }
} }
static void qcms_transform_data_rgb_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) void qcms_transform_data_rgb_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
{ {
qcms_transform_data_template_lut_precache<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX>(transform, src, dest, length); qcms_transform_data_template_lut_precache<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX>(transform, src, dest, length);
} }
static void qcms_transform_data_rgba_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) void qcms_transform_data_rgba_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
{ {
qcms_transform_data_template_lut_precache<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX, RGBA_A_INDEX>(transform, src, dest, length); qcms_transform_data_template_lut_precache<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX, RGBA_A_INDEX>(transform, src, dest, length);
} }
static void qcms_transform_data_bgra_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) void qcms_transform_data_bgra_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
{ {
qcms_transform_data_template_lut_precache<BGRA_R_INDEX, BGRA_G_INDEX, BGRA_B_INDEX, BGRA_A_INDEX>(transform, src, dest, length); qcms_transform_data_template_lut_precache<BGRA_R_INDEX, BGRA_G_INDEX, BGRA_B_INDEX, BGRA_A_INDEX>(transform, src, dest, length);
} }
@ -772,17 +772,17 @@ static void qcms_transform_data_template_lut(const qcms_transform *transform, co
} }
} }
static void qcms_transform_data_rgb_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) void qcms_transform_data_rgb_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
{ {
qcms_transform_data_template_lut<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX>(transform, src, dest, length); qcms_transform_data_template_lut<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX>(transform, src, dest, length);
} }
static void qcms_transform_data_rgba_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) void qcms_transform_data_rgba_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
{ {
qcms_transform_data_template_lut<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX, RGBA_A_INDEX>(transform, src, dest, length); qcms_transform_data_template_lut<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX, RGBA_A_INDEX>(transform, src, dest, length);
} }
static void qcms_transform_data_bgra_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) void qcms_transform_data_bgra_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
{ {
qcms_transform_data_template_lut<BGRA_R_INDEX, BGRA_G_INDEX, BGRA_B_INDEX, BGRA_A_INDEX>(transform, src, dest, length); qcms_transform_data_template_lut<BGRA_R_INDEX, BGRA_G_INDEX, BGRA_B_INDEX, BGRA_A_INDEX>(transform, src, dest, length);
} }

Просмотреть файл

@ -4,63 +4,25 @@
*/ */
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "gtest/MozGTestBench.h"
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/SSE.h"
#include "mozilla/arm.h"
#include "qcms.h" #include "qcms.h"
#include "qcmsint.h" #include "qcmsint.h"
#include "transform_util.h" #include "transform_util.h"
const size_t allGBSize = 1 * 256 * 256 * 4; #include <cmath>
static unsigned char* createAllGB() {
unsigned char* buff = (unsigned char*)malloc(allGBSize);
int pos = 0;
for (int r = 0; r < 1; r++) { // Skip all R values for speed
for (int g = 0; g < 256; g++) {
for (int b = 0; b < 256; b++) {
buff[pos * 4 + 0] = r;
buff[pos * 4 + 1] = g;
buff[pos * 4 + 2] = b;
buff[pos * 4 + 3] = 0x80;
pos++;
}
}
}
return buff; /* SSEv1 is only included in non-Windows or non-x86-64-bit builds. */
} #if defined(MOZILLA_MAY_SUPPORT_SSE) && (!(defined(_MSC_VER) && defined(_M_AMD64)))
#define QCMS_MAY_SUPPORT_SSE
#endif
TEST(GfxQcms, Identity) using namespace mozilla;
{
// XXX: This means that we can't have qcms v2 unit test
// without changing the qcms API.
qcms_enable_iccv4();
qcms_profile* input_profile = qcms_profile_sRGB();
qcms_profile* output_profile = qcms_profile_sRGB();
EXPECT_FALSE(qcms_profile_is_bogus(input_profile));
EXPECT_FALSE(qcms_profile_is_bogus(output_profile));
const qcms_intent intent = QCMS_INTENT_DEFAULT;
qcms_data_type input_type = QCMS_DATA_RGBA_8;
qcms_data_type output_type = QCMS_DATA_RGBA_8;
qcms_transform* transform = qcms_transform_create(
input_profile, input_type, output_profile, output_type, intent);
unsigned char* data_in = createAllGB();
;
unsigned char* data_out = (unsigned char*)malloc(allGBSize);
qcms_transform_data(transform, data_in, data_out, allGBSize / 4);
qcms_profile_release(input_profile);
qcms_profile_release(output_profile);
qcms_transform_release(transform);
free(data_in);
free(data_out);
}
TEST(GfxQcms, LutInverseCrash) TEST(GfxQcms, LutInverseCrash)
{ {
@ -174,3 +136,484 @@ TEST(GfxQcms, LutInverseNonMonotonic)
// Make sure we don't crash, hang or let sanitizers do their magic // Make sure we don't crash, hang or let sanitizers do their magic
} }
static bool CmpRgbChannel(const uint8_t* aRef, const uint8_t* aTest,
size_t aIndex) {
return std::abs(static_cast<int8_t>(aRef[aIndex] - aTest[aIndex])) <= 1;
}
template <bool kSwapRB, bool kHasAlpha>
static bool CmpRgbBufferImpl(const uint8_t* aRefBuffer,
const uint8_t* aTestBuffer, size_t aPixels) {
const size_t pixelSize = kHasAlpha ? 4 : 3;
if (memcmp(aRefBuffer, aTestBuffer, aPixels * pixelSize) == 0) {
return true;
}
const size_t kRIndex = kSwapRB ? 2 : 0;
const size_t kGIndex = 1;
const size_t kBIndex = kSwapRB ? 0 : 2;
const size_t kAIndex = 3;
size_t remaining = aPixels;
const uint8_t* ref = aRefBuffer;
const uint8_t* test = aTestBuffer;
while (remaining > 0) {
if (!CmpRgbChannel(ref, test, kRIndex) ||
!CmpRgbChannel(ref, test, kGIndex) ||
!CmpRgbChannel(ref, test, kBIndex) ||
(kHasAlpha && ref[kAIndex] != test[kAIndex])) {
EXPECT_EQ(test[kRIndex], ref[kRIndex]);
EXPECT_EQ(test[kGIndex], ref[kGIndex]);
EXPECT_EQ(test[kBIndex], ref[kBIndex]);
if (kHasAlpha) {
EXPECT_EQ(test[kAIndex], ref[kAIndex]);
}
return false;
}
--remaining;
ref += pixelSize;
test += pixelSize;
}
return true;
}
template <bool kSwapRB, bool kHasAlpha>
static size_t GetRgbInputBufferImpl(UniquePtr<uint8_t[]>& aOutBuffer) {
const uint8_t colorSamples[] = {0, 5, 16, 43, 101, 127, 182, 255};
const size_t colorSampleMax = sizeof(colorSamples) / sizeof(uint8_t);
const size_t pixelSize = kHasAlpha ? 4 : 3;
const size_t pixelCount = colorSampleMax * colorSampleMax * 256 * 3;
aOutBuffer = MakeUnique<uint8_t[]>(pixelCount * pixelSize);
if (!aOutBuffer) {
return 0;
}
const size_t kRIndex = kSwapRB ? 2 : 0;
const size_t kGIndex = 1;
const size_t kBIndex = kSwapRB ? 0 : 2;
const size_t kAIndex = 3;
// Sample every red pixel value with a subset of green and blue.
uint8_t* color = aOutBuffer.get();
for (uint16_t r = 0; r < 256; ++r) {
for (uint8_t g : colorSamples) {
for (uint8_t b : colorSamples) {
color[kRIndex] = r;
color[kGIndex] = g;
color[kBIndex] = b;
if (kHasAlpha) {
color[kAIndex] = 0x80;
}
color += pixelSize;
}
}
}
// Sample every green pixel value with a subset of red and blue.
for (uint8_t r : colorSamples) {
for (uint16_t g = 0; g < 256; ++g) {
for (uint8_t b : colorSamples) {
color[kRIndex] = r;
color[kGIndex] = g;
color[kBIndex] = b;
if (kHasAlpha) {
color[kAIndex] = 0x80;
}
color += pixelSize;
}
}
}
// Sample every blue pixel value with a subset of red and green.
for (uint8_t r : colorSamples) {
for (uint8_t g : colorSamples) {
for (uint16_t b = 0; b < 256; ++b) {
color[kRIndex] = r;
color[kGIndex] = g;
color[kBIndex] = b;
if (kHasAlpha) {
color[kAIndex] = 0x80;
}
color += pixelSize;
}
}
}
return pixelCount;
}
static size_t GetRgbInputBuffer(UniquePtr<uint8_t[]>& aOutBuffer) {
return GetRgbInputBufferImpl<false, false>(aOutBuffer);
}
static size_t GetRgbaInputBuffer(UniquePtr<uint8_t[]>& aOutBuffer) {
return GetRgbInputBufferImpl<false, true>(aOutBuffer);
}
static size_t GetBgraInputBuffer(UniquePtr<uint8_t[]>& aOutBuffer) {
return GetRgbInputBufferImpl<true, true>(aOutBuffer);
}
static bool CmpRgbBuffer(const uint8_t* aRefBuffer, const uint8_t* aTestBuffer,
size_t aPixels) {
return CmpRgbBufferImpl<false, false>(aRefBuffer, aTestBuffer, aPixels);
}
static bool CmpRgbaBuffer(const uint8_t* aRefBuffer, const uint8_t* aTestBuffer,
size_t aPixels) {
return CmpRgbBufferImpl<false, true>(aRefBuffer, aTestBuffer, aPixels);
}
static bool CmpBgraBuffer(const uint8_t* aRefBuffer, const uint8_t* aTestBuffer,
size_t aPixels) {
return CmpRgbBufferImpl<true, true>(aRefBuffer, aTestBuffer, aPixels);
}
static void ClearRgbBuffer(uint8_t* aBuffer, size_t aPixels) {
if (aBuffer) {
memset(aBuffer, 0, aPixels * 3);
}
}
static void ClearRgbaBuffer(uint8_t* aBuffer, size_t aPixels) {
if (aBuffer) {
memset(aBuffer, 0, aPixels * 4);
}
}
static UniquePtr<uint8_t[]> GetRgbOutputBuffer(size_t aPixels) {
UniquePtr<uint8_t[]> buffer = MakeUnique<uint8_t[]>(aPixels * 3);
ClearRgbBuffer(buffer.get(), aPixels);
return buffer;
}
static UniquePtr<uint8_t[]> GetRgbaOutputBuffer(size_t aPixels) {
UniquePtr<uint8_t[]> buffer = MakeUnique<uint8_t[]>(aPixels * 4);
ClearRgbaBuffer(buffer.get(), aPixels);
return buffer;
}
class GfxQcms_ProfilePairBase : public ::testing::Test {
protected:
GfxQcms_ProfilePairBase()
: mInProfile(nullptr),
mOutProfile(nullptr),
mTransform(nullptr),
mPixels(0),
mStorageType(QCMS_DATA_RGB_8),
mPrecache(false) {}
void TransformPrecache();
void TransformPrecachePlatformExt();
void SetUp() override {
// XXX: This means that we can't have qcms v2 unit test
// without changing the qcms API.
qcms_enable_iccv4();
}
void TearDown() override {
if (mInProfile) {
qcms_profile_release(mInProfile);
}
if (mOutProfile) {
qcms_profile_release(mOutProfile);
}
if (mTransform) {
qcms_transform_release(mTransform);
}
}
bool SetTransform(qcms_transform* aTransform) {
if (mTransform) {
qcms_transform_release(mTransform);
}
mTransform = aTransform;
return !!mTransform;
}
bool SetTransform(qcms_data_type aType) {
return SetTransform(qcms_transform_create(mInProfile, aType, mOutProfile,
aType, QCMS_INTENT_DEFAULT));
}
bool SetBuffers(qcms_data_type aType) {
switch (aType) {
case QCMS_DATA_RGB_8:
mPixels = GetRgbInputBuffer(mInput);
mRef = GetRgbOutputBuffer(mPixels);
mOutput = GetRgbOutputBuffer(mPixels);
break;
case QCMS_DATA_RGBA_8:
mPixels = GetRgbaInputBuffer(mInput);
mRef = GetRgbaOutputBuffer(mPixels);
mOutput = GetRgbaOutputBuffer(mPixels);
break;
case QCMS_DATA_BGRA_8:
mPixels = GetBgraInputBuffer(mInput);
mRef = GetRgbaOutputBuffer(mPixels);
mOutput = GetRgbaOutputBuffer(mPixels);
break;
default:
MOZ_ASSERT_UNREACHABLE("Unknown type!");
break;
}
mStorageType = aType;
return mInput && mOutput && mRef && mPixels > 0u;
}
void ClearOutputBuffer() {
switch (mStorageType) {
case QCMS_DATA_RGB_8:
ClearRgbBuffer(mOutput.get(), mPixels);
break;
case QCMS_DATA_RGBA_8:
case QCMS_DATA_BGRA_8:
ClearRgbaBuffer(mOutput.get(), mPixels);
break;
default:
MOZ_ASSERT_UNREACHABLE("Unknown type!");
break;
}
}
void ProduceRef(transform_fn_t aFn) {
aFn(mTransform, mInput.get(), mRef.get(), mPixels);
}
void CopyInputToRef() {
size_t pixelSize = 0;
switch (mStorageType) {
case QCMS_DATA_RGB_8:
pixelSize = 3;
break;
case QCMS_DATA_RGBA_8:
case QCMS_DATA_BGRA_8:
pixelSize = 4;
break;
default:
MOZ_ASSERT_UNREACHABLE("Unknown type!");
break;
}
memcpy(mRef.get(), mInput.get(), mPixels * pixelSize);
}
void ProduceOutput(transform_fn_t aFn) {
ClearOutputBuffer();
aFn(mTransform, mInput.get(), mOutput.get(), mPixels);
}
bool VerifyOutput(const UniquePtr<uint8_t[]>& aBuf) {
switch (mStorageType) {
case QCMS_DATA_RGB_8:
return CmpRgbBuffer(aBuf.get(), mOutput.get(), mPixels);
case QCMS_DATA_RGBA_8:
return CmpRgbaBuffer(aBuf.get(), mOutput.get(), mPixels);
case QCMS_DATA_BGRA_8:
return CmpBgraBuffer(aBuf.get(), mOutput.get(), mPixels);
default:
MOZ_ASSERT_UNREACHABLE("Unknown type!");
break;
}
return false;
}
bool ProduceVerifyOutput(transform_fn_t aFn) {
ProduceOutput(aFn);
return VerifyOutput(mRef);
}
void PrecacheOutput() {
qcms_profile_precache_output_transform(mOutProfile);
mPrecache = true;
}
qcms_profile* mInProfile;
qcms_profile* mOutProfile;
qcms_transform* mTransform;
UniquePtr<uint8_t[]> mInput;
UniquePtr<uint8_t[]> mOutput;
UniquePtr<uint8_t[]> mRef;
size_t mPixels;
qcms_data_type mStorageType;
bool mPrecache;
};
void GfxQcms_ProfilePairBase::TransformPrecache() {
// Produce reference using interpolation and the lookup tables.
ASSERT_FALSE(mPrecache);
ASSERT_TRUE(SetBuffers(QCMS_DATA_RGB_8));
ASSERT_TRUE(SetTransform(QCMS_DATA_RGB_8));
ProduceRef(qcms_transform_data_rgb_out_lut);
// Produce output using lut and precaching.
PrecacheOutput();
ASSERT_TRUE(SetTransform(QCMS_DATA_RGB_8));
EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgb_out_lut_precache));
}
void GfxQcms_ProfilePairBase::TransformPrecachePlatformExt() {
PrecacheOutput();
// Verify RGB transforms.
ASSERT_TRUE(SetBuffers(QCMS_DATA_RGB_8));
ASSERT_TRUE(SetTransform(QCMS_DATA_RGB_8));
ProduceRef(qcms_transform_data_rgb_out_lut_precache);
#ifdef QCMS_MAY_SUPPORT_SSE
if (mozilla::supports_sse()) {
EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgb_out_lut_sse1));
}
#endif
#ifdef MOZILLA_MAY_SUPPORT_SSE2
if (mozilla::supports_sse2()) {
EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgb_out_lut_sse2));
}
#endif
#ifdef MOZILLA_MAY_SUPPORT_NEON
if (mozilla::supports_neon()) {
EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgb_out_lut_neon));
}
#endif
// Verify RGBA transforms.
ASSERT_TRUE(SetBuffers(QCMS_DATA_RGBA_8));
ASSERT_TRUE(SetTransform(QCMS_DATA_RGBA_8));
ProduceRef(qcms_transform_data_rgba_out_lut_precache);
#ifdef QCMS_MAY_SUPPORT_SSE
if (mozilla::supports_sse()) {
EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgba_out_lut_sse1));
}
#endif
#ifdef MOZILLA_MAY_SUPPORT_SSE2
if (mozilla::supports_sse2()) {
EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgba_out_lut_sse2));
}
#endif
#ifdef MOZILLA_MAY_SUPPORT_NEON
if (mozilla::supports_neon()) {
EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgba_out_lut_neon));
}
#endif
// Verify BGRA transforms.
ASSERT_TRUE(SetBuffers(QCMS_DATA_BGRA_8));
ASSERT_TRUE(SetTransform(QCMS_DATA_BGRA_8));
ProduceRef(qcms_transform_data_bgra_out_lut_precache);
#ifdef QCMS_MAY_SUPPORT_SSE
if (mozilla::supports_sse()) {
EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_bgra_out_lut_sse1));
}
#endif
#ifdef MOZILLA_MAY_SUPPORT_SSE2
if (mozilla::supports_sse2()) {
EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_bgra_out_lut_sse2));
}
#endif
#ifdef MOZILLA_MAY_SUPPORT_NEON
if (mozilla::supports_neon()) {
EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_bgra_out_lut_neon));
}
#endif
}
class GfxQcms_sRGB_To_sRGB : public GfxQcms_ProfilePairBase {
protected:
void SetUp() override {
GfxQcms_ProfilePairBase::SetUp();
mInProfile = qcms_profile_sRGB();
mOutProfile = qcms_profile_sRGB();
}
};
class GfxQcms_sRGB_To_SamsungSyncmaster : public GfxQcms_ProfilePairBase {
protected:
void SetUp() override {
GfxQcms_ProfilePairBase::SetUp();
mInProfile = qcms_profile_sRGB();
mOutProfile = qcms_profile_from_path("lcms_samsung_syncmaster.icc");
}
};
class GfxQcms_sRGB_To_ThinkpadW540 : public GfxQcms_ProfilePairBase {
protected:
void SetUp() override {
GfxQcms_ProfilePairBase::SetUp();
mInProfile = qcms_profile_sRGB();
mOutProfile = qcms_profile_from_path("lcms_thinkpad_w540.icc");
}
};
#define TEST_QCMS_PROFILE_F(test_fixture) \
TEST_F(test_fixture, TransformPrecachePlatformExt) { \
GfxQcms_ProfilePairBase::TransformPrecachePlatformExt(); \
}
TEST_F(GfxQcms_sRGB_To_sRGB, TransformPrecache) {
// TODO(aosmond): This doesn't pass for the non-identity transform. Should
// they produce the same results?
GfxQcms_ProfilePairBase::TransformPrecache();
}
TEST_QCMS_PROFILE_F(GfxQcms_sRGB_To_sRGB)
TEST_F(GfxQcms_sRGB_To_sRGB, TransformIdentity) {
PrecacheOutput();
SetBuffers(QCMS_DATA_RGB_8);
SetTransform(QCMS_DATA_RGB_8);
qcms_transform_data(mTransform, mInput.get(), mOutput.get(), mPixels);
EXPECT_TRUE(VerifyOutput(mInput));
}
TEST_QCMS_PROFILE_F(GfxQcms_sRGB_To_SamsungSyncmaster)
TEST_QCMS_PROFILE_F(GfxQcms_sRGB_To_ThinkpadW540)
class GfxQcmsPerf_Base : public GfxQcms_sRGB_To_ThinkpadW540 {
protected:
explicit GfxQcmsPerf_Base(qcms_data_type aType) { mStorageType = aType; }
void TransformPerf() { ProduceRef(qcms_transform_data_rgb_out_lut_precache); }
void TransformPlatformPerf() {
qcms_transform_data(mTransform, mInput.get(), mRef.get(), mPixels);
}
void SetUp() override {
GfxQcms_sRGB_To_ThinkpadW540::SetUp();
PrecacheOutput();
SetBuffers(mStorageType);
SetTransform(mStorageType);
}
};
class GfxQcmsPerf_Rgb : public GfxQcmsPerf_Base {
protected:
GfxQcmsPerf_Rgb() : GfxQcmsPerf_Base(QCMS_DATA_RGB_8) {}
};
class GfxQcmsPerf_Rgba : public GfxQcmsPerf_Base {
protected:
GfxQcmsPerf_Rgba() : GfxQcmsPerf_Base(QCMS_DATA_RGBA_8) {}
};
class GfxQcmsPerf_Bgra : public GfxQcmsPerf_Base {
protected:
GfxQcmsPerf_Bgra() : GfxQcmsPerf_Base(QCMS_DATA_BGRA_8) {}
};
MOZ_GTEST_BENCH_F(GfxQcmsPerf_Rgb, TransformC, [this] { TransformPerf(); });
MOZ_GTEST_BENCH_F(GfxQcmsPerf_Rgb, TransformPlatform,
[this] { TransformPlatformPerf(); });
MOZ_GTEST_BENCH_F(GfxQcmsPerf_Rgba, TransformC, [this] { TransformPerf(); });
MOZ_GTEST_BENCH_F(GfxQcmsPerf_Rgba, TransformPlatform,
[this] { TransformPlatformPerf(); });
MOZ_GTEST_BENCH_F(GfxQcmsPerf_Bgra, TransformC, [this] { TransformPerf(); });
MOZ_GTEST_BENCH_F(GfxQcmsPerf_Bgra, TransformPlatform,
[this] { TransformPlatformPerf(); });

Двоичные данные
gfx/tests/gtest/icc_profiles/lcms_samsung_syncmaster.icc Normal file

Двоичный файл не отображается.

Двоичные данные
gfx/tests/gtest/icc_profiles/lcms_thinkpad_w540.icc Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -57,6 +57,14 @@ SOURCES += [ '/gfx/ots/tests/%s' % p for p in [
'layout_common_table_test.cc', 'layout_common_table_test.cc',
]] ]]
# ICC profiles used for verifying QCMS transformations. The copyright
# notice embedded in the profiles should be reviewed to ensure there are
# no known restrictions on distribution.
TEST_HARNESS_FILES.gtest += [
'icc_profiles/lcms_samsung_syncmaster.icc',
'icc_profiles/lcms_thinkpad_w540.icc',
]
include('/ipc/chromium/chromium-config.mozbuild') include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [

Просмотреть файл

@ -3232,7 +3232,7 @@ void gfxPlatform::GetApzSupportInfo(mozilla::widget::InfoObject& aObj) {
} }
if (SupportsApzKeyboardInput() && if (SupportsApzKeyboardInput() &&
!StaticPrefs::AccessibilityBrowseWithCaret()) { !StaticPrefs::accessibility_browsewithcaret()) {
aObj.DefineProperty("ApzKeyboardInput", 1); aObj.DefineProperty("ApzKeyboardInput", 1);
} }
@ -3477,15 +3477,15 @@ bool gfxPlatform::SupportsApzTouchInput() const {
} }
bool gfxPlatform::SupportsApzDragInput() const { bool gfxPlatform::SupportsApzDragInput() const {
return StaticPrefs::APZDragEnabled(); return StaticPrefs::apz_drag_enabled();
} }
bool gfxPlatform::SupportsApzKeyboardInput() const { bool gfxPlatform::SupportsApzKeyboardInput() const {
return StaticPrefs::APZKeyboardEnabled(); return StaticPrefs::apz_keyboard_enabled();
} }
bool gfxPlatform::SupportsApzAutoscrolling() const { bool gfxPlatform::SupportsApzAutoscrolling() const {
return StaticPrefs::APZAutoscrollEnabled(); return StaticPrefs::apz_autoscroll_enabled();
} }
void gfxPlatform::InitOpenGLConfig() { void gfxPlatform::InitOpenGLConfig() {

Просмотреть файл

@ -382,7 +382,7 @@ bool TenuredCell::isInsideZone(JS::Zone* zone) const {
} }
if (thing->isMarkedGray()) { if (thing->isMarkedGray()) {
// There shouldn't be anything marked grey unless we're on the main thread. // There shouldn't be anything marked gray unless we're on the main thread.
MOZ_ASSERT(CurrentThreadCanAccessRuntime(thing->runtimeFromAnyThread())); MOZ_ASSERT(CurrentThreadCanAccessRuntime(thing->runtimeFromAnyThread()));
if (!JS::RuntimeHeapIsCollecting()) { if (!JS::RuntimeHeapIsCollecting()) {
JS::UnmarkGrayGCThingRecursively( JS::UnmarkGrayGCThingRecursively(

Просмотреть файл

@ -5246,7 +5246,7 @@ void GCRuntime::getNextSweepGroup() {
* *
* This means that when marking things gray we must not allow marking to leave * This means that when marking things gray we must not allow marking to leave
* the current compartment group, as that could result in things being marked * the current compartment group, as that could result in things being marked
* grey when they might subsequently be marked black. To achieve this, when we * gray when they might subsequently be marked black. To achieve this, when we
* find a cross compartment pointer we don't mark the referent but add it to a * find a cross compartment pointer we don't mark the referent but add it to a
* singly-linked list of incoming gray pointers that is stored with each * singly-linked list of incoming gray pointers that is stored with each
* compartment. * compartment.

Просмотреть файл

@ -6008,7 +6008,7 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
return; return;
} }
if (StaticPrefs::APZKeyboardEnabled()) { if (StaticPrefs::apz_keyboard_enabled()) {
// Update the focus target for async keyboard scrolling. This will be // Update the focus target for async keyboard scrolling. This will be
// forwarded to APZ by nsDisplayList::PaintRoot. We need to to do this // forwarded to APZ by nsDisplayList::PaintRoot. We need to to do this
// before we enter the paint phase because dispatching eVoid events can // before we enter the paint phase because dispatching eVoid events can

Просмотреть файл

@ -173,7 +173,7 @@ static mozilla::layers::ZoomConstraints ComputeZoomConstraintsFromViewportInfo(
constraints.mAllowZoom = aViewportInfo.IsZoomAllowed() && constraints.mAllowZoom = aViewportInfo.IsZoomAllowed() &&
nsLayoutUtils::AllowZoomingForDocument(aDocument); nsLayoutUtils::AllowZoomingForDocument(aDocument);
constraints.mAllowDoubleTapZoom = constraints.mAllowDoubleTapZoom =
constraints.mAllowZoom && StaticPrefs::APZAllowDoubleTapZooming(); constraints.mAllowZoom && StaticPrefs::apz_allow_double_tap_zooming();
if (constraints.mAllowZoom) { if (constraints.mAllowZoom) {
constraints.mMinZoom.scale = aViewportInfo.GetMinZoom().scale; constraints.mMinZoom.scale = aViewportInfo.GetMinZoom().scale;
constraints.mMaxZoom.scale = aViewportInfo.GetMaxZoom().scale; constraints.mMaxZoom.scale = aViewportInfo.GetMaxZoom().scale;

Просмотреть файл

@ -758,7 +758,7 @@ bool nsLayoutUtils::AllowZoomingForDocument(
// True if we allow zooming for all documents on this platform, or if we are // True if we allow zooming for all documents on this platform, or if we are
// in RDM and handling meta viewports, which force zoom under some // in RDM and handling meta viewports, which force zoom under some
// circumstances. // circumstances.
return StaticPrefs::APZAllowZooming() || return StaticPrefs::apz_allow_zooming() ||
(aDocument && aDocument->InRDMPane() && (aDocument && aDocument->InRDMPane() &&
nsLayoutUtils::ShouldHandleMetaViewport(aDocument)); nsLayoutUtils::ShouldHandleMetaViewport(aDocument));
} }
@ -1050,7 +1050,7 @@ bool nsLayoutUtils::ShouldDisableApzForElement(nsIContent* aContent) {
if (!doc) { if (!doc) {
return false; return false;
} }
return StaticPrefs::APZDisableForScrollLinkedEffects() && return StaticPrefs::apz_disable_for_scroll_linked_effects() &&
doc->HasScrollLinkedEffect(); doc->HasScrollLinkedEffect();
} }
@ -9253,7 +9253,7 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
aScrollFrame ? aScrollFrame : aForFrame, isRootContentDocRootScrollFrame, aScrollFrame ? aScrollFrame : aForFrame, isRootContentDocRootScrollFrame,
metrics)); metrics));
if (StaticPrefs::APZPrintTree() || StaticPrefs::apz_test_logging_enabled()) { if (StaticPrefs::apz_printtree() || StaticPrefs::apz_test_logging_enabled()) {
if (nsIContent* content = if (nsIContent* content =
frameForCompositionBoundsCalculation->GetContent()) { frameForCompositionBoundsCalculation->GetContent()) {
nsAutoString contentDescription; nsAutoString contentDescription;

Просмотреть файл

@ -1866,7 +1866,7 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) {
// We want to process any pending APZ metrics ahead of their positions // We want to process any pending APZ metrics ahead of their positions
// in the queue. This will prevent us from spending precious time // in the queue. This will prevent us from spending precious time
// painting a stale displayport. // painting a stale displayport.
if (StaticPrefs::APZPeekMessages()) { if (StaticPrefs::apz_peek_messages_enabled()) {
nsLayoutUtils::UpdateDisplayPortMarginsFromPendingMessages(); nsLayoutUtils::UpdateDisplayPortMarginsFromPendingMessages();
} }

Просмотреть файл

@ -24,7 +24,7 @@ void ScrollVelocityQueue::Sample(const nsPoint& aScrollPosition) {
mAccumulator = nsPoint(); mAccumulator = nsPoint();
} else { } else {
uint32_t durationMs = (currentRefreshTime - mSampleTime).ToMilliseconds(); uint32_t durationMs = (currentRefreshTime - mSampleTime).ToMilliseconds();
if (durationMs > StaticPrefs::APZVelocityRelevanceTime()) { if (durationMs > StaticPrefs::apz_velocity_relevance_time_ms()) {
mAccumulator = nsPoint(); mAccumulator = nsPoint();
mQueue.Clear(); mQueue.Clear();
} else if (durationMs == 0) { } else if (durationMs == 0) {
@ -54,7 +54,7 @@ void ScrollVelocityQueue::TrimQueue() {
uint32_t timeDelta = (currentRefreshTime - mSampleTime).ToMilliseconds(); uint32_t timeDelta = (currentRefreshTime - mSampleTime).ToMilliseconds();
for (int i = mQueue.Length() - 1; i >= 0; i--) { for (int i = mQueue.Length() - 1; i >= 0; i--) {
timeDelta += mQueue[i].first; timeDelta += mQueue[i].first;
if (timeDelta >= StaticPrefs::APZVelocityRelevanceTime()) { if (timeDelta >= StaticPrefs::apz_velocity_relevance_time_ms()) {
// The rest of the samples have expired and should be dropped // The rest of the samples have expired and should be dropped
for (; i >= 0; i--) { for (; i >= 0; i--) {
mQueue.RemoveElementAt(0); mQueue.RemoveElementAt(0);

Просмотреть файл

@ -2467,7 +2467,7 @@ void ScrollFrameHelper::ResetDisplayPortExpiryTimer() {
if (mDisplayPortExpiryTimer) { if (mDisplayPortExpiryTimer) {
mDisplayPortExpiryTimer->InitWithNamedFuncCallback( mDisplayPortExpiryTimer->InitWithNamedFuncCallback(
RemoveDisplayPortCallback, this, RemoveDisplayPortCallback, this,
StaticPrefs::APZDisplayPortExpiryTime(), nsITimer::TYPE_ONE_SHOT, StaticPrefs::apz_displayport_expiry_ms(), nsITimer::TYPE_ONE_SHOT,
"ScrollFrameHelper::ResetDisplayPortExpiryTimer"); "ScrollFrameHelper::ResetDisplayPortExpiryTimer");
} }
} }
@ -2487,7 +2487,7 @@ void ScrollFrameHelper::TriggerDisplayPortExpiration() {
return; return;
} }
if (!StaticPrefs::APZDisplayPortExpiryTime()) { if (!StaticPrefs::apz_displayport_expiry_ms()) {
// a zero time disables the expiry // a zero time disables the expiry
return; return;
} }
@ -2803,7 +2803,7 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange,
bool schedulePaint = true; bool schedulePaint = true;
if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter) && if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter) &&
!nsLayoutUtils::ShouldDisableApzForElement(content) && !nsLayoutUtils::ShouldDisableApzForElement(content) &&
StaticPrefs::APZPaintSkipping()) { StaticPrefs::apz_paint_skipping_enabled()) {
// If APZ is enabled with paint-skipping, there are certain conditions in // If APZ is enabled with paint-skipping, there are certain conditions in
// which we can skip paints: // which we can skip paints:
// 1) If APZ triggered this scroll, and the tile-aligned displayport is // 1) If APZ triggered this scroll, and the tile-aligned displayport is
@ -2838,7 +2838,7 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange,
bool haveScrollLinkedEffects = bool haveScrollLinkedEffects =
content->GetComposedDoc()->HasScrollLinkedEffect(); content->GetComposedDoc()->HasScrollLinkedEffect();
bool apzDisabled = haveScrollLinkedEffects && bool apzDisabled = haveScrollLinkedEffects &&
StaticPrefs::APZDisableForScrollLinkedEffects(); StaticPrefs::apz_disable_for_scroll_linked_effects();
if (!apzDisabled && !HasPluginFrames()) { if (!apzDisabled && !HasPluginFrames()) {
if (LastScrollOrigin() == nsGkAtoms::apz) { if (LastScrollOrigin() == nsGkAtoms::apz) {
schedulePaint = false; schedulePaint = false;

Просмотреть файл

@ -1145,7 +1145,7 @@ nsRect nsDisplayListBuilder::OutOfFlowDisplayData::ComputeVisibleRectForFrame(
nsRect visible = aVisibleRect; nsRect visible = aVisibleRect;
nsRect dirtyRectRelativeToDirtyFrame = aDirtyRect; nsRect dirtyRectRelativeToDirtyFrame = aDirtyRect;
if (StaticPrefs::APZAllowZooming() && if (StaticPrefs::apz_allow_zooming() &&
nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) && nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
aBuilder->IsPaintingToWindow()) { aBuilder->IsPaintingToWindow()) {
dirtyRectRelativeToDirtyFrame = dirtyRectRelativeToDirtyFrame =

Просмотреть файл

@ -163,6 +163,7 @@ whitelist-vars = [
"mozilla::detail::gGkAtoms", "mozilla::detail::gGkAtoms",
"mozilla::detail::kGkAtomsArrayOffset", "mozilla::detail::kGkAtomsArrayOffset",
"mozilla::profiler::detail::RacyFeatures::sActiveAndFeatures", "mozilla::profiler::detail::RacyFeatures::sActiveAndFeatures",
"mozilla::StaticPrefs::.*",
] ]
# TODO(emilio): A bunch of types here can go away once we generate bindings and # TODO(emilio): A bunch of types here can go away once we generate bindings and
# structs together. # structs together.

Просмотреть файл

@ -103,7 +103,7 @@
using namespace mozilla; using namespace mozilla;
using mozilla::ipc::FileDescriptor; using ipc::FileDescriptor;
#ifdef DEBUG #ifdef DEBUG
@ -890,7 +890,7 @@ class Pref {
}; };
struct PrefHasher { struct PrefHasher {
using Key = mozilla::UniquePtr<Pref>; using Key = UniquePtr<Pref>;
using Lookup = const char*; using Lookup = const char*;
static HashNumber hash(const Lookup& aLookup) { return HashString(aLookup); } static HashNumber hash(const Lookup& aLookup) { return HashString(aLookup); }
@ -1194,7 +1194,7 @@ class CallbackNode {
uintptr_t mNextAndMatchKind; uintptr_t mNextAndMatchKind;
}; };
using PrefsHashTable = mozilla::HashSet<mozilla::UniquePtr<Pref>, PrefHasher>; using PrefsHashTable = HashSet<UniquePtr<Pref>, PrefHasher>;
static PrefsHashTable* gHashTable; static PrefsHashTable* gHashTable;
@ -1509,7 +1509,7 @@ static bool gContentProcessPrefsAreInited = false;
#endif // DEBUG #endif // DEBUG
static Pref* pref_HashTableLookup(const char* aPrefName) { static Pref* pref_HashTableLookup(const char* aPrefName) {
MOZ_ASSERT(NS_IsMainThread() || mozilla::ServoStyleSet::IsInServoTraversal()); MOZ_ASSERT(NS_IsMainThread() || ServoStyleSet::IsInServoTraversal());
MOZ_ASSERT_IF(!XRE_IsParentProcess(), gContentProcessPrefsAreInited); MOZ_ASSERT_IF(!XRE_IsParentProcess(), gContentProcessPrefsAreInited);
@ -1538,7 +1538,7 @@ Maybe<PrefWrapper> pref_SharedLookup(const char* aPrefName) {
Maybe<PrefWrapper> pref_Lookup(const char* aPrefName, Maybe<PrefWrapper> pref_Lookup(const char* aPrefName,
bool aIncludeTypeNone = false) { bool aIncludeTypeNone = false) {
MOZ_ASSERT(NS_IsMainThread() || mozilla::ServoStyleSet::IsInServoTraversal()); MOZ_ASSERT(NS_IsMainThread() || ServoStyleSet::IsInServoTraversal());
AddAccessCount(aPrefName); AddAccessCount(aPrefName);
@ -1866,8 +1866,8 @@ class PrefCallback : public PLDHashEntryHdr {
static const PrefCallback* KeyToPointer(PrefCallback* aKey) { return aKey; } static const PrefCallback* KeyToPointer(PrefCallback* aKey) { return aKey; }
static PLDHashNumber HashKey(const PrefCallback* aKey) { static PLDHashNumber HashKey(const PrefCallback* aKey) {
uint32_t hash = mozilla::HashString(aKey->mDomain); uint32_t hash = HashString(aKey->mDomain);
return mozilla::AddToHash(hash, aKey->mCanonical); return AddToHash(hash, aKey->mCanonical);
} }
public: public:
@ -2005,7 +2005,7 @@ class nsPrefBranch final : public nsIPrefBranch,
private: private:
// Helper class for either returning a raw cstring or nsCString. // Helper class for either returning a raw cstring or nsCString.
typedef mozilla::Variant<const char*, const nsCString> PrefNameBase; typedef Variant<const char*, const nsCString> PrefNameBase;
class PrefName : public PrefNameBase { class PrefName : public PrefNameBase {
public: public:
explicit PrefName(const char* aName) : PrefNameBase(aName) {} explicit PrefName(const char* aName) : PrefNameBase(aName) {}
@ -2104,8 +2104,7 @@ nsPrefBranch::nsPrefBranch(const char* aPrefRoot, PrefValueKind aKind)
mKind(aKind), mKind(aKind),
mFreeingObserverList(false), mFreeingObserverList(false),
mObservers() { mObservers() {
nsCOMPtr<nsIObserverService> observerService = nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
mozilla::services::GetObserverService();
if (observerService) { if (observerService) {
++mRefCnt; // must be > 0 when we call this, or we'll get deleted! ++mRefCnt; // must be > 0 when we call this, or we'll get deleted!
@ -2804,8 +2803,7 @@ void nsPrefBranch::FreeObserverList() {
iter.Remove(); iter.Remove();
} }
nsCOMPtr<nsIObserverService> observerService = nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
mozilla::services::GetObserverService();
if (observerService) { if (observerService) {
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
} }
@ -2830,7 +2828,7 @@ nsresult nsPrefBranch::GetDefaultFromPropertiesFile(const char* aPrefName,
} }
nsCOMPtr<nsIStringBundleService> bundleService = nsCOMPtr<nsIStringBundleService> bundleService =
mozilla::services::GetStringBundleService(); services::GetStringBundleService();
if (!bundleService) { if (!bundleService) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -2938,7 +2936,7 @@ void Preferences::HandleDirty() {
sPreferences->mSavePending = true; sPreferences->mSavePending = true;
static const int PREF_DELAY_MS = 500; static const int PREF_DELAY_MS = 500;
NS_DelayedDispatchToCurrentThread( NS_DelayedDispatchToCurrentThread(
mozilla::NewRunnableMethod("Preferences::SavePrefFileAsynchronous", NewRunnableMethod("Preferences::SavePrefFileAsynchronous",
sPreferences.get(), sPreferences.get(),
&Preferences::SavePrefFileAsynchronous), &Preferences::SavePrefFileAsynchronous),
PREF_DELAY_MS); PREF_DELAY_MS);
@ -3074,7 +3072,7 @@ class PWRunnable : public Runnable {
NS_IMETHOD Run() override { NS_IMETHOD Run() override {
// If we get a nullptr on the exchange, it means that somebody // If we get a nullptr on the exchange, it means that somebody
// else has already processed the request, and we can just return. // else has already processed the request, and we can just return.
mozilla::UniquePtr<PrefSaveData> prefs( UniquePtr<PrefSaveData> prefs(
PreferencesWriter::sPendingWriteData.exchange(nullptr)); PreferencesWriter::sPendingWriteData.exchange(nullptr));
nsresult rv = NS_OK; nsresult rv = NS_OK;
if (prefs) { if (prefs) {
@ -3554,7 +3552,7 @@ already_AddRefed<Preferences> Preferences::GetInstanceForService() {
} }
nsCOMPtr<nsIObserverService> observerService = nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService(); services::GetObserverService();
if (!observerService) { if (!observerService) {
sPreferences = nullptr; sPreferences = nullptr;
gCacheDataDesc = "GetObserverService() failed (1)"; gCacheDataDesc = "GetObserverService() failed (1)";
@ -3599,7 +3597,7 @@ bool Preferences::IsServiceAvailable() { return !!sPreferences; }
/* static */ /* static */
bool Preferences::InitStaticMembers() { bool Preferences::InitStaticMembers() {
MOZ_ASSERT(NS_IsMainThread() || mozilla::ServoStyleSet::IsInServoTraversal()); MOZ_ASSERT(NS_IsMainThread() || ServoStyleSet::IsInServoTraversal());
if (MOZ_LIKELY(sPreferences)) { if (MOZ_LIKELY(sPreferences)) {
return true; return true;
@ -3705,6 +3703,16 @@ void Preferences::DeserializePreferences(char* aStr, size_t aPrefsLen) {
#endif #endif
} }
// Forward declarations.
namespace StaticPrefs {
static void InitAll(bool aIsStartup);
static void InitOncePrefs();
static void InitStaticPrefsFromShared();
static void RegisterOncePrefs(SharedPrefMapBuilder& aBuilder);
} // namespace StaticPrefs
/* static */ /* static */
FileDescriptor Preferences::EnsureSnapshot(size_t* aSize) { FileDescriptor Preferences::EnsureSnapshot(size_t* aSize) {
MOZ_ASSERT(XRE_IsParentProcess()); MOZ_ASSERT(XRE_IsParentProcess());
@ -4065,8 +4073,7 @@ Preferences::GetDirty(bool* aRetVal) {
} }
nsresult Preferences::NotifyServiceObservers(const char* aTopic) { nsresult Preferences::NotifyServiceObservers(const char* aTopic) {
nsCOMPtr<nsIObserverService> observerService = nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
mozilla::services::GetObserverService();
if (!observerService) { if (!observerService) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -4207,8 +4214,7 @@ nsresult Preferences::WritePrefFile(nsIFile* aFile, SaveMethod aSaveMethod) {
if (AllowOffMainThreadSave()) { if (AllowOffMainThreadSave()) {
nsresult rv = NS_OK; nsresult rv = NS_OK;
mozilla::UniquePtr<PrefSaveData> prefs = UniquePtr<PrefSaveData> prefs = MakeUnique<PrefSaveData>(pref_savePrefs());
MakeUnique<PrefSaveData>(pref_savePrefs());
// Put the newly constructed preference data into sPendingWriteData // Put the newly constructed preference data into sPendingWriteData
// for the next request to pick up // for the next request to pick up
@ -4487,13 +4493,24 @@ Result<Ok, const char*> Preferences::InitInitialObjects(bool aIsStartup) {
MOZ_DIAGNOSTIC_ASSERT(gSharedMap); MOZ_DIAGNOSTIC_ASSERT(gSharedMap);
#ifdef DEBUG #ifdef DEBUG
// Check that all varcache preferences match their current values. This // For a VarCache pref like this:
// can currently fail if the default value of a static varcache preference //
// is changed in a preference file or at runtime, rather than in // VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
// StaticPrefList.h. //
// StaticPrefs with a Skip policy aren't updated with an overridden value, // we generate checking code like this:
// and shouldn't be checked. //
// MOZ_ASSERT(StaticPrefs::UpdatePolicy::$POLICY ==
// StaticPrefs::UpdatePolicy::Skip ||
// PreferencesInternalMethods::GetPref<int32_t>(name, value) ==
// StaticPrefs::my_pref(),
// "Incorrect cached value for my.pref");
//
// This checks that all VarCache preferences match their current values.
// This can currently fail if the default value of a static VarCache
// preference is changed in a preference file or at runtime, rather than in
// StaticPrefList_*.h. StaticPrefs with a Skip policy aren't updated with
// an overridden value, and shouldn't be checked.
//
# define PREF(name, cpp_type, value) # define PREF(name, cpp_type, value)
# define VARCACHE_PREF(policy, name, id, cpp_type, value) \ # define VARCACHE_PREF(policy, name, id, cpp_type, value) \
MOZ_ASSERT(StaticPrefs::UpdatePolicy::policy == \ MOZ_ASSERT(StaticPrefs::UpdatePolicy::policy == \
@ -4544,8 +4561,7 @@ Result<Ok, const char*> Preferences::InitInitialObjects(bool aIsStartup) {
const char* entryName; const char* entryName;
uint16_t entryNameLen; uint16_t entryNameLen;
RefPtr<nsZipArchive> jarReader = RefPtr<nsZipArchive> jarReader = Omnijar::GetReader(Omnijar::GRE);
mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE);
if (jarReader) { if (jarReader) {
#ifdef MOZ_WIDGET_ANDROID #ifdef MOZ_WIDGET_ANDROID
// Try to load an architecture-specific greprefs.js first. This will be // Try to load an architecture-specific greprefs.js first. This will be
@ -4629,13 +4645,12 @@ Result<Ok, const char*> Preferences::InitInitialObjects(bool aIsStartup) {
// Load jar:$app/omni.jar!/defaults/preferences/*.js // Load jar:$app/omni.jar!/defaults/preferences/*.js
// or jar:$gre/omni.jar!/defaults/preferences/*.js. // or jar:$gre/omni.jar!/defaults/preferences/*.js.
RefPtr<nsZipArchive> appJarReader = RefPtr<nsZipArchive> appJarReader = Omnijar::GetReader(Omnijar::APP);
mozilla::Omnijar::GetReader(mozilla::Omnijar::APP);
// GetReader(mozilla::Omnijar::APP) returns null when `$app == $gre`, in // GetReader(Omnijar::APP) returns null when `$app == $gre`, in
// which case we look for app-specific default preferences in $gre. // which case we look for app-specific default preferences in $gre.
if (!appJarReader) { if (!appJarReader) {
appJarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE); appJarReader = Omnijar::GetReader(Omnijar::GRE);
} }
if (appJarReader) { if (appJarReader) {
@ -4689,8 +4704,7 @@ Result<Ok, const char*> Preferences::InitInitialObjects(bool aIsStartup) {
NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, nullptr, NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, nullptr,
NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID); NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID);
nsCOMPtr<nsIObserverService> observerService = nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
mozilla::services::GetObserverService();
NS_ENSURE_SUCCESS(rv, Err("GetObserverService() failed (2)")); NS_ENSURE_SUCCESS(rv, Err("GetObserverService() failed (2)"));
observerService->NotifyObservers(nullptr, NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, observerService->NotifyObservers(nullptr, NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
@ -5395,8 +5409,9 @@ static void InitVarCachePref(StaticPrefs::UpdatePolicy aPolicy,
static Atomic<bool> sOncePrefRead(false); static Atomic<bool> sOncePrefRead(false);
static StaticMutex sOncePrefMutex; static StaticMutex sOncePrefMutex;
/* static */ namespace StaticPrefs {
void StaticPrefs::MaybeInitOncePrefs() {
void MaybeInitOncePrefs() {
if (MOZ_LIKELY(sOncePrefRead)) { if (MOZ_LIKELY(sOncePrefRead)) {
// `Once` StaticPrefs have already been initialized to their default value. // `Once` StaticPrefs have already been initialized to their default value.
return; return;
@ -5408,48 +5423,42 @@ void StaticPrefs::MaybeInitOncePrefs() {
RefPtr<Runnable> runnable = NS_NewRunnableFunction( RefPtr<Runnable> runnable = NS_NewRunnableFunction(
"Preferences::MaybeInitOncePrefs", [&]() { InitOncePrefs(); }); "Preferences::MaybeInitOncePrefs", [&]() { InitOncePrefs(); });
// This logic needs to run on the main thread // This logic needs to run on the main thread
mozilla::SyncRunnable::DispatchToThread( SyncRunnable::DispatchToThread(
SystemGroup::EventTargetFor(mozilla::TaskCategory::Other), runnable); SystemGroup::EventTargetFor(TaskCategory::Other), runnable);
} }
sOncePrefRead = true; sOncePrefRead = true;
} }
// For a VarCache pref like this: // For a pref like this:
// //
// VARCACHE_PREF(Once, "my.varcache", my_varcache, int32_t, 99) // VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
// //
// we generate a static variable definition and a setter like: // we generate a variable definition like this:
//
// int32_t sVarCache_my_pref(99);
// //
// int32_t StaticPrefs::sVarCache_my_varcache(99);
// int32_t StaticPrefs::my_varcache() {
// if (UpdatePolicy::Skip != UpdatePolicy::Once) {
// return sVarCache_myvarcache;
// }
// MaybeInitOncePrefs();
// return sVarCache_myvarcache;
// }
#define PREF(name, cpp_type, value) #define PREF(name, cpp_type, value)
#define VARCACHE_PREF(policy, name, id, cpp_type, default_value) \ #define VARCACHE_PREF(policy, name, id, cpp_type, default_value) \
cpp_type StaticPrefs::sVarCache_##id(default_value); cpp_type sVarCache_##id(default_value);
#include "mozilla/StaticPrefList.h" #include "mozilla/StaticPrefList.h"
#undef PREF #undef PREF
#undef VARCACHE_PREF #undef VARCACHE_PREF
/* static */ static void InitAll(bool aIsStartup) {
void StaticPrefs::InitAll(bool aIsStartup) { bool isParent = XRE_IsParentProcess();
// For prefs like these: // For prefs like these:
// //
// PREF("foo.bar.baz", bool, true) // PREF("foo.bar.baz", bool, true)
// VARCACHE_PREF(Live, "my.varcache", my_varcache, int32_t, 99) // VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
// //
// we generate registration calls: // we generate registration calls like this:
// //
// if (isParent) // if (isParent) {
// SetPref_bool("foo.bar.baz", true); // SetPref_bool("foo.bar.baz", true);
// InitVarCachePref(StaticPrefs::UpdatePolicy::Live, "my.varcache", // }
// &StaticPrefs::sVarCache_my_varcache, 99, aIsStartup, // InitVarCachePref(UpdatePolicy::Live, "my.pref", &sVarCache_my_pref,
// isParent); // 99, aIsStartup, isParent);
// //
// The SetPref_*() functions have a type suffix to avoid ambiguity between // The SetPref_*() functions have a type suffix to avoid ambiguity between
// prefs having int32_t and float default values. That suffix is not needed // prefs having int32_t and float default values. That suffix is not needed
@ -5458,30 +5467,27 @@ void StaticPrefs::InitAll(bool aIsStartup) {
// //
// In content processes, we rely on the parent to send us the correct initial // In content processes, we rely on the parent to send us the correct initial
// values via shared memory, so we do not re-initialize them here. // values via shared memory, so we do not re-initialize them here.
bool isParent = XRE_IsParentProcess();
#define PREF(name, cpp_type, value) \ #define PREF(name, cpp_type, value) \
if (isParent) SetPref_##cpp_type(name, value); if (isParent) { \
SetPref_##cpp_type(name, value); \
}
#define VARCACHE_PREF(policy, name, id, cpp_type, value) \ #define VARCACHE_PREF(policy, name, id, cpp_type, value) \
InitVarCachePref(StaticPrefs::UpdatePolicy::policy, \ InitVarCachePref(UpdatePolicy::policy, NS_LITERAL_CSTRING(name), \
NS_LITERAL_CSTRING(name), &StaticPrefs::sVarCache_##id, \ &sVarCache_##id, value, aIsStartup, isParent);
value, aIsStartup, isParent);
#include "mozilla/StaticPrefList.h" #include "mozilla/StaticPrefList.h"
#undef PREF #undef PREF
#undef VARCACHE_PREF #undef VARCACHE_PREF
} }
/* static */ static void InitOncePrefs() {
void StaticPrefs::InitOncePrefs() { // For a pref like this:
// For prefs like these:
// //
// VARCACHE_PREF(Skip, "my.varcache", my_varcache, int32_t, 99) // VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
// //
// we generate registration calls: // we generate an initialization (in a non-DEBUG build) like this:
// //
// if (UpdatePolicy::Skip == UpdatePolicy::Once) { // if (UpdatePolicy::$POLICY == UpdatePolicy::Once) {
// StaticPrefs::sVarCache_my_varcache = // sVarCache_my_pref = PreferencesInternalMethods::GetPref("my.pref", 99);
// PreferencesInternalMethods::GetPref("my.varcache",
// StripAtomic<int32_t>(99));
// } // }
// //
// This is done to get the potentially updated Preference value as we didn't // This is done to get the potentially updated Preference value as we didn't
@ -5491,19 +5497,19 @@ void StaticPrefs::InitOncePrefs() {
// original Preference is being modified once `Once` StaticPrefs have been // original Preference is being modified once `Once` StaticPrefs have been
// initialized as this would indicate a likely misuse of `Once` StaticPrefs // initialized as this would indicate a likely misuse of `Once` StaticPrefs
// and that maybe instead they should have been made `Live`. // and that maybe instead they should have been made `Live`.
//
#define PREF(name, cpp_type, value) #define PREF(name, cpp_type, value)
#ifdef DEBUG #ifdef DEBUG
# define VARCACHE_PREF(policy, name, id, cpp_type, value) \ # define VARCACHE_PREF(policy, name, id, cpp_type, value) \
if (UpdatePolicy::policy == UpdatePolicy::Once) { \ if (UpdatePolicy::policy == UpdatePolicy::Once) { \
MOZ_ASSERT(gOnceStaticPrefsAntiFootgun); \ MOZ_ASSERT(gOnceStaticPrefsAntiFootgun); \
StaticPrefs::sVarCache_##id = PreferencesInternalMethods::GetPref( \ sVarCache_##id = PreferencesInternalMethods::GetPref( \
name, StripAtomic<cpp_type>(value)); \ name, StripAtomic<cpp_type>(value)); \
auto checkPref = [&]() { \ auto checkPref = [&]() { \
MOZ_ASSERT(sOncePrefRead); \ MOZ_ASSERT(sOncePrefRead); \
StripAtomic<cpp_type> staticPrefValue = StaticPrefs::id(); \ StripAtomic<cpp_type> staticPrefValue = id(); \
StripAtomic<cpp_type> preferenceValue = \ StripAtomic<cpp_type> preferenceValue = \
PreferencesInternalMethods::GetPref( \ PreferencesInternalMethods::GetPref(Get##id##PrefName(), \
StaticPrefs::Get##id##PrefName(), \
StripAtomic<cpp_type>(value)); \ StripAtomic<cpp_type>(value)); \
MOZ_ASSERT( \ MOZ_ASSERT( \
staticPrefValue == preferenceValue, \ staticPrefValue == preferenceValue, \
@ -5517,7 +5523,7 @@ void StaticPrefs::InitOncePrefs() {
#else #else
# define VARCACHE_PREF(policy, name, id, cpp_type, value) \ # define VARCACHE_PREF(policy, name, id, cpp_type, value) \
if (UpdatePolicy::policy == UpdatePolicy::Once) { \ if (UpdatePolicy::policy == UpdatePolicy::Once) { \
StaticPrefs::sVarCache_##id = PreferencesInternalMethods::GetPref( \ sVarCache_##id = PreferencesInternalMethods::GetPref( \
name, StripAtomic<cpp_type>(value)); \ name, StripAtomic<cpp_type>(value)); \
} }
#endif #endif
@ -5527,6 +5533,8 @@ void StaticPrefs::InitOncePrefs() {
#undef VARCACHE_PREF #undef VARCACHE_PREF
} }
} // namespace StaticPrefs
static MOZ_MAYBE_UNUSED void SaveOncePrefToSharedMap( static MOZ_MAYBE_UNUSED void SaveOncePrefToSharedMap(
SharedPrefMapBuilder& aBuilder, const char* aName, bool aValue) { SharedPrefMapBuilder& aBuilder, const char* aName, bool aValue) {
auto oncePref = MakeUnique<Pref>(aName); auto oncePref = MakeUnique<Pref>(aName);
@ -5578,22 +5586,23 @@ static MOZ_MAYBE_UNUSED void SaveOncePrefToSharedMap(
#define ONCE_PREF_NAME(name) ("$$$" name "$$$") #define ONCE_PREF_NAME(name) ("$$$" name "$$$")
/* static */ namespace StaticPrefs {
void StaticPrefs::RegisterOncePrefs(SharedPrefMapBuilder& aBuilder) {
static void RegisterOncePrefs(SharedPrefMapBuilder& aBuilder) {
MOZ_ASSERT(XRE_IsParentProcess()); MOZ_ASSERT(XRE_IsParentProcess());
MOZ_DIAGNOSTIC_ASSERT(!gSharedMap, MOZ_DIAGNOSTIC_ASSERT(!gSharedMap,
"Must be called before gSharedMap has been created"); "Must be called before gSharedMap has been created");
MaybeInitOncePrefs(); MaybeInitOncePrefs();
// For prefs like these:
// For a pref like this:
// //
// VARCACHE_PREF(Once, "my.varcache", my_varcache, int32_t, 99) // VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
// (Other StaticPrefs policies are ignored)
// //
// we generate registration calls: // we generate a save call like this:
// //
// if (UpdatePolicy::Once == UpdatePolicy::Once) { // if (UpdatePolicy::$POLICY == UpdatePolicy::Once) {
// SaveOncePrefToSharedMap(aBuilder, ONCE_PREF_NAME(my.varcache), // SaveOncePrefToSharedMap(aBuilder, ONCE_PREF_NAME(my.pref),
// sVarCache_myvarcache); // sVarCache_my_pref);
// } // }
// //
// `Once` StaticPrefs values will be stored in a hidden and locked preferences // `Once` StaticPrefs values will be stored in a hidden and locked preferences
@ -5601,7 +5610,7 @@ void StaticPrefs::RegisterOncePrefs(SharedPrefMapBuilder& aBuilder) {
// hidden and not appear in about:config nor ever be stored to disk, we add // hidden and not appear in about:config nor ever be stored to disk, we add
// the "$$$" prefix and suffix to the preference name and set the IsVisible // the "$$$" prefix and suffix to the preference name and set the IsVisible
// flag to false. // flag to false.
//
#define PREF(name, cpp_type, value) #define PREF(name, cpp_type, value)
#define VARCACHE_PREF(policy, name, id, cpp_type, value) \ #define VARCACHE_PREF(policy, name, id, cpp_type, value) \
if (UpdatePolicy::policy == UpdatePolicy::Once) { \ if (UpdatePolicy::policy == UpdatePolicy::Once) { \
@ -5613,32 +5622,30 @@ void StaticPrefs::RegisterOncePrefs(SharedPrefMapBuilder& aBuilder) {
#undef VARCACHE_PREF #undef VARCACHE_PREF
} }
/* static */ static void InitStaticPrefsFromShared() {
void StaticPrefs::InitStaticPrefsFromShared() {
MOZ_ASSERT(!XRE_IsParentProcess()); MOZ_ASSERT(!XRE_IsParentProcess());
MOZ_DIAGNOSTIC_ASSERT(gSharedMap, MOZ_DIAGNOSTIC_ASSERT(gSharedMap,
"Must be called once gSharedMap has been created"); "Must be called once gSharedMap has been created");
// For prefs like these:
// For a prefs like this:
// //
// VARCACHE_PREF(Once, "my.varcache", my_varcache, int32_t, 99) // VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
// (Other StaticPrefs policies are ignored).
// //
// we generate registration calls: // we generate an initialization like this:
// //
// if (UpdatePolicy::Once != UpdatePolicy::Skip) { // if (UpdatePolicy::$POLICY != UpdatePolicy::Skip) {
// int32_t val; // int32_t val;
// nsresult rv; // nsresult rv;
// if (UpdatePolicy::Once == UpdatePolicy::Once) { // if (UpdatePolicy::$POLICY == UpdatePolicy::Once) {
// rv = PreferencesInternalMethods::GetSharedPrefValue( // rv = PreferencesInternalMethods::GetSharedPrefValue(
// "$$$my.varcache$$$", &val); // "$$$my.pref$$$", &val);
// } else if (UpdatePolicy::Once == UpdatePolicy::Live) { // } else if (UpdatePolicy::Once == UpdatePolicy::Live) {
// rv = PreferencesInternalMethods::GetSharedPrefValue( // rv = PreferencesInternalMethods::GetSharedPrefValue("my.pref", &val);
// "my.varcache", &val);
// } // }
// MOZ_DIAGNOSTIC_ALWAYS_TRUE(NS_SUCCEEDED(rv)); // MOZ_DIAGNOSTIC_ALWAYS_TRUE(NS_SUCCEEDED(rv));
// StaticPrefs::sVarCache_my_varcache = val; // sVarCache_my_pref = val;
// } // }
//
#define PREF(name, cpp_type, value) #define PREF(name, cpp_type, value)
#define VARCACHE_PREF(policy, name, id, cpp_type, value) \ #define VARCACHE_PREF(policy, name, id, cpp_type, value) \
if (UpdatePolicy::policy != UpdatePolicy::Skip) { \ if (UpdatePolicy::policy != UpdatePolicy::Skip) { \
@ -5656,12 +5663,15 @@ void StaticPrefs::InitStaticPrefsFromShared() {
#include "mozilla/StaticPrefList.h" #include "mozilla/StaticPrefList.h"
#undef PREF #undef PREF
#undef VARCACHE_PREF #undef VARCACHE_PREF
// `Once` StaticPrefs have been set to their value in the step above and // `Once` StaticPrefs have been set to their value in the step above and
// outside the parent process they are immutable. So we set sOncePrefRead // outside the parent process they are immutable. So we set sOncePrefRead
// so that we can directly skip any lazy initializations. // so that we can directly skip any lazy initializations.
sOncePrefRead = true; sOncePrefRead = true;
} }
} // namespace StaticPrefs
} // namespace mozilla } // namespace mozilla
#undef ENSURE_PARENT_PROCESS #undef ENSURE_PARENT_PROCESS

Просмотреть файл

@ -69,26 +69,8 @@ struct IsAtomic<Atomic<T, Order>> : TrueType {};
template <typename T> template <typename T>
struct IsAtomic<std::atomic<T>> : TrueType {}; struct IsAtomic<std::atomic<T>> : TrueType {};
class StaticPrefs { namespace StaticPrefs {
// For a VarCache pref like this:
//
// VARCACHE_PREF("my.varcache", my_varcache, int32_t, 99)
//
// we generate a static variable declaration, a getter and a setter
// definition. A StaticPref can be set by using the corresponding Set method.
// For example, if the accessor is Foo() then calling SetFoo(...) will update
// the preference and also change the return value of subsequent Foo() calls.
// Changing StaticPrefs is only allowed on the parent process' main thread.
//
// private:
// static int32_t sVarCache_my_varcache;
// public:
// static int32_t my_varcache();
// static const char* Getmy_varcachePrefName() { return "my.varcache"; }
// static int32_t Getmy_varcachePrefDefault() { return 99; }
//
public:
// Enums for the update policy. // Enums for the update policy.
enum class UpdatePolicy { enum class UpdatePolicy {
Skip, // Set the value to default, skip any Preferences calls. Skip, // Set the value to default, skip any Preferences calls.
@ -96,39 +78,52 @@ class StaticPrefs {
Live // Evaluate the preference and set callback so it stays current/live. Live // Evaluate the preference and set callback so it stays current/live.
}; };
#define PREF(str, cpp_type, default_value) void MaybeInitOncePrefs();
#define VARCACHE_PREF(policy, str, id, cpp_type, default_value) \
private: \ // For a VarCache pref like this:
static cpp_type sVarCache_##id; \ //
\ // VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
public: \ //
static StripAtomic<cpp_type> id() { \ // we generate an extern variable declaration and three getter
// declarations/definitions.
//
// extern int32_t sVarCache_my_pref;
// inline int32_t my_pref() {
// if (UpdatePolicy::$POLICY != UpdatePolicy::Once) {
// return sVarCache_my_pref;
// }
// MaybeInitOncePrefs();
// return sVarCache_my_pref();
// }
// inline const char* Getmy_prefPrefName() { return "my.pref"; }
// inline int32_t Getmy_prefPrefDefault() { return 99; }
//
// The extern declaration of the variable is necessary for bindgen to see it
// and generate Rust bindings.
//
#define PREF(name, cpp_type, default_value)
#define VARCACHE_PREF(policy, name, id, cpp_type, default_value) \
extern cpp_type sVarCache_##id; \
inline StripAtomic<cpp_type> id() { \
if (UpdatePolicy::policy != UpdatePolicy::Once) { \ if (UpdatePolicy::policy != UpdatePolicy::Once) { \
MOZ_DIAGNOSTIC_ASSERT( \ MOZ_DIAGNOSTIC_ASSERT( \
UpdatePolicy::policy == UpdatePolicy::Skip || \ UpdatePolicy::policy == UpdatePolicy::Skip || \
IsAtomic<cpp_type>::value || NS_IsMainThread(), \ IsAtomic<cpp_type>::value || NS_IsMainThread(), \
"Non-atomic static pref '" str \ "Non-atomic static pref '" name \
"' being accessed on background thread by getter"); \ "' being accessed on background thread by getter"); \
return sVarCache_##id; \ return sVarCache_##id; \
} \ } \
MaybeInitOncePrefs(); \ MaybeInitOncePrefs(); \
return sVarCache_##id; \ return sVarCache_##id; \
} \ } \
static const char* Get##id##PrefName() { return str; } \ inline const char* Get##id##PrefName() { return name; } \
static StripAtomic<cpp_type> Get##id##PrefDefault() { return default_value; } inline StripAtomic<cpp_type> Get##id##PrefDefault() { return default_value; }
#include "mozilla/StaticPrefList.h" #include "mozilla/StaticPrefList.h"
#undef PREF #undef PREF
#undef VARCACHE_PREF #undef VARCACHE_PREF
private: } // namespace StaticPrefs
friend class Preferences;
static void InitAll(bool aIsStartup);
static void MaybeInitOncePrefs();
static void InitOncePrefs();
static void InitStaticPrefsFromShared();
static void RegisterOncePrefs(SharedPrefMapBuilder& aBuilder);
};
} // namespace mozilla } // namespace mozilla

Просмотреть файл

@ -60,7 +60,7 @@
// VARCACHE_PREF( // VARCACHE_PREF(
// <update-policy>, // <update-policy>,
// <pref-name-string>, // <pref-name-string>,
// <pref-name-id>, // <pref-name-id>, // indented one space to align with <pref-name-string>
// <cpp-type>, <default-value> // <cpp-type>, <default-value>
// ) // )
// //
@ -124,7 +124,7 @@ VARCACHE_PREF(
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"accessibility.browsewithcaret", "accessibility.browsewithcaret",
AccessibilityBrowseWithCaret, accessibility_browsewithcaret,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
@ -136,273 +136,273 @@ VARCACHE_PREF(
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.allow_double_tap_zooming", "apz.allow_double_tap_zooming",
APZAllowDoubleTapZooming, apz_allow_double_tap_zooming,
RelaxedAtomicBool, true RelaxedAtomicBool, true
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.allow_immediate_handoff", "apz.allow_immediate_handoff",
APZAllowImmediateHandoff, apz_allow_immediate_handoff,
RelaxedAtomicBool, true RelaxedAtomicBool, true
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.allow_zooming", "apz.allow_zooming",
APZAllowZooming, apz_allow_zooming,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.android.chrome_fling_physics.enabled", "apz.android.chrome_fling_physics.enabled",
APZUseChromeFlingPhysics, apz_android_chrome_fling_physics_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.android.chrome_fling_physics.friction", "apz.android.chrome_fling_physics.friction",
APZChromeFlingPhysicsFriction, apz_android_chrome_fling_physics_friction,
AtomicFloat, 0.015f AtomicFloat, 0.015f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.android.chrome_fling_physics.inflexion", "apz.android.chrome_fling_physics.inflexion",
APZChromeFlingPhysicsInflexion, apz_android_chrome_fling_physics_inflexion,
AtomicFloat, 0.35f AtomicFloat, 0.35f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.android.chrome_fling_physics.stop_threshold", "apz.android.chrome_fling_physics.stop_threshold",
APZChromeFlingPhysicsStopThreshold, apz_android_chrome_fling_physics_stop_threshold,
AtomicFloat, 0.1f AtomicFloat, 0.1f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.autoscroll.enabled", "apz.autoscroll.enabled",
APZAutoscrollEnabled, apz_autoscroll_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.axis_lock.breakout_angle", "apz.axis_lock.breakout_angle",
APZAxisBreakoutAngle, apz_axis_lock_breakout_angle,
AtomicFloat, float(M_PI / 8.0) /* 22.5 degrees */ AtomicFloat, float(M_PI / 8.0) /* 22.5 degrees */
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.axis_lock.breakout_threshold", "apz.axis_lock.breakout_threshold",
APZAxisBreakoutThreshold, apz_axis_lock_breakout_threshold,
AtomicFloat, 1.0f / 32.0f AtomicFloat, 1.0f / 32.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.axis_lock.direct_pan_angle", "apz.axis_lock.direct_pan_angle",
APZAllowedDirectPanAngle, apz_axis_lock_direct_pan_angle,
AtomicFloat, float(M_PI / 3.0) /* 60 degrees */ AtomicFloat, float(M_PI / 3.0) /* 60 degrees */
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.axis_lock.lock_angle", "apz.axis_lock.lock_angle",
APZAxisLockAngle, apz_axis_lock_lock_angle,
AtomicFloat, float(M_PI / 6.0) /* 30 degrees */ AtomicFloat, float(M_PI / 6.0) /* 30 degrees */
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.axis_lock.mode", "apz.axis_lock.mode",
APZAxisLockMode, apz_axis_lock_mode,
RelaxedAtomicInt32, 0 RelaxedAtomicInt32, 0
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.content_response_timeout", "apz.content_response_timeout",
APZContentResponseTimeout, apz_content_response_timeout,
RelaxedAtomicInt32, 400 RelaxedAtomicInt32, 400
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.danger_zone_x", "apz.danger_zone_x",
APZDangerZoneX, apz_danger_zone_x,
RelaxedAtomicInt32, 50 RelaxedAtomicInt32, 50
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.danger_zone_y", "apz.danger_zone_y",
APZDangerZoneY, apz_danger_zone_y,
RelaxedAtomicInt32, 100 RelaxedAtomicInt32, 100
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.disable_for_scroll_linked_effects", "apz.disable_for_scroll_linked_effects",
APZDisableForScrollLinkedEffects, apz_disable_for_scroll_linked_effects,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.displayport_expiry_ms", "apz.displayport_expiry_ms",
APZDisplayPortExpiryTime, apz_displayport_expiry_ms,
RelaxedAtomicUint32, 15000 RelaxedAtomicUint32, 15000
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.drag.enabled", "apz.drag.enabled",
APZDragEnabled, apz_drag_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.drag.initial.enabled", "apz.drag.initial.enabled",
APZDragInitiationEnabled, apz_drag_initial_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.drag.touch.enabled", "apz.drag.touch.enabled",
APZTouchDragEnabled, apz_touch_drag_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.enlarge_displayport_when_clipped", "apz.enlarge_displayport_when_clipped",
APZEnlargeDisplayPortWhenClipped, apz_enlarge_displayport_when_clipped,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fixed-margin-override.enabled", "apz.fixed-margin-override.enabled",
APZFixedMarginOverrideEnabled, apz_fixed_margin_override_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fixed-margin-override.bottom", "apz.fixed-margin-override.bottom",
APZFixedMarginOverrideBottom, apz_fixed_margin_override_bottom,
RelaxedAtomicInt32, 0 RelaxedAtomicInt32, 0
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fixed-margin-override.top", "apz.fixed-margin-override.top",
APZFixedMarginOverrideTop, apz_fixed_margin_override_top,
RelaxedAtomicInt32, 0 RelaxedAtomicInt32, 0
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fling_accel_base_mult", "apz.fling_accel_base_mult",
APZFlingAccelBaseMultiplier, apz_fling_accel_base_mult,
AtomicFloat, 1.0f AtomicFloat, 1.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fling_accel_interval_ms", "apz.fling_accel_interval_ms",
APZFlingAccelInterval, apz_fling_accel_interval_ms,
RelaxedAtomicInt32, 500 RelaxedAtomicInt32, 500
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fling_accel_supplemental_mult", "apz.fling_accel_supplemental_mult",
APZFlingAccelSupplementalMultiplier, apz_fling_accel_supplemental_mult,
AtomicFloat, 1.0f AtomicFloat, 1.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fling_accel_min_velocity", "apz.fling_accel_min_velocity",
APZFlingAccelMinVelocity, apz_fling_accel_min_velocity,
AtomicFloat, 1.5f AtomicFloat, 1.5f
) )
VARCACHE_PREF( VARCACHE_PREF(
Once, Once,
"apz.fling_curve_function_x1", "apz.fling_curve_function_x1",
APZCurveFunctionX1, apz_fling_curve_function_x1,
float, 0.0f float, 0.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Once, Once,
"apz.fling_curve_function_x2", "apz.fling_curve_function_x2",
APZCurveFunctionX2, apz_fling_curve_function_x2,
float, 1.0f float, 1.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Once, Once,
"apz.fling_curve_function_y1", "apz.fling_curve_function_y1",
APZCurveFunctionY1, apz_fling_curve_function_y1,
float, 0.0f float, 0.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Once, Once,
"apz.fling_curve_function_y2", "apz.fling_curve_function_y2",
APZCurveFunctionY2, apz_fling_curve_function_y2,
float, 1.0f float, 1.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fling_curve_threshold_inches_per_ms", "apz.fling_curve_threshold_inches_per_ms",
APZCurveThreshold, apz_fling_curve_threshold_inches_per_ms,
AtomicFloat, -1.0f AtomicFloat, -1.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fling_friction", "apz.fling_friction",
APZFlingFriction, apz_fling_friction,
AtomicFloat, 0.002f AtomicFloat, 0.002f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fling_min_velocity_threshold", "apz.fling_min_velocity_threshold",
APZFlingMinVelocityThreshold, apz_fling_min_velocity_threshold,
AtomicFloat, 0.5f AtomicFloat, 0.5f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fling_stop_on_tap_threshold", "apz.fling_stop_on_tap_threshold",
APZFlingStopOnTapThreshold, apz_fling_stop_on_tap_threshold,
AtomicFloat, 0.05f AtomicFloat, 0.05f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.fling_stopped_threshold", "apz.fling_stopped_threshold",
APZFlingStoppedThreshold, apz_fling_stopped_threshold,
AtomicFloat, 0.01f AtomicFloat, 0.01f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.frame_delay.enabled", "apz.frame_delay.enabled",
APZFrameDelayEnabled, apz_frame_delay_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
@ -410,7 +410,7 @@ VARCACHE_PREF(
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.gtk.kinetic_scroll.enabled", "apz.gtk.kinetic_scroll.enabled",
APZGTKKineticScrollEnabled, apz_gtk_kinetic_scroll_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
#endif #endif
@ -423,7 +423,7 @@ VARCACHE_PREF(
VARCACHE_PREF( VARCACHE_PREF(
Once, Once,
"apz.keyboard.enabled", "apz.keyboard.enabled",
APZKeyboardEnabled, apz_keyboard_enabled,
bool, PREF_VALUE bool, PREF_VALUE
) )
#undef PREF_VALUE #undef PREF_VALUE
@ -431,161 +431,161 @@ VARCACHE_PREF(
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.keyboard.passive-listeners", "apz.keyboard.passive-listeners",
APZKeyboardPassiveListeners, apz_keyboard_passive_listeners,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.max_tap_time", "apz.max_tap_time",
APZMaxTapTime, apz_max_tap_time,
RelaxedAtomicInt32, 300 RelaxedAtomicInt32, 300
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.max_velocity_inches_per_ms", "apz.max_velocity_inches_per_ms",
APZMaxVelocity, apz_max_velocity_inches_per_ms,
AtomicFloat, -1.0f AtomicFloat, -1.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Once, Once,
"apz.max_velocity_queue_size", "apz.max_velocity_queue_size",
APZMaxVelocityQueueSize, apz_max_velocity_queue_size,
uint32_t, 5 uint32_t, 5
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.min_skate_speed", "apz.min_skate_speed",
APZMinSkateSpeed, apz_min_skate_speed,
AtomicFloat, 1.0f AtomicFloat, 1.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.minimap.enabled", "apz.minimap.enabled",
APZMinimap, apz_minimap_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.one_touch_pinch.enabled", "apz.one_touch_pinch.enabled",
APZOneTouchPinchEnabled, apz_one_touch_pinch_enabled,
RelaxedAtomicBool, true RelaxedAtomicBool, true
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.overscroll.enabled", "apz.overscroll.enabled",
APZOverscrollEnabled, apz_overscroll_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.overscroll.min_pan_distance_ratio", "apz.overscroll.min_pan_distance_ratio",
APZMinPanDistanceRatio, apz_overscroll_min_pan_distance_ratio,
AtomicFloat, 1.0f AtomicFloat, 1.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.overscroll.spring_stiffness", "apz.overscroll.spring_stiffness",
APZOverscrollSpringStiffness, apz_overscroll_spring_stiffness,
AtomicFloat, 0.001f AtomicFloat, 0.001f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.overscroll.stop_distance_threshold", "apz.overscroll.stop_distance_threshold",
APZOverscrollStopDistanceThreshold, apz_overscroll_stop_distance_threshold,
AtomicFloat, 5.0f AtomicFloat, 5.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.paint_skipping.enabled", "apz.paint_skipping.enabled",
APZPaintSkipping, apz_paint_skipping_enabled,
RelaxedAtomicBool, true RelaxedAtomicBool, true
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.peek_messages.enabled", "apz.peek_messages.enabled",
APZPeekMessages, apz_peek_messages_enabled,
RelaxedAtomicBool, true RelaxedAtomicBool, true
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.pinch_lock.mode", "apz.pinch_lock.mode",
APZPinchLockMode, apz_pinch_lock_mode,
RelaxedAtomicInt32, 1 RelaxedAtomicInt32, 1
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.pinch_lock.scroll_lock_threshold", "apz.pinch_lock.scroll_lock_threshold",
APZPinchLockScrollLockThreshold, apz_pinch_lock_scroll_lock_threshold,
AtomicFloat, 1.0f / 32.0f AtomicFloat, 1.0f / 32.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.pinch_lock.span_breakout_threshold", "apz.pinch_lock.span_breakout_threshold",
APZPinchLockSpanBreakoutThreshold, apz_pinch_lock_span_breakout_threshold,
AtomicFloat, 1.0f / 32.0f AtomicFloat, 1.0f / 32.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.pinch_lock.span_lock_threshold", "apz.pinch_lock.span_lock_threshold",
APZPinchLockSpanLockThreshold, apz_pinch_lock_span_lock_threshold,
AtomicFloat, 1.0f / 32.0f AtomicFloat, 1.0f / 32.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Once, Once,
"apz.pinch_lock.buffer_max_age", "apz.pinch_lock.buffer_max_age",
APZPinchLockBufferMaxAge, apz_pinch_lock_buffer_max_age,
int32_t, 50 // milliseconds int32_t, 50 // milliseconds
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.popups.enabled", "apz.popups.enabled",
APZPopupsEnabled, apz_popups_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.printtree", "apz.printtree",
APZPrintTree, apz_printtree,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.record_checkerboarding", "apz.record_checkerboarding",
APZRecordCheckerboarding, apz_record_checkerboarding,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.second_tap_tolerance", "apz.second_tap_tolerance",
APZSecondTapTolerance, apz_second_tap_tolerance,
AtomicFloat, 0.5f AtomicFloat, 0.5f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.test.fails_with_native_injection", "apz.test.fails_with_native_injection",
APZTestFailsWithNativeInjection, apz_test_fails_with_native_injection,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
@ -599,110 +599,94 @@ VARCACHE_PREF(
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.touch_move_tolerance", "apz.touch_move_tolerance",
APZTouchMoveTolerance, apz_touch_move_tolerance,
AtomicFloat, 0.1f AtomicFloat, 0.1f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.touch_start_tolerance", "apz.touch_start_tolerance",
APZTouchStartTolerance, apz_touch_start_tolerance,
AtomicFloat, 1.0f/4.5f AtomicFloat, 1.0f/4.5f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.velocity_bias", "apz.velocity_bias",
APZVelocityBias, apz_velocity_bias,
AtomicFloat, 0.0f AtomicFloat, 0.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.velocity_relevance_time_ms", "apz.velocity_relevance_time_ms",
APZVelocityRelevanceTime, apz_velocity_relevance_time_ms,
RelaxedAtomicUint32, 150 RelaxedAtomicUint32, 150
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.x_skate_highmem_adjust", "apz.x_skate_highmem_adjust",
APZXSkateHighMemAdjust, apz_x_skate_highmem_adjust,
AtomicFloat, 0.0f AtomicFloat, 0.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.x_skate_size_multiplier", "apz.x_skate_size_multiplier",
APZXSkateSizeMultiplier, apz_x_skate_size_multiplier,
AtomicFloat, 1.5f AtomicFloat, 1.5f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.x_stationary_size_multiplier", "apz.x_stationary_size_multiplier",
APZXStationarySizeMultiplier, apz_x_stationary_size_multiplier,
AtomicFloat, 3.0f AtomicFloat, 3.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.y_skate_highmem_adjust", "apz.y_skate_highmem_adjust",
APZYSkateHighMemAdjust, apz_y_skate_highmem_adjust,
AtomicFloat, 0.0f AtomicFloat, 0.0f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.y_skate_size_multiplier", "apz.y_skate_size_multiplier",
APZYSkateSizeMultiplier, apz_y_skate_size_multiplier,
AtomicFloat, 2.5f AtomicFloat, 2.5f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.y_stationary_size_multiplier", "apz.y_stationary_size_multiplier",
APZYStationarySizeMultiplier, apz_y_stationary_size_multiplier,
AtomicFloat, 3.5f AtomicFloat, 3.5f
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.zoom_animation_duration_ms", "apz.zoom_animation_duration_ms",
APZZoomAnimationDuration, apz_zoom_animation_duration_ms,
RelaxedAtomicInt32, 250 RelaxedAtomicInt32, 250
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.scale_repaint_delay_ms", "apz.scale_repaint_delay_ms",
APZScaleRepaintDelay, apz_scale_repaint_delay_ms,
RelaxedAtomicInt32, 500 RelaxedAtomicInt32, 500
) )
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
"apz.relative-update.enabled", "apz.relative-update.enabled",
APZRelativeUpdate, apz_relative_update_enabled,
RelaxedAtomicBool, false RelaxedAtomicBool, false
) )
VARCACHE_PREF(
Live,
"full-screen-api.mouse-event-allow-left-button-only",
full_screen_api_mouse_event_allow_left_button_only,
bool, true
)
// When this pref is set, parent documents may consider child iframes've loaded
// while they are still loading
VARCACHE_PREF(
Live,
"dom.cross_origin_iframes_loaded_in_background",
dom_cross_origin_iframes_loaded_in_background,
bool, false
)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Prefs starting with "beacon." // Prefs starting with "beacon."
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -2648,6 +2632,15 @@ VARCACHE_PREF(
bool, false bool, false
) )
// When this pref is set, parent documents may consider child iframes have
// loaded while they are still loading.
VARCACHE_PREF(
Live,
"dom.cross_origin_iframes_loaded_in_background",
dom_cross_origin_iframes_loaded_in_background,
bool, false
)
// Is support for Navigator.geolocation enabled? // Is support for Navigator.geolocation enabled?
VARCACHE_PREF( VARCACHE_PREF(
Live, Live,
@ -2736,6 +2729,13 @@ VARCACHE_PREF(
bool, true bool, true
) )
VARCACHE_PREF(
Live,
"full-screen-api.mouse-event-allow-left-button-only",
full_screen_api_mouse_event_allow_left_button_only,
bool, true
)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Prefs starting with "fuzzing.". It's important that these can only be // Prefs starting with "fuzzing.". It's important that these can only be
// checked in fuzzing builds (when FUZZING is defined), otherwise you could // checked in fuzzing builds (when FUZZING is defined), otherwise you could

Просмотреть файл

@ -416,13 +416,13 @@ macro_rules! is_descriptor_enabled {
("font-display") => { ("font-display") => {
unsafe { unsafe {
use crate::gecko_bindings::structs::mozilla; use crate::gecko_bindings::structs::mozilla;
mozilla::StaticPrefs_sVarCache_layout_css_font_display_enabled mozilla::StaticPrefs::sVarCache_layout_css_font_display_enabled
} }
}; };
("font-variation-settings") => { ("font-variation-settings") => {
unsafe { unsafe {
use crate::gecko_bindings::structs::mozilla; use crate::gecko_bindings::structs::mozilla;
mozilla::StaticPrefs_sVarCache_layout_css_font_variations_enabled != 0 mozilla::StaticPrefs::sVarCache_layout_css_font_variations_enabled != 0
} }
}; };
($name:tt) => { ($name:tt) => {

Просмотреть файл

@ -271,7 +271,7 @@ impl Device {
return true; return true;
} }
let document_color_use = let document_color_use =
unsafe { structs::StaticPrefs_sVarCache_browser_display_document_color_use }; unsafe { structs::StaticPrefs::sVarCache_browser_display_document_color_use };
let prefs = self.pref_sheet_prefs(); let prefs = self.pref_sheet_prefs();
match document_color_use { match document_color_use {
1 => true, 1 => true,

Просмотреть файл

@ -112,7 +112,7 @@ impl PseudoElement {
% for pseudo in PSEUDOS: % for pseudo in PSEUDOS:
${pseudo_element_variant(pseudo)} => ${pseudo_element_variant(pseudo)} =>
% if pseudo.is_tree_pseudo_element(): % if pseudo.is_tree_pseudo_element():
if unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_tree_pseudos_content_enabled } { if unsafe { structs::StaticPrefs::sVarCache_layout_css_xul_tree_pseudos_content_enabled } {
0 0
} else { } else {
structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME
@ -210,7 +210,7 @@ impl PseudoElement {
return PseudoElement::tree_pseudo_element(name, Box::new([])) return PseudoElement::tree_pseudo_element(name, Box::new([]))
} }
if unsafe { if unsafe {
structs::StaticPrefs_sVarCache_layout_css_unknown_webkit_pseudo_element structs::StaticPrefs::sVarCache_layout_css_unknown_webkit_pseudo_element
} { } {
const WEBKIT_PREFIX: &str = "-webkit-"; const WEBKIT_PREFIX: &str = "-webkit-";
if starts_with_ignore_ascii_case(name, WEBKIT_PREFIX) { if starts_with_ignore_ascii_case(name, WEBKIT_PREFIX) {

Просмотреть файл

@ -175,7 +175,7 @@ impl NonTSPseudoClass {
// For pseudo-classes with pref, the availability in content // For pseudo-classes with pref, the availability in content
// depends on the pref. // depends on the pref.
NonTSPseudoClass::Fullscreen => unsafe { NonTSPseudoClass::Fullscreen => unsafe {
mozilla::StaticPrefs_sVarCache_full_screen_api_unprefix_enabled mozilla::StaticPrefs::sVarCache_full_screen_api_unprefix_enabled
}, },
// Otherwise, a pseudo-class is enabled in content when it // Otherwise, a pseudo-class is enabled in content when it
// doesn't have any enabled flag. // doesn't have any enabled flag.
@ -355,7 +355,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
#[inline] #[inline]
fn parse_part(&self) -> bool { fn parse_part(&self) -> bool {
self.chrome_rules_enabled() || self.chrome_rules_enabled() ||
unsafe { structs::StaticPrefs_sVarCache_layout_css_shadow_parts_enabled } unsafe { structs::StaticPrefs::sVarCache_layout_css_shadow_parts_enabled }
} }
fn parse_non_ts_pseudo_class( fn parse_non_ts_pseudo_class(

Просмотреть файл

@ -302,7 +302,7 @@ impl MediaFeatureExpression {
feature_name = &feature_name[8..]; feature_name = &feature_name[8..];
requirements.insert(ParsingRequirements::WEBKIT_PREFIX); requirements.insert(ParsingRequirements::WEBKIT_PREFIX);
if unsafe { if unsafe {
structs::StaticPrefs_sVarCache_layout_css_prefixes_device_pixel_ratio_webkit structs::StaticPrefs::sVarCache_layout_css_prefixes_device_pixel_ratio_webkit
} { } {
requirements.insert( requirements.insert(
ParsingRequirements::WEBKIT_DEVICE_PIXEL_RATIO_PREF_ENABLED, ParsingRequirements::WEBKIT_DEVICE_PIXEL_RATIO_PREF_ENABLED,

Просмотреть файл

@ -686,7 +686,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
return; return;
} }
let use_document_fonts = unsafe { structs::StaticPrefs_sVarCache_browser_display_use_document_fonts != 0 }; let use_document_fonts = unsafe { structs::StaticPrefs::sVarCache_browser_display_use_document_fonts != 0 };
let builder = &mut self.context.builder; let builder = &mut self.context.builder;
let (default_font_type, prioritize_user_fonts) = { let (default_font_type, prioritize_user_fonts) = {
let font = builder.get_font().gecko(); let font = builder.get_font().gecko();

Просмотреть файл

@ -260,12 +260,12 @@ impl DocumentCondition {
return true; return true;
} }
if unsafe { structs::StaticPrefs_sVarCache_layout_css_moz_document_content_enabled } { if unsafe { structs::StaticPrefs::sVarCache_layout_css_moz_document_content_enabled } {
return true; return true;
} }
if !unsafe { if !unsafe {
structs::StaticPrefs_sVarCache_layout_css_moz_document_url_prefix_hack_enabled structs::StaticPrefs::sVarCache_layout_css_moz_document_url_prefix_hack_enabled
} { } {
return false; return false;
} }

Просмотреть файл

@ -324,7 +324,7 @@ impl RawSelector {
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
{ {
if unsafe { if unsafe {
!crate::gecko_bindings::structs::StaticPrefs_sVarCache_layout_css_supports_selector_enabled !crate::gecko_bindings::structs::StaticPrefs::sVarCache_layout_css_supports_selector_enabled
} { } {
return false; return false;
} }

Просмотреть файл

@ -70,7 +70,7 @@ pub enum TimingKeyword {
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
fn step_position_jump_enabled(_context: &ParserContext) -> bool { fn step_position_jump_enabled(_context: &ParserContext) -> bool {
use crate::gecko_bindings::structs; use crate::gecko_bindings::structs;
unsafe { structs::StaticPrefs_sVarCache_layout_css_step_position_jump_enabled } unsafe { structs::StaticPrefs::sVarCache_layout_css_step_position_jump_enabled }
} }
#[cfg(feature = "servo")] #[cfg(feature = "servo")]

Просмотреть файл

@ -75,7 +75,7 @@ fn line_height_moz_block_height_enabled(context: &ParserContext) -> bool {
use crate::gecko_bindings::structs; use crate::gecko_bindings::structs;
context.in_ua_sheet() || context.in_ua_sheet() ||
unsafe { unsafe {
structs::StaticPrefs_sVarCache_layout_css_line_height_moz_block_height_content_enabled structs::StaticPrefs::sVarCache_layout_css_line_height_moz_block_height_content_enabled
} }
} }

Просмотреть файл

@ -60,7 +60,7 @@ pub type Polygon = generic::GenericPolygon<LengthPercentage>;
fn is_clip_path_path_enabled(context: &ParserContext) -> bool { fn is_clip_path_path_enabled(context: &ParserContext) -> bool {
use crate::gecko_bindings::structs::mozilla; use crate::gecko_bindings::structs::mozilla;
context.chrome_rules_enabled() || context.chrome_rules_enabled() ||
unsafe { mozilla::StaticPrefs_sVarCache_layout_css_clip_path_path_enabled } unsafe { mozilla::StaticPrefs::sVarCache_layout_css_clip_path_path_enabled }
} }
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
fn is_clip_path_path_enabled(_: &ParserContext) -> bool { fn is_clip_path_path_enabled(_: &ParserContext) -> bool {

Просмотреть файл

@ -25,7 +25,7 @@ use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
fn moz_display_values_enabled(context: &ParserContext) -> bool { fn moz_display_values_enabled(context: &ParserContext) -> bool {
use crate::gecko_bindings::structs; use crate::gecko_bindings::structs;
context.in_ua_or_chrome_sheet() || context.in_ua_or_chrome_sheet() ||
unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_display_values_content_enabled } unsafe { structs::StaticPrefs::sVarCache_layout_css_xul_display_values_content_enabled }
} }
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
@ -33,7 +33,7 @@ fn moz_box_display_values_enabled(context: &ParserContext) -> bool {
use crate::gecko_bindings::structs; use crate::gecko_bindings::structs;
context.in_ua_or_chrome_sheet() || context.in_ua_or_chrome_sheet() ||
unsafe { unsafe {
structs::StaticPrefs_sVarCache_layout_css_xul_box_display_values_content_enabled structs::StaticPrefs::sVarCache_layout_css_xul_box_display_values_content_enabled
} }
} }

Просмотреть файл

@ -381,7 +381,7 @@ impl ToComputedValue for TrackList<LengthPercentage, Integer> {
#[inline] #[inline]
fn allow_grid_template_subgrids() -> bool { fn allow_grid_template_subgrids() -> bool {
use crate::gecko_bindings::structs::mozilla; use crate::gecko_bindings::structs::mozilla;
unsafe { mozilla::StaticPrefs_sVarCache_layout_css_grid_template_subgrid_value_enabled } unsafe { mozilla::StaticPrefs::sVarCache_layout_css_grid_template_subgrid_value_enabled }
} }
#[cfg(feature = "servo")] #[cfg(feature = "servo")]

Просмотреть файл

@ -36,7 +36,7 @@ pub type SVGStrokeDashArray = generic::SVGStrokeDashArray<NonNegativeLengthPerce
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub fn is_context_value_enabled() -> bool { pub fn is_context_value_enabled() -> bool {
use crate::gecko_bindings::structs::mozilla; use crate::gecko_bindings::structs::mozilla;
unsafe { mozilla::StaticPrefs_sVarCache_gfx_font_rendering_opentype_svg_enabled } unsafe { mozilla::StaticPrefs::sVarCache_gfx_font_rendering_opentype_svg_enabled }
} }
/// Whether the `context-value` value is enabled. /// Whether the `context-value` value is enabled.

Просмотреть файл

@ -9,6 +9,13 @@ Unreleased
### Added ### Added
- Added support for HTTP `HEAD` requests to the HTTPD
geckodriver now responds correctly to HTTP `HEAD` requests,
which can be used for probing whether it supports a particular API.
Thanks to [Bastien Orivel] for this patch.
- Added support for searching for Nightlys default path on macOS - Added support for searching for Nightlys default path on macOS
If the location of the Firefox binary is not given, geckodriver If the location of the Firefox binary is not given, geckodriver

Просмотреть файл

@ -1,5 +0,0 @@
[scroll-behavior-subframe-root.html]
[Subframe with auto scroll-behavior ; scroll() with smooth behavior]
expected:
if (os == "android") and not debug and e10s: FAIL

Просмотреть файл

@ -1,7 +1,4 @@
[unregister.https.html] [unregister.https.html]
disabled: disabled:
if (os == "android") and not e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=1499972 if (os == "android") and not e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=1499972
[Unregister twice]
expected:
if (os == "android") and not debug: FAIL

Просмотреть файл

@ -1,4 +1,5 @@
[enable_controls_reposition.html] [enable_controls_reposition.html]
disabled:
if (os == "android") and debug: intermittent crash, Bug 1553046
expected: expected:
if (os == "android") and debug: FAIL
FAIL FAIL

Просмотреть файл

@ -1,2 +1,4 @@
[line_integer_and_percent_mixed_overlap.html] [line_integer_and_percent_mixed_overlap.html]
disabled:
if (os == "android") and debug: intermittent crash, Bug 1553046
expected: FAIL expected: FAIL

Просмотреть файл

@ -1,2 +1,4 @@
[bold_timestamp_past.html] [bold_timestamp_past.html]
disabled:
if (os == "android") and debug: intermittent crash, Bug 1553046
expected: FAIL expected: FAIL

Просмотреть файл

@ -1,2 +1,4 @@
[bold_transition_with_timestamp.html] [bold_transition_with_timestamp.html]
disabled:
if (os == "android") and e10s and debug: intermittent crash, Bug 1553046
expected: FAIL expected: FAIL

Просмотреть файл

@ -2,5 +2,4 @@
disabled: disabled:
if (os == "android") and e10s and debug: intermittent crash, Bug 1553046 if (os == "android") and e10s and debug: intermittent crash, Bug 1553046
expected: expected:
if (os == "android") and debug: ERROR
FAIL FAIL

Просмотреть файл

@ -1,2 +1,4 @@
[class_text-decoration_line-through.html] [class_text-decoration_line-through.html]
disabled:
if (os == "android") and debug: intermittent crash, Bug 1553046
expected: FAIL expected: FAIL

Просмотреть файл

@ -1,2 +1,4 @@
[italic_font_properties.html] [italic_font_properties.html]
disabled:
if (os == "android") and debug: intermittent crash, Bug 1553046
expected: FAIL expected: FAIL

Просмотреть файл

@ -1,2 +1,4 @@
[italic_font_shorthand.html] [italic_font_shorthand.html]
disabled:
if (os == "android") and debug: intermittent crash, Bug 1553046
expected: FAIL expected: FAIL

Просмотреть файл

@ -1,2 +1,5 @@
[italic_transition_with_timestamp.html] [italic_transition_with_timestamp.html]
expected: FAIL disabled:
if (os == "android") and debug: intermittent crash, Bug 1553046
expected:
FAIL

Просмотреть файл

@ -1,2 +1,4 @@
[inherit_as_default_value_inherits_values_from_media_element.html] [inherit_as_default_value_inherits_values_from_media_element.html]
disabled:
if (os == "android") and debug: intermittent crash, Bug 1553046
expected: FAIL expected: FAIL

Просмотреть файл

@ -3575,7 +3575,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
} }
// FIXME: bug 1525793 -- this may need to handle zooming or not on a per-document basis. // FIXME: bug 1525793 -- this may need to handle zooming or not on a per-document basis.
if (StaticPrefs::APZAllowZooming()) { if (StaticPrefs::apz_allow_zooming()) {
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(anEvent, [self window]); NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(anEvent, [self window]);
ScreenPoint position = ScreenPoint position =
ViewAs<ScreenPixel>([self convertWindowCoordinatesRoundDown:locationInWindow], ViewAs<ScreenPixel>([self convertWindowCoordinatesRoundDown:locationInWindow],

Просмотреть файл

@ -3057,7 +3057,7 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) {
GdkDevice* device = gdk_event_get_source_device((GdkEvent*)aEvent); GdkDevice* device = gdk_event_get_source_device((GdkEvent*)aEvent);
GdkInputSource source = gdk_device_get_source(device); GdkInputSource source = gdk_device_get_source(device);
if (source == GDK_SOURCE_TOUCHSCREEN || source == GDK_SOURCE_TOUCHPAD) { if (source == GDK_SOURCE_TOUCHSCREEN || source == GDK_SOURCE_TOUCHPAD) {
if (StaticPrefs::APZGTKKineticScrollEnabled() && if (StaticPrefs::apz_gtk_kinetic_scroll_enabled() &&
gtk_check_version(3, 20, 0) == nullptr) { gtk_check_version(3, 20, 0) == nullptr) {
static auto sGdkEventIsScrollStopEvent = static auto sGdkEventIsScrollStopEvent =
(gboolean(*)(const GdkEvent*))dlsym( (gboolean(*)(const GdkEvent*))dlsym(

Просмотреть файл

@ -859,7 +859,7 @@ bool nsBaseWidget::UseAPZ() {
(WindowType() == eWindowType_toplevel || (WindowType() == eWindowType_toplevel ||
WindowType() == eWindowType_child || WindowType() == eWindowType_child ||
(WindowType() == eWindowType_popup && HasRemoteContent() && (WindowType() == eWindowType_popup && HasRemoteContent() &&
StaticPrefs::APZPopupsEnabled()))); StaticPrefs::apz_popups_enabled())));
} }
bool nsBaseWidget::AllowWebRenderForThisWindow() { bool nsBaseWidget::AllowWebRenderForThisWindow() {
@ -893,7 +893,7 @@ void nsBaseWidget::ConfigureAPZCTreeManager() {
NewRunnableMethod<float>("layers::IAPZCTreeManager::SetDPI", mAPZC, NewRunnableMethod<float>("layers::IAPZCTreeManager::SetDPI", mAPZC,
&IAPZCTreeManager::SetDPI, dpi)); &IAPZCTreeManager::SetDPI, dpi));
if (StaticPrefs::APZKeyboardEnabled()) { if (StaticPrefs::apz_keyboard_enabled()) {
KeyboardMap map = nsXBLWindowKeyHandler::CollectKeyboardShortcuts(); KeyboardMap map = nsXBLWindowKeyHandler::CollectKeyboardShortcuts();
// On Android the main thread is not the controller thread // On Android the main thread is not the controller thread
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<KeyboardMap>( APZThreadUtils::RunOnControllerThread(NewRunnableMethod<KeyboardMap>(

Просмотреть файл

@ -133,7 +133,8 @@ nsresult nsWindowBase::SynthesizeNativeTouchPoint(
uint32_t aPointerOrientation, nsIObserver* aObserver) { uint32_t aPointerOrientation, nsIObserver* aObserver) {
AutoObserverNotifier notifier(aObserver, "touchpoint"); AutoObserverNotifier notifier(aObserver, "touchpoint");
if (StaticPrefs::APZTestFailsWithNativeInjection() || !InitTouchInjection()) { if (StaticPrefs::apz_test_fails_with_native_injection() ||
!InitTouchInjection()) {
// If we don't have touch injection from the OS, or if we are running a test // If we don't have touch injection from the OS, or if we are running a test
// that cannot properly inject events to satisfy the OS requirements (see // that cannot properly inject events to satisfy the OS requirements (see
// bug 1313170) we can just fake it and synthesize the events from here. // bug 1313170) we can just fake it and synthesize the events from here.