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

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

Issue 1345063003: Adapt parseFontVariantLigatures to use CSSParserTokenRange (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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/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 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 validPrimitive = true; 1375 validPrimitive = true;
1376 break; 1376 break;
1377 1377
1378 case CSSPropertyWebkitFontFeatureSettings: 1378 case CSSPropertyWebkitFontFeatureSettings:
1379 if (id == CSSValueNormal) 1379 if (id == CSSValueNormal)
1380 validPrimitive = true; 1380 validPrimitive = true;
1381 else 1381 else
1382 parsedValue = parseFontFeatureSettings(); 1382 parsedValue = parseFontFeatureSettings();
1383 break; 1383 break;
1384 1384
1385 case CSSPropertyFontVariantLigatures:
1386 if (id == CSSValueNormal)
1387 validPrimitive = true;
1388 else
1389 return parseFontVariantLigatures(important);
1390 break;
1391 case CSSPropertyWebkitClipPath: 1385 case CSSPropertyWebkitClipPath:
1392 if (id == CSSValueNone) { 1386 if (id == CSSValueNone) {
1393 validPrimitive = true; 1387 validPrimitive = true;
1394 } else if (value->m_unit == CSSParserValue::Function) { 1388 } else if (value->m_unit == CSSParserValue::Function) {
1395 parsedValue = parseBasicShape(); 1389 parsedValue = parseBasicShape();
1396 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) { 1390 } else if (value->unit() == CSSPrimitiveValue::UnitType::URI) {
1397 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV alue::UnitType::URI); 1391 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV alue::UnitType::URI);
1398 addProperty(propId, parsedValue.release(), important); 1392 addProperty(propId, parsedValue.release(), important);
1399 return true; 1393 return true;
1400 } 1394 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 validPrimitive = false; 1432 validPrimitive = false;
1439 break; 1433 break;
1440 1434
1441 // These were not accepted by the new path above so we should return false. 1435 // These were not accepted by the new path above so we should return false.
1442 case CSSPropertyWebkitMarginCollapse: 1436 case CSSPropertyWebkitMarginCollapse:
1443 case CSSPropertyWillChange: 1437 case CSSPropertyWillChange:
1444 case CSSPropertyPage: 1438 case CSSPropertyPage:
1445 case CSSPropertyOverflow: 1439 case CSSPropertyOverflow:
1446 case CSSPropertyQuotes: 1440 case CSSPropertyQuotes:
1447 case CSSPropertyWebkitHighlight: 1441 case CSSPropertyWebkitHighlight:
1442 case CSSPropertyFontVariantLigatures:
1448 validPrimitive = false; 1443 validPrimitive = false;
1449 break; 1444 break;
1450 1445
1451 case CSSPropertyScrollSnapPointsX: 1446 case CSSPropertyScrollSnapPointsX:
1452 case CSSPropertyScrollSnapPointsY: 1447 case CSSPropertyScrollSnapPointsY:
1453 parsedValue = parseScrollSnapPoints(); 1448 parsedValue = parseScrollSnapPoints();
1454 break; 1449 break;
1455 case CSSPropertyScrollSnapCoordinate: 1450 case CSSPropertyScrollSnapCoordinate:
1456 parsedValue = parseScrollSnapCoordinate(); 1451 parsedValue = parseScrollSnapCoordinate();
1457 break; 1452 break;
(...skipping 5552 matching lines...) Expand 10 before | Expand all | Expand 10 after
7010 if (!m_valueList->current() || !parseFontFeatureTag(settings.get())) 7005 if (!m_valueList->current() || !parseFontFeatureTag(settings.get()))
7011 return nullptr; 7006 return nullptr;
7012 if (!m_valueList->current()) 7007 if (!m_valueList->current())
7013 break; 7008 break;
7014 if (!consumeComma(m_valueList)) 7009 if (!consumeComma(m_valueList))
7015 return nullptr; 7010 return nullptr;
7016 } 7011 }
7017 return settings.release(); 7012 return settings.release();
7018 } 7013 }
7019 7014
7020 bool CSSPropertyParser::parseFontVariantLigatures(bool important)
7021 {
7022 RefPtrWillBeRawPtr<CSSValueList> ligatureValues = CSSValueList::createSpaceS eparated();
7023 bool sawCommonLigaturesValue = false;
7024 bool sawDiscretionaryLigaturesValue = false;
7025 bool sawHistoricalLigaturesValue = false;
7026 bool sawContextualLigaturesValue = false;
7027
7028 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) {
7029 if (value->m_unit != CSSParserValue::Identifier)
7030 return false;
7031
7032 switch (value->id) {
7033 case CSSValueNoCommonLigatures:
7034 case CSSValueCommonLigatures:
7035 if (sawCommonLigaturesValue)
7036 return false;
7037 sawCommonLigaturesValue = true;
7038 ligatureValues->append(cssValuePool().createIdentifierValue(value->i d));
7039 break;
7040 case CSSValueNoDiscretionaryLigatures:
7041 case CSSValueDiscretionaryLigatures:
7042 if (sawDiscretionaryLigaturesValue)
7043 return false;
7044 sawDiscretionaryLigaturesValue = true;
7045 ligatureValues->append(cssValuePool().createIdentifierValue(value->i d));
7046 break;
7047 case CSSValueNoHistoricalLigatures:
7048 case CSSValueHistoricalLigatures:
7049 if (sawHistoricalLigaturesValue)
7050 return false;
7051 sawHistoricalLigaturesValue = true;
7052 ligatureValues->append(cssValuePool().createIdentifierValue(value->i d));
7053 break;
7054 case CSSValueNoContextual:
7055 case CSSValueContextual:
7056 if (sawContextualLigaturesValue)
7057 return false;
7058 sawContextualLigaturesValue = true;
7059 ligatureValues->append(cssValuePool().createIdentifierValue(value->i d));
7060 break;
7061 default:
7062 return false;
7063 }
7064 }
7065
7066 if (!ligatureValues->length())
7067 return false;
7068
7069 addProperty(CSSPropertyFontVariantLigatures, ligatureValues.release(), impor tant);
7070 return true;
7071 }
7072
7073 bool CSSPropertyParser::parseCalculation(CSSParserValue* value, ValueRange range ) 7015 bool CSSPropertyParser::parseCalculation(CSSParserValue* value, ValueRange range )
7074 { 7016 {
7075 ASSERT(isCalculation(value)); 7017 ASSERT(isCalculation(value));
7076 7018
7077 CSSParserTokenRange args = value->calcFunction->args; 7019 CSSParserTokenRange args = value->calcFunction->args;
7078 7020
7079 ASSERT(!m_parsedCalculation); 7021 ASSERT(!m_parsedCalculation);
7080 m_parsedCalculation = CSSCalcValue::create(args, range); 7022 m_parsedCalculation = CSSCalcValue::create(args, range);
7081 7023
7082 if (!m_parsedCalculation) 7024 if (!m_parsedCalculation)
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
7786 } 7728 }
7787 } 7729 }
7788 7730
7789 if (!list->length()) 7731 if (!list->length())
7790 return nullptr; 7732 return nullptr;
7791 7733
7792 return list.release(); 7734 return list.release();
7793 } 7735 }
7794 7736
7795 } // namespace blink 7737 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698