| 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 return 0; | 739 return 0; |
| 736 } | 740 } |
| 737 ASSERT_NOT_REACHED(); | 741 ASSERT_NOT_REACHED(); |
| 738 return 0; | 742 return 0; |
| 739 } | 743 } |
| 740 | 744 |
| 741 PassRefPtr<CSSCalcExpressionNode> CSSCalcValue::createExpressionNode(const Lengt
h& length, float zoom) | 745 PassRefPtr<CSSCalcExpressionNode> CSSCalcValue::createExpressionNode(const Lengt
h& length, float zoom) |
| 742 { | 746 { |
| 743 switch (length.type()) { | 747 switch (length.type()) { |
| 744 case Percent: | 748 case Percent: |
| 745 case ViewportPercentageWidth: | |
| 746 case ViewportPercentageHeight: | |
| 747 case ViewportPercentageMin: | |
| 748 case ViewportPercentageMax: | |
| 749 case Fixed: | 749 case Fixed: |
| 750 return createExpressionNode(CSSPrimitiveValue::create(length, zoom), len
gth.value() == trunc(length.value())); | 750 return createExpressionNode(CSSPrimitiveValue::create(length, zoom), len
gth.value() == trunc(length.value())); |
| 751 case Calculated: | 751 case Calculated: |
| 752 return createExpressionNode(length.calculationValue()->expression(), zoo
m); | 752 return createExpressionNode(length.calculationValue()->expression(), zoo
m); |
| 753 case Auto: | 753 case Auto: |
| 754 case Intrinsic: | 754 case Intrinsic: |
| 755 case MinIntrinsic: | 755 case MinIntrinsic: |
| 756 case MinContent: | 756 case MinContent: |
| 757 case MaxContent: | 757 case MaxContent: |
| 758 case FillAvailable: | 758 case FillAvailable: |
| 759 case FitContent: | 759 case FitContent: |
| 760 case ExtendToZoom: | 760 case ExtendToZoom: |
| 761 case DeviceWidth: |
| 762 case DeviceHeight: |
| 761 case Undefined: | 763 case Undefined: |
| 762 ASSERT_NOT_REACHED(); | 764 ASSERT_NOT_REACHED(); |
| 763 return 0; | 765 return 0; |
| 764 } | 766 } |
| 765 ASSERT_NOT_REACHED(); | 767 ASSERT_NOT_REACHED(); |
| 766 return 0; | 768 return 0; |
| 767 } | 769 } |
| 768 | 770 |
| 769 PassRefPtr<CSSCalcValue> CSSCalcValue::create(CSSParserString name, CSSParserVal
ueList* parserValueList, ValueRange range) | 771 PassRefPtr<CSSCalcValue> CSSCalcValue::create(CSSParserString name, CSSParserVal
ueList* parserValueList, ValueRange range) |
| 770 { | 772 { |
| 771 CSSCalcExpressionNodeParser parser; | 773 CSSCalcExpressionNodeParser parser; |
| 772 RefPtr<CSSCalcExpressionNode> expression; | 774 RefPtr<CSSCalcExpressionNode> expression; |
| 773 | 775 |
| 774 if (equalIgnoringCase(name, "calc(") || equalIgnoringCase(name, "-webkit-cal
c(")) | 776 if (equalIgnoringCase(name, "calc(") || equalIgnoringCase(name, "-webkit-cal
c(")) |
| 775 expression = parser.parseCalc(parserValueList); | 777 expression = parser.parseCalc(parserValueList); |
| 776 // FIXME calc (http://webkit.org/b/16662) Add parsing for min and max here | 778 // FIXME calc (http://webkit.org/b/16662) Add parsing for min and max here |
| 777 | 779 |
| 778 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; | 780 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; |
| 779 } | 781 } |
| 780 | 782 |
| 781 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode>
expression, ValueRange range) | 783 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode>
expression, ValueRange range) |
| 782 { | 784 { |
| 783 return adoptRef(new CSSCalcValue(expression, range)); | 785 return adoptRef(new CSSCalcValue(expression, range)); |
| 784 } | 786 } |
| 785 | 787 |
| 786 } // namespace WebCore | 788 } // namespace WebCore |
| OLD | NEW |