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

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: 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::createCommaSeparat 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))
1113 return false;
1114 list->append(createPrimitiveNumericValue(value));
1115 value = m_valueList->next();
1116
1117 if (value) {
1118 if (!validUnit(value, FNumber))
1119 return false;
1120
1121 list->append(createPrimitiveNumericValue(value));
1122 value = m_valueList->next();
1123 } else {
1124 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CS S_NUMBER));
1125 }
1126
1127 } else {
1128 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX ));
1129 }
1130
1131 parsedValue = list.release();
1132 break;
1133 }
1134
1135 case CSSPropertyRotate: { // rotate : <angle> <number>{3}? defaults to a 0 0 1
1136 ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled( ));
1137 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1138 const unsigned maxAxis = 3;
1139
1140 if (!validUnit(value, FAngle))
1141 return false;
1142 list->append(createPrimitiveNumericValue(value));
1143 value = m_valueList->next();
1144
1145 if (m_valueList->size() == 1) {
1146 parsedValue = list.release();
1147 break;
1148 }
1149
1150 if (m_valueList->size() != maxAxis + 1)
1151 return false;
1152
1153 for (unsigned i = 0; i < maxAxis; i++) {
1154 if (!validUnit(value, FNumber))
1155 return false;
1156 list->append(createPrimitiveNumericValue(value));
1157 value = m_valueList->next();
1158 }
1159 parsedValue = list.release();
1160 break;
1161 }
1162
1163 case CSSPropertyScale: { // scale: <number>{1,3}, default scale for all axis is 1
1164 ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled( ));
1165 RefPtrWillBeRawPtr<CSSValueList> scaleList = CSSValueList::createCommaSe parated();
1166 const unsigned maxAxis = 3;
1167
1168 for (unsigned i = 0; i < m_valueList->size(); i++) {
1169 if (!validUnit(value, FNumber))
1170 return false;
1171 scaleList->append(createPrimitiveNumericValue(value));
1172 value = m_valueList->next();
1173 }
1174
1175 for (unsigned i = 0; i < maxAxis - m_valueList->size(); i++)
Eric Willigers 2015/06/05 01:58:22 Perhaps while (scalaList size < ...)
soonm 2015/06/10 04:09:32 Changed - minimal css properties, so there's no ne
1176 scaleList->append(cssValuePool().createValue(1, CSSPrimitiveValue::C SS_NUMBER));
1177
1178 parsedValue = scaleList.release();
1179 break;
1180 }
1181
1099 case CSSPropertyWebkitPerspectiveOriginX: 1182 case CSSPropertyWebkitPerspectiveOriginX:
1100 case CSSPropertyWebkitTransformOriginX: 1183 case CSSPropertyWebkitTransformOriginX:
1101 parsedValue = parseFillPositionX(m_valueList); 1184 parsedValue = parseFillPositionX(m_valueList);
1102 if (parsedValue) 1185 if (parsedValue)
1103 m_valueList->next(); 1186 m_valueList->next();
1104 break; 1187 break;
1105 case CSSPropertyWebkitPerspectiveOriginY: 1188 case CSSPropertyWebkitPerspectiveOriginY:
1106 case CSSPropertyWebkitTransformOriginY: 1189 case CSSPropertyWebkitTransformOriginY:
1107 parsedValue = parseFillPositionY(m_valueList); 1190 parsedValue = parseFillPositionY(m_valueList);
1108 if (parsedValue) 1191 if (parsedValue)
(...skipping 7276 matching lines...) Expand 10 before | Expand all | Expand 10 after
8385 } 8468 }
8386 } 8469 }
8387 8470
8388 if (!list->length()) 8471 if (!list->length())
8389 return nullptr; 8472 return nullptr;
8390 8473
8391 return list.release(); 8474 return list.release();
8392 } 8475 }
8393 8476
8394 } // namespace blink 8477 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698