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

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

Issue 1306823004: Split out String, URI and CustomIdent from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@split_out_attr_values
Patch Set: Rebase Created 5 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/css/FontFace.h ('k') | third_party/WebKit/Source/core/css/RuleFeature.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..acb3f2c8902f915da371ee9234783f1cb8d7fd77 100644
--- a/third_party/WebKit/Source/core/css/FontFace.cpp
+++ b/third_party/WebKit/Source/core/css/FontFace.cpp
@@ -36,6 +36,7 @@
#include "bindings/core/v8/UnionTypesCore.h"
#include "core/CSSValueKeywords.h"
#include "core/css/BinaryDataFontFaceSource.h"
+#include "core/css/CSSCustomIdentValue.h"
#include "core/css/CSSFontFace.h"
#include "core/css/CSSFontFaceSrcValue.h"
#include "core/css/CSSFontSelector.h"
@@ -112,7 +113,7 @@ PassRefPtrWillBeRawPtr<FontFace> FontFace::create(Document* document, const Styl
// Obtain the font-family property and the src property. Both must be defined.
RefPtrWillBeRawPtr<CSSValue> family = properties.getPropertyCSSValue(CSSPropertyFontFamily);
- if (!family || !family->isPrimitiveValue())
+ if (!family || (!family->isCustomIdentValue() && !family->isPrimitiveValue()))
return nullptr;
RefPtrWillBeRawPtr<CSSValue> src = properties.getPropertyCSSValue(CSSPropertySrc);
if (!src || !src->isValueList())
@@ -120,7 +121,7 @@ PassRefPtrWillBeRawPtr<FontFace> FontFace::create(Document* document, const Styl
RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace(document));
- if (fontFace->setFamilyValue(toCSSPrimitiveValue(family.get()))
+ if (fontFace->setFamilyValue(*family)
&& fontFace->setPropertyFromStyle(properties, CSSPropertyFontStyle)
&& fontFace->setPropertyFromStyle(properties, CSSPropertyFontWeight)
&& fontFace->setPropertyFromStyle(properties, CSSPropertyFontStretch)
@@ -270,15 +271,15 @@ bool FontFace::setPropertyValue(PassRefPtrWillBeRawPtr<CSSValue> value, CSSPrope
return true;
}
-bool FontFace::setFamilyValue(CSSPrimitiveValue* familyValue)
+bool FontFace::setFamilyValue(const CSSValue& familyValue)
{
AtomicString family;
- if (familyValue->isCustomIdent()) {
- family = AtomicString(familyValue->getStringValue());
- } else if (familyValue->isValueID()) {
+ if (familyValue.isCustomIdentValue()) {
+ family = AtomicString(toCSSCustomIdentValue(familyValue).value());
+ } else if (toCSSPrimitiveValue(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()) {
+ switch (toCSSPrimitiveValue(familyValue).getValueID()) {
case CSSValueSerif:
family = FontFamilyNames::webkit_serif;
break;
« no previous file with comments | « third_party/WebKit/Source/core/css/FontFace.h ('k') | third_party/WebKit/Source/core/css/RuleFeature.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698