Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: Source/core/css/FontFace.cpp

Issue 1103273010: Add parseFontFaceDescriptor for @font-face handling (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: V4 Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/FontFace.cpp
diff --git a/Source/core/css/FontFace.cpp b/Source/core/css/FontFace.cpp
index 1a251730b35858aa4876e7655cedf46d1544635b..f61d991f688da6bb5e7cee5c0d78a0c278d9d42f 100644
--- a/Source/core/css/FontFace.cpp
+++ b/Source/core/css/FontFace.cpp
@@ -65,7 +65,16 @@ namespace blink {
static PassRefPtrWillBeRawPtr<CSSValue> parseCSSValue(const Document* document, const String& s, CSSPropertyID propertyID)
{
CSSParserContext context(*document, UseCounter::getFrom(document));
- return CSSParser::parseSingleValue(propertyID, s, context);
Timothy Loh 2015/05/04 02:05:18 I think this would look better if we exposed parse
+ StringBuilder builder;
+ builder.appendLiteral("@font-face { ");
+ builder.append(getPropertyNameString(propertyID));
+ builder.appendLiteral(" : ");
+ builder.append(s);
+ builder.appendLiteral("; }");
+ RefPtrWillBeRawPtr<StyleRuleBase> rule = CSSParser::parseRule(context, 0, builder.toString());
+ if (!rule || !rule->isFontFaceRule())
+ return nullptr;
+ return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(propertyID);
}
PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, StringOrArrayBufferOrArrayBufferView& source, const FontFaceDescriptors& descriptors)

Powered by Google App Engine
This is Rietveld 408576698