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

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

Issue 1078883003: remove 'page' and 'size' since those are for printing, and that's obsolete in our world now (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: merge with trunk 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 if (m_valueList->next() && !inShorthand()) 441 if (m_valueList->next() && !inShorthand())
442 return false; 442 return false;
443 addProperty(propId, cssValuePool().createIdentifierValue(id)); 443 addProperty(propId, cssValuePool().createIdentifierValue(id));
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] ]
452 return parseSize(propId);
453 451
454 case CSSPropertyClip: // <shape> | auto | inherit 452 case CSSPropertyClip: // <shape> | auto | inherit
455 if (id == CSSValueAuto) 453 if (id == CSSValueAuto)
456 validPrimitive = true; 454 validPrimitive = true;
457 else if (value->unit == CSSParserValue::Function) 455 else if (value->unit == CSSParserValue::Function)
458 return parseClipShape(propId); 456 return parseClipShape(propId);
459 break; 457 break;
460 458
461 /* Start of supported CSS properties with validation. This is needed for par seShorthand to work 459 /* Start of supported CSS properties with validation. This is needed for par seShorthand to work
462 * correctly and allows optimization in blink::applyRule(..) 460 * correctly and allows optimization in blink::applyRule(..)
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 // 'font-family' ] | inherit 1066 // 'font-family' ] | inherit
1069 return parseFont(); 1067 return parseFont();
1070 case CSSPropertyWebkitTextStroke: 1068 case CSSPropertyWebkitTextStroke:
1071 return parseShorthand(propId, webkitTextStrokeShorthand()); 1069 return parseShorthand(propId, webkitTextStrokeShorthand());
1072 case CSSPropertyAnimation: 1070 case CSSPropertyAnimation:
1073 return parseAnimationShorthand(propId); 1071 return parseAnimationShorthand(propId);
1074 case CSSPropertyTransition: 1072 case CSSPropertyTransition:
1075 return parseTransitionShorthand(propId); 1073 return parseTransitionShorthand(propId);
1076 case CSSPropertyInvalid: 1074 case CSSPropertyInvalid:
1077 return false; 1075 return false;
1078 case CSSPropertyPage:
1079 return parsePage(propId);
1080 // CSS Text Layout Module Level 3: Vertical writing support 1076 // CSS Text Layout Module Level 3: Vertical writing support
1081 case CSSPropertyWebkitTextEmphasis: 1077 case CSSPropertyWebkitTextEmphasis:
1082 return parseShorthand(propId, webkitTextEmphasisShorthand()); 1078 return parseShorthand(propId, webkitTextEmphasisShorthand());
1083 1079
1084 case CSSPropertyWebkitTextEmphasisStyle: 1080 case CSSPropertyWebkitTextEmphasisStyle:
1085 return parseTextEmphasisStyle(); 1081 return parseTextEmphasisStyle();
1086 1082
1087 case CSSPropertyWebkitTextOrientation: 1083 case CSSPropertyWebkitTextOrientation:
1088 // FIXME: For now just support sideways, sideways-right, upright and ver tical-right. 1084 // FIXME: For now just support sideways, sideways-right, upright and ver tical-right.
1089 if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSVa lueVerticalRight || id == CSSValueUpright) 1085 if (id == CSSValueSideways || id == CSSValueSidewaysRight || id == CSSVa lueVerticalRight || id == CSSValueUpright)
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 break; 1542 break;
1547 } 1543 }
1548 default: { 1544 default: {
1549 return false; 1545 return false;
1550 } 1546 }
1551 } 1547 }
1552 1548
1553 return true; 1549 return true;
1554 } 1550 }
1555 1551
1556 // auto | <identifier>
1557 bool CSSPropertyParser::parsePage(CSSPropertyID propId)
1558 {
1559 ASSERT(propId == CSSPropertyPage);
1560
1561 if (m_valueList->size() != 1)
1562 return false;
1563
1564 CSSParserValue* value = m_valueList->current();
1565 if (!value)
1566 return false;
1567
1568 if (value->id == CSSValueAuto) {
1569 addProperty(propId, cssValuePool().createIdentifierValue(value->id));
1570 return true;
1571 } else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) {
1572 addProperty(propId, createPrimitiveStringValue(value));
1573 return true;
1574 }
1575 return false;
1576 }
1577
1578 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
1579 bool CSSPropertyParser::parseSize(CSSPropertyID propId)
1580 {
1581 ASSERT(propId == CSSPropertySize);
1582
1583 if (m_valueList->size() > 2)
1584 return false;
1585
1586 CSSParserValue* value = m_valueList->current();
1587 if (!value)
1588 return false;
1589
1590 RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
1591
1592 // First parameter.
1593 SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value, None);
1594 if (paramType == None)
1595 return false;
1596
1597 // Second parameter, if any.
1598 value = m_valueList->next();
1599 if (value) {
1600 paramType = parseSizeParameter(parsedValues.get(), value, paramType);
1601 if (paramType == None)
1602 return false;
1603 }
1604
1605 addProperty(propId, parsedValues.release());
1606 return true;
1607 }
1608
1609 CSSPropertyParser::SizeParameterType CSSPropertyParser::parseSizeParameter(CSSVa lueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType)
1610 {
1611 switch (value->id) {
1612 case CSSValueAuto:
1613 if (prevParamType == None) {
1614 parsedValues->append(cssValuePool().createIdentifierValue(value->id) );
1615 return Auto;
1616 }
1617 return None;
1618 case CSSValueLandscape:
1619 case CSSValuePortrait:
1620 if (prevParamType == None || prevParamType == PageSize) {
1621 parsedValues->append(cssValuePool().createIdentifierValue(value->id) );
1622 return Orientation;
1623 }
1624 return None;
1625 case CSSValueA3:
1626 case CSSValueA4:
1627 case CSSValueA5:
1628 case CSSValueB4:
1629 case CSSValueB5:
1630 case CSSValueLedger:
1631 case CSSValueLegal:
1632 case CSSValueLetter:
1633 if (prevParamType == None || prevParamType == Orientation) {
1634 // Normalize to Page Size then Orientation order by prepending.
1635 // This is not specified by the CSS3 Paged Media specification, but for simpler processing later (StyleResolver::applyPageSizeProperty).
1636 parsedValues->prepend(cssValuePool().createIdentifierValue(value->id ));
1637 return PageSize;
1638 }
1639 return None;
1640 case 0:
1641 if (validUnit(value, FLength | FNonNeg) && (prevParamType == None || pre vParamType == Length)) {
1642 parsedValues->append(createPrimitiveNumericValue(value));
1643 return Length;
1644 }
1645 return None;
1646 default:
1647 return None;
1648 }
1649 }
1650
1651 PassRefPtr<CSSValue> CSSPropertyParser::parseAttr(CSSParserValueList* args) 1552 PassRefPtr<CSSValue> CSSPropertyParser::parseAttr(CSSParserValueList* args)
1652 { 1553 {
1653 if (args->size() != 1) 1554 if (args->size() != 1)
1654 return nullptr; 1555 return nullptr;
1655 1556
1656 CSSParserValue* a = args->current(); 1557 CSSParserValue* a = args->current();
1657 1558
1658 if (a->unit != CSSPrimitiveValue::CSS_IDENT) 1559 if (a->unit != CSSPrimitiveValue::CSS_IDENT)
1659 return nullptr; 1560 return nullptr;
1660 1561
(...skipping 4263 matching lines...) Expand 10 before | Expand all | Expand 10 after
5924 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 5825 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
5925 } 5826 }
5926 5827
5927 bool CSSPropertyParser::isSystemColor(int id) 5828 bool CSSPropertyParser::isSystemColor(int id)
5928 { 5829 {
5929 // FIXME(sky): remove 5830 // FIXME(sky): remove
5930 return false; 5831 return false;
5931 } 5832 }
5932 5833
5933 } // namespace blink 5834 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/parser/CSSPropertyParser.h ('k') | sky/engine/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698