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

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 1158603003: CSS Independent Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Correct equality operators and remove dependencies on size() in parser Created 5 years, 6 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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 if (!list) 1089 if (!list)
1090 return false; 1090 return false;
1091 // These values are added to match gecko serialization. 1091 // These values are added to match gecko serialization.
1092 if (list->length() == 1) 1092 if (list->length() == 1)
1093 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE)); 1093 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE));
1094 if (list->length() == 2) 1094 if (list->length() == 2)
1095 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX )); 1095 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX ));
1096 addProperty(propId, list.release(), important); 1096 addProperty(propId, list.release(), important);
1097 return true; 1097 return true;
1098 } 1098 }
1099
1100 case CSSPropertyTranslate: {
1101 // translate : [ <length> | <percentage> ] [[ <length> | <percentage> ] <length>? ]?
1102 // defaults to 0 on all axis, note that the last value CANNOT be a perce ntage
1103 ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled( ));
1104 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
1105 if (!validUnit(value, FLength) && !validUnit(value, FPercent)) {
1106 return false;
1107 }
1108 list->append(createPrimitiveNumericValue(value));
1109 value = m_valueList->next();
1110
1111 if (value) {
1112 if (!validUnit(value, FLength) && !validUnit(value, FPercent))
Timothy Loh 2015/06/10 04:22:29 validUnit(value, FLength | FPercent), also add tes
soonm 2015/06/11 23:31:03 Done.
1113 return false;
1114 list->append(createPrimitiveNumericValue(value));
1115 value = m_valueList->next();
1116
1117 if (value) {
1118 if (!validUnit(value, FLength))
1119 return false;
1120
1121 list->append(createPrimitiveNumericValue(value));
1122 value = m_valueList->next();
1123 }
1124 }
1125
1126 parsedValue = list.release();
1127 break;
1128 }
1129
1130 case CSSPropertyRotate: { // rotate : <angle> <number>{3}? defaults to a 0 0 1
1131 ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled( ));
1132 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
1133 const unsigned maxAxis = 3;
1134
1135 if (!validUnit(value, FAngle))
1136 return false;
1137 list->append(createPrimitiveNumericValue(value));
1138 value = m_valueList->next();
1139
1140 if (!value) {
1141 parsedValue = list.release();
1142 break;
1143 }
1144
1145 for (unsigned i = 0; i < maxAxis; i++) {
1146 if (!value || !validUnit(value, FNumber))
1147 return false;
1148 list->append(createPrimitiveNumericValue(value));
1149 value = m_valueList->next();
1150 }
1151
1152 parsedValue = list.release();
1153 if (value)
Timothy Loh 2015/06/10 04:22:29 don't need, checked outside the switch statement
soonm 2015/06/11 23:31:04 Done - Removed
1154 return false;
1155 break;
1156 }
1157
1158 case CSSPropertyScale: { // scale: <number>{1,3}, default scale for all axis is 1
1159 ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled( ));
1160 RefPtrWillBeRawPtr<CSSValueList> scaleList = CSSValueList::createSpaceSe parated();
1161 const unsigned maxAxis = 3;
1162
1163 for (unsigned i = 0; value && i < maxAxis; i++) {
1164 if (!validUnit(value, FNumber))
1165 return false;
1166 scaleList->append(createPrimitiveNumericValue(value));
1167 value = m_valueList->next();
1168 }
1169
1170 if (value)
Timothy Loh 2015/06/10 04:22:29 don't need, checked outside the switch statement
soonm 2015/06/11 23:31:04 Done - Removed
1171 return false;
1172
1173 parsedValue = scaleList.release();
1174 break;
1175 }
1176
1099 case CSSPropertyWebkitPerspectiveOriginX: 1177 case CSSPropertyWebkitPerspectiveOriginX:
1100 case CSSPropertyWebkitTransformOriginX: 1178 case CSSPropertyWebkitTransformOriginX:
1101 parsedValue = parseFillPositionX(m_valueList); 1179 parsedValue = parseFillPositionX(m_valueList);
1102 if (parsedValue) 1180 if (parsedValue)
1103 m_valueList->next(); 1181 m_valueList->next();
1104 break; 1182 break;
1105 case CSSPropertyWebkitPerspectiveOriginY: 1183 case CSSPropertyWebkitPerspectiveOriginY:
1106 case CSSPropertyWebkitTransformOriginY: 1184 case CSSPropertyWebkitTransformOriginY:
1107 parsedValue = parseFillPositionY(m_valueList); 1185 parsedValue = parseFillPositionY(m_valueList);
1108 if (parsedValue) 1186 if (parsedValue)
(...skipping 7367 matching lines...) Expand 10 before | Expand all | Expand 10 after
8476 } 8554 }
8477 } 8555 }
8478 8556
8479 if (!list->length()) 8557 if (!list->length())
8480 return nullptr; 8558 return nullptr;
8481 8559
8482 return list.release(); 8560 return list.release();
8483 } 8561 }
8484 8562
8485 } // namespace blink 8563 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698