зеркало из https://github.com/mozilla/gecko-dev.git
Bug 969322 - make :-moz-window-inactive state follow GDK_WINDOW_STATE_FOCUSED when drawing in titlebar r=karlt,stransky
This patch fixes activation of the :-moz-window-inactive pseudoclass in client side decoration during drag operations. It depends on and complements the fixes provided in support of Bug 1491808. Obsoletes D50445 Differential Revision: https://phabricator.services.mozilla.com/D51307 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c3ba51407b
Коммит
1be2b74935
|
@ -3064,6 +3064,14 @@ void nsWindow::OnContainerFocusOutEvent(GdkEventFocus* aEvent) {
|
||||||
|
|
||||||
DispatchDeactivateEvent();
|
DispatchDeactivateEvent();
|
||||||
|
|
||||||
|
if (mDrawInTitlebar) {
|
||||||
|
// DispatchDeactivateEvent() ultimately results in a call to
|
||||||
|
// nsGlobalWindowOuter::ActivateOrDeactivate(), which resets
|
||||||
|
// the mIsActive flag. We call UpdateMozWindowActive() to keep
|
||||||
|
// the flag in sync with GDK_WINDOW_STATE_FOCUSED.
|
||||||
|
UpdateMozWindowActive();
|
||||||
|
}
|
||||||
|
|
||||||
LOGFOCUS(("Done with container focus out [%p]\n", (void*)this));
|
LOGFOCUS(("Done with container focus out [%p]\n", (void*)this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3330,6 +3338,9 @@ void nsWindow::OnWindowStateEvent(GtkWidget* aWidget,
|
||||||
mTitlebarBackdropState =
|
mTitlebarBackdropState =
|
||||||
!(aEvent->new_window_state & GDK_WINDOW_STATE_FOCUSED);
|
!(aEvent->new_window_state & GDK_WINDOW_STATE_FOCUSED);
|
||||||
|
|
||||||
|
// keep mIsActive in sync with GDK_WINDOW_STATE_FOCUSED
|
||||||
|
UpdateMozWindowActive();
|
||||||
|
|
||||||
ForceTitlebarRedraw();
|
ForceTitlebarRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7396,6 +7407,19 @@ nsIFrame* nsWindow::GetFrame(void) {
|
||||||
return view->GetFrame();
|
return view->GetFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nsWindow::UpdateMozWindowActive() {
|
||||||
|
// Update activation state for the :-moz-window-inactive pseudoclass.
|
||||||
|
// Normally, this follows focus; we override it here to follow
|
||||||
|
// GDK_WINDOW_STATE_FOCUSED.
|
||||||
|
mozilla::dom::Document* document = GetDocument();
|
||||||
|
if (document) {
|
||||||
|
nsPIDOMWindowOuter* window = document->GetWindow();
|
||||||
|
if (window) {
|
||||||
|
window->SetActive(!mTitlebarBackdropState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void nsWindow::ForceTitlebarRedraw(void) {
|
void nsWindow::ForceTitlebarRedraw(void) {
|
||||||
MOZ_ASSERT(mDrawInTitlebar, "We should not redraw invisible titlebar.");
|
MOZ_ASSERT(mDrawInTitlebar, "We should not redraw invisible titlebar.");
|
||||||
|
|
||||||
|
@ -7410,8 +7434,11 @@ void nsWindow::ForceTitlebarRedraw(void) {
|
||||||
|
|
||||||
frame = FindTitlebarFrame(frame);
|
frame = FindTitlebarFrame(frame);
|
||||||
if (frame) {
|
if (frame) {
|
||||||
nsLayoutUtils::PostRestyleEvent(frame->GetContent()->AsElement(),
|
nsIContent* content = frame->GetContent();
|
||||||
RestyleHint{0}, nsChangeHint_RepaintFrame);
|
if (content) {
|
||||||
|
nsLayoutUtils::PostRestyleEvent(content->AsElement(), RestyleHint{0},
|
||||||
|
nsChangeHint_RepaintFrame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -625,6 +625,8 @@ class nsWindow final : public nsBaseWidget {
|
||||||
|
|
||||||
virtual int32_t RoundsWidgetCoordinatesTo() override;
|
virtual int32_t RoundsWidgetCoordinatesTo() override;
|
||||||
|
|
||||||
|
void UpdateMozWindowActive();
|
||||||
|
|
||||||
void ForceTitlebarRedraw();
|
void ForceTitlebarRedraw();
|
||||||
|
|
||||||
void SetPopupWindowDecoration(bool aShowOnTaskbar);
|
void SetPopupWindowDecoration(bool aShowOnTaskbar);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче