summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-13 20:27:07 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-13 20:27:07 +0000
commitda8765903e7d3addd573aca2559b57cd0052d667 (patch)
tree643f5cba883bc2b112384c828db779fb5fa8d2e0
parentdc8c5b2a54e0485c291b4c080ab896bb7637716c (diff)
downloadchromium_src-da8765903e7d3addd573aca2559b57cd0052d667.zip
chromium_src-da8765903e7d3addd573aca2559b57cd0052d667.tar.gz
chromium_src-da8765903e7d3addd573aca2559b57cd0052d667.tar.bz2
* Copy webkit_glue font functions into ChromiumBridge.
* removed a few unneeded headers from MIMETypeRegistry * removed all uses of IMLangFontLang2 Review URL: http://codereview.chromium.org/10661 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5369 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/render_process.cc46
-rw-r--r--chrome/renderer/render_process.h11
-rw-r--r--chrome/renderer/renderer_glue.cc4
-rw-r--r--webkit/glue/chromium_bridge_impl.cc9
-rw-r--r--webkit/glue/webkit_glue.h5
-rw-r--r--webkit/port/platform/MIMETypeRegistry.cpp4
-rw-r--r--webkit/port/platform/UniscribeStateTextRun.cpp5
-rw-r--r--webkit/port/platform/chromium/ChromiumBridge.h11
-rw-r--r--webkit/port/platform/chromium/ScrollbarThemeChromium.cpp4
-rw-r--r--webkit/port/platform/graphics/FontCacheWin.cpp61
-rw-r--r--webkit/port/platform/graphics/FontCustomPlatformData.cpp2
-rw-r--r--webkit/port/platform/graphics/FontPlatformDataWin.cpp20
-rw-r--r--webkit/port/platform/graphics/FontPlatformDataWin.h12
-rw-r--r--webkit/port/platform/graphics/FontWin.cpp4
-rw-r--r--webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp4
-rw-r--r--webkit/port/platform/graphics/SimpleFontDataWin.cpp43
16 files changed, 51 insertions, 194 deletions
diff --git a/chrome/renderer/render_process.cc b/chrome/renderer/render_process.cc
index f1885b9..44a8055 100644
--- a/chrome/renderer/render_process.cc
+++ b/chrome/renderer/render_process.cc
@@ -24,7 +24,6 @@
//-----------------------------------------------------------------------------
-IMLangFontLink2* RenderProcess::lang_font_link_ = NULL;
bool RenderProcess::load_plugins_in_process_ = false;
//-----------------------------------------------------------------------------
@@ -64,8 +63,6 @@ bool RenderProcess::GlobalInit(const std::wstring &channel_name) {
}
}
- InitializeLangFontLink();
-
CommandLine command_line;
if (command_line.HasSwitch(switches::kJavaScriptFlags)) {
webkit_glue::SetJavaScriptFlags(
@@ -103,49 +100,6 @@ bool RenderProcess::GlobalInit(const std::wstring &channel_name) {
// static
void RenderProcess::GlobalCleanup() {
ChildProcess::GlobalCleanup();
- ReleaseLangFontLink();
-}
-
-// static
-void RenderProcess::InitializeLangFontLink() {
- // TODO(hbono): http://b/1072298 Experimentally commented out this code to
- // prevent registry leaks caused by this IMLangFontLink2 interface.
- // If you find any font-rendering regressions. Please feel free to blame me.
-#ifdef USE_IMLANGFONTLINK2
- IMultiLanguage* multi_language = NULL;
- lang_font_link_ = NULL;
- if (S_OK != CoCreateInstance(CLSID_CMultiLanguage,
- 0,
- CLSCTX_ALL,
- IID_IMultiLanguage,
- reinterpret_cast<void**>(&multi_language))) {
- DLOG(ERROR) << "Cannot CoCreate CMultiLanguage";
- } else {
- if (S_OK != multi_language->QueryInterface(IID_IMLangFontLink2,
- reinterpret_cast<void**>(&lang_font_link_))) {
- DLOG(ERROR) << "Cannot query LangFontLink2 interface";
- }
- }
-
- if (multi_language)
- multi_language->Release();
-#endif
-}
-
-// static
-void RenderProcess::ReleaseLangFontLink() {
- // TODO(hbono): http://b/1072298 Experimentally commented out this code to
- // prevent registry leaks caused by this IMLangFontLink2 interface.
- // If you find any font-rendering regressions. Please feel free to blame me.
-#ifdef USE_IMLANGFONTLINK2
- if (lang_font_link_)
- lang_font_link_->Release();
-#endif
-}
-
-// static
-IMLangFontLink2* RenderProcess::GetLangFontLink() {
- return lang_font_link_;
}
// static
diff --git a/chrome/renderer/render_process.h b/chrome/renderer/render_process.h
index e839c88..8fcb186 100644
--- a/chrome/renderer/render_process.h
+++ b/chrome/renderer/render_process.h
@@ -25,8 +25,6 @@ class RenderProcess : public ChildProcess {
// Returns true if plugins should be loaded in-process.
static bool ShouldLoadPluginsInProcess();
- static IMLangFontLink2* GetLangFontLink();
-
// Allocates shared memory. When no longer needed, you should pass the
// SharedMemory pointer to FreeSharedMemory so it can be recycled. The size
// reported in the resulting SharedMemory object will be greater than or
@@ -46,13 +44,6 @@ class RenderProcess : public ChildProcess {
RenderProcess(const std::wstring& channel_name);
~RenderProcess();
- // Initializes the LangFontLink object. This function cannot be called
- // while the process is restricted by the sandbox or it will fail.
- static void InitializeLangFontLink();
-
- // Releases the LangFontLink object if already created.
- static void ReleaseLangFontLink();
-
// Returns a pointer to the RenderProcess singleton instance. This is
// guaranteed to be non-NULL between calls to GlobalInit and GlobalCleanup.
static RenderProcess* self() {
@@ -90,8 +81,6 @@ class RenderProcess : public ChildProcess {
// This factory is used to lazily invoke ClearSharedMemCache.
ScopedRunnableMethodFactory<RenderProcess> clearer_factory_;
- static IMLangFontLink2* lang_font_link_;
-
static bool load_plugins_in_process_;
DISALLOW_EVIL_CONSTRUCTORS(RenderProcess);
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index 297e5ac..1cc689f 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -188,10 +188,6 @@ bool webkit_glue::GetPreferredExtensionForMimeType(const std::string& mime_type,
return !ext->empty();
}
-IMLangFontLink2* webkit_glue::GetLangFontLink() {
- return RenderProcess::GetLangFontLink();
-}
-
std::string webkit_glue::GetDataResource(int resource_id) {
return ResourceBundle::GetSharedInstance().GetDataResource(resource_id);
}
diff --git a/webkit/glue/chromium_bridge_impl.cc b/webkit/glue/chromium_bridge_impl.cc
index f27955ff..a68ee6b 100644
--- a/webkit/glue/chromium_bridge_impl.cc
+++ b/webkit/glue/chromium_bridge_impl.cc
@@ -196,6 +196,15 @@ void ChromiumBridge::prefetchDNS(const String& hostname) {
webkit_glue::PrefetchDns(webkit_glue::StringToStdString(hostname));
}
+// Font -----------------------------------------------------------------------
+
+#if defined(OS_WIN)
+bool ChromiumBridge::ensureFontLoaded(HFONT font) {
+ return webkit_glue::EnsureFontLoaded(font);
+}
+#endif
+
+
// Language -------------------------------------------------------------------
String ChromiumBridge::computedDefaultLanguage() {
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 21754c5..ccc3e06 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -153,11 +153,6 @@ bool GetMimeTypeFromFile(const std::wstring& file_path, std::string* mime_type);
bool GetPreferredExtensionForMimeType(const std::string& mime_type,
std::wstring* ext);
-#if defined(OS_WIN)
-// Returns the com object pointer for the FontLink interface
-IMLangFontLink2* GetLangFontLink();
-#endif
-
// Sets a cookie string for the given URL. The policy_url argument indicates
// the URL of the topmost frame, which may be useful for determining whether or
// not to allow this cookie setting. NOTE: the cookie string is a standard
diff --git a/webkit/port/platform/MIMETypeRegistry.cpp b/webkit/port/platform/MIMETypeRegistry.cpp
index 58c7285..7e7d898 100644
--- a/webkit/port/platform/MIMETypeRegistry.cpp
+++ b/webkit/port/platform/MIMETypeRegistry.cpp
@@ -31,10 +31,6 @@
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
-#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webkit_glue.h"
-#include "webkit/glue/webplugin.h"
-#include "googleurl/src/gurl.h"
#include "net/base/mime_util.h"
namespace WebCore
diff --git a/webkit/port/platform/UniscribeStateTextRun.cpp b/webkit/port/platform/UniscribeStateTextRun.cpp
index 5a3c8f5..25d79c1 100644
--- a/webkit/port/platform/UniscribeStateTextRun.cpp
+++ b/webkit/port/platform/UniscribeStateTextRun.cpp
@@ -27,11 +27,10 @@
#include "UniscribeStateTextRun.h"
+#include "ChromiumBridge.h"
#include "Font.h"
#include "SimpleFontData.h"
-#include "webkit/glue/webkit_glue.h"
-
UniscribeStateTextRun::UniscribeStateTextRun(const WebCore::TextRun& run,
const WebCore::Font& font)
: UniscribeState(run.characters(), run.length(), run.rtl(),
@@ -71,7 +70,7 @@ void UniscribeStateTextRun::TryToPreloadFont(HFONT font) {
// Ask the browser to get the font metrics for this font.
// That will preload the font and it should now be accessible
// from the renderer.
- webkit_glue::EnsureFontLoaded(font);
+ WebCore::ChromiumBridge::ensureFontLoaded(font);
}
bool UniscribeStateTextRun::NextWinFontData(
diff --git a/webkit/port/platform/chromium/ChromiumBridge.h b/webkit/port/platform/chromium/ChromiumBridge.h
index 0f67a36..d64abbc 100644
--- a/webkit/port/platform/chromium/ChromiumBridge.h
+++ b/webkit/port/platform/chromium/ChromiumBridge.h
@@ -30,11 +30,17 @@
#ifndef ChromiumBridge_h
#define ChromiumBridge_h
+#include "config.h"
+
#include "PasteboardPrivate.h"
#include "PlatformString.h"
class NativeImageSkia;
+#if PLATFORM(WIN_OS)
+typedef struct HFONT__* HFONT;
+#endif
+
namespace WebCore {
class Cursor;
class IntRect;
@@ -64,6 +70,11 @@ namespace WebCore {
// DNS ----------------------------------------------------------------
static void prefetchDNS(const String& hostname);
+ // Font ---------------------------------------------------------------
+#if PLATFORM(WIN_OS)
+ static bool ensureFontLoaded(HFONT font);
+#endif
+
// Language -----------------------------------------------------------
static String computedDefaultLanguage();
diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp b/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp
index c0e3c5d..0cbf018 100644
--- a/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp
+++ b/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp
@@ -26,10 +26,10 @@
#include "config.h"
#include "ScrollbarThemeChromium.h"
+#include "ChromiumBridge.h"
#include "PlatformMouseEvent.h"
#include "Scrollbar.h"
#include "ScrollbarThemeComposite.h"
-#include "webkit/glue/webkit_glue.h"
// -----------------------------------------------------------------------------
// This file contains scrollbar theme code that is cross platform. Additional
@@ -142,7 +142,7 @@ IntSize ScrollbarThemeChromium::buttonSize(Scrollbar* scrollbar)
const int kLayoutTestModeGirth = 17;
int thickness = scrollbarThickness();
- int girth = webkit_glue::IsLayoutTestMode() ? kLayoutTestModeGirth : thickness;
+ int girth = ChromiumBridge::layoutTestMode() ? kLayoutTestModeGirth : thickness;
if (scrollbar->orientation() == HorizontalScrollbar) {
int width = scrollbar->width() < 2 * girth ? scrollbar->width() / 2 : girth;
return IntSize(width, thickness);
diff --git a/webkit/port/platform/graphics/FontCacheWin.cpp b/webkit/port/platform/graphics/FontCacheWin.cpp
index b6938a8..c5f34d4 100644
--- a/webkit/port/platform/graphics/FontCacheWin.cpp
+++ b/webkit/port/platform/graphics/FontCacheWin.cpp
@@ -43,7 +43,6 @@
#include "base/gfx/font_utils.h"
#include "base/singleton.h"
#include "unicode/uniset.h"
-#include "webkit/glue/webkit_glue.h"
using std::min;
@@ -301,7 +300,7 @@ static bool fontContainsCharacter(const FontPlatformData* font_data,
HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(hdc, hfont));
int count = GetFontUnicodeRanges(hdc, 0);
if (count == 0) {
- if (webkit_glue::EnsureFontLoaded(hfont))
+ if (ChromiumBridge::ensureFontLoaded(hfont))
count = GetFontUnicodeRanges(hdc, 0);
}
if (count == 0) {
@@ -340,13 +339,6 @@ static bool fontContainsCharacter(const FontPlatformData* font_data,
// Given the desired base font, this will create a SimpleFontData for a specific
// font that can be used to render the given range of characters.
-// Two methods are used : our own getFallbackFamily and Windows' font linking.
-// IMLangFontLink will give us a range of characters, and may not find a font
-// that matches all the input characters. However, normally, we will only get
-// called with one input character because this is used to find a glyph for
-// a missing one. If we are called for a range, I *believe* that it will be
-// used to populate the glyph cache only, meaning we will be called again for
-// the next missing glyph.
const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font,
const UChar* characters,
int length)
@@ -432,52 +424,8 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font,
if (i < numFonts) // we found the font that covers this character !
return getCachedFontData(data);
- // IMLangFontLink can break up a string into regions that can be rendered
- // using one particular font.
- // See http://blogs.msdn.com/oldnewthing/archive/2004/07/16/185261.aspx
- IMLangFontLink2* langFontLink = webkit_glue::GetLangFontLink();
- if (!langFontLink)
- return 0;
-
- SimpleFontData* fontData = 0;
- HDC hdc = GetDC(0);
- HFONT primaryFont = font.primaryFont()->
- fontDataForCharacter(characters[0])->m_font.hfont();
-
- // Get the code pages supported by the requested font.
- DWORD acpCodePages;
- langFontLink->CodePageToCodePages(CP_ACP, &acpCodePages);
-
- // Get the code pages required by the given string, passing in the font's
- // code pages as the ones to give "priority". Priority code pages will be
- // used if there are multiple code pages that can represent the characters
- // in question, and of course, we want to use a page supported by the
- // primary font if possible.
- DWORD actualCodePages;
- long cchActual;
- if (FAILED(langFontLink->GetStrCodePages(characters, length, acpCodePages,
- &actualCodePages, &cchActual)))
- cchActual = 0;
-
- if (cchActual) {
- // GetStrCodePages has found a sequence of characters that can be
- // represented in one font. MapFont will create this mystical font.
- HFONT result;
- // FIXME(jungshik) To make MapFont inherit the properties from
- // the current font, the current font needs to be selected into DC.
- // However, that leads to a failure in intl page cycler,
- // a slow rendering and issue 735750. We need to implement a
- // real font fallback at a higher level (issue 698618)
- if (langFontLink->MapFont(hdc, actualCodePages, characters[0], &result) == S_OK) {
- // This font will have to be deleted using the IMLangFontLink2
- // rather than the normal way.
- FontPlatformData platformData(result, 0, true);
- fontData = getCachedFontData(&platformData);
- }
- }
+ return NULL;
- ReleaseDC(0, hdc);
- return fontData;
}
const AtomicString& FontCache::alternateFamilyName(const AtomicString& familyName)
@@ -530,7 +478,7 @@ FontPlatformData* FontCache::getLastResortFallbackFont(
{
FontDescription::GenericFamilyType generic = description.genericFamily();
// TODO(jungshik): Mapping webkit generic to gfx::GenericFamilyType needs to be
- // more intelligent and the mapping function should be added to webkit_glue.
+ // more intelligent.
// This spot rarely gets reached. GetFontDataForCharacters() gets hit a lot
// more often (see TODO comment there).
const wchar_t* family = gfx::GetFontFamilyForScript(description.dominantScript(),
@@ -704,8 +652,7 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
}
return new FontPlatformData(hfont,
- fontDescription.computedPixelSize(),
- false);
+ fontDescription.computedPixelSize());
}
}
diff --git a/webkit/port/platform/graphics/FontCustomPlatformData.cpp b/webkit/port/platform/graphics/FontCustomPlatformData.cpp
index ab65b7e..9105a8c 100644
--- a/webkit/port/platform/graphics/FontCustomPlatformData.cpp
+++ b/webkit/port/platform/graphics/FontCustomPlatformData.cpp
@@ -34,7 +34,7 @@ FontCustomPlatformData::~FontCustomPlatformData()
FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic)
{
- return FontPlatformData(m_font, size, false);
+ return FontPlatformData(m_font, size);
}
FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
diff --git a/webkit/port/platform/graphics/FontPlatformDataWin.cpp b/webkit/port/platform/graphics/FontPlatformDataWin.cpp
index b529484..e1afaa2 100644
--- a/webkit/port/platform/graphics/FontPlatformDataWin.cpp
+++ b/webkit/port/platform/graphics/FontPlatformDataWin.cpp
@@ -28,8 +28,7 @@
#include <objidl.h>
#include <mlang.h>
-#undef LOG
-#include "webkit/glue/webkit_glue.h"
+#include "ChromiumBridge.h"
namespace WebCore {
@@ -49,9 +48,8 @@ FontPlatformData::FontPlatformData()
{
}
-FontPlatformData::FontPlatformData(HFONT font, float size,
- bool isMLangFont)
- : m_font(RefCountedHFONT::create(font, isMLangFont))
+FontPlatformData::FontPlatformData(HFONT font, float size)
+ : m_font(RefCountedHFONT::create(font))
, m_size(size)
, m_scriptCache(0)
, m_scriptFontProperties(0)
@@ -105,20 +103,14 @@ FontPlatformData::~FontPlatformData()
FontPlatformData::RefCountedHFONT::~RefCountedHFONT()
{
if (m_hfont != reinterpret_cast<HFONT>(-1)) {
- if (m_isMLangFont) {
- IMLangFontLink2* langFontLink = webkit_glue::GetLangFontLink();
- if (langFontLink)
- langFontLink->ReleaseFont(m_hfont);
- } else {
- DeleteObject(m_hfont);
- }
+ DeleteObject(m_hfont);
}
}
FontPlatformData::RefCountedHFONT* FontPlatformData::hashTableDeletedFontValue()
{
static RefPtr<RefCountedHFONT> deletedValue =
- RefCountedHFONT::create(reinterpret_cast<HFONT>(-1), false);
+ RefCountedHFONT::create(reinterpret_cast<HFONT>(-1));
return deletedValue.get();
}
@@ -136,7 +128,7 @@ SCRIPT_FONTPROPERTIES* FontPlatformData::scriptFontProperties() const
HRESULT hr = ScriptGetFontProperties(dc, scriptCache(),
m_scriptFontProperties);
if (S_OK != hr) {
- if (webkit_glue::EnsureFontLoaded(hfont())) {
+ if (ChromiumBridge::ensureFontLoaded(hfont())) {
// Retry ScriptGetFontProperties.
// TODO(nsylvain): Handle gracefully the error if this call
// also fails. See bug 1136944.
diff --git a/webkit/port/platform/graphics/FontPlatformDataWin.h b/webkit/port/platform/graphics/FontPlatformDataWin.h
index 7c9ef40..80f9df3 100644
--- a/webkit/port/platform/graphics/FontPlatformDataWin.h
+++ b/webkit/port/platform/graphics/FontPlatformDataWin.h
@@ -52,8 +52,7 @@ public:
// set everything to NULL.
FontPlatformData(WTF::HashTableDeletedValueType);
FontPlatformData();
- FontPlatformData(HFONT hfont, float size,
- bool isMLangFont);
+ FontPlatformData(HFONT hfont, float size);
FontPlatformData(float size, bool bold, bool oblique);
FontPlatformData(const FontPlatformData& data);
@@ -87,9 +86,9 @@ private:
// don't really want to re-create the HFONT.
class RefCountedHFONT : public RefCounted<RefCountedHFONT> {
public:
- static PassRefPtr<RefCountedHFONT> create(HFONT hfont, bool isMLangFont)
+ static PassRefPtr<RefCountedHFONT> create(HFONT hfont)
{
- return adoptRef(new RefCountedHFONT(hfont, isMLangFont));
+ return adoptRef(new RefCountedHFONT(hfont));
}
~RefCountedHFONT();
@@ -108,14 +107,11 @@ private:
private:
// The create() function assumes there is already a refcount of one
// so it can do adoptRef.
- RefCountedHFONT(HFONT hfont, bool isMLangFont)
- : m_hfont(hfont)
- , m_isMLangFont(isMLangFont)
+ RefCountedHFONT(HFONT hfont) : m_hfont(hfont)
{
}
HFONT m_hfont;
- bool m_isMLangFont;
};
static RefCountedHFONT* hashTableDeletedFontValue();
diff --git a/webkit/port/platform/graphics/FontWin.cpp b/webkit/port/platform/graphics/FontWin.cpp
index 6428bcb..565a44a 100644
--- a/webkit/port/platform/graphics/FontWin.cpp
+++ b/webkit/port/platform/graphics/FontWin.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include <windows.h>
+#include "ChromiumBridge.h"
#include "Font.h"
#include "FontFallbackList.h"
#include "GlyphBuffer.h"
@@ -35,7 +36,6 @@
#include "base/gfx/platform_canvas_win.h"
#include "base/gfx/skia_utils.h"
#include "graphics/SkiaUtils.h"
-#include "webkit/glue/webkit_glue.h"
namespace WebCore {
@@ -112,7 +112,7 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext,
if (!success && executions == 0) {
// Ask the browser to load the font for us and retry.
- webkit_glue::EnsureFontLoaded(font->platformData().hfont());
+ ChromiumBridge::ensureFontLoaded(font->platformData().hfont());
continue;
}
break;
diff --git a/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp b/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp
index b7d2549..6e0ea3e 100644
--- a/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp
+++ b/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp
@@ -31,13 +31,13 @@
#include <windows.h>
#include <vector>
+#include "ChromiumBridge.h"
#include "Font.h"
#include "GlyphPageTreeNode.h"
#include "SimpleFontData.h"
#include "UniscribeStateTextRun.h"
#include "base/win_util.h"
-#include "webkit/glue/webkit_glue.h"
namespace WebCore
{
@@ -76,7 +76,7 @@ static bool FillBMPGlyphs(UChar* buffer,
ReleaseDC(0, dc);
if (recurse) {
- if (webkit_glue::EnsureFontLoaded(fontData->m_font.hfont())) {
+ if (ChromiumBridge::ensureFontLoaded(fontData->m_font.hfont())) {
return FillBMPGlyphs(buffer, page, fontData, false);
} else {
FillEmptyGlyphs(page);
diff --git a/webkit/port/platform/graphics/SimpleFontDataWin.cpp b/webkit/port/platform/graphics/SimpleFontDataWin.cpp
index f35c08d..6be0a1e 100644
--- a/webkit/port/platform/graphics/SimpleFontDataWin.cpp
+++ b/webkit/port/platform/graphics/SimpleFontDataWin.cpp
@@ -27,6 +27,7 @@
*/
#include "config.h"
+#include "ChromiumBridge.h"
#include "Font.h"
#include "FontCache.h"
#include "SimpleFontData.h"
@@ -38,8 +39,6 @@
#include <objidl.h>
#include <mlang.h>
-#include "webkit/glue/webkit_glue.h"
-
namespace WebCore {
static inline float scaleEmToUnits(float x, int unitsPerEm)
@@ -54,7 +53,7 @@ void SimpleFontData::platformInit()
TEXTMETRIC tm = {0};
if (!GetTextMetrics(dc, &tm)) {
- if (webkit_glue::EnsureFontLoaded(m_font.hfont())) {
+ if (ChromiumBridge::ensureFontLoaded(m_font.hfont())) {
// Retry GetTextMetrics.
// TODO(nsylvain): Handle gracefully the error if this call also
// fails.
@@ -107,42 +106,16 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes
winfont.lfHeight = -lroundf(smallCapsSize);
HFONT hfont = CreateFontIndirect(&winfont);
m_smallCapsFontData =
- new SimpleFontData(FontPlatformData(hfont, smallCapsSize,
- false));
+ new SimpleFontData(FontPlatformData(hfont, smallCapsSize));
}
return m_smallCapsFontData;
}
bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
{
- // FIXME: Microsoft documentation seems to imply that characters can be output using a given font and DC
- // merely by testing code page intersection. This seems suspect though. Can't a font only partially
- // cover a given code page?
- IMLangFontLink2* langFontLink = webkit_glue::GetLangFontLink();
- if (!langFontLink)
- return false;
-
- HDC dc = GetDC((HWND)0);
-
- DWORD acpCodePages;
- langFontLink->CodePageToCodePages(CP_ACP, &acpCodePages);
-
- DWORD fontCodePages;
- langFontLink->GetFontCodePages(dc, m_font.hfont(), &fontCodePages);
-
- DWORD actualCodePages;
- long numCharactersProcessed;
- long offset = 0;
- while (offset < length) {
- langFontLink->GetStrCodePages(characters, length, acpCodePages, &actualCodePages, &numCharactersProcessed);
- if ((actualCodePages & fontCodePages) == 0)
- return false;
- offset += numCharactersProcessed;
- }
-
- ReleaseDC(0, dc);
-
- return true;
+ // This used to be implemented with IMLangFontLink2, but since that code has
+ // been disabled, this would always return false anyway.
+ return false;
}
void SimpleFontData::determinePitch()
@@ -155,7 +128,7 @@ void SimpleFontData::determinePitch()
// is *not* fixed pitch. Unbelievable but true.
TEXTMETRIC tm = {0};
if (!GetTextMetrics(dc, &tm)) {
- if (webkit_glue::EnsureFontLoaded(m_font.hfont())) {
+ if (ChromiumBridge::ensureFontLoaded(m_font.hfont())) {
// Retry GetTextMetrics.
// TODO(nsylvain): Handle gracefully the error if this call also fails.
// See bug 1136944.
@@ -179,7 +152,7 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
int width = 0;
if (!GetCharWidthI(dc, glyph, 1, 0, &width)) {
// Ask the browser to preload the font and retry.
- if (webkit_glue::EnsureFontLoaded(m_font.hfont())) {
+ if (ChromiumBridge::ensureFontLoaded(m_font.hfont())) {
if (!GetCharWidthI(dc, glyph, 1, 0, &width)) {
ASSERT_NOT_REACHED();
}