Diff
Modified: trunk/Source/WebCore/ChangeLog (129256 => 129257)
--- trunk/Source/WebCore/ChangeLog 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebCore/ChangeLog 2012-09-21 21:43:57 UTC (rev 129257)
@@ -1,3 +1,37 @@
+2012-09-21 Mark Pilgrim <pilg...@chromium.org>
+
+ [Chromium] remove getFontFamilyForCharacters from PlatformSupport
+ https://bugs.webkit.org/show_bug.cgi?id=96282
+
+ Reviewed by Tony Chang.
+
+ Migrating away from PlatformSupport. getFontFamilyForCharacters is
+ moved to FontCache.h and overridden by the two platforms that
+ need it (Chromium Linux and Blackberry). New files for the overrides.
+ Part of a larger refactoring series. See tracking bug 82948.
+
+ * PlatformBlackBerry.cmake:
+ * WebCore.gypi:
+ * platform/chromium/PlatformSupport.h:
+ (PlatformSupport):
+ * platform/graphics/FontCache.h:
+ (SimpleFontFamily):
+ (FontCache):
+ * platform/graphics/blackberry/FontCacheBlackberry.cpp: Added.
+ (WebCore):
+ (WebCore::FontCache::getFontFamilyForCharacters):
+ * platform/graphics/blackberry/skia/PlatformSupport.cpp:
+ (WebCore):
+ * platform/graphics/blackberry/skia/PlatformSupport.h:
+ (PlatformSupport):
+ * platform/graphics/chromium/FontCacheAndroid.cpp:
+ (WebCore::FontCache::getFontDataForCharacters):
+ * platform/graphics/chromium/FontCacheChromiumLinux.cpp: Added.
+ (WebCore):
+ (WebCore::FontCache::getFontFamilyForCharacters):
+ * platform/graphics/skia/FontCacheSkia.cpp:
+ (WebCore::FontCache::getFontDataForCharacters):
+
2012-09-21 Chris Fleizach <cfleiz...@apple.com>
AX: WebKit exposes incorrect bounds for embedded SVG in HTML
Modified: trunk/Source/WebCore/PlatformBlackBerry.cmake (129256 => 129257)
--- trunk/Source/WebCore/PlatformBlackBerry.cmake 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebCore/PlatformBlackBerry.cmake 2012-09-21 21:43:57 UTC (rev 129257)
@@ -42,6 +42,7 @@
# Skia font backend sources
LIST(APPEND WebCore_SOURCES
+ platform/graphics/blackberry/FontCacheBlackberry.cpp
platform/graphics/blackberry/skia/PlatformBridge.cpp
platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp
platform/graphics/harfbuzz/FontHarfBuzz.cpp
Modified: trunk/Source/WebCore/WebCore.gypi (129256 => 129257)
--- trunk/Source/WebCore/WebCore.gypi 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebCore/WebCore.gypi 2012-09-21 21:43:57 UTC (rev 129257)
@@ -4888,6 +4888,7 @@
'platform/graphics/chromium/DrawingBufferChromium.cpp',
'platform/graphics/chromium/Extensions3DChromium.h',
'platform/graphics/chromium/FontCacheAndroid.cpp',
+ 'platform/graphics/chromium/FontCacheChromiumLinux.cpp',
'platform/graphics/chromium/FontCacheChromiumWin.cpp',
'platform/graphics/chromium/FontChromiumWin.cpp',
'platform/graphics/chromium/FontPlatformData.h',
Modified: trunk/Source/WebCore/platform/chromium/PlatformSupport.h (129256 => 129257)
--- trunk/Source/WebCore/platform/chromium/PlatformSupport.h 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebCore/platform/chromium/PlatformSupport.h 2012-09-21 21:43:57 UTC (rev 129257)
@@ -101,13 +101,6 @@
#endif
#if OS(DARWIN)
static bool loadFont(NSFont* srcFont, CGFontRef*, uint32_t* fontID);
-#elif OS(UNIX)
- struct FontFamily {
- String name;
- bool isBold;
- bool isItalic;
- };
- static void getFontFamilyForCharacters(const UChar*, size_t numCharacters, const char* preferredLocale, FontFamily*);
#endif
// IndexedDB ----------------------------------------------------------
Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (129256 => 129257)
--- trunk/Source/WebCore/platform/graphics/FontCache.h 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h 2012-09-21 21:43:57 UTC (rev 129257)
@@ -33,6 +33,7 @@
#include <limits.h>
#include <wtf/Forward.h>
#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
#include <wtf/unicode/Unicode.h>
#if OS(WINDOWS)
@@ -113,6 +114,13 @@
OpenTypeVerticalData* getVerticalData(const FontFileKey&, const FontPlatformData&);
#endif
+ struct SimpleFontFamily {
+ String name;
+ bool isBold;
+ bool isItalic;
+ };
+ static void getFontFamilyForCharacters(const UChar* characters, size_t numCharacters, const char* preferredLocale, SimpleFontFamily*);
+
private:
FontCache();
~FontCache();
Added: trunk/Source/WebCore/platform/graphics/blackberry/FontCacheBlackberry.cpp (0 => 129257)
--- trunk/Source/WebCore/platform/graphics/blackberry/FontCacheBlackberry.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/blackberry/FontCacheBlackberry.cpp 2012-09-21 21:43:57 UTC (rev 129257)
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2012 Google 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 "FontCache.h"
+
+#include "FontRenderStyle.h"
+
+#include <fontconfig/fontconfig.h>
+#include <string.h>
+#include <unicode/utf16.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+void FontCache::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters, const char*, FontCache::SimpleFontFamily* family)
+{
+ FcCharSet* cset = FcCharSetCreate();
+ for (size_t i = 0; i < numCharacters; ++i) {
+ if (U16_IS_SURROGATE(characters[i])
+ && U16_IS_SURROGATE_LEAD(characters[i])
+ && i != numCharacters - 1
+ && U16_IS_TRAIL(characters[i + 1])) {
+ FcCharSetAddChar(cset, U16_GET_SUPPLEMENTARY(characters[i], characters[i+1]));
+ i++;
+ } else
+ FcCharSetAddChar(cset, characters[i]);
+ }
+ FcPattern* pattern = FcPatternCreate();
+
+ FcValue fcvalue;
+ fcvalue.type = FcTypeCharSet;
+ fcvalue.u.c = cset;
+ FcPatternAdd(pattern, FC_CHARSET, fcvalue, FcFalse);
+
+ fcvalue.type = FcTypeBool;
+ fcvalue.u.b = FcTrue;
+ FcPatternAdd(pattern, FC_SCALABLE, fcvalue, FcFalse);
+
+ FcConfigSubstitute(0, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
+
+ FcResult result;
+ FcFontSet* fontSet = FcFontSort(0, pattern, 0, 0, &result);
+ FcPatternDestroy(pattern);
+ FcCharSetDestroy(cset);
+
+ if (!fontSet) {
+ family->name = String();
+ family->isBold = false;
+ family->isItalic = false;
+ return;
+ }
+
+ // Older versions of fontconfig have a bug where they cannot select
+ // only scalable fonts so we have to manually filter the results.
+ for (int i = 0; i < fontSet->nfont; ++i) {
+ FcPattern* current = fontSet->fonts[i];
+ FcBool isScalable;
+
+ if (FcPatternGetBool(current, FC_SCALABLE, 0, &isScalable) != FcResultMatch
+ || !isScalable)
+ continue;
+
+ // fontconfig can also return fonts which are unreadable
+ FcChar8* cFilename;
+ if (FcPatternGetString(current, FC_FILE, 0, &cFilename) != FcResultMatch)
+ continue;
+
+ if (access(reinterpret_cast<char*>(cFilename), R_OK))
+ continue;
+
+ FcChar8* familyName;
+ if (FcPatternGetString(current, FC_FAMILY, 0, &familyName) == FcResultMatch) {
+ const char* charFamily = reinterpret_cast<char*>(familyName);
+ family->name = String::fromUTF8(charFamily, strlen(charFamily));
+ }
+
+ int weight;
+ if (FcPatternGetInteger(current, FC_WEIGHT, 0, &weight) == FcResultMatch)
+ family->isBold = weight >= FC_WEIGHT_BOLD;
+ else
+ family->isBold = false;
+
+ int slant;
+ if (FcPatternGetInteger(current, FC_SLANT, 0, &slant) == FcResultMatch)
+ family->isItalic = slant != FC_SLANT_ROMAN;
+ else
+ family->isItalic = false;
+
+ FcFontSetDestroy(fontSet);
+ return;
+ }
+
+ FcFontSetDestroy(fontSet);
+}
+
+}; // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/blackberry/skia/PlatformSupport.cpp (129256 => 129257)
--- trunk/Source/WebCore/platform/graphics/blackberry/skia/PlatformSupport.cpp 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebCore/platform/graphics/blackberry/skia/PlatformSupport.cpp 2012-09-21 21:43:57 UTC (rev 129257)
@@ -129,86 +129,4 @@
FcPatternDestroy(match);
}
-void PlatformSupport::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters, const char*, FontFamily* family)
-{
- FcCharSet* cset = FcCharSetCreate();
- for (size_t i = 0; i < numCharacters; ++i) {
- if (U16_IS_SURROGATE(characters[i])
- && U16_IS_SURROGATE_LEAD(characters[i])
- && i != numCharacters - 1
- && U16_IS_TRAIL(characters[i + 1])) {
- FcCharSetAddChar(cset, U16_GET_SUPPLEMENTARY(characters[i], characters[i+1]));
- i++;
- } else
- FcCharSetAddChar(cset, characters[i]);
- }
- FcPattern* pattern = FcPatternCreate();
-
- FcValue fcvalue;
- fcvalue.type = FcTypeCharSet;
- fcvalue.u.c = cset;
- FcPatternAdd(pattern, FC_CHARSET, fcvalue, FcFalse);
-
- fcvalue.type = FcTypeBool;
- fcvalue.u.b = FcTrue;
- FcPatternAdd(pattern, FC_SCALABLE, fcvalue, FcFalse);
-
- FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
-
- FcResult result;
- FcFontSet* fontSet = FcFontSort(0, pattern, 0, 0, &result);
- FcPatternDestroy(pattern);
- FcCharSetDestroy(cset);
-
- if (!fontSet) {
- family->name = String();
- family->isBold = false;
- family->isItalic = false;
- return;
- }
-
- // Older versions of fontconfig have a bug where they cannot select
- // only scalable fonts so we have to manually filter the results.
- for (int i = 0; i < fontSet->nfont; ++i) {
- FcPattern* current = fontSet->fonts[i];
- FcBool isScalable;
-
- if (FcPatternGetBool(current, FC_SCALABLE, 0, &isScalable) != FcResultMatch
- || !isScalable)
- continue;
-
- // fontconfig can also return fonts which are unreadable
- FcChar8* cFilename;
- if (FcPatternGetString(current, FC_FILE, 0, &cFilename) != FcResultMatch)
- continue;
-
- if (access(reinterpret_cast<char*>(cFilename), R_OK))
- continue;
-
- FcChar8* familyName;
- if (FcPatternGetString(current, FC_FAMILY, 0, &familyName) == FcResultMatch) {
- const char* charFamily = reinterpret_cast<char*>(familyName);
- family->name = String::fromUTF8(charFamily, strlen(charFamily));
- }
-
- int weight;
- if (FcPatternGetInteger(current, FC_WEIGHT, 0, &weight) == FcResultMatch)
- family->isBold = weight >= FC_WEIGHT_BOLD;
- else
- family->isBold = false;
-
- int slant;
- if (FcPatternGetInteger(current, FC_SLANT, 0, &slant) == FcResultMatch)
- family->isItalic = slant != FC_SLANT_ROMAN;
- else
- family->isItalic = false;
-
- FcFontSetDestroy(fontSet);
- return;
- }
-
- FcFontSetDestroy(fontSet);
-}
-
}; // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/blackberry/skia/PlatformSupport.h (129256 => 129257)
--- trunk/Source/WebCore/platform/graphics/blackberry/skia/PlatformSupport.h 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebCore/platform/graphics/blackberry/skia/PlatformSupport.h 2012-09-21 21:43:57 UTC (rev 129257)
@@ -42,12 +42,6 @@
class PlatformSupport {
public:
static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result);
- struct FontFamily {
- String name;
- bool isBold;
- bool isItalic;
- };
- static void getFontFamilyForCharacters(const UChar*, size_t numCharacters, const char* preferredLocale, FontFamily*);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp (129256 => 129257)
--- trunk/Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp 2012-09-21 21:43:57 UTC (rev 129257)
@@ -35,7 +35,6 @@
#include "FontDescription.h"
#include "FontPlatformData.h"
#include "NotImplemented.h"
-#include "PlatformSupport.h"
#include "SimpleFontData.h"
#include "SkPaint.h"
@@ -100,13 +99,9 @@
const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
{
- icu::Locale locale = icu::Locale::getDefault();
- PlatformSupport::FontFamily family;
- PlatformSupport::getFontFamilyForCharacters(characters, length, locale.getLanguage(), &family);
- if (family.name.isEmpty())
- return 0;
-
- AtomicString atomicFamily(family.name);
+ // FIXME: We do not use fontconfig on Android, so use simple logic for now.
+ // https://bugs.webkit.org/show_bug.cgi?id=67587
+ AtomicString atomicFamily("Arial");
return getCachedFontData(getCachedFontPlatformData(font.fontDescription(), atomicFamily, DoNotRetain), DoNotRetain);
}
Added: trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumLinux.cpp (0 => 129257)
--- trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumLinux.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumLinux.cpp 2012-09-21 21:43:57 UTC (rev 129257)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 Google 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 "FontCache.h"
+
+#include <public/Platform.h>
+#include <public/linux/WebFontFamily.h>
+#include <public/linux/WebFontInfo.h>
+#include <public/linux/WebSandboxSupport.h>
+
+namespace WebCore {
+
+void FontCache::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters, const char* preferredLocale, FontCache::SimpleFontFamily* family)
+{
+ WebKit::WebFontFamily webFamily;
+ if (WebKit::Platform::current()->sandboxSupport())
+ WebKit::Platform::current()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters, preferredLocale, &webFamily);
+ else
+ WebKit::WebFontInfo::familyForChars(characters, numCharacters, preferredLocale, &webFamily);
+ family->name = String::fromUTF8(webFamily.name.data(), webFamily.name.length());
+ family->isBold = webFamily.isBold;
+ family->isItalic = webFamily.isItalic;
+}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/skia/FontCacheSkia.cpp (129256 => 129257)
--- trunk/Source/WebCore/platform/graphics/skia/FontCacheSkia.cpp 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebCore/platform/graphics/skia/FontCacheSkia.cpp 2012-09-21 21:43:57 UTC (rev 129257)
@@ -33,6 +33,7 @@
#include "Font.h"
#include "FontDescription.h"
+#include "FontFamily.h"
#include "FontPlatformData.h"
#include "Logging.h"
#include "NotImplemented.h"
@@ -59,8 +60,8 @@
int length)
{
icu::Locale locale = icu::Locale::getDefault();
- PlatformSupport::FontFamily family;
- PlatformSupport::getFontFamilyForCharacters(characters, length, locale.getLanguage(), &family);
+ FontCache::SimpleFontFamily family;
+ FontCache::getFontFamilyForCharacters(characters, length, locale.getLanguage(), &family);
if (family.name.isEmpty())
return 0;
Modified: trunk/Source/WebKit/chromium/ChangeLog (129256 => 129257)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-09-21 21:43:57 UTC (rev 129257)
@@ -1,3 +1,18 @@
+2012-09-21 Mark Pilgrim <pilg...@chromium.org>
+
+ [Chromium] remove getFontFamilyForCharacters from PlatformSupport
+ https://bugs.webkit.org/show_bug.cgi?id=96282
+
+ Reviewed by Tony Chang.
+
+ Migrating away from PlatformSupport. getFontFamilyForCharacters is
+ moved to FontCache.h and overridden by the two platforms that
+ need it (Chromium Linux and Blackberry). New files for the overrides.
+ Part of a larger refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
2012-09-21 Dana Jansens <dan...@chromium.org>
[chromium] Add setters to WebFilterOperation for IPC pickling
Modified: trunk/Source/WebKit/chromium/src/PlatformSupport.cpp (129256 => 129257)
--- trunk/Source/WebKit/chromium/src/PlatformSupport.cpp 2012-09-21 21:40:49 UTC (rev 129256)
+++ trunk/Source/WebKit/chromium/src/PlatformSupport.cpp 2012-09-21 21:43:57 UTC (rev 129257)
@@ -233,28 +233,8 @@
return false;
}
#elif OS(UNIX)
-void PlatformSupport::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters, const char* preferredLocale, FontFamily* family)
-{
-#if OS(ANDROID)
- // FIXME: We do not use fontconfig on Android, so use simple logic for now.
- // https://bugs.webkit.org/show_bug.cgi?id=67587
- family->name = "Arial";
- family->isBold = false;
- family->isItalic = false;
-#else
- WebFontFamily webFamily;
- if (WebKit::Platform::current()->sandboxSupport())
- WebKit::Platform::current()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters, preferredLocale, &webFamily);
- else
- WebFontInfo::familyForChars(characters, numCharacters, preferredLocale, &webFamily);
- family->name = String::fromUTF8(webFamily.name.data(), webFamily.name.length());
- family->isBold = webFamily.isBold;
- family->isItalic = webFamily.isItalic;
#endif
-}
-#endif
-
// Indexed Database -----------------------------------------------------------
PassRefPtr<IDBFactoryBackendInterface> PlatformSupport::idbFactory()