Bug 89406 - [Chromium] Let the embedder override the max page scale factor set by the page
Summary: [Chromium] Let the embedder override the max page scale factor set by the page
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adam Barth
URL:
Keywords:
Depends on:
Blocks: 66687
  Show dependency treegraph
 
Reported: 2012-06-18 17:53 PDT by Adam Barth
Modified: 2012-06-25 19:01 PDT (History)
8 users (show)

See Also:


Attachments
Patch (7.71 KB, patch)
2012-06-18 17:56 PDT, Adam Barth
no flags Details | Formatted Diff | Diff
work in progress (5.53 KB, patch)
2012-06-25 15:20 PDT, Adam Barth
no flags Details | Formatted Diff | Diff
Patch (7.15 KB, patch)
2012-06-25 15:59 PDT, Adam Barth
no flags Details | Formatted Diff | Diff
Patch (7.58 KB, patch)
2012-06-25 16:07 PDT, Adam Barth
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Barth 2012-06-18 17:53:45 PDT
[Chromium] Let the embedder override the max page scale factor set by the page
Comment 1 James Robinson 2012-06-18 17:55:17 PDT
WebView.h:

    // PageScaleFactor will be force-clamped between minPageScale and maxPageScale
    // (and these values will persist until setPageScaleFactorLimits is called
    // again).
    virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale) = 0;


is that not sufficient?
Comment 2 Adam Barth 2012-06-18 17:56:01 PDT
Created attachment 148217 [details]
Patch
Comment 3 Adam Barth 2012-06-18 17:56:39 PDT
> is that not sufficient?

No, that's a ceiling for the max page scale factor.  This patch lets the embedder set a floor for the max page scale factor.
Comment 4 WebKit Review Bot 2012-06-18 17:58:45 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 5 Adam Barth 2012-06-24 01:58:32 PDT
@jamesr: What's the next step here?  Are you happy with the design if the API, or do we need to iterate?  I've verified that this feature is actively used in chromium-android.  (In Chrome for Android, if you go into Settings -> Accessibility, this code implements the "Force enable zoom" checkbox.)
Comment 6 Alexandre Elias 2012-06-25 14:22:24 PDT
FYI, setPageScaleFactorLimits is no longer used by Chrome for Android (because it was for viewport tag logic now moved into WebViewImpl), nor are there plans to use it again in the future.  The only user is now on desktop platforms to disable pinch-zoom.  We should probably remove it, especially since the setting is liable to be unexpectedly overridden by the viewport tag anyway.

Anyway, as for this value, I think passing a boolean would be clearer, there are already confusingly many min/max values and I can't think of a reason the embedder would want to pass a specific number.  I suggest naming it "ignoreViewportTagMaximumScale".
Comment 7 Adam Barth 2012-06-25 14:31:45 PDT
(In reply to comment #6)
> FYI, setPageScaleFactorLimits is no longer used by Chrome for Android (because it was for viewport tag logic now moved into WebViewImpl), nor are there plans to use it again in the future.  The only user is now on desktop platforms to disable pinch-zoom.  We should probably remove it, especially since the setting is liable to be unexpectedly overridden by the viewport tag anyway.

Ok.  I'll investigate and prepare a patch to remove it.

> Anyway, as for this value, I think passing a boolean would be clearer, there are already confusingly many min/max values and I can't think of a reason the embedder would want to pass a specific number.  I suggest naming it "ignoreViewportTagMaximumScale".

The implementation in the chromium-android branch uses a boolean, but then there's this funny 5.0f constant.  I guess that constant needs to be somewhere.
Comment 8 Alexandre Elias 2012-06-25 14:35:23 PDT
For the number, we can use:

const float WebView::maxPageScaleFactor = 4.0;

which is defined in WebViewImpl and already exported in WebView.  (The exact number 5 is not important, 4 is fine.)
Comment 9 Adam Barth 2012-06-25 14:37:20 PDT
Comment on attachment 148217 [details]
Patch

Ok.  Will do.  By the way, I think 4.0 was the real limit in practice in the chromium-android branch too.
Comment 10 Adam Barth 2012-06-25 15:20:35 PDT
Created attachment 149367 [details]
work in progress
Comment 11 Adam Barth 2012-06-25 15:59:55 PDT
Created attachment 149379 [details]
Patch
Comment 12 Adam Barth 2012-06-25 16:05:16 PDT
> > FYI, setPageScaleFactorLimits is no longer used by Chrome for Android (because it was for viewport tag logic now moved into WebViewImpl), nor are there plans to use it again in the future.  The only user is now on desktop platforms to disable pinch-zoom.  We should probably remove it, especially since the setting is liable to be unexpectedly overridden by the viewport tag anyway.
> 
> Ok.  I'll investigate and prepare a patch to remove it.

Turns out setPageScaleFactorLimits is still used by WebKit internally to implement the viewport meta tag.  We might still want to remove the API given that it's not clear that the page can override it using a meta tag.
Comment 13 Adam Barth 2012-06-25 16:07:51 PDT
Created attachment 149381 [details]
Patch
Comment 14 James Robinson 2012-06-25 16:49:55 PDT
Comment on attachment 149381 [details]
Patch

R=me, looks fine.
Comment 15 Adam Barth 2012-06-25 16:53:18 PDT
Comment on attachment 149381 [details]
Patch

Thanks!
Comment 16 WebKit Review Bot 2012-06-25 19:00:12 PDT
Comment on attachment 149381 [details]
Patch

Clearing flags on attachment: 149381

Committed r121213: <http://trac.webkit.org/changeset/121213>
Comment 17 WebKit Review Bot 2012-06-25 19:00:18 PDT
All reviewed patches have been landed.  Closing bug.
Comment 18 Alexandre Elias 2012-06-25 19:01:36 PDT
(In reply to comment #12)
> > > FYI, setPageScaleFactorLimits is no longer used by Chrome for Android (because it was for viewport tag logic now moved into WebViewImpl), nor are there plans to use it again in the future.  The only user is now on desktop platforms to disable pinch-zoom.  We should probably remove it, especially since the setting is liable to be unexpectedly overridden by the viewport tag anyway.
> > 
> > Ok.  I'll investigate and prepare a patch to remove it.
> 
> Turns out setPageScaleFactorLimits is still used by WebKit internally to implement the viewport meta tag.  We might still want to remove the API given that it's not clear that the page can override it using a meta tag.

Right, sorry I wasn't clear, I only meant remove the API from public WebView.