[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
ossy at webkit.org
ossy at webkit.org
Thu Dec 3 13:26:46 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit b34da7e623e81d2dbb4b3d925386002b16db2a44
Author: ossy at webkit.org <ossy at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Nov 4 11:27:21 2009 +0000
Unreviewed rollout.
Patch by Csaba Osztrogonác <ossy at webkit.org> on 2009-11-04
Revert r50496 because it broke all layout tests on QtBuildBot.
WebCore:
* WebCore.pro:
* platform/graphics/qt/FontCacheQt.cpp:
(WebCore::fontCache):
(WebCore::FontCache::FontCache):
(WebCore::FontCache::getTraitsInFamily):
(WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey):
(WebCore::FontPlatformDataCacheKey::isHashTableDeletedValue):
(WebCore::FontPlatformDataCacheKey::):
(WebCore::FontPlatformDataCacheKey::operator==):
(WebCore::FontPlatformDataCacheKey::hash):
(WebCore::FontPlatformDataCacheKey::computeHash):
(WebCore::FontPlatformDataCacheKey::hashTableDeletedSize):
(WebCore::FontPlatformDataCacheKeyHash::hash):
(WebCore::FontPlatformDataCacheKeyHash::equal):
(WebCore::FontPlatformDataCacheKeyTraits::emptyValue):
(WebCore::FontPlatformDataCacheKeyTraits::constructDeletedValue):
(WebCore::FontPlatformDataCacheKeyTraits::isDeletedValue):
(WebCore::FontCache::getCachedFontPlatformData):
(WebCore::FontCache::getCachedFontData):
(WebCore::FontCache::getLastResortFallbackFont):
(WebCore::FontCache::releaseFontData):
(WebCore::FontCache::purgeInactiveFontData):
(WebCore::FontCache::addClient):
(WebCore::FontCache::removeClient):
(WebCore::FontCache::invalidate):
* platform/graphics/qt/FontFallbackListQt.cpp: Added.
(WebCore::FontFallbackList::FontFallbackList):
(WebCore::FontFallbackList::invalidate):
(WebCore::FontFallbackList::releaseFontData):
(WebCore::FontFallbackList::determinePitch):
(WebCore::FontFallbackList::fontDataAt):
(WebCore::FontFallbackList::fontDataForCharacters):
(WebCore::FontFallbackList::setPlatformFont):
* platform/graphics/qt/FontPlatformData.h:
(WebCore::FontPlatformData::pixelSize):
* platform/graphics/qt/FontPlatformDataQt.cpp:
(WebCore::FontPlatformData::FontPlatformData):
LayoutTests:
* svg/text/resources: Removed.
* svg/text/resources/text-font-invalid.svg: Removed.
* svg/text/text-font-invalid-expected.txt: Removed.
* svg/text/text-font-invalid.html: Removed.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50510 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 5da1dfb..fd52421 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-11-04 Csaba Osztrogonác <ossy at webkit.org>
+
+ Unreviewed rollout.
+
+ Revert r50496 because it broke all layout tests on QtBuildBot.
+
+ * svg/text/resources: Removed.
+ * svg/text/resources/text-font-invalid.svg: Removed.
+ * svg/text/text-font-invalid-expected.txt: Removed.
+ * svg/text/text-font-invalid.html: Removed.
+
2009-11-03 Roland Steiner <rolandsteiner at chromium.org>
Reviewed by Mark Rowe.
diff --git a/LayoutTests/svg/text/resources/text-font-invalid.svg b/LayoutTests/svg/text/resources/text-font-invalid.svg
deleted file mode 100644
index 0f9e006..0000000
--- a/LayoutTests/svg/text/resources/text-font-invalid.svg
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1">
- <defs>
- <font-face font-family="Arbitrary font not on the system">
- <font-face-src>
- <font-face-name name="VeryUnlikelyToExistFont"/>
- </font-face-src>
- </font-face>
- </defs>
- <g>
- <text>
- <tspan font-family="Arbitrary font not on the system">Foobar</tspan>
- </text>
- </g>
-</svg>
-
diff --git a/LayoutTests/svg/text/text-font-invalid-expected.txt b/LayoutTests/svg/text/text-font-invalid-expected.txt
deleted file mode 100644
index 8c848d6..0000000
--- a/LayoutTests/svg/text/text-font-invalid-expected.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This test is to ensure that we do not crash when loading a SVG image without a valid font-family
-PASS: Did not crash when rendering the SVG image.
-
diff --git a/LayoutTests/svg/text/text-font-invalid.html b/LayoutTests/svg/text/text-font-invalid.html
deleted file mode 100644
index 7c9a16f..0000000
--- a/LayoutTests/svg/text/text-font-invalid.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<html>
- <body>
- This test is to ensure that we do not crash when loading a SVG image without a valid font-family
- <div id="log"><span style='color: red;'>FAIL:</span> Did not complete test</div>
- <img src="resources/text-font-invalid.svg" />
- <script>
- if (window.layoutTestController)
- layoutTestController.dumpAsText();
- document.getElementById("log").innerHTML = "<span style='color: green;'>PASS:</span> Did not crash when rendering the SVG image.";
- </script>
- </body>
-</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7f51667..c202641 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,47 @@
+2009-11-04 Csaba Osztrogonác <ossy at webkit.org>
+
+ Unreviewed rollout.
+
+ Revert r50496 because it broke all layout tests on QtBuildBot.
+
+ * WebCore.pro:
+ * platform/graphics/qt/FontCacheQt.cpp:
+ (WebCore::fontCache):
+ (WebCore::FontCache::FontCache):
+ (WebCore::FontCache::getTraitsInFamily):
+ (WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey):
+ (WebCore::FontPlatformDataCacheKey::isHashTableDeletedValue):
+ (WebCore::FontPlatformDataCacheKey::):
+ (WebCore::FontPlatformDataCacheKey::operator==):
+ (WebCore::FontPlatformDataCacheKey::hash):
+ (WebCore::FontPlatformDataCacheKey::computeHash):
+ (WebCore::FontPlatformDataCacheKey::hashTableDeletedSize):
+ (WebCore::FontPlatformDataCacheKeyHash::hash):
+ (WebCore::FontPlatformDataCacheKeyHash::equal):
+ (WebCore::FontPlatformDataCacheKeyTraits::emptyValue):
+ (WebCore::FontPlatformDataCacheKeyTraits::constructDeletedValue):
+ (WebCore::FontPlatformDataCacheKeyTraits::isDeletedValue):
+ (WebCore::FontCache::getCachedFontPlatformData):
+ (WebCore::FontCache::getCachedFontData):
+ (WebCore::FontCache::getLastResortFallbackFont):
+ (WebCore::FontCache::releaseFontData):
+ (WebCore::FontCache::purgeInactiveFontData):
+ (WebCore::FontCache::addClient):
+ (WebCore::FontCache::removeClient):
+ (WebCore::FontCache::invalidate):
+ * platform/graphics/qt/FontFallbackListQt.cpp: Added.
+ (WebCore::FontFallbackList::FontFallbackList):
+ (WebCore::FontFallbackList::invalidate):
+ (WebCore::FontFallbackList::releaseFontData):
+ (WebCore::FontFallbackList::determinePitch):
+ (WebCore::FontFallbackList::fontDataAt):
+ (WebCore::FontFallbackList::fontDataForCharacters):
+ (WebCore::FontFallbackList::setPlatformFont):
+ * platform/graphics/qt/FontPlatformData.h:
+ (WebCore::FontPlatformData::pixelSize):
+ * platform/graphics/qt/FontPlatformDataQt.cpp:
+ (WebCore::FontPlatformData::FontPlatformData):
+
2009-11-04 Joanmarie Diggs <joanmarie.diggs at gmail.com>
Reviewed by Jan Alonzo.
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 24d9d79..cb41841 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1187,7 +1187,6 @@ SOURCES += \
platform/image-decoders/qt/RGBA32BufferQt.cpp \
platform/graphics/filters/FEGaussianBlur.cpp \
platform/graphics/FontDescription.cpp \
- platform/graphics/FontFallbackList.cpp \
platform/graphics/FontFamily.cpp \
platform/graphics/BitmapImage.cpp \
platform/graphics/Color.cpp \
@@ -1198,7 +1197,6 @@ SOURCES += \
platform/graphics/FloatSize.cpp \
platform/graphics/FontData.cpp \
platform/graphics/Font.cpp \
- platform/graphics/FontCache.cpp \
platform/graphics/GeneratedImage.cpp \
platform/graphics/Gradient.cpp \
platform/graphics/GraphicsContext.cpp \
@@ -2384,6 +2382,7 @@ SOURCES += \
platform/qt/SharedBufferQt.cpp \
platform/graphics/qt/FontCacheQt.cpp \
platform/graphics/qt/FontCustomPlatformData.cpp \
+ platform/graphics/qt/FontFallbackListQt.cpp \
platform/graphics/qt/GlyphPageTreeNodeQt.cpp \
platform/graphics/qt/SimpleFontDataQt.cpp \
platform/qt/KURLQt.cpp \
diff --git a/WebCore/platform/graphics/qt/FontCacheQt.cpp b/WebCore/platform/graphics/qt/FontCacheQt.cpp
index 2aa9e11..1113eae 100644
--- a/WebCore/platform/graphics/qt/FontCacheQt.cpp
+++ b/WebCore/platform/graphics/qt/FontCacheQt.cpp
@@ -38,32 +38,256 @@ using namespace WTF;
namespace WebCore {
-void FontCache::platformInit()
+FontCache* fontCache()
{
+ DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ());
+ return &globalFontCache;
}
-const SimpleFontData* FontCache::getFontDataForCharacters(const Font&, const UChar*, int)
+FontCache::FontCache()
{
- return 0;
}
-FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+void FontCache::getTraitsInFamily(const AtomicString&, Vector<unsigned>&)
+{
+}
+
+// This type must be consistent with FontPlatformData's ctor - the one which
+// gets FontDescription as it's parameter.
+class FontPlatformDataCacheKey {
+public:
+ FontPlatformDataCacheKey(const FontDescription& description)
+ : m_familyName()
+ , m_size(description.computedPixelSize())
+ , m_bold(false)
+ , m_italic(description.italic())
+ , m_smallCaps(description.smallCaps())
+ , m_hash(0)
+ {
+ // FIXME: Map all FontWeight values to QFont weights in FontPlatformData's ctor and follow it here
+ if (FontPlatformData::toQFontWeight(description.weight()) > QFont::Normal)
+ m_bold = true;
+
+ const FontFamily* family = &description.family();
+ while (family) {
+ m_familyName.append(family->family());
+ family = family->next();
+ if (family)
+ m_familyName.append(',');
+ }
+
+ computeHash();
+ }
+
+ FontPlatformDataCacheKey(const FontPlatformData& fontData)
+ : m_familyName(static_cast<String>(fontData.family()))
+ , m_size(fontData.pixelSize())
+ , m_bold(fontData.bold())
+ , m_italic(fontData.italic())
+ , m_smallCaps(fontData.smallCaps())
+ , m_hash(0)
+ {
+ computeHash();
+ }
+
+ FontPlatformDataCacheKey(HashTableDeletedValueType) : m_size(hashTableDeletedSize()) { }
+ bool isHashTableDeletedValue() const { return m_size == hashTableDeletedSize(); }
+
+ enum HashTableEmptyValueType { HashTableEmptyValue };
+
+ FontPlatformDataCacheKey(HashTableEmptyValueType)
+ : m_familyName()
+ , m_size(0)
+ , m_bold(false)
+ , m_italic(false)
+ , m_smallCaps(false)
+ , m_hash(0)
+ {
+ }
+
+ bool operator==(const FontPlatformDataCacheKey& other) const
+ {
+ if (m_hash != other.m_hash)
+ return false;
+
+ return equalIgnoringCase(m_familyName, other.m_familyName) && m_size == other.m_size &&
+ m_bold == other.m_bold && m_italic == other.m_italic && m_smallCaps == other.m_smallCaps;
+ }
+
+ unsigned hash() const
+ {
+ return m_hash;
+ }
+
+ void computeHash()
+ {
+ unsigned hashCodes[] = {
+ CaseFoldingHash::hash(m_familyName),
+ m_size | static_cast<unsigned>(m_bold << sizeof(unsigned) * 8 - 1)
+ | static_cast<unsigned>(m_italic) << sizeof(unsigned) *8 - 2
+ | static_cast<unsigned>(m_smallCaps) << sizeof(unsigned) * 8 - 3
+ };
+ m_hash = StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+ }
+
+private:
+ String m_familyName;
+ int m_size;
+ bool m_bold;
+ bool m_italic;
+ bool m_smallCaps;
+ unsigned m_hash;
+
+ static unsigned hashTableDeletedSize() { return 0xFFFFFFFFU; }
+};
+
+struct FontPlatformDataCacheKeyHash {
+ static unsigned hash(const FontPlatformDataCacheKey& key)
+ {
+ return key.hash();
+ }
+
+ static bool equal(const FontPlatformDataCacheKey& a, const FontPlatformDataCacheKey& b)
+ {
+ return a == b;
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+struct FontPlatformDataCacheKeyTraits : WTF::GenericHashTraits<FontPlatformDataCacheKey> {
+ static const bool needsDestruction = true;
+ static const FontPlatformDataCacheKey& emptyValue()
+ {
+ DEFINE_STATIC_LOCAL(FontPlatformDataCacheKey, key, (FontPlatformDataCacheKey::HashTableEmptyValue));
+ return key;
+ }
+ static void constructDeletedValue(FontPlatformDataCacheKey& slot)
+ {
+ new (&slot) FontPlatformDataCacheKey(HashTableDeletedValue);
+ }
+ static bool isDeletedValue(const FontPlatformDataCacheKey& value)
+ {
+ return value.isHashTableDeletedValue();
+ }
+};
+
+typedef HashMap<FontPlatformDataCacheKey, FontPlatformData*, FontPlatformDataCacheKeyHash, FontPlatformDataCacheKeyTraits> FontPlatformDataCache;
+
+// using Q_GLOBAL_STATIC leads to crash. TODO investigate the way to fix this.
+static FontPlatformDataCache* gFontPlatformDataCache = 0;
+
+FontPlatformData* FontCache::getCachedFontPlatformData(const FontDescription& description, const AtomicString&, bool)
{
- return new FontPlatformData(font.fontDescription());
+ if (!gFontPlatformDataCache)
+ gFontPlatformDataCache = new FontPlatformDataCache;
+
+ FontPlatformDataCacheKey key(description);
+ FontPlatformData* platformData = gFontPlatformDataCache->get(key);
+ if (!platformData) {
+ platformData = new FontPlatformData(description);
+ gFontPlatformDataCache->add(key, platformData);
+ }
+ return platformData;
+}
+
+typedef HashMap<FontPlatformDataCacheKey, std::pair<SimpleFontData*, unsigned>, FontPlatformDataCacheKeyHash, FontPlatformDataCacheKeyTraits> FontDataCache;
+
+static FontDataCache* gFontDataCache = 0;
+
+static const int cMaxInactiveFontData = 40;
+static const int cTargetInactiveFontData = 32;
+
+static ListHashSet<const SimpleFontData*>* gInactiveFontDataSet = 0;
+
+SimpleFontData* FontCache::getCachedFontData(const FontPlatformData* fontPlatformData)
+{
+ if (!gFontDataCache) {
+ gFontDataCache = new FontDataCache;
+ gInactiveFontDataSet = new ListHashSet<const SimpleFontData*>;
+ }
+
+ FontPlatformDataCacheKey key(*fontPlatformData);
+ FontDataCache::iterator it = gFontDataCache->find(key);
+ if (it == gFontDataCache->end()) {
+ SimpleFontData* fontData = new SimpleFontData(*fontPlatformData);
+ gFontDataCache->add(key, std::pair<SimpleFontData*, unsigned>(fontData, 1));
+ return fontData;
+ }
+ if (!it->second.second++) {
+ ASSERT(gInactiveFontDataSet->contains(it->second.first));
+ gInactiveFontDataSet->remove(it->second.first);
+ }
+ return it->second.first;
}
FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription&)
{
- return new FontPlatformData();
+ return 0;
}
-void FontCache::getTraitsInFamily(const AtomicString&, Vector<unsigned>&)
+void FontCache::releaseFontData(const WebCore::SimpleFontData* fontData)
{
+ ASSERT(gFontDataCache);
+ ASSERT(!fontData->isCustomFont());
+
+ FontPlatformDataCacheKey key(fontData->platformData());
+ FontDataCache::iterator it = gFontDataCache->find(key);
+ ASSERT(it != gFontDataCache->end());
+ if (!--it->second.second) {
+ gInactiveFontDataSet->add(it->second.first);
+ if (gInactiveFontDataSet->size() > cMaxInactiveFontData)
+ purgeInactiveFontData(gInactiveFontDataSet->size() - cTargetInactiveFontData);
+ }
}
-FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString&)
+void FontCache::purgeInactiveFontData(int count)
{
- return new FontPlatformData(fontDescription);
+ static bool isPurging; // Guard against reentry when e.g. a deleted FontData releases its small caps FontData.
+ if (isPurging)
+ return;
+
+ isPurging = true;
+
+ ListHashSet<const SimpleFontData*>::iterator it = gInactiveFontDataSet->begin();
+ ListHashSet<const SimpleFontData*>::iterator end = gInactiveFontDataSet->end();
+ for (int i = 0; i < count && it != end; ++i, ++it) {
+ FontPlatformDataCacheKey key = (*it)->platformData();
+ pair<SimpleFontData*, unsigned> fontDataPair = gFontDataCache->take(key);
+ ASSERT(fontDataPair.first != 0);
+ ASSERT(!fontDataPair.second);
+ delete fontDataPair.first;
+
+ FontPlatformData* platformData = gFontPlatformDataCache->take(key);
+ if (platformData)
+ delete platformData;
+ }
+
+ if (it == end) {
+ // Removed everything
+ gInactiveFontDataSet->clear();
+ } else {
+ for (int i = 0; i < count; ++i)
+ gInactiveFontDataSet->remove(gInactiveFontDataSet->begin());
+ }
+
+ isPurging = false;
+}
+
+void FontCache::addClient(FontSelector*)
+{
+}
+
+void FontCache::removeClient(FontSelector*)
+{
+}
+
+void FontCache::invalidate()
+{
+ if (!gFontPlatformDataCache || !gFontDataCache)
+ return;
+
+ purgeInactiveFontData();
}
} // namespace WebCore
diff --git a/WebCore/platform/graphics/qt/FontFallbackListQt.cpp b/WebCore/platform/graphics/qt/FontFallbackListQt.cpp
new file mode 100644
index 0000000..8e1e4f6
--- /dev/null
+++ b/WebCore/platform/graphics/qt/FontFallbackListQt.cpp
@@ -0,0 +1,138 @@
+/*
+ Copyright (C) 2008 Holger Hans Peter Freyther
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ Replacement of the stock FontFallbackList as Qt is going to find us a
+ replacement font, will do caching and the other stuff we implement in
+ WebKit.
+*/
+
+#include "config.h"
+#include "FontFallbackList.h"
+
+#include "Font.h"
+#include "FontCache.h"
+#include "SegmentedFontData.h"
+
+#include <QDebug>
+
+namespace WebCore {
+
+FontFallbackList::FontFallbackList()
+ : m_pageZero(0)
+ , m_cachedPrimarySimpleFontData(0)
+ , m_fontSelector(0)
+ , m_familyIndex(0)
+ , m_pitch(UnknownPitch)
+ , m_loadingCustomFonts(false)
+ , m_generation(0)
+{
+}
+
+void FontFallbackList::invalidate(WTF::PassRefPtr<WebCore::FontSelector> fontSelector)
+{
+ releaseFontData();
+ m_fontList.clear();
+ m_pageZero = 0;
+ m_pages.clear();
+ m_cachedPrimarySimpleFontData = 0;
+ m_familyIndex = 0;
+ m_pitch = UnknownPitch;
+ m_loadingCustomFonts = false;
+ m_fontSelector = fontSelector;
+ m_generation = 0;
+}
+
+void FontFallbackList::releaseFontData()
+{
+ unsigned numFonts = m_fontList.size();
+ for (unsigned i = 0; i < numFonts; ++i) {
+ if (m_fontList[i].second)
+ delete m_fontList[i].first;
+ else {
+ ASSERT(!m_fontList[i].first->isSegmented());
+ fontCache()->releaseFontData(static_cast<const SimpleFontData*>(m_fontList[i].first));
+ }
+ }
+}
+
+void FontFallbackList::determinePitch(const WebCore::Font* font) const
+{
+ const FontData* fontData = primaryFontData(font);
+ if (!fontData->isSegmented())
+ m_pitch = static_cast<const SimpleFontData*>(fontData)->pitch();
+ else {
+ const SegmentedFontData* segmentedFontData = static_cast<const SegmentedFontData*>(fontData);
+ unsigned numRanges = segmentedFontData->numRanges();
+ if (numRanges == 1)
+ m_pitch = segmentedFontData->rangeAt(0).fontData()->pitch();
+ else
+ m_pitch = VariablePitch;
+ }
+}
+
+const FontData* FontFallbackList::fontDataAt(const WebCore::Font* _font, unsigned index) const
+{
+ if (index != 0)
+ return 0;
+
+ // Search for the WebCore font that is already in the list
+ for (int i = m_fontList.size() - 1; i >= 0; --i) {
+ pair<const FontData*, bool> item = m_fontList[i];
+ // item.second means that the item was created locally or not
+ if (!item.second)
+ return item.first;
+ }
+
+ // Use the FontSelector to get a WebCore font and then fallback to Qt
+ const FontDescription& description = _font->fontDescription();
+ const FontFamily* family = &description.family();
+ while (family) {
+ if (m_fontSelector) {
+ FontData* data = m_fontSelector->getFontData(description, family->family());
+ if (data) {
+ if (data->isLoading())
+ m_loadingCustomFonts = true;
+ if (!data->isCustomFont()) {
+ // Custom fonts can be freed anytime so we must not hold them
+ m_fontList.append(pair<const FontData*, bool>(data, false));
+ }
+ return data;
+ }
+ }
+ family = family->next();
+ }
+
+ if (m_fontList.size())
+ return m_fontList[0].first;
+
+ const FontData* result = new SimpleFontData(FontPlatformData(description, _font->wordSpacing(), _font->letterSpacing()), true);
+ m_fontList.append(pair<const FontData*, bool>(result, true));
+ return result;
+}
+
+const FontData* FontFallbackList::fontDataForCharacters(const WebCore::Font* font, const UChar*, int) const
+{
+ return primaryFontData(font);
+}
+
+void FontFallbackList::setPlatformFont(const WebCore::FontPlatformData&)
+{
+ m_familyIndex = cAllFamiliesScanned;
+}
+
+}
diff --git a/WebCore/platform/graphics/qt/FontPlatformData.h b/WebCore/platform/graphics/qt/FontPlatformData.h
index f71793d..92219fd 100644
--- a/WebCore/platform/graphics/qt/FontPlatformData.h
+++ b/WebCore/platform/graphics/qt/FontPlatformData.h
@@ -26,7 +26,6 @@
#include "FontDescription.h"
#include <QFont>
-#include <QHash>
namespace WebCore {
@@ -42,13 +41,6 @@ public:
FontPlatformData(const FontDescription&, int wordSpacing = 0, int letterSpacing = 0);
FontPlatformData(const QFont&, bool bold);
- FontPlatformData(WTF::HashTableDeletedValueType)
- : m_isDeletedValue(true)
- {
- }
-
- bool isHashTableDeletedValue() const { return m_isDeletedValue; }
-
static inline QFont::Weight toQFontWeight(FontWeight fontWeight)
{
switch (fontWeight) {
@@ -77,34 +69,15 @@ public:
bool italic() const { return m_font.italic(); }
bool smallCaps() const { return m_font.capitalization() == QFont::SmallCaps; }
int pixelSize() const { return m_font.pixelSize(); }
- unsigned hash() const
- {
- float size = m_size;
- return qHash(m_isDeletedValue)
- ^ qHash(m_bold)
- ^ qHash(m_oblique)
- ^ qHash(*reinterpret_cast<quint32*>(&size))
- ^ qHash(m_font.toString());
- }
-
- bool operator==(const FontPlatformData& other) const
- {
- return (m_isDeletedValue && m_isDeletedValue == other.m_isDeletedValue)
- || (m_bold == other.m_bold
- && m_oblique == other.m_oblique
- && m_size == other.m_size
- && m_font == m_font);
- }
#ifndef NDEBUG
String description() const;
#endif
- QFont m_font;
float m_size;
- bool m_bold : 1;
- bool m_oblique : 1;
- bool m_isDeletedValue : 1;
+ bool m_bold;
+ bool m_oblique;
+ QFont m_font;
};
} // namespace WebCore
diff --git a/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp b/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
index 058bb21..7709be6 100644
--- a/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
+++ b/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp
@@ -30,7 +30,6 @@ FontPlatformData::FontPlatformData(const FontDescription& description, int wordS
: m_size(0.0f)
, m_bold(false)
, m_oblique(false)
- , m_isDeletedValue(false)
{
QString familyName;
const FontFamily* family = &description.family();
@@ -56,11 +55,10 @@ FontPlatformData::FontPlatformData(const FontDescription& description, int wordS
}
FontPlatformData::FontPlatformData(const QFont& font, bool bold)
- : m_font(font)
- , m_size(font.pointSize())
+ : m_size(font.pointSize())
, m_bold(bold)
, m_oblique(false)
- , m_isDeletedValue(false)
+ , m_font(font)
{
}
@@ -69,16 +67,14 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool oblique)
: m_size(size)
, m_bold(bold)
, m_oblique(oblique)
- , m_isDeletedValue(false)
{
}
#endif
FontPlatformData::FontPlatformData()
- : m_size(m_font.pointSize())
+ : m_size(0.0f)
, m_bold(false)
, m_oblique(false)
- , m_isDeletedValue(false)
{
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list