From 69d7cf9cea8ae0e2fb630104c2be892e027a57bd Mon Sep 17 00:00:00 2001 From: Pale Moon Date: Sat, 20 Jan 2018 12:04:19 +0100 Subject: [PATCH] Issue #1595 part 5: Remove Vista checks in Windows widget code --- widget/windows/KeyboardLayout.cpp | 22 +- widget/windows/WinMouseScrollHandler.cpp | 4 +- widget/windows/WinUtils.cpp | 2 +- widget/windows/nsDataObj.cpp | 3 +- widget/windows/nsFilePicker.cpp | 45 +-- widget/windows/nsLookAndFeel.cpp | 12 +- widget/windows/nsNativeThemeWin.cpp | 364 ++++++++--------------- widget/windows/nsTextStore.cpp | 144 +++------ widget/windows/nsUXThemeData.cpp | 9 +- widget/windows/nsWindow.cpp | 36 +-- 10 files changed, 202 insertions(+), 439 deletions(-) diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 58667f79e6..864b2a4a57 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -1016,9 +1016,7 @@ NativeKey::GetScanCodeWithExtendedFlag() const // MapVirtualKeyEx() has been improved for supporting extended keys since // Vista. When we call it for mapping a scancode of an extended key and // a virtual keycode, we need to add 0xE000 to the scancode. - // On Win XP and Win Server 2003, this doesn't support. On them, we have - // no way to get virtual keycodes from scancode of extended keys. - if (!mIsExtended || !IsVistaOrLater()) { + if (!mIsExtended) { return mScanCode; } return (0xE000 | mScanCode); @@ -1094,12 +1092,7 @@ bool NativeKey::CanComputeVirtualKeyCodeFromScanCode() const { // Vista or later supports ScanCodeEx. - if (IsVistaOrLater()) { - return true; - } - // Otherwise, MapVirtualKeyEx() can compute virtual keycode only with - // non-extended key. - return !mIsExtended; + return true; } uint8_t @@ -1125,8 +1118,7 @@ NativeKey::ComputeScanCodeExFromVirtualKeyCode(UINT aVirtualKeyCode) const { return static_cast( ::MapVirtualKeyEx(aVirtualKeyCode, - IsVistaOrLater() ? MAPVK_VK_TO_VSC_EX : - MAPVK_VK_TO_VSC, + MAPVK_VK_TO_VSC_EX, mKeyboardLayout)); } @@ -2384,8 +2376,7 @@ KeyboardLayout::LoadLayout(HKL aLayout) #ifdef PR_LOGGING if (PR_LOG_TEST(sKeyboardLayoutLogger, PR_LOG_DEBUG)) { static const UINT kExtendedScanCode[] = { 0x0000, 0xE000 }; - static const UINT kMapType = - IsVistaOrLater() ? MAPVK_VSC_TO_VK_EX : MAPVK_VSC_TO_VK; + static const UINT kMapType = MAPVK_VSC_TO_VK_EX; PR_LOG(sKeyboardLayoutLogger, PR_LOG_DEBUG, ("Logging virtual keycode values for scancode (0x%p)...", mKeyboardLayout)); @@ -2397,11 +2388,6 @@ KeyboardLayout::LoadLayout(HKL aLayout) PR_LOG(sKeyboardLayoutLogger, PR_LOG_DEBUG, ("0x%04X, %s", scanCode, kVirtualKeyName[virtualKeyCode])); } - // XP and Server 2003 don't support 0xE0 prefix of the scancode. - // Therefore, we don't need to continue on them. - if (!IsVistaOrLater()) { - break; - } } } #endif // #ifdef PR_LOGGING diff --git a/widget/windows/WinMouseScrollHandler.cpp b/widget/windows/WinMouseScrollHandler.cpp index 822a364670..8f37578abc 100644 --- a/widget/windows/WinMouseScrollHandler.cpp +++ b/widget/windows/WinMouseScrollHandler.cpp @@ -945,9 +945,7 @@ MouseScrollHandler::SystemSettings::Init() PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, ("MouseScroll::SystemSettings::Init(): ::SystemParametersInfo(" "SPI_GETWHEELSCROLLCHARS) failed, %s", - IsVistaOrLater() ? - "this is unexpected on Vista or later" : - "but on XP or earlier, this is not a problem")); + "this is unexpected.")); mScrollChars = 1; } diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp index 25dd909cc7..e13d20467a 100644 --- a/widget/windows/WinUtils.cpp +++ b/widget/windows/WinUtils.cpp @@ -437,7 +437,7 @@ WinUtils::Initialize() gWindowsLog = PR_NewLogModule("Widget"); } #endif - if (!sDwmDll && IsVistaOrLater()) { + if (!sDwmDll) { sDwmDll = ::LoadLibraryW(kDwmLibraryName); if (sDwmDll) { diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp index 44c4865f80..38068f0967 100644 --- a/widget/windows/nsDataObj.cpp +++ b/widget/windows/nsDataObj.cpp @@ -1138,8 +1138,7 @@ nsDataObj :: GetFileContentsInternetShortcut ( FORMATETC& aFE, STGMEDIUM& aSTG ) const char *shortcutFormatStr; int totalLen; nsCString path; - if (!Preferences::GetBool(kShellIconPref, true) || - !IsVistaOrLater()) { + if (!Preferences::GetBool(kShellIconPref, true)) { shortcutFormatStr = "[InternetShortcut]\r\nURL=%s\r\n"; const int formatLen = strlen(shortcutFormatStr) - 2; // don't include %s totalLen = formatLen + asciiUrl.Length(); // don't include null character diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp index 22e9033172..57626bd3bc 100644 --- a/widget/windows/nsFilePicker.cpp +++ b/widget/windows/nsFilePicker.cpp @@ -25,7 +25,6 @@ #include "WinUtils.h" #include "nsPIDOMWindow.h" -using mozilla::IsVistaOrLater; using namespace mozilla::widget; char16_t *nsFilePicker::mLastUsedUnicodeDirectory; @@ -689,15 +688,6 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir) OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_EXPLORER; - // Windows Vista and up won't allow you to use the new looking dialogs with - // a hook procedure. The hook procedure fixes a problem on XP dialogs for - // file picker visibility. Vista and up automatically ensures the file - // picker is always visible. - if (!IsVistaOrLater()) { - ofn.lpfnHook = FilePickerHook; - ofn.Flags |= OFN_ENABLEHOOK; - } - // Handle add to recent docs settings if (IsPrivacyModeEnabled() || !mAddToRecentDocs) { ofn.Flags |= OFN_DONTADDTORECENT; @@ -742,24 +732,9 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir) case modeOpenMultiple: ofn.Flags |= OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT; - // The hook set here ensures that the buffer returned will always be - // large enough to hold all selected files. The hook may modify the - // value of ofn.lpstrFile and deallocate the old buffer that it pointed - // to (fileBuffer). The hook assumes that the passed in value is heap - // allocated and that the returned value should be freed by the caller. - // If the hook changes the buffer, it will deallocate the old buffer. - // This fix would be nice to have in Vista and up, but it would force - // the file picker to use the old style dialogs because hooks are not - // allowed in the new file picker UI. We need to eventually move to - // the new Common File Dialogs for Vista and up. - if (!IsVistaOrLater()) { - ofn.lpfnHook = MultiFilePickerHook; - fileBuffer.forget(); - result = FilePickerWrapper(&ofn, PICKER_TYPE_OPEN); - fileBuffer = ofn.lpstrFile; - } else { - result = FilePickerWrapper(&ofn, PICKER_TYPE_OPEN); - } + // XXX: We need to eventually move to + // the new Common File Dialogs for Windows. + result = FilePickerWrapper(&ofn, PICKER_TYPE_OPEN); break; case modeSave: @@ -1044,20 +1019,18 @@ nsFilePicker::ShowW(int16_t *aReturnVal) mUnicodeFile.Truncate(); mFiles.Clear(); - // Launch the XP file/folder picker on XP and as a fallback on Vista+. + // Launch the XP-style file/folder picker as a fallback. // The CoCreateInstance call to CLSID_FileOpenDialog fails with "(0x80040111) // ClassFactory cannot supply requested class" when the checkbox for // Disable Visual Themes is on in the compatability tab within the shortcut // properties. bool result = false, wasInitError = true; if (mMode == modeGetFolder) { - if (IsVistaOrLater()) - result = ShowFolderPicker(initialDir, wasInitError); + result = ShowFolderPicker(initialDir, wasInitError); if (!result && wasInitError) result = ShowXPFolderPicker(initialDir); } else { - if (IsVistaOrLater()) - result = ShowFilePicker(initialDir, wasInitError); + result = ShowFilePicker(initialDir, wasInitError); if (!result && wasInitError) result = ShowXPFilePicker(initialDir); } @@ -1248,11 +1221,7 @@ nsFilePicker::AppendXPFilter(const nsAString& aTitle, const nsAString& aFilter) NS_IMETHODIMP nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) { - if (IsVistaOrLater()) { - mComFilterList.Append(aTitle, aFilter); - } else { - AppendXPFilter(aTitle, aFilter); - } + mComFilterList.Append(aTitle, aFilter); return NS_OK; } diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp index 0239cc0876..56979fd291 100644 --- a/widget/windows/nsLookAndFeel.cpp +++ b/widget/windows/nsLookAndFeel.cpp @@ -34,10 +34,8 @@ nsLookAndFeel::GetOperatingSystemVersion() version = eOperatingSystemVersion_Windows8; } else if (IsWin7OrLater()) { version = eOperatingSystemVersion_Windows7; - } else if (IsVistaOrLater()) { - version = eOperatingSystemVersion_WindowsVista; } else { - version = eOperatingSystemVersion_WindowsXP; + version = eOperatingSystemVersion_WindowsVista; } return version; @@ -193,7 +191,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) idx = COLOR_HIGHLIGHT; break; case eColorID__moz_menubarhovertext: - if (!IsVistaOrLater() || !IsAppThemed()) + if (!IsAppThemed()) { idx = nsUXThemeData::sFlatMenus ? COLOR_HIGHLIGHTTEXT : @@ -202,7 +200,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) } // Fall through case eColorID__moz_menuhovertext: - if (IsVistaOrLater() && IsAppThemed()) + if (IsAppThemed()) { res = ::GetColorFromTheme(eUXMenu, MENU_POPUPITEM, MPI_HOT, TMT_TEXTCOLOR, aColor); @@ -295,7 +293,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) aColor = NS_RGB(0, 0, 0); return NS_OK; case eColorID__moz_win_mediatext: - if (IsVistaOrLater() && IsAppThemed()) { + if (IsAppThemed()) { res = ::GetColorFromTheme(eUXMediaToolbar, TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor); if (NS_SUCCEEDED(res)) @@ -305,7 +303,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) idx = COLOR_WINDOWTEXT; break; case eColorID__moz_win_communicationstext: - if (IsVistaOrLater() && IsAppThemed()) + if (IsAppThemed()) { res = ::GetColorFromTheme(eUXCommunicationsToolbar, TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor); diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp index 4168572b20..25a56fbdcc 100644 --- a/widget/windows/nsNativeThemeWin.cpp +++ b/widget/windows/nsNativeThemeWin.cpp @@ -38,7 +38,6 @@ #include "nsUXThemeConstants.h" #include -using mozilla::IsVistaOrLater; using namespace mozilla; using namespace mozilla::widget; @@ -353,8 +352,6 @@ AddPaddingRect(nsIntSize* aSize, CaptionButton button) { RECT offset; if (!IsAppThemed()) offset = buttonData[CAPTION_CLASSIC].hotPadding[button]; - else if (!IsVistaOrLater()) - offset = buttonData[CAPTION_XPTHEME].hotPadding[button]; else offset = buttonData[CAPTION_BASIC].hotPadding[button]; aSize->width += offset.left + offset.right; @@ -368,8 +365,6 @@ OffsetBackgroundRect(RECT& rect, CaptionButton button) { RECT offset; if (!IsAppThemed()) offset = buttonData[CAPTION_CLASSIC].hotPadding[button]; - else if (!IsVistaOrLater()) - offset = buttonData[CAPTION_XPTHEME].hotPadding[button]; else offset = buttonData[CAPTION_BASIC].hotPadding[button]; rect.left += offset.left; @@ -432,15 +427,9 @@ static int32_t GetProgressOverlayStyle(bool aIsVertical) { if (aIsVertical) { - if (IsVistaOrLater()) { - return PP_MOVEOVERLAYVERT; - } - return PP_CHUNKVERT; + return PP_MOVEOVERLAYVERT; } else { - if (IsVistaOrLater()) { - return PP_MOVEOVERLAY; - } - return PP_CHUNK; + return PP_MOVEOVERLAY; } } @@ -452,14 +441,11 @@ GetProgressOverlayStyle(bool aIsVertical) static int32_t GetProgressOverlaySize(bool aIsVertical, bool aIsIndeterminate) { - if (IsVistaOrLater()) { - if (aIsVertical) { - return aIsIndeterminate ? kProgressVerticalIndeterminateOverlaySize - : kProgressVerticalOverlaySize; - } - return kProgressHorizontalVistaOverlaySize; + if (aIsVertical) { + return aIsIndeterminate ? kProgressVerticalIndeterminateOverlaySize + : kProgressVerticalOverlaySize; } - return kProgressHorizontalXPOverlaySize; + return kProgressHorizontalVistaOverlaySize; } /* @@ -660,12 +646,6 @@ nsNativeThemeWin::DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType, RECT adjWidgetRect, adjClipRect; adjWidgetRect = *aWidgetRect; adjClipRect = *aClipRect; - if (!IsVistaOrLater()) { - // Adjust clipping out by one pixel. XP progress meters are inset, - // Vista+ are not. - InflateRect(&adjWidgetRect, 1, 1); - InflateRect(&adjClipRect, 1, 1); - } nsIFrame* parentFrame = aFrame->GetParent(); if (!parentFrame) { @@ -680,20 +660,13 @@ nsNativeThemeWin::DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType, bool indeterminate = IsIndeterminateProgress(parentFrame, eventStates); bool animate = indeterminate; - if (IsVistaOrLater()) { - // Vista and up progress meter is fill style, rendered here. We render - // the pulse overlay in the follow up section below. - DrawThemeBackground(aTheme, aHdc, aPart, aState, - &adjWidgetRect, &adjClipRect); - if (!IsProgressMeterFilled(aFrame)) { - animate = true; - } - } else if (!indeterminate) { - // XP progress meters are 'chunk' style. - DrawChunkProgressMeter(aTheme, aHdc, aPart, aState, aFrame, - &adjWidgetRect, &adjClipRect, aAppUnits, - indeterminate, vertical, IsFrameRTL(aFrame)); - } + // Progress meter is fill style, rendered here. We render + // the pulse overlay in the follow-up section below. + DrawThemeBackground(aTheme, aHdc, aPart, aState, + &adjWidgetRect, &adjClipRect); + if (!IsProgressMeterFilled(aFrame)) { + animate = true; + } if (animate) { // Indeterminate rendering @@ -701,15 +674,8 @@ nsNativeThemeWin::DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType, RECT overlayRect = CalculateProgressOverlayRect(aFrame, &adjWidgetRect, vertical, indeterminate, false); - if (IsVistaOrLater()) { - DrawThemeBackground(aTheme, aHdc, overlayPart, aState, &overlayRect, - &adjClipRect); - } else { - DrawChunkProgressMeter(aTheme, aHdc, overlayPart, aState, aFrame, - &overlayRect, &adjClipRect, aAppUnits, - indeterminate, vertical, IsFrameRTL(aFrame)); - } - + DrawThemeBackground(aTheme, aHdc, overlayPart, aState, &overlayRect, + &adjClipRect); if (!QueueAnimatedContentForRefresh(aFrame->GetContent(), 60)) { NS_WARNING("unable to animate progress widget!"); } @@ -719,15 +685,6 @@ nsNativeThemeWin::DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType, HANDLE nsNativeThemeWin::GetTheme(uint8_t aWidgetType) { - if (!IsVistaOrLater()) { - // On XP or earlier, render dropdowns as textfields; - // doing it the right way works fine with the MS themes, - // but breaks on a lot of custom themes (presumably because MS - // apps do the textfield border business as well). - if (aWidgetType == NS_THEME_DROPDOWN) - aWidgetType = NS_THEME_TEXTFIELD; - } - switch (aWidgetType) { case NS_THEME_BUTTON: case NS_THEME_RADIO: @@ -740,9 +697,7 @@ nsNativeThemeWin::GetTheme(uint8_t aWidgetType) case NS_THEME_FOCUS_OUTLINE: return nsUXThemeData::GetTheme(eUXEdit); case NS_THEME_TOOLTIP: - // XP/2K3 should force a classic treatment of tooltips - return !IsVistaOrLater() ? - nullptr : nsUXThemeData::GetTheme(eUXTooltip); + return nsUXThemeData::GetTheme(eUXTooltip); case NS_THEME_TOOLBOX: return nsUXThemeData::GetTheme(eUXRebar); case NS_THEME_WIN_MEDIA_TOOLBOX: @@ -869,12 +824,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, int32_t& aPart, int32_t& aState) { - if (!IsVistaOrLater()) { - // See GetTheme - if (aWidgetType == NS_THEME_DROPDOWN) - aWidgetType = NS_THEME_TEXTFIELD; - } - switch (aWidgetType) { case NS_THEME_BUTTON: { aPart = BP_BUTTON; @@ -947,63 +896,45 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, case NS_THEME_TEXTFIELD_MULTILINE: { EventStates eventState = GetContentState(aFrame, aWidgetType); - if (IsVistaOrLater()) { - /* Note: the NOSCROLL type has a rounded corner in each - * corner. The more specific HSCROLL, VSCROLL, HVSCROLL types - * have side and/or top/bottom edges rendered as straight - * horizontal lines with sharp corners to accommodate a - * scrollbar. However, the scrollbar gets rendered on top of - * this for us, so we don't care, and can just use NOSCROLL - * here. - */ - aPart = TFP_EDITBORDER_NOSCROLL; + /* Note: the NOSCROLL type has a rounded corner in each + * corner. The more specific HSCROLL, VSCROLL, HVSCROLL types + * have side and/or top/bottom edges rendered as straight + * horizontal lines with sharp corners to accommodate a + * scrollbar. However, the scrollbar gets rendered on top of + * this for us, so we don't care, and can just use NOSCROLL + * here. + */ + aPart = TFP_EDITBORDER_NOSCROLL; - if (!aFrame) { - aState = TFS_EDITBORDER_NORMAL; - } else if (IsDisabled(aFrame, eventState)) { - aState = TFS_EDITBORDER_DISABLED; - } else if (IsReadOnly(aFrame)) { - /* no special read-only state */ - aState = TFS_EDITBORDER_NORMAL; - } else { - nsIContent* content = aFrame->GetContent(); - - /* XUL textboxes don't get focused themselves, because they have child - * html:input.. but we can check the XUL focused attributes on them - */ - if (content && content->IsXUL() && IsFocused(aFrame)) - aState = TFS_EDITBORDER_FOCUSED; - else if (eventState.HasAtLeastOneOfStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS)) - aState = TFS_EDITBORDER_FOCUSED; - else if (eventState.HasState(NS_EVENT_STATE_HOVER)) - aState = TFS_EDITBORDER_HOVER; - else - aState = TFS_EDITBORDER_NORMAL; - } + if (!aFrame) { + aState = TFS_EDITBORDER_NORMAL; + } else if (IsDisabled(aFrame, eventState)) { + aState = TFS_EDITBORDER_DISABLED; + } else if (IsReadOnly(aFrame)) { + /* no special read-only state */ + aState = TFS_EDITBORDER_NORMAL; } else { - aPart = TFP_TEXTFIELD; - - if (!aFrame) - aState = TS_NORMAL; - else if (IsDisabled(aFrame, eventState)) - aState = TS_DISABLED; - else if (IsReadOnly(aFrame)) - aState = TFS_READONLY; + nsIContent* content = aFrame->GetContent(); + + /* XUL textboxes don't get focused themselves, because they have child + * html:input.. but we can check the XUL focused attributes on them + */ + if (content && content->IsXUL() && IsFocused(aFrame)) + aState = TFS_EDITBORDER_FOCUSED; + else if (eventState.HasAtLeastOneOfStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS)) + aState = TFS_EDITBORDER_FOCUSED; + else if (eventState.HasState(NS_EVENT_STATE_HOVER)) + aState = TFS_EDITBORDER_HOVER; else - aState = StandardGetState(aFrame, aWidgetType, true); + aState = TFS_EDITBORDER_NORMAL; } return NS_OK; } case NS_THEME_FOCUS_OUTLINE: { - if (IsVistaOrLater()) { - // XXX the EDITBORDER values don't respect DTBG_OMITCONTENT - aPart = TFP_TEXTFIELD; //TFP_EDITBORDER_NOSCROLL; - aState = TS_FOCUSED; //TFS_EDITBORDER_FOCUSED; - } else { - aPart = TFP_TEXTFIELD; - aState = TS_FOCUSED; - } + // XXX the EDITBORDER values don't respect DTBG_OMITCONTENT + aPart = TFP_TEXTFIELD; //TFP_EDITBORDER_NOSCROLL; + aState = TS_FOCUSED; //TFS_EDITBORDER_FOCUSED; return NS_OK; } case NS_THEME_TOOLTIP: { @@ -1028,11 +959,9 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, EventStates eventStates = GetContentState(parentFrame, aWidgetType); if (aWidgetType == NS_THEME_PROGRESSBAR_CHUNK_VERTICAL || IsVerticalProgress(parentFrame)) { - aPart = IsVistaOrLater() ? - PP_FILLVERT : PP_CHUNKVERT; + aPart = PP_FILLVERT; } else { - aPart = IsVistaOrLater() ? - PP_FILL : PP_CHUNK; + aPart = PP_FILL; } aState = PBBVS_NORMAL; @@ -1096,8 +1025,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, aState += TS_ACTIVE; else if (eventState.HasState(NS_EVENT_STATE_HOVER)) aState += TS_HOVER; - else if (IsVistaOrLater() && - parentState.HasState(NS_EVENT_STATE_HOVER)) + else if (parentState.HasState(NS_EVENT_STATE_HOVER)) aState = (aWidgetType - NS_THEME_SCROLLBAR_BUTTON_UP) + SP_BUTTON_IMPLICIT_HOVER_BASE; else aState += TS_NORMAL; @@ -1200,14 +1128,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, case NS_THEME_SCROLLBAR: case NS_THEME_SCROLLBAR_SMALL: { aState = 0; - if (IsVistaOrLater()) { - // On vista, they have a part - aPart = RP_BACKGROUND; - } else { - // Otherwise, they don't. (But I bet - // RP_BACKGROUND would work here, too); - aPart = 0; - } + aPart = RP_BACKGROUND; return NS_OK; } case NS_THEME_TOOLBAR: { @@ -1332,8 +1253,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, aFrame = parentFrame; EventStates eventState = GetContentState(aFrame, aWidgetType); - aPart = IsVistaOrLater() ? - CBP_DROPMARKER_VISTA : CBP_DROPMARKER; + aPart = CBP_DROPMARKER_VISTA; // For HTML controls with author styling, we should fall // back to the old dropmarker style to avoid clashes with @@ -1353,28 +1273,26 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, else isOpen = IsOpenButton(aFrame); - if (IsVistaOrLater()) { - if (isHTML || IsMenuListEditable(aFrame)) { - if (isOpen) { - /* Hover is propagated, but we need to know whether we're - * hovering just the combobox frame, not the dropdown frame. - * But, we can't get that information, since hover is on the - * content node, and they share the same content node. So, - * instead, we cheat -- if the dropdown is open, we always - * show the hover state. This looks fine in practice. - */ - aState = TS_HOVER; - return NS_OK; - } - } else { - /* On Vista, the dropdown indicator on a menulist button in - * chrome is not given a hover effect. When the frame isn't - * isn't HTML content, we cheat and force the dropdown state - * to be normal. (Bug 430434) + if (isHTML || IsMenuListEditable(aFrame)) { + if (isOpen) { + /* Hover is propagated, but we need to know whether we're + * hovering just the combobox frame, not the dropdown frame. + * But, we can't get that information, since hover is on the + * content node, and they share the same content node. So, + * instead, we cheat -- if the dropdown is open, we always + * show the hover state. This looks fine in practice. */ - aState = TS_NORMAL; + aState = TS_HOVER; return NS_OK; } + } else { + /* The dropdown indicator on a menulist button in + * chrome is not given a hover effect. When the frame isn't + * HTML content, we cheat and force the dropdown state + * to be normal. (Bug 430434) + */ + aState = TS_NORMAL; + return NS_OK; } aState = TS_NORMAL; @@ -1904,10 +1822,9 @@ RENDER_AGAIN: ::GetViewportOrgEx(hdc, &vpOrg); ::SetBrushOrgEx(hdc, vpOrg.x + widgetRect.left, vpOrg.y + widgetRect.top, nullptr); - // On vista, choose our own colors and draw an XP style half focus rect + // Choose our own colors and draw an XP style half focus rect // for focused checkboxes and a full rect when active. - if (IsVistaOrLater() && - aWidgetType == NS_THEME_CHECKBOX) { + if (aWidgetType == NS_THEME_CHECKBOX) { LOGBRUSH lb; lb.lbStyle = BS_SOLID; lb.lbColor = RGB(255,255,255); @@ -2120,39 +2037,37 @@ nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext, return true; } - if (IsVistaOrLater()) { - if (aWidgetType == NS_THEME_NUMBER_INPUT || - aWidgetType == NS_THEME_TEXTFIELD || - aWidgetType == NS_THEME_TEXTFIELD_MULTILINE || - aWidgetType == NS_THEME_DROPDOWN) - { - /* If we have author-specified padding for these elements, don't do the fixups below */ - if (aFrame->PresContext()->HasAuthorSpecifiedRules(aFrame, NS_AUTHOR_SPECIFIED_PADDING)) - return false; - } + if (aWidgetType == NS_THEME_NUMBER_INPUT || + aWidgetType == NS_THEME_TEXTFIELD || + aWidgetType == NS_THEME_TEXTFIELD_MULTILINE || + aWidgetType == NS_THEME_DROPDOWN) + { + /* If we have author-specified padding for these elements, don't do the fixups below */ + if (aFrame->PresContext()->HasAuthorSpecifiedRules(aFrame, NS_AUTHOR_SPECIFIED_PADDING)) + return false; + } - /* textfields need extra pixels on all sides, otherwise they - * wrap their content too tightly. The actual border is drawn 1px - * inside the specified rectangle, so Goanna will end up making the - * contents look too small. Instead, we add 2px padding for the - * contents and fix this. (Used to be 1px added, see bug 430212) + /* textfields need extra pixels on all sides, otherwise they + * wrap their content too tightly. The actual border is drawn 1px + * inside the specified rectangle, so Goanna will end up making the + * contents look too small. Instead, we add 2px padding for the + * contents and fix this. (Used to be 1px added, see bug 430212) + */ + if (aWidgetType == NS_THEME_NUMBER_INPUT || + aWidgetType == NS_THEME_TEXTFIELD || + aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) { + aResult->top = aResult->bottom = 2; + aResult->left = aResult->right = 2; + return true; + } else if (IsHTMLContent(aFrame) && aWidgetType == NS_THEME_DROPDOWN) { + /* For content menulist controls, we need an extra pixel so + * that we have room to draw our focus rectangle stuff. + * Otherwise, the focus rect might overlap the control's + * border. */ - if (aWidgetType == NS_THEME_NUMBER_INPUT || - aWidgetType == NS_THEME_TEXTFIELD || - aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) { - aResult->top = aResult->bottom = 2; - aResult->left = aResult->right = 2; - return true; - } else if (IsHTMLContent(aFrame) && aWidgetType == NS_THEME_DROPDOWN) { - /* For content menulist controls, we need an extra pixel so - * that we have room to draw our focus rectangle stuff. - * Otherwise, the focus rect might overlap the control's - * border. - */ - aResult->top = aResult->bottom = 1; - aResult->left = aResult->right = 1; - return true; - } + aResult->top = aResult->bottom = 1; + aResult->left = aResult->right = 1; + return true; } int32_t right, left, top, bottom; @@ -2216,23 +2131,21 @@ nsNativeThemeWin::GetWidgetOverflow(nsDeviceContext* aContext, * a border only shows up if the widget is being hovered. */ #if 0 - if (IsVistaOrLater()) { - /* We explicitly draw dropdown buttons in HTML content 1px bigger - * up, right, and bottom so that they overlap the dropdown's border - * like they're supposed to. - */ - if (aWidgetType == NS_THEME_DROPDOWN_BUTTON && - IsHTMLContent(aFrame) && - !IsWidgetStyled(aFrame->GetParent()->PresContext(), - aFrame->GetParent(), - NS_THEME_DROPDOWN)) - { - int32_t p2a = aContext->AppUnitsPerDevPixel(); - /* Note: no overflow on the left */ - nsMargin m(p2a, p2a, p2a, 0); - aOverflowRect->Inflate (m); - return true; - } + /* We explicitly draw dropdown buttons in HTML content 1px bigger + * up, right, and bottom so that they overlap the dropdown's border + * like they're supposed to. + */ + if (aWidgetType == NS_THEME_DROPDOWN_BUTTON && + IsHTMLContent(aFrame) && + !IsWidgetStyled(aFrame->GetParent()->PresContext(), + aFrame->GetParent(), + NS_THEME_DROPDOWN)) + { + int32_t p2a = aContext->AppUnitsPerDevPixel(); + /* Note: no overflow on the left */ + nsMargin m(p2a, p2a, p2a, 0); + aOverflowRect->Inflate (m); + return true; } #endif @@ -2348,21 +2261,18 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aF case NS_THEME_SCALE_THUMB_VERTICAL: { *aIsOverridable = false; - // on Vista, GetThemePartAndState returns odd values for + // GetThemePartAndState returns odd values for // scale thumbs, so use a hardcoded size instead. - if (IsVistaOrLater()) { - if (aWidgetType == NS_THEME_SCALE_THUMB_HORIZONTAL || - (aWidgetType == NS_THEME_RANGE_THUMB && IsRangeHorizontal(aFrame))) { - aResult->width = 12; - aResult->height = 20; - } - else { - aResult->width = 20; - aResult->height = 12; - } - return NS_OK; + if (aWidgetType == NS_THEME_SCALE_THUMB_HORIZONTAL || + (aWidgetType == NS_THEME_RANGE_THUMB && IsRangeHorizontal(aFrame))) { + aResult->width = 12; + aResult->height = 20; } - break; + else { + aResult->width = 20; + aResult->height = 12; + } + return NS_OK; } case NS_THEME_SCROLLBAR: @@ -2399,11 +2309,6 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aF // stores that info in nsUXThemeData. aResult->width = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_RESTORE].cx; aResult->height = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_RESTORE].cy; - // For XP, subtract 4 from system metrics dimensions. - if (!IsVistaOrLater()) { - aResult->width -= 4; - aResult->height -= 4; - } AddPaddingRect(aResult, CAPTIONBUTTON_RESTORE); *aIsOverridable = false; return NS_OK; @@ -2411,10 +2316,6 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aF case NS_THEME_WINDOW_BUTTON_MINIMIZE: aResult->width = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_MINIMIZE].cx; aResult->height = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_MINIMIZE].cy; - if (!IsVistaOrLater()) { - aResult->width -= 4; - aResult->height -= 4; - } AddPaddingRect(aResult, CAPTIONBUTTON_MINIMIZE); *aIsOverridable = false; return NS_OK; @@ -2422,10 +2323,6 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aF case NS_THEME_WINDOW_BUTTON_CLOSE: aResult->width = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_CLOSE].cx; aResult->height = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_CLOSE].cy; - if (!IsVistaOrLater()) { - aResult->width -= 4; - aResult->height -= 4; - } AddPaddingRect(aResult, CAPTIONBUTTON_CLOSE); *aIsOverridable = false; return NS_OK; @@ -2543,18 +2440,9 @@ nsNativeThemeWin::WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, return NS_OK; } - // On Vista, the scrollbar buttons need to change state when the track has/doesn't have hover - if (!IsVistaOrLater() && - (aWidgetType == NS_THEME_SCROLLBAR_TRACK_VERTICAL || - aWidgetType == NS_THEME_SCROLLBAR_TRACK_HORIZONTAL)) { - *aShouldRepaint = false; - return NS_OK; - } - // We need to repaint the dropdown arrow in vista HTML combobox controls when // the control is closed to get rid of the hover effect. - if (IsVistaOrLater() && - (aWidgetType == NS_THEME_DROPDOWN || aWidgetType == NS_THEME_DROPDOWN_BUTTON) && + if ((aWidgetType == NS_THEME_DROPDOWN || aWidgetType == NS_THEME_DROPDOWN_BUTTON) && IsHTMLContent(aFrame)) { *aShouldRepaint = true; diff --git a/widget/windows/nsTextStore.cpp b/widget/windows/nsTextStore.cpp index 8fd51654f5..40f80f0748 100644 --- a/widget/windows/nsTextStore.cpp +++ b/widget/windows/nsTextStore.cpp @@ -830,29 +830,16 @@ TSFStaticSink::Init(ITfThreadMgr* aThreadMgr, } // On Vista or later, Windows let us know activate IME changed only with - // ITfInputProcessorProfileActivationSink. However, it's not available on XP. - // On XP, ITfActiveLanguageProfileNotifySink is available for it. + // ITfInputProcessorProfileActivationSink. // NOTE: Each OnActivated() should be called when TSF becomes available. - if (IsVistaOrLater()) { - hr = source->AdviseSink(IID_ITfInputProcessorProfileActivationSink, - static_cast(this), - &mIPProfileCookie); - if (FAILED(hr) || mIPProfileCookie == TF_INVALID_COOKIE) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, - ("TSF: 0x%p TSFStaticSink::Init() FAILED to install " - "ITfInputProcessorProfileActivationSink (0x%08X)", this, hr)); - return false; - } - } else { - hr = source->AdviseSink(IID_ITfActiveLanguageProfileNotifySink, - static_cast(this), - &mLangProfileCookie); - if (FAILED(hr) || mLangProfileCookie == TF_INVALID_COOKIE) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, - ("TSF: 0x%p TSFStaticSink::Init() FAILED to install " - "ITfActiveLanguageProfileNotifySink (0x%08X)", this, hr)); - return false; - } + hr = source->AdviseSink(IID_ITfInputProcessorProfileActivationSink, + static_cast(this), + &mIPProfileCookie); + if (FAILED(hr) || mIPProfileCookie == TF_INVALID_COOKIE) { + PR_LOG(sTextStoreLog, PR_LOG_ERROR, + ("TSF: 0x%p TSFStaticSink::Init() FAILED to install " + "ITfInputProcessorProfileActivationSink (0x%08X)", this, hr)); + return false; } PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, @@ -991,88 +978,40 @@ TSFStaticSink::EnsureInitActiveTIPKeyboard() return true; } - if (IsVistaOrLater()) { - nsRefPtr profileMgr; - HRESULT hr = - mInputProcessorProfiles->QueryInterface(IID_ITfInputProcessorProfileMgr, - getter_AddRefs(profileMgr)); - if (FAILED(hr) || !profileMgr) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, - ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " - "to get input processor profile manager, hr=0x%08X", this, hr)); - return false; - } - - TF_INPUTPROCESSORPROFILE profile; - hr = profileMgr->GetActiveProfile(GUID_TFCAT_TIP_KEYBOARD, &profile); - if (hr == S_FALSE) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, - ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " - "to get active keyboard layout profile due to no active profile, " - "hr=0x%08X", this, hr)); - // XXX Should we call OnActivated() with arguments like non-TIP in this - // case? - return false; - } - if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, - ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " - "to get active TIP keyboard, hr=0x%08X", this, hr)); - return false; - } - - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, - ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), " - "calling OnActivated() manually...", this)); - OnActivated(profile.dwProfileType, profile.langid, profile.clsid, - profile.catid, profile.guidProfile, ::GetKeyboardLayout(0), - TF_IPSINK_FLAG_ACTIVE); - return true; + nsRefPtr profileMgr; + HRESULT hr = + mInputProcessorProfiles->QueryInterface(IID_ITfInputProcessorProfileMgr, + getter_AddRefs(profileMgr)); + if (FAILED(hr) || !profileMgr) { + PR_LOG(sTextStoreLog, PR_LOG_ERROR, + ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " + "to get input processor profile manager, hr=0x%08X", this, hr)); + return false; } - LANGID langID; - HRESULT hr = mInputProcessorProfiles->GetCurrentLanguage(&langID); + TF_INPUTPROCESSORPROFILE profile; + hr = profileMgr->GetActiveProfile(GUID_TFCAT_TIP_KEYBOARD, &profile); + if (hr == S_FALSE) { + PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " + "to get active keyboard layout profile due to no active profile, " + "hr=0x%08X", this, hr)); + // XXX Should we call OnActivated() with arguments like non-TIP in this + // case? + return false; + } if (FAILED(hr)) { PR_LOG(sTextStoreLog, PR_LOG_ERROR, ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " - "to get current language ID, hr=0x%08X", this, hr)); + "to get active TIP keyboard, hr=0x%08X", this, hr)); return false; } - nsRefPtr enumLangProfiles; - hr = mInputProcessorProfiles->EnumLanguageProfiles(langID, - getter_AddRefs(enumLangProfiles)); - if (FAILED(hr) || !enumLangProfiles) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, - ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " - "to get language profiles enumerator, hr=0x%08X", this, hr)); - return false; - } - - TF_LANGUAGEPROFILE profile; - ULONG fetch = 0; - while (SUCCEEDED(enumLangProfiles->Next(1, &profile, &fetch)) && fetch) { - if (!profile.fActive || profile.catid != GUID_TFCAT_TIP_KEYBOARD) { - continue; - } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, - ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), " - "calling OnActivated() manually...", this)); - bool isTIP = profile.guidProfile != GUID_NULL; - OnActivated(isTIP ? TF_PROFILETYPE_INPUTPROCESSOR : - TF_PROFILETYPE_KEYBOARDLAYOUT, - profile.langid, profile.clsid, profile.catid, - profile.guidProfile, ::GetKeyboardLayout(0), - TF_IPSINK_FLAG_ACTIVE); - return true; - } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), " - "calling OnActivated() without active TIP manually...", this)); - OnActivated(TF_PROFILETYPE_KEYBOARDLAYOUT, - langID, CLSID_NULL, GUID_TFCAT_TIP_KEYBOARD, - GUID_NULL, ::GetKeyboardLayout(0), + "calling OnActivated() manually...", this)); + OnActivated(profile.dwProfileType, profile.langid, profile.clsid, + profile.catid, profile.guidProfile, ::GetKeyboardLayout(0), TF_IPSINK_FLAG_ACTIVE); return true; } @@ -4546,7 +4485,7 @@ nsTextStore::Initialize() bool enableTsf = Preferences::GetBool(kPrefNameForceEnableTSF, false) || - (IsVistaOrLater() && Preferences::GetBool(kPrefNameEnableTSF, false)); + Preferences::GetBool(kPrefNameEnableTSF, false); PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, ("TSF: nsTextStore::Initialize(), TSF is %s", enableTsf ? "enabled" : "disabled")); @@ -5054,19 +4993,12 @@ nsTextStore::CurrentKeyboardLayoutHasIME() sInputProcessorProfiles->QueryInterface(IID_ITfInputProcessorProfileMgr, getter_AddRefs(profileMgr)); if (FAILED(hr) || !profileMgr) { - // On Windows Vista or later, ImmIsIME() API always returns true. // If we failed to obtain the profile manager, we cannot know if current // keyboard layout has IME. - if (IsVistaOrLater()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, - ("TSF: nsTextStore::CurrentKeyboardLayoutHasIME() FAILED to query " - "ITfInputProcessorProfileMgr")); - return false; - } - // If the profiles instance doesn't have ITfInputProcessorProfileMgr - // interface, that means probably we're running on WinXP or WinServer2003 - // (except WinServer2003 R2). Then, we should use ImmIsIME(). - return ::ImmIsIME(::GetKeyboardLayout(0)); + PR_LOG(sTextStoreLog, PR_LOG_ERROR, + ("TSF: nsTextStore::CurrentKeyboardLayoutHasIME() FAILED to query " + "ITfInputProcessorProfileMgr")); + return false; } TF_INPUTPROCESSORPROFILE profile; diff --git a/widget/windows/nsUXThemeData.cpp b/widget/windows/nsUXThemeData.cpp index f787bcc7cb..53379f3fae 100644 --- a/widget/windows/nsUXThemeData.cpp +++ b/widget/windows/nsUXThemeData.cpp @@ -142,10 +142,9 @@ nsUXThemeData::InitTitlebarInfo() sCommandButtons[3].cx = sCommandButtons[0].cx * 3; sCommandButtons[3].cy = sCommandButtons[0].cy; - // Use system metrics for pre-vista, otherwise trigger a - // refresh on the next layout. - sTitlebarInfoPopulatedAero = sTitlebarInfoPopulatedThemed = - !IsVistaOrLater(); + // Trigger a refresh on the next layout. + sTitlebarInfoPopulatedAero = sTitlebarInfoPopulatedThemed = false; + } // static @@ -280,7 +279,7 @@ void nsUXThemeData::UpdateNativeThemeInfo() { // Trigger a refresh of themed button metrics if needed - sTitlebarInfoPopulatedThemed = !IsVistaOrLater(); + sTitlebarInfoPopulatedThemed = false; sIsDefaultWindowsTheme = false; sThemeId = LookAndFeel::eWindowsTheme_Generic; diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 0f53f2107f..6262e2966a 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -504,7 +504,7 @@ nsWindow::Create(nsIWidget *aParent, parent = nullptr; } - if (IsVistaOrLater() && !IsWin8OrLater() && + if (!IsWin8OrLater() && HasBogusPopupsDropShadowOnMultiMonitor()) { extendedStyle |= WS_EX_COMPOSITED; } @@ -633,13 +633,11 @@ nsWindow::Create(nsIWidget *aParent, // before any visible windows, and after the profile has been initialized), // do some initialization work. if (sTrimOnMinimize == 2 && mWindowType == eWindowType_invisible) { - // Our internal trim prevention logic is effective on 2K/XP at maintaining - // the working set when windows are minimized, but on Vista and up it has - // little to no effect. Since this feature has been the source of numerous - // bugs over the years, disable it (sTrimOnMinimize=1) on Vista and up. + // Our internal trim prevention logic has little to no effect on current + // Windows versions. Since this feature has been the source of numerous + // bugs over the years, disable it (sTrimOnMinimize=1). sTrimOnMinimize = - Preferences::GetBool("config.trim_on_minimize", - IsVistaOrLater() ? 1 : 0); + Preferences::GetBool("config.trim_on_minimize", 1); sSwitchKeyboardLayout = Preferences::GetBool("intl.keyboard.per_window_layout", false); } @@ -1261,11 +1259,11 @@ bool nsWindow::IsVisible() const * **************************************************************/ -// XP and Vista visual styles sometimes require window clipping regions to be applied for proper +// Visual styles sometimes require window clipping regions to be applied for proper // transparency. These routines are called on size and move operations. void nsWindow::ClearThemeRegion() { - if (IsVistaOrLater() && !HasGlass() && + if (!HasGlass() && (mWindowType == eWindowType_popup && !IsPopupWithTitleBar() && (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) { SetWindowRgn(mWnd, nullptr, false); @@ -1279,7 +1277,7 @@ void nsWindow::SetThemeRegion() // so default constants are used for part and state. At some point we might need part and // state values from nsNativeThemeWin's GetThemePartAndState, but currently windows that // change shape based on state haven't come up. - if (IsVistaOrLater() && !HasGlass() && + if (!HasGlass() && (mWindowType == eWindowType_popup && !IsPopupWithTitleBar() && (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) { HRGN hRgn = nullptr; @@ -3438,17 +3436,13 @@ nsWindow::OverrideSystemMouseScrollSpeed(double aOriginalDeltaX, return NS_OK; } - // Only Vista and later, Windows has the system setting of horizontal - // scrolling by the mouse wheel. - if (IsVistaOrLater()) { - if (!::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &systemSpeed, 0)) { - return NS_ERROR_FAILURE; - } - // The default horizontal scrolling speed is 3, this is defined on the - // document of SystemParametersInfo in MSDN. - if (systemSpeed != kSystemDefaultScrollingSpeed) { - return NS_OK; - } + if (!::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &systemSpeed, 0)) { + return NS_ERROR_FAILURE; + } + // The default horizontal scrolling speed is 3, this is defined on the + // document of SystemParametersInfo in MSDN. + if (systemSpeed != kSystemDefaultScrollingSpeed) { + return NS_OK; } // Limit the overridden delta value from the system settings. The mouse