[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
cmarrin at apple.com
cmarrin at apple.com
Tue Jan 5 23:45:56 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 410cf0c1f4c50c76041cb794c2ba48a8096a153a
Author: cmarrin at apple.com <cmarrin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 9 18:44:03 2009 +0000
Delay load DLLs for accelerated compositing
https://bugs.webkit.org/show_bug.cgi?id=31856
Add logic to turn off accelerated compositing if d3d9 or QuartzCore
DLLs are not present.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8d6a7e6..1e2d3c0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2009-12-09 Chris Marrin <cmarrin at apple.com>
+
+ Reviewed by Adam Roben.
+
+ Delay load DLLs for accelerated compositing
+ https://bugs.webkit.org/show_bug.cgi?id=31856
+
+ Add logic to turn off accelerated compositing if d3d9 or QuartzCore
+ DLLs are not present.
+
+ This patch also changes the WKCACFLayerRenderer to be a pointer.
+ This allows me to have a create() method which will not create it when
+ accelerated compositing is disabled because of missing DLLs. It
+ avoids having to do so many checks. I also made WebViewWndProc
+ a member function to allow several methods to be made protected, which
+ allows me to avoid doing availability checks there as well.
+
+ * platform/graphics/win/WKCACFLayer.cpp:
+ * platform/graphics/win/WKCACFLayer.h:
+ * platform/graphics/win/WKCACFLayerRenderer.cpp:
+ * platform/graphics/win/WKCACFLayerRenderer.h:
+ * rendering/RenderLayerBacking.cpp:
+
2009-12-09 Nate Chapin <japhet at chromium.org>
Reviewed by Darin Adler.
diff --git a/WebCore/platform/graphics/win/WKCACFLayer.cpp b/WebCore/platform/graphics/win/WKCACFLayer.cpp
index f874645..21e010d 100644
--- a/WebCore/platform/graphics/win/WKCACFLayer.cpp
+++ b/WebCore/platform/graphics/win/WKCACFLayer.cpp
@@ -35,6 +35,8 @@
#include <QuartzCore/CACFContext.h>
#include <QuartzCore/CARender.h>
+#pragma comment(lib, "QuartzCore")
+
namespace WebCore {
using namespace std;
diff --git a/WebCore/platform/graphics/win/WKCACFLayer.h b/WebCore/platform/graphics/win/WKCACFLayer.h
index 9da3013..6655f7a 100644
--- a/WebCore/platform/graphics/win/WKCACFLayer.h
+++ b/WebCore/platform/graphics/win/WKCACFLayer.h
@@ -50,7 +50,7 @@ class WKCACFTimingFunction;
class WKCACFLayer : public RefCounted<WKCACFLayer> {
public:
- static PassRefPtr<WKCACFLayer> create(CFStringRef className, GraphicsLayerCACF* owner=0) { return adoptRef(new WKCACFLayer(className, owner)); }
+ static PassRefPtr<WKCACFLayer> create(CFStringRef className, GraphicsLayerCACF* owner = 0) { return adoptRef(new WKCACFLayer(className, owner)); }
static WKCACFLayer* layer(CACFLayerRef layer) { return static_cast<WKCACFLayer*>(CACFLayerGetUserData(layer)); }
~WKCACFLayer();
@@ -62,10 +62,22 @@ public:
static RetainPtr<CFTypeRef> cfValue(const TransformationMatrix& value)
{
CATransform3D t;
- t.m11 = value.m11(); t.m12 = value.m12(); t.m13 = value.m13(); t.m14 = value.m14();
- t.m21 = value.m21(); t.m22 = value.m22(); t.m23 = value.m23(); t.m24 = value.m24();
- t.m31 = value.m31(); t.m32 = value.m32(); t.m33 = value.m33(); t.m34 = value.m34();
- t.m41 = value.m41(); t.m42 = value.m42(); t.m43 = value.m43(); t.m44 = value.m44();
+ t.m11 = value.m11();
+ t.m12 = value.m12();
+ t.m13 = value.m13();
+ t.m14 = value.m14();
+ t.m21 = value.m21();
+ t.m22 = value.m22();
+ t.m23 = value.m23();
+ t.m24 = value.m24();
+ t.m31 = value.m31();
+ t.m32 = value.m32();
+ t.m33 = value.m33();
+ t.m34 = value.m34();
+ t.m41 = value.m41();
+ t.m42 = value.m42();
+ t.m43 = value.m43();
+ t.m44 = value.m44();
return RetainPtr<CFTypeRef>(AdoptCF, CACFVectorCreateTransform(t));
}
static RetainPtr<CFTypeRef> cfValue(const FloatPoint& value)
@@ -77,8 +89,10 @@ public:
static RetainPtr<CFTypeRef> cfValue(const FloatRect& rect)
{
CGRect r;
- r.origin.x = rect.x(); r.origin.y = rect.y();
- r.size.width = rect.width(); r.size.height = rect.height();
+ r.origin.x = rect.x();
+ r.origin.y = rect.y();
+ r.size.width = rect.width();
+ r.size.height = rect.height();
CGFloat v[4] = { CGRectGetMinX(r), CGRectGetMinY(r), CGRectGetMaxX(r), CGRectGetMaxY(r) };
return RetainPtr<CFTypeRef>(AdoptCF, CACFVectorCreate(4, v));
}
diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
index 1c1c57c..9fbd0fc 100644
--- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
+++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
@@ -40,6 +40,10 @@
#include <d3dx9.h>
#include <dxerr9.h>
+#pragma comment(lib, "d3d9")
+#pragma comment(lib, "d3dx9")
+#pragma comment(lib, "QuartzCore")
+
static IDirect3D9* s_d3d = 0;
static IDirect3D9* d3d()
{
@@ -86,6 +90,29 @@ static D3DPRESENT_PARAMETERS initialPresentationParameters()
return parameters;
}
+bool WKCACFLayerRenderer::acceleratedCompositingAvailable()
+{
+ static bool available;
+ static bool tested;
+
+ if (tested)
+ return available;
+
+ tested = true;
+ HMODULE library = LoadLibrary(TEXT("d3d9.dll"));
+ if (!library)
+ return false;
+
+ FreeLibrary(library);
+ library = LoadLibrary(TEXT("QuartzCore.dll"));
+ if (!library)
+ return false;
+
+ FreeLibrary(library);
+ available = true;
+ return available;
+}
+
void WKCACFLayerRenderer::didFlushContext(CACFContextRef context)
{
WKCACFLayerRenderer* window = windowsForContexts().get(context);
@@ -95,6 +122,13 @@ void WKCACFLayerRenderer::didFlushContext(CACFContextRef context)
window->renderSoon();
}
+PassOwnPtr<WKCACFLayerRenderer> WKCACFLayerRenderer::create()
+{
+ if (!acceleratedCompositingAvailable())
+ return 0;
+ return new WKCACFLayerRenderer;
+}
+
WKCACFLayerRenderer::WKCACFLayerRenderer()
: m_triedToCreateD3DRenderer(false)
, m_renderContext(0)
diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
index 0d080db..12cde48 100644
--- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
+++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
@@ -52,9 +52,10 @@ namespace WebCore {
// (https://bugs.webkit.org/show_bug.cgi?id=31855)
class WKCACFLayerRenderer : public Noncopyable {
public:
- WKCACFLayerRenderer();
+ static PassOwnPtr<WKCACFLayerRenderer> create();
~WKCACFLayerRenderer();
+ static bool acceleratedCompositingAvailable();
static void didFlushContext(CACFContextRef);
void setScrollFrame(int width, int height, int scrollX, int scrollY);
@@ -72,6 +73,8 @@ protected:
WKCACFLayer* rootLayer() const { return m_rootLayer.get(); }
private:
+ WKCACFLayerRenderer();
+
void renderTimerFired(Timer<WKCACFLayerRenderer>*);
CGRect bounds() const;
diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp
index 28e8aa6..a62c1be 100644
--- a/WebCore/rendering/RenderLayerBacking.cpp
+++ b/WebCore/rendering/RenderLayerBacking.cpp
@@ -28,7 +28,9 @@
#if USE(ACCELERATED_COMPOSITING)
#include "AnimationController.h"
+#if ENABLE(3D_CANVAS)
#include "WebGLRenderingContext.h"
+#endif
#include "CSSPropertyNames.h"
#include "CSSStyleSelector.h"
#include "FrameView.h"
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 59747db..d002807 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,17 @@
+2009-12-08 Chris Marrin <cmarrin at apple.com>
+
+ Reviewed by Adam Roben.
+
+ Delay load DLLs for accelerated compositing
+ https://bugs.webkit.org/show_bug.cgi?id=31856
+
+ If the DLLs (d3d9 and QuartzCore). are not present it
+ turns off accelerated compositing and avoids calling
+ any of the functions in the DLLs.
+
+ * WebView.cpp:
+ * WebView.h:
+
2009-12-08 Adam Roben <aroben at apple.com>
Windows build fix
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index 2a8d280..d98d390 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -271,7 +271,6 @@ static const int maxToolTipWidth = 250;
static const int delayBeforeDeletingBackingStoreMsec = 5000;
static ATOM registerWebView();
-static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static void initializeStaticObservers();
@@ -295,36 +294,36 @@ enum {
bool WebView::s_allowSiteSpecificHacks = false;
WebView::WebView()
-: m_refCount(0)
-, m_hostWindow(0)
-, m_viewWindow(0)
-, m_mainFrame(0)
-, m_page(0)
-, m_hasCustomDropTarget(false)
-, m_useBackForwardList(true)
-, m_userAgentOverridden(false)
-, m_zoomMultiplier(1.0f)
-, m_mouseActivated(false)
-, m_dragData(0)
-, m_currentCharacterCode(0)
-, m_isBeingDestroyed(false)
-, m_paintCount(0)
-, m_hasSpellCheckerDocumentTag(false)
-, m_smartInsertDeleteEnabled(false)
-, m_didClose(false)
-, m_inIMEComposition(0)
-, m_toolTipHwnd(0)
-, m_closeWindowTimer(this, &WebView::closeWindowTimerFired)
-, m_topLevelParent(0)
-, m_deleteBackingStoreTimerActive(false)
-, m_transparent(false)
-, m_selectTrailingWhitespaceEnabled(false)
-, m_lastPanX(0)
-, m_lastPanY(0)
-, m_xOverpan(0)
-, m_yOverpan(0)
+ : m_refCount(0)
+ , m_hostWindow(0)
+ , m_viewWindow(0)
+ , m_mainFrame(0)
+ , m_page(0)
+ , m_hasCustomDropTarget(false)
+ , m_useBackForwardList(true)
+ , m_userAgentOverridden(false)
+ , m_zoomMultiplier(1.0f)
+ , m_mouseActivated(false)
+ , m_dragData(0)
+ , m_currentCharacterCode(0)
+ , m_isBeingDestroyed(false)
+ , m_paintCount(0)
+ , m_hasSpellCheckerDocumentTag(false)
+ , m_smartInsertDeleteEnabled(false)
+ , m_didClose(false)
+ , m_inIMEComposition(0)
+ , m_toolTipHwnd(0)
+ , m_closeWindowTimer(this, &WebView::closeWindowTimerFired)
+ , m_topLevelParent(0)
+ , m_deleteBackingStoreTimerActive(false)
+ , m_transparent(false)
+ , m_selectTrailingWhitespaceEnabled(false)
+ , m_lastPanX(0)
+ , m_lastPanY(0)
+ , m_xOverpan(0)
+ , m_yOverpan(0)
#if USE(ACCELERATED_COMPOSITING)
-, m_isAcceleratedCompositing(false)
+ , m_isAcceleratedCompositing(false)
#endif
{
JSC::initializeThreading();
@@ -1824,7 +1823,7 @@ bool WebView::keyPress(WPARAM charCode, LPARAM keyData, bool systemKeyDown)
return frame->eventHandler()->keyEvent(keyEvent);
}
-static bool registerWebViewWindowClass()
+bool WebView::registerWebViewWindowClass()
{
static bool haveRegisteredWindowClass = false;
if (haveRegisteredWindowClass)
@@ -1868,7 +1867,7 @@ static HWND findTopLevelParent(HWND window)
return 0;
}
-static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK WebView::WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult = 0;
LONG_PTR longPtr = GetWindowLongPtr(hWnd, 0);
@@ -1983,8 +1982,8 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L
case WM_SETFOCUS: {
COMPtr<IWebUIDelegate> uiDelegate;
COMPtr<IWebUIDelegatePrivate> uiDelegatePrivate;
- if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate &&
- SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate)
+ if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate
+ && SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate)
uiDelegatePrivate->webViewReceivedFocus(webView);
FocusController* focusController = webView->page()->focusController();
@@ -2003,8 +2002,8 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L
COMPtr<IWebUIDelegate> uiDelegate;
COMPtr<IWebUIDelegatePrivate> uiDelegatePrivate;
HWND newFocusWnd = reinterpret_cast<HWND>(wParam);
- if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate &&
- SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate)
+ if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate
+ && SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate)
uiDelegatePrivate->webViewLostFocus(webView, (OLE_HANDLE)(ULONG64)newFocusWnd);
FocusController* focusController = webView->page()->focusController();
@@ -2087,9 +2086,9 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L
if (lpMsg->message == WM_KEYDOWN)
keyCode = (UINT) lpMsg->wParam;
}
- if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate &&
- SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate &&
- SUCCEEDED(uiDelegatePrivate->webViewGetDlgCode(webView, keyCode, &dlgCode)))
+ if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate
+ && SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate
+ && SUCCEEDED(uiDelegatePrivate->webViewGetDlgCode(webView, keyCode, &dlgCode)))
return dlgCode;
handled = false;
break;
@@ -5734,29 +5733,34 @@ void WebView::downloadURL(const KURL& url)
void WebView::setRootChildLayer(WebCore::PlatformLayer* layer)
{
setAcceleratedCompositing(layer ? true : false);
- m_layerRenderer.setRootChildLayer(layer);
+ if (m_layerRenderer)
+ m_layerRenderer->setRootChildLayer(layer);
}
void WebView::setAcceleratedCompositing(bool accelerated)
{
- if (m_isAcceleratedCompositing == accelerated)
+ if (m_isAcceleratedCompositing == accelerated || !WKCACFLayerRenderer::acceleratedCompositingAvailable())
return;
- m_isAcceleratedCompositing = accelerated;
- if (m_isAcceleratedCompositing) {
- // Create the root layer
- ASSERT(m_viewWindow);
- m_layerRenderer.setHostWindow(m_viewWindow);
- updateRootLayerContents();
+ if (accelerated) {
+ m_layerRenderer = WKCACFLayerRenderer::create();
+ if (m_layerRenderer) {
+ m_isAcceleratedCompositing = true;
+
+ // Create the root layer
+ ASSERT(m_viewWindow);
+ m_layerRenderer->setHostWindow(m_viewWindow);
+ updateRootLayerContents();
+ }
} else {
- // Tear down the root layer
- m_layerRenderer.destroyRenderer();
+ m_layerRenderer = 0;
+ m_isAcceleratedCompositing = false;
}
}
void WebView::updateRootLayerContents()
{
- if (!m_backingStoreBitmap)
+ if (!m_backingStoreBitmap || !m_layerRenderer)
return;
// Get the backing store into a CGImage
@@ -5777,7 +5781,7 @@ void WebView::updateRootLayerContents()
kCGRenderingIntentDefault));
// Hand the CGImage to CACF for compositing
- m_layerRenderer.setRootContents(backingStoreImage.get());
+ m_layerRenderer->setRootContents(backingStoreImage.get());
// Set the frame and scroll position
Frame* coreFrame = core(m_mainFrame);
@@ -5785,7 +5789,7 @@ void WebView::updateRootLayerContents()
return;
FrameView* frameView = coreFrame->view();
- m_layerRenderer.setScrollFrame(frameView->layoutWidth(), frameView->layoutHeight(),
+ m_layerRenderer->setScrollFrame(frameView->layoutWidth(), frameView->layoutHeight(),
frameView->scrollX(), frameView->scrollY());
}
#endif
diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h
index 11cfdfc..4bdc98f 100644
--- a/WebKit/win/WebView.h
+++ b/WebKit/win/WebView.h
@@ -864,10 +864,7 @@ public:
void downloadURL(const WebCore::KURL&);
#if USE(ACCELERATED_COMPOSITING)
- bool isAcceleratedCompositing() const { return m_isAcceleratedCompositing; }
- void resizeLayerRenderer() { m_layerRenderer.resize(); }
- void layerRendererBecameVisible() { m_layerRenderer.createRenderer(); }
- void setRootLayerNeedsDisplay() { m_layerRenderer.setNeedsDisplay(); }
+ void setRootLayerNeedsDisplay() { if (m_layerRenderer) m_layerRenderer->setNeedsDisplay(); }
void setRootChildLayer(WebCore::PlatformLayer* layer);
#endif
@@ -895,6 +892,9 @@ private:
DWORD m_lastDropEffect;
protected:
+ static bool registerWebViewWindowClass();
+ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+
HIMC getIMMContext();
void releaseIMMContext(HIMC);
static bool allowSiteSpecificHacks() { return s_allowSiteSpecificHacks; }
@@ -982,10 +982,13 @@ protected:
long m_yOverpan;
#if USE(ACCELERATED_COMPOSITING)
+ bool isAcceleratedCompositing() const { return m_isAcceleratedCompositing; }
void setAcceleratedCompositing(bool);
void updateRootLayerContents();
+ void resizeLayerRenderer() { m_layerRenderer->resize(); }
+ void layerRendererBecameVisible() { m_layerRenderer->createRenderer(); }
- WebCore::WKCACFLayerRenderer m_layerRenderer;
+ OwnPtr<WebCore::WKCACFLayerRenderer> m_layerRenderer;
bool m_isAcceleratedCompositing;
#endif
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list