[iOS] Suppress page count recalc when setting a snapshot paper rect
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Mar 2017 02:06:11 +0000 (02:06 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Mar 2017 02:06:11 +0000 (02:06 +0000)
commitea99586d8ddf87e63289fd11e2927d7ea4010580
tree2ea6057ec2b5904ccca9ced784bb25af560a0fe2
parent4795711f0be0def9c8c4b80be146073c5a9a9fe6
[iOS] Suppress page count recalc when setting a snapshot paper rect
https://bugs.webkit.org/show_bug.cgi?id=170156
<rdar://problem/30787872>

Reviewed by Tim Horton.

When _WKWebViewPrintFormatter computes a page count for snapshotting, it updates the paper
rect, which triggers UIKit to ask for the page count again while we're in the middle of
printing, putting us in a bad state.

Suppress page count recalc while setting the new paper rect, since we know this will not
cause it to change.

* UIProcess/_WKWebViewPrintFormatter.mm:
(-[_WKWebViewPrintFormatter _setSnapshotPaperRect:]): Temporarily set
_suppressPageCountRecalc to YES before updating the paper rect.
(-[_WKWebViewPrintFormatter _setNeedsRecalc]): Only call [super _setNeedsRecalc] if
_suppressPageCountRecalc is NO.
* UIProcess/_WKWebViewPrintFormatterInternal.h: Declared -_setNeedsRecalc.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@214449 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/_WKWebViewPrintFormatter.mm
Source/WebKit2/UIProcess/_WKWebViewPrintFormatterInternal.h