Skip to content

Commit

Permalink
Remove magnifyScaleAroundAnchor method
Browse files Browse the repository at this point in the history
This method was used by the old Mac trackpad pinch zoom path. In
https://crrev.com/297980d7a0e33b44dce6c727d7016345a80e33fa we removed
this special case for Mac and started relying on sending GesturePinch
events for processing in the compositor, just like touchscreen pinch.
This method is now unused.

Bug: 787924
Change-Id: I91737b4abe160830ed7068c2634b678304cc99f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1534349
Commit-Queue: David Bokan <bokan@chromium.org>
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#643613}
  • Loading branch information
bokand authored and Commit Bot committed Mar 22, 2019
1 parent fe4c37b commit d5e8951
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 47 deletions.
30 changes: 0 additions & 30 deletions third_party/blink/renderer/core/frame/visual_viewport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -520,36 +520,6 @@ bool VisualViewport::DidSetScaleOrLocation(float scale,
return true;
}

bool VisualViewport::MagnifyScaleAroundAnchor(float magnify_delta,
const FloatPoint& anchor) {
const float old_page_scale = Scale();
const float new_page_scale =
GetPage().GetChromeClient().ClampPageScaleFactorToLimits(magnify_delta *
old_page_scale);
if (new_page_scale == old_page_scale)
return false;
if (!MainFrame() || !MainFrame()->View())
return false;

// Keep the center-of-pinch anchor in a stable position over the course
// of the magnify.
// TODO(bokan): Looks like we call into setScaleAndLocation with infinity for
// the location so it seems either old or newPageScale is invalid.
// crbug.com/702771.
FloatPoint anchor_at_old_scale = anchor.ScaledBy(1.f / old_page_scale);
FloatPoint anchor_at_new_scale = anchor.ScaledBy(1.f / new_page_scale);
FloatSize anchor_delta = anchor_at_old_scale - anchor_at_new_scale;

// First try to use the anchor's delta to scroll the LocalFrameView.
FloatSize anchor_delta_unused_by_scroll = anchor_delta;

// Manually bubble any remaining anchor delta up to the visual viewport.
FloatPoint new_location(FloatPoint(GetScrollOffset()) +
anchor_delta_unused_by_scroll);
SetScaleAndLocation(new_page_scale, new_location);
return true;
}

void VisualViewport::CreateLayerTree() {
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
return;
Expand Down
5 changes: 0 additions & 5 deletions third_party/blink/renderer/core/frame/visual_viewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,6 @@ class CORE_EXPORT VisualViewport final
void SetScale(float);
float Scale() const { return scale_; }

// Update scale factor, magnifying or minifying by magnifyDelta, centered
// around the point specified by anchor in window coordinates. Returns false
// if page scale factor is left unchanged.
bool MagnifyScaleAroundAnchor(float magnify_delta, const FloatPoint& anchor);

// Convert the given rect in the main LocalFrameView's coordinates into a rect
// in the viewport. The given and returned rects are in CSS pixels, meaning
// scale isn't applied.
Expand Down
8 changes: 0 additions & 8 deletions third_party/blink/renderer/core/testing/internals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2475,14 +2475,6 @@ void Internals::setPageScaleFactorLimits(float min_scale_factor,
page->SetDefaultPageScaleLimits(min_scale_factor, max_scale_factor);
}

bool Internals::magnifyScaleAroundAnchor(float scale_factor, float x, float y) {
if (!GetFrame())
return false;

return GetFrame()->GetPage()->GetVisualViewport().MagnifyScaleAroundAnchor(
scale_factor, FloatPoint(x, y));
}

void Internals::setIsCursorVisible(Document* document,
bool is_visible,
ExceptionState& exception_state) {
Expand Down
2 changes: 0 additions & 2 deletions third_party/blink/renderer/core/testing/internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,6 @@ class Internals final : public ScriptWrappable {
float max_scale_factor,
ExceptionState&);

bool magnifyScaleAroundAnchor(float factor, float x, float y);

void setIsCursorVisible(Document*, bool, ExceptionState&);

String effectivePreload(HTMLMediaElement*);
Expand Down
2 changes: 0 additions & 2 deletions third_party/blink/renderer/core/testing/internals.idl
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,6 @@

void setVisualViewportOffset(long x, long y);

boolean magnifyScaleAroundAnchor(float offset, float x, float y);

boolean isUseCounted(Document document, unsigned long feature);
boolean isCSSPropertyUseCounted(Document document, DOMString propertyName);
boolean isAnimatedCSSPropertyUseCounted(Document document, DOMString propertyName);
Expand Down

0 comments on commit d5e8951

Please sign in to comment.