diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-09 09:42:44 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-09 09:42:44 +0100 |
| commit | a59391482883479a9b28a6f1ace6d1ebd08a7ecd (patch) | |
| tree | fa539db054a20a67bff2fc891c33b0f4ec632916 /Source/WebKit2/WebProcess/WebPage/WebPage.cpp | |
| parent | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (diff) | |
| download | qtwebkit-a59391482883479a9b28a6f1ace6d1ebd08a7ecd.tar.gz | |
Imported WebKit commit 7bcdfab9a40db7d16b4b95bb77d78b8a59c9e701 (http://svn.webkit.org/repository/webkit/trunk@134025)
New snapshot with numerious build fixes, including MSVC 2012 and ARM Thumb-2.
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/WebPage.cpp')
| -rw-r--r-- | Source/WebKit2/WebProcess/WebPage/WebPage.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 2312e84c3..60ca6781a 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -2275,6 +2275,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store) settings->setScrollingPerformanceLoggingEnabled(m_scrollingPerformanceLoggingEnabled); settings->setPlugInSnapshottingEnabled(store.getBoolValueForKey(WebPreferencesKey::plugInSnapshottingEnabledKey())); + settings->setUsesEncodingDetector(store.getBoolValueForKey(WebPreferencesKey::usesEncodingDetectorKey())); platformPreferencesDidChange(store); @@ -3174,12 +3175,12 @@ void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printIn } #if PLATFORM(MAC) || PLATFORM(WIN) -void WebPage::drawRectToPDF(uint64_t frameID, const PrintInfo& printInfo, const WebCore::IntRect& rect, uint64_t callbackID) +void WebPage::drawRectToImage(uint64_t frameID, const PrintInfo& printInfo, const WebCore::IntRect& rect, uint64_t callbackID) { WebFrame* frame = WebProcess::shared().webFrame(frameID); Frame* coreFrame = frame ? frame->coreFrame() : 0; - RetainPtr<CFMutableDataRef> pdfPageData(AdoptCF, CFDataCreateMutable(0, 0)); + RefPtr<WebImage> image; #if USE(CG) if (coreFrame) { @@ -3188,34 +3189,29 @@ void WebPage::drawRectToPDF(uint64_t frameID, const PrintInfo& printInfo, const #else ASSERT(coreFrame->document()->printing()); #endif - - // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data. - RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get())); - - CGRect mediaBox = CGRectMake(0, 0, rect.width(), rect.height()); - RetainPtr<CGContextRef> context(AdoptCF, CGPDFContextCreate(pdfDataConsumer.get(), &mediaBox, 0)); - RetainPtr<CFDictionaryRef> pageInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - CGPDFContextBeginPage(context.get(), pageInfo.get()); - #if PLATFORM(MAC) if (RetainPtr<PDFDocument> pdfDocument = pdfDocumentForPrintingFrame(coreFrame)) { ASSERT(!m_printContext); - drawRectToPDFFromPDFDocument(context.get(), pdfDocument.get(), printInfo, rect); + RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(rect.size(), ShareableBitmap::SupportsAlpha); + OwnPtr<GraphicsContext> graphicsContext = bitmap->createGraphicsContext(); + graphicsContext->scale(FloatSize(1, -1)); + graphicsContext->translate(0, -rect.height()); + drawPDFDocument(graphicsContext->platformContext(), pdfDocument.get(), printInfo, rect); + image = WebImage::create(bitmap.release()); } else #endif { - GraphicsContext ctx(context.get()); - ctx.scale(FloatSize(1, -1)); - ctx.translate(0, -rect.height()); - m_printContext->spoolRect(ctx, rect); + image = scaledSnapshotWithOptions(rect, 1, SnapshotOptionsShareable | SnapshotOptionsExcludeSelectionHighlighting); } - - CGPDFContextEndPage(context.get()); - CGPDFContextClose(context.get()); } #endif - send(Messages::WebPageProxy::DataCallback(CoreIPC::DataReference(CFDataGetBytePtr(pdfPageData.get()), CFDataGetLength(pdfPageData.get())), callbackID)); + ShareableBitmap::Handle handle; + + if (image) + image->bitmap()->createHandle(handle, SharedMemory::ReadOnly); + + send(Messages::WebPageProxy::ImageCallback(handle, callbackID)); } void WebPage::drawPagesToPDF(uint64_t frameID, const PrintInfo& printInfo, uint32_t first, uint32_t count, uint64_t callbackID) |
