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

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

Issue 1103273010: Add parseFontFaceDescriptor for @font-face handling (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: V2 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/StyleRule.cpp
diff --git a/Source/core/css/StyleRule.cpp b/Source/core/css/StyleRule.cpp
index dc810357ca37e3125b526763bc3498a1a480db4b..7eb6e6e85eef3b729d0f45619f9e0e078849e65f 100644
--- a/Source/core/css/StyleRule.cpp
+++ b/Source/core/css/StyleRule.cpp
@@ -29,6 +29,7 @@
#include "core/css/CSSPageRule.h"
#include "core/css/CSSStyleRule.h"
#include "core/css/CSSSupportsRule.h"
+#include "core/css/CSSValueList.h"
#include "core/css/CSSViewportRule.h"
#include "core/css/StylePropertySet.h"
#include "core/css/StyleRuleImport.h"
@@ -347,9 +348,18 @@ MutableStylePropertySet& StyleRuleFontFace::mutableProperties()
return *toMutableStylePropertySet(m_properties);
}
-void StyleRuleFontFace::setProperties(PassRefPtrWillBeRawPtr<StylePropertySet> properties)
+bool StyleRuleFontFace::setProperties(PassRefPtrWillBeRawPtr<StylePropertySet> properties)
{
+ // FIXME: This logic should be in CSSPropertyParser
+ // FIXME: Shouldn't we fail if font-family or src aren't specified?
+ for (unsigned i = 0; i < properties->propertyCount(); ++i) {
+ StylePropertySet::PropertyReference property = properties->propertyAt(i);
+ if (property.id() == CSSPropertyFontFamily && (!property.value()->isValueList() || toCSSValueList(property.value())->length() != 1))
+ return false;
+ }
+
m_properties = properties;
+ return true;
}
DEFINE_TRACE_AFTER_DISPATCH(StyleRuleFontFace)

Powered by Google App Engine
This is Rietveld 408576698