OLD | NEW |
---|---|
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 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1144 if (!list) | 1144 if (!list) |
1145 return false; | 1145 return false; |
1146 // These values are added to match gecko serialization. | 1146 // These values are added to match gecko serialization. |
1147 if (list->length() == 1) | 1147 if (list->length() == 1) |
1148 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE)); | 1148 list->append(cssValuePool().createValue(50, CSSPrimitiveValue::CSS_P ERCENTAGE)); |
1149 if (list->length() == 2) | 1149 if (list->length() == 2) |
1150 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX )); | 1150 list->append(cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX )); |
1151 addProperty(propId, list.release(), important); | 1151 addProperty(propId, list.release(), important); |
1152 return true; | 1152 return true; |
1153 } | 1153 } |
1154 case CSSPropertyWebkitTransformOriginX: | |
1155 parsedValue = parseFillPositionX(m_valueList.get()); | |
1156 if (parsedValue) | |
1157 m_valueList->next(); | |
1158 break; | |
1159 case CSSPropertyWebkitTransformOriginY: | |
1160 parsedValue = parseFillPositionY(m_valueList.get()); | |
1161 if (parsedValue) | |
1162 m_valueList->next(); | |
1163 break; | |
1164 case CSSPropertyWebkitTransformOriginZ: | |
1165 validPrimitive = validUnit(value, FLength); | |
1166 break; | |
1154 case CSSPropertyWebkitTransformOrigin: | 1167 case CSSPropertyWebkitTransformOrigin: |
1155 case CSSPropertyWebkitTransformOriginX: | 1168 return parseWebkitTransformOriginShorthand(important); |
1156 case CSSPropertyWebkitTransformOriginY: | |
1157 case CSSPropertyWebkitTransformOriginZ: { | |
1158 RefPtrWillBeRawPtr<CSSValue> val1 = nullptr; | |
1159 RefPtrWillBeRawPtr<CSSValue> val2 = nullptr; | |
1160 RefPtrWillBeRawPtr<CSSValue> val3 = nullptr; | |
1161 CSSPropertyID propId1, propId2, propId3; | |
1162 if (parseWebkitTransformOrigin(propId, propId1, propId2, propId3, val1, val2, val3)) { | |
1163 addProperty(propId1, val1.release(), important); | |
1164 if (val2) | |
1165 addProperty(propId2, val2.release(), important); | |
1166 if (val3) | |
1167 addProperty(propId3, val3.release(), important); | |
1168 return true; | |
1169 } | |
1170 return false; | |
1171 } | |
1172 case CSSPropertyPerspective: | 1169 case CSSPropertyPerspective: |
1173 if (id == CSSValueNone) { | 1170 if (id == CSSValueNone) { |
1174 validPrimitive = true; | 1171 validPrimitive = true; |
1175 } else if (validUnit(value, FLength | FNonNeg)) { | 1172 } else if (validUnit(value, FLength | FNonNeg)) { |
1176 addProperty(propId, createPrimitiveNumericValue(value), important); | 1173 addProperty(propId, createPrimitiveNumericValue(value), important); |
1177 return true; | 1174 return true; |
1178 } | 1175 } |
1179 break; | 1176 break; |
1180 case CSSPropertyWebkitPerspective: | 1177 case CSSPropertyWebkitPerspective: |
1181 if (id == CSSValueNone) { | 1178 if (id == CSSValueNone) { |
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3127 CSSPropertyID result = cssPropertyID(value->string); | 3124 CSSPropertyID result = cssPropertyID(value->string); |
3128 if (result && RuntimeCSSEnabled::isCSSPropertyEnabled(result)) | 3125 if (result && RuntimeCSSEnabled::isCSSPropertyEnabled(result)) |
3129 return cssValuePool().createIdentifierValue(result); | 3126 return cssValuePool().createIdentifierValue(result); |
3130 if (equalIgnoringCase(value, "none")) | 3127 if (equalIgnoringCase(value, "none")) |
3131 return cssValuePool().createIdentifierValue(CSSValueNone); | 3128 return cssValuePool().createIdentifierValue(CSSValueNone); |
3132 if (equalIgnoringCase(value, "inherit") || equalIgnoringCase(value, "initial ")) | 3129 if (equalIgnoringCase(value, "inherit") || equalIgnoringCase(value, "initial ")) |
3133 return nullptr; | 3130 return nullptr; |
3134 return createPrimitiveStringValue(value); | 3131 return createPrimitiveStringValue(value); |
3135 } | 3132 } |
3136 | 3133 |
3137 bool CSSPropertyParser::parseWebkitTransformOriginShorthand(RefPtrWillBeRawPtr<C SSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSVa lue>& value3) | 3134 bool CSSPropertyParser::parseWebkitTransformOriginShorthand(bool important) |
3138 { | 3135 { |
3139 parse2ValuesFillPosition(m_valueList.get(), value1, value2); | 3136 RefPtrWillBeRawPtr<CSSValue> originX; |
3137 RefPtrWillBeRawPtr<CSSValue> originY; | |
3138 parse2ValuesFillPosition(m_valueList.get(), originX, originY); | |
3140 | 3139 |
3141 // now get z | 3140 if (m_valueList->current() && !validUnit(m_valueList->current(), FLength)) |
3141 return false; | |
alancutter (OOO until 2018)
2014/08/15 01:00:03
This can be merged into the if block below.
Timothy Loh
2014/08/15 01:03:18
Not sure what you mean here, the "if (m_valueList-
Timothy Loh
2014/08/15 01:11:41
err yeah I can move adding properties lower, will
Timothy Loh
2014/08/15 01:26:41
Done.
| |
3142 | |
3143 addProperty(CSSPropertyWebkitTransformOriginX, originX.release(), important) ; | |
3144 addProperty(CSSPropertyWebkitTransformOriginY, originY.release(), important) ; | |
3145 | |
3146 RefPtrWillBeRawPtr<CSSValue> originZ; | |
3142 if (m_valueList->current()) { | 3147 if (m_valueList->current()) { |
3143 if (validUnit(m_valueList->current(), FLength)) { | 3148 originZ = createPrimitiveNumericValue(m_valueList->current()); |
3144 value3 = createPrimitiveNumericValue(m_valueList->current()); | 3149 m_valueList->next(); |
3145 m_valueList->next(); | 3150 } else { |
3146 return true; | 3151 originZ = cssValuePool().createImplicitInitialValue(); |
3147 } | |
3148 return false; | |
3149 } | 3152 } |
3150 value3 = cssValuePool().createImplicitInitialValue(); | 3153 addProperty(CSSPropertyWebkitTransformOriginZ, originZ.release(), important) ; |
3154 | |
3151 return true; | 3155 return true; |
3152 } | 3156 } |
3153 | 3157 |
3154 bool CSSPropertyParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result) | 3158 bool CSSPropertyParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result) |
3155 { | 3159 { |
3156 CSSParserValue* v = args->current(); | 3160 CSSParserValue* v = args->current(); |
3157 if (!validUnit(v, FNumber)) | 3161 if (!validUnit(v, FNumber)) |
3158 return false; | 3162 return false; |
3159 result = v->fValue; | 3163 result = v->fValue; |
3160 v = args->next(); | 3164 v = args->next(); |
(...skipping 4394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7555 | 7559 |
7556 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; | 7560 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; |
7557 list->append(xValue.release()); | 7561 list->append(xValue.release()); |
7558 if (yValue) | 7562 if (yValue) |
7559 list->append(yValue.release()); | 7563 list->append(yValue.release()); |
7560 if (zValue) | 7564 if (zValue) |
7561 list->append(zValue.release()); | 7565 list->append(zValue.release()); |
7562 return list.release(); | 7566 return list.release(); |
7563 } | 7567 } |
7564 | 7568 |
7565 bool CSSPropertyParser::parseWebkitTransformOrigin(CSSPropertyID propId, CSSProp ertyID& propId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtrWillBeRaw Ptr<CSSValue>& value, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<C SSValue>& value3) | |
7566 { | |
7567 propId1 = propId; | |
7568 propId2 = propId; | |
7569 propId3 = propId; | |
7570 if (propId == CSSPropertyWebkitTransformOrigin) { | |
7571 propId1 = CSSPropertyWebkitTransformOriginX; | |
7572 propId2 = CSSPropertyWebkitTransformOriginY; | |
7573 propId3 = CSSPropertyWebkitTransformOriginZ; | |
7574 } | |
7575 | |
7576 switch (propId) { | |
7577 case CSSPropertyWebkitTransformOrigin: | |
7578 if (!parseWebkitTransformOriginShorthand(value, value2, value3)) | |
7579 return false; | |
7580 // parseWebkitTransformOriginShorthand advances the m_valueList poin ter | |
7581 break; | |
7582 case CSSPropertyWebkitTransformOriginX: { | |
7583 value = parseFillPositionX(m_valueList.get()); | |
7584 if (value) | |
7585 m_valueList->next(); | |
7586 break; | |
7587 } | |
7588 case CSSPropertyWebkitTransformOriginY: { | |
7589 value = parseFillPositionY(m_valueList.get()); | |
7590 if (value) | |
7591 m_valueList->next(); | |
7592 break; | |
7593 } | |
7594 case CSSPropertyWebkitTransformOriginZ: { | |
7595 if (validUnit(m_valueList->current(), FLength)) | |
7596 value = createPrimitiveNumericValue(m_valueList->current()); | |
7597 if (value) | |
7598 m_valueList->next(); | |
7599 break; | |
7600 } | |
7601 default: | |
7602 ASSERT_NOT_REACHED(); | |
7603 return false; | |
7604 } | |
7605 | |
7606 return value; | |
7607 } | |
7608 | |
7609 bool CSSPropertyParser::parseWebkitPerspectiveOrigin(CSSPropertyID propId, CSSPr opertyID& propId1, CSSPropertyID& propId2, RefPtrWillBeRawPtr<CSSValue>& value, RefPtrWillBeRawPtr<CSSValue>& value2) | 7569 bool CSSPropertyParser::parseWebkitPerspectiveOrigin(CSSPropertyID propId, CSSPr opertyID& propId1, CSSPropertyID& propId2, RefPtrWillBeRawPtr<CSSValue>& value, RefPtrWillBeRawPtr<CSSValue>& value2) |
7610 { | 7570 { |
7611 propId1 = propId; | 7571 propId1 = propId; |
7612 propId2 = propId; | 7572 propId2 = propId; |
7613 if (propId == CSSPropertyWebkitPerspectiveOrigin) { | 7573 if (propId == CSSPropertyWebkitPerspectiveOrigin) { |
7614 propId1 = CSSPropertyWebkitPerspectiveOriginX; | 7574 propId1 = CSSPropertyWebkitPerspectiveOriginX; |
7615 propId2 = CSSPropertyWebkitPerspectiveOriginY; | 7575 propId2 = CSSPropertyWebkitPerspectiveOriginY; |
7616 } | 7576 } |
7617 | 7577 |
7618 switch (propId) { | 7578 switch (propId) { |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8533 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8493 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8534 if (!seenStroke) | 8494 if (!seenStroke) |
8535 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); | 8495 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); |
8536 if (!seenMarkers) | 8496 if (!seenMarkers) |
8537 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); | 8497 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); |
8538 | 8498 |
8539 return parsedValues.release(); | 8499 return parsedValues.release(); |
8540 } | 8500 } |
8541 | 8501 |
8542 } // namespace blink | 8502 } // namespace blink |
OLD | NEW |