Index: Source/core/css/FontFace.cpp |
diff --git a/Source/core/css/FontFace.cpp b/Source/core/css/FontFace.cpp |
index c4bc50ab9f069a746d2e54914d89cdb74ac627ca..45ae68d591adee2278777a097cdd02ba38dca0ee 100644 |
--- a/Source/core/css/FontFace.cpp |
+++ b/Source/core/css/FontFace.cpp |
@@ -31,7 +31,6 @@ |
#include "config.h" |
#include "core/css/FontFace.h" |
-#include "bindings/core/v8/Dictionary.h" |
#include "bindings/core/v8/ExceptionState.h" |
#include "bindings/core/v8/ScriptPromiseResolver.h" |
#include "bindings/core/v8/ScriptState.h" |
@@ -43,6 +42,7 @@ |
#include "core/css/CSSPrimitiveValue.h" |
#include "core/css/CSSUnicodeRangeValue.h" |
#include "core/css/CSSValueList.h" |
+#include "core/css/FontFaceDescriptors.h" |
#include "core/css/LocalFontFaceSource.h" |
#include "core/css/RemoteFontFaceSource.h" |
#include "core/css/StylePropertySet.h" |
@@ -103,47 +103,34 @@ static PassRefPtrWillBeRawPtr<CSSValue> parseCSSValue(const Document* document, |
return parsedStyle->getPropertyCSSValue(propertyID); |
} |
-static bool initFontFace(FontFace* fontFace, ExecutionContext* context, const AtomicString& family, const Dictionary& descriptors, ExceptionState& exceptionState) |
+static bool initFontFace(FontFace* fontFace, ExecutionContext* context, const AtomicString& family, const FontFaceDescriptors* descriptors, ExceptionState& exceptionState) |
{ |
fontFace->setFamily(context, family, exceptionState); |
if (exceptionState.hadException()) |
return false; |
- String value; |
- if (DictionaryHelper::get(descriptors, "style", value)) { |
- fontFace->setStyle(context, value, exceptionState); |
- if (exceptionState.hadException()) |
- return false; |
- } |
- if (DictionaryHelper::get(descriptors, "weight", value)) { |
- fontFace->setWeight(context, value, exceptionState); |
- if (exceptionState.hadException()) |
- return false; |
- } |
- if (DictionaryHelper::get(descriptors, "stretch", value)) { |
- fontFace->setStretch(context, value, exceptionState); |
- if (exceptionState.hadException()) |
- return false; |
- } |
- if (DictionaryHelper::get(descriptors, "unicodeRange", value)) { |
- fontFace->setUnicodeRange(context, value, exceptionState); |
- if (exceptionState.hadException()) |
- return false; |
- } |
- if (DictionaryHelper::get(descriptors, "variant", value)) { |
- fontFace->setVariant(context, value, exceptionState); |
- if (exceptionState.hadException()) |
- return false; |
- } |
- if (DictionaryHelper::get(descriptors, "featureSettings", value)) { |
- fontFace->setFeatureSettings(context, value, exceptionState); |
- if (exceptionState.hadException()) |
- return false; |
- } |
+ fontFace->setStyle(context, descriptors->style(), exceptionState); |
+ if (exceptionState.hadException()) |
+ return false; |
+ fontFace->setWeight(context, descriptors->weight(), exceptionState); |
+ if (exceptionState.hadException()) |
+ return false; |
+ fontFace->setStretch(context, descriptors->stretch(), exceptionState); |
+ if (exceptionState.hadException()) |
+ return false; |
+ fontFace->setUnicodeRange(context, descriptors->unicodeRange(), exceptionState); |
+ if (exceptionState.hadException()) |
+ return false; |
+ fontFace->setVariant(context, descriptors->variant(), exceptionState); |
+ if (exceptionState.hadException()) |
+ return false; |
+ fontFace->setFeatureSettings(context, descriptors->featureSettings(), exceptionState); |
+ if (exceptionState.hadException()) |
+ return false; |
return true; |
} |
-PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, const String& source, const Dictionary& descriptors, ExceptionState& exceptionState) |
+PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, const String& source, const FontFaceDescriptors* descriptors, ExceptionState& exceptionState) |
{ |
RefPtrWillBeRawPtr<CSSValue> src = parseCSSValue(toDocument(context), source, CSSPropertySrc); |
if (!src || !src->isValueList()) { |
@@ -157,7 +144,7 @@ PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, con |
return fontFace.release(); |
} |
-PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<ArrayBuffer> source, const Dictionary& descriptors, ExceptionState& exceptionState) |
+PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<ArrayBuffer> source, const FontFaceDescriptors* descriptors, ExceptionState& exceptionState) |
{ |
RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace()); |
if (initFontFace(fontFace.get(), context, family, descriptors, exceptionState)) |
@@ -165,7 +152,7 @@ PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, con |
return fontFace.release(); |
} |
-PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<ArrayBufferView> source, const Dictionary& descriptors, ExceptionState& exceptionState) |
+PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<ArrayBufferView> source, const FontFaceDescriptors* descriptors, ExceptionState& exceptionState) |
{ |
RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace()); |
if (initFontFace(fontFace.get(), context, family, descriptors, exceptionState)) |