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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 1715513002: Move background related shorthands into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase test Created 4 years, 9 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) 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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 result.angle += 180; 648 result.angle += 180;
649 } else { 649 } else {
650 result.angle += primitiveValue.computeDegrees(); 650 result.angle += primitiveValue.computeDegrees();
651 } 651 }
652 } 652 }
653 653
654 return result; 654 return result;
655 } 655 }
656 656
657 template <CSSValueID cssValueFor0, CSSValueID cssValueFor100> 657 template <CSSValueID cssValueFor0, CSSValueID cssValueFor100>
658 static Length convertPositionLength(StyleResolverState& state, const CSSValue& v alue) 658 Length StyleBuilderConverter::convertPositionLength(StyleResolverState& state, c onst CSSValue& value)
659 { 659 {
660 if (value.isValuePair()) { 660 if (value.isValuePair()) {
661 const CSSValuePair& pair = toCSSValuePair(value); 661 const CSSValuePair& pair = toCSSValuePair(value);
662 Length length = StyleBuilderConverter::convertLength(state, pair.second( )); 662 Length length = StyleBuilderConverter::convertLength(state, pair.second( ));
663 if (toCSSPrimitiveValue(pair.first()).getValueID() == cssValueFor0) 663 if (toCSSPrimitiveValue(pair.first()).getValueID() == cssValueFor0)
664 return length; 664 return length;
665 ASSERT(toCSSPrimitiveValue(pair.first()).getValueID() == cssValueFor100) ; 665 ASSERT(toCSSPrimitiveValue(pair.first()).getValueID() == cssValueFor100) ;
666 return length.subtractFromOneHundredPercent(); 666 return length.subtractFromOneHundredPercent();
667 } 667 }
668 668
(...skipping 30 matching lines...) Expand all
699 699
700 float StyleBuilderConverter::convertPerspective(StyleResolverState& state, const CSSValue& value) 700 float StyleBuilderConverter::convertPerspective(StyleResolverState& state, const CSSValue& value)
701 { 701 {
702 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 702 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
703 703
704 if (primitiveValue.getValueID() == CSSValueNone) 704 if (primitiveValue.getValueID() == CSSValueNone)
705 return ComputedStyle::initialPerspective(); 705 return ComputedStyle::initialPerspective();
706 return convertPerspectiveLength(state, primitiveValue); 706 return convertPerspectiveLength(state, primitiveValue);
707 } 707 }
708 708
709 template <CSSValueID cssValueFor0, CSSValueID cssValueFor100>
710 static Length convertOriginLength(StyleResolverState& state, const CSSPrimitiveV alue& primitiveValue)
711 {
712 if (primitiveValue.isValueID()) {
713 switch (primitiveValue.getValueID()) {
714 case cssValueFor0:
715 return Length(0, Percent);
716 case cssValueFor100:
717 return Length(100, Percent);
718 case CSSValueCenter:
719 return Length(50, Percent);
720 default:
721 ASSERT_NOT_REACHED();
722 }
723 }
724
725 return StyleBuilderConverter::convertLength(state, primitiveValue);
726 }
727
728 EPaintOrder StyleBuilderConverter::convertPaintOrder(StyleResolverState&, const CSSValue& cssPaintOrder) 709 EPaintOrder StyleBuilderConverter::convertPaintOrder(StyleResolverState&, const CSSValue& cssPaintOrder)
729 { 710 {
730 if (cssPaintOrder.isValueList()) { 711 if (cssPaintOrder.isValueList()) {
731 const CSSValueList& orderTypeList = toCSSValueList(cssPaintOrder); 712 const CSSValueList& orderTypeList = toCSSValueList(cssPaintOrder);
732 switch (toCSSPrimitiveValue(orderTypeList.item(0))->getValueID()) { 713 switch (toCSSPrimitiveValue(orderTypeList.item(0))->getValueID()) {
733 case CSSValueFill: 714 case CSSValueFill:
734 return orderTypeList.length() > 1 ? PaintOrderFillMarkersStroke : Pa intOrderFillStrokeMarkers; 715 return orderTypeList.length() > 1 ? PaintOrderFillMarkersStroke : Pa intOrderFillStrokeMarkers;
735 case CSSValueStroke: 716 case CSSValueStroke:
736 return orderTypeList.length() > 1 ? PaintOrderStrokeMarkersFill : Pa intOrderStrokeFillMarkers; 717 return orderTypeList.length() > 1 ? PaintOrderStrokeMarkersFill : Pa intOrderStrokeFillMarkers;
737 case CSSValueMarkers: 718 case CSSValueMarkers:
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 TransformOrigin StyleBuilderConverter::convertTransformOrigin(StyleResolverState & state, const CSSValue& value) 856 TransformOrigin StyleBuilderConverter::convertTransformOrigin(StyleResolverState & state, const CSSValue& value)
876 { 857 {
877 const CSSValueList& list = toCSSValueList(value); 858 const CSSValueList& list = toCSSValueList(value);
878 ASSERT(list.length() == 3); 859 ASSERT(list.length() == 3);
879 860
880 const CSSPrimitiveValue& primitiveValueX = toCSSPrimitiveValue(*list.item(0) ); 861 const CSSPrimitiveValue& primitiveValueX = toCSSPrimitiveValue(*list.item(0) );
881 const CSSPrimitiveValue& primitiveValueY = toCSSPrimitiveValue(*list.item(1) ); 862 const CSSPrimitiveValue& primitiveValueY = toCSSPrimitiveValue(*list.item(1) );
882 const CSSPrimitiveValue& primitiveValueZ = toCSSPrimitiveValue(*list.item(2) ); 863 const CSSPrimitiveValue& primitiveValueZ = toCSSPrimitiveValue(*list.item(2) );
883 864
884 return TransformOrigin( 865 return TransformOrigin(
885 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) , 866 convertPositionLength<CSSValueLeft, CSSValueRight>(state, primitiveValue X),
886 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) , 867 convertPositionLength<CSSValueTop, CSSValueBottom>(state, primitiveValue Y),
887 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ) 868 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ)
888 ); 869 );
889 } 870 }
890 871
891 ScrollSnapPoints StyleBuilderConverter::convertSnapPoints(StyleResolverState& st ate, const CSSValue& value) 872 ScrollSnapPoints StyleBuilderConverter::convertSnapPoints(StyleResolverState& st ate, const CSSValue& value)
892 { 873 {
893 // Handles: none | repeat(<length>) 874 // Handles: none | repeat(<length>)
894 ScrollSnapPoints points; 875 ScrollSnapPoints points;
895 points.hasRepeat = false; 876 points.hasRepeat = false;
896 877
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 963
983 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) 964 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value)
984 { 965 {
985 if (value.isPathValue()) 966 if (value.isPathValue())
986 return convertPath(state, value); 967 return convertPath(state, value);
987 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); 968 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone);
988 return nullptr; 969 return nullptr;
989 } 970 }
990 971
991 } // namespace blink 972 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698