зеркало из https://github.com/mozilla/gecko-dev.git
Bug 868498: Enable switching between overlay and regular scrollbars without browser restart on Mac OSX. r=roc
This commit is contained in:
Родитель
bfc9abde85
Коммит
e5abe7e1ae
|
@ -726,7 +726,6 @@ GetBrowserRoot(nsIContent* aContent)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
@ -736,6 +735,8 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||
DO_GLOBAL_REFLOW_COUNT("nsHTMLScrollFrame");
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
|
||||
mInner.HandleScrollbarStyleSwitching();
|
||||
|
||||
ScrollReflowState state(this, aReflowState);
|
||||
// sanity check: ensure that if we have no scrollbar, we treat it
|
||||
// as hidden.
|
||||
|
@ -774,10 +775,6 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsRect oldScrollAreaBounds = mInner.mScrollPort;
|
||||
nsRect oldScrolledAreaBounds =
|
||||
mInner.mScrolledFrame->GetScrollableOverflowRectRelativeToParent();
|
||||
// Adjust to a multiple of device pixels to restore the invariant that
|
||||
// oldScrollPosition is a multiple of device pixels. This could have been
|
||||
// thrown out by a zoom change.
|
||||
nsIntPoint ptDevPx;
|
||||
nsPoint oldScrollPosition = mInner.GetScrollPosition();
|
||||
|
||||
state.mComputedBorder = aReflowState.mComputedBorderPadding -
|
||||
|
@ -971,6 +968,23 @@ nsGfxScrollFrameInner::GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState
|
|||
return GetDesiredScrollbarSizes(aState).LeftRight();
|
||||
}
|
||||
|
||||
void
|
||||
nsGfxScrollFrameInner::HandleScrollbarStyleSwitching()
|
||||
{
|
||||
// Check if we switched between scrollbar styles.
|
||||
if (mScrollbarActivity &&
|
||||
LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) == 0) {
|
||||
mScrollbarActivity->Destroy();
|
||||
mScrollbarActivity = nullptr;
|
||||
mOuter->PresContext()->ThemeChanged();
|
||||
}
|
||||
else if (!mScrollbarActivity &&
|
||||
LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
|
||||
mScrollbarActivity = new ScrollbarActivity(do_QueryFrame(mOuter));
|
||||
mOuter->PresContext()->ThemeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULScrollFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||
{
|
||||
|
|
|
@ -269,6 +269,8 @@ public:
|
|||
void ScheduleSyntheticMouseMove();
|
||||
static void ScrollActivityCallback(nsITimer *aTimer, void* anInstance);
|
||||
|
||||
void HandleScrollbarStyleSwitching();
|
||||
|
||||
// owning references to the nsIAnonymousContentCreator-built content
|
||||
nsCOMPtr<nsIContent> mHScrollbarContent;
|
||||
nsCOMPtr<nsIContent> mVScrollbarContent;
|
||||
|
|
|
@ -2808,7 +2808,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||
object:nil];
|
||||
// TODO: replace the string with the constant once we build with the 10.7 SDK
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(systemMetricsChanged)
|
||||
selector:@selector(scrollbarSystemMetricChanged)
|
||||
name:@"NSPreferredScrollerStyleDidChangeNotification"
|
||||
object:nil];
|
||||
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
|
||||
|
@ -2961,6 +2961,18 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||
mGeckoChild->NotifyThemeChanged();
|
||||
}
|
||||
|
||||
- (void)scrollbarSystemMetricChanged
|
||||
{
|
||||
[self systemMetricsChanged];
|
||||
|
||||
if (mGeckoChild) {
|
||||
nsIWidgetListener* listener = mGeckoChild->GetWidgetListener();
|
||||
if (listener) {
|
||||
listener->GetPresShell()->ReconstructFrames();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setNeedsPendingDisplay
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче