diff options
author | Steve Block <steveblock@google.com> | 2011-06-08 08:26:01 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-08 08:26:01 -0700 |
commit | 3742ac093d35d923c81693096ab6671e9b147700 (patch) | |
tree | c2add9100f789dad45ef1ec5328bddde02c47a4c /Source/WebKit/win/WebFrame.cpp | |
parent | 901401d90459bc22580842455d4588b9a697514d (diff) | |
parent | e5926f4a0d6adc9ad4a75824129f117181953560 (diff) | |
download | external_webkit-3742ac093d35d923c81693096ab6671e9b147700.zip external_webkit-3742ac093d35d923c81693096ab6671e9b147700.tar.gz external_webkit-3742ac093d35d923c81693096ab6671e9b147700.tar.bz2 |
Merge changes I55c6d71a,Ifb3277d4,Ia1b847a2,I7ba9cf3f,Ida2b2a8a,I1280ec90,I72f818d5,I2e3b588b,I9a4e6289,Ia724c78b,Icd8612c8,Ie31b15d7,Ie125edae,I77941a88,I89dae78b,I3516e5ca,I1a4c17b5,I2c4ecc1a,I9c8e6537,Ifac13115,Ie1f80e09,Ia541ed77,I60ce9d78
* changes:
Merge WebKit at r82507: Update ThirdPartyProject.prop
Merge WebKit at r82507: Cherry-pick change r88166 to add INSPECTOR guards to ScriptProfiler
Merge WebKit at r82507: Work around a V8 bug
Merge WebKit at r82507: JNIType renamed to JavaType
Merge WebKit at r82507: IconDatabaseClient interface expanded
Merge WebKit at r82507: Don't use new loss-free code path in HTMLCanvasElement::toDataURL()
Merge WebKit at r82507: IcondDatabaseBase::iconForPageURL() renamed
Merge WebKit at r82507: IconDatabaseBase::Open() signature changed
Merge WebKit at r82507: Node::isContentEditable() renamed
Merge WebKit at r82507: Use icon database through IconDatabaseBase
Merge WebKit at r82507: toInputElement() is now a member of Node
Merge WebKit at r82507: FrameLoaderClient::objectContentType() signature changed
Merge WebKit at r82507: StringImpl::computeHash() removed
Merge WebKit at r82507: Stub out FontPlatformData::setOrientation()
Merge WebKit at r82507: Path::strokeBoundingRect() is now const
Merge WebKit at r82507: Add missing UnusedParam.h include in ApplicationCacheGroup.cpp
Merge WebKit at r82507: Continue to use Android's version of FontPlatformData.h
Merge WebKit at r82507: Update signature of FontCustomPlatformData::fontPlatformData()
Merge WebKit at r82507: Fix conflicts due to JNI refactoring
Merge WebKit at r82507: Fix conflicts due to new StorageTracker
Merge WebKit at r82507: Fix conflicts
Merge WebKit at r82507: Fix makefiles
Merge WebKit at r82507: Initial merge by git
Diffstat (limited to 'Source/WebKit/win/WebFrame.cpp')
-rw-r--r-- | Source/WebKit/win/WebFrame.cpp | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/Source/WebKit/win/WebFrame.cpp b/Source/WebKit/win/WebFrame.cpp index e412543..4b9e35d 100644 --- a/Source/WebKit/win/WebFrame.cpp +++ b/Source/WebKit/win/WebFrame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. * Copyright (C) Research In Motion Limited 2009. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,7 +53,6 @@ #include "WebScriptWorld.h" #include "WebURLResponse.h" #include "WebView.h" -#pragma warning( push, 0 ) #include <WebCore/BString.h> #include <WebCore/MemoryCache.h> #include <WebCore/Document.h> @@ -104,11 +103,11 @@ #include <JavaScriptCore/JSObject.h> #include <JavaScriptCore/JSValue.h> #include <wtf/MathExtras.h> -#pragma warning(pop) #if PLATFORM(CG) #include <CoreGraphics/CoreGraphics.h> #elif PLATFORM(CAIRO) +#include "PlatformContextCairo.h" #include <cairo-win32.h> #endif @@ -1029,7 +1028,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::hasSpellingMarker( Frame* coreFrame = core(this); if (!coreFrame) return E_FAIL; - *result = coreFrame->editor()->selectionStartHasSpellingMarkerFor(from, length); + *result = coreFrame->editor()->selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length); return S_OK; } @@ -1899,9 +1898,9 @@ PassRefPtr<Widget> WebFrame::createJavaAppletWidget(const IntSize& pluginSize, H return pluginView; } -ObjectContentType WebFrame::objectContentType(const KURL& url, const String& mimeType) +ObjectContentType WebFrame::objectContentType(const KURL& url, const String& mimeType, bool shouldPreferPlugInsForImages) { - return WebCore::FrameLoader::defaultObjectContentType(url, mimeType); + return WebCore::FrameLoader::defaultObjectContentType(url, mimeType, shouldPreferPlugInsForImages); } String WebFrame::overrideMediaType() const @@ -2188,8 +2187,7 @@ static float scaleFactor(HDC printDC, const IntRect& marginRect, const IntRect& static HDC hdcFromContext(PlatformGraphicsContext* pctx) { - cairo_surface_t* surface = cairo_get_target(pctx); - return cairo_win32_surface_get_dc(surface); + return cairo_win32_surface_get_dc(cairo_get_target(pctx->cr())); } void WebFrame::drawHeader(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, const IntRect& pageRect, float headerHeight) @@ -2244,13 +2242,14 @@ void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCt XFORM original, scaled; GetWorldTransform(hdc, &original); + cairo_t* cr = pctx->cr(); bool preview = (hdc != printDC); if (preview) { // If this is a preview, the Windows HDC was set to a non-scaled state so that Cairo will // draw correctly. We need to retain the correct preview scale here for use when the Cairo // drawing completes so that we can scale our GDI-based header/footer calls. This is a // workaround for a bug in Cairo (see https://bugs.freedesktop.org/show_bug.cgi?id=28161) - scaled = buildXFORMFromCairo(hdc, pctx); + scaled = buildXFORMFromCairo(hdc, cr); } float scale = scaleFactor(printDC, marginRect, pageRect); @@ -2260,13 +2259,13 @@ void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCt // We cannot scale the display HDC because the print surface also scales fonts, // resulting in invalid printing (and print preview) - cairo_scale(pctx, scale, scale); - cairo_translate(pctx, cairoMarginRect.x(), cairoMarginRect.y() + headerHeight); + cairo_scale(cr, scale, scale); + cairo_translate(cr, cairoMarginRect.x(), cairoMarginRect.y() + headerHeight); // Modify Cairo (only) to account for page position. - cairo_translate(pctx, -pageRect.x(), -pageRect.y()); + cairo_translate(cr, -pageRect.x(), -pageRect.y()); coreFrame->view()->paintContents(spoolCtx, pageRect); - cairo_translate(pctx, pageRect.x(), pageRect.y()); + cairo_translate(cr, pageRect.x(), pageRect.y()); if (preview) { // If this is a preview, the Windows HDC was set to a non-scaled state so that Cairo would @@ -2287,8 +2286,8 @@ void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCt SetWorldTransform(hdc, &original); - cairo_show_page(pctx); - ASSERT(!cairo_status(pctx)); + cairo_show_page(cr); + ASSERT(!cairo_status(cr)); spoolCtx->restore(); } @@ -2340,17 +2339,21 @@ HRESULT STDMETHODCALLTYPE WebFrame::spoolPages( else printSurface = cairo_win32_printing_surface_create(targetDC); // metafile - PlatformGraphicsContext* pctx = (PlatformGraphicsContext*)cairo_create(printSurface); - if (!pctx) { + cairo_t* cr = cairo_create(printSurface); + if (!cr) { cairo_surface_destroy(printSurface); return E_FAIL; } - + + PlatformContextCairo platformContext(cr); + PlatformGraphicsContext* pctx = &platformContext; + cairo_destroy(cr); + if (ctx) { // If this is a preview, the Windows HDC was sent with scaling information. // Retrieve it and reset it so that it draws properly. This is a workaround // for a bug in Cairo (see https://bugs.freedesktop.org/show_bug.cgi?id=28161) - setCairoTransformToPreviewHDC(pctx, targetDC); + setCairoTransformToPreviewHDC(cr, targetDC); } cairo_surface_set_fallback_resolution(printSurface, 72.0, 72.0); @@ -2394,7 +2397,6 @@ HRESULT STDMETHODCALLTYPE WebFrame::spoolPages( spoolPage(pctx, &spoolCtx, printDC, ui.get(), headerHeight, footerHeight, ii, pageCount); #if PLATFORM(CAIRO) - cairo_destroy(pctx); cairo_surface_finish(printSurface); ASSERT(!cairo_surface_status(printSurface)); cairo_surface_destroy(printSurface); |