Changeset 206713 in webkit
- Timestamp:
- Oct 1, 2016 6:05:14 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r206712 r206713 1 2016-10-01 Simon Fraser <simon.fraser@apple.com> 2 3 Support transitions/animations of background-position with right/bottom-relative values 4 https://bugs.webkit.org/show_bug.cgi?id=162048 5 6 Reviewed by Dean Jackson. 7 8 * transitions/background-position-transitions-expected.txt: Added. 9 * transitions/background-position-transitions.html: Added. 10 * transitions/resources/transition-test-helpers.js: 11 * transitions/svg-transitions-expected.txt: 12 1 13 2016-10-01 Simon Fraser <simon.fraser@apple.com> 2 14 -
trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation-expected.txt
r167132 r206713 23 23 PASS - "webkitShapeOutside" property for "circle-to-bottomright-using-keyword-box" element at 1s saw something close to: circle(35% at 75% 75%) 24 24 PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-box" element at 1s saw something close to: circle(35% at 75% 75%) 25 PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-box" element at 1s saw something close to: circle(35% at calc((50% * 0.5) + ((100% - 10%) * 0.5))calc((50% * 0.5) + ((100% - 20px) * 0.5)))26 PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-2-box" element at 1s saw something close to: circle(35% at calc((50% * 0.5) + ((100% - 10%) * 0.5))calc((50% * 0.5) + ((100% - 10px) * 0.5)))25 PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-box" element at 1s saw something close to: circle(35% at 70% calc((50% * 0.5) + ((100% - 20px) * 0.5))) 26 PASS - "webkitShapeOutside" property for "circle-to-bottomright-extended-using-keyword-2-box" element at 1s saw something close to: circle(35% at 70% calc((50% * 0.5) + ((100% - 10px) * 0.5))) 27 27 -
trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-animation.html
r167132 r206713 147 147 ["circle-to-bottomright-using-keyword-anim", 1, "circle-to-bottomright-using-keyword-box", "webkitShapeOutside", "circle(35% at 75% 75%)", 0.05], 148 148 ["circle-to-bottomright-extended-anim", 1, "circle-to-bottomright-extended-box", "webkitShapeOutside", "circle(35% at 75% 75%)", 0.05], 149 ["circle-to-bottomright-extended-using-keyword-anim", 1, "circle-to-bottomright-extended-using-keyword-box", "webkitShapeOutside", "circle(35% at calc((50% * 0.5) + ((100% - 10%) * 0.5))calc((50% * 0.5) + ((100% - 20px) * 0.5)))", 0.01],150 ["circle-to-bottomright-extended-using-keyword-2-anim", 1, "circle-to-bottomright-extended-using-keyword-2-box", "webkitShapeOutside", "circle(35% at calc((50% * 0.5) + ((100% - 10%) * 0.5))calc((50% * 0.5) + ((100% - 10px) * 0.5)))", 0.01],149 ["circle-to-bottomright-extended-using-keyword-anim", 1, "circle-to-bottomright-extended-using-keyword-box", "webkitShapeOutside", "circle(35% at 70% calc((50% * 0.5) + ((100% - 20px) * 0.5)))", 0.01], 150 ["circle-to-bottomright-extended-using-keyword-2-anim", 1, "circle-to-bottomright-extended-using-keyword-2-box", "webkitShapeOutside", "circle(35% at 70% calc((50% * 0.5) + ((100% - 10px) * 0.5)))", 0.01], 151 151 ]; 152 152 -
trunk/LayoutTests/transitions/resources/transition-test-helpers.js
r200888 r206713 109 109 window.console.log('failed to match ' + s); 110 110 return null; 111 } 112 113 function hasFloatValue(value) 114 { 115 switch (value.primitiveType) { 116 case CSSPrimitiveValue.CSS_FR: 117 case CSSPrimitiveValue.CSS_NUMBER: 118 case CSSPrimitiveValue.CSS_PARSER_INTEGER: 119 case CSSPrimitiveValue.CSS_PERCENTAGE: 120 case CSSPrimitiveValue.CSS_EMS: 121 case CSSPrimitiveValue.CSS_EXS: 122 case CSSPrimitiveValue.CSS_CHS: 123 case CSSPrimitiveValue.CSS_REMS: 124 case CSSPrimitiveValue.CSS_PX: 125 case CSSPrimitiveValue.CSS_CM: 126 case CSSPrimitiveValue.CSS_MM: 127 case CSSPrimitiveValue.CSS_IN: 128 case CSSPrimitiveValue.CSS_PT: 129 case CSSPrimitiveValue.CSS_PC: 130 case CSSPrimitiveValue.CSS_DEG: 131 case CSSPrimitiveValue.CSS_RAD: 132 case CSSPrimitiveValue.CSS_GRAD: 133 case CSSPrimitiveValue.CSS_TURN: 134 case CSSPrimitiveValue.CSS_MS: 135 case CSSPrimitiveValue.CSS_S: 136 case CSSPrimitiveValue.CSS_HZ: 137 case CSSPrimitiveValue.CSS_KHZ: 138 case CSSPrimitiveValue.CSS_DIMENSION: 139 case CSSPrimitiveValue.CSS_VW: 140 case CSSPrimitiveValue.CSS_VH: 141 case CSSPrimitiveValue.CSS_VMIN: 142 case CSSPrimitiveValue.CSS_VMAX: 143 case CSSPrimitiveValue.CSS_DPPX: 144 case CSSPrimitiveValue.CSS_DPI: 145 case CSSPrimitiveValue.CSS_DPCM: 146 return true; 147 } 148 return false; 149 } 150 151 function getNumericValue(cssValue) 152 { 153 if (hasFloatValue(cssValue.primitiveType)) 154 return cssValue.getFloatValue(cssValue.primitiveType); 155 156 return -1; 157 } 158 159 function isCalcPrimitiveValue(value) 160 { 161 switch (value.primitiveType) { 162 case 113: // CSSPrimitiveValue.CSS_CALC: 163 case 114: // CSSPrimitiveValue.CSS_CALC_PERCENTAGE_WITH_NUMBER: 164 case 115: // CSSPrimitiveValue.CSS_CALC_PERCENTAGE_WITH_LENGTH: 165 return true; 166 } 167 return false; 168 } 169 170 function extractNumbersFromCalcExpression(value, values) 171 { 172 var calcRegexp = /^calc\((.+)\)$/; 173 var result = calcRegexp.exec(value.cssText); 174 var numberMatch = /([^\.\-0-9]*)(-?[\.0-9]+)/; 175 var remainder = result[1]; 176 var match; 177 while ((match = numberMatch.exec(remainder)) !== null) { 178 var skipLength = match[1].length + match[2].length; 179 values.push(parseFloat(match[2])) 180 remainder = remainder.substr(skipLength + 1); 181 } 111 182 } 112 183 … … 195 266 var values = []; 196 267 for (var i = 0; i < computedStyle.length; ++i) { 197 switch (computedStyle[i].cssValueType) { 268 var styleValue = computedStyle[i]; 269 switch (styleValue.cssValueType) { 198 270 case CSSValue.CSS_PRIMITIVE_VALUE: 199 values.push(computedStyle[i].getFloatValue(CSSPrimitiveValue.CSS_NUMBER)); 271 if (hasFloatValue(styleValue)) 272 values.push(styleValue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)); 273 else if (isCalcPrimitiveValue(styleValue)) 274 extractNumbersFromCalcExpression(styleValue, values); 200 275 break; 201 276 case CSSValue.CSS_CUSTOM: 202 277 // arbitrarily pick shadow-x and shadow-y 203 278 if (isShadow) { 204 var shadowXY = getShadowXY( computedStyle[i]);279 var shadowXY = getShadowXY(styleValue); 205 280 values.push(shadowXY[0]); 206 281 values.push(shadowXY[1]); 207 282 } else 208 values.push( computedStyle[i].cssText);283 values.push(styleValue.cssText); 209 284 break; 210 285 } 211 286 } 212 287 computedValue = values.join(','); 213 pass = true;288 pass = values.length > 0; 214 289 for (var i = 0; i < values.length; ++i) 215 290 pass &= isCloseEnough(values[i], expectedValue[i], tolerance); -
trunk/LayoutTests/transitions/svg-transitions-expected.txt
r191551 r206713 1 CONSOLE MESSAGE: line 293: Failed to pause 'fill' transition on element 'rect7'1 CONSOLE MESSAGE: line 368: Failed to pause 'fill' transition on element 'rect7' 2 2 Example 3 3 PASS - "fill-opacity" property for "rect1" element at 1s saw something close to: 0.6 -
trunk/Source/WebCore/ChangeLog
r206712 r206713 1 2016-10-01 Simon Fraser <simon.fraser@apple.com> 2 3 Support transitions/animations of background-position with right/bottom-relative values 4 https://bugs.webkit.org/show_bug.cgi?id=162048 5 6 Reviewed by Dean Jackson. 7 8 Make transitions between "background-position: 10px 20px" and "background-position: right 10px bottom 20px" 9 work. We do this by by converting "right 10px" to "calc(100% - 10px)" when blending. 10 11 Also improve logging of calculated lengths, and better animation logging for FillLayer properties. 12 13 Test: transitions/background-position-transitions.html 14 15 * page/animation/CSSPropertyAnimation.cpp: 16 (WebCore::FillLayerAnimationPropertyWrapperBase::FillLayerAnimationPropertyWrapperBase): Keep the propertyID 17 around so logging can use it. 18 (WebCore::FillLayerAnimationPropertyWrapperBase::property): 19 (WebCore::FillLayerPropertyWrapperGetter::FillLayerPropertyWrapperGetter): 20 (WebCore::FillLayerPropertyWrapperGetter::value): 21 (WebCore::FillLayerPropertyWrapper::FillLayerPropertyWrapper): 22 (WebCore::createCalculatedLength): 23 (WebCore::FillLayerPositionPropertyWrapper::FillLayerPositionPropertyWrapper): 24 (WebCore::FillLayerRefCountedPropertyWrapper::FillLayerRefCountedPropertyWrapper): 25 (WebCore::FillLayerStyleImagePropertyWrapper::FillLayerStyleImagePropertyWrapper): 26 (WebCore::FillLayersPropertyWrapper::FillLayersPropertyWrapper): 27 (WebCore::CSSPropertyAnimation::blendProperties): Blend then log, so that the logging 28 can show the result. 29 * platform/CalculationValue.cpp: 30 (WebCore::CalcExpressionNumber::dump): 31 (WebCore::CalcExpressionBinaryOperation::dump): 32 (WebCore::CalcExpressionLength::dump): 33 (WebCore::CalcExpressionBlendLength::dump): 34 (WebCore::operator<<): 35 * platform/CalculationValue.h: 36 * platform/Length.cpp: 37 (WebCore::operator<<): 38 1 39 2016-10-01 Simon Fraser <simon.fraser@apple.com> 2 40 -
trunk/Source/WebCore/css/StyleBuilderConverter.h
r206679 r206713 158 158 #endif 159 159 160 static Length convertTo100PercentMinusLength(const Length&);161 160 static Length convertPositionComponent(StyleResolver&, const CSSPrimitiveValue&); 162 161 … … 310 309 311 310 return LengthSize(radiusWidth, radiusHeight); 312 }313 314 inline Length StyleBuilderConverter::convertTo100PercentMinusLength(const Length& length)315 {316 if (length.isPercent())317 return Length(100 - length.value(), Percent);318 319 // Turn this into a calc expression: calc(100% - length)320 auto lhs = std::make_unique<CalcExpressionLength>(Length(100, Percent));321 auto rhs = std::make_unique<CalcExpressionLength>(length);322 auto op = std::make_unique<CalcExpressionBinaryOperation>(WTFMove(lhs), WTFMove(rhs), CalcSubtract);323 return Length(CalculationValue::create(WTFMove(op), ValueRangeAll));324 311 } 325 312 -
trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp
r206690 r206713 40 40 #include "CSSPropertyNames.h" 41 41 #include "CachedImage.h" 42 #include "CalculationValue.h" 42 43 #include "ClipPathOperation.h" 43 44 #include "FloatConversion.h" … … 959 960 WTF_MAKE_FAST_ALLOCATED; 960 961 public: 961 FillLayerAnimationPropertyWrapperBase() 962 { 963 } 962 FillLayerAnimationPropertyWrapperBase(CSSPropertyID property) 963 : m_property(property) 964 { 965 } 966 967 CSSPropertyID property() const { return m_property; } 964 968 965 969 virtual ~FillLayerAnimationPropertyWrapperBase() { } … … 967 971 virtual bool equals(const FillLayer*, const FillLayer*) const = 0; 968 972 virtual void blend(const AnimationBase*, FillLayer*, const FillLayer*, const FillLayer*, double) const = 0; 973 974 #if !LOG_DISABLED 975 virtual void logBlend(const FillLayer* result, const FillLayer*, const FillLayer*, double) const = 0; 976 #endif 977 private: 978 CSSPropertyID m_property; 969 979 }; 970 980 … … 974 984 WTF_MAKE_NONCOPYABLE(FillLayerPropertyWrapperGetter); 975 985 public: 976 FillLayerPropertyWrapperGetter(T (FillLayer::*getter)() const) 977 : m_getter(getter) 986 FillLayerPropertyWrapperGetter(CSSPropertyID property, T (FillLayer::*getter)() const) 987 : FillLayerAnimationPropertyWrapperBase(property) 988 , m_getter(getter) 978 989 { 979 990 } … … 988 999 } 989 1000 1001 T value(const FillLayer* layer) const 1002 { 1003 return (layer->*m_getter)(); 1004 } 1005 1006 #if !LOG_DISABLED 1007 void logBlend(const FillLayer* result, const FillLayer* a, const FillLayer* b, double progress) const override 1008 { 1009 LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(a) << " to " << value(b) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result)); 1010 } 1011 #endif 1012 990 1013 protected: 991 1014 T (FillLayer::*m_getter)() const; … … 996 1019 WTF_MAKE_FAST_ALLOCATED; 997 1020 public: 998 FillLayerPropertyWrapper( const T& (FillLayer::*getter)() const, void (FillLayer::*setter)(T))999 : FillLayerPropertyWrapperGetter<const T&>( getter)1021 FillLayerPropertyWrapper(CSSPropertyID property, const T& (FillLayer::*getter)() const, void (FillLayer::*setter)(T)) 1022 : FillLayerPropertyWrapperGetter<const T&>(property, getter) 1000 1023 , m_setter(setter) 1001 1024 { 1002 1025 } 1003 1026 1004 v irtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const1027 void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override 1005 1028 { 1006 1029 (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<const T&>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<const T&>::m_getter)(), progress)); 1007 1030 } 1031 1032 #if !LOG_DISABLED 1033 void logBlend(const FillLayer* result, const FillLayer* a, const FillLayer* b, double progress) const override 1034 { 1035 LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(FillLayerPropertyWrapperGetter<const T&>::property()) 1036 << " from " << FillLayerPropertyWrapperGetter<const T&>::value(a) 1037 << " to " << FillLayerPropertyWrapperGetter<const T&>::value(b) 1038 << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << FillLayerPropertyWrapperGetter<const T&>::value(result)); 1039 } 1040 #endif 1008 1041 1009 1042 protected: … … 1011 1044 }; 1012 1045 1046 class FillLayerPositionPropertyWrapper : public FillLayerPropertyWrapperGetter<const Length&> { 1047 WTF_MAKE_FAST_ALLOCATED; 1048 public: 1049 FillLayerPositionPropertyWrapper(CSSPropertyID property, const Length& (FillLayer::*lengthGetter)() const, void (FillLayer::*lengthSetter)(Length), Edge (FillLayer::*originGetter)() const, void (FillLayer::*originSetter)(Edge), Edge farEdge) 1050 : FillLayerPropertyWrapperGetter<const Length&>(property, lengthGetter) 1051 , m_lengthSetter(lengthSetter) 1052 , m_originGetter(originGetter) 1053 , m_originSetter(originSetter) 1054 , m_farEdge(farEdge) 1055 { 1056 } 1057 1058 bool equals(const FillLayer* a, const FillLayer* b) const override 1059 { 1060 if (a == b) 1061 return true; 1062 if (!a || !b) 1063 return false; 1064 1065 Length fromLength = (a->*FillLayerPropertyWrapperGetter<const Length&>::m_getter)(); 1066 Length toLength = (b->*FillLayerPropertyWrapperGetter<const Length&>::m_getter)(); 1067 1068 Edge fromEdge = (a->*m_originGetter)(); 1069 Edge toEdge = (b->*m_originGetter)(); 1070 1071 return fromLength == toLength && fromEdge == toEdge; 1072 } 1073 1074 void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override 1075 { 1076 Length fromLength = (a->*FillLayerPropertyWrapperGetter<const Length&>::m_getter)(); 1077 Length toLength = (b->*FillLayerPropertyWrapperGetter<const Length&>::m_getter)(); 1078 1079 Edge fromEdge = (a->*m_originGetter)(); 1080 Edge toEdge = (b->*m_originGetter)(); 1081 1082 if (fromEdge != toEdge) { 1083 // Convert the right/bottom into a calc expression, 1084 if (fromEdge == m_farEdge) 1085 fromLength = convertTo100PercentMinusLength(fromLength); 1086 else if (toEdge == m_farEdge) { 1087 toLength = convertTo100PercentMinusLength(toLength); 1088 (dst->*m_originSetter)(fromEdge); // Now we have a calc(100% - l), it's relative to the left/top edge. 1089 } 1090 } 1091 1092 (dst->*m_lengthSetter)(blendFunc(anim, fromLength, toLength, progress)); 1093 } 1094 1095 #if !LOG_DISABLED 1096 void logBlend(const FillLayer* result, const FillLayer* a, const FillLayer* b, double progress) const override 1097 { 1098 LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(a) << " to " << value(b) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result)); 1099 } 1100 #endif 1101 1102 protected: 1103 void (FillLayer::*m_lengthSetter)(Length); 1104 Edge (FillLayer::*m_originGetter)() const; 1105 void (FillLayer::*m_originSetter)(Edge); 1106 Edge m_farEdge; 1107 }; 1108 1013 1109 template <typename T> 1014 1110 class FillLayerRefCountedPropertyWrapper : public FillLayerPropertyWrapperGetter<T*> { 1015 1111 WTF_MAKE_FAST_ALLOCATED; 1016 1112 public: 1017 FillLayerRefCountedPropertyWrapper( T* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<T>))1018 : FillLayerPropertyWrapperGetter<T*>( getter)1113 FillLayerRefCountedPropertyWrapper(CSSPropertyID property, T* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<T>)) 1114 : FillLayerPropertyWrapperGetter<T*>(property, getter) 1019 1115 , m_setter(setter) 1020 1116 { 1021 1117 } 1022 1118 1023 v irtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const1119 void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override 1024 1120 { 1025 1121 (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T*>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<T*>::m_getter)(), progress)); 1026 1122 } 1123 1124 #if !LOG_DISABLED 1125 void logBlend(const FillLayer* result, const FillLayer* a, const FillLayer* b, double progress) const override 1126 { 1127 LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(FillLayerPropertyWrapperGetter<T*>::property()) 1128 << " from " << FillLayerPropertyWrapperGetter<T*>::value(a) 1129 << " to " << FillLayerPropertyWrapperGetter<T*>::value(b) 1130 << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << FillLayerPropertyWrapperGetter<T*>::value(result)); 1131 } 1132 #endif 1027 1133 1028 1134 protected: … … 1033 1139 WTF_MAKE_FAST_ALLOCATED; 1034 1140 public: 1035 FillLayerStyleImagePropertyWrapper( StyleImage* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<StyleImage>))1036 : FillLayerRefCountedPropertyWrapper<StyleImage>( getter, setter)1141 FillLayerStyleImagePropertyWrapper(CSSPropertyID property, StyleImage* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<StyleImage>)) 1142 : FillLayerRefCountedPropertyWrapper<StyleImage>(property, getter, setter) 1037 1143 { 1038 1144 } … … 1049 1155 return arePointingToEqualData(imageA, imageB); 1050 1156 } 1157 1158 #if !LOG_DISABLED 1159 void logBlend(const FillLayer* result, const FillLayer* a, const FillLayer* b, double progress) const override 1160 { 1161 LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(a) << " to " << value(b) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result)); 1162 } 1163 #endif 1051 1164 }; 1052 1165 … … 1057 1170 typedef FillLayer& (RenderStyle::*LayersAccessor)(); 1058 1171 1059 FillLayersPropertyWrapper(CSSPropertyID prop , LayersGetter getter, LayersAccessor accessor)1060 : AnimationPropertyWrapperBase(prop )1172 FillLayersPropertyWrapper(CSSPropertyID property, LayersGetter getter, LayersAccessor accessor) 1173 : AnimationPropertyWrapperBase(property) 1061 1174 , m_layersGetter(getter) 1062 1175 , m_layersAccessor(accessor) 1063 1176 { 1064 switch (prop ) {1177 switch (property) { 1065 1178 case CSSPropertyBackgroundPositionX: 1066 1179 case CSSPropertyWebkitMaskPositionX: 1067 m_fillLayerPropertyWrapper = std::make_unique<FillLayerP ropertyWrapper<Length>>(&FillLayer::xPosition, &FillLayer::setXPosition);1180 m_fillLayerPropertyWrapper = std::make_unique<FillLayerPositionPropertyWrapper>(property, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::backgroundXOrigin, &FillLayer::setBackgroundXOrigin, Edge::Right); 1068 1181 break; 1069 1182 case CSSPropertyBackgroundPositionY: 1070 1183 case CSSPropertyWebkitMaskPositionY: 1071 m_fillLayerPropertyWrapper = std::make_unique<FillLayerP ropertyWrapper<Length>>(&FillLayer::yPosition, &FillLayer::setYPosition);1184 m_fillLayerPropertyWrapper = std::make_unique<FillLayerPositionPropertyWrapper>(property, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::backgroundYOrigin, &FillLayer::setBackgroundYOrigin, Edge::Bottom); 1072 1185 break; 1073 1186 case CSSPropertyBackgroundSize: 1074 1187 case CSSPropertyWebkitBackgroundSize: 1075 1188 case CSSPropertyWebkitMaskSize: 1076 m_fillLayerPropertyWrapper = std::make_unique<FillLayerPropertyWrapper<LengthSize>>( &FillLayer::sizeLength, &FillLayer::setSizeLength);1189 m_fillLayerPropertyWrapper = std::make_unique<FillLayerPropertyWrapper<LengthSize>>(property, &FillLayer::sizeLength, &FillLayer::setSizeLength); 1077 1190 break; 1078 1191 case CSSPropertyBackgroundImage: 1079 m_fillLayerPropertyWrapper = std::make_unique<FillLayerStyleImagePropertyWrapper>( &FillLayer::image, &FillLayer::setImage);1192 m_fillLayerPropertyWrapper = std::make_unique<FillLayerStyleImagePropertyWrapper>(property, &FillLayer::image, &FillLayer::setImage); 1080 1193 break; 1081 1194 default: … … 1120 1233 1121 1234 #if !LOG_DISABLED 1122 void logBlend(const RenderStyle*, const RenderStyle*, const RenderStyle*, double progress) const final 1123 { 1124 // FIXME: better logging. 1125 LOG_WITH_STREAM(Animations, stream << " blending FillLayers at " << TextStream::FormatNumberRespectingIntegers(progress)); 1235 void logBlend(const RenderStyle* from, const RenderStyle* to, const RenderStyle* result, double progress) const final 1236 { 1237 const FillLayer* aLayer = (from->*m_layersGetter)(); 1238 const FillLayer* bLayer = (to->*m_layersGetter)(); 1239 const FillLayer* dstLayer = (result->*m_layersGetter)(); 1240 1241 while (aLayer && bLayer && dstLayer) { 1242 m_fillLayerPropertyWrapper->logBlend(dstLayer, aLayer, bLayer, progress); 1243 aLayer = aLayer->next(); 1244 bLayer = bLayer->next(); 1245 dstLayer = dstLayer->next(); 1246 } 1126 1247 } 1127 1248 #endif … … 1166 1287 1167 1288 #if !LOG_DISABLED 1168 void logBlend(const RenderStyle* , const RenderStyle*, const RenderStyle*, double progress) const final1169 { 1170 // FIXME: better logging.1171 LOG_WITH_STREAM(Animations, stream << " blending shorthand property " << getPropertyName(property()) << " at " << TextStream::FormatNumberRespectingIntegers(progress));1289 void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* dst, double progress) const final 1290 { 1291 for (auto& wrapper : m_propertyWrappers) 1292 wrapper->logBlend(a, b, dst, progress); 1172 1293 } 1173 1294 #endif … … 1580 1701 AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(prop); 1581 1702 if (wrapper) { 1703 wrapper->blend(anim, dst, a, b, progress); 1582 1704 #if !LOG_DISABLED 1583 1705 wrapper->logBlend(a, b, dst, progress); 1584 1706 #endif 1585 wrapper->blend(anim, dst, a, b, progress);1586 1707 return !wrapper->animationIsAccelerated() || !anim->isAccelerated(); 1587 1708 } -
trunk/Source/WebCore/platform/CalculationValue.cpp
r206043 r206713 32 32 #include "config.h" 33 33 #include "CalculationValue.h" 34 #include "TextStream.h" 34 35 35 36 #include <limits> … … 45 46 { 46 47 return m_value; 48 } 49 50 void CalcExpressionNumber::dump(TextStream& ts) const 51 { 52 ts << TextStream::FormatNumberRespectingIntegers(m_value); 47 53 } 48 54 … … 87 93 } 88 94 95 void CalcExpressionBinaryOperation::dump(TextStream& ts) const 96 { 97 ts << *m_leftSide << " " << m_operator << " " << *m_rightSide; 98 } 99 89 100 float CalcExpressionLength::evaluate(float maxValue) const 90 101 { … … 95 106 { 96 107 return other.type() == CalcExpressionNodeLength && *this == toCalcExpressionLength(other); 108 } 109 110 void CalcExpressionLength::dump(TextStream& ts) const 111 { 112 ts << m_length; 97 113 } 98 114 … … 107 123 } 108 124 125 void CalcExpressionBlendLength::dump(TextStream& ts) const 126 { 127 ts << "blend(" << m_from << ", " << m_to << ", " << m_progress << ")"; 128 } 129 130 TextStream& operator<<(TextStream& ts, CalcOperator op) 131 { 132 switch (op) { 133 case CalcAdd: ts << "+"; break; 134 case CalcSubtract: ts << "-"; break; 135 case CalcMultiply: ts << "*"; break; 136 case CalcDivide: ts << "/"; break; 137 } 138 return ts; 139 } 140 141 TextStream& operator<<(TextStream& ts, const CalculationValue& value) 142 { 143 ts << "calc("; 144 ts << value.expression(); 145 ts << ")"; 146 return ts; 147 } 148 149 TextStream& operator<<(TextStream& ts, const CalcExpressionNode& expressionNode) 150 { 151 expressionNode.dump(ts); 152 return ts; 153 } 154 109 155 } // namespace WebCore -
trunk/Source/WebCore/platform/CalculationValue.h
r206043 r206713 40 40 namespace WebCore { 41 41 42 class TextStream; 43 42 44 enum CalcOperator { 43 45 CalcAdd = '+', … … 65 67 virtual float evaluate(float maxValue) const = 0; 66 68 virtual bool operator==(const CalcExpressionNode&) const = 0; 69 virtual void dump(TextStream&) const = 0; 67 70 68 71 private: … … 79 82 float evaluate(float) const override; 80 83 bool operator==(const CalcExpressionNode&) const override; 84 void dump(TextStream&) const override; 81 85 82 86 float m_value; … … 92 96 float evaluate(float maxValue) const override; 93 97 bool operator==(const CalcExpressionNode&) const override; 98 void dump(TextStream&) const override; 94 99 95 100 Length m_length; … … 107 112 float evaluate(float maxValue) const override; 108 113 bool operator==(const CalcExpressionNode&) const override; 114 void dump(TextStream&) const override; 109 115 110 116 std::unique_ptr<CalcExpressionNode> m_leftSide; … … 124 130 float evaluate(float maxValue) const override; 125 131 bool operator==(const CalcExpressionNode&) const override; 132 void dump(TextStream&) const override; 126 133 127 134 Length m_from; … … 233 240 } 234 241 242 TextStream& operator<<(TextStream&, const CalculationValue&); 243 TextStream& operator<<(TextStream&, const CalcExpressionNode&); 244 TextStream& operator<<(TextStream&, CalcOperator); 245 235 246 } // namespace WebCore 236 247 -
trunk/Source/WebCore/platform/Length.cpp
r206196 r206713 285 285 } 286 286 287 Length convertTo100PercentMinusLength(const Length& length) 288 { 289 if (length.isPercent()) 290 return Length(100 - length.value(), Percent); 291 292 // Turn this into a calc expression: calc(100% - length) 293 auto lhs = std::make_unique<CalcExpressionLength>(Length(100, Percent)); 294 auto rhs = std::make_unique<CalcExpressionLength>(length); 295 auto op = std::make_unique<CalcExpressionBinaryOperation>(WTFMove(lhs), WTFMove(rhs), CalcSubtract); 296 return Length(CalculationValue::create(WTFMove(op), ValueRangeAll)); 297 } 298 287 299 static Length blendMixedTypes(const Length& from, const Length& to, double progress) 288 300 { … … 371 383 break; 372 384 case Calculated: 373 // FIXME: dump CalculationValue. 374 ts << "calc(...)"; 385 ts << length.calculationValue(); 375 386 break; 376 387 } -
trunk/Source/WebCore/platform/Length.h
r205103 r206713 416 416 } 417 417 418 Length convertTo100PercentMinusLength(const Length&); 419 418 420 TextStream& operator<<(TextStream&, Length); 419 421 -
trunk/Source/WebCore/rendering/style/BasicShapes.cpp
r206043 r206713 53 53 return; 54 54 } 55 55 56 if (m_length.isUndefined()) { 56 57 m_computedLength = Length(100, Percent); 57 58 return; 58 59 } 59 60 auto lhs = std::make_unique<CalcExpressionLength>(Length(100, Percent)); 61 auto rhs = std::make_unique<CalcExpressionLength>(m_length); 62 auto op = std::make_unique<CalcExpressionBinaryOperation>(WTFMove(lhs), WTFMove(rhs), CalcSubtract); 63 m_computedLength = Length(CalculationValue::create(WTFMove(op), ValueRangeAll)); 60 61 m_computedLength = convertTo100PercentMinusLength(m_length); 64 62 } 65 63 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/CalculationValue.cpp
r206043 r206713 28 28 #include <WebCore/CalculationValue.h> 29 29 30 namespace WebCore { 31 class TextStream; 32 }; 33 30 34 namespace TestWebKitAPI { 31 35 … … 41 45 float evaluate(float) const override { return 0; } 42 46 bool operator==(const CalcExpressionNode&) const override { ASSERT_NOT_REACHED(); return false; } 47 48 private: 49 void dump(WebCore::TextStream&) const override { }; 43 50 }; 44 51
Note: See TracChangeset
for help on using the changeset viewer.