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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp

Issue 1535463002: Parse border-radius shorthand in CSSPropertyParser with CSSParserTokens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also remove ImplicitScope Created 4 years, 11 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 | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 476 }
477 case CSSPropertyBorderImageWidth: 477 case CSSPropertyBorderImageWidth:
478 case CSSPropertyWebkitMaskBoxImageWidth: { 478 case CSSPropertyWebkitMaskBoxImageWidth: {
479 RefPtrWillBeRawPtr<CSSQuadValue> result = nullptr; 479 RefPtrWillBeRawPtr<CSSQuadValue> result = nullptr;
480 if (parseBorderImageWidth(result)) { 480 if (parseBorderImageWidth(result)) {
481 addProperty(propId, result, important); 481 addProperty(propId, result, important);
482 return true; 482 return true;
483 } 483 }
484 break; 484 break;
485 } 485 }
486 case CSSPropertyBorderTopRightRadius:
487 case CSSPropertyBorderTopLeftRadius:
488 case CSSPropertyBorderBottomLeftRadius:
489 case CSSPropertyBorderBottomRightRadius: {
490 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg);
491 if (!validPrimitive)
492 return false;
493 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNume ricValue(value);
494 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = nullptr;
495 value = m_valueList->next();
496 if (value) {
497 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg);
498 if (!validPrimitive)
499 return false;
500 parsedValue2 = createPrimitiveNumericValue(value);
501 } else
502 parsedValue2 = parsedValue1;
503
504 if (m_valueList->next())
505 return false;
506 addProperty(propId, CSSValuePair::create(parsedValue1.release(), parsedV alue2.release(), CSSValuePair::DropIdenticalValues), important);
507 return true;
508 }
509 case CSSPropertyBorderRadius: {
510 ShorthandScope scope(this, unresolvedProperty);
511 RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4];
512 RefPtrWillBeRawPtr<CSSPrimitiveValue> radii2[4];
513 if (!parseRadii(radii, radii2, m_valueList, unresolvedProperty))
514 return false;
515 ImplicitScope implicitScope(this);
516 addProperty(CSSPropertyBorderTopLeftRadius, CSSValuePair::create(radii[0 ].release(), radii2[0].release(), CSSValuePair::DropIdenticalValues), important) ;
517 addProperty(CSSPropertyBorderTopRightRadius, CSSValuePair::create(radii[ 1].release(), radii2[1].release(), CSSValuePair::DropIdenticalValues), important );
518 addProperty(CSSPropertyBorderBottomRightRadius, CSSValuePair::create(rad ii[2].release(), radii2[2].release(), CSSValuePair::DropIdenticalValues), import ant);
519 addProperty(CSSPropertyBorderBottomLeftRadius, CSSValuePair::create(radi i[3].release(), radii2[3].release(), CSSValuePair::DropIdenticalValues), importa nt);
520 return true;
521 }
522 case CSSPropertyWebkitBoxReflect: 486 case CSSPropertyWebkitBoxReflect:
523 if (id == CSSValueNone) 487 if (id == CSSValueNone)
524 validPrimitive = true; 488 validPrimitive = true;
525 else 489 else
526 parsedValue = parseReflect(); 490 parsedValue = parseReflect();
527 break; 491 break;
528 case CSSPropertyFontSizeAdjust: // none | <number> 492 case CSSPropertyFontSizeAdjust: // none | <number>
529 ASSERT(RuntimeEnabledFeatures::cssFontSizeAdjustEnabled()); 493 ASSERT(RuntimeEnabledFeatures::cssFontSizeAdjustEnabled());
530 validPrimitive = (id == CSSValueNone) ? true : validUnit(value, FNumber | FNonNeg); 494 validPrimitive = (id == CSSValueNone) ? true : validUnit(value, FNumber | FNonNeg);
531 break; 495 break;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 case CSSPropertyTranslate: 836 case CSSPropertyTranslate:
873 case CSSPropertyCursor: 837 case CSSPropertyCursor:
874 case CSSPropertyTransformOrigin: 838 case CSSPropertyTransformOrigin:
875 case CSSPropertyContent: 839 case CSSPropertyContent:
876 case CSSPropertyListStyleImage: 840 case CSSPropertyListStyleImage:
877 case CSSPropertyListStyle: 841 case CSSPropertyListStyle:
878 case CSSPropertyPerspective: 842 case CSSPropertyPerspective:
879 case CSSPropertyScrollSnapCoordinate: 843 case CSSPropertyScrollSnapCoordinate:
880 case CSSPropertyScrollSnapPointsX: 844 case CSSPropertyScrollSnapPointsX:
881 case CSSPropertyScrollSnapPointsY: 845 case CSSPropertyScrollSnapPointsY:
846 case CSSPropertyBorderTopRightRadius:
847 case CSSPropertyBorderTopLeftRadius:
848 case CSSPropertyBorderBottomLeftRadius:
849 case CSSPropertyBorderBottomRightRadius:
850 case CSSPropertyBorderRadius:
851 case CSSPropertyAliasWebkitBorderRadius:
882 validPrimitive = false; 852 validPrimitive = false;
883 break; 853 break;
884 854
885 default: 855 default:
886 // If you crash here, it's because you added a css property and are not handling it 856 // If you crash here, it's because you added a css property and are not handling it
887 // in either this switch statement or the one in CSSPropertyParser::pars eSingleValue. 857 // in either this switch statement or the one in CSSPropertyParser::pars eSingleValue.
888 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId); 858 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId);
889 return false; 859 return false;
890 } 860 }
891 861
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 default: 2555 default:
2586 return parsedValues; 2556 return parsedValues;
2587 } 2557 }
2588 parsedValues->append(cssValuePool().createIdentifierValue(value->id)); 2558 parsedValues->append(cssValuePool().createIdentifierValue(value->id));
2589 list.next(); 2559 list.next();
2590 } 2560 }
2591 2561
2592 return parsedValues; 2562 return parsedValues;
2593 } 2563 }
2594 2564
2595 static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4]) 2565 void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4])
2596 { 2566 {
2597 if (radii[3]) 2567 if (radii[3])
2598 return; 2568 return;
2599 if (!radii[2]) { 2569 if (!radii[2]) {
2600 if (!radii[1]) 2570 if (!radii[1])
2601 radii[1] = radii[0]; 2571 radii[1] = radii[0];
2602 radii[2] = radii[0]; 2572 radii[2] = radii[0];
2603 } 2573 }
2604 radii[3] = radii[1]; 2574 radii[3] = radii[1];
2605 } 2575 }
(...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after
4619 ASSERT(!m_parsedCalculation); 4589 ASSERT(!m_parsedCalculation);
4620 m_parsedCalculation = CSSCalcValue::create(args, range); 4590 m_parsedCalculation = CSSCalcValue::create(args, range);
4621 4591
4622 if (!m_parsedCalculation) 4592 if (!m_parsedCalculation)
4623 return false; 4593 return false;
4624 4594
4625 return true; 4595 return true;
4626 } 4596 }
4627 4597
4628 } // namespace blink 4598 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698