Skip to content

Commit

Permalink
Bug 1665991 - Stop unnecessarily repainting default buttons and progr…
Browse files Browse the repository at this point in the history
…ess bars. r=spohl

On 10.9 and below, the native appearance for those widgets was animated: default buttons had a blue pulse, and progress bars had a blue flow animation.
Now that we no longer support 10.9, we can stop triggering these repaints. Indeterminate progress bars still animate.

Differential Revision: https://phabricator.services.mozilla.com/D90730
  • Loading branch information
mstange committed Sep 18, 2020
1 parent f05c1cb commit fbd877d
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions widget/cocoa/nsNativeThemeCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2770,10 +2770,6 @@ static bool IsHiDPIContext(nsDeviceContext* aContext) {
// and black text.)
EventStates docState = aFrame->GetContent()->OwnerDoc()->GetDocumentState();
bool isInActiveWindow = !docState.HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE);
if (!IsDisabled(aFrame, eventState) && isInActiveWindow &&
!QueueAnimatedContentForRefresh(aFrame->GetContent(), 10)) {
NS_WARNING("Unable to animate button!");
}
bool hasDefaultButtonLook = isInActiveWindow && !eventState.HasState(NS_EVENT_STATE_ACTIVE);
ButtonType buttonType =
hasDefaultButtonLook ? ButtonType::eDefaultPushButton : ButtonType::eRegularPushButton;
Expand Down Expand Up @@ -2938,8 +2934,7 @@ static bool IsHiDPIContext(nsDeviceContext* aContext) {
return Some(WidgetInfo::SearchField(ComputeSearchFieldParams(aFrame, eventState)));

case StyleAppearance::ProgressBar: {
// Don't request repaints for scrollbars at 100% because those don't animate.
if (GetProgressValue(aFrame) < GetProgressMaxValue(aFrame)) {
if (IsIndeterminateProgress(aFrame, eventState)) {
if (!QueueAnimatedContentForRefresh(aFrame->GetContent(), 30)) {
NS_WARNING("Unable to animate progressbar!");
}
Expand Down

0 comments on commit fbd877d

Please sign in to comment.