Bug 1769012 - Deal with <xul:tree> scrollbars in Theme.cpp. r=mstange

Tree has a non-anonymous scrollbar whose mediator is the
nsTreeBodyFrame:

  https://searchfox.org/mozilla-central/rev/b72e9d7d63bf499d1d8168291b93d4ec7fde236e/toolkit/content/widgets/tree.js#601

So use the scrollbar mediator interface rather than poking at the scroll
frame directly.

Differential Revision: https://phabricator.services.mozilla.com/D146158
This commit is contained in:
Emilio Cobos Álvarez 2022-05-12 23:21:05 +00:00
Родитель f7fd6fc688
Коммит 211ac07df9
1 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -19,7 +19,8 @@
#include "mozilla/webrender/WebRenderAPI.h"
#include "nsCSSColorUtils.h"
#include "nsCSSRendering.h"
#include "nsIScrollableFrame.h"
#include "nsScrollbarFrame.h"
#include "nsIScrollbarMediator.h"
#include "nsDeviceContext.h"
#include "nsLayoutUtils.h"
#include "nsRangeFrame.h"
@ -1048,11 +1049,13 @@ static ScrollbarDrawing::ScrollbarKind ComputeScrollbarKind(
if (NS_WARN_IF(!scrollbar)) {
return ScrollbarDrawing::ScrollbarKind::VerticalRight;
}
nsIScrollableFrame* sf = do_QueryFrame(scrollbar->GetParent());
if (NS_WARN_IF(!sf)) {
MOZ_ASSERT(scrollbar->IsScrollbarFrame());
nsIScrollbarMediator* sm =
static_cast<nsScrollbarFrame*>(scrollbar)->GetScrollbarMediator();
if (NS_WARN_IF(!sm)) {
return ScrollbarDrawing::ScrollbarKind::VerticalRight;
}
return sf->IsScrollbarOnRight()
return sm->IsScrollbarOnRight()
? ScrollbarDrawing::ScrollbarKind::VerticalRight
: ScrollbarDrawing::ScrollbarKind::VerticalLeft;
}