Bug 1501665 Part 4: Use the new function as a replacement for APZAllowZooming. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D19239

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brad Werth 2019-03-18 14:56:55 +00:00
Родитель e0fb57be15
Коммит b43c639430
9 изменённых файлов: 30 добавлений и 14 удалений

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

@ -64,6 +64,8 @@ nsEventStatus APZInputBridge::ReceiveInputEvent(
// mouse event undergoes (in PositionedEventTargeting.cpp) uses // mouse event undergoes (in PositionedEventTargeting.cpp) uses
// the IGNORE_ROOT_SCROLL_FRAME flag, which is needed for correct // the IGNORE_ROOT_SCROLL_FRAME flag, which is needed for correct
// hit testing in a zoomed-in or zoomed-out state. // hit testing in a zoomed-in or zoomed-out state.
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis.
if (gfxPrefs::APZAllowZooming()) { if (gfxPrefs::APZAllowZooming()) {
mouseEvent.mIgnoreRootScrollFrame = true; mouseEvent.mIgnoreRootScrollFrame = true;
} }

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

@ -1525,6 +1525,8 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(
// For platforms that don't support APZ zooming, dispatch a message to the // For platforms that don't support APZ zooming, dispatch a message to the
// content controller, it may want to do something else with this gesture. // content controller, it may want to do something else with this gesture.
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis.
if (!gfxPrefs::APZAllowZooming()) { if (!gfxPrefs::APZAllowZooming()) {
if (RefPtr<GeckoContentController> controller = if (RefPtr<GeckoContentController> controller =
GetGeckoContentController()) { GetGeckoContentController()) {
@ -1569,6 +1571,8 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
mY.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.y, aEvent.mTime); mY.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.y, aEvent.mTime);
} }
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis.
if (!gfxPrefs::APZAllowZooming()) { if (!gfxPrefs::APZAllowZooming()) {
if (RefPtr<GeckoContentController> controller = if (RefPtr<GeckoContentController> controller =
GetGeckoContentController()) { GetGeckoContentController()) {
@ -1702,6 +1706,8 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(
return nsEventStatus_eIgnore; return nsEventStatus_eIgnore;
} }
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis.
if (!gfxPrefs::APZAllowZooming()) { if (!gfxPrefs::APZAllowZooming()) {
if (RefPtr<GeckoContentController> controller = if (RefPtr<GeckoContentController> controller =
GetGeckoContentController()) { GetGeckoContentController()) {
@ -4074,6 +4080,8 @@ AsyncPanZoomController::GetCurrentAsyncTransformForFixedAdjustment(
// Use the layout viewport to adjust fixed position elements if and only if // Use the layout viewport to adjust fixed position elements if and only if
// it's larger than the visual viewport (assuming we're scrolling the RCD-RSF // it's larger than the visual viewport (assuming we're scrolling the RCD-RSF
// with apz.allow_zooming enabled). // with apz.allow_zooming enabled).
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis.
return (gfxPrefs::APZAllowZooming() && Metrics().IsRootContent() && return (gfxPrefs::APZAllowZooming() && Metrics().IsRootContent() &&
Metrics().GetVisualViewport().Size() <= Metrics().GetVisualViewport().Size() <=
Metrics().GetLayoutViewport().Size()) Metrics().GetLayoutViewport().Size())

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

@ -307,7 +307,8 @@ void APZCCallbackHelper::UpdateRootFrame(const RepaintRequest& aRequest) {
return; return;
} }
if (gfxPrefs::APZAllowZooming() && aRequest.GetScrollOffsetUpdated()) { if (nsLayoutUtils::AllowZoomingForDocument(shell->GetDocument()) &&
aRequest.GetScrollOffsetUpdated()) {
// If zooming is disabled then we don't really want to let APZ fiddle // If zooming is disabled then we don't really want to let APZ fiddle
// with these things. In theory setting the resolution here should be a // with these things. In theory setting the resolution here should be a
// no-op, but setting the visual viewport size is bad because it can cause a // no-op, but setting the visual viewport size is bad because it can cause a
@ -671,7 +672,8 @@ static bool PrepareForSetTargetAPZCNotification(
nsPoint point = nsLayoutUtils::GetEventCoordinatesRelativeTo( nsPoint point = nsLayoutUtils::GetEventCoordinatesRelativeTo(
aWidget, aRefPoint, aRootFrame); aWidget, aRefPoint, aRootFrame);
EnumSet<FrameForPointOption> options; EnumSet<FrameForPointOption> options;
if (gfxPrefs::APZAllowZooming()) { if (nsLayoutUtils::AllowZoomingForDocument(
aRootFrame->PresShell()->GetDocument())) {
// If zooming is enabled, we need IgnoreRootScrollFrame for correct // If zooming is enabled, we need IgnoreRootScrollFrame for correct
// hit testing. Otherwise, don't use it because it interferes with // hit testing. Otherwise, don't use it because it interferes with
// hit testing for some purposes such as scrollbar dragging (this will // hit testing for some purposes such as scrollbar dragging (this will

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

@ -506,7 +506,7 @@ void MobileViewportManager::RefreshViewportSize(bool aForceAdjustResolution) {
MVM_LOG("%p: Updating properties because %d || %d\n", this, mIsFirstPaint, MVM_LOG("%p: Updating properties because %d || %d\n", this, mIsFirstPaint,
mMobileViewportSize != viewport); mMobileViewportSize != viewport);
if (gfxPrefs::APZAllowZooming()) { if (nsLayoutUtils::AllowZoomingForDocument(mDocument)) {
UpdateResolution(viewportInfo, displaySize, viewport, UpdateResolution(viewportInfo, displaySize, viewport,
displayWidthChangeRatio, UpdateType::ViewportSize); displayWidthChangeRatio, UpdateType::ViewportSize);
} else { } else {
@ -545,8 +545,8 @@ void MobileViewportManager::ShrinkToDisplaySizeIfNeeded(
return; return;
} }
if (!gfxPrefs::APZAllowZooming()) { if (!nsLayoutUtils::AllowZoomingForDocument(mDocument)) {
// If the APZ is disabled, we don't scale down wider contents to fit them // If zoom is disabled, we don't scale down wider contents to fit them
// into device screen because users won't be able to zoom out the tiny // into device screen because users won't be able to zoom out the tiny
// contents. // contents.
return; return;

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

@ -10502,9 +10502,10 @@ nsresult PresShell::SetIsActive(bool aIsActive) {
} }
void PresShell::UpdateViewportOverridden(bool aAfterInitialization) { void PresShell::UpdateViewportOverridden(bool aAfterInitialization) {
// Determine if we require a MobileViewportManager. // Determine if we require a MobileViewportManager. This logic is
bool needMVM = nsLayoutUtils::ShouldHandleMetaViewport(mDocument) || // equivalent to ShouldHandleMetaViewport, which will check gfxPrefs if
gfxPrefs::APZAllowZooming(); // there are not meta viewport overrides.
bool needMVM = nsLayoutUtils::ShouldHandleMetaViewport(mDocument);
if (needMVM == !!mMobileViewportManager) { if (needMVM == !!mMobileViewportManager) {
// Either we've need one and we've already got it, or we don't need one // Either we've need one and we've already got it, or we don't need one

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

@ -114,7 +114,8 @@ nsIFrame* TouchManager::SetupTarget(WidgetTouchEvent* aEvent,
// Setting this flag will skip the scrollbars on the root frame from // Setting this flag will skip the scrollbars on the root frame from
// participating in hit-testing, and we only want that to happen on // participating in hit-testing, and we only want that to happen on
// zoomable platforms (for now). // zoomable platforms (for now).
if (gfxPrefs::APZAllowZooming()) { dom::Document* doc = aFrame->PresContext()->Document();
if (nsLayoutUtils::AllowZoomingForDocument(doc)) {
flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME; flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
} }

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

@ -168,10 +168,10 @@ void ZoomConstraintsClient::ScreenSizeChanged() {
} }
static mozilla::layers::ZoomConstraints ComputeZoomConstraintsFromViewportInfo( static mozilla::layers::ZoomConstraints ComputeZoomConstraintsFromViewportInfo(
const nsViewportInfo& aViewportInfo) { const nsViewportInfo& aViewportInfo, Document* aDocument) {
mozilla::layers::ZoomConstraints constraints; mozilla::layers::ZoomConstraints constraints;
constraints.mAllowZoom = constraints.mAllowZoom = aViewportInfo.IsZoomAllowed() &&
aViewportInfo.IsZoomAllowed() && gfxPrefs::APZAllowZooming(); nsLayoutUtils::AllowZoomingForDocument(aDocument);
constraints.mAllowDoubleTapZoom = constraints.mAllowDoubleTapZoom =
constraints.mAllowZoom && gfxPrefs::APZAllowDoubleTapZooming(); constraints.mAllowZoom && gfxPrefs::APZAllowDoubleTapZooming();
if (constraints.mAllowZoom) { if (constraints.mAllowZoom) {
@ -209,7 +209,7 @@ void ZoomConstraintsClient::RefreshZoomConstraints() {
screenSize, PixelCastJustification::LayoutDeviceIsScreenForBounds)); screenSize, PixelCastJustification::LayoutDeviceIsScreenForBounds));
mozilla::layers::ZoomConstraints zoomConstraints = mozilla::layers::ZoomConstraints zoomConstraints =
ComputeZoomConstraintsFromViewportInfo(viewportInfo); ComputeZoomConstraintsFromViewportInfo(viewportInfo, mDocument);
if (mDocument->Fullscreen()) { if (mDocument->Fullscreen()) {
ZCC_LOG("%p is in fullscreen, disallowing zooming\n", this); ZCC_LOG("%p is in fullscreen, disallowing zooming\n", this);

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

@ -9351,7 +9351,8 @@ static void UpdateDisplayPortMarginsForPendingMetrics(
return; return;
} }
if (gfxPrefs::APZAllowZooming() && aMetrics.IsRootContent()) { if (nsLayoutUtils::AllowZoomingForDocument(shell->GetDocument()) &&
aMetrics.IsRootContent()) {
// See APZCCallbackHelper::UpdateRootFrame for details. // See APZCCallbackHelper::UpdateRootFrame for details.
float presShellResolution = shell->GetResolution(); float presShellResolution = shell->GetResolution();
if (presShellResolution != aMetrics.GetPresShellResolution()) { if (presShellResolution != aMetrics.GetPresShellResolution()) {

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

@ -3678,6 +3678,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
return; return;
} }
// FIXME: bug 1525793 -- this may need to handle zooming or not on a per-document basis.
if (gfxPrefs::APZAllowZooming()) { if (gfxPrefs::APZAllowZooming()) {
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(anEvent, [self window]); NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(anEvent, [self window]);
ScreenPoint position = ScreenPoint position =