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;
}
_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 } = {}) {
if (this.selection.isSlotted()) {
// Slotted elements should not show any context menu.
@ -648,29 +673,57 @@ class MarkupContextMenu {
type: "separator",
}));
// 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),
});
menu.append(new MenuItem({
id: "node-menu-useinconsole",
label: INSPECTOR_L10N.getStr("inspectorUseInConsole.label"),
click: () => this._useInConsole(),
}));
if (isSelectionElement) {
const checked = this.selection.nodeFront.hasPseudoClassLock(name);
menuitem.checked = checked;
} else {
menuitem.disabled = true;
}
menu.append(new MenuItem({
id: "node-menu-showdomproperties",
label: INSPECTOR_L10N.getStr("inspectorShowDOMProperties.label"),
click: () => this._showDOMProperties(),
}));
menu.append(menuitem);
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(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({
type: "separator",
}));
menu.append(new MenuItem({
label: INSPECTOR_L10N.getStr("inspectorCopyHTMLSubmenu.label"),
submenu: this._getCopySubmenu(markupContainer, isSelectionElement),
@ -700,49 +753,6 @@ class MarkupContextMenu {
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();
if (nodeLinkMenuItems.filter(item => item.visible).length > 0) {
menu.append(new MenuItem({

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

@ -290,6 +290,10 @@ inspectorAttributesSubmenu.accesskey=A
inspectorAddAttribute.label=Add Attribute
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
# shown as the placeholder for the markup view search in the inspector.
inspectorSearchHTML.label3=Search HTML

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

@ -139,6 +139,7 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 1,
#define GC_REQUEST_OBSERVER_TOPIC "child-gc-request"
#define CC_REQUEST_OBSERVER_TOPIC "child-cc-request"
#define MEMORY_PRESSURE_OBSERVER_TOPIC "memory-pressure"
#define MEMORY_PRESSURE_ONGOING_DATA "low-memory-ongoing"
#define BROADCAST_ALL_WORKERS(_func, ...) \
PR_BEGIN_MACRO \
@ -2199,9 +2200,13 @@ RuntimeService::Observe(nsISupports* aSubject, const char* aTopic,
return NS_OK;
}
if (!strcmp(aTopic, MEMORY_PRESSURE_OBSERVER_TOPIC)) {
GarbageCollectAllWorkers(/* shrinking = */ true);
CycleCollectAllWorkers();
MemoryPressureAllWorkers();
// 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);
CycleCollectAllWorkers();
MemoryPressureAllWorkers();
}
return NS_OK;
}
if (!strcmp(aTopic, NS_IOSERVICE_OFFLINE_STATUS_TOPIC)) {

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

@ -272,7 +272,7 @@ APZCTreeManager::APZCTreeManager(LayersId aRootLayersId)
"layers::APZCTreeManager::APZCTreeManager",
[self] { self->mFlushObserver = new CheckerboardFlushObserver(self); }));
AsyncPanZoomController::InitializeGlobalState();
mApzcTreeLog.ConditionOnPrefFunction(StaticPrefs::APZPrintTree);
mApzcTreeLog.ConditionOnPrefFunction(StaticPrefs::apz_printtree);
#if defined(MOZ_WIDGET_ANDROID)
if (jni::IsFennec()) {
mToolbarAnimator = new AndroidDynamicToolbarAnimator(this);
@ -606,7 +606,7 @@ void APZCTreeManager::UpdateFocusState(LayersId aRootLayerTreeId,
const FocusTarget& aFocusTarget) {
AssertOnUpdaterThread();
if (!StaticPrefs::APZKeyboardEnabled()) {
if (!StaticPrefs::apz_keyboard_enabled()) {
return;
}
@ -1319,7 +1319,7 @@ nsEventStatus APZCTreeManager::ReceiveInputEvent(
}
TargetConfirmationFlags confFlags{hitResult};
bool apzDragEnabled = StaticPrefs::APZDragEnabled();
bool apzDragEnabled = StaticPrefs::apz_drag_enabled();
if (apzDragEnabled && hitScrollbar) {
// If scrollbar dragging is enabled and we hit a scrollbar, wait
// for the main-thread confirmation because it contains drag metrics
@ -1544,8 +1544,8 @@ nsEventStatus APZCTreeManager::ReceiveInputEvent(
case KEYBOARD_INPUT: {
// Disable async keyboard scrolling when accessibility.browsewithcaret is
// enabled
if (!StaticPrefs::APZKeyboardEnabled() ||
StaticPrefs::AccessibilityBrowseWithCaret()) {
if (!StaticPrefs::apz_keyboard_enabled() ||
StaticPrefs::accessibility_browsewithcaret()) {
APZ_KEY_LOG("Skipping key input from invalid prefs\n");
return result;
}
@ -1741,8 +1741,9 @@ nsEventStatus APZCTreeManager::ProcessTouchInput(
// checked are similar to the ones we check for MOUSE_INPUT starting
// a scrollbar mouse-drag.
mInScrollbarTouchDrag =
StaticPrefs::APZDragEnabled() && StaticPrefs::APZTouchDragEnabled() &&
hitScrollbarNode && hitScrollbarNode->IsScrollThumbNode() &&
StaticPrefs::apz_drag_enabled() &&
StaticPrefs::apz_touch_drag_enabled() && hitScrollbarNode &&
hitScrollbarNode->IsScrollThumbNode() &&
hitScrollbarNode->GetScrollbarData().mThumbIsAsyncDraggable;
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.
// 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
aScrollThumbNode->GetScrollTargetId() == aApzc->GetGuid().mScrollId &&
!aApzc->IsScrollInfoLayer()) {
@ -2388,7 +2389,7 @@ ParentLayerPoint APZCTreeManager::DispatchFling(
AsyncPanZoomController* aPrev, const FlingHandoffState& aHandoffState) {
// If immediate handoff is disallowed, do not allow handoff beyond the
// 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) {
FLING_LOG("APZCTM dropping handoff due to disallowed immediate handoff\n");
return aHandoffState.mVelocity;

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

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

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

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

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

@ -33,7 +33,7 @@ const float kDecelerationRate = 2.3582018f;
// Default friction constant in android.view.ViewConfiguration.
static float GetFlingFriction() {
return StaticPrefs::APZChromeFlingPhysicsFriction();
return StaticPrefs::apz_android_chrome_fling_physics_friction();
}
// 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
// do not make sense in the physics model, and for negative values the
// 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) {
return 0.0f;
}
@ -54,7 +55,7 @@ static float GetInflexion() {
// Fling scroll is stopped when the scroll position is |kThresholdForFlingEnd|
// pixels or closer from the end.
static float GetThresholdForFlingEnd() {
return StaticPrefs::APZChromeFlingPhysicsStopThreshold();
return StaticPrefs::apz_android_chrome_fling_physics_stop_threshold();
}
static double ComputeSplineDeceleration(ParentLayerCoord aVelocity,

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

@ -251,7 +251,7 @@ Maybe<float> AndroidVelocityTracker::ComputeVelocity(uint32_t aTimestampMs) {
float time[kHistorySize];
uint32_t m = 0;
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];
do {

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

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

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

@ -25,8 +25,8 @@ class DesktopFlingPhysics {
}
void Sample(const TimeDuration& aDelta, ParentLayerPoint* aOutVelocity,
ParentLayerPoint* aOutOffset) {
float friction = StaticPrefs::APZFlingFriction();
float threshold = StaticPrefs::APZFlingStoppedThreshold();
float friction = StaticPrefs::apz_fling_friction();
float threshold = StaticPrefs::apz_fling_stopped_threshold();
mVelocity = ParentLayerPoint(
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
// the focus or selection of the page.
if (StaticPrefs::APZKeyboardPassiveListeners()) {
if (StaticPrefs::apz_keyboard_passive_listeners()) {
mFocusHasKeyEventListeners =
HasListenersForNonPassiveKeyEvents(keyEventTarget.get());
} else {

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

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

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

@ -291,13 +291,13 @@ nsEventStatus GestureEventListener::HandleInputTouchMove() {
// The user has performed a double tap, but not lifted her finger.
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.
if (MoveDistanceIsLarge()) {
CancelLongTapTimeoutTask();
CancelMaxTapTimeoutTask();
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-
// tap gesture instead.
SetState(GESTURE_NONE);
@ -629,7 +629,7 @@ void GestureEventListener::CreateMaxTapTimeoutTask() {
mMaxTapTimeoutTask = task;
mAsyncPanZoomController->PostDelayedTask(task.forget(),
StaticPrefs::APZMaxTapTime());
StaticPrefs::apz_max_tap_time());
}
} // namespace layers

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

@ -150,7 +150,7 @@ bool InputBlockState::IsDownchainOf(AsyncPanZoomController* aA,
void InputBlockState::SetScrolledApzc(AsyncPanZoomController* aApzc) {
// 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)
: mScrolledApzc == aApzc));
@ -783,8 +783,8 @@ Maybe<ScrollDirection> TouchBlockState::GetBestGuessPanDirection(
angle = fabs(angle); // range [0, pi]
double angleThreshold = TouchActionAllowsPanningXY()
? StaticPrefs::APZAxisLockAngle()
: StaticPrefs::APZAllowedDirectPanAngle();
? StaticPrefs::apz_axis_lock_lock_angle()
: StaticPrefs::apz_axis_lock_direct_pan_angle();
if (apz::IsCloseToHorizontal(angle, angleThreshold)) {
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.
// This is used in configurations where a single input block is only
// 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.
RefPtr<AsyncPanZoomController> mScrolledApzc;

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

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

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

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

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

@ -161,7 +161,8 @@ class APZCPinchLockingTester : public APZCPinchTester {
void twoFingerPan() {
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));
@ -174,7 +175,8 @@ class APZCPinchLockingTester : public APZCPinchTester {
void twoFingerZoom() {
float pinchDistance =
StaticPrefs::APZPinchLockSpanBreakoutThreshold() * 1.2 * tm->GetDPI();
StaticPrefs::apz_pinch_lock_span_breakout_threshold() * 1.2 *
tm->GetDPI();
float newSpan = mSpan + pinchDistance;
@ -191,7 +193,8 @@ class APZCPinchLockingTester : public APZCPinchTester {
// Send a small scale input to the APZC
float pinchDistance =
StaticPrefs::APZPinchLockSpanBreakoutThreshold() * 0.8 * tm->GetDPI();
StaticPrefs::apz_pinch_lock_span_breakout_threshold() * 0.8 *
tm->GetDPI();
apzc->ReceiveInputEvent(
CreatePinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE, mFocus,
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
// 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);
nsTArray<uint32_t> behaviors = {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);
// 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.
EXPECT_CALL(*mcc, NotifyPinchGesture(_, _, _, _)).Times(0);
@ -435,11 +438,11 @@ TEST_F(APZCPinchGestureDetectorTester, Pinch_APZZoom_Disabled) {
FrameMetrics originalMetrics = GetPinchableFrameMetrics();
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.
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.
EXPECT_CALL(*mcc,
NotifyPinchGesture(PinchGestureInput::PINCHGESTURE_START,
@ -474,11 +477,11 @@ TEST_F(APZCPinchGestureDetectorTester, Pinch_NoSpan) {
FrameMetrics originalMetrics = GetPinchableFrameMetrics();
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.
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.
EXPECT_CALL(*mcc,
NotifyPinchGesture(PinchGestureInput::PINCHGESTURE_START,

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

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

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

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

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

@ -229,9 +229,9 @@ bool SharedFrameMetricsHelper::AboutToCheckerboard(
CSSRect showing =
CSSRect(aCompositorMetrics.GetScrollOffset(),
aCompositorMetrics.CalculateBoundedCompositedSizeInCssPixels());
showing.Inflate(
LayerSize(StaticPrefs::APZDangerZoneX(), StaticPrefs::APZDangerZoneY()) /
aCompositorMetrics.LayersPixelsPerCSSPixel());
showing.Inflate(LayerSize(StaticPrefs::apz_danger_zone_x(),
StaticPrefs::apz_danger_zone_y()) /
aCompositorMetrics.LayersPixelsPerCSSPixel());
// Clamp both rects to the scrollable rect, because having either of those
// exceed the scrollable rect doesn't make sense, and could lead to false

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

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

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

@ -31,6 +31,10 @@ struct precache_output
#define ALIGN __attribute__(( aligned (16) ))
#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 {
float ALIGN matrix[3][4];
float *input_gamma_table_r;
@ -74,7 +78,7 @@ struct _qcms_transform {
struct precache_output *output_table_g;
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 {
@ -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 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,
const unsigned char *src,
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);
}
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);
}
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);
}
@ -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);
}
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);
}
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);
}

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

@ -4,63 +4,25 @@
*/
#include "gtest/gtest.h"
#include "gtest/MozGTestBench.h"
#include "gmock/gmock.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/SSE.h"
#include "mozilla/arm.h"
#include "qcms.h"
#include "qcmsint.h"
#include "transform_util.h"
const size_t allGBSize = 1 * 256 * 256 * 4;
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++;
}
}
}
#include <cmath>
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)
{
// 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);
}
using namespace mozilla;
TEST(GfxQcms, LutInverseCrash)
{
@ -174,3 +136,484 @@ TEST(GfxQcms, LutInverseNonMonotonic)
// 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',
]]
# 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')
LOCAL_INCLUDES += [

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

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

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

@ -382,7 +382,7 @@ bool TenuredCell::isInsideZone(JS::Zone* zone) const {
}
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()));
if (!JS::RuntimeHeapIsCollecting()) {
JS::UnmarkGrayGCThingRecursively(

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

@ -5246,7 +5246,7 @@ void GCRuntime::getNextSweepGroup() {
*
* 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
* 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
* singly-linked list of incoming gray pointers that is stored with each
* compartment.

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

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

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

@ -173,7 +173,7 @@ static mozilla::layers::ZoomConstraints ComputeZoomConstraintsFromViewportInfo(
constraints.mAllowZoom = aViewportInfo.IsZoomAllowed() &&
nsLayoutUtils::AllowZoomingForDocument(aDocument);
constraints.mAllowDoubleTapZoom =
constraints.mAllowZoom && StaticPrefs::APZAllowDoubleTapZooming();
constraints.mAllowZoom && StaticPrefs::apz_allow_double_tap_zooming();
if (constraints.mAllowZoom) {
constraints.mMinZoom.scale = aViewportInfo.GetMinZoom().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
// in RDM and handling meta viewports, which force zoom under some
// circumstances.
return StaticPrefs::APZAllowZooming() ||
return StaticPrefs::apz_allow_zooming() ||
(aDocument && aDocument->InRDMPane() &&
nsLayoutUtils::ShouldHandleMetaViewport(aDocument));
}
@ -1050,7 +1050,7 @@ bool nsLayoutUtils::ShouldDisableApzForElement(nsIContent* aContent) {
if (!doc) {
return false;
}
return StaticPrefs::APZDisableForScrollLinkedEffects() &&
return StaticPrefs::apz_disable_for_scroll_linked_effects() &&
doc->HasScrollLinkedEffect();
}
@ -9253,7 +9253,7 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
aScrollFrame ? aScrollFrame : aForFrame, isRootContentDocRootScrollFrame,
metrics));
if (StaticPrefs::APZPrintTree() || StaticPrefs::apz_test_logging_enabled()) {
if (StaticPrefs::apz_printtree() || StaticPrefs::apz_test_logging_enabled()) {
if (nsIContent* content =
frameForCompositionBoundsCalculation->GetContent()) {
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
// in the queue. This will prevent us from spending precious time
// painting a stale displayport.
if (StaticPrefs::APZPeekMessages()) {
if (StaticPrefs::apz_peek_messages_enabled()) {
nsLayoutUtils::UpdateDisplayPortMarginsFromPendingMessages();
}

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

@ -24,7 +24,7 @@ void ScrollVelocityQueue::Sample(const nsPoint& aScrollPosition) {
mAccumulator = nsPoint();
} else {
uint32_t durationMs = (currentRefreshTime - mSampleTime).ToMilliseconds();
if (durationMs > StaticPrefs::APZVelocityRelevanceTime()) {
if (durationMs > StaticPrefs::apz_velocity_relevance_time_ms()) {
mAccumulator = nsPoint();
mQueue.Clear();
} else if (durationMs == 0) {
@ -54,7 +54,7 @@ void ScrollVelocityQueue::TrimQueue() {
uint32_t timeDelta = (currentRefreshTime - mSampleTime).ToMilliseconds();
for (int i = mQueue.Length() - 1; i >= 0; i--) {
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
for (; i >= 0; i--) {
mQueue.RemoveElementAt(0);

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

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

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

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

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

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

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

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

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

@ -69,66 +69,61 @@ struct IsAtomic<Atomic<T, Order>> : TrueType {};
template <typename T>
struct IsAtomic<std::atomic<T>> : TrueType {};
class 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; }
//
namespace StaticPrefs {
public:
// Enums for the update policy.
enum class UpdatePolicy {
Skip, // Set the value to default, skip any Preferences calls.
Once, // Evaluate the preference once, unchanged during the session.
Live // Evaluate the preference and set callback so it stays current/live.
};
// Enums for the update policy.
enum class UpdatePolicy {
Skip, // Set the value to default, skip any Preferences calls.
Once, // Evaluate the preference once, unchanged during the session.
Live // Evaluate the preference and set callback so it stays current/live.
};
#define PREF(str, cpp_type, default_value)
#define VARCACHE_PREF(policy, str, id, cpp_type, default_value) \
private: \
static cpp_type sVarCache_##id; \
\
public: \
static StripAtomic<cpp_type> id() { \
if (UpdatePolicy::policy != UpdatePolicy::Once) { \
MOZ_DIAGNOSTIC_ASSERT( \
UpdatePolicy::policy == UpdatePolicy::Skip || \
IsAtomic<cpp_type>::value || NS_IsMainThread(), \
"Non-atomic static pref '" str \
"' being accessed on background thread by getter"); \
return sVarCache_##id; \
} \
MaybeInitOncePrefs(); \
return sVarCache_##id; \
} \
static const char* Get##id##PrefName() { return str; } \
static StripAtomic<cpp_type> Get##id##PrefDefault() { return default_value; }
void MaybeInitOncePrefs();
// For a VarCache pref like this:
//
// VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
//
// 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) { \
MOZ_DIAGNOSTIC_ASSERT( \
UpdatePolicy::policy == UpdatePolicy::Skip || \
IsAtomic<cpp_type>::value || NS_IsMainThread(), \
"Non-atomic static pref '" name \
"' being accessed on background thread by getter"); \
return sVarCache_##id; \
} \
MaybeInitOncePrefs(); \
return sVarCache_##id; \
} \
inline const char* Get##id##PrefName() { return name; } \
inline StripAtomic<cpp_type> Get##id##PrefDefault() { return default_value; }
#include "mozilla/StaticPrefList.h"
#undef PREF
#undef VARCACHE_PREF
private:
friend class Preferences;
static void InitAll(bool aIsStartup);
static void MaybeInitOncePrefs();
static void InitOncePrefs();
static void InitStaticPrefsFromShared();
static void RegisterOncePrefs(SharedPrefMapBuilder& aBuilder);
};
} // namespace StaticPrefs
} // namespace mozilla

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

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

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

@ -416,13 +416,13 @@ macro_rules! is_descriptor_enabled {
("font-display") => {
unsafe {
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") => {
unsafe {
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) => {

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

@ -271,7 +271,7 @@ impl Device {
return true;
}
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();
match document_color_use {
1 => true,

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

@ -112,7 +112,7 @@ impl PseudoElement {
% for pseudo in PSEUDOS:
${pseudo_element_variant(pseudo)} =>
% 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
} else {
structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME
@ -210,7 +210,7 @@ impl PseudoElement {
return PseudoElement::tree_pseudo_element(name, Box::new([]))
}
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-";
if starts_with_ignore_ascii_case(name, WEBKIT_PREFIX) {

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

@ -175,7 +175,7 @@ impl NonTSPseudoClass {
// For pseudo-classes with pref, the availability in content
// depends on the pref.
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
// doesn't have any enabled flag.
@ -355,7 +355,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
#[inline]
fn parse_part(&self) -> bool {
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(

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

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

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

@ -686,7 +686,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
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 (default_font_type, prioritize_user_fonts) = {
let font = builder.get_font().gecko();

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

@ -260,12 +260,12 @@ impl DocumentCondition {
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;
}
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;
}

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

@ -324,7 +324,7 @@ impl RawSelector {
#[cfg(feature = "gecko")]
{
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;
}

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

@ -70,7 +70,7 @@ pub enum TimingKeyword {
#[cfg(feature = "gecko")]
fn step_position_jump_enabled(_context: &ParserContext) -> bool {
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")]

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

@ -75,7 +75,7 @@ fn line_height_moz_block_height_enabled(context: &ParserContext) -> bool {
use crate::gecko_bindings::structs;
context.in_ua_sheet() ||
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 {
use crate::gecko_bindings::structs::mozilla;
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")]
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 {
use crate::gecko_bindings::structs;
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")]
@ -33,7 +33,7 @@ fn moz_box_display_values_enabled(context: &ParserContext) -> bool {
use crate::gecko_bindings::structs;
context.in_ua_or_chrome_sheet() ||
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]
fn allow_grid_template_subgrids() -> bool {
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")]

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

@ -36,7 +36,7 @@ pub type SVGStrokeDashArray = generic::SVGStrokeDashArray<NonNegativeLengthPerce
#[cfg(feature = "gecko")]
pub fn is_context_value_enabled() -> bool {
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.

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

@ -9,6 +9,13 @@ Unreleased
### 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
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]
disabled:
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]
disabled:
if (os == "android") and debug: intermittent crash, Bug 1553046
expected:
if (os == "android") and debug: FAIL
FAIL

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,2 +1,5 @@
[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]
disabled:
if (os == "android") and debug: intermittent crash, Bug 1553046
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.
if (StaticPrefs::APZAllowZooming()) {
if (StaticPrefs::apz_allow_zooming()) {
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(anEvent, [self window]);
ScreenPoint position =
ViewAs<ScreenPixel>([self convertWindowCoordinatesRoundDown:locationInWindow],

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

@ -3057,7 +3057,7 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) {
GdkDevice* device = gdk_event_get_source_device((GdkEvent*)aEvent);
GdkInputSource source = gdk_device_get_source(device);
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) {
static auto sGdkEventIsScrollStopEvent =
(gboolean(*)(const GdkEvent*))dlsym(

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

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

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

@ -133,7 +133,8 @@ nsresult nsWindowBase::SynthesizeNativeTouchPoint(
uint32_t aPointerOrientation, nsIObserver* aObserver) {
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
// that cannot properly inject events to satisfy the OS requirements (see
// bug 1313170) we can just fake it and synthesize the events from here.