OLD | NEW |
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 12 matching lines...) Expand all Loading... |
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 * Boston, MA 02110-1301, USA. | 24 * Boston, MA 02110-1301, USA. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/css/parser/CSSPropertyParser.h" | 28 #include "core/css/parser/CSSPropertyParser.h" |
29 | 29 |
30 // FIXME: Way too many! | 30 // FIXME: Way too many! |
31 #include "core/CSSValueKeywords.h" | 31 #include "core/CSSValueKeywords.h" |
32 #include "core/StylePropertyShorthand.h" | 32 #include "core/StylePropertyShorthand.h" |
33 #include "core/css/CSSAspectRatioValue.h" | |
34 #include "core/css/CSSBasicShapes.h" | 33 #include "core/css/CSSBasicShapes.h" |
35 #include "core/css/CSSBorderImage.h" | 34 #include "core/css/CSSBorderImage.h" |
36 #include "core/css/CSSCanvasValue.h" | 35 #include "core/css/CSSCanvasValue.h" |
37 #include "core/css/CSSCrossfadeValue.h" | 36 #include "core/css/CSSCrossfadeValue.h" |
38 #include "core/css/CSSCursorImageValue.h" | 37 #include "core/css/CSSCursorImageValue.h" |
39 #include "core/css/CSSFontFaceSrcValue.h" | 38 #include "core/css/CSSFontFaceSrcValue.h" |
40 #include "core/css/CSSFontFeatureValue.h" | 39 #include "core/css/CSSFontFeatureValue.h" |
41 #include "core/css/CSSFunctionValue.h" | 40 #include "core/css/CSSFunctionValue.h" |
42 #include "core/css/CSSGradientValue.h" | 41 #include "core/css/CSSGradientValue.h" |
43 #include "core/css/CSSGridLineNamesValue.h" | 42 #include "core/css/CSSGridLineNamesValue.h" |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 parsedValue2 = createPrimitiveNumericValue(value); | 1000 parsedValue2 = createPrimitiveNumericValue(value); |
1002 } else | 1001 } else |
1003 parsedValue2 = parsedValue1; | 1002 parsedValue2 = parsedValue1; |
1004 | 1003 |
1005 addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), par
sedValue2.release()), important); | 1004 addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), par
sedValue2.release()), important); |
1006 return true; | 1005 return true; |
1007 } | 1006 } |
1008 case CSSPropertyTabSize: | 1007 case CSSPropertyTabSize: |
1009 validPrimitive = validUnit(value, FInteger | FNonNeg); | 1008 validPrimitive = validUnit(value, FInteger | FNonNeg); |
1010 break; | 1009 break; |
1011 case CSSPropertyWebkitAspectRatio: | |
1012 parsedValue = parseAspectRatio(); | |
1013 break; | |
1014 case CSSPropertyBorderRadius: | 1010 case CSSPropertyBorderRadius: |
1015 case CSSPropertyWebkitBorderRadius: | 1011 case CSSPropertyWebkitBorderRadius: |
1016 return parseBorderRadius(propId, important); | 1012 return parseBorderRadius(propId, important); |
1017 case CSSPropertyOutlineOffset: | 1013 case CSSPropertyOutlineOffset: |
1018 validPrimitive = validUnit(value, FLength); | 1014 validPrimitive = validUnit(value, FLength); |
1019 break; | 1015 break; |
1020 case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS
3, so treat as CSS3 | 1016 case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS
3, so treat as CSS3 |
1021 case CSSPropertyBoxShadow: | 1017 case CSSPropertyBoxShadow: |
1022 case CSSPropertyWebkitBoxShadow: | 1018 case CSSPropertyWebkitBoxShadow: |
1023 if (id == CSSValueNone) | 1019 if (id == CSSValueNone) |
(...skipping 5110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6134 completeBorderRadii(radii[1]); | 6130 completeBorderRadii(radii[1]); |
6135 | 6131 |
6136 ImplicitScope implicitScope(this); | 6132 ImplicitScope implicitScope(this); |
6137 addProperty(CSSPropertyBorderTopLeftRadius, createPrimitiveValuePair(radii[0
][0].release(), radii[1][0].release()), important); | 6133 addProperty(CSSPropertyBorderTopLeftRadius, createPrimitiveValuePair(radii[0
][0].release(), radii[1][0].release()), important); |
6138 addProperty(CSSPropertyBorderTopRightRadius, createPrimitiveValuePair(radii[
0][1].release(), radii[1][1].release()), important); | 6134 addProperty(CSSPropertyBorderTopRightRadius, createPrimitiveValuePair(radii[
0][1].release(), radii[1][1].release()), important); |
6139 addProperty(CSSPropertyBorderBottomRightRadius, createPrimitiveValuePair(rad
ii[0][2].release(), radii[1][2].release()), important); | 6135 addProperty(CSSPropertyBorderBottomRightRadius, createPrimitiveValuePair(rad
ii[0][2].release(), radii[1][2].release()), important); |
6140 addProperty(CSSPropertyBorderBottomLeftRadius, createPrimitiveValuePair(radi
i[0][3].release(), radii[1][3].release()), important); | 6136 addProperty(CSSPropertyBorderBottomLeftRadius, createPrimitiveValuePair(radi
i[0][3].release(), radii[1][3].release()), important); |
6141 return true; | 6137 return true; |
6142 } | 6138 } |
6143 | 6139 |
6144 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAspectRatio() | |
6145 { | |
6146 unsigned num = m_valueList->size(); | |
6147 if (num == 1 && m_valueList->valueAt(0)->id == CSSValueNone) { | |
6148 m_valueList->next(); | |
6149 return cssValuePool().createIdentifierValue(CSSValueNone); | |
6150 } | |
6151 | |
6152 if (num != 3) | |
6153 return nullptr; | |
6154 | |
6155 CSSParserValue* lvalue = m_valueList->current(); | |
6156 CSSParserValue* op = m_valueList->next(); | |
6157 CSSParserValue* rvalue = m_valueList->next(); | |
6158 m_valueList->next(); | |
6159 | |
6160 if (!isForwardSlashOperator(op)) | |
6161 return nullptr; | |
6162 | |
6163 if (!validUnit(lvalue, FNumber | FNonNeg) || !validUnit(rvalue, FNumber | FN
onNeg)) | |
6164 return nullptr; | |
6165 | |
6166 if (!lvalue->fValue || !rvalue->fValue) | |
6167 return nullptr; | |
6168 | |
6169 return CSSAspectRatioValue::create(narrowPrecisionToFloat(lvalue->fValue), n
arrowPrecisionToFloat(rvalue->fValue)); | |
6170 } | |
6171 | |
6172 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValu
e) | 6140 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValu
e) |
6173 { | 6141 { |
6174 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 6142 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
6175 | 6143 |
6176 while (m_valueList->current()) { | 6144 while (m_valueList->current()) { |
6177 CSSParserValue* val = m_valueList->current(); | 6145 CSSParserValue* val = m_valueList->current(); |
6178 if (val->unit != CSSPrimitiveValue::CSS_IDENT) | 6146 if (val->unit != CSSPrimitiveValue::CSS_IDENT) |
6179 return nullptr; | 6147 return nullptr; |
6180 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName = createPrimitiveStrin
gValue(val); | 6148 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName = createPrimitiveStrin
gValue(val); |
6181 m_valueList->next(); | 6149 m_valueList->next(); |
(...skipping 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8396 return nullptr; | 8364 return nullptr; |
8397 a = args->next(); | 8365 a = args->next(); |
8398 | 8366 |
8399 argNumber++; | 8367 argNumber++; |
8400 } | 8368 } |
8401 | 8369 |
8402 return transformValue.release(); | 8370 return transformValue.release(); |
8403 } | 8371 } |
8404 | 8372 |
8405 } // namespace blink | 8373 } // namespace blink |
OLD | NEW |