RESOLVED FIXED 223208
[iOS][FCR] Add pressed state for button-like controls
https://bugs.webkit.org/show_bug.cgi?id=223208
Summary [iOS][FCR] Add pressed state for button-like controls
Aditya Keerthi
Reported 2021-03-15 12:27:49 PDT
...
Attachments
Patch (5.85 KB, patch)
2021-03-15 12:33 PDT, Aditya Keerthi
no flags
Patch (9.30 KB, patch)
2021-03-19 11:03 PDT, Aditya Keerthi
no flags
Patch (15.54 KB, patch)
2021-03-19 12:26 PDT, Aditya Keerthi
no flags
Aditya Keerthi
Comment 1 2021-03-15 12:28:05 PDT
Aditya Keerthi
Comment 2 2021-03-15 12:33:51 PDT
EWS
Comment 3 2021-03-16 06:43:00 PDT
Committed r274473: <https://commits.webkit.org/r274473> All reviewed patches have been landed. Closing bug and clearing flags on attachment 423220 [details].
Simon Fraser (smfr)
Comment 4 2021-03-16 15:37:47 PDT
Comment on attachment 423220 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423220&action=review > Source/WebCore/rendering/RenderThemeIOS.mm:350 > + style.setOpacity(0.75f); You can't just set opacity in the style without calling Adjuster::adjust() - opacity has side effects, like creating CSS stacking context.
WebKit Commit Bot
Comment 5 2021-03-16 15:50:05 PDT
Re-opened since this is blocked by bug 223287
Aditya Keerthi
Comment 6 2021-03-19 11:03:19 PDT
Simon Fraser (smfr)
Comment 7 2021-03-19 11:23:23 PDT
Comment on attachment 423746 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423746&action=review > Source/WebCore/rendering/RenderThemeIOS.mm:2124 > + if (pressed) > + context.fillRoundedRect(checkboxRect, systemColor(CSSValueAppleSystemBlue, styleColorOptions).colorWithAlphaMultipliedBy(pressedStateOpacity)); > + else if (enabled) > context.fillRoundedRect(checkboxRect, systemColor(CSSValueAppleSystemBlue, styleColorOptions)); > else > context.fillRoundedRect(checkboxRect, systemColor(CSSValueAppleSystemSecondaryFillDisabled, styleColorOptions)); With code like this, it's much better to factor it so that you only call the actual function once. Prepare the inputs based on state, but just have one call to context.fillRoundedRect()
Aditya Keerthi
Comment 8 2021-03-19 12:26:59 PDT
Aditya Keerthi
Comment 9 2021-03-19 12:28:03 PDT
(In reply to Simon Fraser (smfr) from comment #7) > Comment on attachment 423746 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=423746&action=review > > > Source/WebCore/rendering/RenderThemeIOS.mm:2124 > > + if (pressed) > > + context.fillRoundedRect(checkboxRect, systemColor(CSSValueAppleSystemBlue, styleColorOptions).colorWithAlphaMultipliedBy(pressedStateOpacity)); > > + else if (enabled) > > context.fillRoundedRect(checkboxRect, systemColor(CSSValueAppleSystemBlue, styleColorOptions)); > > else > > context.fillRoundedRect(checkboxRect, systemColor(CSSValueAppleSystemSecondaryFillDisabled, styleColorOptions)); > > With code like this, it's much better to factor it so that you only call the > actual function once. Prepare the inputs based on state, but just have one > call to context.fillRoundedRect() Done. I moved the color determination into separate methods, so that they can be used for both checkboxes and radio buttons.
Simon Fraser (smfr)
Comment 10 2021-03-23 10:57:43 PDT
Comment on attachment 423759 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423759&action=review > Source/WebCore/rendering/RenderThemeIOS.mm:2100 > + if (!(states & ControlStates::EnabledState)) ControlStates::States should be an enum class, and be used OptionSet<>
Aditya Keerthi
Comment 11 2021-03-23 11:04:10 PDT
(In reply to Simon Fraser (smfr) from comment #10) > Comment on attachment 423759 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=423759&action=review > > > Source/WebCore/rendering/RenderThemeIOS.mm:2100 > > + if (!(states & ControlStates::EnabledState)) > > ControlStates::States should be an enum class, and be used OptionSet<> Tracking this refactoring in https://bugs.webkit.org/show_bug.cgi?id=223647.
EWS
Comment 12 2021-03-23 11:32:03 PDT
Committed r274886: <https://commits.webkit.org/r274886> All reviewed patches have been landed. Closing bug and clearing flags on attachment 423759 [details].
Note You need to log in before you can comment on or make changes to this bug.