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

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

Issue 1429003004: Parse text-emphasis shorthand in CSSPropertyParser with CSSParserTokens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 1 month 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 case CSSPropertyBackgroundColor: // <color> | inherit 430 case CSSPropertyBackgroundColor: // <color> | inherit
431 case CSSPropertyBorderTopColor: // <color> | inherit 431 case CSSPropertyBorderTopColor: // <color> | inherit
432 case CSSPropertyBorderRightColor: 432 case CSSPropertyBorderRightColor:
433 case CSSPropertyBorderBottomColor: 433 case CSSPropertyBorderBottomColor:
434 case CSSPropertyBorderLeftColor: 434 case CSSPropertyBorderLeftColor:
435 case CSSPropertyWebkitBorderStartColor: 435 case CSSPropertyWebkitBorderStartColor:
436 case CSSPropertyWebkitBorderEndColor: 436 case CSSPropertyWebkitBorderEndColor:
437 case CSSPropertyWebkitBorderBeforeColor: 437 case CSSPropertyWebkitBorderBeforeColor:
438 case CSSPropertyWebkitBorderAfterColor: 438 case CSSPropertyWebkitBorderAfterColor:
439 case CSSPropertyWebkitColumnRuleColor: 439 case CSSPropertyWebkitColumnRuleColor:
440 case CSSPropertyWebkitTextEmphasisColor:
441 case CSSPropertyWebkitTextStrokeColor: 440 case CSSPropertyWebkitTextStrokeColor:
442 parsedValue = parseColor(m_valueList->current(), acceptQuirkyColors(prop Id)); 441 parsedValue = parseColor(m_valueList->current(), acceptQuirkyColors(prop Id));
443 if (parsedValue) 442 if (parsedValue)
444 m_valueList->next(); 443 m_valueList->next();
445 break; 444 break;
446 445
447 case CSSPropertyCursor: { 446 case CSSPropertyCursor: {
448 // Grammar defined by CSS3 UI and modified by CSS4 images: 447 // Grammar defined by CSS3 UI and modified by CSS4 images:
449 // [ [<image> [<x> <y>]?,]* 448 // [ [<image> [<x> <y>]?,]*
450 // [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize | 449 // [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 return parseShorthand(propId, flexFlowShorthand(), important); 1043 return parseShorthand(propId, flexFlowShorthand(), important);
1045 case CSSPropertyListStyle: 1044 case CSSPropertyListStyle:
1046 return parseShorthand(propId, listStyleShorthand(), important); 1045 return parseShorthand(propId, listStyleShorthand(), important);
1047 case CSSPropertyWebkitColumnRule: 1046 case CSSPropertyWebkitColumnRule:
1048 return parseShorthand(propId, webkitColumnRuleShorthand(), important); 1047 return parseShorthand(propId, webkitColumnRuleShorthand(), important);
1049 case CSSPropertyWebkitTextStroke: 1048 case CSSPropertyWebkitTextStroke:
1050 return parseShorthand(propId, webkitTextStrokeShorthand(), important); 1049 return parseShorthand(propId, webkitTextStrokeShorthand(), important);
1051 case CSSPropertyInvalid: 1050 case CSSPropertyInvalid:
1052 return false; 1051 return false;
1053 // CSS Text Layout Module Level 3: Vertical writing support 1052 // CSS Text Layout Module Level 3: Vertical writing support
1054 case CSSPropertyWebkitTextEmphasis:
1055 return parseShorthand(propId, webkitTextEmphasisShorthand(), important);
1056
1057 case CSSPropertyWebkitTextEmphasisStyle:
1058 parsedValue = parseTextEmphasisStyle();
1059 break;
1060
1061 case CSSPropertyWebkitTextOrientation: 1053 case CSSPropertyWebkitTextOrientation:
1062 // FIXME: For now just support sideways, sideways-right, upright and ver tical-right. 1054 // FIXME: For now just support sideways, sideways-right, upright and ver tical-right.
1063 if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSVa lueVerticalRight || id == CSSValueUpright) 1055 if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSVa lueVerticalRight || id == CSSValueUpright)
1064 validPrimitive = true; 1056 validPrimitive = true;
1065 break; 1057 break;
1066 1058
1067 case CSSPropertyWebkitClipPath: 1059 case CSSPropertyWebkitClipPath:
1068 if (id == CSSValueNone) { 1060 if (id == CSSValueNone) {
1069 validPrimitive = true; 1061 validPrimitive = true;
1070 } else if (value->m_unit == CSSParserValue::Function) { 1062 } else if (value->m_unit == CSSParserValue::Function) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 case CSSPropertyWebkitFilter: 1178 case CSSPropertyWebkitFilter:
1187 case CSSPropertyBackdropFilter: 1179 case CSSPropertyBackdropFilter:
1188 case CSSPropertyTextDecorationColor: 1180 case CSSPropertyTextDecorationColor:
1189 case CSSPropertyWebkitTextDecorationsInEffect: 1181 case CSSPropertyWebkitTextDecorationsInEffect:
1190 case CSSPropertyTextDecorationLine: 1182 case CSSPropertyTextDecorationLine:
1191 case CSSPropertyTextDecoration: 1183 case CSSPropertyTextDecoration:
1192 case CSSPropertyMotionPath: 1184 case CSSPropertyMotionPath:
1193 case CSSPropertyMotionOffset: 1185 case CSSPropertyMotionOffset:
1194 case CSSPropertyMotionRotation: 1186 case CSSPropertyMotionRotation:
1195 case CSSPropertyMotion: 1187 case CSSPropertyMotion:
1188 case CSSPropertyWebkitTextEmphasisColor:
1189 case CSSPropertyWebkitTextEmphasisStyle:
1190 case CSSPropertyWebkitTextEmphasis:
1196 validPrimitive = false; 1191 validPrimitive = false;
1197 break; 1192 break;
1198 1193
1199 case CSSPropertyScrollSnapPointsX: 1194 case CSSPropertyScrollSnapPointsX:
1200 case CSSPropertyScrollSnapPointsY: 1195 case CSSPropertyScrollSnapPointsY:
1201 parsedValue = parseScrollSnapPoints(); 1196 parsedValue = parseScrollSnapPoints();
1202 break; 1197 break;
1203 case CSSPropertyScrollSnapCoordinate: 1198 case CSSPropertyScrollSnapCoordinate:
1204 parsedValue = parseScrollSnapCoordinate(); 1199 parsedValue = parseScrollSnapCoordinate();
1205 break; 1200 break;
(...skipping 4163 matching lines...) Expand 10 before | Expand all | Expand 10 after
5369 5364
5370 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 5365 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
5371 list->append(xValue.release()); 5366 list->append(xValue.release());
5372 if (yValue) 5367 if (yValue)
5373 list->append(yValue.release()); 5368 list->append(yValue.release());
5374 if (zValue) 5369 if (zValue)
5375 list->append(zValue.release()); 5370 list->append(zValue.release());
5376 return list.release(); 5371 return list.release();
5377 } 5372 }
5378 5373
5379 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextEmphasisStyle()
5380 {
5381 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr;
5382 RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = nullptr;
5383
5384 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL ist->next()) {
5385 if (value->m_unit == CSSParserValue::String) {
5386 if (fill || shape)
5387 return nullptr;
5388 m_valueList->next();
5389 return createPrimitiveStringValue(value);
5390 }
5391
5392 if (value->id == CSSValueNone) {
5393 if (fill || shape)
5394 return nullptr;
5395 m_valueList->next();
5396 return cssValuePool().createIdentifierValue(CSSValueNone);
5397 }
5398
5399 if (value->id == CSSValueOpen || value->id == CSSValueFilled) {
5400 if (fill)
5401 return nullptr;
5402 fill = cssValuePool().createIdentifierValue(value->id);
5403 } else if (value->id == CSSValueDot || value->id == CSSValueCircle || va lue->id == CSSValueDoubleCircle || value->id == CSSValueTriangle || value->id == CSSValueSesame) {
5404 if (shape)
5405 return nullptr;
5406 shape = cssValuePool().createIdentifierValue(value->id);
5407 } else {
5408 break;
5409 }
5410 }
5411
5412 if (fill && shape) {
5413 RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpac eSeparated();
5414 parsedValues->append(fill.release());
5415 parsedValues->append(shape.release());
5416 return parsedValues.release();
5417 }
5418 if (fill)
5419 return fill.release();
5420 if (shape)
5421 return shape.release();
5422
5423 return nullptr;
5424 }
5425
5426 bool CSSPropertyParser::parseCalculation(CSSParserValue* value, ValueRange range ) 5374 bool CSSPropertyParser::parseCalculation(CSSParserValue* value, ValueRange range )
5427 { 5375 {
5428 ASSERT(isCalculation(value)); 5376 ASSERT(isCalculation(value));
5429 5377
5430 CSSParserTokenRange args = value->calcFunction->args; 5378 CSSParserTokenRange args = value->calcFunction->args;
5431 5379
5432 ASSERT(!m_parsedCalculation); 5380 ASSERT(!m_parsedCalculation);
5433 m_parsedCalculation = CSSCalcValue::create(args, range); 5381 m_parsedCalculation = CSSCalcValue::create(args, range);
5434 5382
5435 if (!m_parsedCalculation) 5383 if (!m_parsedCalculation)
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
5945 return nullptr; 5893 return nullptr;
5946 a = args->next(); 5894 a = args->next();
5947 5895
5948 argNumber++; 5896 argNumber++;
5949 } 5897 }
5950 5898
5951 return transformValue.release(); 5899 return transformValue.release();
5952 } 5900 }
5953 5901
5954 } // namespace blink 5902 } // 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