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

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

Issue 649153002: Align -webkit-transform-origin behaviour with transform-origin behaviour (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: git cl try Created 6 years, 2 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
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 validPrimitive = true; 1104 validPrimitive = true;
1105 else { 1105 else {
1106 RefPtrWillBeRawPtr<CSSValue> transformValue = parseTransform(propId) ; 1106 RefPtrWillBeRawPtr<CSSValue> transformValue = parseTransform(propId) ;
1107 if (transformValue) { 1107 if (transformValue) {
1108 addProperty(propId, transformValue.release(), important); 1108 addProperty(propId, transformValue.release(), important);
1109 return true; 1109 return true;
1110 } 1110 }
1111 return false; 1111 return false;
1112 } 1112 }
1113 break; 1113 break;
1114 case CSSPropertyTransformOrigin: { 1114 case CSSPropertyTransformOrigin:
1115 case CSSPropertyWebkitTransformOrigin: {
1115 RefPtrWillBeRawPtr<CSSValueList> list = parseTransformOrigin(); 1116 RefPtrWillBeRawPtr<CSSValueList> list = parseTransformOrigin();
1116 if (!list) 1117 if (!list)
1117 return false; 1118 return false;
1118 // These values are added to match gecko serialization. 1119 // These values are added to match gecko serialization.
1119 if (list->length() == 1) 1120 if (list->length() == 1)
1120 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE)); 1121 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE));
1121 if (list->length() == 2) 1122 if (list->length() == 2)
1122 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX )); 1123 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX ));
1123 addProperty(propId, list.release(), important); 1124 addProperty(propId, list.release(), important);
1124 return true; 1125 return true;
1125 } 1126 }
1126 case CSSPropertyWebkitPerspectiveOriginX: 1127 case CSSPropertyWebkitPerspectiveOriginX:
1127 case CSSPropertyWebkitTransformOriginX: 1128 case CSSPropertyWebkitTransformOriginX:
1128 parsedValue = parseFillPositionX(m_valueList); 1129 parsedValue = parseFillPositionX(m_valueList);
1129 if (parsedValue) 1130 if (parsedValue)
1130 m_valueList->next(); 1131 m_valueList->next();
1131 break; 1132 break;
1132 case CSSPropertyWebkitPerspectiveOriginY: 1133 case CSSPropertyWebkitPerspectiveOriginY:
1133 case CSSPropertyWebkitTransformOriginY: 1134 case CSSPropertyWebkitTransformOriginY:
1134 parsedValue = parseFillPositionY(m_valueList); 1135 parsedValue = parseFillPositionY(m_valueList);
1135 if (parsedValue) 1136 if (parsedValue)
1136 m_valueList->next(); 1137 m_valueList->next();
1137 break; 1138 break;
1138 case CSSPropertyWebkitTransformOriginZ: 1139 case CSSPropertyWebkitTransformOriginZ:
1139 validPrimitive = validUnit(value, FLength); 1140 validPrimitive = validUnit(value, FLength);
1140 break; 1141 break;
1141 case CSSPropertyWebkitTransformOrigin:
1142 return parseWebkitTransformOriginShorthand(important);
1143 case CSSPropertyPerspective: 1142 case CSSPropertyPerspective:
1144 if (id == CSSValueNone) { 1143 if (id == CSSValueNone) {
1145 validPrimitive = true; 1144 validPrimitive = true;
1146 } else if (validUnit(value, FLength | FNonNeg)) { 1145 } else if (validUnit(value, FLength | FNonNeg)) {
1147 addProperty(propId, createPrimitiveNumericValue(value), important); 1146 addProperty(propId, createPrimitiveNumericValue(value), important);
1148 return true; 1147 return true;
1149 } 1148 }
1150 break; 1149 break;
1151 case CSSPropertyWebkitPerspective: 1150 case CSSPropertyWebkitPerspective:
1152 if (id == CSSValueNone) { 1151 if (id == CSSValueNone) {
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after
2957 ASSERT(CSSPropertyMetadata::isEnabledProperty(property)); 2956 ASSERT(CSSPropertyMetadata::isEnabledProperty(property));
2958 return cssValuePool().createIdentifierValue(property); 2957 return cssValuePool().createIdentifierValue(property);
2959 } 2958 }
2960 if (value->id == CSSValueNone) 2959 if (value->id == CSSValueNone)
2961 return cssValuePool().createIdentifierValue(CSSValueNone); 2960 return cssValuePool().createIdentifierValue(CSSValueNone);
2962 if (value->id == CSSValueInitial || value->id == CSSValueInherit) 2961 if (value->id == CSSValueInitial || value->id == CSSValueInherit)
2963 return nullptr; 2962 return nullptr;
2964 return createPrimitiveStringValue(value); 2963 return createPrimitiveStringValue(value);
2965 } 2964 }
2966 2965
2967 bool CSSPropertyParser::parseWebkitTransformOriginShorthand(bool important)
2968 {
2969 RefPtrWillBeRawPtr<CSSValue> originX = nullptr;
2970 RefPtrWillBeRawPtr<CSSValue> originY = nullptr;
2971 RefPtrWillBeRawPtr<CSSValue> originZ = nullptr;
2972
2973 parse2ValuesFillPosition(m_valueList, originX, originY);
2974
2975 if (m_valueList->current()) {
2976 if (!validUnit(m_valueList->current(), FLength))
2977 return false;
2978 originZ = createPrimitiveNumericValue(m_valueList->current());
2979 m_valueList->next();
2980 } else {
2981 originZ = cssValuePool().createImplicitInitialValue();
2982 }
2983
2984 addProperty(CSSPropertyWebkitTransformOriginX, originX.release(), important) ;
2985 addProperty(CSSPropertyWebkitTransformOriginY, originY.release(), important) ;
2986 addProperty(CSSPropertyWebkitTransformOriginZ, originZ.release(), important) ;
2987
2988 return true;
2989 }
2990
2991 bool CSSPropertyParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result) 2966 bool CSSPropertyParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result)
2992 { 2967 {
2993 CSSParserValue* v = args->current(); 2968 CSSParserValue* v = args->current();
2994 if (!validUnit(v, FNumber)) 2969 if (!validUnit(v, FNumber))
2995 return false; 2970 return false;
2996 result = v->fValue; 2971 result = v->fValue;
2997 v = args->next(); 2972 v = args->next();
2998 if (!v) 2973 if (!v)
2999 // The last number in the function has no comma after it, so we're done. 2974 // The last number in the function has no comma after it, so we're done.
3000 return true; 2975 return true;
(...skipping 5395 matching lines...) Expand 10 before | Expand all | Expand 10 after
8396 return nullptr; 8371 return nullptr;
8397 a = args->next(); 8372 a = args->next();
8398 8373
8399 argNumber++; 8374 argNumber++;
8400 } 8375 }
8401 8376
8402 return transformValue.release(); 8377 return transformValue.release();
8403 } 8378 }
8404 8379
8405 } // namespace blink 8380 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698