<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[203092] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/203092">203092</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2016-07-11 16:23:56 -0700 (Mon, 11 Jul 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Honor the second argument to FontFaceSet.load and FontFaceSet.check
https://bugs.webkit.org/show_bug.cgi?id=159607
<rdar://problem/27284902>
Reviewed by Zalan Bujtas.
Source/WebCore:
This second argument is used in conjunction with the unicode-range CSS property, so that
loading from a FontFaceSet only loads the fonts which actually match the characters given.
Previously, we hadn't implemented proper support for this unicode-range property, but now
that we have implemented it, we should honor this second argument.
Test: fast/text/unicode-range-javascript.html
* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::rangesMatchCodePoint):
* css/CSSFontFace.h:
* css/CSSFontFaceSet.cpp:
(WebCore::codePointsFromString):
(WebCore::CSSFontFaceSet::matchingFaces):
LayoutTests:
* fast/text/font-face-set-document-expected.txt:
* fast/text/font-face-set-document.html:
* fast/text/font-face-set-javascript-expected.txt:
* fast/text/font-face-set-javascript.html:
* fast/text/unicode-range-javascript-expected.txt: Added.
* fast/text/unicode-range-javascript.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfasttextfontfacesetdocumentexpectedtxt">trunk/LayoutTests/fast/text/font-face-set-document-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasttextfontfacesetdocumenthtml">trunk/LayoutTests/fast/text/font-face-set-document.html</a></li>
<li><a href="#trunkLayoutTestsfasttextfontfacesetjavascriptexpectedtxt">trunk/LayoutTests/fast/text/font-face-set-javascript-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasttextfontfacesetjavascripthtml">trunk/LayoutTests/fast/text/font-face-set-javascript.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontFacecpp">trunk/Source/WebCore/css/CSSFontFace.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontFaceh">trunk/Source/WebCore/css/CSSFontFace.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontFaceSetcpp">trunk/Source/WebCore/css/CSSFontFaceSet.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasttextunicoderangejavascriptexpectedtxt">trunk/LayoutTests/fast/text/unicode-range-javascript-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasttextunicoderangejavascripthtml">trunk/LayoutTests/fast/text/unicode-range-javascript.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (203091 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-07-11 23:18:41 UTC (rev 203091)
+++ trunk/LayoutTests/ChangeLog        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-07-11 Myles C. Maxfield <mmaxfield@apple.com>
+
+ Honor the second argument to FontFaceSet.load and FontFaceSet.check
+ https://bugs.webkit.org/show_bug.cgi?id=159607
+ <rdar://problem/27284902>
+
+ Reviewed by Zalan Bujtas.
+
+ * fast/text/font-face-set-document-expected.txt:
+ * fast/text/font-face-set-document.html:
+ * fast/text/font-face-set-javascript-expected.txt:
+ * fast/text/font-face-set-javascript.html:
+ * fast/text/unicode-range-javascript-expected.txt: Added.
+ * fast/text/unicode-range-javascript.html: Added.
+
</ins><span class="cx"> 2016-07-11 Nan Wang <n_wang@apple.com>
</span><span class="cx">
</span><span class="cx"> AX: Crash when backspacing in number field with spin button
</span></span></pre></div>
<a id="trunkLayoutTestsfasttextfontfacesetdocumentexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/text/font-face-set-document-expected.txt (203091 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/font-face-set-document-expected.txt        2016-07-11 23:18:41 UTC (rev 203091)
+++ trunk/LayoutTests/fast/text/font-face-set-document-expected.txt        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -12,9 +12,8 @@
</span><span class="cx"> PASS object.done is true
</span><span class="cx"> PASS document.getElementById("testElement").offsetWidth is not originalWidth
</span><span class="cx"> PASS document.getElementById("testElement").offsetWidth is originalWidth
</span><del>-PASS object.length is 2
</del><ins>+PASS object.length is 1
</ins><span class="cx"> PASS object[0].family is "MyFont3"
</span><del>-PASS object[1].family is "MyFont3"
</del><span class="cx"> PASS document.getElementById("testElement").offsetWidth is not originalWidth
</span><span class="cx"> PASS document.getElementById("testElement").offsetWidth is originalWidth
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestsfasttextfontfacesetdocumenthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/text/font-face-set-document.html (203091 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/font-face-set-document.html        2016-07-11 23:18:41 UTC (rev 203091)
+++ trunk/LayoutTests/fast/text/font-face-set-document.html        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -76,9 +76,8 @@
</span><span class="cx"> return document.fonts.load("50px MyFont3");
</span><span class="cx"> }).then(function(x) {
</span><span class="cx"> object = x;
</span><del>- shouldBe("object.length", "2");
</del><ins>+ shouldBe("object.length", "1");
</ins><span class="cx"> shouldBeEqualToString("object[0].family", "MyFont3");
</span><del>- shouldBeEqualToString("object[1].family", "MyFont3");
</del><span class="cx"> object = undefined;
</span><span class="cx"> appliedFont = new FontFace("AppliedFont", "url(\"../../resources/Ahem.otf\")", {});
</span><span class="cx"> document.fonts.add(appliedFont);
</span></span></pre></div>
<a id="trunkLayoutTestsfasttextfontfacesetjavascriptexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/text/font-face-set-javascript-expected.txt (203091 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/font-face-set-javascript-expected.txt        2016-07-11 23:18:41 UTC (rev 203091)
+++ trunk/LayoutTests/fast/text/font-face-set-javascript-expected.txt        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> PASS fontFaceSet.status is "loaded"
</span><span class="cx"> PASS fontFaceSet.status is "loaded"
</span><span class="cx"> PASS item is [fontFace3]
</span><del>-PASS item is [fontFace3, fontFace4]
</del><ins>+PASS item is [fontFace3]
</ins><span class="cx"> PASS item is fontFaceSet
</span><span class="cx"> PASS fontFaceSet.status is "loaded"
</span><span class="cx"> PASS fontFaceSet.status is "loading"
</span></span></pre></div>
<a id="trunkLayoutTestsfasttextfontfacesetjavascripthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/text/font-face-set-javascript.html (203091 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/font-face-set-javascript.html        2016-07-11 23:18:41 UTC (rev 203091)
+++ trunk/LayoutTests/fast/text/font-face-set-javascript.html        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -126,7 +126,7 @@
</span><span class="cx"> finishJSTest();
</span><span class="cx"> }).then(function(arg) {
</span><span class="cx"> item = arg;
</span><del>- shouldBe("item", "[fontFace3, fontFace4]");
</del><ins>+ shouldBe("item", "[fontFace3]");
</ins><span class="cx"> fontFaceSet.add(fontFace4);
</span><span class="cx"> fontFaceSet.load("16px family3");
</span><span class="cx"> return fontFaceSet.ready;
</span></span></pre></div>
<a id="trunkLayoutTestsfasttextunicoderangejavascriptexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/text/unicode-range-javascript-expected.txt (0 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/unicode-range-javascript-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/text/unicode-range-javascript-expected.txt        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+This test makes sure that the second argument to FontFaceSet.load() and FontFaceSet.check() is honored.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS faces.length is 1
+PASS faces[0].unicodeRange is "U+41-41"
+PASS document.fonts.check('14px WebFont', 'A') is true
+PASS faces.length is 1
+PASS faces[0].family is "WebFont"
+PASS faces[0].unicodeRange is "U+41-41"
+PASS document.fonts.check('14px WebFont3', 'A') is false
+PASS document.fonts.check('14px WebFont3', 'A') is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasttextunicoderangejavascripthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/text/unicode-range-javascript.html (0 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/text/unicode-range-javascript.html         (rev 0)
+++ trunk/LayoutTests/fast/text/unicode-range-javascript.html        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+if (window.internals) {
+ internals.clearMemoryCache();
+ internals.invalidateFontCache();
+}
+</script>
+<style>
+@font-face {
+        font-family: WebFont;
+        src: url("../../resources/Ahem.ttf") format("truetype");
+        unicode-range: U+42;
+}
+@font-face {
+ font-family: WebFont;
+ src: url("../../resources/Ahem.otf") format("opentype");
+ unicode-range: U+41;
+}
+@font-face {
+ font-family: WebFont2;
+ src: url("../../resources/Ahem.otf") format("opentype");
+ unicode-range: U+41-42;
+}
+@font-face {
+ font-family: WebFont3;
+ src: url("notafont.ttf") format("truetype");
+ unicode-range: U+42;
+}
+@font-face {
+ font-family: WebFont3;
+ src: url("../../resources/Ahem.woff") format("woff");
+ unicode-range: U+41;
+}
+</style>
+</head>
+<body>
+<script>
+self.jsTestIsAsync = true;
+
+description("This test makes sure that the second argument to FontFaceSet.load() and FontFaceSet.check() is honored.");
+
+function failure() {
+ testFailed("Promise should not fail.");
+ finishJSTest();
+}
+
+var faces;
+document.fonts.load("14px WebFont", "A").then(function(facesArgument) {
+ faces = facesArgument;
+ shouldBe("faces.length", "1");
+ shouldBeEqualToString("faces[0].unicodeRange", "U+41-41");
+ shouldBeTrue("document.fonts.check('14px WebFont', 'A')");
+ return document.fonts.load("14px WebFont, WebFont2", "A");
+}, failure).then(function(facesArgument) {
+ faces = facesArgument;
+ shouldBe("faces.length", "1");
+ shouldBeEqualToString("faces[0].family", "WebFont");
+ shouldBeEqualToString("faces[0].unicodeRange", "U+41-41");
+ shouldBeFalse("document.fonts.check('14px WebFont3', 'A')");
+ for (let f of document.fonts) {
+ if (f.family == "WebFont3" && f.unicodeRange == "U+41-41")
+ return f.load();
+ }
+ testFailed("Should find font.");
+ finishJSTest();
+}, failure).then(function(face) {
+ shouldBeTrue("document.fonts.check('14px WebFont3', 'A')");
+ finishJSTest();
+}, failure);
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203091 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-11 23:18:41 UTC (rev 203091)
+++ trunk/Source/WebCore/ChangeLog        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-07-11 Myles C. Maxfield <mmaxfield@apple.com>
+
+ Honor the second argument to FontFaceSet.load and FontFaceSet.check
+ https://bugs.webkit.org/show_bug.cgi?id=159607
+ <rdar://problem/27284902>
+
+ Reviewed by Zalan Bujtas.
+
+ This second argument is used in conjunction with the unicode-range CSS property, so that
+ loading from a FontFaceSet only loads the fonts which actually match the characters given.
+ Previously, we hadn't implemented proper support for this unicode-range property, but now
+ that we have implemented it, we should honor this second argument.
+
+ Test: fast/text/unicode-range-javascript.html
+
+ * css/CSSFontFace.cpp:
+ (WebCore::CSSFontFace::rangesMatchCodePoint):
+ * css/CSSFontFace.h:
+ * css/CSSFontFaceSet.cpp:
+ (WebCore::codePointsFromString):
+ (WebCore::CSSFontFaceSet::matchingFaces):
+
</ins><span class="cx"> 2016-07-11 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Unable to edit fields or drag to select text in Dashboard widgets.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFace.cpp (203091 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFace.cpp        2016-07-11 23:18:41 UTC (rev 203091)
+++ trunk/Source/WebCore/css/CSSFontFace.cpp        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -370,6 +370,18 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool CSSFontFace::rangesMatchCodePoint(UChar32 character) const
+{
+ if (m_ranges.isEmpty())
+ return true;
+
+ for (auto& range : m_ranges) {
+ if (range.from <= character && character <= range.to)
+ return true;
+ }
+ return false;
+}
+
</ins><span class="cx"> void CSSFontFace::fontLoadEventOccurred()
</span><span class="cx"> {
</span><span class="cx"> Ref<CSSFontFace> protectedThis(*this);
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFace.h (203091 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFace.h        2016-07-11 23:18:41 UTC (rev 203091)
+++ trunk/Source/WebCore/css/CSSFontFace.h        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -133,6 +133,8 @@
</span><span class="cx"> UChar32 to;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+ bool rangesMatchCodePoint(UChar32) const;
+
</ins><span class="cx"> // We don't guarantee that the FontFace wrapper will be the same every time you ask for it.
</span><span class="cx"> Ref<FontFace> wrapper();
</span><span class="cx"> void setWrapper(FontFace&);
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceSet.cpp (203091 => 203092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceSet.cpp        2016-07-11 23:18:41 UTC (rev 203091)
+++ trunk/Source/WebCore/css/CSSFontFaceSet.cpp        2016-07-11 23:23:56 UTC (rev 203092)
</span><span class="lines">@@ -308,8 +308,24 @@
</span><span class="cx"> return static_cast<FontTraitsMask>(static_cast<unsigned>(styleMask) | static_cast<unsigned>(weightMask));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Vector<std::reference_wrapper<CSSFontFace>> CSSFontFaceSet::matchingFaces(const String& font, const String&, ExceptionCode& ec)
</del><ins>+static HashSet<UChar32> codePointsFromString(StringView stringView)
</ins><span class="cx"> {
</span><ins>+ HashSet<UChar32> result;
+ auto graphemeClusters = stringView.graphemeClusters();
+ for (auto cluster : graphemeClusters) {
+ ASSERT(cluster.length() > 0);
+ UChar32 character = 0;
+ if (cluster.is8Bit())
+ character = cluster[0];
+ else
+ U16_GET(cluster.characters16(), 0, 0, cluster.length(), character);
+ result.add(character);
+ }
+ return result;
+}
+
+Vector<std::reference_wrapper<CSSFontFace>> CSSFontFaceSet::matchingFaces(const String& font, const String& string, ExceptionCode& ec)
+{
</ins><span class="cx"> Vector<std::reference_wrapper<CSSFontFace>> result;
</span><span class="cx"> auto style = MutableStyleProperties::create();
</span><span class="cx"> auto parseResult = CSSParser::parseValue(style, CSSPropertyFont, font, true, CSSStrictMode, nullptr);
</span><span class="lines">@@ -334,21 +350,37 @@
</span><span class="cx"> CSSValueList& familyList = downcast<CSSValueList>(*family);
</span><span class="cx">
</span><span class="cx"> HashSet<AtomicString> uniqueFamilies;
</span><ins>+ Vector<AtomicString> familyOrder;
</ins><span class="cx"> for (auto& family : familyList) {
</span><span class="cx"> const CSSPrimitiveValue& primitive = downcast<CSSPrimitiveValue>(family.get());
</span><span class="cx"> if (!primitive.isFontFamily())
</span><span class="cx"> continue;
</span><del>- uniqueFamilies.add(primitive.fontFamily().familyName);
</del><ins>+ if (uniqueFamilies.add(primitive.fontFamily().familyName).isNewEntry)
+ familyOrder.append(primitive.fontFamily().familyName);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- for (auto& family : uniqueFamilies) {
- CSSSegmentedFontFace* faces = getFontFace(fontTraitsMask, family);
- if (!faces)
- continue;
- for (auto& constituentFace : faces->constituentFaces())
- result.append(constituentFace.get());
</del><ins>+ HashSet<CSSFontFace*> resultConstituents;
+ for (auto codePoint : codePointsFromString(string)) {
+ bool found = false;
+ for (auto& family : familyOrder) {
+ CSSSegmentedFontFace* faces = getFontFace(fontTraitsMask, family);
+ if (!faces)
+ continue;
+ for (auto& constituentFace : faces->constituentFaces()) {
+ if (constituentFace->rangesMatchCodePoint(codePoint)) {
+ resultConstituents.add(constituentFace.ptr());
+ found = true;
+ break;
+ }
+ }
+ if (found)
+ break;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ for (auto* constituent : resultConstituents)
+ result.append(*constituent);
+
</ins><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>