Skip to content

Commit af36581

Browse files
committed
Fix broken tooltips on 32 bit build
Reverts ade0599 Could be better, but I don't know how to properly fix the issue.
1 parent abf6c4d commit af36581

File tree

9 files changed

+9
-48
lines changed

9 files changed

+9
-48
lines changed

layout/xul/nsMenuPopupFrame.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,12 +2166,6 @@ nsMargin nsMenuPopupFrame::GetMargin() const {
21662166
margin.left += auOffset.x;
21672167
margin.right += auOffset.x;
21682168
}
2169-
if (mPopupType == PopupType::Tooltip && !IsAnchored()) {
2170-
const auto auOffset =
2171-
CSSPixel::ToAppUnits(LookAndFeel::TooltipOffsetVertical());
2172-
margin.top += auOffset;
2173-
margin.bottom += auOffset;
2174-
}
21752169
// TODO(emilio): We should consider make these properly mirrored (that is,
21762170
// changing -= to += here, and removing the rtl special case), but some tests
21772171
// rely on the old behavior of the anchor moving physically regardless of

toolkit/content/tests/chrome/window_tooltip.xhtml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ var gOriginalWidth = -1;
3030
var gOriginalHeight = -1;
3131
var gButton = null;
3232

33-
const kTooltipOffsetVertical = 10;
34-
3533
function runTest()
3634
{
3735
startPopupTests(popupTests);
@@ -114,7 +112,7 @@ var popupTests = [
114112
Math.round(buttonrect.left + parseFloat(popupstyle.marginLeft) + 6),
115113
testname + " left position of tooltip");
116114
is(Math.round(rect.top),
117-
Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6 + kTooltipOffsetVertical),
115+
Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6),
118116
testname + " top position of tooltip");
119117

120118
var labelrect = document.getElementById("label").getBoundingClientRect();
@@ -161,7 +159,7 @@ var popupTests = [
161159
Math.round(buttonrect.left + parseFloat(popupstyle.marginLeft) + 4),
162160
testname + " left position of tooltip");
163161
is(Math.round(rect.top),
164-
Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 4 + kTooltipOffsetVertical),
162+
Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 4),
165163
testname + " top position of tooltip");
166164

167165
var labelrect = document.getElementById("label").getBoundingClientRect();
@@ -206,7 +204,7 @@ var popupTests = [
206204
Math.round(buttonrect.left + parseFloat(popupstyle.marginLeft) + 6),
207205
testname + " left position of tooltip");
208206
is(Math.round(rect.top),
209-
Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6 + kTooltipOffsetVertical),
207+
Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6),
210208
testname + " top position of tooltip");
211209

212210
var labelrect = document.getElementById("label").getBoundingClientRect();
@@ -397,14 +395,7 @@ function moveWindowTo(x, y, callback, arg)
397395
}
398396
}
399397

400-
(async function() {
401-
let parent = window.arguments[0];
402-
await Promise.all([
403-
parent.SimpleTest.promiseFocus(window),
404-
parent.SpecialPowers.pushPrefEnv({set: [["ui.tooltipOffsetVertical", kTooltipOffsetVertical]]}),
405-
]);
406-
runTest();
407-
})();
398+
window.arguments[0].SimpleTest.waitForFocus(runTest, window);
408399
]]>
409400
</script>
410401

toolkit/content/xul.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ tooltip {
366366
pointer-events: none;
367367
}
368368

369+
tooltip:not([position]) {
370+
margin-top: 21px;
371+
}
372+
369373
/**
370374
* It's important that these styles are in a UA sheet, because the default
371375
* tooltip is native anonymous content

widget/LookAndFeel.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ class LookAndFeel {
232232
*/
233233
ContextMenuOffsetVertical,
234234
ContextMenuOffsetHorizontal,
235-
TooltipOffsetVertical,
236235

237236
/*
238237
* A boolean value indicating whether client-side decorations are
@@ -383,11 +382,6 @@ class LookAndFeel {
383382
return GetInt(IntID::UseOverlayScrollbars);
384383
}
385384

386-
static constexpr int32_t kDefaultTooltipOffset = 21;
387-
static int32_t TooltipOffsetVertical() {
388-
return GetInt(IntID::TooltipOffsetVertical, kDefaultTooltipOffset);
389-
}
390-
391385
// Returns keyCode value of a modifier key which is used for accesskey.
392386
// Returns 0 if the platform doesn't support access key.
393387
static uint32_t GetMenuAccessKey();

widget/nsXPLookAndFeel.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ static const char sIntPrefs[][45] = {
174174
"ui.scrollbarFadeDuration",
175175
"ui.contextMenuOffsetVertical",
176176
"ui.contextMenuOffsetHorizontal",
177-
"ui.tooltipOffsetVertical",
178177
"ui.GtkCSDAvailable",
179178
"ui.GtkCSDTransparencyAvailable",
180179
"ui.GtkCSDMinimizeButton",

widget/windows/WinEventObserver.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "mozilla/Logging.h"
2525
#include "mozilla/LookAndFeel.h"
2626
#include "mozilla/WindowsVersion.h"
27-
#include "nsLookAndFeel.h"
2827
#include "nsStringFwd.h"
2928
#include "nsWindowDbg.h"
3029
#include "nsdefs.h"
@@ -177,11 +176,10 @@ static void OnSettingsChange(WPARAM wParam, LPARAM lParam) {
177176
case SPI_SETCLIENTAREAANIMATION:
178177
case SPI_SETKEYBOARDDELAY:
179178
case SPI_SETMOUSEVANISH:
180-
case MOZ_SPI_SETCURSORSIZE:
181179
// These need to update LookAndFeel cached values.
182180
//
183181
// They affect reduced motion settings / caret blink count / show pointer
184-
// while typing / tooltip offset, so no need to invalidate style / layout.
182+
// while typing, so no need to invalidate style / layout.
185183
NotifyThemeChanged(widget::ThemeChangeKind::MediaQueriesOnly);
186184
return;
187185

widget/windows/nsLookAndFeel.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,6 @@ static int32_t GetSystemParam(long flag, int32_t def) {
4040
return ::SystemParametersInfo(flag, 0, &value, 0) ? value : def;
4141
}
4242

43-
static int32_t GetTooltipOffsetVertical() {
44-
static constexpr DWORD kDefaultCursorSize = 32;
45-
const DWORD cursorSize =
46-
GetSystemParam(MOZ_SPI_CURSORSIZE, kDefaultCursorSize);
47-
if (cursorSize == kDefaultCursorSize) {
48-
return LookAndFeel::kDefaultTooltipOffset;
49-
}
50-
return std::ceilf(float(LookAndFeel::kDefaultTooltipOffset) *
51-
float(cursorSize) / float(kDefaultCursorSize));
52-
}
53-
5443
static bool SystemWantsDarkTheme() {
5544
if (nsUXThemeData::IsHighContrastOn()) {
5645
return LookAndFeel::IsDarkColor(
@@ -619,9 +608,6 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
619608
case IntID::ContextMenuOffsetHorizontal:
620609
aResult = 2;
621610
break;
622-
case IntID::TooltipOffsetVertical:
623-
aResult = GetTooltipOffsetVertical();
624-
break;
625611
case IntID::SystemUsesDarkTheme:
626612
aResult = SystemWantsDarkTheme();
627613
break;

widget/windows/nsLookAndFeel.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@
4040
#define SYS_COLOR_MAX 30
4141
#define SYS_COLOR_COUNT (SYS_COLOR_MAX - SYS_COLOR_MIN + 1)
4242

43-
// Undocumented SPI, see bug 1712669 comment 4.
44-
#define MOZ_SPI_CURSORSIZE 0x2028
45-
#define MOZ_SPI_SETCURSORSIZE 0x2029
46-
4743
namespace mozilla::widget::WinRegistry {
4844
class KeyWatcher;
4945
}

widget/windows/nsWindow.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979

8080
#include "mozilla/widget/WinEventObserver.h"
8181
#include "mozilla/widget/WinMessages.h"
82-
#include "nsLookAndFeel.h"
8382
#include "nsWindow.h"
8483
#include "nsWindowTaskbarConcealer.h"
8584
#include "nsAppRunner.h"

0 commit comments

Comments
 (0)