Changed CSSParser::parseFontFaceDescriptor to return a const CSSValue*
Changed CSSParser::parseFontFaceDescriptor to return a const CSSValue*,
which required changing FontFace to store Member<const CSSValue>
instead of regular Member<CSSValue>.
This is an entirely mechanical change and is pre-work for making
StylePropertySet::getPropertyCSSValue return a const CSSValue*.
BUG=526586
Review-Url: https://codereview.chromium.org/2040853002
Cr-Commit-Position: refs/heads/master@{#401215}
diff --git a/third_party/WebKit/Source/core/css/FontFace.cpp b/third_party/WebKit/Source/core/css/FontFace.cpp
index 669f361..771bba6 100644
--- a/third_party/WebKit/Source/core/css/FontFace.cpp
+++ b/third_party/WebKit/Source/core/css/FontFace.cpp
@@ -63,7 +63,7 @@
namespace blink {
-static CSSValue* parseCSSValue(const Document* document, const String& value, CSSPropertyID propertyID)
+static const CSSValue* parseCSSValue(const Document* document, const String& value, CSSPropertyID propertyID)
{
CSSParserContext context(*document, UseCounter::getFrom(document));
return CSSParser::parseFontFaceDescriptor(propertyID, value, context);
@@ -85,7 +85,7 @@
{
FontFace* fontFace = new FontFace(context, family, descriptors);
- CSSValue* src = parseCSSValue(toDocument(context), source, CSSPropertySrc);
+ const CSSValue* src = parseCSSValue(toDocument(context), source, CSSPropertySrc);
if (!src || !src->isValueList())
fontFace->setError(DOMException::create(SyntaxError, "The source provided ('" + source + "') could not be parsed as a value list."));
@@ -228,7 +228,7 @@
void FontFace::setPropertyFromString(const Document* document, const String& s, CSSPropertyID propertyID, ExceptionState* exceptionState)
{
- CSSValue* value = parseCSSValue(document, s, propertyID);
+ const CSSValue* value = parseCSSValue(document, s, propertyID);
if (value && setPropertyValue(value, propertyID))
return;
@@ -244,7 +244,7 @@
return setPropertyValue(properties.getPropertyCSSValue(propertyID), propertyID);
}
-bool FontFace::setPropertyValue(CSSValue* value, CSSPropertyID propertyID)
+bool FontFace::setPropertyValue(const CSSValue* value, CSSPropertyID propertyID)
{
switch (propertyID) {
case CSSPropertyFontStyle:
@@ -510,7 +510,7 @@
return 0;
}
-static FontDisplay CSSValueToFontDisplay(CSSValue* value)
+static FontDisplay CSSValueToFontDisplay(const CSSValue* value)
{
if (value && value->isPrimitiveValue()) {
switch (toCSSPrimitiveValue(value)->getValueID()) {
@@ -531,10 +531,10 @@
return FontDisplayAuto;
}
-static CSSFontFace* createCSSFontFace(FontFace* fontFace, CSSValue* unicodeRange)
+static CSSFontFace* createCSSFontFace(FontFace* fontFace, const CSSValue* unicodeRange)
{
Vector<UnicodeRange> ranges;
- if (CSSValueList* rangeList = toCSSValueList(unicodeRange)) {
+ if (const CSSValueList* rangeList = toCSSValueList(unicodeRange)) {
unsigned numRanges = rangeList->length();
for (unsigned i = 0; i < numRanges; i++) {
const CSSUnicodeRangeValue& range = toCSSUnicodeRangeValue(rangeList->item(i));
@@ -545,7 +545,7 @@
return new CSSFontFace(fontFace, ranges);
}
-void FontFace::initCSSFontFace(Document* document, CSSValue* src)
+void FontFace::initCSSFontFace(Document* document, const CSSValue* src)
{
m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get());
if (m_error)
@@ -554,7 +554,7 @@
// Each item in the src property's list is a single CSSFontFaceSource. Put them all into a CSSFontFace.
ASSERT(src);
ASSERT(src->isValueList());
- CSSValueList* srcList = toCSSValueList(src);
+ const CSSValueList* srcList = toCSSValueList(src);
int srcLength = srcList->length();
for (int i = 0; i < srcLength; i++) {
diff --git a/third_party/WebKit/Source/core/css/FontFace.h b/third_party/WebKit/Source/core/css/FontFace.h
index 68182b6..89470451 100644
--- a/third_party/WebKit/Source/core/css/FontFace.h
+++ b/third_party/WebKit/Source/core/css/FontFace.h
@@ -121,11 +121,11 @@
explicit FontFace(ExecutionContext*);
FontFace(ExecutionContext*, const AtomicString& family, const FontFaceDescriptors&);
- void initCSSFontFace(Document*, CSSValue* src);
+ void initCSSFontFace(Document*, const CSSValue* src);
void initCSSFontFace(const unsigned char* data, size_t);
void setPropertyFromString(const Document*, const String&, CSSPropertyID, ExceptionState* = 0);
bool setPropertyFromStyle(const StylePropertySet&, CSSPropertyID);
- bool setPropertyValue(CSSValue*, CSSPropertyID);
+ bool setPropertyValue(const CSSValue*, CSSPropertyID);
bool setFamilyValue(const CSSValue&);
void loadInternal(ExecutionContext*);
ScriptPromise fontStatusPromise(ScriptState*);
@@ -134,13 +134,13 @@
AtomicString m_family;
String m_otsParseMessage;
- Member<CSSValue> m_style;
- Member<CSSValue> m_weight;
- Member<CSSValue> m_stretch;
- Member<CSSValue> m_unicodeRange;
- Member<CSSValue> m_variant;
- Member<CSSValue> m_featureSettings;
- Member<CSSValue> m_display;
+ Member<const CSSValue> m_style;
+ Member<const CSSValue> m_weight;
+ Member<const CSSValue> m_stretch;
+ Member<const CSSValue> m_unicodeRange;
+ Member<const CSSValue> m_variant;
+ Member<const CSSValue> m_featureSettings;
+ Member<const CSSValue> m_display;
LoadStatusType m_status;
Member<DOMException> m_error;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
index fd94660..9e99d3b 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
@@ -167,7 +167,7 @@
return true;
}
-CSSValue* CSSParser::parseFontFaceDescriptor(CSSPropertyID propertyID, const String& propertyValue, const CSSParserContext& context)
+const CSSValue* CSSParser::parseFontFaceDescriptor(CSSPropertyID propertyID, const String& propertyValue, const CSSParserContext& context)
{
StringBuilder builder;
builder.append("@font-face { ");
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParser.h b/third_party/WebKit/Source/core/css/parser/CSSParser.h
index 706dd562..2b46054 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParser.h
+++ b/third_party/WebKit/Source/core/css/parser/CSSParser.h
@@ -44,7 +44,7 @@
// This is for non-shorthands only
static CSSValue* parseSingleValue(CSSPropertyID, const String&, const CSSParserContext& = strictCSSParserContext());
- static CSSValue* parseFontFaceDescriptor(CSSPropertyID, const String&, const CSSParserContext&);
+ static const CSSValue* parseFontFaceDescriptor(CSSPropertyID, const String&, const CSSParserContext&);
static ImmutableStylePropertySet* parseInlineStyleDeclaration(const String&, Element*);