Skip to content

Commit df77840

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 b34cf38 commit df77840

File tree

8 files changed

+10
-49
lines changed

8 files changed

+10
-49
lines changed

layout/xul/nsMenuPopupFrame.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,12 +2163,6 @@ nsMargin nsMenuPopupFrame::GetMargin() const {
21632163
margin.left += auOffset.x;
21642164
margin.right += auOffset.x;
21652165
}
2166-
if (mPopupType == PopupType::Tooltip && !IsAnchored()) {
2167-
const auto auOffset =
2168-
CSSPixel::ToAppUnits(LookAndFeel::TooltipOffsetVertical());
2169-
margin.top += auOffset;
2170-
margin.bottom += auOffset;
2171-
}
21722166
// TODO(emilio): We should consider make these properly mirrored (that is,
21732167
// changing -= to += here, and removing the rtl special case), but some tests
21742168
// 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
@@ -389,6 +389,10 @@ tooltip {
389389
pointer-events: none;
390390
}
391391

392+
tooltip:not([position]) {
393+
margin-top: 21px;
394+
}
395+
392396
/**
393397
* It's important that these styles are in a UA sheet, because the default
394398
* tooltip is native anonymous content

widget/LookAndFeel.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ class LookAndFeel {
229229
*/
230230
ContextMenuOffsetVertical,
231231
ContextMenuOffsetHorizontal,
232-
TooltipOffsetVertical,
233232

234233
/*
235234
* A boolean value indicating whether client-side decorations are
@@ -367,11 +366,6 @@ class LookAndFeel {
367366
return GetInt(IntID::UseOverlayScrollbars);
368367
}
369368

370-
static constexpr int32_t kDefaultTooltipOffset = 21;
371-
static int32_t TooltipOffsetVertical() {
372-
return GetInt(IntID::TooltipOffsetVertical, kDefaultTooltipOffset);
373-
}
374-
375369
// Returns keyCode value of a modifier key which is used for accesskey.
376370
// Returns 0 if the platform doesn't support access key.
377371
static uint32_t GetMenuAccessKey();

widget/nsXPLookAndFeel.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ static const char sIntPrefs[][45] = {
171171
"ui.scrollbarFadeDuration",
172172
"ui.contextMenuOffsetVertical",
173173
"ui.contextMenuOffsetHorizontal",
174-
"ui.tooltipOffsetVertical",
175174
"ui.GtkCSDAvailable",
176175
"ui.GtkCSDMinimizeButton",
177176
"ui.GtkCSDMaximizeButton",

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(
@@ -611,9 +600,6 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
611600
case IntID::ContextMenuOffsetHorizontal:
612601
aResult = 2;
613602
break;
614-
case IntID::TooltipOffsetVertical:
615-
aResult = GetTooltipOffsetVertical();
616-
break;
617603
case IntID::SystemUsesDarkTheme:
618604
aResult = SystemWantsDarkTheme();
619605
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: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
#include <limits>
7979

8080
#include "mozilla/widget/WinMessages.h"
81-
#include "nsLookAndFeel.h"
8281
#include "nsWindow.h"
8382
#include "nsWindowTaskbarConcealer.h"
8483
#include "nsAppRunner.h"
@@ -5293,12 +5292,10 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
52935292

52945293
case WM_SETTINGCHANGE: {
52955294
if (wParam == SPI_SETCLIENTAREAANIMATION ||
5296-
wParam == SPI_SETKEYBOARDDELAY || wParam == SPI_SETMOUSEVANISH ||
5297-
wParam == MOZ_SPI_SETCURSORSIZE) {
5295+
wParam == SPI_SETKEYBOARDDELAY || wParam == SPI_SETMOUSEVANISH) {
52985296
// These need to update LookAndFeel cached values.
52995297
// They affect reduced motion settings / caret blink count / show
5300-
// pointer while typing / tooltip offset, so no need to invalidate style
5301-
// / layout.
5298+
// pointer while typing, so no need to invalidate style / layout.
53025299
NotifyThemeChanged(widget::ThemeChangeKind::MediaQueriesOnly);
53035300
break;
53045301
}

0 commit comments

Comments
 (0)