The print preview image snapshot is being generated with a size that takes the print preview scale into account. It doesn't need to do this - the bitmap just needs to be the size that we're going to draw at! <rdar://problem/12807090>
Created attachment 180308 [details] patch
Comment on attachment 180308 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=180308&action=review > Source/WebKit2/ChangeLog:12 > + The bitmap image used for print previews was being created respecting the print preview scale. > + This doesn't make any sense, as the scale does not affect the size of the image required to > + represent the previewed page. Instead, we should not scale the size, creating the buffer at a > + size that is constant regardless of scale, and do the scaling when drawing *into* the buffer instead. With four lines of explanation, I'm still not quite sure if this was an out of memory crash :) > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:3283 > + float printingScale = (float)desiredImageSize.width() / rect.width(); We generally prefer static_cast. > Source/WebKit2/WebProcess/WebPage/WebPage.messages.in:220 > + DrawRectToImage(uint64_t frameID, WebKit::PrintInfo printInfo, WebCore::IntRect rect, WebCore::IntSize desiredImageSize, uint64_t callbackID) "Desired" makes it sound like the desire may not be granted. Is that accurate?
(In reply to comment #2) > (From update of attachment 180308 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=180308&action=review > > > Source/WebKit2/ChangeLog:12 > > + The bitmap image used for print previews was being created respecting the print preview scale. > > + This doesn't make any sense, as the scale does not affect the size of the image required to > > + represent the previewed page. Instead, we should not scale the size, creating the buffer at a > > + size that is constant regardless of scale, and do the scaling when drawing *into* the buffer instead. > > With four lines of explanation, I'm still not quite sure if this was an out of memory crash :) It was, but the crash was secondary to the fact that we were respecting the scale at all when we didn't need to :D > > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:3283 > > + float printingScale = (float)desiredImageSize.width() / rect.width(); > > We generally prefer static_cast. Of course! > > Source/WebKit2/WebProcess/WebPage/WebPage.messages.in:220 > > + DrawRectToImage(uint64_t frameID, WebKit::PrintInfo printInfo, WebCore::IntRect rect, WebCore::IntSize desiredImageSize, uint64_t callbackID) > > "Desired" makes it sound like the desire may not be granted. Is that accurate? No, it will always be the desired size. Perhaps requested? or just imageSize?
http://trac.webkit.org/changeset/138356