Changeset 274415 in webkit
- Timestamp:
- Mar 15, 2021 6:00:06 AM (16 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/animation/CSSPropertyAnimation.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r274411 r274415 1 2021-03-15 Rob Buis <rbuis@igalia.com> 2 3 CSS aspect-ratio interpolation 4 https://bugs.webkit.org/show_bug.cgi?id=220848 5 6 Reviewed by Antoine Quint. 7 8 Import relevant test. 9 10 * web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation-expected.txt: Added. 11 * web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html: Added. 12 1 13 2021-03-10 Sergio Villar Senin <svillar@igalia.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r274414 r274415 1 2021-03-15 Rob Buis <rbuis@igalia.com> 2 3 CSS aspect-ratio interpolation 4 https://bugs.webkit.org/show_bug.cgi?id=220848 5 6 Reviewed by Antoine Quint. 7 8 Implement CSS aspect-ratio interpolation as defined here: 9 https://drafts.csswg.org/css-values/#combine-ratio 10 11 Test: imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html 12 13 * animation/CSSPropertyAnimation.cpp: 14 (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): 15 1 16 2021-03-15 Kimmo Kinnunen <kkinnunen@apple.com> 2 17 -
trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp
r274409 r274415 1853 1853 else 1854 1854 NonNegativeFloatPropertyWrapper::blend(client, destination, from, to, progress); 1855 } 1856 }; 1857 1858 class PropertyWrapperAspectRatio final : public AnimationPropertyWrapperBase { 1859 WTF_MAKE_FAST_ALLOCATED; 1860 public: 1861 PropertyWrapperAspectRatio() 1862 : AnimationPropertyWrapperBase(CSSPropertyAspectRatio) 1863 { 1864 } 1865 1866 bool equals(const RenderStyle* a, const RenderStyle* b) const final 1867 { 1868 if (a == b) 1869 return true; 1870 if (!a || !b) 1871 return false; 1872 1873 return a->aspectRatioType() == b->aspectRatioType() && a->aspectRatioWidth() == b->aspectRatioWidth() && a->aspectRatioHeight() == b->aspectRatioHeight(); 1874 } 1875 1876 bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final 1877 { 1878 return (from->aspectRatioType() == AspectRatioType::Ratio && to->aspectRatioType() == AspectRatioType::Ratio) || (from->aspectRatioType() == AspectRatioType::AutoAndRatio && to->aspectRatioType() == AspectRatioType::AutoAndRatio); 1879 } 1880 1881 #if !LOG_DISABLED 1882 void logBlend(const RenderStyle* from, const RenderStyle* to, const RenderStyle* result, double progress) const final 1883 { 1884 LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << from->logicalAspectRatio() << " to " << to->logicalAspectRatio() << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << result->logicalAspectRatio()); 1885 } 1886 #endif 1887 1888 void blend(const CSSPropertyBlendingClient*, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final 1889 { 1890 destination->setAspectRatioType(progress < 0.5 ? from->aspectRatioType() : to->aspectRatioType()); 1891 if (canInterpolate(from, to)) { 1892 auto aspectRatioDst = WebCore::blend(log(from->logicalAspectRatio()), log(to->logicalAspectRatio()), progress); 1893 destination->setAspectRatio(exp(aspectRatioDst), 1); 1894 return; 1895 } 1896 // For auto/auto-zero aspect-ratio we use discrete values, we can't use general 1897 // logic since logicalAspectRatio asserts on aspect-ratio type. 1898 ASSERT(!progress || progress == 1); 1899 auto* applicableStyle = progress ? to : from; 1900 destination->setAspectRatio(applicableStyle->aspectRatioWidth(), applicableStyle->aspectRatioHeight()); 1855 1901 } 1856 1902 }; … … 2154 2200 new DiscretePropertyWrapper<BlendMode>(CSSPropertyMixBlendMode, &RenderStyle::blendMode, &RenderStyle::setBlendMode), 2155 2201 #endif 2202 new PropertyWrapperAspectRatio, 2156 2203 }; 2157 2204 const unsigned animatableLonghandPropertiesCount = WTF_ARRAY_LENGTH(animatableLonghandPropertyWrappers);
Note: See TracChangeset
for help on using the changeset viewer.