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

Side by Side Diff: sky/engine/core/css/parser/CSSPropertyParser.cpp

Issue 1070263002: remove CSS quotes property (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 return true; 444 return true;
445 } 445 }
446 446
447 bool validPrimitive = false; 447 bool validPrimitive = false;
448 RefPtr<CSSValue> parsedValue = nullptr; 448 RefPtr<CSSValue> parsedValue = nullptr;
449 449
450 switch (propId) { 450 switch (propId) {
451 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size > || [ portrait | landscape] ] 451 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size > || [ portrait | landscape] ]
452 return parseSize(propId); 452 return parseSize(propId);
453 453
454 case CSSPropertyQuotes: // [<string> <string>]+ | none
455 if (id == CSSValueNone)
456 validPrimitive = true;
457 else
458 parsedValue = parseQuotes();
459 break;
460
461 case CSSPropertyClip: // <shape> | auto | inherit 454 case CSSPropertyClip: // <shape> | auto | inherit
462 if (id == CSSValueAuto) 455 if (id == CSSValueAuto)
463 validPrimitive = true; 456 validPrimitive = true;
464 else if (value->unit == CSSParserValue::Function) 457 else if (value->unit == CSSParserValue::Function)
465 return parseClipShape(propId); 458 return parseClipShape(propId);
466 break; 459 break;
467 460
468 /* Start of supported CSS properties with validation. This is needed for par seShorthand to work 461 /* Start of supported CSS properties with validation. This is needed for par seShorthand to work
469 * correctly and allows optimization in blink::applyRule(..) 462 * correctly and allows optimization in blink::applyRule(..)
470 */ 463 */
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 if (validUnit(value, FLength | FNonNeg) && (prevParamType == None || pre vParamType == Length)) { 1648 if (validUnit(value, FLength | FNonNeg) && (prevParamType == None || pre vParamType == Length)) {
1656 parsedValues->append(createPrimitiveNumericValue(value)); 1649 parsedValues->append(createPrimitiveNumericValue(value));
1657 return Length; 1650 return Length;
1658 } 1651 }
1659 return None; 1652 return None;
1660 default: 1653 default:
1661 return None; 1654 return None;
1662 } 1655 }
1663 } 1656 }
1664 1657
1665 // [ <string> <string> ]+ | none, but none is handled in parseValue
1666 PassRefPtr<CSSValue> CSSPropertyParser::parseQuotes()
1667 {
1668 RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
1669 while (CSSParserValue* val = m_valueList->current()) {
1670 RefPtr<CSSValue> parsedValue = nullptr;
1671 if (val->unit != CSSPrimitiveValue::CSS_STRING)
1672 return nullptr;
1673 parsedValue = CSSPrimitiveValue::create(val->string, CSSPrimitiveValue:: CSS_STRING);
1674 values->append(parsedValue.release());
1675 m_valueList->next();
1676 }
1677 if (values->length() && values->length() % 2 == 0)
1678 return values.release();
1679 return nullptr;
1680 }
1681
1682 PassRefPtr<CSSValue> CSSPropertyParser::parseAttr(CSSParserValueList* args) 1658 PassRefPtr<CSSValue> CSSPropertyParser::parseAttr(CSSParserValueList* args)
1683 { 1659 {
1684 if (args->size() != 1) 1660 if (args->size() != 1)
1685 return nullptr; 1661 return nullptr;
1686 1662
1687 CSSParserValue* a = args->current(); 1663 CSSParserValue* a = args->current();
1688 1664
1689 if (a->unit != CSSPrimitiveValue::CSS_IDENT) 1665 if (a->unit != CSSPrimitiveValue::CSS_IDENT)
1690 return nullptr; 1666 return nullptr;
1691 1667
(...skipping 4263 matching lines...) Expand 10 before | Expand all | Expand 10 after
5955 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 5931 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
5956 } 5932 }
5957 5933
5958 bool CSSPropertyParser::isSystemColor(int id) 5934 bool CSSPropertyParser::isSystemColor(int id)
5959 { 5935 {
5960 // FIXME(sky): remove 5936 // FIXME(sky): remove
5961 return false; 5937 return false;
5962 } 5938 }
5963 5939
5964 } // namespace blink 5940 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/parser/CSSPropertyParser.h ('k') | sky/engine/core/css/resolver/StyleBuilderConverter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698