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

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

Issue 2932593004: Update the snap points css properties (Closed)
Patch Set: Fix nits 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 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 case CSSValueSmooth: 2576 case CSSValueSmooth:
2577 return kScrollBehaviorSmooth; 2577 return kScrollBehaviorSmooth;
2578 default: 2578 default:
2579 break; 2579 break;
2580 } 2580 }
2581 NOTREACHED(); 2581 NOTREACHED();
2582 return kScrollBehaviorAuto; 2582 return kScrollBehaviorAuto;
2583 } 2583 }
2584 2584
2585 template <> 2585 template <>
2586 inline CSSIdentifierValue::CSSIdentifierValue(ScrollSnapType snap_type) 2586 inline CSSIdentifierValue::CSSIdentifierValue(SnapAxis axis)
2587 : CSSValue(kIdentifierClass) { 2587 : CSSValue(kIdentifierClass) {
2588 switch (snap_type) { 2588 switch (axis) {
2589 case kScrollSnapTypeNone: 2589 case kSnapAxisX:
2590 value_id_ = CSSValueNone; 2590 value_id_ = CSSValueX;
2591 break; 2591 break;
2592 case kScrollSnapTypeMandatory: 2592 case kSnapAxisY:
2593 value_id_ = CSSValueMandatory; 2593 value_id_ = CSSValueY;
2594 break; 2594 break;
2595 case kScrollSnapTypeProximity: 2595 case kSnapAxisBlock:
2596 value_id_ = CSSValueProximity; 2596 value_id_ = CSSValueBlock;
2597 break;
2598 case kSnapAxisInline:
2599 value_id_ = CSSValueInline;
2600 break;
2601 case kSnapAxisBoth:
2602 value_id_ = CSSValueBoth;
2597 break; 2603 break;
2598 } 2604 }
2599 } 2605 }
2600 2606
2601 template <> 2607 template <>
2602 inline ScrollSnapType CSSIdentifierValue::ConvertTo() const { 2608 inline SnapAxis CSSIdentifierValue::ConvertTo() const {
2603 switch (GetValueID()) { 2609 switch (GetValueID()) {
2604 case CSSValueNone: 2610 case CSSValueX:
2605 return kScrollSnapTypeNone; 2611 return kSnapAxisX;
2606 case CSSValueMandatory: 2612 case CSSValueY:
2607 return kScrollSnapTypeMandatory; 2613 return kSnapAxisY;
2608 case CSSValueProximity: 2614 case CSSValueBlock:
2609 return kScrollSnapTypeProximity; 2615 return kSnapAxisBlock;
2616 case CSSValueInline:
2617 return kSnapAxisInline;
2618 case CSSValueBoth:
2619 return kSnapAxisBoth;
2610 default: 2620 default:
2611 break; 2621 break;
2612 } 2622 }
2613 NOTREACHED(); 2623 NOTREACHED();
2614 return kScrollSnapTypeNone; 2624 return kSnapAxisBoth;
2615 } 2625 }
2616 2626
2617 template <> 2627 template <>
2628 inline CSSIdentifierValue::CSSIdentifierValue(SnapStrictness strictness)
2629 : CSSValue(kIdentifierClass) {
2630 switch (strictness) {
2631 case kSnapStrictnessProximity:
2632 value_id_ = CSSValueProximity;
2633 break;
2634 case kSnapStrictnessMandatory:
2635 value_id_ = CSSValueMandatory;
2636 break;
2637 }
2638 }
2639
2640 template <>
2641 inline SnapStrictness CSSIdentifierValue::ConvertTo() const {
2642 switch (GetValueID()) {
2643 case CSSValueProximity:
2644 return kSnapStrictnessProximity;
2645 case CSSValueMandatory:
2646 return kSnapStrictnessMandatory;
2647 default:
2648 break;
2649 }
2650 NOTREACHED();
2651 return kSnapStrictnessProximity;
2652 }
2653
2654 template <>
2655 inline CSSIdentifierValue::CSSIdentifierValue(SnapAlignment alignment)
2656 : CSSValue(kIdentifierClass) {
2657 switch (alignment) {
2658 case kSnapAlignmentNone:
2659 value_id_ = CSSValueNone;
2660 break;
2661 case kSnapAlignmentStart:
2662 value_id_ = CSSValueStart;
2663 break;
2664 case kSnapAlignmentEnd:
2665 value_id_ = CSSValueEnd;
2666 break;
2667 case kSnapAlignmentCenter:
2668 value_id_ = CSSValueCenter;
2669 break;
2670 }
2671 }
2672
2673 template <>
2674 inline SnapAlignment CSSIdentifierValue::ConvertTo() const {
2675 switch (GetValueID()) {
2676 case CSSValueNone:
2677 return kSnapAlignmentNone;
2678 case CSSValueStart:
2679 return kSnapAlignmentStart;
2680 case CSSValueEnd:
2681 return kSnapAlignmentEnd;
2682 case CSSValueCenter:
2683 return kSnapAlignmentCenter;
2684 default:
2685 break;
2686 }
2687 NOTREACHED();
2688 return kSnapAlignmentNone;
2689 }
2690
2691 template <>
2618 inline CSSIdentifierValue::CSSIdentifierValue(Containment snap_type) 2692 inline CSSIdentifierValue::CSSIdentifierValue(Containment snap_type)
2619 : CSSValue(kIdentifierClass) { 2693 : CSSValue(kIdentifierClass) {
2620 switch (snap_type) { 2694 switch (snap_type) {
2621 case kContainsNone: 2695 case kContainsNone:
2622 value_id_ = CSSValueNone; 2696 value_id_ = CSSValueNone;
2623 break; 2697 break;
2624 case kContainsStrict: 2698 case kContainsStrict:
2625 value_id_ = CSSValueStrict; 2699 value_id_ = CSSValueStrict;
2626 break; 2700 break;
2627 case kContainsContent: 2701 case kContainsContent:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 default: 2736 default:
2663 break; 2737 break;
2664 } 2738 }
2665 NOTREACHED(); 2739 NOTREACHED();
2666 return kContainsNone; 2740 return kContainsNone;
2667 } 2741 }
2668 2742
2669 } // namespace blink 2743 } // namespace blink
2670 2744
2671 #endif 2745 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698