Chromium Code Reviews| Index: Source/core/css/parser/CSSPropertyParser.cpp |
| diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp |
| index e89861130584f9fd6fe30e0908a7b17ff465b241..ade3ffbab6183cb54e2ff6120ee27a0883a9eabf 100644 |
| --- a/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -363,6 +363,13 @@ inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit |
| return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRING); |
| } |
| +inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWithReferrer(const String& rawValue, const KURL& url) |
| +{ |
| + RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, url); |
| + toCSSImageValue(imageValue.get())->setReferrer(m_context.baseURL().string()); |
|
abarth-chromium
2014/04/17 17:44:58
What does m_context.baseURL() mean here?
Don't we
bashi
2014/04/18 10:16:59
I think it's the URL of stylesheets which is being
|
| + return imageValue; |
| +} |
| + |
| static inline bool isComma(CSSParserValue* value) |
| { |
| return value && value->unit == CSSParserValue::Operator && value->iValue == ','; |
| @@ -636,7 +643,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important) |
| if (value->unit == CSSPrimitiveValue::CSS_URI) { |
| String uri = value->string; |
| if (!uri.isNull()) |
| - image = CSSImageValue::create(uri, completeURL(uri)); |
| + image = createCSSImageValueWithReferrer(uri, completeURL(uri)); |
| } else if (value->unit == CSSParserValue::Function && equalIgnoringCase(value->function->name, "-webkit-image-set(")) { |
| image = parseImageSet(m_valueList.get()); |
| if (!image) |
| @@ -755,7 +762,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important) |
| parsedValue = cssValuePool().createIdentifierValue(CSSValueNone); |
| m_valueList->next(); |
| } else if (value->unit == CSSPrimitiveValue::CSS_URI) { |
| - parsedValue = CSSImageValue::create(value->string, completeURL(value->string)); |
| + parsedValue = createCSSImageValueWithReferrer(value->string, completeURL(value->string)); |
| m_valueList->next(); |
| } else if (isGeneratedImageValue(value)) { |
| if (parseGeneratedImage(m_valueList.get(), parsedValue)) |
| @@ -2310,7 +2317,7 @@ bool CSSPropertyParser::parseContent(CSSPropertyID propId, bool important) |
| RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
| if (val->unit == CSSPrimitiveValue::CSS_URI) { |
| // url |
| - parsedValue = CSSImageValue::create(val->string, completeURL(val->string)); |
| + parsedValue = createCSSImageValueWithReferrer(val->string, completeURL(val->string)); |
| } else if (val->unit == CSSParserValue::Function) { |
| // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradient(...) |
| CSSParserValueList* args = val->function->args.get(); |
| @@ -2414,7 +2421,7 @@ bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWill |
| return true; |
| } |
| if (valueList->current()->unit == CSSPrimitiveValue::CSS_URI) { |
| - value = CSSImageValue::create(valueList->current()->string, completeURL(valueList->current()->string)); |
| + value = createCSSImageValueWithReferrer(valueList->current()->string, completeURL(valueList->current()->string)); |
| return true; |
| } |
| @@ -4799,6 +4806,7 @@ bool CSSPropertyParser::parseFontWeight(bool important) |
| bool CSSPropertyParser::parseFontFaceSrcURI(CSSValueList* valueList) |
| { |
| RefPtrWillBeRawPtr<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create(completeURL(m_valueList->current()->string))); |
| + uriValue->setReferrer(m_context.baseURL().string()); |
| CSSParserValue* value = m_valueList->next(); |
| if (!value) { |
| @@ -5896,7 +5904,7 @@ bool BorderImageParseContext::buildFromParser(CSSPropertyParser& parser, CSSProp |
| if (!context.canAdvance() && context.allowImage()) { |
| if (val->unit == CSSPrimitiveValue::CSS_URI) { |
| - context.commitImage(CSSImageValue::create(val->string, parser.m_context.completeURL(val->string))); |
| + context.commitImage(parser.createCSSImageValueWithReferrer(val->string, parser.m_context.completeURL(val->string))); |
| } else if (isGeneratedImageValue(val)) { |
| RefPtrWillBeRawPtr<CSSValue> value = nullptr; |
| if (parser.parseGeneratedImage(parser.m_valueList.get(), value)) |
| @@ -7185,7 +7193,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseImageSet(CSSParserValue |
| if (arg->unit != CSSPrimitiveValue::CSS_URI) |
| return nullptr; |
| - RefPtrWillBeRawPtr<CSSImageValue> image = CSSImageValue::create(arg->string, completeURL(arg->string)); |
| + RefPtrWillBeRawPtr<CSSValue> image = createCSSImageValueWithReferrer(arg->string, completeURL(arg->string)); |
| imageSet->append(image); |
| arg = functionArgs->next(); |