Changeset 270065 in webkit
- Timestamp:
- Nov 19, 2020 5:41:43 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 11 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r270059 r270065 1 2020-11-19 Aditya Keerthi <akeerthi@apple.com> 2 3 [iOS][FCR] Add new look for progress bars 4 https://bugs.webkit.org/show_bug.cgi?id=218864 5 <rdar://problem/71334958> 6 7 Reviewed by Darin Adler and Wenson Hsieh. 8 9 Added tests to verify different states and appearances of native progress bars. 10 11 * fast/forms/ios/form-control-refresh/progress/filled-appearance-expected-mismatch.html: Added. 12 * fast/forms/ios/form-control-refresh/progress/filled-appearance.html: Added. 13 * fast/forms/ios/form-control-refresh/progress/indeterminate-appearance-expected-mismatch.html: Added. 14 * fast/forms/ios/form-control-refresh/progress/indeterminate-appearance.html: Added. 15 * fast/forms/ios/form-control-refresh/progress/rtl-appearance-expected-mismatch.html: Added. 16 * fast/forms/ios/form-control-refresh/progress/rtl-appearance.html: Added. 17 * fast/forms/ios/form-control-refresh/progress/style-height-expected.html: Added. 18 * fast/forms/ios/form-control-refresh/progress/style-height.html: Added. 19 * fast/forms/ios/form-control-refresh/progress/style-width-expected-mismatch.html: Added. 20 * fast/forms/ios/form-control-refresh/progress/style-width.html: Added. 21 1 22 2020-11-19 Geoffrey Garen <ggaren@apple.com> 2 23 -
trunk/Source/WebCore/ChangeLog
r270064 r270065 1 2020-11-19 Aditya Keerthi <akeerthi@apple.com> 2 3 [iOS][FCR] Add new look for progress bars 4 https://bugs.webkit.org/show_bug.cgi?id=218864 5 <rdar://problem/71334958> 6 7 Reviewed by Darin Adler and Wenson Hsieh. 8 9 Tests: fast/forms/ios/form-control-refresh/progress/filled-appearance.html 10 fast/forms/ios/form-control-refresh/progress/indeterminate-appearance.html 11 fast/forms/ios/form-control-refresh/progress/rtl-appearance.html 12 fast/forms/ios/form-control-refresh/progress/style-height.html 13 fast/forms/ios/form-control-refresh/progress/style-width.html 14 15 * platform/graphics/FloatRoundedRect.h: 16 (WebCore::FloatRoundedRect::Radii::Radii): 17 18 Added a new initializer to be used when all radii have the same value 19 but the horizontal and vertical components of an individual radius are 20 not equal. 21 22 * rendering/RenderTheme.cpp: 23 (WebCore::RenderTheme::animationRepeatIntervalForProgressBar const): 24 (WebCore::RenderTheme::animationDurationForProgressBar const): 25 * rendering/RenderTheme.h: Updated methods to take const parameter. 26 * rendering/RenderThemeAdwaita.cpp: 27 (WebCore::RenderThemeAdwaita::animationRepeatIntervalForProgressBar const): 28 (WebCore::RenderThemeAdwaita::animationDurationForProgressBar const): 29 * rendering/RenderThemeAdwaita.h: 30 * rendering/RenderThemeIOS.h: 31 * rendering/RenderThemeIOS.mm: 32 (WebCore::RenderThemeIOS::paintProgressBar): 33 (WebCore::RenderThemeIOS::animationRepeatIntervalForProgressBar const): 34 (WebCore::RenderThemeIOS::paintProgressBarFCR): 35 36 Updated appearance of determinate progress bars to match UIKit. 37 38 Added an animated indeterminate progress bar, by implementing the 39 animationRepeatIntervalForProgressBar method in RenderThemeIOS. This 40 matches RenderThemeMac. On macOS, the animation start time and the 41 current time are forwarded to CoreUI for drawing. However, on iOS, we 42 use this information to paint the animated progress bar ourselves. 43 44 * rendering/RenderThemeMac.h: 45 * rendering/RenderThemeMac.mm: Renamed constant for accuracy. 46 (WebCore::RenderThemeMac::animationRepeatIntervalForProgressBar const): 47 1 48 2020-11-19 Dean Jackson <dino@apple.com> 2 49 -
trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h
r269563 r270065 68 68 } 69 69 70 explicit Radii(float uniformRadiusWidth, float uniformRadiusHeight) 71 : m_topLeft(uniformRadiusWidth, uniformRadiusHeight) 72 , m_topRight(uniformRadiusWidth, uniformRadiusHeight) 73 , m_bottomLeft(uniformRadiusWidth, uniformRadiusHeight) 74 , m_bottomRight(uniformRadiusWidth, uniformRadiusHeight) 75 { 76 } 77 70 78 void setTopLeft(const FloatSize& size) { m_topLeft = size; } 71 79 void setTopRight(const FloatSize& size) { m_topRight = size; } -
trunk/Source/WebCore/rendering/RenderTheme.cpp
r269785 r270065 1119 1119 #endif 1120 1120 1121 Seconds RenderTheme::animationRepeatIntervalForProgressBar( RenderProgress&) const1121 Seconds RenderTheme::animationRepeatIntervalForProgressBar(const RenderProgress&) const 1122 1122 { 1123 1123 return 0_s; 1124 1124 } 1125 1125 1126 Seconds RenderTheme::animationDurationForProgressBar( RenderProgress&) const1126 Seconds RenderTheme::animationDurationForProgressBar(const RenderProgress&) const 1127 1127 { 1128 1128 return 0_s; -
trunk/Source/WebCore/rendering/RenderTheme.h
r269785 r270065 188 188 189 189 // Returns the repeat interval of the animation for the progress bar. 190 virtual Seconds animationRepeatIntervalForProgressBar( RenderProgress&) const;190 virtual Seconds animationRepeatIntervalForProgressBar(const RenderProgress&) const; 191 191 // Returns the duration of the animation for the progress bar. 192 virtual Seconds animationDurationForProgressBar( RenderProgress&) const;192 virtual Seconds animationDurationForProgressBar(const RenderProgress&) const; 193 193 virtual IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const; 194 194 -
trunk/Source/WebCore/rendering/RenderThemeAdwaita.cpp
r267009 r270065 303 303 } 304 304 305 Seconds RenderThemeAdwaita::animationRepeatIntervalForProgressBar( RenderProgress&) const305 Seconds RenderThemeAdwaita::animationRepeatIntervalForProgressBar(const RenderProgress&) const 306 306 { 307 307 return progressAnimationFrameRate; 308 308 } 309 309 310 Seconds RenderThemeAdwaita::animationDurationForProgressBar( RenderProgress&) const310 Seconds RenderThemeAdwaita::animationDurationForProgressBar(const RenderProgress&) const 311 311 { 312 312 return progressAnimationFrameRate * progressAnimationFrameCount; -
trunk/Source/WebCore/rendering/RenderThemeAdwaita.h
r264298 r270065 71 71 bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) final; 72 72 73 Seconds animationRepeatIntervalForProgressBar( RenderProgress&) const final;74 Seconds animationDurationForProgressBar( RenderProgress&) const final;73 Seconds animationRepeatIntervalForProgressBar(const RenderProgress&) const final; 74 Seconds animationDurationForProgressBar(const RenderProgress&) const final; 75 75 IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const final; 76 76 bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) final; -
trunk/Source/WebCore/rendering/RenderThemeIOS.h
r269975 r270065 114 114 bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&) override; 115 115 bool paintRadio(const RenderObject&, const PaintInfo&, const IntRect&) override; 116 117 Seconds animationRepeatIntervalForProgressBar(const RenderProgress&) const final; 118 bool paintProgressBarFCR(const RenderObject&, const PaintInfo&, const IntRect&); 116 119 #endif 117 120 -
trunk/Source/WebCore/rendering/RenderThemeIOS.mm
r269975 r270065 908 908 bool RenderThemeIOS::paintProgressBar(const RenderObject& renderer, const PaintInfo& paintInfo, const IntRect& rect) 909 909 { 910 #if ENABLE(IOS_FORM_CONTROL_REFRESH) 911 if (renderer.settings().iOSFormControlRefreshEnabled()) 912 return paintProgressBarFCR(renderer, paintInfo, rect); 913 #endif 914 910 915 if (!is<RenderProgress>(renderer)) 911 916 return true; … … 2070 2075 } 2071 2076 2077 // Animate the indeterminate progress bar at 30 fps. This value was chosen to 2078 // ensure a smooth animation, while trying to reduce the number of times the 2079 // progress bar is repainted. 2080 constexpr Seconds progressAnimationRepeatInterval = 33_ms; 2081 2082 Seconds RenderThemeIOS::animationRepeatIntervalForProgressBar(const RenderProgress&) const 2083 { 2084 return progressAnimationRepeatInterval; 2085 } 2086 2087 bool RenderThemeIOS::paintProgressBarFCR(const RenderObject& renderer, const PaintInfo& paintInfo, const IntRect& rect) 2088 { 2089 if (!is<RenderProgress>(renderer)) 2090 return true; 2091 auto& renderProgress = downcast<RenderProgress>(renderer); 2092 2093 auto& context = paintInfo.context(); 2094 GraphicsContextStateSaver stateSaver(context); 2095 2096 constexpr auto barHeight = 4.0f; 2097 FloatRoundedRect::Radii barCornerRadii(2.5f, 1.5f); 2098 2099 if (rect.height() < barHeight) { 2100 // The rect is smaller than the standard progress bar. We clip to the 2101 // element's rect to avoid leaking pixels outside the repaint rect. 2102 context.clip(rect); 2103 } 2104 2105 float barTop = rect.y() + (rect.height() - barHeight) / 2.0f; 2106 2107 FloatRect trackRect(rect.x(), barTop, rect.width(), barHeight); 2108 FloatRoundedRect roundedTrackRect(trackRect, barCornerRadii); 2109 context.fillRoundedRect(roundedTrackRect, controlBackgroundColor); 2110 2111 float barWidth; 2112 float barLeft = rect.x(); 2113 2114 if (renderProgress.isDeterminate()) { 2115 barWidth = clampTo<float>(renderProgress.position(), 0.0f, 1.0f) * trackRect.width(); 2116 2117 if (!renderProgress.style().isLeftToRightDirection()) 2118 barLeft = trackRect.maxX() - barWidth; 2119 } else { 2120 barWidth = 0.25f * trackRect.width(); 2121 2122 Seconds elapsed = MonotonicTime::now() - renderProgress.animationStartTime(); 2123 float position = fmodf(elapsed.value(), 1.0f); 2124 float offset = position * (trackRect.width() + barWidth); 2125 2126 bool reverseDirection = static_cast<int>(elapsed.value()) % 2; 2127 if (reverseDirection) 2128 barLeft = trackRect.maxX() - offset; 2129 else 2130 barLeft -= barWidth - offset; 2131 2132 context.clipRoundedRect(roundedTrackRect); 2133 } 2134 2135 FloatRect barRect(barLeft, barTop, barWidth, barHeight); 2136 context.fillRoundedRect(FloatRoundedRect(barRect, barCornerRadii), controlColor); 2137 2138 return false; 2139 } 2140 2072 2141 #endif // ENABLE(IOS_FORM_CONTROL_REFRESH) 2073 2142 -
trunk/Source/WebCore/rendering/RenderThemeMac.h
r269785 r270065 89 89 90 90 // Returns the repeat interval of the animation for the progress bar. 91 Seconds animationRepeatIntervalForProgressBar( RenderProgress&) const final;91 Seconds animationRepeatIntervalForProgressBar(const RenderProgress&) const final; 92 92 IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const final; 93 93 -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r269869 r270065 116 116 @end 117 117 118 static const Seconds progressAnimationFrameRate= 33_ms; // 30 fps118 constexpr Seconds progressAnimationRepeatInterval = 33_ms; // 30 fps 119 119 120 120 @interface WebCoreRenderThemeNotificationObserver : NSObject … … 1345 1345 } 1346 1346 1347 Seconds RenderThemeMac::animationRepeatIntervalForProgressBar( RenderProgress&) const1348 { 1349 return progressAnimation FrameRate;1347 Seconds RenderThemeMac::animationRepeatIntervalForProgressBar(const RenderProgress&) const 1348 { 1349 return progressAnimationRepeatInterval; 1350 1350 } 1351 1351
Note: See TracChangeset
for help on using the changeset viewer.