WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
133417
[iOS][WK2] Round the UIScrollView content size to device pixel
https://bugs.webkit.org/show_bug.cgi?id=133417
Summary
[iOS][WK2] Round the UIScrollView content size to device pixel
Benjamin Poulain
Reported
2014-05-30 21:54:49 PDT
[iOS][WK2] Round the UIScrollView content size to device pixel
Attachments
Patch
(5.09 KB, patch)
2014-05-30 21:56 PDT
,
Benjamin Poulain
no flags
Details
Formatted Diff
Diff
Patch
(5.17 KB, patch)
2014-06-02 15:00 PDT
,
Benjamin Poulain
simon.fraser
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Benjamin Poulain
Comment 1
2014-05-30 21:56:41 PDT
Created
attachment 232314
[details]
Patch
Benjamin Poulain
Comment 2
2014-05-30 21:57:22 PDT
<
rdar://problem/15922440
>
zalan
Comment 3
2014-05-30 22:13:45 PDT
Comment on
attachment 232314
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=232314&action=review
> Source/WebKit2/ChangeLog:11 > + This patch ensure the content size as seen by the API is rounded to device pixels.
rounded or floored?
> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:455 > +static inline CGFloat floorFloatToPixels(CGFloat input, float deviceScaleFactor)
We've been using roundToDevicePixel, floorToDevicePixel terms in WebCore. Having 'float' in the function name doesn't add any useful information, while it's missing what the rounding unit is. Any explanation why we floor instead of round or ceil? (I guess, it's because you don't want garbage at the edges, but it'd be helpful to explain it in the changelog)
Ian Henderson
Comment 4
2014-05-31 01:22:16 PDT
Comment on
attachment 232314
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=232314&action=review
> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:460 > +static CGSize roundScrollViewCountentSize(const WebKit::WebPageProxy& page, const CGSize& contentSize)
"Countent" -> "Content" Is there a reason to pass contentSize by const reference instead of by value here? It seems likely it'll all be inlined anyway. Everything else looks good to me, thanks!
Benjamin Poulain
Comment 5
2014-05-31 01:31:10 PDT
> Is there a reason to pass contentSize by const reference instead of by value here? It seems likely it'll all be inlined anyway.
It is an habit. We pass stuff by const reference when they cannot be passed as registers. The "default" is to use const reference for non POD. Here the CGSize can be passed by registers, so I should not have used const references.
Benjamin Poulain
Comment 6
2014-06-02 15:00:25 PDT
Created
attachment 232401
[details]
Patch
Simon Fraser (smfr)
Comment 7
2014-06-02 15:05:04 PDT
Comment on
attachment 232401
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=232401&action=review
> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:460 > +static CGSize roundScrollViewContentSize(const WebKit::WebPageProxy& page, CGSize contentSize)
Why not just pass in page.deviceScaleFactor()?
Benjamin Poulain
Comment 8
2014-06-02 15:10:07 PDT
(In reply to
comment #7
)
> (From update of
attachment 232401
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=232401&action=review
> > > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:460 > > +static CGSize roundScrollViewContentSize(const WebKit::WebPageProxy& page, CGSize contentSize) > > Why not just pass in page.deviceScaleFactor()?
Too many call sites, the repetition is not worth it.
Benjamin Poulain
Comment 9
2014-06-02 15:19:33 PDT
Committed
r169549
: <
http://trac.webkit.org/changeset/169549
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug