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

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: Remove animation from CL 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 | FPercent))
1106 return false;
1107
1108 list->append(createPrimitiveNumericValue(value));
1109 value = m_valueList->next();
1110
1111 if (value) {
1112 if (!validUnit(value, FLength | FPercent))
1113 return false;
1114
1115 list->append(createPrimitiveNumericValue(value));
1116 value = m_valueList->next();
1117
1118 if (value) {
1119 if (!validUnit(value, FLength))
1120 return false;
1121
1122 list->append(createPrimitiveNumericValue(value));
1123 value = m_valueList->next();
1124 }
1125 }
1126
1127 parsedValue = list.release();
1128 break;
1129 }
1130
1131 case CSSPropertyRotate: { // rotate : <angle> <number>{3}? defaults to a 0 0 1
1132 ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled( ));
1133 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
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 < 3; i++) { // 3 dimensions of rotation
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 break;
1154 }
1155
1156 case CSSPropertyScale: { // scale: <number>{1,3}, default scale for all axis is 1
1157 ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled( ));
1158 RefPtrWillBeRawPtr<CSSValueList> scaleList = CSSValueList::createSpaceSe parated();
1159
1160 for (unsigned i = 0; value && i < 3; i++) { // up to 3 dimensions of sca le
1161 if (!validUnit(value, FNumber))
1162 return false;
1163 scaleList->append(createPrimitiveNumericValue(value));
1164 value = m_valueList->next();
1165 }
1166
1167 parsedValue = scaleList.release();
1168 break;
1169 }
1170
1099 case CSSPropertyWebkitPerspectiveOriginX: 1171 case CSSPropertyWebkitPerspectiveOriginX:
1100 case CSSPropertyWebkitTransformOriginX: 1172 case CSSPropertyWebkitTransformOriginX:
1101 parsedValue = parseFillPositionX(m_valueList); 1173 parsedValue = parseFillPositionX(m_valueList);
1102 if (parsedValue) 1174 if (parsedValue)
1103 m_valueList->next(); 1175 m_valueList->next();
1104 break; 1176 break;
1105 case CSSPropertyWebkitPerspectiveOriginY: 1177 case CSSPropertyWebkitPerspectiveOriginY:
1106 case CSSPropertyWebkitTransformOriginY: 1178 case CSSPropertyWebkitTransformOriginY:
1107 parsedValue = parseFillPositionY(m_valueList); 1179 parsedValue = parseFillPositionY(m_valueList);
1108 if (parsedValue) 1180 if (parsedValue)
(...skipping 7393 matching lines...) Expand 10 before | Expand all | Expand 10 after
8502 } 8574 }
8503 } 8575 }
8504 8576
8505 if (!list->length()) 8577 if (!list->length())
8506 return nullptr; 8578 return nullptr;
8507 8579
8508 return list.release(); 8580 return list.release();
8509 } 8581 }
8510 8582
8511 } // namespace blink 8583 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698