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 5690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5701 if (!mask) | 5701 if (!mask) |
5702 return false; | 5702 return false; |
5703 } | 5703 } |
5704 | 5704 |
5705 RefPtrWillBeRawPtr<CSSReflectValue> reflectValue = CSSReflectValue::create(d
irection.release(), offset.release(), mask.release()); | 5705 RefPtrWillBeRawPtr<CSSReflectValue> reflectValue = CSSReflectValue::create(d
irection.release(), offset.release(), mask.release()); |
5706 addProperty(propId, reflectValue.release(), important); | 5706 addProperty(propId, reflectValue.release(), important); |
5707 m_valueList->next(); | 5707 m_valueList->next(); |
5708 return true; | 5708 return true; |
5709 } | 5709 } |
5710 | 5710 |
| 5711 static bool isFlexBasisMiddleArg(double flexGrow, double flexShrink, double unse
tValue, int argSize) |
| 5712 { |
| 5713 return flexGrow != unsetValue && flexShrink == unsetValue && argSize == 3; |
| 5714 } |
| 5715 |
5711 bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important) | 5716 bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important) |
5712 { | 5717 { |
5713 if (!args || !args->size() || args->size() > 3) | 5718 if (!args || !args->size() || args->size() > 3) |
5714 return false; | 5719 return false; |
5715 static const double unsetValue = -1; | 5720 static const double unsetValue = -1; |
5716 double flexGrow = unsetValue; | 5721 double flexGrow = unsetValue; |
5717 double flexShrink = unsetValue; | 5722 double flexShrink = unsetValue; |
5718 RefPtrWillBeRawPtr<CSSPrimitiveValue> flexBasis = nullptr; | 5723 RefPtrWillBeRawPtr<CSSPrimitiveValue> flexBasis = nullptr; |
5719 | 5724 |
5720 while (CSSParserValue* arg = args->current()) { | 5725 while (CSSParserValue* arg = args->current()) { |
5721 if (validUnit(arg, FNumber | FNonNeg)) { | 5726 if (validUnit(arg, FNumber | FNonNeg)) { |
5722 if (flexGrow == unsetValue) | 5727 if (flexGrow == unsetValue) |
5723 flexGrow = arg->fValue; | 5728 flexGrow = arg->fValue; |
5724 else if (flexShrink == unsetValue) | 5729 else if (flexShrink == unsetValue) |
5725 flexShrink = arg->fValue; | 5730 flexShrink = arg->fValue; |
5726 else if (!arg->fValue) { | 5731 else if (!arg->fValue) { |
5727 // flex only allows a basis of 0 (sans units) if flex-grow and f
lex-shrink values have already been set. | 5732 // flex only allows a basis of 0 (sans units) if flex-grow and f
lex-shrink values have already been set. |
5728 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS
_PX); | 5733 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS
_PX); |
5729 } else { | 5734 } else { |
5730 // We only allow 3 numbers without units if the last value is 0.
E.g., flex:1 1 1 is invalid. | 5735 // We only allow 3 numbers without units if the last value is 0.
E.g., flex:1 1 1 is invalid. |
5731 return false; | 5736 return false; |
5732 } | 5737 } |
5733 } else if (!flexBasis && (arg->id == CSSValueAuto || validUnit(arg, FLen
gth | FPercent | FNonNeg))) | 5738 } else if (!flexBasis && (arg->id == CSSValueAuto || (validUnit(arg, FLe
ngth | FPercent | FNonNeg) && !isFlexBasisMiddleArg(flexGrow, flexShrink, unsetV
alue, args->size())))) |
5734 flexBasis = parseValidPrimitive(arg->id, arg); | 5739 flexBasis = parseValidPrimitive(arg->id, arg); |
5735 else { | 5740 else { |
5736 // Not a valid arg for flex. | 5741 // Not a valid arg for flex. |
5737 return false; | 5742 return false; |
5738 } | 5743 } |
5739 args->next(); | 5744 args->next(); |
5740 } | 5745 } |
5741 | 5746 |
5742 if (flexGrow == unsetValue) | 5747 if (flexGrow == unsetValue) |
5743 flexGrow = 1; | 5748 flexGrow = 1; |
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8497 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8502 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8498 if (!seenStroke) | 8503 if (!seenStroke) |
8499 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8504 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
8500 if (!seenMarkers) | 8505 if (!seenMarkers) |
8501 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8506 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
8502 | 8507 |
8503 return parsedValues.release(); | 8508 return parsedValues.release(); |
8504 } | 8509 } |
8505 | 8510 |
8506 } // namespace WebCore | 8511 } // namespace WebCore |
OLD | NEW |