зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1722833 - Tweak default button :active state rendering. r=mac-reviewers,spohl
Before this patch we were drawing default buttons as follows: (no state): Drawn as a regular default button, with white text. :active:hover: Drawn as a pressed non-default button, with white text. :active:not(:hover): Drawn as a regular non-default button, with regular button text (black in light mode, white in dark mode). With this patch, we are drawing default buttons as follows: (no state): Unchanged. :active:hover: Drawn as a pressed *default* button, with white text. :active:not(:hover): Drawn as a regular *default* button, with white text. So we're changing both the pressed state and the "dragged" state. The pressed state looks the same as before on all macOS versions prior to macOS 12; on those versions, pressed default buttons and pressed non-default buttons look the same. It's only on macOS 12 that the two diverge. The "dragged" state didn't seem to match any native behavior in the past, and is corrected for all macOS versions now. Differential Revision: https://phabricator.services.mozilla.com/D128616
This commit is contained in:
Родитель
b910e0fd90
Коммит
eb296ef5d2
|
@ -23,12 +23,6 @@ button:where([default="true"]:not(:-moz-window-inactive)) {
|
|||
color: -moz-mac-defaultbuttontext;
|
||||
}
|
||||
|
||||
/* Likewise, when active (mousedown) but not hovering, the default button
|
||||
* background isn't drawn, override the previous selector for that case: */
|
||||
button:where([default="true"]:active:not(:hover)) {
|
||||
color: ButtonText;
|
||||
}
|
||||
|
||||
.button-text {
|
||||
margin-block: 1px;
|
||||
margin-inline: 3px 2px;
|
||||
|
|
|
@ -2307,13 +2307,9 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
|
|||
// text, and default buttons in inactive windows have white background
|
||||
// and black text.)
|
||||
EventStates docState = aFrame->GetContent()->OwnerDoc()->GetDocumentState();
|
||||
bool isInActiveWindow = !docState.HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE);
|
||||
bool hasDefaultButtonLook = isInActiveWindow && !eventState.HasState(NS_EVENT_STATE_ACTIVE);
|
||||
ButtonType buttonType =
|
||||
hasDefaultButtonLook ? ButtonType::eDefaultPushButton : ButtonType::eRegularPushButton;
|
||||
ControlParams params = ComputeControlParams(aFrame, eventState);
|
||||
params.insideActiveWindow = isInActiveWindow;
|
||||
return Some(WidgetInfo::Button(ButtonParams{params, buttonType}));
|
||||
params.insideActiveWindow = !docState.HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE);
|
||||
return Some(WidgetInfo::Button(ButtonParams{params, ButtonType::eDefaultPushButton}));
|
||||
}
|
||||
if (IsButtonTypeMenu(aFrame)) {
|
||||
ControlParams controlParams = ComputeControlParams(aFrame, eventState);
|
||||
|
|
Загрузка…
Ссылка в новой задаче