WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Move FontCustomPlatformData to platform/skia
FontCustomPlatformData.patch (text/plain), 23.82 KB, created by
Kwang Yul Seo
on 2010-09-06 14:29:32 PDT
(
hide
)
Description:
Move FontCustomPlatformData to platform/skia
Filename:
MIME Type:
Creator:
Kwang Yul Seo
Created:
2010-09-06 14:29:32 PDT
Size:
23.82 KB
patch
obsolete
>Index: WebCore/ChangeLog >=================================================================== >--- WebCore/ChangeLog (revision 66849) >+++ WebCore/ChangeLog (working copy) >@@ -1,3 +1,31 @@ >+2010-09-06 Kwang Yul Seo <skyul@company100.net> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make sure skia is not Chromium specific >+ https://bugs.webkit.org/show_bug.cgi?id=39672 >+ >+ FontCustomPlatformData is not Chromium-specific. Move it to platform/skia. >+ >+ No new tests because this is pure refactoring. >+ >+ * WebCore.gyp/WebCore.gyp: >+ * WebCore.gypi: >+ * platform/graphics/chromium/FontCustomPlatformData.cpp: Removed. >+ * platform/graphics/chromium/FontCustomPlatformData.h: Removed. >+ * platform/graphics/skia/FontCustomPlatformData.cpp: Added. >+ (WebCore::FontCustomPlatformData::~FontCustomPlatformData): >+ (WebCore::FontCustomPlatformData::fontPlatformData): >+ (WebCore::createUniqueFontName): >+ (WebCore::RemoteFontStream::RemoteFontStream): >+ (WebCore::RemoteFontStream::~RemoteFontStream): >+ (WebCore::RemoteFontStream::rewind): >+ (WebCore::RemoteFontStream::read): >+ (WebCore::createFontCustomPlatformData): >+ (WebCore::FontCustomPlatformData::supportsFormat): >+ * platform/graphics/skia/FontCustomPlatformData.h: Added. >+ (WebCore::FontCustomPlatformData::FontCustomPlatformData): >+ > 2010-09-06 Martin Robinson <mrobinson@igalia.com> > > Reviewed by Gustavo Noronha Silva. >Index: WebCore/WebCore.gypi >=================================================================== >--- WebCore/WebCore.gypi (revision 66848) >+++ WebCore/WebCore.gypi (working copy) >@@ -2284,8 +2284,6 @@ > 'platform/graphics/chromium/FontCacheChromiumWin.cpp', > 'platform/graphics/chromium/FontCacheLinux.cpp', > 'platform/graphics/chromium/FontChromiumWin.cpp', >- 'platform/graphics/chromium/FontCustomPlatformData.cpp', >- 'platform/graphics/chromium/FontCustomPlatformData.h', > 'platform/graphics/chromium/FontLinux.cpp', > 'platform/graphics/chromium/FontPlatformData.h', > 'platform/graphics/chromium/FontPlatformDataChromiumWin.cpp', >@@ -2458,6 +2456,8 @@ > 'platform/graphics/skia/BitmapImageSingleFrameSkia.h', > 'platform/graphics/skia/FloatPointSkia.cpp', > 'platform/graphics/skia/FloatRectSkia.cpp', >+ 'platform/graphics/skia/FontCustomPlatformData.cpp', >+ 'platform/graphics/skia/FontCustomPlatformData.h', > 'platform/graphics/skia/GradientSkia.cpp', > 'platform/graphics/skia/GraphicsContextPlatformPrivate.h', > 'platform/graphics/skia/GraphicsContextSkia.cpp', >Index: WebCore/WebCore.gyp/WebCore.gyp >=================================================================== >--- WebCore/WebCore.gyp/WebCore.gyp (revision 66848) >+++ WebCore/WebCore.gyp/WebCore.gyp (working copy) >@@ -1220,7 +1220,7 @@ > > # The Mac currently uses FontCustomPlatformData.cpp from > # platform/graphics/mac, included by regex above, instead. >- '../platform/graphics/chromium/FontCustomPlatformData.cpp', >+ '../platform/graphics/skia/FontCustomPlatformData.cpp', > > # The Mac currently uses ScrollbarThemeChromiumMac.mm, which is not > # related to ScrollbarThemeChromium.cpp. >Index: WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp >=================================================================== >--- WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp (revision 66849) >+++ WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp (working copy) >@@ -1,213 +0,0 @@ >-/* >- * Copyright (C) 2007 Apple Computer, Inc. >- * Copyright (c) 2007, 2008, 2009, 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: >- * >- * * Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * * 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. >- * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >- * OWNER OR 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 "FontCustomPlatformData.h" >- >-#if OS(WINDOWS) >-#include "Base64.h" >-#include "ChromiumBridge.h" >-#include "OpenTypeUtilities.h" >-#elif OS(LINUX) >-#include "SkStream.h" >-#endif >- >-#include "FontPlatformData.h" >-#include "NotImplemented.h" >-#include "OpenTypeSanitizer.h" >-#include "SharedBuffer.h" >- >-#if OS(WINDOWS) >-#include <objbase.h> >-#elif OS(LINUX) >-#include <cstring> >-#endif >- >-namespace WebCore { >- >-FontCustomPlatformData::~FontCustomPlatformData() >-{ >-#if OS(WINDOWS) >- if (m_fontReference) >- RemoveFontMemResourceEx(m_fontReference); >-#elif OS(LINUX) >- if (m_fontReference) >- m_fontReference->unref(); >-#endif >-} >- >-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontRenderingMode mode) >-{ >-#if OS(WINDOWS) >- ASSERT(m_fontReference); >- >- LOGFONT logFont; >- // m_name comes from createUniqueFontName, which, in turn, gets >- // it from base64-encoded uuid (128-bit). So, m_name >- // can never be longer than LF_FACESIZE (32). >- if (m_name.length() + 1 >= LF_FACESIZE) { >- ASSERT_NOT_REACHED(); >- return FontPlatformData(); >- } >- memcpy(logFont.lfFaceName, m_name.charactersWithNullTermination(), >- sizeof(logFont.lfFaceName[0]) * (1 + m_name.length())); >- >- // FIXME: almost identical to FillLogFont in FontCacheWin.cpp. >- // Need to refactor. >- logFont.lfHeight = -size; >- logFont.lfWidth = 0; >- logFont.lfEscapement = 0; >- logFont.lfOrientation = 0; >- logFont.lfUnderline = false; >- logFont.lfStrikeOut = false; >- logFont.lfCharSet = DEFAULT_CHARSET; >- logFont.lfOutPrecision = OUT_TT_ONLY_PRECIS; >- logFont.lfQuality = ChromiumBridge::layoutTestMode() ? >- NONANTIALIASED_QUALITY : >- DEFAULT_QUALITY; // Honor user's desktop settings. >- logFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; >- logFont.lfItalic = italic; >- logFont.lfWeight = bold ? 700 : 400; >- >- HFONT hfont = CreateFontIndirect(&logFont); >- return FontPlatformData(hfont, size); >-#elif OS(LINUX) >- ASSERT(m_fontReference); >- return FontPlatformData(m_fontReference, "", size, bold && !m_fontReference->isBold(), italic && !m_fontReference->isItalic()); >-#else >- notImplemented(); >- return FontPlatformData(); >-#endif >-} >- >-#if OS(WINDOWS) >-// Creates a unique and unpredictable font name, in order to avoid collisions and to >-// not allow access from CSS. >-static String createUniqueFontName() >-{ >- Vector<char> fontUuid(sizeof(GUID)); >- CoCreateGuid(reinterpret_cast<GUID*>(fontUuid.data())); >- >- Vector<char> fontNameVector; >- base64Encode(fontUuid, fontNameVector); >- ASSERT(fontNameVector.size() < LF_FACESIZE); >- return String(fontNameVector.data(), fontNameVector.size()); >-} >-#endif >- >-#if OS(LINUX) >-class RemoteFontStream : public SkStream { >-public: >- explicit RemoteFontStream(PassRefPtr<SharedBuffer> buffer) >- : m_buffer(buffer) >- , m_offset(0) >- { >- } >- >- virtual ~RemoteFontStream() >- { >- } >- >- virtual bool rewind() >- { >- m_offset = 0; >- return true; >- } >- >- virtual size_t read(void* buffer, size_t size) >- { >- if (!buffer && !size) { >- // This is request for the length of the stream. >- return m_buffer->size(); >- } >- if (!buffer) { >- // This is a request to skip bytes. This operation is not supported. >- return 0; >- } >- // This is a request to read bytes. >- if (!m_buffer->data() || !m_buffer->size()) >- return 0; >- size_t left = m_buffer->size() - m_offset; >- size_t toRead = (left > size) ? size : left; >- std::memcpy(buffer, m_buffer->data() + m_offset, toRead); >- m_offset += toRead; >- return toRead; >- } >- >-private: >- RefPtr<SharedBuffer> m_buffer; >- size_t m_offset; >-}; >-#endif >- >-FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) >-{ >- ASSERT_ARG(buffer, buffer); >- >-#if ENABLE(OPENTYPE_SANITIZER) >- OpenTypeSanitizer sanitizer(buffer); >- RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize(); >- if (!transcodeBuffer) >- return 0; // validation failed. >- buffer = transcodeBuffer.get(); >-#endif >- >-#if OS(WINDOWS) >- // Introduce the font to GDI. AddFontMemResourceEx should be used with care, because it will pollute the process's >- // font namespace (Windows has no API for creating an HFONT from data without exposing the font to the >- // entire process first). >- String fontName = createUniqueFontName(); >- HANDLE fontReference = renameAndActivateFont(buffer, fontName); >- if (!fontReference) >- return 0; >- return new FontCustomPlatformData(fontReference, fontName); >-#elif OS(LINUX) >- RemoteFontStream* stream = new RemoteFontStream(buffer); >- SkTypeface* typeface = SkTypeface::CreateFromStream(stream); >- if (!typeface) >- return 0; >- return new FontCustomPlatformData(typeface); >-#else >- notImplemented(); >- return 0; >-#endif >-} >- >-bool FontCustomPlatformData::supportsFormat(const String& format) >-{ >- return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") >-#if ENABLE(OPENTYPE_SANITIZER) >- || equalIgnoringCase(format, "woff") >-#endif >- ; >-} >- >-} >Index: WebCore/platform/graphics/chromium/FontCustomPlatformData.h >=================================================================== >--- WebCore/platform/graphics/chromium/FontCustomPlatformData.h (revision 66849) >+++ WebCore/platform/graphics/chromium/FontCustomPlatformData.h (working copy) >@@ -1,81 +0,0 @@ >-/* >- * Copyright (C) 2007 Apple Computer, Inc. >- * Copyright (c) 2007, 2008, 2009, 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: >- * >- * * Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * * 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. >- * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >- * OWNER OR 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 FontCustomPlatformData_h >-#define FontCustomPlatformData_h >- >-#include "FontRenderingMode.h" >-#include <wtf/Forward.h> >-#include <wtf/Noncopyable.h> >- >-#if OS(WINDOWS) >-#include "PlatformString.h" >-#include <windows.h> >-#elif OS(LINUX) >-#include "SkTypeface.h" >-#endif >- >-namespace WebCore { >- >-class FontPlatformData; >-class SharedBuffer; >- >-struct FontCustomPlatformData : Noncopyable { >-#if OS(WINDOWS) >- FontCustomPlatformData(HANDLE fontReference, const String& name) >- : m_fontReference(fontReference) >- , m_name(name) >- {} >-#elif OS(LINUX) >- explicit FontCustomPlatformData(SkTypeface* typeface) >- : m_fontReference(typeface) >- {} >-#endif >- >- ~FontCustomPlatformData(); >- >- FontPlatformData fontPlatformData(int size, bool bold, bool italic, >- FontRenderingMode = NormalRenderingMode); >- >- static bool supportsFormat(const String&); >- >-#if OS(WINDOWS) >- HANDLE m_fontReference; >- String m_name; >-#elif OS(LINUX) >- SkTypeface* m_fontReference; >-#endif >-}; >- >-FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer*); >-} >- >-#endif // FontCustomPlatformData_h >Index: WebCore/platform/graphics/skia/FontCustomPlatformData.cpp >=================================================================== >--- WebCore/platform/graphics/skia/FontCustomPlatformData.cpp (revision 0) >+++ WebCore/platform/graphics/skia/FontCustomPlatformData.cpp (revision 0) >@@ -0,0 +1,213 @@ >+/* >+ * Copyright (C) 2007 Apple Computer, Inc. >+ * Copyright (c) 2007, 2008, 2009, 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: >+ * >+ * * Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * * 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. >+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >+ * OWNER OR 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 "FontCustomPlatformData.h" >+ >+#if OS(WINDOWS) >+#include "Base64.h" >+#include "ChromiumBridge.h" >+#include "OpenTypeUtilities.h" >+#elif OS(LINUX) >+#include "SkStream.h" >+#endif >+ >+#include "FontPlatformData.h" >+#include "NotImplemented.h" >+#include "OpenTypeSanitizer.h" >+#include "SharedBuffer.h" >+ >+#if OS(WINDOWS) >+#include <objbase.h> >+#elif OS(LINUX) >+#include <cstring> >+#endif >+ >+namespace WebCore { >+ >+FontCustomPlatformData::~FontCustomPlatformData() >+{ >+#if OS(WINDOWS) >+ if (m_fontReference) >+ RemoveFontMemResourceEx(m_fontReference); >+#elif OS(LINUX) >+ if (m_fontReference) >+ m_fontReference->unref(); >+#endif >+} >+ >+FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontRenderingMode mode) >+{ >+#if OS(WINDOWS) >+ ASSERT(m_fontReference); >+ >+ LOGFONT logFont; >+ // m_name comes from createUniqueFontName, which, in turn, gets >+ // it from base64-encoded uuid (128-bit). So, m_name >+ // can never be longer than LF_FACESIZE (32). >+ if (m_name.length() + 1 >= LF_FACESIZE) { >+ ASSERT_NOT_REACHED(); >+ return FontPlatformData(); >+ } >+ memcpy(logFont.lfFaceName, m_name.charactersWithNullTermination(), >+ sizeof(logFont.lfFaceName[0]) * (1 + m_name.length())); >+ >+ // FIXME: almost identical to FillLogFont in FontCacheWin.cpp. >+ // Need to refactor. >+ logFont.lfHeight = -size; >+ logFont.lfWidth = 0; >+ logFont.lfEscapement = 0; >+ logFont.lfOrientation = 0; >+ logFont.lfUnderline = false; >+ logFont.lfStrikeOut = false; >+ logFont.lfCharSet = DEFAULT_CHARSET; >+ logFont.lfOutPrecision = OUT_TT_ONLY_PRECIS; >+ logFont.lfQuality = ChromiumBridge::layoutTestMode() ? >+ NONANTIALIASED_QUALITY : >+ DEFAULT_QUALITY; // Honor user's desktop settings. >+ logFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; >+ logFont.lfItalic = italic; >+ logFont.lfWeight = bold ? 700 : 400; >+ >+ HFONT hfont = CreateFontIndirect(&logFont); >+ return FontPlatformData(hfont, size); >+#elif OS(LINUX) >+ ASSERT(m_fontReference); >+ return FontPlatformData(m_fontReference, "", size, bold && !m_fontReference->isBold(), italic && !m_fontReference->isItalic()); >+#else >+ notImplemented(); >+ return FontPlatformData(); >+#endif >+} >+ >+#if OS(WINDOWS) >+// Creates a unique and unpredictable font name, in order to avoid collisions and to >+// not allow access from CSS. >+static String createUniqueFontName() >+{ >+ Vector<char> fontUuid(sizeof(GUID)); >+ CoCreateGuid(reinterpret_cast<GUID*>(fontUuid.data())); >+ >+ Vector<char> fontNameVector; >+ base64Encode(fontUuid, fontNameVector); >+ ASSERT(fontNameVector.size() < LF_FACESIZE); >+ return String(fontNameVector.data(), fontNameVector.size()); >+} >+#endif >+ >+#if OS(LINUX) >+class RemoteFontStream : public SkStream { >+public: >+ explicit RemoteFontStream(PassRefPtr<SharedBuffer> buffer) >+ : m_buffer(buffer) >+ , m_offset(0) >+ { >+ } >+ >+ virtual ~RemoteFontStream() >+ { >+ } >+ >+ virtual bool rewind() >+ { >+ m_offset = 0; >+ return true; >+ } >+ >+ virtual size_t read(void* buffer, size_t size) >+ { >+ if (!buffer && !size) { >+ // This is request for the length of the stream. >+ return m_buffer->size(); >+ } >+ if (!buffer) { >+ // This is a request to skip bytes. This operation is not supported. >+ return 0; >+ } >+ // This is a request to read bytes. >+ if (!m_buffer->data() || !m_buffer->size()) >+ return 0; >+ size_t left = m_buffer->size() - m_offset; >+ size_t toRead = (left > size) ? size : left; >+ std::memcpy(buffer, m_buffer->data() + m_offset, toRead); >+ m_offset += toRead; >+ return toRead; >+ } >+ >+private: >+ RefPtr<SharedBuffer> m_buffer; >+ size_t m_offset; >+}; >+#endif >+ >+FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) >+{ >+ ASSERT_ARG(buffer, buffer); >+ >+#if ENABLE(OPENTYPE_SANITIZER) >+ OpenTypeSanitizer sanitizer(buffer); >+ RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize(); >+ if (!transcodeBuffer) >+ return 0; // validation failed. >+ buffer = transcodeBuffer.get(); >+#endif >+ >+#if OS(WINDOWS) >+ // Introduce the font to GDI. AddFontMemResourceEx should be used with care, because it will pollute the process's >+ // font namespace (Windows has no API for creating an HFONT from data without exposing the font to the >+ // entire process first). >+ String fontName = createUniqueFontName(); >+ HANDLE fontReference = renameAndActivateFont(buffer, fontName); >+ if (!fontReference) >+ return 0; >+ return new FontCustomPlatformData(fontReference, fontName); >+#elif OS(LINUX) >+ RemoteFontStream* stream = new RemoteFontStream(buffer); >+ SkTypeface* typeface = SkTypeface::CreateFromStream(stream); >+ if (!typeface) >+ return 0; >+ return new FontCustomPlatformData(typeface); >+#else >+ notImplemented(); >+ return 0; >+#endif >+} >+ >+bool FontCustomPlatformData::supportsFormat(const String& format) >+{ >+ return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") >+#if ENABLE(OPENTYPE_SANITIZER) >+ || equalIgnoringCase(format, "woff") >+#endif >+ ; >+} >+ >+} >Index: WebCore/platform/graphics/skia/FontCustomPlatformData.h >=================================================================== >--- WebCore/platform/graphics/skia/FontCustomPlatformData.h (revision 0) >+++ WebCore/platform/graphics/skia/FontCustomPlatformData.h (revision 0) >@@ -0,0 +1,81 @@ >+/* >+ * Copyright (C) 2007 Apple Computer, Inc. >+ * Copyright (c) 2007, 2008, 2009, 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: >+ * >+ * * Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * * 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. >+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >+ * OWNER OR 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 FontCustomPlatformData_h >+#define FontCustomPlatformData_h >+ >+#include "FontRenderingMode.h" >+#include <wtf/Forward.h> >+#include <wtf/Noncopyable.h> >+ >+#if OS(WINDOWS) >+#include "PlatformString.h" >+#include <windows.h> >+#elif OS(LINUX) >+#include "SkTypeface.h" >+#endif >+ >+namespace WebCore { >+ >+class FontPlatformData; >+class SharedBuffer; >+ >+struct FontCustomPlatformData : Noncopyable { >+#if OS(WINDOWS) >+ FontCustomPlatformData(HANDLE fontReference, const String& name) >+ : m_fontReference(fontReference) >+ , m_name(name) >+ {} >+#elif OS(LINUX) >+ explicit FontCustomPlatformData(SkTypeface* typeface) >+ : m_fontReference(typeface) >+ {} >+#endif >+ >+ ~FontCustomPlatformData(); >+ >+ FontPlatformData fontPlatformData(int size, bool bold, bool italic, >+ FontRenderingMode = NormalRenderingMode); >+ >+ static bool supportsFormat(const String&); >+ >+#if OS(WINDOWS) >+ HANDLE m_fontReference; >+ String m_name; >+#elif OS(LINUX) >+ SkTypeface* m_fontReference; >+#endif >+}; >+ >+FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer*); >+} >+ >+#endif // FontCustomPlatformData_h
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
jamesr
:
review-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 39672
:
57011
|
62408
|
66669
|
66841
|
67055
|
67056
|
67199
|
68133
|
71180
|
71787