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

Side by Side Diff: Source/core/css/CSSParser-in.cpp

Issue 25044003: Generate toCSSFooValue for CSS*GradientValues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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 unified diff | Download patch
« no previous file with comments | « Source/core/css/CSSImageGeneratorValue.cpp ('k') | Source/core/css/CSSValue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 7377 matching lines...) Expand 10 before | Expand all | Expand 10 after
7388 // Comma after the first point. 7388 // Comma after the first point.
7389 a = args->next(); 7389 a = args->next();
7390 if (!isComma(a)) 7390 if (!isComma(a))
7391 return false; 7391 return false;
7392 7392
7393 // For radial gradients only, we now expect a numeric radius. 7393 // For radial gradients only, we now expect a numeric radius.
7394 if (gradientType == CSSDeprecatedRadialGradient) { 7394 if (gradientType == CSSDeprecatedRadialGradient) {
7395 a = args->next(); 7395 a = args->next();
7396 if (!a || a->unit != CSSPrimitiveValue::CSS_NUMBER) 7396 if (!a || a->unit != CSSPrimitiveValue::CSS_NUMBER)
7397 return false; 7397 return false;
7398 static_cast<CSSRadialGradientValue*>(result.get())->setFirstRadius(creat ePrimitiveNumericValue(a)); 7398 toCSSRadialGradientValue(result.get())->setFirstRadius(createPrimitiveNu mericValue(a));
7399 7399
7400 // Comma after the first radius. 7400 // Comma after the first radius.
7401 a = args->next(); 7401 a = args->next();
7402 if (!isComma(a)) 7402 if (!isComma(a))
7403 return false; 7403 return false;
7404 } 7404 }
7405 7405
7406 // Next is the ending point for the gradient as an x, y pair. 7406 // Next is the ending point for the gradient as an x, y pair.
7407 // Second X. It can be left, right, number or percent. 7407 // Second X. It can be left, right, number or percent.
7408 a = args->next(); 7408 a = args->next();
(...skipping 16 matching lines...) Expand all
7425 // For radial gradients only, we now expect the second radius. 7425 // For radial gradients only, we now expect the second radius.
7426 if (gradientType == CSSDeprecatedRadialGradient) { 7426 if (gradientType == CSSDeprecatedRadialGradient) {
7427 // Comma after the second point. 7427 // Comma after the second point.
7428 a = args->next(); 7428 a = args->next();
7429 if (!isComma(a)) 7429 if (!isComma(a))
7430 return false; 7430 return false;
7431 7431
7432 a = args->next(); 7432 a = args->next();
7433 if (!a || a->unit != CSSPrimitiveValue::CSS_NUMBER) 7433 if (!a || a->unit != CSSPrimitiveValue::CSS_NUMBER)
7434 return false; 7434 return false;
7435 static_cast<CSSRadialGradientValue*>(result.get())->setSecondRadius(crea tePrimitiveNumericValue(a)); 7435 toCSSRadialGradientValue(result.get())->setSecondRadius(createPrimitiveN umericValue(a));
7436 } 7436 }
7437 7437
7438 // We now will accept any number of stops (0 or more). 7438 // We now will accept any number of stops (0 or more).
7439 a = args->next(); 7439 a = args->next();
7440 while (a) { 7440 while (a) {
7441 // Look for the comma before the next stop. 7441 // Look for the comma before the next stop.
7442 if (!isComma(a)) 7442 if (!isComma(a))
7443 return false; 7443 return false;
7444 7444
7445 // Now examine the stop itself. 7445 // Now examine the stop itself.
(...skipping 4575 matching lines...) Expand 10 before | Expand all | Expand 10 after
12021 { 12021 {
12022 // The tokenizer checks for the construct of an+b. 12022 // The tokenizer checks for the construct of an+b.
12023 // However, since the {ident} rule precedes the {nth} rule, some of those 12023 // However, since the {ident} rule precedes the {nth} rule, some of those
12024 // tokens are identified as string literal. Furthermore we need to accept 12024 // tokens are identified as string literal. Furthermore we need to accept
12025 // "odd" and "even" which does not match to an+b. 12025 // "odd" and "even" which does not match to an+b.
12026 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 12026 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
12027 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 12027 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
12028 } 12028 }
12029 12029
12030 } 12030 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSImageGeneratorValue.cpp ('k') | Source/core/css/CSSValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698