| Index: third_party/WebKit/Source/core/css/FontFace.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/FontFace.cpp b/third_party/WebKit/Source/core/css/FontFace.cpp
|
| index 91dee225068c2ce5022334c885f717dfd47367c6..8441cf6e6aecea13b6be8973652e6cc3d257a850 100644
|
| --- a/third_party/WebKit/Source/core/css/FontFace.cpp
|
| +++ b/third_party/WebKit/Source/core/css/FontFace.cpp
|
| @@ -111,16 +111,13 @@ PassRefPtrWillBeRawPtr<FontFace> FontFace::create(Document* document, const Styl
|
| const StylePropertySet& properties = fontFaceRule->properties();
|
|
|
| // Obtain the font-family property and the src property. Both must be defined.
|
| - RefPtrWillBeRawPtr<CSSValue> family = properties.getPropertyCSSValue(CSSPropertyFontFamily);
|
| - if (!family || !family->isPrimitiveValue())
|
| - return nullptr;
|
| RefPtrWillBeRawPtr<CSSValue> src = properties.getPropertyCSSValue(CSSPropertySrc);
|
| if (!src || !src->isValueList())
|
| return nullptr;
|
|
|
| RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace(document));
|
|
|
| - if (fontFace->setFamilyValue(toCSSPrimitiveValue(family.get()))
|
| + if (fontFace->setPropertyFromStyle(properties, CSSPropertyFontFamily)
|
| && fontFace->setPropertyFromStyle(properties, CSSPropertyFontStyle)
|
| && fontFace->setPropertyFromStyle(properties, CSSPropertyFontWeight)
|
| && fontFace->setPropertyFromStyle(properties, CSSPropertyFontStretch)
|
| @@ -144,10 +141,10 @@ FontFace::FontFace(ExecutionContext* context)
|
|
|
| FontFace::FontFace(ExecutionContext* context, const AtomicString& family, const FontFaceDescriptors& descriptors)
|
| : ActiveDOMObject(context)
|
| - , m_family(family)
|
| , m_status(Unloaded)
|
| {
|
| Document* document = toDocument(context);
|
| + setPropertyFromString(document, family, CSSPropertyFontFamily);
|
| setPropertyFromString(document, descriptors.style(), CSSPropertyFontStyle);
|
| setPropertyFromString(document, descriptors.weight(), CSSPropertyFontWeight);
|
| setPropertyFromString(document, descriptors.stretch(), CSSPropertyFontStretch);
|
| @@ -192,6 +189,11 @@ String FontFace::featureSettings() const
|
| return m_featureSettings ? m_featureSettings->cssText() : "normal";
|
| }
|
|
|
| +void FontFace::setFamily(ExecutionContext* context, const String& s, ExceptionState& exceptionState)
|
| +{
|
| + setPropertyFromString(toDocument(context), s, CSSPropertyFontFamily, &exceptionState);
|
| +}
|
| +
|
| void FontFace::setStyle(ExecutionContext* context, const String& s, ExceptionState& exceptionState)
|
| {
|
| setPropertyFromString(toDocument(context), s, CSSPropertyFontStyle, &exceptionState);
|
| @@ -243,6 +245,11 @@ bool FontFace::setPropertyFromStyle(const StylePropertySet& properties, CSSPrope
|
| bool FontFace::setPropertyValue(PassRefPtrWillBeRawPtr<CSSValue> value, CSSPropertyID propertyID)
|
| {
|
| switch (propertyID) {
|
| + case CSSPropertyFontFamily:
|
| + if (!value || !value->isPrimitiveValue())
|
| + return false;
|
| + m_family = AtomicString(toCSSPrimitiveValue(value.get())->getStringValue());
|
| + break;
|
| case CSSPropertyFontStyle:
|
| m_style = value;
|
| break;
|
| @@ -270,41 +277,6 @@ bool FontFace::setPropertyValue(PassRefPtrWillBeRawPtr<CSSValue> value, CSSPrope
|
| return true;
|
| }
|
|
|
| -bool FontFace::setFamilyValue(CSSPrimitiveValue* familyValue)
|
| -{
|
| - AtomicString family;
|
| - if (familyValue->isCustomIdent()) {
|
| - family = AtomicString(familyValue->getStringValue());
|
| - } else if (familyValue->isValueID()) {
|
| - // We need to use the raw text for all the generic family types, since @font-face is a way of actually
|
| - // defining what font to use for those types.
|
| - switch (familyValue->getValueID()) {
|
| - case CSSValueSerif:
|
| - family = FontFamilyNames::webkit_serif;
|
| - break;
|
| - case CSSValueSansSerif:
|
| - family = FontFamilyNames::webkit_sans_serif;
|
| - break;
|
| - case CSSValueCursive:
|
| - family = FontFamilyNames::webkit_cursive;
|
| - break;
|
| - case CSSValueFantasy:
|
| - family = FontFamilyNames::webkit_fantasy;
|
| - break;
|
| - case CSSValueMonospace:
|
| - family = FontFamilyNames::webkit_monospace;
|
| - break;
|
| - case CSSValueWebkitPictograph:
|
| - family = FontFamilyNames::webkit_pictograph;
|
| - break;
|
| - default:
|
| - return false;
|
| - }
|
| - }
|
| - m_family = family;
|
| - return true;
|
| -}
|
| -
|
| String FontFace::status() const
|
| {
|
| switch (m_status) {
|
|
|