Bug 131976 - WKThumbnailView doesn't quite work with topContentInset
Summary: WKThumbnailView doesn't quite work with topContentInset
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-04-22 01:47 PDT by Tim Horton
Modified: 2014-04-22 08:52 PDT (History)
2 users (show)

See Also:


Attachments
patch (4.37 KB, patch)
2014-04-22 01:48 PDT, Tim Horton
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2014-04-22 01:47:12 PDT
<rdar://problem/16642127>
Comment 1 Tim Horton 2014-04-22 01:48:31 PDT
Created attachment 229871 [details]
patch
Comment 2 Darin Adler 2014-04-22 07:45:04 PDT
Comment on attachment 229871 [details]
patch

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

> Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.mm:90
> +    _lastSnapshotScale = 0;

Could consider NaN instead for uses like this.

> Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.mm:126
> -    IntRect snapshotRect(IntPoint(), _webPageProxy->viewSize());
> +    IntRect snapshotRect(IntPoint(), IntSize(_webPageProxy->viewSize().width(), _webPageProxy->viewSize().height() - _webPageProxy->topContentInset()));

Is there a way to write this math simpler? Like maybe this:

    IntRect snapshotRect(IntPoint(), _webPageProxy->viewSize() - IntSize(0, _webPageProxy->topContentInset()));
Comment 3 Tim Horton 2014-04-22 08:37:51 PDT
(In reply to comment #2)
> (From update of attachment 229871 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=229871&action=review
> 
> > Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.mm:90
> > +    _lastSnapshotScale = 0;
> 
> Could consider NaN instead for uses like this.

I had really never considered using NaN for a comparison-that-always-fails case like this. That's neat.

> > Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.mm:126
> > -    IntRect snapshotRect(IntPoint(), _webPageProxy->viewSize());
> > +    IntRect snapshotRect(IntPoint(), IntSize(_webPageProxy->viewSize().width(), _webPageProxy->viewSize().height() - _webPageProxy->topContentInset()));
> 
> Is there a way to write this math simpler? Like maybe this:
> 
>     IntRect snapshotRect(IntPoint(), _webPageProxy->viewSize() - IntSize(0, _webPageProxy->topContentInset()));

Sure.

Thanks, Darin!
Comment 4 Tim Horton 2014-04-22 08:52:29 PDT
http://trac.webkit.org/changeset/167662