Commit 34a3f21c authored by scottmg@chromium.org's avatar scottmg@chromium.org

Add ability to pass through IDWriteFactory so sandbox can control how it's constructed

Skia supports receiving a factory after Skia r14000. Plumb
a pointer through here so that the sandbox warmup code, see
https://codereview.chromium.org/217813008 can control how
it's constructed.

R=eae@chromium.org
BUG=333029

Review URL: https://codereview.chromium.org/213223003

git-svn-id: svn://svn.chromium.org/blink/trunk@170669 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 79b18499
......@@ -66,6 +66,7 @@ static FontPlatformDataCache* gFontPlatformDataCache = 0;
#if OS(WIN)
bool FontCache::s_useDirectWrite = false;
IDWriteFactory* FontCache::s_directWriteFactory = 0;
bool FontCache::s_useSubpixelPositioning = false;
#endif // OS(WIN)
......
......@@ -45,6 +45,7 @@
#include <windows.h>
#include <objidl.h>
#include <mlang.h>
struct IDWriteFactory;
#endif
#if OS(ANDROID)
......@@ -100,6 +101,7 @@ public:
bool useSubpixelPositioning() const { return s_useSubpixelPositioning; }
SkFontMgr* fontManager() { return m_fontManager.get(); }
static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useDirectWrite; }
static void setDirectWriteFactory(IDWriteFactory* factory) { s_directWriteFactory = factory; }
static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSubpixelPositioning = useSubpixelPositioning; }
#endif
......@@ -150,6 +152,7 @@ private:
#if OS(WIN)
OwnPtr<SkFontMgr> m_fontManager;
static bool s_useDirectWrite;
static IDWriteFactory* s_directWriteFactory;
static bool s_useSubpixelPositioning;
#endif
......
......@@ -48,7 +48,7 @@ FontCache::FontCache()
SkFontMgr* fontManager;
if (s_useDirectWrite) {
fontManager = SkFontMgr_New_DirectWrite();
fontManager = SkFontMgr_New_DirectWrite(s_directWriteFactory);
} else {
fontManager = SkFontMgr_New_GDI();
// Subpixel text positioning is not supported by the GDI backend.
......
......@@ -15,6 +15,12 @@ void WebFontRendering::setUseDirectWrite(bool useDirectWrite)
WebCore::FontCache::setUseDirectWrite(useDirectWrite);
}
// static
void WebFontRendering::setDirectWriteFactory(IDWriteFactory* factory)
{
WebCore::FontCache::setDirectWriteFactory(factory);
}
// static
void WebFontRendering::setUseSubpixelPositioning(bool useSubpixelPositioning)
{
......
......@@ -7,11 +7,14 @@
#include "public/platform/WebCommon.h"
struct IDWriteFactory;
namespace blink {
class WebFontRendering {
public:
BLINK_EXPORT static void setUseDirectWrite(bool);
BLINK_EXPORT static void setDirectWriteFactory(IDWriteFactory*);
BLINK_EXPORT static void setUseSubpixelPositioning(bool);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment