Bug 131976

Summary: WKThumbnailView doesn't quite work with topContentInset
Product: WebKit Reporter: Tim Horton <thorton>
Component: WebKit2Assignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, simon.fraser
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch darin: review+

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