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

Side by Side Diff: Source/core/css/CSSParser-in.cpp

Issue 20262002: [css3-text] Implement text-decoration property shorthand (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Julien's 2nd round review fixes Created 7 years, 4 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 | Annotate | Revision Log
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 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 validPrimitive = true; 2111 validPrimitive = true;
2112 break; 2112 break;
2113 case CSSPropertyFontFamily: 2113 case CSSPropertyFontFamily:
2114 // [[ <family-name> | <generic-family> ],]* [<family-name> | <generic-fa mily>] | inherit 2114 // [[ <family-name> | <generic-family> ],]* [<family-name> | <generic-fa mily>] | inherit
2115 { 2115 {
2116 parsedValue = parseFontFamily(); 2116 parsedValue = parseFontFamily();
2117 break; 2117 break;
2118 } 2118 }
2119 2119
2120 case CSSPropertyTextDecoration: 2120 case CSSPropertyTextDecoration:
2121 // Fall through to CSS2.1 implementation if runtime feature is disabled.
Julien - ping for review 2013/07/30 22:37:22 This comment could be improved if you explained wh
abinader 2013/07/31 21:24:03 Ack! Sounds better indeed.
2122 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) {
2123 // [ <text-decoration-line> || <text-decoration-style> || <text-deco ration-color> ] | inherit
2124 return parseShorthand(CSSPropertyTextDecoration, textDecorationShort hand(), important);
2125 }
2121 case CSSPropertyWebkitTextDecorationsInEffect: 2126 case CSSPropertyWebkitTextDecorationsInEffect:
2122 case CSSPropertyTextDecorationLine: 2127 case CSSPropertyTextDecorationLine:
2123 // none | [ underline || overline || line-through || blink ] | inherit 2128 // none | [ underline || overline || line-through || blink ] | inherit
2124 return parseTextDecoration(propId, important); 2129 return parseTextDecoration(propId, important);
2125 2130
2126 case CSSPropertyTextDecorationStyle: 2131 case CSSPropertyTextDecorationStyle:
2127 // solid | double | dotted | dashed | wavy 2132 // solid | double | dotted | dashed | wavy
2128 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled() 2133 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()
2129 && (id == CSSValueSolid || id == CSSValueDouble || id == CSSValueDot ted || id == CSSValueDashed || id == CSSValueWavy)) 2134 && (id == CSSValueSolid || id == CSSValueDouble || id == CSSValueDot ted || id == CSSValueDashed || id == CSSValueWavy))
2130 validPrimitive = true; 2135 validPrimitive = true;
(...skipping 6747 matching lines...) Expand 10 before | Expand all | Expand 10 after
8878 list->append(cssValuePool().createIdentifierValue(value->id)); 8883 list->append(cssValuePool().createIdentifierValue(value->id));
8879 break; 8884 break;
8880 default: 8885 default:
8881 isValid = false; 8886 isValid = false;
8882 break; 8887 break;
8883 } 8888 }
8884 if (isValid) 8889 if (isValid)
8885 value = m_valueList->next(); 8890 value = m_valueList->next();
8886 } 8891 }
8887 8892
8888 if (list->length() && isValid) { 8893 // Values are either valid or in shorthand scope.
8894 if (list->length() && (isValid || inShorthand())) {
8889 addTextDecorationProperty(propId, list.release(), important); 8895 addTextDecorationProperty(propId, list.release(), important);
8890 return true; 8896 return true;
8891 } 8897 }
8892 8898
8893 return false; 8899 return false;
8894 } 8900 }
8895 8901
8896 #if ENABLE(CSS3_TEXT) 8902 #if ENABLE(CSS3_TEXT)
8897 bool CSSParser::parseTextUnderlinePosition(bool important) 8903 bool CSSParser::parseTextUnderlinePosition(bool important)
8898 { 8904 {
(...skipping 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after
11745 { 11751 {
11746 // The tokenizer checks for the construct of an+b. 11752 // The tokenizer checks for the construct of an+b.
11747 // However, since the {ident} rule precedes the {nth} rule, some of those 11753 // However, since the {ident} rule precedes the {nth} rule, some of those
11748 // tokens are identified as string literal. Furthermore we need to accept 11754 // tokens are identified as string literal. Furthermore we need to accept
11749 // "odd" and "even" which does not match to an+b. 11755 // "odd" and "even" which does not match to an+b.
11750 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 11756 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
11751 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 11757 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
11752 } 11758 }
11753 11759
11754 } 11760 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698