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

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

Issue 1406433002: Move text-indent property into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 case CSSPropertyWebkitBorderEndWidth: 657 case CSSPropertyWebkitBorderEndWidth:
658 case CSSPropertyWebkitBorderBeforeWidth: 658 case CSSPropertyWebkitBorderBeforeWidth:
659 case CSSPropertyWebkitBorderAfterWidth: 659 case CSSPropertyWebkitBorderAfterWidth:
660 case CSSPropertyWebkitColumnRuleWidth: 660 case CSSPropertyWebkitColumnRuleWidth:
661 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) 661 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick)
662 validPrimitive = true; 662 validPrimitive = true;
663 else 663 else
664 validPrimitive = validUnit(value, FLength | FNonNeg | unitless); 664 validPrimitive = validUnit(value, FLength | FNonNeg | unitless);
665 break; 665 break;
666 666
667 case CSSPropertyTextIndent:
668 parsedValue = parseTextIndent();
669 break;
670
671 case CSSPropertyPaddingTop: //// <padding-width> | inherit 667 case CSSPropertyPaddingTop: //// <padding-width> | inherit
672 case CSSPropertyPaddingRight: // Which is defined as 668 case CSSPropertyPaddingRight: // Which is defined as
673 case CSSPropertyPaddingBottom: // <length> | <percentage> 669 case CSSPropertyPaddingBottom: // <length> | <percentage>
674 case CSSPropertyPaddingLeft: //// 670 case CSSPropertyPaddingLeft: ////
675 unitless = FUnitlessQuirk; 671 unitless = FUnitlessQuirk;
676 // fall through 672 // fall through
677 case CSSPropertyWebkitPaddingStart: 673 case CSSPropertyWebkitPaddingStart:
678 case CSSPropertyWebkitPaddingEnd: 674 case CSSPropertyWebkitPaddingEnd:
679 case CSSPropertyWebkitPaddingBefore: 675 case CSSPropertyWebkitPaddingBefore:
680 case CSSPropertyWebkitPaddingAfter: 676 case CSSPropertyWebkitPaddingAfter:
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 case CSSPropertyTabSize: 1346 case CSSPropertyTabSize:
1351 case CSSPropertyFontSize: 1347 case CSSPropertyFontSize:
1352 case CSSPropertyLineHeight: 1348 case CSSPropertyLineHeight:
1353 case CSSPropertyRotate: 1349 case CSSPropertyRotate:
1354 case CSSPropertyFont: 1350 case CSSPropertyFont:
1355 case CSSPropertyWebkitBorderHorizontalSpacing: 1351 case CSSPropertyWebkitBorderHorizontalSpacing:
1356 case CSSPropertyWebkitBorderVerticalSpacing: 1352 case CSSPropertyWebkitBorderVerticalSpacing:
1357 case CSSPropertyBorderSpacing: 1353 case CSSPropertyBorderSpacing:
1358 case CSSPropertyCounterIncrement: 1354 case CSSPropertyCounterIncrement:
1359 case CSSPropertyCounterReset: 1355 case CSSPropertyCounterReset:
1356 case CSSPropertyTextIndent:
1360 validPrimitive = false; 1357 validPrimitive = false;
1361 break; 1358 break;
1362 1359
1363 case CSSPropertyScrollSnapPointsX: 1360 case CSSPropertyScrollSnapPointsX:
1364 case CSSPropertyScrollSnapPointsY: 1361 case CSSPropertyScrollSnapPointsY:
1365 parsedValue = parseScrollSnapPoints(); 1362 parsedValue = parseScrollSnapPoints();
1366 break; 1363 break;
1367 case CSSPropertyScrollSnapCoordinate: 1364 case CSSPropertyScrollSnapCoordinate:
1368 parsedValue = parseScrollSnapCoordinate(); 1365 parsedValue = parseScrollSnapCoordinate();
1369 break; 1366 break;
(...skipping 5057 matching lines...) Expand 10 before | Expand all | Expand 10 after
6427 return parsedValues.release(); 6424 return parsedValues.release();
6428 } 6425 }
6429 if (fill) 6426 if (fill)
6430 return fill.release(); 6427 return fill.release();
6431 if (shape) 6428 if (shape)
6432 return shape.release(); 6429 return shape.release();
6433 6430
6434 return nullptr; 6431 return nullptr;
6435 } 6432 }
6436 6433
6437 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextIndent()
6438 {
6439 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
6440
6441 bool hasLengthOrPercentage = false;
6442 bool hasEachLine = false;
6443 bool hasHanging = false;
6444
6445 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) {
6446 // <length> | <percentage> | inherit when RuntimeEnabledFeatures::css3Te xtEnabled() returns false
6447 if (!hasLengthOrPercentage && validUnit(value, FLength | FPercent | FUni tlessQuirk)) {
6448 list->append(createPrimitiveNumericValue(value));
6449 hasLengthOrPercentage = true;
6450 continue;
6451 }
6452
6453 // [ <length> | <percentage> ] && hanging? && each-line? | inherit
6454 // when RuntimeEnabledFeatures::css3TextEnabled() returns true
6455 if (RuntimeEnabledFeatures::css3TextEnabled()) {
6456 if (!hasEachLine && value->id == CSSValueEachLine) {
6457 list->append(cssValuePool().createIdentifierValue(CSSValueEachLi ne));
6458 hasEachLine = true;
6459 continue;
6460 }
6461 if (!hasHanging && value->id == CSSValueHanging) {
6462 list->append(cssValuePool().createIdentifierValue(CSSValueHangin g));
6463 hasHanging = true;
6464 continue;
6465 }
6466 }
6467 return nullptr;
6468 }
6469
6470 if (!hasLengthOrPercentage)
6471 return nullptr;
6472
6473 return list.release();
6474 }
6475
6476 bool CSSPropertyParser::parseCalculation(CSSParserValue* value, ValueRange range ) 6434 bool CSSPropertyParser::parseCalculation(CSSParserValue* value, ValueRange range )
6477 { 6435 {
6478 ASSERT(isCalculation(value)); 6436 ASSERT(isCalculation(value));
6479 6437
6480 CSSParserTokenRange args = value->calcFunction->args; 6438 CSSParserTokenRange args = value->calcFunction->args;
6481 6439
6482 ASSERT(!m_parsedCalculation); 6440 ASSERT(!m_parsedCalculation);
6483 m_parsedCalculation = CSSCalcValue::create(args, range); 6441 m_parsedCalculation = CSSCalcValue::create(args, range);
6484 6442
6485 if (!m_parsedCalculation) 6443 if (!m_parsedCalculation)
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
7060 } 7018 }
7061 } 7019 }
7062 7020
7063 if (!list->length()) 7021 if (!list->length())
7064 return nullptr; 7022 return nullptr;
7065 7023
7066 return list.release(); 7024 return list.release();
7067 } 7025 }
7068 7026
7069 } // namespace blink 7027 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698