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

Side by Side Diff: Source/WebCore/css/CSSParser.cpp

Issue 13674002: Support intrinsic values for height, min-height and max-height (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: CSS table tests Created 7 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
« no previous file with comments | « Source/WebCore/css/CSSParser.h ('k') | Source/WebCore/css/StyleBuilder.cpp » ('j') | 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 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 { 1687 {
1688 return value && value->unit == CSSParserValue::Operator && value->iValue == ','; 1688 return value && value->unit == CSSParserValue::Operator && value->iValue == ',';
1689 } 1689 }
1690 1690
1691 static inline bool isForwardSlashOperator(CSSParserValue* value) 1691 static inline bool isForwardSlashOperator(CSSParserValue* value)
1692 { 1692 {
1693 ASSERT(value); 1693 ASSERT(value);
1694 return value->unit == CSSParserValue::Operator && value->iValue == '/'; 1694 return value->unit == CSSParserValue::Operator && value->iValue == '/';
1695 } 1695 }
1696 1696
1697 bool CSSParser::validWidth(CSSParserValue* value) 1697 bool CSSParser::validWidthOrHeight(CSSParserValue* value)
1698 { 1698 {
1699 int id = value->id; 1699 int id = value->id;
1700 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueW ebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAva ilable || id == CSSValueWebkitFitContent) 1700 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueW ebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAva ilable || id == CSSValueWebkitFitContent)
1701 return true; 1701 return true;
1702 return !id && validUnit(value, FLength | FPercent | FNonNeg); 1702 return !id && validUnit(value, FLength | FPercent | FNonNeg);
1703 } 1703 }
1704 1704
1705 // FIXME: Combine this with validWidth when we support fit-content, et al, for h eights.
1706 bool CSSParser::validHeight(CSSParserValue* value)
1707 {
1708 int id = value->id;
1709 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic)
1710 return true;
1711 return !id && validUnit(value, FLength | FPercent | FNonNeg);
1712 }
1713
1714 inline PassRefPtr<CSSPrimitiveValue> CSSParser::parseValidPrimitive(int identifi er, CSSParserValue* value) 1705 inline PassRefPtr<CSSPrimitiveValue> CSSParser::parseValidPrimitive(int identifi er, CSSParserValue* value)
1715 { 1706 {
1716 if (identifier) 1707 if (identifier)
1717 return cssValuePool().createIdentifierValue(identifier); 1708 return cssValuePool().createIdentifierValue(identifier);
1718 if (value->unit == CSSPrimitiveValue::CSS_STRING) 1709 if (value->unit == CSSPrimitiveValue::CSS_STRING)
1719 return createPrimitiveStringValue(value); 1710 return createPrimitiveStringValue(value);
1720 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit iveValue::CSS_KHZ) 1711 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit iveValue::CSS_KHZ)
1721 return createPrimitiveNumericValue(value); 1712 return createPrimitiveNumericValue(value);
1722 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv eValue::CSS_CHS) 1713 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv eValue::CSS_CHS)
1723 return createPrimitiveNumericValue(value); 1714 return createPrimitiveNumericValue(value);
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 case CSSPropertyPaddingLeft: //// 2121 case CSSPropertyPaddingLeft: ////
2131 case CSSPropertyWebkitPaddingStart: 2122 case CSSPropertyWebkitPaddingStart:
2132 case CSSPropertyWebkitPaddingEnd: 2123 case CSSPropertyWebkitPaddingEnd:
2133 case CSSPropertyWebkitPaddingBefore: 2124 case CSSPropertyWebkitPaddingBefore:
2134 case CSSPropertyWebkitPaddingAfter: 2125 case CSSPropertyWebkitPaddingAfter:
2135 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg)) ; 2126 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg)) ;
2136 break; 2127 break;
2137 2128
2138 case CSSPropertyMaxWidth: 2129 case CSSPropertyMaxWidth:
2139 case CSSPropertyWebkitMaxLogicalWidth: 2130 case CSSPropertyWebkitMaxLogicalWidth:
2140 validPrimitive = (id == CSSValueNone || validWidth(value)); 2131 case CSSPropertyMaxHeight:
2132 case CSSPropertyWebkitMaxLogicalHeight:
2133 validPrimitive = (id == CSSValueNone || validWidthOrHeight(value));
2141 break; 2134 break;
2142 2135
2143 case CSSPropertyMinWidth: 2136 case CSSPropertyMinWidth:
2144 case CSSPropertyWebkitMinLogicalWidth: 2137 case CSSPropertyWebkitMinLogicalWidth:
2145 validPrimitive = validWidth(value); 2138 case CSSPropertyMinHeight:
2139 case CSSPropertyWebkitMinLogicalHeight:
2140 validPrimitive = validWidthOrHeight(value);
2146 break; 2141 break;
2147 2142
2148 case CSSPropertyWidth: 2143 case CSSPropertyWidth:
2149 case CSSPropertyWebkitLogicalWidth: 2144 case CSSPropertyWebkitLogicalWidth:
2150 validPrimitive = (id == CSSValueAuto || validWidth(value));
2151 break;
2152
2153 case CSSPropertyMaxHeight:
2154 case CSSPropertyWebkitMaxLogicalHeight:
2155 validPrimitive = (id == CSSValueNone || validHeight(value));
2156 break;
2157
2158 case CSSPropertyMinHeight:
2159 case CSSPropertyWebkitMinLogicalHeight:
2160 validPrimitive = validHeight(value);
2161 break;
2162
2163 case CSSPropertyHeight: 2145 case CSSPropertyHeight:
2164 case CSSPropertyWebkitLogicalHeight: 2146 case CSSPropertyWebkitLogicalHeight:
2165 validPrimitive = (id == CSSValueAuto || validHeight(value)); 2147 validPrimitive = (id == CSSValueAuto || validWidthOrHeight(value));
2166 break; 2148 break;
2167 2149
2168 case CSSPropertyFontSize: 2150 case CSSPropertyFontSize:
2169 return parseFontSize(important); 2151 return parseFontSize(important);
2170 2152
2171 case CSSPropertyFontVariant: // normal | small-caps | inherit 2153 case CSSPropertyFontVariant: // normal | small-caps | inherit
2172 return parseFontVariant(important); 2154 return parseFontVariant(important);
2173 2155
2174 case CSSPropertyVerticalAlign: 2156 case CSSPropertyVerticalAlign:
2175 // baseline | sub | super | top | text-top | middle | bottom | text-bott om | 2157 // baseline | sub | super | top | text-top | middle | bottom | text-bott om |
(...skipping 9565 matching lines...) Expand 10 before | Expand all | Expand 10 after
11741 { 11723 {
11742 // The tokenizer checks for the construct of an+b. 11724 // The tokenizer checks for the construct of an+b.
11743 // However, since the {ident} rule precedes the {nth} rule, some of those 11725 // However, since the {ident} rule precedes the {nth} rule, some of those
11744 // tokens are identified as string literal. Furthermore we need to accept 11726 // tokens are identified as string literal. Furthermore we need to accept
11745 // "odd" and "even" which does not match to an+b. 11727 // "odd" and "even" which does not match to an+b.
11746 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 11728 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
11747 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 11729 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
11748 } 11730 }
11749 11731
11750 } 11732 }
OLDNEW
« no previous file with comments | « Source/WebCore/css/CSSParser.h ('k') | Source/WebCore/css/StyleBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698