OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/parser/CSSPropertyParserHelpers.h" | 5 #include "core/css/parser/CSSPropertyParserHelpers.h" |
6 | 6 |
7 #include "core/css/CSSCalculationValue.h" | 7 #include "core/css/CSSCalculationValue.h" |
8 #include "core/css/CSSColorValue.h" | 8 #include "core/css/CSSColorValue.h" |
9 #include "core/css/CSSCrossfadeValue.h" | 9 #include "core/css/CSSCrossfadeValue.h" |
10 #include "core/css/CSSGradientValue.h" | 10 #include "core/css/CSSGradientValue.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 return StringView(); | 369 return StringView(); |
370 ASSERT(next.type() == StringToken); | 370 ASSERT(next.type() == StringToken); |
371 range = urlRange; | 371 range = urlRange; |
372 range.consumeWhitespace(); | 372 range.consumeWhitespace(); |
373 return next.value(); | 373 return next.value(); |
374 } | 374 } |
375 | 375 |
376 return StringView(); | 376 return StringView(); |
377 } | 377 } |
378 | 378 |
379 CSSURIValue* consumeUrl(CSSParserTokenRange& range) { | 379 CSSURIValue* consumeUrl(CSSParserTokenRange& range, |
| 380 const CSSParserContext* context) { |
380 StringView url = consumeUrlAsStringView(range); | 381 StringView url = consumeUrlAsStringView(range); |
381 if (url.isNull()) | 382 if (url.isNull()) |
382 return nullptr; | 383 return nullptr; |
383 return CSSURIValue::create(url.toString()); | 384 String urlString = url.toString(); |
| 385 return CSSURIValue::create(urlString, context->completeURL(urlString)); |
384 } | 386 } |
385 | 387 |
386 static int clampRGBComponent(const CSSPrimitiveValue& value) { | 388 static int clampRGBComponent(const CSSPrimitiveValue& value) { |
387 double result = value.getDoubleValue(); | 389 double result = value.getDoubleValue(); |
388 // TODO(timloh): Multiply by 2.55 and round instead of floor. | 390 // TODO(timloh): Multiply by 2.55 and round instead of floor. |
389 if (value.isPercentage()) | 391 if (value.isPercentage()) |
390 result *= 2.56; | 392 result *= 2.56; |
391 return clampTo<int>(result, 0, 255); | 393 return clampTo<int>(result, 0, 255); |
392 } | 394 } |
393 | 395 |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 | 1250 |
1249 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box | 1251 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box |
1250 CSSIdentifierValue* consumeShapeBox(CSSParserTokenRange& range) { | 1252 CSSIdentifierValue* consumeShapeBox(CSSParserTokenRange& range) { |
1251 return consumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox, | 1253 return consumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox, |
1252 CSSValueMarginBox>(range); | 1254 CSSValueMarginBox>(range); |
1253 } | 1255 } |
1254 | 1256 |
1255 } // namespace CSSPropertyParserHelpers | 1257 } // namespace CSSPropertyParserHelpers |
1256 | 1258 |
1257 } // namespace blink | 1259 } // namespace blink |
OLD | NEW |