Bug 1560702 - Improve hit boxes of titlebar buttons. r=stransky,desktop-theme-reviewers,dao

In order to do it, expose the button padding to CSS via env(), and make
the buttons just use the regular drawing.

This slightly changes the padding to the end of the titlebar to match
one half of the inter-button spacing, rather that however much padding
the headerbar has.

We could improve on this slightly by also exposing the headerbar padding
and applying that to the last button, but that's not terribly easy to do
due to us supporting re-ordering of the titlebar buttons, and reversing
their placement, so it'd involve some rather hacky CSS. Not impossible,
but not trivial, and this looks good enough IMO.

Differential Revision: https://phabricator.services.mozilla.com/D202616
This commit is contained in:
Emilio Cobos Álvarez
2024-02-27 10:28:56 +00:00
parent 5157481604
commit c39cabe97e
14 changed files with 126 additions and 180 deletions

View File

@@ -555,15 +555,16 @@ void nsImageFrame::DidSetComputedStyle(ComputedStyle* aOldStyle) {
//
// TODO(emilio): We might want to do the same for regular list-style-image or
// even simple content: url() changes.
if (mKind == Kind::XULImage) {
if (!mContent->AsElement()->HasNonEmptyAttr(nsGkAtoms::src) && aOldStyle &&
if (mKind == Kind::XULImage && aOldStyle) {
if (!mContent->AsElement()->HasNonEmptyAttr(nsGkAtoms::src) &&
aOldStyle->StyleList()->mListStyleImage !=
StyleList()->mListStyleImage) {
UpdateXULImage();
}
if (!mOwnedRequest && aOldStyle &&
aOldStyle->StyleDisplay()->EffectiveAppearance() !=
StyleDisplay()->EffectiveAppearance()) {
// If we have no image our intrinsic size might be themed. We need to
// update the size even if the effective appearance hasn't changed to
// deal correctly with theme changes.
if (!mOwnedRequest) {
UpdateIntrinsicSize();
}
}