зеркало из 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();
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -3330,6 +3338,9 @@ void nsWindow::OnWindowStateEvent(GtkWidget* aWidget,
|
|||
mTitlebarBackdropState =
|
||||
!(aEvent->new_window_state & GDK_WINDOW_STATE_FOCUSED);
|
||||
|
||||
// keep mIsActive in sync with GDK_WINDOW_STATE_FOCUSED
|
||||
UpdateMozWindowActive();
|
||||
|
||||
ForceTitlebarRedraw();
|
||||
}
|
||||
|
||||
|
@ -7396,6 +7407,19 @@ nsIFrame* nsWindow::GetFrame(void) {
|
|||
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) {
|
||||
MOZ_ASSERT(mDrawInTitlebar, "We should not redraw invisible titlebar.");
|
||||
|
||||
|
@ -7410,8 +7434,11 @@ void nsWindow::ForceTitlebarRedraw(void) {
|
|||
|
||||
frame = FindTitlebarFrame(frame);
|
||||
if (frame) {
|
||||
nsLayoutUtils::PostRestyleEvent(frame->GetContent()->AsElement(),
|
||||
RestyleHint{0}, nsChangeHint_RepaintFrame);
|
||||
nsIContent* content = frame->GetContent();
|
||||
if (content) {
|
||||
nsLayoutUtils::PostRestyleEvent(content->AsElement(), RestyleHint{0},
|
||||
nsChangeHint_RepaintFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -625,6 +625,8 @@ class nsWindow final : public nsBaseWidget {
|
|||
|
||||
virtual int32_t RoundsWidgetCoordinatesTo() override;
|
||||
|
||||
void UpdateMozWindowActive();
|
||||
|
||||
void ForceTitlebarRedraw();
|
||||
|
||||
void SetPopupWindowDecoration(bool aShowOnTaskbar);
|
||||
|
|
Загрузка…
Ссылка в новой задаче