WebKit Bugzilla
Attachment 339169 Details for
Bug 184624
: Collection fragment identifiers don't use PostScript names
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-184624-20180430183804.patch (text/plain), 9.84 KB, created by
Myles C. Maxfield
on 2018-04-30 18:38:05 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2018-04-30 18:38:05 PDT
Size:
9.84 KB
patch
obsolete
>Subversion Revision: 231188 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c4b55410f4575ba272e49d5e425586a5bdd1613c..d0938eb5853b09f7448ae1d917a4e36bf6ff71ce 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-04-30 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ Collection fragment identifiers don't use PostScript names >+ https://bugs.webkit.org/show_bug.cgi?id=184624 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests (OOPS!). >+ >+ * css/CSSFontFaceSource.cpp: >+ (WebCore::CSSFontFaceSource::load): >+ * loader/cache/CachedFont.cpp: >+ (WebCore::CachedFont::calculateItemInCollection const): >+ (WebCore::CachedFont::ensureCustomFontData): >+ (WebCore::CachedFont::createCustomFontData): >+ (WebCore::CachedFont::calculateIndex const): Deleted. >+ * loader/cache/CachedFont.h: >+ * platform/graphics/mac/FontCustomPlatformData.cpp: >+ (WebCore::createFontCustomPlatformData): >+ * platform/graphics/mac/FontCustomPlatformData.h: >+ > 2018-04-30 Myles C. Maxfield <mmaxfield@apple.com> > > Improve the performance of FontCascadeDescription's effectiveFamilies >diff --git a/Source/WebCore/css/CSSFontFaceSource.cpp b/Source/WebCore/css/CSSFontFaceSource.cpp >index 85a4eabded866d2c398e56a6a52ad0e51e716b45..1092213a35fe7b2a78034706154a8c670ee8b68d 100644 >--- a/Source/WebCore/css/CSSFontFaceSource.cpp >+++ b/Source/WebCore/css/CSSFontFaceSource.cpp >@@ -159,7 +159,7 @@ void CSSFontFaceSource::load(CSSFontSelector* fontSelector) > if (auto otfFont = convertSVGToOTFFont(fontElement)) > m_generatedOTFBuffer = SharedBuffer::create(WTFMove(otfFont.value())); > if (m_generatedOTFBuffer) { >- m_inDocumentCustomPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer, 0); >+ m_inDocumentCustomPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer, String()); > success = static_cast<bool>(m_inDocumentCustomPlatformData); > } > } >@@ -170,7 +170,7 @@ void CSSFontFaceSource::load(CSSFontSelector* fontSelector) > bool wrapping; > RefPtr<SharedBuffer> buffer = SharedBuffer::create(static_cast<const char*>(m_immediateSource->baseAddress()), m_immediateSource->byteLength()); > ASSERT(buffer); >- m_immediateFontCustomPlatformData = CachedFont::createCustomFontData(*buffer, 0, wrapping); >+ m_immediateFontCustomPlatformData = CachedFont::createCustomFontData(*buffer, String(), wrapping); > success = static_cast<bool>(m_immediateFontCustomPlatformData); > } else { > // We are only interested in whether or not fontForFamily() returns null or not. Luckily, none of >diff --git a/Source/WebCore/loader/cache/CachedFont.cpp b/Source/WebCore/loader/cache/CachedFont.cpp >index 2b6815e921f9524a17737773a3fd910faa3b020f..f60a38cc7c96b5a838ada357f5df85ea6e44ef18 100644 >--- a/Source/WebCore/loader/cache/CachedFont.cpp >+++ b/Source/WebCore/loader/cache/CachedFont.cpp >@@ -88,27 +88,19 @@ bool CachedFont::ensureCustomFontData(const AtomicString&) > return ensureCustomFontData(m_data.get()); > } > >-unsigned CachedFont::calculateIndex() const >+String CachedFont::calculateItemInCollection() const > { > auto& url = this->url(); > if (!url.hasFragmentIdentifier()) >- return 0; >- const auto& fragment = url.fragmentIdentifier(); >- unsigned result = 0; >- for (unsigned i = 0; i < fragment.length(); ++i) { >- UChar c = fragment[i]; >- if (c < '0' || c > '9') >- return 0; >- result = result * 10 + (c - '0'); >- } >- return result; >+ return String(); >+ return url.fragmentIdentifier(); > } > > bool CachedFont::ensureCustomFontData(SharedBuffer* data) > { > if (!m_fontCustomPlatformData && !errorOccurred() && !isLoading() && data) { > bool wrapping; >- m_fontCustomPlatformData = createCustomFontData(*data, calculateIndex(), wrapping); >+ m_fontCustomPlatformData = createCustomFontData(*data, calculateItemInCollection(), wrapping); > m_hasCreatedFontDataWrappingResource = m_fontCustomPlatformData && wrapping; > if (!m_fontCustomPlatformData) > setStatus(DecodeError); >@@ -117,7 +109,7 @@ bool CachedFont::ensureCustomFontData(SharedBuffer* data) > return m_fontCustomPlatformData.get(); > } > >-std::unique_ptr<FontCustomPlatformData> CachedFont::createCustomFontData(SharedBuffer& bytes, unsigned index, bool& wrapping) >+std::unique_ptr<FontCustomPlatformData> CachedFont::createCustomFontData(SharedBuffer& bytes, const String& itemInCollection, bool& wrapping) > { > wrapping = true; > >@@ -129,11 +121,11 @@ std::unique_ptr<FontCustomPlatformData> CachedFont::createCustomFontData(SharedB > return nullptr; > > auto buffer = SharedBuffer::create(WTFMove(convertedFont)); >- return createFontCustomPlatformData(buffer, index); >+ return createFontCustomPlatformData(buffer, itemInCollection); > } > #endif > >- return createFontCustomPlatformData(bytes, index); >+ return createFontCustomPlatformData(bytes, itemInCollection); > } > > RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities) >diff --git a/Source/WebCore/loader/cache/CachedFont.h b/Source/WebCore/loader/cache/CachedFont.h >index daa3c732ed38c3b10fe66056a68ba4bab1bf59dc..e9de5ed6b5adc1c6f2704cb64ea0df4ed0d461f4 100644 >--- a/Source/WebCore/loader/cache/CachedFont.h >+++ b/Source/WebCore/loader/cache/CachedFont.h >@@ -52,7 +52,7 @@ public: > bool stillNeedsLoad() const override { return !m_loadInitiated; } > > virtual bool ensureCustomFontData(const AtomicString& remoteURI); >- static std::unique_ptr<FontCustomPlatformData> createCustomFontData(SharedBuffer&, unsigned index, bool& wrapping); >+ static std::unique_ptr<FontCustomPlatformData> createCustomFontData(SharedBuffer&, const String& itemInCollection, bool& wrapping); > static FontPlatformData platformDataFromCustomData(FontCustomPlatformData&, const FontDescription&, bool bold, bool italic, const FontFeatureSettings&, const FontVariantSettings&, FontSelectionSpecifiedCapabilities); > > virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, const FontVariantSettings&, FontSelectionSpecifiedCapabilities); >@@ -63,7 +63,7 @@ protected: > bool ensureCustomFontData(SharedBuffer* data); > > private: >- unsigned calculateIndex() const; >+ String calculateItemInCollection() const; > > void checkNotify() override; > bool mayTryReplaceEncodedData() const override; >diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp >index dc0afa3f917fb9d5311f41fdf3c1e5f78c047558..749a585057434fa3cff4bddd5617622339f87f1a 100644 >--- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp >+++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp >@@ -51,7 +51,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& > return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode()); > } > >-std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer& buffer, unsigned index) >+std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer& buffer, const String& itemInCollection) > { > RetainPtr<CFDataRef> bufferData = buffer.createCFData(); > >@@ -63,17 +63,26 @@ std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffe > auto length = CFArrayGetCount(array.get()); > if (length <= 0) > return nullptr; >- if (index > 0) >- --index; >- if (index >= static_cast<unsigned>(length)) >- index = 0; >- fontDescriptor = static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(array.get(), index)); >+ if (!itemInCollection.isNull()) { >+ if (auto desiredName = itemInCollection.createCFString()) { >+ for (CFIndex i = 0; i < length; ++i) { >+ auto candidate = static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(array.get(), i)); >+ auto postScriptName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(candidate, kCTFontNameAttribute))); >+ if (CFStringCompare(postScriptName.get(), desiredName.get(), 0) == kCFCompareEqualTo) { >+ fontDescriptor = candidate; >+ break; >+ } >+ } >+ } >+ } >+ if (!fontDescriptor) >+ fontDescriptor = static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(array.get(), 0)); > #else >- UNUSED_PARAM(index); >+ UNUSED_PARAM(itemInCollection); > fontDescriptor = adoptCF(CTFontManagerCreateFontDescriptorFromData(bufferData.get())); >-#endif > if (!fontDescriptor) > return nullptr; >+#endif > > return std::make_unique<FontCustomPlatformData>(fontDescriptor.get()); > } >diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h >index 9cf761898354f0ec792efbc0f3392822d0416a48..f81d3694217841afc64e9422bfc5b4400e858db9 100644 >--- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h >+++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h >@@ -57,7 +57,7 @@ public: > RetainPtr<CTFontDescriptorRef> m_fontDescriptor; > }; > >-std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer&, unsigned index); >+std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer&, const String& itemInCollection); > > } >
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 184624
:
338141
|
339169
|
339259
|
339264
|
339272