WebKitTools:
Use WebTextRenderer in DRT
Reviewed by Ada.
* DumpRenderTree/win/DumpRenderTree.cpp:
(initialize): Use WebTextRenderer instead of using
InitializeCoreGraphics/AddFontResourceEx.
WebKit/win:
Add [I]WebTextRenderer
Right now this class can only be used to add private fonts for use by
the running process, but will eventually be the home of the
WebKitGraphics functions.
Reviewed by Ada.
* ForEachCoClass.h: Added WebTextRenderer.
* Interfaces/WebKit.idl: Ditto.
* WebKit.vcproj/Interfaces.vcproj: Ditto.
* WebKit.vcproj/WebKit.vcproj: Ditto.
* WebKit.vcproj/WebKitGUID.vcproj: Ditto.
* WebKitClassFactory.cpp: Ditto.
* WebTextRenderer.cpp: Added.
(WebTextRenderer::createInstance):
(WebTextRenderer::WebTextRenderer):
(WebTextRenderer::~WebTextRenderer):
(WebTextRenderer::QueryInterface):
(WebTextRenderer::AddRef):
(WebTextRenderer::Release):
(WebTextRenderer::registerPrivateFont):
* WebTextRenderer.h: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27019
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-10-24 Adam Roben <aroben@apple.com>
+
+ Add [I]WebTextRenderer
+
+ Right now this class can only be used to add private fonts for use by
+ the running process, but will eventually be the home of the
+ WebKitGraphics functions.
+
+ Reviewed by Ada.
+
+ * ForEachCoClass.h: Added WebTextRenderer.
+ * Interfaces/WebKit.idl: Ditto.
+ * WebKit.vcproj/Interfaces.vcproj: Ditto.
+ * WebKit.vcproj/WebKit.vcproj: Ditto.
+ * WebKit.vcproj/WebKitGUID.vcproj: Ditto.
+ * WebKitClassFactory.cpp: Ditto.
+ * WebTextRenderer.cpp: Added.
+ (WebTextRenderer::createInstance):
+ (WebTextRenderer::WebTextRenderer):
+ (WebTextRenderer::~WebTextRenderer):
+ (WebTextRenderer::QueryInterface):
+ (WebTextRenderer::AddRef):
+ (WebTextRenderer::Release):
+ (WebTextRenderer::registerPrivateFont):
+ * WebTextRenderer.h: Added.
+
2007-10-24 Adam Roben <aroben@apple.com>
Use FOR_EACH_COCLASS in WebKitClassFactory
macro(WebNotificationCenter) \
macro(WebPreferences) \
macro(WebScrollBar) \
+ macro(WebTextRenderer) \
macro(WebURLCredential) \
macro(WebURLProtectionSpace) \
macro(WebURLRequest) \
import "oaidl.idl";
import "ocidl.idl";
+import "IWebTextRenderer.idl";
import "IWebView.idl";
import "IWebViewPrivate.idl";
import "IWebUIDelegate.idl";
coclass WebURLResponse {
[default] interface IWebURLResponse;
}
+
+#if __BUILDBOT__
+ [uuid(24040cd6-aff4-4a51-9c8b-71539580ee76)]
+#else
+ [uuid(1fbff564-5ff4-484f-b3d9-217483f9f5fc)]
+#endif
+ coclass WebTextRenderer {
+ [default] interface IWebTextRenderer;
+ }
}
RelativePath="..\Interfaces\IWebScrollBarPrivate.idl"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\Interfaces\IWebTextRenderer.idl"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\Interfaces\IWebUIDelegate.idl"\r
>\r
DebugInformationFormat="3"\r
DisableSpecificWarnings="4127;4355"\r
ForcedIncludeFiles="CodeAnalysisConfig.h"\r
- EnablePREfast="$(EnablePREfast)"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
DebugInformationFormat="3"\r
DisableSpecificWarnings="4127;4355"\r
ForcedIncludeFiles="CodeAnalysisConfig.h"\r
- EnablePREfast="$(EnablePREfast)"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
DebugInformationFormat="3"\r
DisableSpecificWarnings="4127;4355"\r
ForcedIncludeFiles="CodeAnalysisConfig.h"\r
- EnablePREfast="$(EnablePREfast)"\r
/>\r
<Tool\r
Name="VCManagedResourceCompilerTool"\r
RelativePath="..\WebScrollBar.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\WebTextRenderer.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\WebURLAuthenticationChallenge.h"\r
>\r
RelativePath="..\WebScrollBar.cpp"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\WebTextRenderer.cpp"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\WebURLAuthenticationChallenge.cpp"\r
>\r
RelativePath="$(WebKitOutputDir)\obj\WebKit\Interfaces\IWebScrollBarPrivate_i.c"\r
>\r
</File>\r
+ <File\r
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\Interfaces\IWebTextRenderer_i.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="$(WebKitOutputDir)\obj\WebKit\Interfaces\IWebUIDelegate_i.c"\r
>\r
#include "WebMutableURLRequest.h"
#include "WebNotificationCenter.h"
#include "WebPreferences.h"
+#include "WebTextRenderer.h"
#include "WebURLCredential.h"
#include "WebURLProtectionSpace.h"
#include "WebURLResponse.h"
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebTextRenderer.h"
+
+#include <CoreFoundation/CFString.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <wtf/RetainPtr.h>
+
+WebTextRenderer* WebTextRenderer::createInstance()
+{
+ WebTextRenderer* instance = new WebTextRenderer;
+ instance->AddRef();
+ return instance;
+}
+
+WebTextRenderer::WebTextRenderer()
+ : m_refCount(0)
+{
+}
+
+WebTextRenderer::~WebTextRenderer()
+{
+}
+
+HRESULT STDMETHODCALLTYPE WebTextRenderer::QueryInterface(const IID &riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebTextRenderer*>(this);
+ else if (IsEqualGUID(riid, IID_IWebTextRenderer))
+ *ppvObject = static_cast<IWebTextRenderer*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebTextRenderer::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebTextRenderer::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE WebTextRenderer::registerPrivateFont(
+ /* [in] */ LPCOLESTR fontFilePath)
+{
+ if (!AddFontResourceEx(fontFilePath, FR_PRIVATE, 0))
+ return E_FAIL;
+
+ RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(fontFilePath), static_cast<CFIndex>(wcslen(fontFilePath))));
+ wkAddFontsAtPath(string.get());
+ return S_OK;
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebTextRenderer_h
+#define WebTextRenderer_h
+
+#include "IWebTextRenderer.h"
+
+class WebTextRenderer : public IWebTextRenderer {
+public:
+ static WebTextRenderer* createInstance();
+
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void** ppvObject);
+
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ virtual HRESULT STDMETHODCALLTYPE registerPrivateFont(
+ /* [in] */ LPCOLESTR fontFilePath);
+
+private:
+ WebTextRenderer();
+ ~WebTextRenderer();
+
+ ULONG m_refCount;
+};
+
+#endif // !defined(WebTextRenderer_h)
+2007-10-24 Adam Roben <aroben@apple.com>
+
+ Use WebTextRenderer in DRT
+
+ Reviewed by Ada.
+
+ * DumpRenderTree/win/DumpRenderTree.cpp:
+ (initialize): Use WebTextRenderer instead of using AddFontResourceEx.
+
2007-10-24 Sven Herzberg <sven@imendio.com>
Reviewed by Mark Rowe.
if (FARPROC dllRegisterServer = GetProcAddress(webKitModule, "DllRegisterServer"))
dllRegisterServer();
+ // Init COM
+ OleInitialize(0);
+
static LPCTSTR fontsToInstall[] = {
TEXT("AHEM____.ttf"),
TEXT("Apple Chancery.ttf"),
wstring resourcesPath(exePath + TEXT("DumpRenderTree.resources\\"));
- for (int i = 0; i < ARRAYSIZE(fontsToInstall); ++i)
- AddFontResourceEx(wstring(resourcesPath + fontsToInstall[i]).c_str(), FR_PRIVATE, 0);
-
- // Init COM
- OleInitialize(0);
+ COMPtr<IWebTextRenderer> textRenderer;
+ if (SUCCEEDED(CoCreateInstance(CLSID_WebTextRenderer, 0, CLSCTX_ALL, IID_IWebTextRenderer, (void**)&textRenderer)))
+ for (int i = 0; i < ARRAYSIZE(fontsToInstall); ++i)
+ textRenderer->registerPrivateFont(wstring(resourcesPath + fontsToInstall[i]).c_str());
// Initialize CG
InitializeCoreGraphics();