Bug 108252 - [BlackBerry] Zooming in during page load of non-scalable webpage results in fixed magnification
Summary: [BlackBerry] Zooming in during page load of non-scalable webpage results in f...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit BlackBerry (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jacky Jiang
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-29 16:40 PST by Jacky Jiang
Modified: 2013-02-01 12:24 PST (History)
9 users (show)

See Also:


Attachments
Patch (2.89 KB, patch)
2013-01-30 12:57 PST, Jacky Jiang
no flags Details | Formatted Diff | Diff
Patch (2.22 KB, patch)
2013-02-01 11:55 PST, Jacky Jiang
yong.li.webkit: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jacky Jiang 2013-01-29 16:40:12 PST
PR: 284828
Comment 1 Jacky Jiang 2013-01-30 12:57:44 PST
Created attachment 185541 [details]
Patch
Comment 2 Yong Li 2013-01-30 13:23:44 PST
Comment on attachment 185541 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=185541&action=review

I don't like this confusing function, and your patch makes it even more confusing.

> Source/WebKit/blackberry/Api/WebPage.cpp:1772
> +        // We can get float layoutSize(342.284122, 521.448467) and m_maximumScale(2.243750)
> +        // after computing viewport meta and lay out the contents at IntSize(342, 521).

Can we adjust m_maximumScale to fit the integer layout size?

> Source/WebKit/blackberry/Api/WebPage.cpp:1774
> +        // Therefore, zoomToFitScale(2.245681) could be a bit larger than m_maximumScale
> +        // based on that contents size and results in maximumScale()!=minimumScale(), which

can we make all these floating comparison with something like (fabs(f1-f2) < 0.01)?
Comment 3 Yong Li 2013-01-30 13:50:29 PST
Comment on attachment 185541 [details]
Patch

how about:
1) isPageScalable = minScale < maxScale (rather than !=)
or 2) maxScale() returns std::max(maxScale, zoomToFitScale)
Comment 4 Jacky Jiang 2013-01-30 15:04:07 PST
Comment on attachment 185541 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=185541&action=review

>> Source/WebKit/blackberry/Api/WebPage.cpp:1772
>> +        // after computing viewport meta and lay out the contents at IntSize(342, 521).
> 
> Can we adjust m_maximumScale to fit the integer layout size?

That might be best to be resolved right after viewport computing which was the first way I considered.   However, looks not good.   We have to change result.devicePixelRatio to zoomToFitScale which can not be calculated at that point and also it is not necessary to be std::max(deviceWidth/342, deviceHeight/521).
    if (result.initialScale > 0)
        setInitialScale(result.initialScale * result.devicePixelRatio);
    if (result.minimumScale > 0)
        setMinimumScale(result.minimumScale * result.devicePixelRatio);
    if (result.maximumScale > 0)
        setMaximumScale(result.maximumScale * result.devicePixelRatio);

>> Source/WebKit/blackberry/Api/WebPage.cpp:1774
>> +        // based on that contents size and results in maximumScale()!=minimumScale(), which
> 
> can we make all these floating comparison with something like (fabs(f1-f2) < 0.01)?

This is doable to make things better, but can not fix the issue.
Comment 5 Jacky Jiang 2013-01-30 15:23:28 PST
(In reply to comment #3)
> (From update of attachment 185541 [details])
> how about:
> 1) isPageScalable = minScale < maxScale (rather than !=)
May be it is OK. What if  minScale() > maxScale()?  

> or 2) maxScale() returns std::max(maxScale, zoomToFitScale)
Suppose  there is another page that m_maxScale:2.4 and zoomToFitScale: 2.5,  previously we would return 4 as maximumScaleScale().
If we return std::max(maxScale, zoomToFitScale),  we will then return 2.5 as the maximumScaleScale() and the page will be non-zoomable even if the page was supposed to be zoomable, which seems not good.

Adding Arvid to the discussion, any opinions on the bug?
Comment 6 Jacky Jiang 2013-01-30 15:25:06 PST
(In reply to comment #5)
> (In reply to comment #3)
> Adding Arvid to the discussion, any opinions on the bug?

Forgot CC.
Comment 7 Jacky Jiang 2013-01-31 16:03:50 PST
(In reply to comment #5)
> (In reply to comment #3)
> > (From update of attachment 185541 [details] [details])
> > how about:
> > 1) isPageScalable = minScale < maxScale (rather than !=)
> May be it is OK. What if  minScale() > maxScale()?  
This doesn't fix the problem by testing, and also there are some cases minScale() >= maxScale()  although m_minimumScale < m_maximumScale which expects the page to be scalable.
Comment 8 Jacky Jiang 2013-02-01 11:55:58 PST
Created attachment 186095 [details]
Patch

Updated the patch by taking Yong's suggestion.
Comment 9 Yong Li 2013-02-01 11:59:55 PST
Comment on attachment 186095 [details]
Patch

thanks. much simpler
Comment 10 Jacky Jiang 2013-02-01 12:24:49 PST
Committed r141626: <http://trac.webkit.org/changeset/141626>