OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. | 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. |
3 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
4 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 4 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
5 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> | 5 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 case CSSValueHide: | 1318 case CSSValueHide: |
1319 return HIDE; | 1319 return HIDE; |
1320 default: | 1320 default: |
1321 break; | 1321 break; |
1322 } | 1322 } |
1323 | 1323 |
1324 ASSERT_NOT_REACHED(); | 1324 ASSERT_NOT_REACHED(); |
1325 return SHOW; | 1325 return SHOW; |
1326 } | 1326 } |
1327 | 1327 |
1328 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EJustifyContent e) | |
1329 : CSSValue(PrimitiveClass) | |
1330 { | |
1331 m_primitiveUnitType = CSS_VALUE_ID; | |
1332 switch (e) { | |
1333 case JustifyFlexStart: | |
1334 m_value.valueID = CSSValueFlexStart; | |
1335 break; | |
1336 case JustifyFlexEnd: | |
1337 m_value.valueID = CSSValueFlexEnd; | |
1338 break; | |
1339 case JustifyCenter: | |
1340 m_value.valueID = CSSValueCenter; | |
1341 break; | |
1342 case JustifySpaceBetween: | |
1343 m_value.valueID = CSSValueSpaceBetween; | |
1344 break; | |
1345 case JustifySpaceAround: | |
1346 m_value.valueID = CSSValueSpaceAround; | |
1347 break; | |
1348 } | |
1349 } | |
1350 | |
1351 template<> inline CSSPrimitiveValue::operator EJustifyContent() const | |
1352 { | |
1353 ASSERT(isValueID()); | |
1354 switch (m_value.valueID) { | |
1355 case CSSValueFlexStart: | |
1356 return JustifyFlexStart; | |
1357 case CSSValueFlexEnd: | |
1358 return JustifyFlexEnd; | |
1359 case CSSValueCenter: | |
1360 return JustifyCenter; | |
1361 case CSSValueSpaceBetween: | |
1362 return JustifySpaceBetween; | |
1363 case CSSValueSpaceAround: | |
1364 return JustifySpaceAround; | |
1365 default: | |
1366 break; | |
1367 } | |
1368 | |
1369 ASSERT_NOT_REACHED(); | |
1370 return JustifyFlexStart; | |
1371 } | |
1372 | |
1373 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexDirection e) | 1328 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexDirection e) |
1374 : CSSValue(PrimitiveClass) | 1329 : CSSValue(PrimitiveClass) |
1375 { | 1330 { |
1376 m_primitiveUnitType = CSS_VALUE_ID; | 1331 m_primitiveUnitType = CSS_VALUE_ID; |
1377 switch (e) { | 1332 switch (e) { |
1378 case FlowRow: | 1333 case FlowRow: |
1379 m_value.valueID = CSSValueRow; | 1334 m_value.valueID = CSSValueRow; |
1380 break; | 1335 break; |
1381 case FlowRowReverse: | 1336 case FlowRowReverse: |
1382 m_value.valueID = CSSValueRowReverse; | 1337 m_value.valueID = CSSValueRowReverse; |
(...skipping 3370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4753 return ItemPositionLeft; | 4708 return ItemPositionLeft; |
4754 case CSSValueRight: | 4709 case CSSValueRight: |
4755 return ItemPositionRight; | 4710 return ItemPositionRight; |
4756 default: | 4711 default: |
4757 break; | 4712 break; |
4758 } | 4713 } |
4759 ASSERT_NOT_REACHED(); | 4714 ASSERT_NOT_REACHED(); |
4760 return ItemPositionAuto; | 4715 return ItemPositionAuto; |
4761 } | 4716 } |
4762 | 4717 |
| 4718 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ContentPosition contentPo
sition) |
| 4719 : CSSValue(PrimitiveClass) |
| 4720 { |
| 4721 m_primitiveUnitType = CSS_VALUE_ID; |
| 4722 switch (contentPosition) { |
| 4723 case ContentPositionAuto: |
| 4724 m_value.valueID = CSSValueAuto; |
| 4725 break; |
| 4726 case ContentPositionBaseline: |
| 4727 m_value.valueID = CSSValueBaseline; |
| 4728 break; |
| 4729 case ContentPositionLastBaseline: |
| 4730 m_value.valueID = CSSValueLastBaseline; |
| 4731 break; |
| 4732 case ContentPositionCenter: |
| 4733 m_value.valueID = CSSValueCenter; |
| 4734 break; |
| 4735 case ContentPositionStart: |
| 4736 m_value.valueID = CSSValueStart; |
| 4737 break; |
| 4738 case ContentPositionEnd: |
| 4739 m_value.valueID = CSSValueEnd; |
| 4740 break; |
| 4741 case ContentPositionFlexStart: |
| 4742 m_value.valueID = CSSValueFlexStart; |
| 4743 break; |
| 4744 case ContentPositionFlexEnd: |
| 4745 m_value.valueID = CSSValueFlexEnd; |
| 4746 break; |
| 4747 case ContentPositionLeft: |
| 4748 m_value.valueID = CSSValueLeft; |
| 4749 break; |
| 4750 case ContentPositionRight: |
| 4751 m_value.valueID = CSSValueRight; |
| 4752 break; |
| 4753 } |
| 4754 } |
| 4755 |
| 4756 template<> inline CSSPrimitiveValue::operator ContentPosition() const |
| 4757 { |
| 4758 switch (m_value.valueID) { |
| 4759 case CSSValueAuto: |
| 4760 return ContentPositionAuto; |
| 4761 case CSSValueBaseline: |
| 4762 return ContentPositionBaseline; |
| 4763 case CSSValueLastBaseline: |
| 4764 return ContentPositionLastBaseline; |
| 4765 case CSSValueCenter: |
| 4766 return ContentPositionCenter; |
| 4767 case CSSValueStart: |
| 4768 return ContentPositionStart; |
| 4769 case CSSValueEnd: |
| 4770 return ContentPositionEnd; |
| 4771 case CSSValueFlexStart: |
| 4772 return ContentPositionFlexStart; |
| 4773 case CSSValueFlexEnd: |
| 4774 return ContentPositionFlexEnd; |
| 4775 case CSSValueLeft: |
| 4776 return ContentPositionLeft; |
| 4777 case CSSValueRight: |
| 4778 return ContentPositionRight; |
| 4779 default: |
| 4780 break; |
| 4781 } |
| 4782 ASSERT_NOT_REACHED(); |
| 4783 return ContentPositionAuto; |
| 4784 } |
| 4785 |
| 4786 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ContentDistributionType c
ontentDistribution) |
| 4787 : CSSValue(PrimitiveClass) |
| 4788 { |
| 4789 m_primitiveUnitType = CSS_VALUE_ID; |
| 4790 switch (contentDistribution) { |
| 4791 case ContentDistributionDefault: |
| 4792 m_value.valueID = CSSValueDefault; |
| 4793 break; |
| 4794 case ContentDistributionSpaceBetween: |
| 4795 m_value.valueID = CSSValueSpaceBetween; |
| 4796 break; |
| 4797 case ContentDistributionSpaceAround: |
| 4798 m_value.valueID = CSSValueSpaceAround; |
| 4799 break; |
| 4800 case ContentDistributionSpaceEvenly: |
| 4801 m_value.valueID = CSSValueSpaceEvenly; |
| 4802 break; |
| 4803 case ContentDistributionStretch: |
| 4804 m_value.valueID = CSSValueStretch; |
| 4805 break; |
| 4806 } |
| 4807 } |
| 4808 |
| 4809 template<> inline CSSPrimitiveValue::operator ContentDistributionType() const |
| 4810 { |
| 4811 switch (m_value.valueID) { |
| 4812 case CSSValueSpaceBetween: |
| 4813 return ContentDistributionSpaceBetween; |
| 4814 case CSSValueSpaceAround: |
| 4815 return ContentDistributionSpaceAround; |
| 4816 case CSSValueSpaceEvenly: |
| 4817 return ContentDistributionSpaceEvenly; |
| 4818 case CSSValueStretch: |
| 4819 return ContentDistributionStretch; |
| 4820 default: |
| 4821 break; |
| 4822 } |
| 4823 ASSERT_NOT_REACHED(); |
| 4824 return ContentDistributionStretch; |
| 4825 } |
| 4826 |
4763 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(OverflowAlignment overflo
wAlignment) | 4827 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(OverflowAlignment overflo
wAlignment) |
4764 : CSSValue(PrimitiveClass) | 4828 : CSSValue(PrimitiveClass) |
4765 { | 4829 { |
4766 m_primitiveUnitType = CSS_VALUE_ID; | 4830 m_primitiveUnitType = CSS_VALUE_ID; |
4767 switch (overflowAlignment) { | 4831 switch (overflowAlignment) { |
4768 case OverflowAlignmentDefault: | 4832 case OverflowAlignmentDefault: |
4769 m_value.valueID = CSSValueDefault; | 4833 m_value.valueID = CSSValueDefault; |
4770 break; | 4834 break; |
4771 case OverflowAlignmentTrue: | 4835 case OverflowAlignmentTrue: |
4772 m_value.valueID = CSSValueTrue; | 4836 m_value.valueID = CSSValueTrue; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4819 default: | 4883 default: |
4820 break; | 4884 break; |
4821 } | 4885 } |
4822 ASSERT_NOT_REACHED(); | 4886 ASSERT_NOT_REACHED(); |
4823 return ScrollBehaviorInstant; | 4887 return ScrollBehaviorInstant; |
4824 } | 4888 } |
4825 | 4889 |
4826 } | 4890 } |
4827 | 4891 |
4828 #endif | 4892 #endif |
OLD | NEW |