OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * * Redistributions of source code must retain the above copyright | 4 * * Redistributions of source code must retain the above copyright |
5 * notice, this list of conditions and the following disclaimer. | 5 * notice, this list of conditions and the following disclaimer. |
6 * * Redistributions in binary form must reproduce the above | 6 * * Redistributions in binary form must reproduce the above |
7 * copyright notice, this list of conditions and the following disclaimer | 7 * copyright notice, this list of conditions and the following disclaimer |
8 * in the documentation and/or other materials provided with the | 8 * in the documentation and/or other materials provided with the |
9 * distribution. | 9 * distribution. |
10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 589 |
590 // CSSPropertyWebkitPerspective accepts unitless numbers. | 590 // CSSPropertyWebkitPerspective accepts unitless numbers. |
591 if (primitiveValue->isNumber()) { | 591 if (primitiveValue->isNumber()) { |
592 RefPtr<CSSPrimitiveValue> px = CSSPrimitiveValue::create(primitiveValue-
>getDoubleValue(), CSSPrimitiveValue::CSS_PX); | 592 RefPtr<CSSPrimitiveValue> px = CSSPrimitiveValue::create(primitiveValue-
>getDoubleValue(), CSSPrimitiveValue::CSS_PX); |
593 return convertPerspectiveLength(state, px.get()); | 593 return convertPerspectiveLength(state, px.get()); |
594 } | 594 } |
595 | 595 |
596 return convertPerspectiveLength(state, primitiveValue); | 596 return convertPerspectiveLength(state, primitiveValue); |
597 } | 597 } |
598 | 598 |
| 599 template <CSSValueID cssValueFor0, CSSValueID cssValueFor100> |
| 600 static Length convertOriginLength(StyleResolverState& state, CSSPrimitiveValue*
primitiveValue) |
| 601 { |
| 602 if (primitiveValue->isValueID()) { |
| 603 switch (primitiveValue->getValueID()) { |
| 604 case cssValueFor0: |
| 605 return Length(0, Percent); |
| 606 case cssValueFor100: |
| 607 return Length(100, Percent); |
| 608 case CSSValueCenter: |
| 609 return Length(50, Percent); |
| 610 default: |
| 611 ASSERT_NOT_REACHED(); |
| 612 } |
| 613 } |
| 614 |
| 615 return StyleBuilderConverter::convertLength(state, primitiveValue); |
| 616 } |
| 617 |
| 618 LengthPoint StyleBuilderConverter::convertPerspectiveOrigin(StyleResolverState&
state, CSSValue* value) |
| 619 { |
| 620 CSSValueList* list = toCSSValueList(value); |
| 621 ASSERT(list->length() == 2); |
| 622 |
| 623 CSSPrimitiveValue* primitiveValueX = toCSSPrimitiveValue(list->item(0)); |
| 624 CSSPrimitiveValue* primitiveValueY = toCSSPrimitiveValue(list->item(1)); |
| 625 |
| 626 return LengthPoint( |
| 627 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX)
, |
| 628 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) |
| 629 ); |
| 630 } |
| 631 |
599 EPaintOrder StyleBuilderConverter::convertPaintOrder(StyleResolverState&, CSSVal
ue* cssPaintOrder) | 632 EPaintOrder StyleBuilderConverter::convertPaintOrder(StyleResolverState&, CSSVal
ue* cssPaintOrder) |
600 { | 633 { |
601 if (cssPaintOrder->isValueList()) { | 634 if (cssPaintOrder->isValueList()) { |
602 int paintOrder = 0; | 635 int paintOrder = 0; |
603 const CSSValueList& list = *toCSSValueList(cssPaintOrder); | 636 const CSSValueList& list = *toCSSValueList(cssPaintOrder); |
604 for (size_t i = 0; i < list.length(); ++i) { | 637 for (size_t i = 0; i < list.length(); ++i) { |
605 EPaintOrderType paintOrderType = PT_NONE; | 638 EPaintOrderType paintOrderType = PT_NONE; |
606 switch (toCSSPrimitiveValue(list.item(i))->getValueID()) { | 639 switch (toCSSPrimitiveValue(list.item(i))->getValueID()) { |
607 case CSSValueFill: | 640 case CSSValueFill: |
608 paintOrderType = PT_FILL; | 641 paintOrderType = PT_FILL; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 { | 774 { |
742 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 775 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
743 if (primitiveValue->getValueID()) { | 776 if (primitiveValue->getValueID()) { |
744 float multiplier = convertLineWidth<float>(state, value); | 777 float multiplier = convertLineWidth<float>(state, value); |
745 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS
_EMS)->computeLength<float>(state.cssToLengthConversionData()); | 778 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS
_EMS)->computeLength<float>(state.cssToLengthConversionData()); |
746 } | 779 } |
747 return primitiveValue->computeLength<float>(state.cssToLengthConversionData(
)); | 780 return primitiveValue->computeLength<float>(state.cssToLengthConversionData(
)); |
748 } | 781 } |
749 | 782 |
750 } // namespace blink | 783 } // namespace blink |
OLD | NEW |