Title: [276385] trunk/Source/WebCore
Revision
276385
Author
[email protected]
Date
2021-04-21 12:44:43 -0700 (Wed, 21 Apr 2021)

Log Message

[iOS][FCR] Adjust border radius for large buttons and <select>
https://bugs.webkit.org/show_bug.cgi?id=224825
<rdar://problem/76912116>

Reviewed by Wenson Hsieh.

* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::adjustRoundBorderRadius):

Larger UIKit buttons do not have a pill-shaped appearance. Match their
appearance for buttons and <select> elements that are natively styled
(ones that do not set "-webkit-appearance: none").

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (276384 => 276385)


--- trunk/Source/WebCore/ChangeLog	2021-04-21 19:42:35 UTC (rev 276384)
+++ trunk/Source/WebCore/ChangeLog	2021-04-21 19:44:43 UTC (rev 276385)
@@ -1,3 +1,18 @@
+2021-04-21  Aditya Keerthi  <[email protected]>
+
+        [iOS][FCR] Adjust border radius for large buttons and <select>
+        https://bugs.webkit.org/show_bug.cgi?id=224825
+        <rdar://problem/76912116>
+
+        Reviewed by Wenson Hsieh.
+
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::adjustRoundBorderRadius):
+
+        Larger UIKit buttons do not have a pill-shaped appearance. Match their
+        appearance for buttons and <select> elements that are natively styled
+        (ones that do not set "-webkit-appearance: none").
+
 2021-04-21  Adrian Perez de Castro  <[email protected]>
 
         Non-unified build fixes, mid April 2021 edition

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (276384 => 276385)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2021-04-21 19:42:35 UTC (rev 276384)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2021-04-21 19:44:43 UTC (rev 276385)
@@ -63,6 +63,8 @@
 #import "PathUtilities.h"
 #import "PlatformLocale.h"
 #import "RenderAttachment.h"
+#import "RenderButton.h"
+#import "RenderMenuList.h"
 #import "RenderMeter.h"
 #import "RenderObject.h"
 #import "RenderProgress.h"
@@ -554,6 +556,10 @@
     paintTextFieldDecorations(box, paintInfo, rect);
 }
 
+// These values are taken from the UIKit button system.
+constexpr auto largeButtonSize = 45;
+constexpr auto largeButtonBorderRadiusRatio = 0.35f / 2;
+
 const int MenuListMinHeight = 15;
 
 const float MenuListBaseHeight = 20;
@@ -603,6 +609,12 @@
     if (!canAdjustBorderRadiusForAppearance(style.appearance(), box) || style.backgroundLayers().hasImage())
         return;
 
+    if ((is<RenderButton>(box) || is<RenderMenuList>(box)) && box.height() >= largeButtonSize) {
+        auto largeButtonBorderRadius = std::min(box.width(), box.height()) * largeButtonBorderRadiusRatio;
+        style.setBorderRadius({ { largeButtonBorderRadius, LengthType::Fixed }, { largeButtonBorderRadius, LengthType::Fixed } });
+        return;
+    }
+
     // FIXME: We should not be relying on border radius for the appearance of our controls <rdar://problem/7675493>.
     style.setBorderRadius({ { std::min(box.width(), box.height()) / 2, LengthType::Fixed }, { box.height() / 2, LengthType::Fixed } });
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to