| Index: third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp b/third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp
|
| index 3efce5a35606776747076bb466824fdf9255b439..357d701cd38bc4771d21d30f9ed0693b2638510a 100644
|
| --- a/third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp
|
| +++ b/third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp
|
| @@ -106,6 +106,19 @@
|
| fontFace->cssFontFace()->clearSegmentedFontFace();
|
| }
|
|
|
| +static void appendFontData(SegmentedFontData* newFontData, PassRefPtr<SimpleFontData> prpFaceFontData, const UnicodeRangeSet& ranges)
|
| +{
|
| + RefPtr<SimpleFontData> faceFontData = prpFaceFontData;
|
| + unsigned numRanges = ranges.size();
|
| + if (!numRanges) {
|
| + newFontData->appendRange(FontDataRange(0, 0x7FFFFFFF, faceFontData));
|
| + return;
|
| + }
|
| +
|
| + for (unsigned j = 0; j < numRanges; ++j)
|
| + newFontData->appendRange(FontDataRange(ranges.rangeAt(j).from(), ranges.rangeAt(j).to(), faceFontData));
|
| +}
|
| +
|
| PassRefPtr<FontData> CSSSegmentedFontFace::getFontData(const FontDescription& fontDescription)
|
| {
|
| if (!isValid())
|
| @@ -115,7 +128,7 @@
|
| FontCacheKey key = fontDescription.cacheKey(FontFaceCreationParams(), desiredTraits);
|
|
|
| RefPtr<SegmentedFontData>& fontData = m_fontDataTable.add(key.hash(), nullptr).storedValue->value;
|
| - if (fontData && fontData->numFaces())
|
| + if (fontData && fontData->numRanges())
|
| return fontData; // No release, we have a reference to an object in the cache which should retain the ref count it has.
|
|
|
| if (!fontData)
|
| @@ -131,10 +144,10 @@
|
| continue;
|
| if (RefPtr<SimpleFontData> faceFontData = (*it)->cssFontFace()->getFontData(requestedFontDescription)) {
|
| ASSERT(!faceFontData->isSegmented());
|
| - fontData->appendFace(FontDataForRangeSet(faceFontData.release(), (*it)->cssFontFace()->ranges()));
|
| + appendFontData(fontData.get(), faceFontData.release(), (*it)->cssFontFace()->ranges());
|
| }
|
| }
|
| - if (fontData->numFaces())
|
| + if (fontData->numRanges())
|
| return fontData; // No release, we have a reference to an object in the cache which should retain the ref count it has.
|
|
|
| return nullptr;
|
| @@ -150,14 +163,14 @@
|
| }
|
| }
|
|
|
| -void CSSSegmentedFontFace::willUseRange(const blink::FontDescription& fontDescription, const blink::FontDataForRangeSet& rangeSet)
|
| +void CSSSegmentedFontFace::willUseRange(const blink::FontDescription& fontDescription, const blink::FontDataRange& range)
|
| {
|
| // Iterating backwards since later defined unicode-range faces override
|
| // previously defined ones, according to the CSS3 fonts module.
|
| // https://drafts.csswg.org/css-fonts/#composite-fonts
|
| for (FontFaceList::reverse_iterator it = m_fontFaces.rbegin(); it != m_fontFaces.rend(); ++it) {
|
| CSSFontFace* cssFontFace = (*it)->cssFontFace();
|
| - if (cssFontFace->maybeScheduleFontLoad(fontDescription, rangeSet))
|
| + if (cssFontFace->maybeScheduleFontLoad(fontDescription, range))
|
| break;
|
| }
|
| }
|
| @@ -165,7 +178,7 @@
|
| bool CSSSegmentedFontFace::checkFont(const String& text) const
|
| {
|
| for (const auto& fontFace : m_fontFaces) {
|
| - if (fontFace->loadStatus() != FontFace::Loaded && fontFace->cssFontFace()->ranges()->intersectsWith(text))
|
| + if (fontFace->loadStatus() != FontFace::Loaded && fontFace->cssFontFace()->ranges().intersectsWith(text))
|
| return false;
|
| }
|
| return true;
|
| @@ -174,7 +187,7 @@
|
| void CSSSegmentedFontFace::match(const String& text, WillBeHeapVector<RefPtrWillBeMember<FontFace>>& faces) const
|
| {
|
| for (const auto& fontFace : m_fontFaces) {
|
| - if (fontFace->cssFontFace()->ranges()->intersectsWith(text))
|
| + if (fontFace->cssFontFace()->ranges().intersectsWith(text))
|
| faces.append(fontFace);
|
| }
|
| }
|
|
|