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

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: Rebase master 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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 if (!list) 1086 if (!list)
1087 return false; 1087 return false;
1088 // These values are added to match gecko serialization. 1088 // These values are added to match gecko serialization.
1089 if (list->length() == 1) 1089 if (list->length() == 1)
1090 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE)); 1090 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE));
1091 if (list->length() == 2) 1091 if (list->length() == 2)
1092 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX )); 1092 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX ));
1093 addProperty(propId, list.release(), important); 1093 addProperty(propId, list.release(), important);
1094 return true; 1094 return true;
1095 } 1095 }
1096
1097 case CSSPropertyTranslate: {
1098 // translate : [ <length> | <percentage> ] [[ <length> | <percentage> ] <length>? ]?
1099 // defaults to 0 on all axis, note that the last value CANNOT be a perce ntage
1100 ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled( ));
1101 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
1102 if (!validUnit(value, FLength | FPercent))
1103 return false;
1104
1105 list->append(createPrimitiveNumericValue(value));
1106 value = m_valueList->next();
1107
1108 if (value) {
1109 if (!validUnit(value, FLength | FPercent))
1110 return false;
1111
1112 list->append(createPrimitiveNumericValue(value));
1113 value = m_valueList->next();
1114
1115 if (value) {
1116 if (!validUnit(value, FLength))
1117 return false;
1118
1119 list->append(createPrimitiveNumericValue(value));
1120 value = m_valueList->next();
1121 }
1122 }
1123
1124 parsedValue = list.release();
1125 break;
1126 }
1127
1128 case CSSPropertyRotate: { // rotate : <angle> <number>{3}? defaults to a 0 0 1
1129 ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled( ));
1130 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
1131
1132 if (!validUnit(value, FAngle))
1133 return false;
1134 list->append(createPrimitiveNumericValue(value));
1135 value = m_valueList->next();
1136
1137 if (!value) {
1138 parsedValue = list.release();
1139 break;
1140 }
1141
1142 for (unsigned i = 0; i < 3; i++) { // 3 dimensions of rotation
1143 if (!value || !validUnit(value, FNumber))
1144 return false;
1145 list->append(createPrimitiveNumericValue(value));
1146 value = m_valueList->next();
1147 }
1148
1149 parsedValue = list.release();
1150 break;
1151 }
1152
1153 case CSSPropertyScale: { // scale: <number>{1,3}, default scale for all axis is 1
1154 ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled( ));
1155 RefPtrWillBeRawPtr<CSSValueList> scaleList = CSSValueList::createSpaceSe parated();
1156
1157 for (unsigned i = 0; value && i < 3; i++) { // up to 3 dimensions of sca le
1158 if (!validUnit(value, FNumber))
1159 return false;
1160 scaleList->append(createPrimitiveNumericValue(value));
1161 value = m_valueList->next();
1162 }
1163
1164 parsedValue = scaleList.release();
1165 break;
1166 }
1167
1096 case CSSPropertyWebkitPerspectiveOriginX: 1168 case CSSPropertyWebkitPerspectiveOriginX:
1097 case CSSPropertyWebkitTransformOriginX: 1169 case CSSPropertyWebkitTransformOriginX:
1098 parsedValue = parseFillPositionX(m_valueList); 1170 parsedValue = parseFillPositionX(m_valueList);
1099 if (parsedValue) 1171 if (parsedValue)
1100 m_valueList->next(); 1172 m_valueList->next();
1101 break; 1173 break;
1102 case CSSPropertyWebkitPerspectiveOriginY: 1174 case CSSPropertyWebkitPerspectiveOriginY:
1103 case CSSPropertyWebkitTransformOriginY: 1175 case CSSPropertyWebkitTransformOriginY:
1104 parsedValue = parseFillPositionY(m_valueList); 1176 parsedValue = parseFillPositionY(m_valueList);
1105 if (parsedValue) 1177 if (parsedValue)
(...skipping 7073 matching lines...) Expand 10 before | Expand all | Expand 10 after
8179 } 8251 }
8180 } 8252 }
8181 8253
8182 if (!list->length()) 8254 if (!list->length())
8183 return nullptr; 8255 return nullptr;
8184 8256
8185 return list.release(); 8257 return list.release();
8186 } 8258 }
8187 8259
8188 } // namespace blink 8260 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/ComputedStyleCSSValueMapping.cpp ('k') | Source/core/css/resolver/StyleBuilderConverter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698