Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h

Issue 2932593004: Update the snap points css properties (Closed)
Patch Set: Rebase and Add QuadLengthValue.h Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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. 4 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
5 * (http://www.torchmobile.com/) 5 * (http://www.torchmobile.com/)
6 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> 6 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
(...skipping 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 case CSSValueSmooth: 2650 case CSSValueSmooth:
2651 return kScrollBehaviorSmooth; 2651 return kScrollBehaviorSmooth;
2652 default: 2652 default:
2653 break; 2653 break;
2654 } 2654 }
2655 NOTREACHED(); 2655 NOTREACHED();
2656 return kScrollBehaviorAuto; 2656 return kScrollBehaviorAuto;
2657 } 2657 }
2658 2658
2659 template <> 2659 template <>
2660 inline CSSIdentifierValue::CSSIdentifierValue(ScrollSnapType snap_type) 2660 inline CSSIdentifierValue::CSSIdentifierValue(SnapAxis axis)
2661 : CSSValue(kIdentifierClass) { 2661 : CSSValue(kIdentifierClass) {
2662 switch (snap_type) { 2662 switch (axis) {
2663 case kScrollSnapTypeNone: 2663 case kSnapAxisX:
2664 value_id_ = CSSValueNone; 2664 value_id_ = CSSValueX;
2665 break; 2665 break;
2666 case kScrollSnapTypeMandatory: 2666 case kSnapAxisY:
2667 value_id_ = CSSValueMandatory; 2667 value_id_ = CSSValueY;
2668 break; 2668 break;
2669 case kScrollSnapTypeProximity: 2669 case kSnapAxisBlock:
2670 value_id_ = CSSValueProximity; 2670 value_id_ = CSSValueBlock;
2671 break;
2672 case kSnapAxisInline:
2673 value_id_ = CSSValueInline;
2674 break;
2675 case kSnapAxisBoth:
2676 value_id_ = CSSValueBoth;
2671 break; 2677 break;
2672 } 2678 }
2673 } 2679 }
2674 2680
2675 template <> 2681 template <>
2676 inline ScrollSnapType CSSIdentifierValue::ConvertTo() const { 2682 inline SnapAxis CSSIdentifierValue::ConvertTo() const {
2677 switch (GetValueID()) { 2683 switch (GetValueID()) {
2678 case CSSValueNone: 2684 case CSSValueX:
2679 return kScrollSnapTypeNone; 2685 return kSnapAxisX;
2680 case CSSValueMandatory: 2686 case CSSValueY:
2681 return kScrollSnapTypeMandatory; 2687 return kSnapAxisY;
2682 case CSSValueProximity: 2688 case CSSValueBlock:
2683 return kScrollSnapTypeProximity; 2689 return kSnapAxisBlock;
2690 case CSSValueInline:
2691 return kSnapAxisInline;
2692 case CSSValueBoth:
2693 return kSnapAxisBoth;
2684 default: 2694 default:
2685 break; 2695 break;
2686 } 2696 }
2687 NOTREACHED(); 2697 NOTREACHED();
2688 return kScrollSnapTypeNone; 2698 return kSnapAxisBoth;
2689 } 2699 }
2690 2700
2691 template <> 2701 template <>
2702 inline CSSIdentifierValue::CSSIdentifierValue(SnapStrictness strictness)
2703 : CSSValue(kIdentifierClass) {
2704 switch (strictness) {
2705 case kSnapStrictnessProximity:
2706 value_id_ = CSSValueProximity;
2707 break;
2708 case kSnapStrictnessMandatory:
2709 value_id_ = CSSValueMandatory;
2710 break;
2711 }
2712 }
2713
2714 template <>
2715 inline SnapStrictness CSSIdentifierValue::ConvertTo() const {
2716 switch (GetValueID()) {
2717 case CSSValueProximity:
2718 return kSnapStrictnessProximity;
2719 case CSSValueMandatory:
2720 return kSnapStrictnessMandatory;
2721 default:
2722 break;
2723 }
2724 NOTREACHED();
2725 return kSnapStrictnessProximity;
2726 }
2727
2728 template <>
2729 inline CSSIdentifierValue::CSSIdentifierValue(SnapAlignment alignment)
2730 : CSSValue(kIdentifierClass) {
2731 switch (alignment) {
2732 case kSnapAlignmentNone:
2733 value_id_ = CSSValueNone;
2734 break;
2735 case kSnapAlignmentStart:
2736 value_id_ = CSSValueStart;
2737 break;
2738 case kSnapAlignmentEnd:
2739 value_id_ = CSSValueEnd;
2740 break;
2741 case kSnapAlignmentCenter:
2742 value_id_ = CSSValueCenter;
2743 break;
2744 }
2745 }
2746
2747 template <>
2748 inline SnapAlignment CSSIdentifierValue::ConvertTo() const {
2749 switch (GetValueID()) {
2750 case CSSValueNone:
2751 return kSnapAlignmentNone;
2752 case CSSValueStart:
2753 return kSnapAlignmentStart;
2754 case CSSValueEnd:
2755 return kSnapAlignmentEnd;
2756 case CSSValueCenter:
2757 return kSnapAlignmentCenter;
2758 default:
2759 break;
2760 }
2761 NOTREACHED();
2762 return kSnapAlignmentNone;
2763 }
2764
2765 template <>
2692 inline CSSIdentifierValue::CSSIdentifierValue(Containment snap_type) 2766 inline CSSIdentifierValue::CSSIdentifierValue(Containment snap_type)
2693 : CSSValue(kIdentifierClass) { 2767 : CSSValue(kIdentifierClass) {
2694 switch (snap_type) { 2768 switch (snap_type) {
2695 case kContainsNone: 2769 case kContainsNone:
2696 value_id_ = CSSValueNone; 2770 value_id_ = CSSValueNone;
2697 break; 2771 break;
2698 case kContainsStrict: 2772 case kContainsStrict:
2699 value_id_ = CSSValueStrict; 2773 value_id_ = CSSValueStrict;
2700 break; 2774 break;
2701 case kContainsContent: 2775 case kContainsContent:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 default: 2810 default:
2737 break; 2811 break;
2738 } 2812 }
2739 NOTREACHED(); 2813 NOTREACHED();
2740 return kContainsNone; 2814 return kContainsNone;
2741 } 2815 }
2742 2816
2743 } // namespace blink 2817 } // namespace blink
2744 2818
2745 #endif 2819 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698