Title: [209217] trunk/Source/WebCore
Revision
209217
Author
hy...@apple.com
Date
2016-12-01 14:54:52 -0800 (Thu, 01 Dec 2016)

Log Message

[CSS Parser] Only allow a single font-family in @font-face
https://bugs.webkit.org/show_bug.cgi?id=165278

Reviewed by Zalan Bujtas.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontFamilyDescriptor):
(WebCore::CSSPropertyParser::parseFontFaceDescriptor):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209216 => 209217)


--- trunk/Source/WebCore/ChangeLog	2016-12-01 22:53:36 UTC (rev 209216)
+++ trunk/Source/WebCore/ChangeLog	2016-12-01 22:54:52 UTC (rev 209217)
@@ -1,3 +1,14 @@
+2016-12-01  Dave Hyatt  <hy...@apple.com>
+
+        [CSS Parser] Only allow a single font-family in @font-face
+        https://bugs.webkit.org/show_bug.cgi?id=165278
+
+        Reviewed by Zalan Bujtas.
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeFontFamilyDescriptor):
+        (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
+
 2016-12-01  Beth Dakin  <bda...@apple.com>
 
         Blacklist Netflix for TouchBar support

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (209216 => 209217)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-12-01 22:53:36 UTC (rev 209216)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2016-12-01 22:54:52 UTC (rev 209217)
@@ -923,6 +923,24 @@
     return list;
 }
 
+static RefPtr<CSSValueList> consumeFontFamilyDescriptor(CSSParserTokenRange& range)
+{
+    // FIXME-NEWPARSER: For compatibility with the old parser, we have to make
+    // a list here, even though the list always contains only a single family name.
+    // Once the old parser is gone, we can delete this function, make the caller
+    // use consumeFamilyName instead, and then patch the @font-face code to
+    // not expect a list with a single name in it.
+    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+    RefPtr<CSSValue> parsedValue = consumeFamilyName(range);
+    if (parsedValue)
+        list->append(parsedValue.releaseNonNull());
+    
+    if (!range.atEnd() || !list->length())
+        return nullptr;
+
+    return list;
+}
+
 static RefPtr<CSSValue> consumeFontSynthesis(CSSParserTokenRange& range)
 {
     // none | [ weight || style ]
@@ -4076,7 +4094,7 @@
     RefPtr<CSSValue> parsedValue;
     switch (propId) {
     case CSSPropertyFontFamily:
-        parsedValue = consumeFontFamily(m_range);
+        parsedValue = consumeFontFamilyDescriptor(m_range);
         break;
     case CSSPropertySrc: // This is a list of urls or local references.
         parsedValue = consumeFontFaceSrc(m_range, m_context);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to