Bug 87061 - WKPageGetScaleFactor can return 0.0 after a session is restored
Summary: WKPageGetScaleFactor can return 0.0 after a session is restored
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-05-21 17:38 PDT by Brady Eidson
Modified: 2012-05-21 19:04 PDT (History)
1 user (show)

See Also:


Attachments
Patch v1 - Fix + API test (10.07 KB, patch)
2012-05-21 17:43 PDT, Brady Eidson
bdakin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2012-05-21 17:38:43 PDT
WKPageGetScaleFactor can return 0.0 after a session is restored

This is because http://trac.webkit.org/changeset/116617 made "0.0" the new default scale factor to indicate that the scale factor has never actually been set.

When restoring sessions in WK2 we propagate that 0.0 up to the UIProcess as the "actual" scale factor which then confuses clients.

Patch and API test coming.

In radar as <rdar://problem/11460336>
Comment 1 Brady Eidson 2012-05-21 17:43:10 PDT
Created attachment 143150 [details]
Patch v1 - Fix + API test
Comment 2 WebKit Review Bot 2012-05-21 17:46:19 PDT
Attachment 143150 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1
Tools/TestWebKitAPI/Tests/WebKit2/WKPageGetScaleFactorNotZero.cpp:76:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:1133:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 2 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 John Sullivan 2012-05-21 17:47:55 PDT
Comment on attachment 143150 [details]
Patch v1 - Fix + API test

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

> Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:1135
>      m_frame->page()->send(Messages::WebPageProxy::PageScaleFactorDidChange(scaleFactor));

It seems cleaner to bail out without calling PageScaleFactorDidChange() at all if we're just trying to use "no particular value". Would that approach not work for some reason? It doesn't seem right to set the scaleFactor to 1 if we have no information about the actual scaleFactor.
Comment 4 Brady Eidson 2012-05-21 18:00:23 PDT
(In reply to comment #3)
> (From update of attachment 143150 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=143150&action=review
> 
> > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:1135
> >      m_frame->page()->send(Messages::WebPageProxy::PageScaleFactorDidChange(scaleFactor));
> 
> It seems cleaner to bail out without calling PageScaleFactorDidChange() at all if we're just trying to use "no particular value". Would that approach not work for some reason? It doesn't seem right to set the scaleFactor to 1 if we have no information about the actual scaleFactor.

Previous behavior was to notify the UI process of the scale factor always, even if it was the default value of 1.0

This is important - for example - if the page already had content in it and the scale factor had been set to a non-default value.  Restoring a session in to that page with the default scale factor needs to also update the UI process's copy of the scale factor.
Comment 5 Beth Dakin 2012-05-21 18:18:48 PDT
Comment on attachment 143150 [details]
Patch v1 - Fix + API test

You should fix the style errors, but r=me
Comment 6 Brady Eidson 2012-05-21 19:00:39 PDT
(In reply to comment #5)
> (From update of attachment 143150 [details])
> You should fix the style errors, but r=me

Yah, misguided attempt to be more precise with floating points than with other numbers, based on "== 0.0" being scattered throughout WebCore.

Will fix.

Thanks for the review!
Comment 7 Brady Eidson 2012-05-21 19:04:16 PDT
http://trac.webkit.org/changeset/117870