| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 case CSSPrimitiveValue::CSS_EMS: | 58 case CSSPrimitiveValue::CSS_EMS: |
| 59 case CSSPrimitiveValue::CSS_EXS: | 59 case CSSPrimitiveValue::CSS_EXS: |
| 60 case CSSPrimitiveValue::CSS_PX: | 60 case CSSPrimitiveValue::CSS_PX: |
| 61 case CSSPrimitiveValue::CSS_CM: | 61 case CSSPrimitiveValue::CSS_CM: |
| 62 case CSSPrimitiveValue::CSS_MM: | 62 case CSSPrimitiveValue::CSS_MM: |
| 63 case CSSPrimitiveValue::CSS_IN: | 63 case CSSPrimitiveValue::CSS_IN: |
| 64 case CSSPrimitiveValue::CSS_PT: | 64 case CSSPrimitiveValue::CSS_PT: |
| 65 case CSSPrimitiveValue::CSS_PC: | 65 case CSSPrimitiveValue::CSS_PC: |
| 66 case CSSPrimitiveValue::CSS_REMS: | 66 case CSSPrimitiveValue::CSS_REMS: |
| 67 case CSSPrimitiveValue::CSS_CHS: | 67 case CSSPrimitiveValue::CSS_CHS: |
| 68 case CSSPrimitiveValue::CSS_VW: |
| 69 case CSSPrimitiveValue::CSS_VH: |
| 70 case CSSPrimitiveValue::CSS_VMIN: |
| 71 case CSSPrimitiveValue::CSS_VMAX: |
| 68 return CalcLength; | 72 return CalcLength; |
| 69 case CSSPrimitiveValue::CSS_VARIABLE_NAME: | 73 case CSSPrimitiveValue::CSS_VARIABLE_NAME: |
| 70 return CalcVariable; | 74 return CalcVariable; |
| 71 default: | 75 default: |
| 72 return CalcOther; | 76 return CalcOther; |
| 73 } | 77 } |
| 74 } | 78 } |
| 75 | 79 |
| 76 static bool hasDoubleValue(CSSPrimitiveValue::UnitTypes type) | 80 static bool hasDoubleValue(CSSPrimitiveValue::UnitTypes type) |
| 77 { | 81 { |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 return 0; | 743 return 0; |
| 740 } | 744 } |
| 741 ASSERT_NOT_REACHED(); | 745 ASSERT_NOT_REACHED(); |
| 742 return 0; | 746 return 0; |
| 743 } | 747 } |
| 744 | 748 |
| 745 PassRefPtr<CSSCalcExpressionNode> CSSCalcValue::createExpressionNode(const Lengt
h& length, float zoom) | 749 PassRefPtr<CSSCalcExpressionNode> CSSCalcValue::createExpressionNode(const Lengt
h& length, float zoom) |
| 746 { | 750 { |
| 747 switch (length.type()) { | 751 switch (length.type()) { |
| 748 case Percent: | 752 case Percent: |
| 749 case ViewportPercentageWidth: | |
| 750 case ViewportPercentageHeight: | |
| 751 case ViewportPercentageMin: | |
| 752 case ViewportPercentageMax: | |
| 753 case Fixed: | 753 case Fixed: |
| 754 return createExpressionNode(CSSPrimitiveValue::create(length, zoom), len
gth.value() == trunc(length.value())); | 754 return createExpressionNode(CSSPrimitiveValue::create(length, zoom), len
gth.value() == trunc(length.value())); |
| 755 case Calculated: | 755 case Calculated: |
| 756 return createExpressionNode(length.calculationValue()->expression(), zoo
m); | 756 return createExpressionNode(length.calculationValue()->expression(), zoo
m); |
| 757 case Auto: | 757 case Auto: |
| 758 case Intrinsic: | 758 case Intrinsic: |
| 759 case MinIntrinsic: | 759 case MinIntrinsic: |
| 760 case MinContent: | 760 case MinContent: |
| 761 case MaxContent: | 761 case MaxContent: |
| 762 case FillAvailable: | 762 case FillAvailable: |
| 763 case FitContent: | 763 case FitContent: |
| 764 case ExtendToZoom: | 764 case ExtendToZoom: |
| 765 case DeviceWidth: |
| 766 case DeviceHeight: |
| 765 case Undefined: | 767 case Undefined: |
| 766 ASSERT_NOT_REACHED(); | 768 ASSERT_NOT_REACHED(); |
| 767 return 0; | 769 return 0; |
| 768 } | 770 } |
| 769 ASSERT_NOT_REACHED(); | 771 ASSERT_NOT_REACHED(); |
| 770 return 0; | 772 return 0; |
| 771 } | 773 } |
| 772 | 774 |
| 773 PassRefPtr<CSSCalcValue> CSSCalcValue::create(CSSParserString name, CSSParserVal
ueList* parserValueList, ValueRange range) | 775 PassRefPtr<CSSCalcValue> CSSCalcValue::create(CSSParserString name, CSSParserVal
ueList* parserValueList, ValueRange range) |
| 774 { | 776 { |
| 775 CSSCalcExpressionNodeParser parser; | 777 CSSCalcExpressionNodeParser parser; |
| 776 RefPtr<CSSCalcExpressionNode> expression; | 778 RefPtr<CSSCalcExpressionNode> expression; |
| 777 | 779 |
| 778 if (equalIgnoringCase(name, "calc(") || equalIgnoringCase(name, "-webkit-cal
c(")) | 780 if (equalIgnoringCase(name, "calc(") || equalIgnoringCase(name, "-webkit-cal
c(")) |
| 779 expression = parser.parseCalc(parserValueList); | 781 expression = parser.parseCalc(parserValueList); |
| 780 // FIXME calc (http://webkit.org/b/16662) Add parsing for min and max here | 782 // FIXME calc (http://webkit.org/b/16662) Add parsing for min and max here |
| 781 | 783 |
| 782 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; | 784 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; |
| 783 } | 785 } |
| 784 | 786 |
| 785 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode>
expression, ValueRange range) | 787 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode>
expression, ValueRange range) |
| 786 { | 788 { |
| 787 return adoptRef(new CSSCalcValue(expression, range)); | 789 return adoptRef(new CSSCalcValue(expression, range)); |
| 788 } | 790 } |
| 789 | 791 |
| 790 } // namespace WebCore | 792 } // namespace WebCore |
| OLD | NEW |