Title: [136057] trunk/Source
Revision
136057
Author
[email protected]
Date
2012-11-28 14:35:36 -0800 (Wed, 28 Nov 2012)

Log Message

[Chromium][Win] Remove ensureFontLoaded from PlatformSupport
https://bugs.webkit.org/show_bug.cgi?id=97696

Reviewed by Adam Barth.

Move ensureFontLoaded() from PlatformSupport to
FontPlatformDataChromiumWin. Part of a refactoring series; see
tracking bug 82948.

Source/WebCore:

* platform/chromium/PlatformSupport.h:
(PlatformSupport):
* platform/graphics/chromium/FontCacheChromiumWin.cpp:
(WebCore::fontContainsCharacter):
* platform/graphics/chromium/FontChromiumWin.cpp:
(WebCore::drawGlyphsWin):
* platform/graphics/chromium/FontPlatformDataChromiumWin.cpp:
(WebCore::FontPlatformData::scriptFontProperties):
(WebCore):
(WebCore::FontPlatformData::ensureFontLoaded):
* platform/graphics/chromium/FontPlatformDataChromiumWin.h:
(FontPlatformData):
* platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp:
(WebCore::getGlyphIndices):
(WebCore::fillBMPGlyphs):
* platform/graphics/chromium/SimpleFontDataChromiumWin.cpp:
(WebCore::SimpleFontData::platformInit):
(WebCore::SimpleFontData::determinePitch):
(WebCore::SimpleFontData::platformBoundsForGlyph):
(WebCore::SimpleFontData::platformWidthForGlyph):
* platform/graphics/chromium/UniscribeHelperTextRun.cpp:
(WebCore::UniscribeHelperTextRun::tryToPreloadFont):
* platform/graphics/skia/SkiaFontWin.cpp:
(WebCore::paintSkiaText):

Source/WebKit/chromium:

* src/PlatformSupport.cpp:
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136056 => 136057)


--- trunk/Source/WebCore/ChangeLog	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebCore/ChangeLog	2012-11-28 22:35:36 UTC (rev 136057)
@@ -1,3 +1,39 @@
+2012-11-28  Mark Pilgrim  <[email protected]>
+
+        [Chromium][Win] Remove ensureFontLoaded from PlatformSupport
+        https://bugs.webkit.org/show_bug.cgi?id=97696
+
+        Reviewed by Adam Barth.
+
+        Move ensureFontLoaded() from PlatformSupport to
+        FontPlatformDataChromiumWin. Part of a refactoring series; see
+        tracking bug 82948.
+
+        * platform/chromium/PlatformSupport.h:
+        (PlatformSupport):
+        * platform/graphics/chromium/FontCacheChromiumWin.cpp:
+        (WebCore::fontContainsCharacter):
+        * platform/graphics/chromium/FontChromiumWin.cpp:
+        (WebCore::drawGlyphsWin):
+        * platform/graphics/chromium/FontPlatformDataChromiumWin.cpp:
+        (WebCore::FontPlatformData::scriptFontProperties):
+        (WebCore):
+        (WebCore::FontPlatformData::ensureFontLoaded):
+        * platform/graphics/chromium/FontPlatformDataChromiumWin.h:
+        (FontPlatformData):
+        * platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp:
+        (WebCore::getGlyphIndices):
+        (WebCore::fillBMPGlyphs):
+        * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        (WebCore::SimpleFontData::determinePitch):
+        (WebCore::SimpleFontData::platformBoundsForGlyph):
+        (WebCore::SimpleFontData::platformWidthForGlyph):
+        * platform/graphics/chromium/UniscribeHelperTextRun.cpp:
+        (WebCore::UniscribeHelperTextRun::tryToPreloadFont):
+        * platform/graphics/skia/SkiaFontWin.cpp:
+        (WebCore::paintSkiaText):
+
 2012-11-28  [email protected]  <[email protected]>
 
         [WinCairo] Crash when requesting favicon.

Modified: trunk/Source/WebCore/platform/chromium/PlatformSupport.h (136056 => 136057)


--- trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-11-28 22:35:36 UTC (rev 136057)
@@ -49,10 +49,6 @@
 typedef struct _NPP NPP_t;
 typedef NPP_t* NPP;
 
-#if OS(WINDOWS)
-typedef struct HFONT__* HFONT;
-#endif
-
 namespace WebCore {
 
 class Color;
@@ -77,11 +73,6 @@
 
 class PlatformSupport {
 public:
-    // Font ---------------------------------------------------------------
-#if OS(WINDOWS)
-    static bool ensureFontLoaded(HFONT);
-#endif
-
     // IndexedDB ----------------------------------------------------------
     static PassRefPtr<IDBFactoryBackendInterface> idbFactory();
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp (136056 => 136057)


--- trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp	2012-11-28 22:35:36 UTC (rev 136057)
@@ -33,10 +33,10 @@
 #include "FontCache.h"
 
 #include "Font.h"
+#include "FontPlatformDataChromiumWin.h"
 #include "FontUtilsChromiumWin.h"
 #include "HWndDC.h"
 #include "LayoutTestSupport.h"
-#include "PlatformSupport.h"
 #include "SimpleFontData.h"
 #include <unicode/uniset.h>
 #include <wtf/HashMap.h>
@@ -283,7 +283,7 @@
     HWndDC hdc(0);
     HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(hdc, hfont));
     int count = GetFontUnicodeRanges(hdc, 0);
-    if (!count && PlatformSupport::ensureFontLoaded(hfont))
+    if (!count && FontPlatformData::ensureFontLoaded(hfont))
         count = GetFontUnicodeRanges(hdc, 0);
     if (!count) {
         LOG_ERROR("Unable to get the font unicode range after second attempt");

Modified: trunk/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp (136056 => 136057)


--- trunk/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp	2012-11-28 22:35:36 UTC (rev 136057)
@@ -33,9 +33,9 @@
 #include "Font.h"
 
 #include "FontFallbackList.h"
+#include "FontPlatformDataChromiumWin.h"
 #include "GlyphBuffer.h"
 #include "NotImplemented.h"
-#include "PlatformSupport.h"
 #include "PlatformContextSkia.h"
 #include "SimpleFontData.h"
 #include "SkiaFontWin.h"
@@ -527,7 +527,7 @@
             success = painter.drawGlyphs(curLen, &glyphs[0], &advances[0], horizontalOffset - point.x() - currentWidth);
             if (!success && !executions) {
                 // Ask the browser to load the font for us and retry.
-                PlatformSupport::ensureFontLoaded(font->platformData().hfont());
+                FontPlatformData::ensureFontLoaded(font->platformData().hfont());
                 continue;
             }
             break;

Modified: trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp (136056 => 136057)


--- trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp	2012-11-28 22:35:36 UTC (rev 136057)
@@ -34,13 +34,13 @@
 
 #include "FontCache.h"
 #include "HWndDC.h"
-#include "PlatformSupport.h"
 #include "SharedBuffer.h"
 #include "SkTypeface_win.h"
 #include "SkiaFontWin.h"
-
 #include <mlang.h>
 #include <objidl.h>
+#include <public/Platform.h>
+#include <public/win/WebSandboxSupport.h>
 #include <windows.h>
 #include <wtf/StdLibExtras.h>
 
@@ -175,7 +175,7 @@
             HRESULT hr = ScriptGetFontProperties(dc, scriptCache(),
                                                  m_scriptFontProperties);
             if (S_OK != hr) {
-                if (PlatformSupport::ensureFontLoaded(hfont())) {
+                if (FontPlatformData::ensureFontLoaded(hfont())) {
                     // FIXME: Handle gracefully the error if this call also fails.
                     hr = ScriptGetFontProperties(dc, scriptCache(),
                                                  m_scriptFontProperties);
@@ -223,4 +223,12 @@
 }
 #endif
 
+bool FontPlatformData::ensureFontLoaded(HFONT font)
+{
+    WebKit::WebSandboxSupport* sandboxSupport = WebKit::Platform::current()->sandboxSupport();
+    // if there is no sandbox, then we can assume the font
+    // was able to be loaded successfully already
+    return sandboxSupport ? sandboxSupport->ensureFontLoaded(font) : true;
 }
+
+}

Modified: trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h (136056 => 136057)


--- trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h	2012-11-28 22:35:36 UTC (rev 136057)
@@ -106,6 +106,8 @@
     SCRIPT_FONTPROPERTIES* scriptFontProperties() const;
     SCRIPT_CACHE* scriptCache() const { return &m_scriptCache; }
 
+    static bool ensureFontLoaded(HFONT);
+
 private:
     // We refcount the internal HFONT so that FontPlatformData can be
     // efficiently copied. WebKit depends on being able to copy it, and we

Modified: trunk/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp (136056 => 136057)


--- trunk/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp	2012-11-28 22:35:36 UTC (rev 136057)
@@ -33,9 +33,9 @@
 #include <vector>
 
 #include "Font.h"
+#include "FontPlatformDataChromiumWin.h"
 #include "GlyphPageTreeNode.h"
 #include "HWndDC.h"
-#include "PlatformSupport.h"
 #include "SimpleFontData.h"
 #include "SystemInfo.h"
 #include "UniscribeHelperTextRun.h"
@@ -56,7 +56,7 @@
 {
     if (GetGlyphIndices(dc, characters, charactersLength, glyphBuffer, flag) != GDI_ERROR)
         return true;
-    if (PlatformSupport::ensureFontLoaded(font)) {
+    if (FontPlatformData::ensureFontLoaded(font)) {
         if (GetGlyphIndices(dc, characters, charactersLength, glyphBuffer, flag) != GDI_ERROR)
             return true;
         // FIXME: Handle gracefully the error if this call also fails.
@@ -88,7 +88,7 @@
 
     TEXTMETRIC tm = {0};
     if (!GetTextMetrics(dc, &tm)) {
-        if (PlatformSupport::ensureFontLoaded(fontData->platformData().hfont())) {
+        if (FontPlatformData::ensureFontLoaded(fontData->platformData().hfont())) {
             if (!GetTextMetrics(dc, &tm)) {
                 // FIXME: Handle gracefully the error if this call also fails.
                 // See http://crbug.com/6401

Modified: trunk/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp (136056 => 136057)


--- trunk/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp	2012-11-28 22:35:36 UTC (rev 136057)
@@ -36,14 +36,13 @@
 #include "Font.h"
 #include "FontCache.h"
 #include "FontDescription.h"
+#include "FontPlatformDataChromiumWin.h"
 #include "HWndDC.h"
-#include "PlatformSupport.h"
-#include <wtf/MathExtras.h>
-
+#include <mlang.h>
+#include <objidl.h>
 #include <unicode/uchar.h>
 #include <unicode/unorm.h>
-#include <objidl.h>
-#include <mlang.h>
+#include <wtf/MathExtras.h>
 
 namespace WebCore {
 
@@ -61,7 +60,7 @@
 
     TEXTMETRIC textMetric = {0};
     if (!GetTextMetrics(dc, &textMetric)) {
-        if (PlatformSupport::ensureFontLoaded(m_platformData.hfont())) {
+        if (FontPlatformData::ensureFontLoaded(m_platformData.hfont())) {
             // Retry GetTextMetrics.
             // FIXME: Handle gracefully the error if this call also fails.
             // See http://crbug.com/6401.
@@ -136,7 +135,7 @@
     // is *not* fixed pitch.  Unbelievable but true.
     TEXTMETRIC textMetric = {0};
     if (!GetTextMetrics(dc, &textMetric)) {
-        if (PlatformSupport::ensureFontLoaded(m_platformData.hfont())) {
+        if (FontPlatformData::ensureFontLoaded(m_platformData.hfont())) {
             // Retry GetTextMetrics.
             // FIXME: Handle gracefully the error if this call also fails.
             // See http://crbug.com/6401.
@@ -159,7 +158,7 @@
     GLYPHMETRICS gdiMetrics;
     static const MAT2 identity = { 0, 1,  0, 0,  0, 0,  0, 1 };
     if (GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity) == -1) {
-        if (PlatformSupport::ensureFontLoaded(m_platformData.hfont())) {
+        if (FontPlatformData::ensureFontLoaded(m_platformData.hfont())) {
             // Retry GetTextMetrics.
             // FIXME: Handle gracefully the error if this call also fails.
             // See http://crbug.com/6401.
@@ -185,7 +184,7 @@
     int width = 0;
     if (!GetCharWidthI(dc, glyph, 1, 0, &width)) {
         // Ask the browser to preload the font and retry.
-        if (PlatformSupport::ensureFontLoaded(m_platformData.hfont())) {
+        if (FontPlatformData::ensureFontLoaded(m_platformData.hfont())) {
             // FIXME: Handle gracefully the error if this call also fails.
             // See http://crbug.com/6401.
             if (!GetCharWidthI(dc, glyph, 1, 0, &width))

Modified: trunk/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp (136056 => 136057)


--- trunk/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp	2012-11-28 22:35:36 UTC (rev 136057)
@@ -32,7 +32,7 @@
 #include "UniscribeHelperTextRun.h"
 
 #include "Font.h"
-#include "PlatformSupport.h"
+#include "FontPlatformDataChromiumWin.h"
 #include "SimpleFontData.h"
 #include "TextRun.h"
 
@@ -82,7 +82,7 @@
     // 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.
-    PlatformSupport::ensureFontLoaded(font);
+    FontPlatformData::ensureFontLoaded(font);
 }
 
 bool UniscribeHelperTextRun::nextWinFontData(

Modified: trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp (136056 => 136057)


--- trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp	2012-11-28 22:35:36 UTC (rev 136057)
@@ -32,10 +32,10 @@
 #include "SkiaFontWin.h"
 
 #include "AffineTransform.h"
+#include "FontPlatformDataChromiumWin.h"
 #include "Gradient.h"
 #include "Pattern.h"
 #include "PlatformContextSkia.h"
-#include "PlatformSupport.h"
 #include "SimpleFontData.h"
 #include "SkCanvas.h"
 #include "SkDevice.h"
@@ -221,7 +221,7 @@
     TextDrawingModeFlags textMode = platformContext->getTextDrawingMode();
     // Ensure font load for printing, because PDF device needs it.
     if (platformContext->isVector())
-        PlatformSupport::ensureFontLoaded(hfont);
+        FontPlatformData::ensureFontLoaded(hfont);
 
     // Filling (if necessary). This is the common case.
     SkPaint paint;

Modified: trunk/Source/WebKit/chromium/ChangeLog (136056 => 136057)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-11-28 22:35:36 UTC (rev 136057)
@@ -1,3 +1,17 @@
+2012-11-28  Mark Pilgrim  <[email protected]>
+
+        [Chromium][Win] Remove ensureFontLoaded from PlatformSupport
+        https://bugs.webkit.org/show_bug.cgi?id=97696
+
+        Reviewed by Adam Barth.
+
+        Move ensureFontLoaded() from PlatformSupport to
+        FontPlatformDataChromiumWin. Part of a refactoring series; see
+        tracking bug 82948.
+
+        * src/PlatformSupport.cpp:
+        (WebCore):
+
 2012-11-28  Eric Uhrhane  <[email protected]>
 
         [chromium] Add unit tests for ChromeClientImpl::getNavigationPolicy

Modified: trunk/Source/WebKit/chromium/src/PlatformSupport.cpp (136056 => 136057)


--- trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-11-28 22:21:47 UTC (rev 136056)
+++ trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-11-28 22:35:36 UTC (rev 136057)
@@ -104,19 +104,6 @@
 
 namespace WebCore {
 
-// Font -----------------------------------------------------------------------
-
-#if OS(WINDOWS)
-bool PlatformSupport::ensureFontLoaded(HFONT font)
-{
-    WebSandboxSupport* ss = WebKit::Platform::current()->sandboxSupport();
-
-    // if there is no sandbox, then we can assume the font
-    // was able to be loaded successfully already
-    return ss ? ss->ensureFontLoaded(font) : true;
-}
-#endif
-
 // Indexed Database -----------------------------------------------------------
 
 PassRefPtr<IDBFactoryBackendInterface> PlatformSupport::idbFactory()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to