forked from mirrors/gecko-dev
Bug 1811834 - Clean up nsWidgetInitData. r=cmartin,geckoview-reviewers,calu
Move it to the mozilla::widget namespace. Use enum classes for transparency, popup type, popup level, etc. Mostly automated with sed, but there were a few manual changes required as well in windows code because they relied on Atomic<TransparencyMode> working (which now doesn't because TransparencyMode is 1 byte instead of 4 bytes). Differential Revision: https://phabricator.services.mozilla.com/D167537
This commit is contained in:
parent
4bee581e3d
commit
9e530f224a
70 changed files with 842 additions and 829 deletions
|
|
@ -450,7 +450,7 @@ DocAccessible* DocManager::CreateDocOrRootAccessible(Document* aDocument) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIWidget* widget = nsContentUtils::WidgetForDocument(aDocument);
|
nsIWidget* widget = nsContentUtils::WidgetForDocument(aDocument);
|
||||||
if (!widget || widget->WindowType() == eWindowType_invisible) {
|
if (!widget || widget->GetWindowType() == widget::WindowType::Invisible) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ uint64_t LocalAccessible::VisibilityState() const {
|
||||||
nsIFrame* curFrame = frame;
|
nsIFrame* curFrame = frame;
|
||||||
do {
|
do {
|
||||||
nsView* view = curFrame->GetView();
|
nsView* view = curFrame->GetView();
|
||||||
if (view && view->GetVisibility() == nsViewVisibility_kHide) {
|
if (view && view->GetVisibility() == ViewVisibility::Hide) {
|
||||||
return states::INVISIBLE;
|
return states::INVISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,8 @@ MsaaDocAccessible::get_accParent(
|
||||||
nsIFrame* frame = docAcc->GetFrame();
|
nsIFrame* frame = docAcc->GetFrame();
|
||||||
if (frame) {
|
if (frame) {
|
||||||
nsIWidget* widget = frame->GetNearestWidget();
|
nsIWidget* widget = frame->GetNearestWidget();
|
||||||
if (widget->WindowType() == eWindowType_child && !widget->GetParent()) {
|
if (widget->GetWindowType() == widget::WindowType::Child &&
|
||||||
|
!widget->GetParent()) {
|
||||||
// Bug 1427304: Windows opened with popup=yes (such as the WebRTC
|
// Bug 1427304: Windows opened with popup=yes (such as the WebRTC
|
||||||
// sharing indicator) get two HWNDs. The root widget is associated
|
// sharing indicator) get two HWNDs. The root widget is associated
|
||||||
// with the inner HWND, but the outer HWND still answers to
|
// with the inner HWND, but the outer HWND still answers to
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ XULMenupopupAccessible::XULMenupopupAccessible(nsIContent* aContent,
|
||||||
DocAccessible* aDoc)
|
DocAccessible* aDoc)
|
||||||
: XULSelectControlAccessible(aContent, aDoc) {
|
: XULSelectControlAccessible(aContent, aDoc) {
|
||||||
if (nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame())) {
|
if (nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame())) {
|
||||||
if (menuPopupFrame->PopupType() == ePopupTypeMenu) {
|
if (menuPopupFrame->GetPopupType() == widget::PopupType::Menu) {
|
||||||
mType = eMenuPopupType;
|
mType = eMenuPopupType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -250,10 +250,10 @@ class BasePopup {
|
||||||
}
|
}
|
||||||
// Wait the reflow before asking the popup panel to grab the focus, otherwise
|
// Wait the reflow before asking the popup panel to grab the focus, otherwise
|
||||||
// `nsFocusManager::SetFocus` may ignore out request because the panel view
|
// `nsFocusManager::SetFocus` may ignore out request because the panel view
|
||||||
// visibility is still set to `nsViewVisibility_kHide` (waiting the document
|
// visibility is still set to `ViewVisibility::Hide` (waiting the document
|
||||||
// to be fully flushed makes us sure that when the popup panel grabs the focus
|
// to be fully flushed makes us sure that when the popup panel grabs the focus
|
||||||
// nsMenuPopupFrame::LayoutPopup has already been colled and set the frame
|
// nsMenuPopupFrame::LayoutPopup has already been colled and set the frame
|
||||||
// visibility to `nsViewVisibility_kShow`).
|
// visibility to `ViewVisibility::Show`).
|
||||||
this.browser.ownerGlobal.promiseDocumentFlushed(() => {
|
this.browser.ownerGlobal.promiseDocumentFlushed(() => {
|
||||||
if (this.destroyed) {
|
if (this.destroyed) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -4850,7 +4850,7 @@ nsDocShell::GetVisibility(bool* aVisibility) {
|
||||||
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
// if our root view is hidden, we are not visible
|
// if our root view is hidden, we are not visible
|
||||||
if (view->GetVisibility() == nsViewVisibility_kHide) {
|
if (view->GetVisibility() == ViewVisibility::Hide) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3480,7 +3480,7 @@ nsresult nsFocusManager::DetermineElementToMoveFocus(
|
||||||
// the panel
|
// the panel
|
||||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||||
if (pm) {
|
if (pm) {
|
||||||
popupFrame = pm->GetTopPopup(ePopupTypePanel);
|
popupFrame = pm->GetTopPopup(PopupType::Panel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (popupFrame) {
|
if (popupFrame) {
|
||||||
|
|
|
||||||
|
|
@ -1224,11 +1224,6 @@ already_AddRefed<ContentParent> ContentParent::GetNewOrUsedJSPluginProcess(
|
||||||
return p.forget();
|
return p.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
|
||||||
/*static*/
|
|
||||||
void ContentParent::SendAsyncUpdate(nsIWidget* aWidget) {}
|
|
||||||
#endif // defined(XP_WIN)
|
|
||||||
|
|
||||||
static nsIDocShell* GetOpenerDocShellHelper(Element* aFrameElement) {
|
static nsIDocShell* GetOpenerDocShellHelper(Element* aFrameElement) {
|
||||||
// Propagate the private-browsing status of the element's parent
|
// Propagate the private-browsing status of the element's parent
|
||||||
// docshell to the remote docshell, via the chrome flags.
|
// docshell to the remote docshell, via the chrome flags.
|
||||||
|
|
|
||||||
|
|
@ -325,17 +325,6 @@ class ContentParent final : public PContentParent,
|
||||||
// been updated and so full reflows are in order.
|
// been updated and so full reflows are in order.
|
||||||
static void NotifyUpdatedFonts(bool aFullRebuild);
|
static void NotifyUpdatedFonts(bool aFullRebuild);
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
|
||||||
/**
|
|
||||||
* Windows helper for firing off an update window request to a plugin
|
|
||||||
* instance.
|
|
||||||
*
|
|
||||||
* aWidget - the eWindowType_plugin_ipc_chrome widget associated with
|
|
||||||
* this plugin window.
|
|
||||||
*/
|
|
||||||
static void SendAsyncUpdate(nsIWidget* aWidget);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvCreateGMPService();
|
mozilla::ipc::IPCResult RecvCreateGMPService();
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvRemovePermission(
|
mozilla::ipc::IPCResult RecvRemovePermission(
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ bool WebRenderLayerManager::Initialize(
|
||||||
static bool hasInitialized = false;
|
static bool hasInitialized = false;
|
||||||
|
|
||||||
WindowKind windowKind;
|
WindowKind windowKind;
|
||||||
if (mWidget->WindowType() != eWindowType_popup) {
|
if (mWidget->GetWindowType() != widget::WindowType::Popup) {
|
||||||
windowKind = WindowKind::MAIN;
|
windowKind = WindowKind::MAIN;
|
||||||
} else {
|
} else {
|
||||||
windowKind = WindowKind::SECONDARY;
|
windowKind = WindowKind::SECONDARY;
|
||||||
|
|
|
||||||
|
|
@ -49,12 +49,12 @@ class MockWidget : public nsBaseWidget {
|
||||||
|
|
||||||
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) override {
|
InitData* aInitData = nullptr) override {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const DesktopIntRect& aRect,
|
const DesktopIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) override {
|
InitData* aInitData = nullptr) override {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
virtual void Show(bool aState) override {}
|
virtual void Show(bool aState) override {}
|
||||||
|
|
|
||||||
|
|
@ -5505,8 +5505,9 @@ PresShell::CanvasBackground PresShell::ComputeCanvasBackground() const {
|
||||||
|
|
||||||
nscolor PresShell::ComputeBackstopColor(nsView* aDisplayRoot) {
|
nscolor PresShell::ComputeBackstopColor(nsView* aDisplayRoot) {
|
||||||
nsIWidget* widget = aDisplayRoot->GetWidget();
|
nsIWidget* widget = aDisplayRoot->GetWidget();
|
||||||
if (widget && (widget->GetTransparencyMode() != eTransparencyOpaque ||
|
if (widget &&
|
||||||
widget->WidgetPaintsBackground())) {
|
(widget->GetTransparencyMode() != widget::TransparencyMode::Opaque ||
|
||||||
|
widget->WidgetPaintsBackground())) {
|
||||||
// Within a transparent widget, so the backstop color must be
|
// Within a transparent widget, so the backstop color must be
|
||||||
// totally transparent.
|
// totally transparent.
|
||||||
return NS_RGBA(0, 0, 0, 0);
|
return NS_RGBA(0, 0, 0, 0);
|
||||||
|
|
@ -5677,7 +5678,7 @@ static nsView* FindViewContaining(nsView* aRelativeToView,
|
||||||
nsView* aView, nsPoint aPt) {
|
nsView* aView, nsPoint aPt) {
|
||||||
MOZ_ASSERT(aRelativeToView->GetFrame());
|
MOZ_ASSERT(aRelativeToView->GetFrame());
|
||||||
|
|
||||||
if (aView->GetVisibility() == nsViewVisibility_kHide) {
|
if (aView->GetVisibility() == ViewVisibility::Hide) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8851,7 +8852,7 @@ bool PresShell::EventHandler::AdjustContextMenuKeyEvent(
|
||||||
// if a menu is open, open the context menu relative to the active item on the
|
// if a menu is open, open the context menu relative to the active item on the
|
||||||
// menu.
|
// menu.
|
||||||
if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
|
if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
|
||||||
nsIFrame* popupFrame = pm->GetTopPopup(ePopupTypeMenu);
|
nsIFrame* popupFrame = pm->GetTopPopup(widget::PopupType::Menu);
|
||||||
if (popupFrame) {
|
if (popupFrame) {
|
||||||
nsIFrame* itemFrame = (static_cast<nsMenuPopupFrame*>(popupFrame))
|
nsIFrame* itemFrame = (static_cast<nsMenuPopupFrame*>(popupFrame))
|
||||||
->GetCurrentMenuItemFrame();
|
->GetCurrentMenuItemFrame();
|
||||||
|
|
|
||||||
|
|
@ -888,7 +888,7 @@ bool nsCaret::IsMenuPopupHidingCaret() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (popupFrame->PopupType() == ePopupTypeMenu &&
|
if (popupFrame->GetPopupType() == widget::PopupType::Menu &&
|
||||||
!popupFrame->IsContextMenu()) {
|
!popupFrame->IsContextMenu()) {
|
||||||
// This is an open menu popup. It does not contain the caret (else we'd
|
// This is an open menu popup. It does not contain the caret (else we'd
|
||||||
// have returned above). Even if the caret is in a subsequent popup,
|
// have returned above). Even if the caret is in a subsequent popup,
|
||||||
|
|
|
||||||
|
|
@ -2273,11 +2273,11 @@ nsresult nsDocumentViewer::MakeWindow(const nsSize& aSize,
|
||||||
// hierarchy will stand alone. otherwise the view will find its own parent
|
// hierarchy will stand alone. otherwise the view will find its own parent
|
||||||
// widget and "do the right thing" to establish a parent/child widget
|
// widget and "do the right thing" to establish a parent/child widget
|
||||||
// relationship
|
// relationship
|
||||||
nsWidgetInitData initData;
|
widget::InitData initData;
|
||||||
nsWidgetInitData* initDataPtr;
|
widget::InitData* initDataPtr;
|
||||||
if (!mParentWidget) {
|
if (!mParentWidget) {
|
||||||
initDataPtr = &initData;
|
initDataPtr = &initData;
|
||||||
initData.mWindowType = eWindowType_invisible;
|
initData.mWindowType = widget::WindowType::Invisible;
|
||||||
} else {
|
} else {
|
||||||
initDataPtr = nullptr;
|
initDataPtr = nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -3250,9 +3250,10 @@ bool nsDocumentViewer::ShouldAttachToTopLevel() {
|
||||||
|
|
||||||
// On windows, in the parent process we also attach, but just to
|
// On windows, in the parent process we also attach, but just to
|
||||||
// chrome items
|
// chrome items
|
||||||
nsWindowType winType = mParentWidget->WindowType();
|
auto winType = mParentWidget->GetWindowType();
|
||||||
if ((winType == eWindowType_toplevel || winType == eWindowType_dialog ||
|
if ((winType == widget::WindowType::TopLevel ||
|
||||||
winType == eWindowType_invisible) &&
|
winType == widget::WindowType::Dialog ||
|
||||||
|
winType == widget::WindowType::Invisible) &&
|
||||||
mPresContext->IsChrome()) {
|
mPresContext->IsChrome()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2558,7 +2558,7 @@ nsRect nsLayoutUtils::TransformFrameRectToAncestor(
|
||||||
static LayoutDeviceIntPoint GetWidgetOffset(nsIWidget* aWidget,
|
static LayoutDeviceIntPoint GetWidgetOffset(nsIWidget* aWidget,
|
||||||
nsIWidget*& aRootWidget) {
|
nsIWidget*& aRootWidget) {
|
||||||
LayoutDeviceIntPoint offset(0, 0);
|
LayoutDeviceIntPoint offset(0, 0);
|
||||||
while (aWidget->WindowType() == eWindowType_child) {
|
while (aWidget->GetWindowType() == widget::WindowType::Child) {
|
||||||
nsIWidget* parent = aWidget->GetParent();
|
nsIWidget* parent = aWidget->GetParent();
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -6832,25 +6832,26 @@ bool nsLayoutUtils::HasNonZeroCornerOnSide(const BorderRadius& aCorners,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
nsTransparencyMode nsLayoutUtils::GetFrameTransparency(
|
widget::TransparencyMode nsLayoutUtils::GetFrameTransparency(
|
||||||
nsIFrame* aBackgroundFrame, nsIFrame* aCSSRootFrame) {
|
nsIFrame* aBackgroundFrame, nsIFrame* aCSSRootFrame) {
|
||||||
if (aCSSRootFrame->StyleEffects()->mOpacity < 1.0f)
|
if (aCSSRootFrame->StyleEffects()->mOpacity < 1.0f)
|
||||||
return eTransparencyTransparent;
|
return TransparencyMode::Transparent;
|
||||||
|
|
||||||
if (HasNonZeroCorner(aCSSRootFrame->StyleBorder()->mBorderRadius))
|
if (HasNonZeroCorner(aCSSRootFrame->StyleBorder()->mBorderRadius))
|
||||||
return eTransparencyTransparent;
|
return TransparencyMode::Transparent;
|
||||||
|
|
||||||
StyleAppearance appearance =
|
StyleAppearance appearance =
|
||||||
aCSSRootFrame->StyleDisplay()->EffectiveAppearance();
|
aCSSRootFrame->StyleDisplay()->EffectiveAppearance();
|
||||||
|
|
||||||
if (appearance == StyleAppearance::MozWinBorderlessGlass) {
|
if (appearance == StyleAppearance::MozWinBorderlessGlass) {
|
||||||
return eTransparencyBorderlessGlass;
|
return TransparencyMode::BorderlessGlass;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsITheme::Transparency transparency;
|
nsITheme::Transparency transparency;
|
||||||
if (aCSSRootFrame->IsThemed(&transparency)) {
|
if (aCSSRootFrame->IsThemed(&transparency)) {
|
||||||
return transparency == nsITheme::eTransparent ? eTransparencyTransparent
|
return transparency == nsITheme::eTransparent
|
||||||
: eTransparencyOpaque;
|
? TransparencyMode::Transparent
|
||||||
|
: TransparencyMode::Opaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need an uninitialized window to be treated as opaque because doing
|
// We need an uninitialized window to be treated as opaque because doing
|
||||||
|
|
@ -6858,20 +6859,20 @@ nsTransparencyMode nsLayoutUtils::GetFrameTransparency(
|
||||||
// Vista. (bug 450322)
|
// Vista. (bug 450322)
|
||||||
if (aBackgroundFrame->IsViewportFrame() &&
|
if (aBackgroundFrame->IsViewportFrame() &&
|
||||||
!aBackgroundFrame->PrincipalChildList().FirstChild()) {
|
!aBackgroundFrame->PrincipalChildList().FirstChild()) {
|
||||||
return eTransparencyOpaque;
|
return TransparencyMode::Opaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ComputedStyle* bgSC = nsCSSRendering::FindBackground(aBackgroundFrame);
|
const ComputedStyle* bgSC = nsCSSRendering::FindBackground(aBackgroundFrame);
|
||||||
if (!bgSC) {
|
if (!bgSC) {
|
||||||
return eTransparencyTransparent;
|
return TransparencyMode::Transparent;
|
||||||
}
|
}
|
||||||
const nsStyleBackground* bg = bgSC->StyleBackground();
|
const nsStyleBackground* bg = bgSC->StyleBackground();
|
||||||
if (NS_GET_A(bg->BackgroundColor(bgSC)) < 255 ||
|
if (NS_GET_A(bg->BackgroundColor(bgSC)) < 255 ||
|
||||||
// bottom layer's clip is used for the color
|
// bottom layer's clip is used for the color
|
||||||
bg->BottomLayer().mClip != StyleGeometryBox::BorderBox) {
|
bg->BottomLayer().mClip != StyleGeometryBox::BorderBox) {
|
||||||
return eTransparencyTransparent;
|
return TransparencyMode::Transparent;
|
||||||
}
|
}
|
||||||
return eTransparencyOpaque;
|
return TransparencyMode::Opaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,10 @@ class Image;
|
||||||
class StackingContextHelper;
|
class StackingContextHelper;
|
||||||
class Layer;
|
class Layer;
|
||||||
class WebRenderLayerManager;
|
class WebRenderLayerManager;
|
||||||
|
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
|
namespace widget {
|
||||||
|
enum class TransparencyMode : uint8_t;
|
||||||
|
}
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
// Flags to customize the behavior of nsLayoutUtils::DrawString.
|
// Flags to customize the behavior of nsLayoutUtils::DrawString.
|
||||||
|
|
@ -2066,8 +2068,9 @@ class nsLayoutUtils {
|
||||||
* same.
|
* same.
|
||||||
* @return a value suitable for passing to SetWindowTranslucency.
|
* @return a value suitable for passing to SetWindowTranslucency.
|
||||||
*/
|
*/
|
||||||
static nsTransparencyMode GetFrameTransparency(nsIFrame* aBackgroundFrame,
|
using TransparencyMode = mozilla::widget::TransparencyMode;
|
||||||
nsIFrame* aCSSRootFrame);
|
static TransparencyMode GetFrameTransparency(nsIFrame* aBackgroundFrame,
|
||||||
|
nsIFrame* aCSSRootFrame);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A frame is a popup if it has its own floating window. Menus, panels
|
* A frame is a popup if it has its own floating window. Menus, panels
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
/* base class #1 for rendering objects that have child lists */
|
/* base class #1 for rendering objects that have child lists */
|
||||||
|
|
||||||
#include "nsContainerFrame.h"
|
#include "nsContainerFrame.h"
|
||||||
|
#include "mozilla/widget/InitData.h"
|
||||||
#include "nsContainerFrameInlines.h"
|
#include "nsContainerFrameInlines.h"
|
||||||
|
|
||||||
#include "mozilla/ComputedStyle.h"
|
#include "mozilla/ComputedStyle.h"
|
||||||
|
|
@ -729,10 +730,12 @@ static nsIWidget* GetPresContextContainerWidget(nsPresContext* aPresContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsTopLevelWidget(nsIWidget* aWidget) {
|
static bool IsTopLevelWidget(nsIWidget* aWidget) {
|
||||||
nsWindowType windowType = aWidget->WindowType();
|
using WindowType = mozilla::widget::WindowType;
|
||||||
return windowType == eWindowType_toplevel ||
|
|
||||||
windowType == eWindowType_dialog || windowType == eWindowType_popup ||
|
auto windowType = aWidget->GetWindowType();
|
||||||
windowType == eWindowType_sheet;
|
return windowType == WindowType::TopLevel ||
|
||||||
|
windowType == WindowType::Dialog || windowType == WindowType::Popup ||
|
||||||
|
windowType == WindowType::Sheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsContainerFrame::SyncWindowProperties(nsPresContext* aPresContext,
|
void nsContainerFrame::SyncWindowProperties(nsPresContext* aPresContext,
|
||||||
|
|
@ -793,7 +796,7 @@ void nsContainerFrame::SyncWindowProperties(nsPresContext* aPresContext,
|
||||||
// openDialog("something.html") to produce an opaque window
|
// openDialog("something.html") to produce an opaque window
|
||||||
// even if the HTML doesn't have a background-color set.
|
// even if the HTML doesn't have a background-color set.
|
||||||
auto* canvas = aPresContext->PresShell()->GetCanvasFrame();
|
auto* canvas = aPresContext->PresShell()->GetCanvasFrame();
|
||||||
nsTransparencyMode mode = nsLayoutUtils::GetFrameTransparency(
|
widget::TransparencyMode mode = nsLayoutUtils::GetFrameTransparency(
|
||||||
canvas ? canvas : aFrame, rootFrame);
|
canvas ? canvas : aFrame, rootFrame);
|
||||||
StyleWindowShadow shadow = rootFrame->StyleUIReset()->mWindowShadow;
|
StyleWindowShadow shadow = rootFrame->StyleUIReset()->mWindowShadow;
|
||||||
nsCOMPtr<nsIWidget> viewWidget = aView->GetWidget();
|
nsCOMPtr<nsIWidget> viewWidget = aView->GetWidget();
|
||||||
|
|
|
||||||
|
|
@ -375,7 +375,7 @@ bool nsIFrame::IsVisibleConsideringAncestors(uint32_t aFlags) const {
|
||||||
const nsIFrame* frame = this;
|
const nsIFrame* frame = this;
|
||||||
while (frame) {
|
while (frame) {
|
||||||
nsView* view = frame->GetView();
|
nsView* view = frame->GetView();
|
||||||
if (view && view->GetVisibility() == nsViewVisibility_kHide) {
|
if (view && view->GetVisibility() == ViewVisibility::Hide) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1556,8 +1556,8 @@ void nsIFrame::SyncFrameViewProperties(nsView* aView) {
|
||||||
// See if the view should be hidden or visible
|
// See if the view should be hidden or visible
|
||||||
ComputedStyle* sc = Style();
|
ComputedStyle* sc = Style();
|
||||||
vm->SetViewVisibility(aView, sc->StyleVisibility()->IsVisible()
|
vm->SetViewVisibility(aView, sc->StyleVisibility()->IsVisible()
|
||||||
? nsViewVisibility_kShow
|
? ViewVisibility::Show
|
||||||
: nsViewVisibility_kHide);
|
: ViewVisibility::Hide);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto zIndex = ZIndex();
|
const auto zIndex = ZIndex();
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ nsMenuPopupFrame::nsMenuPopupFrame(ComputedStyle* aStyle,
|
||||||
mYPos(0),
|
mYPos(0),
|
||||||
mAlignmentOffset(0),
|
mAlignmentOffset(0),
|
||||||
mLastClientOffset(0, 0),
|
mLastClientOffset(0, 0),
|
||||||
mPopupType(ePopupTypePanel),
|
mPopupType(PopupType::Panel),
|
||||||
mPopupState(ePopupClosed),
|
mPopupState(ePopupClosed),
|
||||||
mPopupAlignment(POPUPALIGNMENT_NONE),
|
mPopupAlignment(POPUPALIGNMENT_NONE),
|
||||||
mPopupAnchor(POPUPALIGNMENT_NONE),
|
mPopupAnchor(POPUPALIGNMENT_NONE),
|
||||||
|
|
@ -149,7 +149,7 @@ static nsIWidget::InputRegion ComputeInputRegion(const ComputedStyle& aStyle,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsMenuPopupFrame::ShouldCreateWidgetUpfront() const {
|
bool nsMenuPopupFrame::ShouldCreateWidgetUpfront() const {
|
||||||
if (mPopupType != ePopupTypeMenu) {
|
if (mPopupType != PopupType::Menu) {
|
||||||
// Any panel with a type attribute, such as the autocomplete popup, is
|
// Any panel with a type attribute, such as the autocomplete popup, is
|
||||||
// always generated right away.
|
// always generated right away.
|
||||||
return mContent->AsElement()->HasAttr(nsGkAtoms::type);
|
return mContent->AsElement()->HasAttr(nsGkAtoms::type);
|
||||||
|
|
@ -178,11 +178,11 @@ void nsMenuPopupFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
|
||||||
nsViewManager* viewManager = ourView->GetViewManager();
|
nsViewManager* viewManager = ourView->GetViewManager();
|
||||||
viewManager->SetViewFloating(ourView, true);
|
viewManager->SetViewFloating(ourView, true);
|
||||||
|
|
||||||
mPopupType = ePopupTypePanel;
|
mPopupType = PopupType::Panel;
|
||||||
if (aContent->IsAnyOfXULElements(nsGkAtoms::menupopup, nsGkAtoms::popup)) {
|
if (aContent->IsAnyOfXULElements(nsGkAtoms::menupopup, nsGkAtoms::popup)) {
|
||||||
mPopupType = ePopupTypeMenu;
|
mPopupType = PopupType::Menu;
|
||||||
} else if (aContent->IsXULElement(nsGkAtoms::tooltip)) {
|
} else if (aContent->IsXULElement(nsGkAtoms::tooltip)) {
|
||||||
mPopupType = ePopupTypeTooltip;
|
mPopupType = PopupType::Tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PresContext()->IsChrome()) {
|
if (PresContext()->IsChrome()) {
|
||||||
|
|
@ -216,23 +216,23 @@ void nsMenuPopupFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsMenuPopupFrame::HasRemoteContent() const {
|
bool nsMenuPopupFrame::HasRemoteContent() const {
|
||||||
return (!mInContentShell && mPopupType == ePopupTypePanel &&
|
return !mInContentShell && mPopupType == PopupType::Panel &&
|
||||||
mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||||
nsGkAtoms::remote,
|
nsGkAtoms::remote, nsGkAtoms::_true,
|
||||||
nsGkAtoms::_true, eIgnoreCase));
|
eIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsMenuPopupFrame::IsNoAutoHide() const {
|
bool nsMenuPopupFrame::IsNoAutoHide() const {
|
||||||
// Panels with noautohide="true" don't hide when the mouse is clicked
|
// Panels with noautohide="true" don't hide when the mouse is clicked
|
||||||
// outside of them, or when another application is made active. Non-autohide
|
// outside of them, or when another application is made active. Non-autohide
|
||||||
// panels cannot be used in content windows.
|
// panels cannot be used in content windows.
|
||||||
return (!mInContentShell && mPopupType == ePopupTypePanel &&
|
return !mInContentShell && mPopupType == PopupType::Panel &&
|
||||||
mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||||
nsGkAtoms::noautohide,
|
nsGkAtoms::noautohide,
|
||||||
nsGkAtoms::_true, eIgnoreCase));
|
nsGkAtoms::_true, eIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsPopupLevel nsMenuPopupFrame::PopupLevel(bool aIsNoAutoHide) const {
|
widget::PopupLevel nsMenuPopupFrame::GetPopupLevel(bool aIsNoAutoHide) const {
|
||||||
// The popup level is determined as follows, in this order:
|
// The popup level is determined as follows, in this order:
|
||||||
// 1. non-panels (menus and tooltips) are always topmost
|
// 1. non-panels (menus and tooltips) are always topmost
|
||||||
// 2. any specified level attribute
|
// 2. any specified level attribute
|
||||||
|
|
@ -241,7 +241,9 @@ nsPopupLevel nsMenuPopupFrame::PopupLevel(bool aIsNoAutoHide) const {
|
||||||
// 5. use the platform-specific default level
|
// 5. use the platform-specific default level
|
||||||
|
|
||||||
// If this is not a panel, this is always a top-most popup.
|
// If this is not a panel, this is always a top-most popup.
|
||||||
if (mPopupType != ePopupTypePanel) return ePopupLevelTop;
|
if (mPopupType != PopupType::Panel) {
|
||||||
|
return PopupLevel::Top;
|
||||||
|
}
|
||||||
|
|
||||||
// If the level attribute has been set, use that.
|
// If the level attribute has been set, use that.
|
||||||
static Element::AttrValuesArray strings[] = {
|
static Element::AttrValuesArray strings[] = {
|
||||||
|
|
@ -249,22 +251,25 @@ nsPopupLevel nsMenuPopupFrame::PopupLevel(bool aIsNoAutoHide) const {
|
||||||
switch (mContent->AsElement()->FindAttrValueIn(
|
switch (mContent->AsElement()->FindAttrValueIn(
|
||||||
kNameSpaceID_None, nsGkAtoms::level, strings, eCaseMatters)) {
|
kNameSpaceID_None, nsGkAtoms::level, strings, eCaseMatters)) {
|
||||||
case 0:
|
case 0:
|
||||||
return ePopupLevelTop;
|
return PopupLevel::Top;
|
||||||
case 1:
|
case 1:
|
||||||
return ePopupLevelParent;
|
return PopupLevel::Parent;
|
||||||
case 2:
|
case 2:
|
||||||
return ePopupLevelFloating;
|
return PopupLevel::Floating;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Panels with titlebars most likely want to be floating popups.
|
// Panels with titlebars most likely want to be floating popups.
|
||||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::titlebar))
|
if (mContent->AsElement()->HasAttr(nsGkAtoms::titlebar)) {
|
||||||
return ePopupLevelFloating;
|
return PopupLevel::Floating;
|
||||||
|
}
|
||||||
|
|
||||||
// If this panel is a noautohide panel, the default is the parent level.
|
// If this panel is a noautohide panel, the default is the parent level.
|
||||||
if (aIsNoAutoHide) return ePopupLevelParent;
|
if (aIsNoAutoHide) {
|
||||||
|
return PopupLevel::Parent;
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise, the result depends on the platform.
|
// Otherwise, the result depends on the platform.
|
||||||
return sDefaultLevelIsTop ? ePopupLevelTop : ePopupLevelParent;
|
return sDefaultLevelIsTop ? PopupLevel::Top : PopupLevel::Parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsMenuPopupFrame::PrepareWidget(bool aRecreate) {
|
void nsMenuPopupFrame::PrepareWidget(bool aRecreate) {
|
||||||
|
|
@ -289,9 +294,9 @@ void nsMenuPopupFrame::PrepareWidget(bool aRecreate) {
|
||||||
|
|
||||||
nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) {
|
nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) {
|
||||||
// Create a widget for ourselves.
|
// Create a widget for ourselves.
|
||||||
nsWidgetInitData widgetData;
|
widget::InitData widgetData;
|
||||||
widgetData.mWindowType = eWindowType_popup;
|
widgetData.mWindowType = widget::WindowType::Popup;
|
||||||
widgetData.mBorderStyle = eBorderStyle_default;
|
widgetData.mBorderStyle = widget::BorderStyle::Default;
|
||||||
widgetData.mForMenupopupFrame = true;
|
widgetData.mForMenupopupFrame = true;
|
||||||
widgetData.mClipSiblings = true;
|
widgetData.mClipSiblings = true;
|
||||||
widgetData.mPopupHint = mPopupType;
|
widgetData.mPopupHint = mPopupType;
|
||||||
|
|
@ -299,7 +304,7 @@ nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) {
|
||||||
|
|
||||||
if (!mInContentShell) {
|
if (!mInContentShell) {
|
||||||
// A drag popup may be used for non-static translucent drag feedback
|
// A drag popup may be used for non-static translucent drag feedback
|
||||||
if (mPopupType == ePopupTypePanel &&
|
if (mPopupType == PopupType::Panel &&
|
||||||
mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||||
nsGkAtoms::drag, eIgnoreCase)) {
|
nsGkAtoms::drag, eIgnoreCase)) {
|
||||||
widgetData.mIsDragPopup = true;
|
widgetData.mIsDragPopup = true;
|
||||||
|
|
@ -307,36 +312,32 @@ nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString title;
|
nsAutoString title;
|
||||||
if (widgetData.mNoAutoHide) {
|
if (widgetData.mNoAutoHide &&
|
||||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::titlebar,
|
||||||
nsGkAtoms::titlebar,
|
nsGkAtoms::normal, eCaseMatters)) {
|
||||||
nsGkAtoms::normal, eCaseMatters)) {
|
widgetData.mBorderStyle = widget::BorderStyle::Title;
|
||||||
widgetData.mBorderStyle = eBorderStyle_title;
|
|
||||||
|
|
||||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label,
|
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, title);
|
||||||
title);
|
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::close,
|
||||||
|
nsGkAtoms::_true, eCaseMatters)) {
|
||||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
widgetData.mBorderStyle =
|
||||||
nsGkAtoms::close, nsGkAtoms::_true,
|
widgetData.mBorderStyle | widget::BorderStyle::Close;
|
||||||
eCaseMatters)) {
|
|
||||||
widgetData.mBorderStyle = static_cast<enum nsBorderStyle>(
|
|
||||||
widgetData.mBorderStyle | eBorderStyle_close);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool remote = HasRemoteContent();
|
bool remote = HasRemoteContent();
|
||||||
|
|
||||||
nsTransparencyMode mode = nsLayoutUtils::GetFrameTransparency(this, this);
|
auto mode = nsLayoutUtils::GetFrameTransparency(this, this);
|
||||||
widgetData.mHasRemoteContent = remote;
|
widgetData.mHasRemoteContent = remote;
|
||||||
widgetData.mSupportTranslucency = mode == eTransparencyTransparent;
|
widgetData.mSupportTranslucency =
|
||||||
widgetData.mPopupLevel = PopupLevel(widgetData.mNoAutoHide);
|
mode == widget::TransparencyMode::Transparent;
|
||||||
|
widgetData.mPopupLevel = GetPopupLevel(widgetData.mNoAutoHide);
|
||||||
|
|
||||||
// Panels which have a parent level need a parent widget. This allows them to
|
// Panels which have a parent level need a parent widget. This allows them to
|
||||||
// always appear in front of the parent window but behind other windows that
|
// always appear in front of the parent window but behind other windows that
|
||||||
// should be in front of it.
|
// should be in front of it.
|
||||||
nsCOMPtr<nsIWidget> parentWidget;
|
nsCOMPtr<nsIWidget> parentWidget;
|
||||||
if (widgetData.mPopupLevel != ePopupLevelTop) {
|
if (widgetData.mPopupLevel != PopupLevel::Top) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> dsti = PresContext()->GetDocShell();
|
nsCOMPtr<nsIDocShellTreeItem> dsti = PresContext()->GetDocShell();
|
||||||
if (!dsti) return NS_ERROR_FAILURE;
|
if (!dsti) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
|
@ -712,7 +713,7 @@ void nsMenuPopupFrame::LayoutPopup(nsBoxLayoutState& aState) {
|
||||||
mPopupState = ePopupVisible;
|
mPopupState = ePopupVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
viewManager->SetViewVisibility(view, ViewVisibility::Show);
|
||||||
SyncFrameViewProperties(view);
|
SyncFrameViewProperties(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1037,10 +1038,8 @@ void nsMenuPopupFrame::ShowPopup(bool aIsContextMenu) {
|
||||||
mIsOpenChanged = true;
|
mIsOpenChanged = true;
|
||||||
|
|
||||||
// Clear mouse capture when a popup is opened.
|
// Clear mouse capture when a popup is opened.
|
||||||
if (mPopupType == ePopupTypeMenu) {
|
if (mPopupType == PopupType::Menu) {
|
||||||
EventStateManager* activeESM = static_cast<EventStateManager*>(
|
if (auto* activeESM = EventStateManager::GetActiveEventStateManager()) {
|
||||||
EventStateManager::GetActiveEventStateManager());
|
|
||||||
if (activeESM) {
|
|
||||||
EventStateManager::ClearGlobalActiveContent(activeESM);
|
EventStateManager::ClearGlobalActiveContent(activeESM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1056,7 +1055,7 @@ void nsMenuPopupFrame::ShowPopup(bool aIsContextMenu) {
|
||||||
PresShell()->FrameNeedsReflow(this, IntrinsicDirty::FrameAndAncestors,
|
PresShell()->FrameNeedsReflow(this, IntrinsicDirty::FrameAndAncestors,
|
||||||
NS_FRAME_IS_DIRTY);
|
NS_FRAME_IS_DIRTY);
|
||||||
|
|
||||||
if (mPopupType == ePopupTypeMenu) {
|
if (mPopupType == PopupType::Menu) {
|
||||||
nsCOMPtr<nsISound> sound(do_GetService("@mozilla.org/sound;1"));
|
nsCOMPtr<nsISound> sound(do_GetService("@mozilla.org/sound;1"));
|
||||||
if (sound) sound->PlayEventSound(nsISound::EVENT_MENU_POPUP);
|
if (sound) sound->PlayEventSound(nsISound::EVENT_MENU_POPUP);
|
||||||
}
|
}
|
||||||
|
|
@ -1128,7 +1127,7 @@ void nsMenuPopupFrame::HidePopup(bool aDeselectMenu, nsPopupState aNewState,
|
||||||
|
|
||||||
nsView* view = GetView();
|
nsView* view = GetView();
|
||||||
nsViewManager* viewManager = view->GetViewManager();
|
nsViewManager* viewManager = view->GetViewManager();
|
||||||
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
|
viewManager->SetViewVisibility(view, ViewVisibility::Hide);
|
||||||
|
|
||||||
RefPtr popup = &PopupElement();
|
RefPtr popup = &PopupElement();
|
||||||
// XXX, bug 137033, In Windows, if mouse is outside the window when the
|
// XXX, bug 137033, In Windows, if mouse is outside the window when the
|
||||||
|
|
@ -1531,7 +1530,7 @@ nsresult nsMenuPopupFrame::SetPopupPosition(bool aIsMove) {
|
||||||
nsRect rootScreenRect = rootFrame->GetScreenRectInAppUnits();
|
nsRect rootScreenRect = rootFrame->GetScreenRectInAppUnits();
|
||||||
|
|
||||||
bool isNoAutoHide = IsNoAutoHide();
|
bool isNoAutoHide = IsNoAutoHide();
|
||||||
nsPopupLevel popupLevel = PopupLevel(isNoAutoHide);
|
PopupLevel popupLevel = GetPopupLevel(isNoAutoHide);
|
||||||
|
|
||||||
if (anchored) {
|
if (anchored) {
|
||||||
// if we are anchored, there are certain things we don't want to do when
|
// if we are anchored, there are certain things we don't want to do when
|
||||||
|
|
@ -1580,7 +1579,7 @@ nsresult nsMenuPopupFrame::SetPopupPosition(bool aIsMove) {
|
||||||
// the window is moved. Popups at the parent level follow the parent
|
// the window is moved. Popups at the parent level follow the parent
|
||||||
// window as it is moved and remained anchored, so we want to maintain the
|
// window as it is moved and remained anchored, so we want to maintain the
|
||||||
// anchoring instead.
|
// anchoring instead.
|
||||||
if (isNoAutoHide && (popupLevel != ePopupLevelParent ||
|
if (isNoAutoHide && (popupLevel != PopupLevel::Parent ||
|
||||||
mAnchorType == MenuPopupAnchorType_Rect)) {
|
mAnchorType == MenuPopupAnchorType_Rect)) {
|
||||||
// Account for the margin that will end up being added to the screen
|
// Account for the margin that will end up being added to the screen
|
||||||
// coordinate the next time SetPopupPosition is called.
|
// coordinate the next time SetPopupPosition is called.
|
||||||
|
|
@ -1607,7 +1606,7 @@ nsresult nsMenuPopupFrame::SetPopupPosition(bool aIsMove) {
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
// OSX tooltips follow standard flip rule but other popups flip horizontally
|
// OSX tooltips follow standard flip rule but other popups flip horizontally
|
||||||
// not vertically
|
// not vertically
|
||||||
if (mPopupType == ePopupTypeTooltip) {
|
if (mPopupType == PopupType::Tooltip) {
|
||||||
vFlip = FlipStyle_Outside;
|
vFlip = FlipStyle_Outside;
|
||||||
} else {
|
} else {
|
||||||
hFlip = FlipStyle_Outside;
|
hFlip = FlipStyle_Outside;
|
||||||
|
|
@ -1629,7 +1628,7 @@ nsresult nsMenuPopupFrame::SetPopupPosition(bool aIsMove) {
|
||||||
if (!IS_WAYLAND_DISPLAY() &&
|
if (!IS_WAYLAND_DISPLAY() &&
|
||||||
(mInContentShell ||
|
(mInContentShell ||
|
||||||
(mFlip != FlipType_None &&
|
(mFlip != FlipType_None &&
|
||||||
(!aIsMove || mIsOffset || mPopupType != ePopupTypePanel)))) {
|
(!aIsMove || mIsOffset || mPopupType != PopupType::Panel)))) {
|
||||||
const nsRect screenRect = [&] {
|
const nsRect screenRect = [&] {
|
||||||
int32_t appPerDev = presContext->AppUnitsPerDevPixel();
|
int32_t appPerDev = presContext->AppUnitsPerDevPixel();
|
||||||
auto anchorRectDevPix =
|
auto anchorRectDevPix =
|
||||||
|
|
@ -1731,7 +1730,7 @@ nsresult nsMenuPopupFrame::SetPopupPosition(bool aIsMove) {
|
||||||
// titlebar or borders, we skip these calculations anyway for non-panels
|
// titlebar or borders, we skip these calculations anyway for non-panels
|
||||||
// to save time since they will never have a titlebar.
|
// to save time since they will never have a titlebar.
|
||||||
nsIWidget* widget = view->GetWidget();
|
nsIWidget* widget = view->GetWidget();
|
||||||
if (mPopupType == ePopupTypePanel && widget) {
|
if (mPopupType == PopupType::Panel && widget) {
|
||||||
mLastClientOffset = widget->GetClientOffset();
|
mLastClientOffset = widget->GetClientOffset();
|
||||||
viewPoint.x += presContext->DevPixelsToAppUnits(mLastClientOffset.x);
|
viewPoint.x += presContext->DevPixelsToAppUnits(mLastClientOffset.x);
|
||||||
viewPoint.y += presContext->DevPixelsToAppUnits(mLastClientOffset.y);
|
viewPoint.y += presContext->DevPixelsToAppUnits(mLastClientOffset.y);
|
||||||
|
|
@ -1796,7 +1795,7 @@ void nsMenuPopupFrame::WidgetPositionOrSizeDidChange() {
|
||||||
|
|
||||||
LayoutDeviceIntRect nsMenuPopupFrame::GetConstraintRect(
|
LayoutDeviceIntRect nsMenuPopupFrame::GetConstraintRect(
|
||||||
const LayoutDeviceIntRect& aAnchorRect,
|
const LayoutDeviceIntRect& aAnchorRect,
|
||||||
const LayoutDeviceIntRect& aRootScreenRect, nsPopupLevel aPopupLevel) {
|
const LayoutDeviceIntRect& aRootScreenRect, PopupLevel aPopupLevel) {
|
||||||
LayoutDeviceIntRect screenRectPixels;
|
LayoutDeviceIntRect screenRectPixels;
|
||||||
|
|
||||||
// GetConstraintRect() does not work on Wayland as we can't get absolute
|
// GetConstraintRect() does not work on Wayland as we can't get absolute
|
||||||
|
|
@ -1825,7 +1824,7 @@ LayoutDeviceIntRect nsMenuPopupFrame::GetConstraintRect(
|
||||||
if (screen) {
|
if (screen) {
|
||||||
// Non-top-level popups (which will always be panels)
|
// Non-top-level popups (which will always be panels)
|
||||||
// should never overlap the OS bar:
|
// should never overlap the OS bar:
|
||||||
bool dontOverlapOSBar = aPopupLevel != ePopupLevelTop;
|
bool dontOverlapOSBar = aPopupLevel != PopupLevel::Top;
|
||||||
// get the total screen area if the popup is allowed to overlap it.
|
// get the total screen area if the popup is allowed to overlap it.
|
||||||
if (!dontOverlapOSBar && mMenuCanOverlapOSBar && !mInContentShell)
|
if (!dontOverlapOSBar && mMenuCanOverlapOSBar && !mInContentShell)
|
||||||
screen->GetRect(&screenRectPixels.x, &screenRectPixels.y,
|
screen->GetRect(&screenRectPixels.x, &screenRectPixels.y,
|
||||||
|
|
@ -2354,7 +2353,7 @@ void nsMenuPopupFrame::CreatePopupView() {
|
||||||
|
|
||||||
// Create a view
|
// Create a view
|
||||||
nsView* parentView = viewManager->GetRootView();
|
nsView* parentView = viewManager->GetRootView();
|
||||||
nsViewVisibility visibility = nsViewVisibility_kHide;
|
auto visibility = ViewVisibility::Hide;
|
||||||
|
|
||||||
NS_ASSERTION(parentView, "no parent view");
|
NS_ASSERTION(parentView, "no parent view");
|
||||||
|
|
||||||
|
|
@ -2392,9 +2391,9 @@ bool nsMenuPopupFrame::ShouldFollowAnchor() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (mPopupType == ePopupTypePanel &&
|
return mPopupType == PopupType::Panel &&
|
||||||
mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||||
nsGkAtoms::arrow, eCaseMatters));
|
nsGkAtoms::arrow, eCaseMatters);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsMenuPopupFrame::ShouldFollowAnchor(nsRect& aRect) {
|
bool nsMenuPopupFrame::ShouldFollowAnchor(nsRect& aRect) {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@ class KeyboardEvent;
|
||||||
class XULButtonElement;
|
class XULButtonElement;
|
||||||
class XULPopupElement;
|
class XULPopupElement;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
namespace widget {
|
||||||
|
enum class PopupLevel : uint8_t;
|
||||||
|
}
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
enum ConsumeOutsideClicksResult {
|
enum ConsumeOutsideClicksResult {
|
||||||
|
|
@ -128,6 +131,9 @@ class nsXULPopupShownEvent final : public mozilla::Runnable,
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsMenuPopupFrame final : public nsBoxFrame, public nsIReflowCallback {
|
class nsMenuPopupFrame final : public nsBoxFrame, public nsIReflowCallback {
|
||||||
|
using PopupLevel = mozilla::widget::PopupLevel;
|
||||||
|
using PopupType = mozilla::widget::PopupType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_DECL_QUERYFRAME
|
NS_DECL_QUERYFRAME
|
||||||
NS_DECL_FRAMEARENA_HELPERS(nsMenuPopupFrame)
|
NS_DECL_FRAMEARENA_HELPERS(nsMenuPopupFrame)
|
||||||
|
|
@ -189,7 +195,7 @@ class nsMenuPopupFrame final : public nsBoxFrame, public nsIReflowCallback {
|
||||||
// true. These panels do not roll up automatically.
|
// true. These panels do not roll up automatically.
|
||||||
bool IsNoAutoHide() const;
|
bool IsNoAutoHide() const;
|
||||||
|
|
||||||
nsPopupLevel PopupLevel() const { return PopupLevel(IsNoAutoHide()); }
|
PopupLevel GetPopupLevel() const { return GetPopupLevel(IsNoAutoHide()); }
|
||||||
|
|
||||||
// Ensure that a widget has already been created for this view, and create
|
// Ensure that a widget has already been created for this view, and create
|
||||||
// one if it hasn't. If aRecreate is true, destroys any existing widget and
|
// one if it hasn't. If aRecreate is true, destroys any existing widget and
|
||||||
|
|
@ -231,7 +237,7 @@ class nsMenuPopupFrame final : public nsBoxFrame, public nsIReflowCallback {
|
||||||
mozilla::dom::XULButtonElement* GetCurrentMenuItem() const;
|
mozilla::dom::XULButtonElement* GetCurrentMenuItem() const;
|
||||||
nsIFrame* GetCurrentMenuItemFrame() const;
|
nsIFrame* GetCurrentMenuItemFrame() const;
|
||||||
|
|
||||||
nsPopupType PopupType() const { return mPopupType; }
|
PopupType GetPopupType() const { return mPopupType; }
|
||||||
bool IsContextMenu() const { return mIsContextMenu; }
|
bool IsContextMenu() const { return mIsContextMenu; }
|
||||||
|
|
||||||
bool IsOpen() const {
|
bool IsOpen() const {
|
||||||
|
|
@ -335,7 +341,7 @@ class nsMenuPopupFrame final : public nsBoxFrame, public nsIReflowCallback {
|
||||||
mozilla::LayoutDeviceIntRect GetConstraintRect(
|
mozilla::LayoutDeviceIntRect GetConstraintRect(
|
||||||
const mozilla::LayoutDeviceIntRect& aAnchorRect,
|
const mozilla::LayoutDeviceIntRect& aAnchorRect,
|
||||||
const mozilla::LayoutDeviceIntRect& aRootScreenRect,
|
const mozilla::LayoutDeviceIntRect& aRootScreenRect,
|
||||||
nsPopupLevel aPopupLevel);
|
PopupLevel aPopupLevel);
|
||||||
|
|
||||||
// Determines whether the given edges of the popup may be moved, where
|
// Determines whether the given edges of the popup may be moved, where
|
||||||
// aHorizontalSide and aVerticalSide are one of the enum Side constants.
|
// aHorizontalSide and aVerticalSide are one of the enum Side constants.
|
||||||
|
|
@ -401,7 +407,7 @@ class nsMenuPopupFrame final : public nsBoxFrame, public nsIReflowCallback {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// returns the popup's level.
|
// returns the popup's level.
|
||||||
nsPopupLevel PopupLevel(bool aIsNoAutoHide) const;
|
PopupLevel GetPopupLevel(bool aIsNoAutoHide) const;
|
||||||
|
|
||||||
void ConstrainSizeForWayland(nsSize&) const;
|
void ConstrainSizeForWayland(nsSize&) const;
|
||||||
|
|
||||||
|
|
@ -566,7 +572,7 @@ class nsMenuPopupFrame final : public nsBoxFrame, public nsIReflowCallback {
|
||||||
// position of our widget didn't change.
|
// position of our widget didn't change.
|
||||||
mozilla::LayoutDeviceIntPoint mLastClientOffset;
|
mozilla::LayoutDeviceIntPoint mLastClientOffset;
|
||||||
|
|
||||||
nsPopupType mPopupType; // type of popup
|
PopupType mPopupType; // type of popup
|
||||||
nsPopupState mPopupState; // open state of the popup
|
nsPopupState mPopupState; // open state of the popup
|
||||||
|
|
||||||
// popup alignment relative to the anchor node
|
// popup alignment relative to the anchor node
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ bool nsXULPopupManager::RollupInternal(RollupKind aKind, uint32_t aCount,
|
||||||
nsMenuChainItem* first = item;
|
nsMenuChainItem* first = item;
|
||||||
while (first->GetParent()) {
|
while (first->GetParent()) {
|
||||||
nsMenuChainItem* parent = first->GetParent();
|
nsMenuChainItem* parent = first->GetParent();
|
||||||
if (first->Frame()->PopupType() != parent->Frame()->PopupType() ||
|
if (first->Frame()->GetPopupType() != parent->Frame()->GetPopupType() ||
|
||||||
first->IsContextMenu() != parent->IsContextMenu()) {
|
first->IsContextMenu() != parent->IsContextMenu()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -477,7 +477,7 @@ bool nsXULPopupManager::ShouldConsumeOnMouseWheelEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMenuPopupFrame* frame = item->Frame();
|
nsMenuPopupFrame* frame = item->Frame();
|
||||||
if (frame->PopupType() != ePopupTypePanel) return true;
|
if (frame->GetPopupType() != PopupType::Panel) return true;
|
||||||
|
|
||||||
return !frame->GetContent()->AsElement()->AttrValueIs(
|
return !frame->GetContent()->AsElement()->AttrValueIs(
|
||||||
kNameSpaceID_None, nsGkAtoms::type, nsGkAtoms::arrow, eCaseMatters);
|
kNameSpaceID_None, nsGkAtoms::type, nsGkAtoms::arrow, eCaseMatters);
|
||||||
|
|
@ -509,7 +509,8 @@ uint32_t nsXULPopupManager::GetSubmenuWidgetChain(
|
||||||
if (!sameTypeCount) {
|
if (!sameTypeCount) {
|
||||||
count++;
|
count++;
|
||||||
if (!parent ||
|
if (!parent ||
|
||||||
item->Frame()->PopupType() != parent->Frame()->PopupType() ||
|
item->Frame()->GetPopupType() !=
|
||||||
|
parent->Frame()->GetPopupType() ||
|
||||||
item->IsContextMenu() != parent->IsContextMenu()) {
|
item->IsContextMenu() != parent->IsContextMenu()) {
|
||||||
sameTypeCount = count;
|
sameTypeCount = count;
|
||||||
}
|
}
|
||||||
|
|
@ -601,7 +602,8 @@ void nsXULPopupManager::PopupMoved(nsIFrame* aFrame, nsIntPoint aPnt,
|
||||||
|
|
||||||
// Don't do anything if the popup is already at the specified location. This
|
// Don't do anything if the popup is already at the specified location. This
|
||||||
// prevents recursive calls when a popup is positioned.
|
// prevents recursive calls when a popup is positioned.
|
||||||
LayoutDeviceIntRect curDevSize = view->CalcWidgetBounds(eWindowType_popup);
|
LayoutDeviceIntRect curDevSize =
|
||||||
|
view->CalcWidgetBounds(widget::WindowType::Popup);
|
||||||
nsIWidget* widget = menuPopupFrame->GetWidget();
|
nsIWidget* widget = menuPopupFrame->GetWidget();
|
||||||
if (curDevSize.x == aPnt.x && curDevSize.y == aPnt.y &&
|
if (curDevSize.x == aPnt.x && curDevSize.y == aPnt.y &&
|
||||||
(!widget ||
|
(!widget ||
|
||||||
|
|
@ -614,7 +616,7 @@ void nsXULPopupManager::PopupMoved(nsIFrame* aFrame, nsIntPoint aPnt,
|
||||||
// relative to the parent window. Otherwise, just update the popup to
|
// relative to the parent window. Otherwise, just update the popup to
|
||||||
// the specified screen coordinates.
|
// the specified screen coordinates.
|
||||||
if (menuPopupFrame->IsAnchored() &&
|
if (menuPopupFrame->IsAnchored() &&
|
||||||
menuPopupFrame->PopupLevel() == ePopupLevelParent) {
|
menuPopupFrame->GetPopupLevel() == widget::PopupLevel::Parent) {
|
||||||
menuPopupFrame->SetPopupPosition(true);
|
menuPopupFrame->SetPopupPosition(true);
|
||||||
} else {
|
} else {
|
||||||
CSSPoint cssPos = LayoutDeviceIntPoint::FromUnknownPoint(aPnt) /
|
CSSPoint cssPos = LayoutDeviceIntPoint::FromUnknownPoint(aPnt) /
|
||||||
|
|
@ -637,7 +639,8 @@ void nsXULPopupManager::PopupResized(nsIFrame* aFrame,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntRect curDevSize = view->CalcWidgetBounds(eWindowType_popup);
|
LayoutDeviceIntRect curDevSize =
|
||||||
|
view->CalcWidgetBounds(widget::WindowType::Popup);
|
||||||
// If the size is what we think it is, we have nothing to do.
|
// If the size is what we think it is, we have nothing to do.
|
||||||
if (curDevSize.width == aSize.width && curDevSize.height == aSize.height) {
|
if (curDevSize.width == aSize.width && curDevSize.height == aSize.height) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -684,10 +687,10 @@ nsMenuChainItem* nsXULPopupManager::GetRollupItem(RollupKind aKind) {
|
||||||
if (item->Frame()->PopupState() == ePopupInvisible) {
|
if (item->Frame()->PopupState() == ePopupInvisible) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
MOZ_ASSERT_IF(item->Frame()->PopupType() == ePopupTypeTooltip,
|
MOZ_ASSERT_IF(item->Frame()->GetPopupType() == PopupType::Tooltip,
|
||||||
item->IsNoAutoHide());
|
item->IsNoAutoHide());
|
||||||
const bool valid = aKind == RollupKind::Tooltip
|
const bool valid = aKind == RollupKind::Tooltip
|
||||||
? item->Frame()->PopupType() == ePopupTypeTooltip
|
? item->Frame()->GetPopupType() == PopupType::Tooltip
|
||||||
: !item->IsNoAutoHide();
|
: !item->IsNoAutoHide();
|
||||||
if (valid) {
|
if (valid) {
|
||||||
return item;
|
return item;
|
||||||
|
|
@ -938,7 +941,8 @@ void nsXULPopupManager::OnNativeMenuClosed() {
|
||||||
popup->AsElement()->UnsetAttr(kNameSpaceID_None, nsGkAtoms::aria_hidden,
|
popup->AsElement()->UnsetAttr(kNameSpaceID_None, nsGkAtoms::aria_hidden,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
if (shouldHideChain && mPopups && mPopups->PopupType() == ePopupTypeMenu) {
|
if (shouldHideChain && mPopups &&
|
||||||
|
mPopups->GetPopupType() == PopupType::Menu) {
|
||||||
// A menu item was activated before this menu closed, and the item requested
|
// A menu item was activated before this menu closed, and the item requested
|
||||||
// the entire popup chain to be closed, which includes any open non-native
|
// the entire popup chain to be closed, which includes any open non-native
|
||||||
// menus.
|
// menus.
|
||||||
|
|
@ -1054,15 +1058,15 @@ void nsXULPopupManager::ShowPopupCallback(nsIContent* aPopup,
|
||||||
nsMenuPopupFrame* aPopupFrame,
|
nsMenuPopupFrame* aPopupFrame,
|
||||||
bool aIsContextMenu,
|
bool aIsContextMenu,
|
||||||
bool aSelectFirstItem) {
|
bool aSelectFirstItem) {
|
||||||
nsPopupType popupType = aPopupFrame->PopupType();
|
PopupType popupType = aPopupFrame->GetPopupType();
|
||||||
const bool isMenu = popupType == ePopupTypeMenu;
|
const bool isMenu = popupType == PopupType::Menu;
|
||||||
|
|
||||||
// Popups normally hide when an outside click occurs. Panels may use
|
// Popups normally hide when an outside click occurs. Panels may use
|
||||||
// the noautohide attribute to disable this behaviour. It is expected
|
// the noautohide attribute to disable this behaviour. It is expected
|
||||||
// that the application will hide these popups manually. The tooltip
|
// that the application will hide these popups manually. The tooltip
|
||||||
// listener will handle closing the tooltip also.
|
// listener will handle closing the tooltip also.
|
||||||
bool isNoAutoHide =
|
bool isNoAutoHide =
|
||||||
aPopupFrame->IsNoAutoHide() || popupType == ePopupTypeTooltip;
|
aPopupFrame->IsNoAutoHide() || popupType == PopupType::Tooltip;
|
||||||
|
|
||||||
auto item = MakeUnique<nsMenuChainItem>(aPopupFrame, isNoAutoHide,
|
auto item = MakeUnique<nsMenuChainItem>(aPopupFrame, isNoAutoHide,
|
||||||
aIsContextMenu, popupType);
|
aIsContextMenu, popupType);
|
||||||
|
|
@ -1227,13 +1231,13 @@ void nsXULPopupManager::HidePopup(nsIContent* aPopup, bool aHideChain,
|
||||||
// For menus, popupToHide is always the frontmost item in the list to hide.
|
// For menus, popupToHide is always the frontmost item in the list to hide.
|
||||||
if (aAsynchronous) {
|
if (aAsynchronous) {
|
||||||
nsCOMPtr<nsIRunnable> event = new nsXULPopupHidingEvent(
|
nsCOMPtr<nsIRunnable> event = new nsXULPopupHidingEvent(
|
||||||
popupToHide, nextPopup, lastPopup, popupFrame->PopupType(),
|
popupToHide, nextPopup, lastPopup, popupFrame->GetPopupType(),
|
||||||
deselectMenu, aIsCancel);
|
deselectMenu, aIsCancel);
|
||||||
aPopup->OwnerDoc()->Dispatch(TaskCategory::Other, event.forget());
|
aPopup->OwnerDoc()->Dispatch(TaskCategory::Other, event.forget());
|
||||||
} else {
|
} else {
|
||||||
RefPtr<nsPresContext> presContext = popupFrame->PresContext();
|
RefPtr<nsPresContext> presContext = popupFrame->PresContext();
|
||||||
FirePopupHidingEvent(popupToHide, nextPopup, lastPopup, presContext,
|
FirePopupHidingEvent(popupToHide, nextPopup, lastPopup, presContext,
|
||||||
popupFrame->PopupType(), deselectMenu, aIsCancel);
|
popupFrame->GetPopupType(), deselectMenu, aIsCancel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1287,7 +1291,7 @@ class TransitionEnder final : public nsIDOMEventListener {
|
||||||
// the first one ending.
|
// the first one ending.
|
||||||
if (RefPtr<nsXULPopupManager> pm = nsXULPopupManager::GetInstance()) {
|
if (RefPtr<nsXULPopupManager> pm = nsXULPopupManager::GetInstance()) {
|
||||||
pm->HidePopupCallback(mContent, popupFrame, nullptr, nullptr,
|
pm->HidePopupCallback(mContent, popupFrame, nullptr, nullptr,
|
||||||
popupFrame->PopupType(), mDeselectMenu);
|
popupFrame->GetPopupType(), mDeselectMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -1304,7 +1308,7 @@ NS_INTERFACE_MAP_END
|
||||||
NS_IMPL_CYCLE_COLLECTION(TransitionEnder, mContent);
|
NS_IMPL_CYCLE_COLLECTION(TransitionEnder, mContent);
|
||||||
void nsXULPopupManager::HidePopupCallback(
|
void nsXULPopupManager::HidePopupCallback(
|
||||||
nsIContent* aPopup, nsMenuPopupFrame* aPopupFrame, nsIContent* aNextPopup,
|
nsIContent* aPopup, nsMenuPopupFrame* aPopupFrame, nsIContent* aNextPopup,
|
||||||
nsIContent* aLastPopup, nsPopupType aPopupType, bool aDeselectMenu) {
|
nsIContent* aLastPopup, PopupType aPopupType, bool aDeselectMenu) {
|
||||||
if (mCloseTimer && mTimerMenu == aPopupFrame) {
|
if (mCloseTimer && mTimerMenu == aPopupFrame) {
|
||||||
mCloseTimer->Cancel();
|
mCloseTimer->Cancel();
|
||||||
mCloseTimer = nullptr;
|
mCloseTimer = nullptr;
|
||||||
|
|
@ -1349,7 +1353,7 @@ void nsXULPopupManager::HidePopupCallback(
|
||||||
// is reached, or until a popup of a different type is reached. This
|
// is reached, or until a popup of a different type is reached. This
|
||||||
// last check is needed so that a menulist inside a non-menu panel only
|
// last check is needed so that a menulist inside a non-menu panel only
|
||||||
// closes the menu and not the panel as well.
|
// closes the menu and not the panel as well.
|
||||||
if (foundMenu && (aLastPopup || aPopupType == foundMenu->PopupType())) {
|
if (foundMenu && (aLastPopup || aPopupType == foundMenu->GetPopupType())) {
|
||||||
nsCOMPtr<nsIContent> popupToHide = foundMenu->Content();
|
nsCOMPtr<nsIContent> popupToHide = foundMenu->Content();
|
||||||
nsMenuChainItem* parent = foundMenu->GetParent();
|
nsMenuChainItem* parent = foundMenu->GetParent();
|
||||||
|
|
||||||
|
|
@ -1363,7 +1367,7 @@ void nsXULPopupManager::HidePopupCallback(
|
||||||
|
|
||||||
RefPtr<nsPresContext> presContext = popupFrame->PresContext();
|
RefPtr<nsPresContext> presContext = popupFrame->PresContext();
|
||||||
FirePopupHidingEvent(popupToHide, nextPopup, aLastPopup, presContext,
|
FirePopupHidingEvent(popupToHide, nextPopup, aLastPopup, presContext,
|
||||||
foundMenu->PopupType(), aDeselectMenu, false);
|
foundMenu->GetPopupType(), aDeselectMenu, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1562,7 +1566,7 @@ void nsXULPopupManager::BeginShowingPopup(const PendingPopup& aPendingPopup,
|
||||||
presShell->FrameNeedsReflow(popupFrame, IntrinsicDirty::FrameAndAncestors,
|
presShell->FrameNeedsReflow(popupFrame, IntrinsicDirty::FrameAndAncestors,
|
||||||
NS_FRAME_IS_DIRTY);
|
NS_FRAME_IS_DIRTY);
|
||||||
|
|
||||||
nsPopupType popupType = popupFrame->PopupType();
|
PopupType popupType = popupFrame->GetPopupType();
|
||||||
|
|
||||||
nsEventStatus status = FirePopupShowingEvent(aPendingPopup, presContext);
|
nsEventStatus status = FirePopupShowingEvent(aPendingPopup, presContext);
|
||||||
|
|
||||||
|
|
@ -1570,7 +1574,7 @@ void nsXULPopupManager::BeginShowingPopup(const PendingPopup& aPendingPopup,
|
||||||
// This is done after the popupshowing event in case that event is cancelled.
|
// This is done after the popupshowing event in case that event is cancelled.
|
||||||
// Using noautofocus="true" will disable this behaviour, which is needed for
|
// Using noautofocus="true" will disable this behaviour, which is needed for
|
||||||
// the autocomplete widget as it manages focus itself.
|
// the autocomplete widget as it manages focus itself.
|
||||||
if (popupType == ePopupTypePanel &&
|
if (popupType == PopupType::Panel &&
|
||||||
!popup->AsElement()->AttrValueIs(kNameSpaceID_None,
|
!popup->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||||
nsGkAtoms::noautofocus, nsGkAtoms::_true,
|
nsGkAtoms::noautofocus, nsGkAtoms::_true,
|
||||||
eCaseMatters)) {
|
eCaseMatters)) {
|
||||||
|
|
@ -1622,7 +1626,7 @@ void nsXULPopupManager::BeginShowingPopup(const PendingPopup& aPendingPopup,
|
||||||
|
|
||||||
void nsXULPopupManager::FirePopupHidingEvent(
|
void nsXULPopupManager::FirePopupHidingEvent(
|
||||||
nsIContent* aPopup, nsIContent* aNextPopup, nsIContent* aLastPopup,
|
nsIContent* aPopup, nsIContent* aNextPopup, nsIContent* aLastPopup,
|
||||||
nsPresContext* aPresContext, nsPopupType aPopupType, bool aDeselectMenu,
|
nsPresContext* aPresContext, PopupType aPopupType, bool aDeselectMenu,
|
||||||
bool aIsCancel) {
|
bool aIsCancel) {
|
||||||
nsCOMPtr<nsIContent> popup = aPopup;
|
nsCOMPtr<nsIContent> popup = aPopup;
|
||||||
RefPtr<PresShell> presShell = aPresContext->PresShell();
|
RefPtr<PresShell> presShell = aPresContext->PresShell();
|
||||||
|
|
@ -1635,7 +1639,7 @@ void nsXULPopupManager::FirePopupHidingEvent(
|
||||||
EventDispatcher::Dispatch(aPopup, aPresContext, &event, nullptr, &status);
|
EventDispatcher::Dispatch(aPopup, aPresContext, &event, nullptr, &status);
|
||||||
|
|
||||||
// when a panel is closed, blur whatever has focus inside the popup
|
// when a panel is closed, blur whatever has focus inside the popup
|
||||||
if (aPopupType == ePopupTypePanel &&
|
if (aPopupType == PopupType::Panel &&
|
||||||
(!aPopup->IsElement() || !aPopup->AsElement()->AttrValueIs(
|
(!aPopup->IsElement() || !aPopup->AsElement()->AttrValueIs(
|
||||||
kNameSpaceID_None, nsGkAtoms::noautofocus,
|
kNameSpaceID_None, nsGkAtoms::noautofocus,
|
||||||
nsGkAtoms::_true, eCaseMatters))) {
|
nsGkAtoms::_true, eCaseMatters))) {
|
||||||
|
|
@ -1733,10 +1737,10 @@ bool nsXULPopupManager::IsPopupOpen(nsIContent* aPopup) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIFrame* nsXULPopupManager::GetTopPopup(nsPopupType aType) {
|
nsIFrame* nsXULPopupManager::GetTopPopup(PopupType aType) {
|
||||||
for (nsMenuChainItem* item = mPopups.get(); item; item = item->GetParent()) {
|
for (nsMenuChainItem* item = mPopups.get(); item; item = item->GetParent()) {
|
||||||
if (item->Frame()->IsVisible() &&
|
if (item->Frame()->IsVisible() &&
|
||||||
(item->PopupType() == aType || aType == ePopupTypeAny)) {
|
(item->GetPopupType() == aType || aType == PopupType::Any)) {
|
||||||
return item->Frame();
|
return item->Frame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1791,7 +1795,7 @@ already_AddRefed<nsINode> nsXULPopupManager::GetLastTriggerNode(
|
||||||
for (nsMenuChainItem* item = mPopups.get(); item;
|
for (nsMenuChainItem* item = mPopups.get(); item;
|
||||||
item = item->GetParent()) {
|
item = item->GetParent()) {
|
||||||
// look for a popup of the same type and document.
|
// look for a popup of the same type and document.
|
||||||
if ((item->PopupType() == ePopupTypeTooltip) == aIsTooltip &&
|
if ((item->GetPopupType() == PopupType::Tooltip) == aIsTooltip &&
|
||||||
item->Content()->GetUncomposedDoc() == aDocument) {
|
item->Content()->GetUncomposedDoc() == aDocument) {
|
||||||
node = nsMenuPopupFrame::GetTriggerContent(item->Frame());
|
node = nsMenuPopupFrame::GetTriggerContent(item->Frame());
|
||||||
if (node) {
|
if (node) {
|
||||||
|
|
@ -1981,7 +1985,7 @@ void nsXULPopupManager::UpdateKeyboardListeners() {
|
||||||
if (item->IgnoreKeys() != eIgnoreKeys_True) {
|
if (item->IgnoreKeys() != eIgnoreKeys_True) {
|
||||||
newTarget = item->Content()->GetComposedDoc();
|
newTarget = item->Content()->GetComposedDoc();
|
||||||
}
|
}
|
||||||
isForMenu = item->PopupType() == ePopupTypeMenu;
|
isForMenu = item->GetPopupType() == PopupType::Menu;
|
||||||
} else if (mActiveMenuBar) {
|
} else if (mActiveMenuBar) {
|
||||||
newTarget = mActiveMenuBar->GetContent()->GetComposedDoc();
|
newTarget = mActiveMenuBar->GetContent()->GetComposedDoc();
|
||||||
isForMenu = true;
|
isForMenu = true;
|
||||||
|
|
@ -2388,7 +2392,7 @@ bool nsXULPopupManager::HandleKeyboardEventWithKeyCode(
|
||||||
|
|
||||||
// Escape should close panels, but the other keys should have no effect.
|
// Escape should close panels, but the other keys should have no effect.
|
||||||
if (aTopVisibleMenuItem &&
|
if (aTopVisibleMenuItem &&
|
||||||
aTopVisibleMenuItem->PopupType() != ePopupTypeMenu) {
|
aTopVisibleMenuItem->GetPopupType() != PopupType::Menu) {
|
||||||
if (keyCode == KeyboardEvent_Binding::DOM_VK_ESCAPE) {
|
if (keyCode == KeyboardEvent_Binding::DOM_VK_ESCAPE) {
|
||||||
HidePopup(aTopVisibleMenuItem->Content(), false, false, false, true);
|
HidePopup(aTopVisibleMenuItem->Content(), false, false, false, true);
|
||||||
aKeyEvent->StopPropagation();
|
aKeyEvent->StopPropagation();
|
||||||
|
|
@ -2539,7 +2543,7 @@ nsresult nsXULPopupManager::KeyUp(KeyboardEvent* aKeyEvent) {
|
||||||
// don't do anything if a menu isn't open or a menubar isn't active
|
// don't do anything if a menu isn't open or a menubar isn't active
|
||||||
if (!mActiveMenuBar) {
|
if (!mActiveMenuBar) {
|
||||||
nsMenuChainItem* item = GetTopVisibleMenu();
|
nsMenuChainItem* item = GetTopVisibleMenu();
|
||||||
if (!item || item->PopupType() != ePopupTypeMenu) return NS_OK;
|
if (!item || item->GetPopupType() != PopupType::Menu) return NS_OK;
|
||||||
|
|
||||||
if (item->IgnoreKeys() == eIgnoreKeys_Shortcuts) {
|
if (item->IgnoreKeys() == eIgnoreKeys_Shortcuts) {
|
||||||
aKeyEvent->StopCrossProcessForwarding();
|
aKeyEvent->StopCrossProcessForwarding();
|
||||||
|
|
@ -2565,7 +2569,7 @@ nsresult nsXULPopupManager::KeyDown(KeyboardEvent* aKeyEvent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't do anything if a menu isn't open or a menubar isn't active
|
// don't do anything if a menu isn't open or a menubar isn't active
|
||||||
if (!mActiveMenuBar && (!item || item->PopupType() != ePopupTypeMenu))
|
if (!mActiveMenuBar && (!item || item->GetPopupType() != PopupType::Menu))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// Since a menu was open, stop propagation of the event to keep other event
|
// Since a menu was open, stop propagation of the event to keep other event
|
||||||
|
|
@ -2618,7 +2622,7 @@ nsresult nsXULPopupManager::KeyPress(KeyboardEvent* aKeyEvent) {
|
||||||
|
|
||||||
nsMenuChainItem* item = GetTopVisibleMenu();
|
nsMenuChainItem* item = GetTopVisibleMenu();
|
||||||
if (item && (item->Frame()->PopupElement().IsLocked() ||
|
if (item && (item->Frame()->PopupElement().IsLocked() ||
|
||||||
item->PopupType() != ePopupTypeMenu)) {
|
item->GetPopupType() != PopupType::Menu)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#define nsXULPopupManager_h__
|
#define nsXULPopupManager_h__
|
||||||
|
|
||||||
#include "mozilla/Logging.h"
|
#include "mozilla/Logging.h"
|
||||||
|
#include "mozilla/widget/InitData.h"
|
||||||
#include "nsHashtablesFwd.h"
|
#include "nsHashtablesFwd.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIRollupListener.h"
|
#include "nsIRollupListener.h"
|
||||||
|
|
@ -25,7 +26,6 @@
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
#include "nsWidgetInitData.h"
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/widget/NativeMenu.h"
|
#include "mozilla/widget/NativeMenu.h"
|
||||||
#include "Units.h"
|
#include "Units.h"
|
||||||
|
|
@ -213,9 +213,10 @@ struct PendingPopup {
|
||||||
// doubly linked list. Note that the linked list is stored beginning from
|
// doubly linked list. Note that the linked list is stored beginning from
|
||||||
// the lowest child in a chain of menus, as this is the active submenu.
|
// the lowest child in a chain of menus, as this is the active submenu.
|
||||||
class nsMenuChainItem {
|
class nsMenuChainItem {
|
||||||
private:
|
using PopupType = mozilla::widget::PopupType;
|
||||||
|
|
||||||
nsMenuPopupFrame* mFrame; // the popup frame
|
nsMenuPopupFrame* mFrame; // the popup frame
|
||||||
nsPopupType mPopupType; // the popup type of the frame
|
PopupType mPopupType; // the popup type of the frame
|
||||||
bool mNoAutoHide; // true for noautohide panels
|
bool mNoAutoHide; // true for noautohide panels
|
||||||
bool mIsContext; // true for context menus
|
bool mIsContext; // true for context menus
|
||||||
bool mOnMenuBar; // true if the menu is on a menu bar
|
bool mOnMenuBar; // true if the menu is on a menu bar
|
||||||
|
|
@ -234,7 +235,7 @@ class nsMenuChainItem {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
nsMenuChainItem(nsMenuPopupFrame* aFrame, bool aNoAutoHide, bool aIsContext,
|
nsMenuChainItem(nsMenuPopupFrame* aFrame, bool aNoAutoHide, bool aIsContext,
|
||||||
nsPopupType aPopupType)
|
PopupType aPopupType)
|
||||||
: mFrame(aFrame),
|
: mFrame(aFrame),
|
||||||
mPopupType(aPopupType),
|
mPopupType(aPopupType),
|
||||||
mNoAutoHide(aNoAutoHide),
|
mNoAutoHide(aNoAutoHide),
|
||||||
|
|
@ -250,10 +251,10 @@ class nsMenuChainItem {
|
||||||
|
|
||||||
nsIContent* Content();
|
nsIContent* Content();
|
||||||
nsMenuPopupFrame* Frame() { return mFrame; }
|
nsMenuPopupFrame* Frame() { return mFrame; }
|
||||||
nsPopupType PopupType() { return mPopupType; }
|
PopupType GetPopupType() { return mPopupType; }
|
||||||
bool IsNoAutoHide() { return mNoAutoHide; }
|
bool IsNoAutoHide() { return mNoAutoHide; }
|
||||||
void SetNoAutoHide(bool aNoAutoHide) { mNoAutoHide = aNoAutoHide; }
|
void SetNoAutoHide(bool aNoAutoHide) { mNoAutoHide = aNoAutoHide; }
|
||||||
bool IsMenu() { return mPopupType == ePopupTypeMenu; }
|
bool IsMenu() { return mPopupType == PopupType::Menu; }
|
||||||
bool IsContextMenu() { return mIsContext; }
|
bool IsContextMenu() { return mIsContext; }
|
||||||
nsIgnoreKeys IgnoreKeys() { return mIgnoreKeys; }
|
nsIgnoreKeys IgnoreKeys() { return mIgnoreKeys; }
|
||||||
void SetIgnoreKeys(nsIgnoreKeys aIgnoreKeys) { mIgnoreKeys = aIgnoreKeys; }
|
void SetIgnoreKeys(nsIgnoreKeys aIgnoreKeys) { mIgnoreKeys = aIgnoreKeys; }
|
||||||
|
|
@ -274,9 +275,11 @@ class nsMenuChainItem {
|
||||||
|
|
||||||
// this class is used for dispatching popuphiding events asynchronously.
|
// this class is used for dispatching popuphiding events asynchronously.
|
||||||
class nsXULPopupHidingEvent : public mozilla::Runnable {
|
class nsXULPopupHidingEvent : public mozilla::Runnable {
|
||||||
|
using PopupType = mozilla::widget::PopupType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
nsXULPopupHidingEvent(nsIContent* aPopup, nsIContent* aNextPopup,
|
nsXULPopupHidingEvent(nsIContent* aPopup, nsIContent* aNextPopup,
|
||||||
nsIContent* aLastPopup, nsPopupType aPopupType,
|
nsIContent* aLastPopup, PopupType aPopupType,
|
||||||
bool aDeselectMenu, bool aIsCancel)
|
bool aDeselectMenu, bool aIsCancel)
|
||||||
: mozilla::Runnable("nsXULPopupHidingEvent"),
|
: mozilla::Runnable("nsXULPopupHidingEvent"),
|
||||||
mPopup(aPopup),
|
mPopup(aPopup),
|
||||||
|
|
@ -296,7 +299,7 @@ class nsXULPopupHidingEvent : public mozilla::Runnable {
|
||||||
nsCOMPtr<nsIContent> mPopup;
|
nsCOMPtr<nsIContent> mPopup;
|
||||||
nsCOMPtr<nsIContent> mNextPopup;
|
nsCOMPtr<nsIContent> mNextPopup;
|
||||||
nsCOMPtr<nsIContent> mLastPopup;
|
nsCOMPtr<nsIContent> mLastPopup;
|
||||||
nsPopupType mPopupType;
|
PopupType mPopupType;
|
||||||
bool mDeselectMenu;
|
bool mDeselectMenu;
|
||||||
bool mIsRollup;
|
bool mIsRollup;
|
||||||
};
|
};
|
||||||
|
|
@ -364,6 +367,8 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
||||||
friend class nsXULMenuCommandEvent;
|
friend class nsXULMenuCommandEvent;
|
||||||
friend class TransitionEnder;
|
friend class TransitionEnder;
|
||||||
|
|
||||||
|
using PopupType = mozilla::widget::PopupType;
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIOBSERVER
|
NS_DECL_NSIOBSERVER
|
||||||
NS_DECL_NSIDOMEVENTLISTENER
|
NS_DECL_NSIDOMEVENTLISTENER
|
||||||
|
|
@ -576,10 +581,10 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the frame for the topmost open popup of a given type, or null if
|
* Return the frame for the topmost open popup of a given type, or null if
|
||||||
* no popup of that type is open. If aType is ePopupTypeAny, a menu of any
|
* no popup of that type is open. If aType is PopupType::Any, a menu of any
|
||||||
* type is returned.
|
* type is returned.
|
||||||
*/
|
*/
|
||||||
nsIFrame* GetTopPopup(nsPopupType aType);
|
nsIFrame* GetTopPopup(PopupType aType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the topmost active menuitem that's currently visible, if any.
|
* Returns the topmost active menuitem that's currently visible, if any.
|
||||||
|
|
@ -747,7 +752,7 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
||||||
bool aSelectFirstItem);
|
bool aSelectFirstItem);
|
||||||
MOZ_CAN_RUN_SCRIPT void HidePopupCallback(
|
MOZ_CAN_RUN_SCRIPT void HidePopupCallback(
|
||||||
nsIContent* aPopup, nsMenuPopupFrame* aPopupFrame, nsIContent* aNextPopup,
|
nsIContent* aPopup, nsMenuPopupFrame* aPopupFrame, nsIContent* aNextPopup,
|
||||||
nsIContent* aLastPopup, nsPopupType aPopupType, bool aDeselectMenu);
|
nsIContent* aLastPopup, PopupType aPopupType, bool aDeselectMenu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger frame construction and reflow in the popup, fire a popupshowing
|
* Trigger frame construction and reflow in the popup, fire a popupshowing
|
||||||
|
|
@ -785,7 +790,7 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
||||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||||
void FirePopupHidingEvent(nsIContent* aPopup, nsIContent* aNextPopup,
|
void FirePopupHidingEvent(nsIContent* aPopup, nsIContent* aNextPopup,
|
||||||
nsIContent* aLastPopup, nsPresContext* aPresContext,
|
nsIContent* aLastPopup, nsPresContext* aPresContext,
|
||||||
nsPopupType aPopupType, bool aDeselectMenu,
|
PopupType aPopupType, bool aDeselectMenu,
|
||||||
bool aIsCancel);
|
bool aIsCancel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -83,9 +83,9 @@ nsIWidget* nsWebBrowser::EnsureWidget() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsWidgetInitData widgetInit;
|
widget::InitData widgetInit;
|
||||||
widgetInit.mClipChildren = true;
|
widgetInit.mClipChildren = true;
|
||||||
widgetInit.mWindowType = eWindowType_child;
|
widgetInit.mWindowType = widget::WindowType::Child;
|
||||||
LayoutDeviceIntRect bounds(0, 0, 0, 0);
|
LayoutDeviceIntRect bounds(0, 0, 0, 0);
|
||||||
|
|
||||||
mInternalWidget->SetWidgetListener(&mWidgetListenerDelegate);
|
mInternalWidget->SetWidgetListener(&mWidgetListenerDelegate);
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,9 @@
|
||||||
#include "mozilla/StartupTimeline.h"
|
#include "mozilla/StartupTimeline.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
using namespace mozilla::widget;
|
||||||
|
|
||||||
nsView::nsView(nsViewManager* aViewManager, nsViewVisibility aVisibility)
|
nsView::nsView(nsViewManager* aViewManager, ViewVisibility aVisibility)
|
||||||
: mViewManager(aViewManager),
|
: mViewManager(aViewManager),
|
||||||
mParent(nullptr),
|
mParent(nullptr),
|
||||||
mNextSibling(nullptr),
|
mNextSibling(nullptr),
|
||||||
|
|
@ -201,12 +202,12 @@ void nsView::ResetWidgetBounds(bool aRecurse, bool aForceSync) {
|
||||||
|
|
||||||
bool nsView::IsEffectivelyVisible() {
|
bool nsView::IsEffectivelyVisible() {
|
||||||
for (nsView* v = this; v; v = v->mParent) {
|
for (nsView* v = this; v; v = v->mParent) {
|
||||||
if (v->GetVisibility() == nsViewVisibility_kHide) return false;
|
if (v->GetVisibility() == ViewVisibility::Hide) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntRect nsView::CalcWidgetBounds(nsWindowType aType) {
|
LayoutDeviceIntRect nsView::CalcWidgetBounds(WindowType aType) {
|
||||||
int32_t p2a = mViewManager->AppUnitsPerDevPixel();
|
int32_t p2a = mViewManager->AppUnitsPerDevPixel();
|
||||||
|
|
||||||
nsRect viewBounds(mDimBounds);
|
nsRect viewBounds(mDimBounds);
|
||||||
|
|
@ -219,7 +220,7 @@ LayoutDeviceIntRect nsView::CalcWidgetBounds(nsWindowType aType) {
|
||||||
// make viewBounds be relative to the parent widget, in appunits
|
// make viewBounds be relative to the parent widget, in appunits
|
||||||
viewBounds += offset;
|
viewBounds += offset;
|
||||||
|
|
||||||
if (parentWidget && aType == eWindowType_popup && IsEffectivelyVisible()) {
|
if (parentWidget && aType == WindowType::Popup && IsEffectivelyVisible()) {
|
||||||
// put offset into screen coordinates. (based on client area origin)
|
// put offset into screen coordinates. (based on client area origin)
|
||||||
LayoutDeviceIntPoint screenPoint = parentWidget->WidgetToScreenOffset();
|
LayoutDeviceIntPoint screenPoint = parentWidget->WidgetToScreenOffset();
|
||||||
viewBounds += nsPoint(NSIntPixelsToAppUnits(screenPoint.x, p2a),
|
viewBounds += nsPoint(NSIntPixelsToAppUnits(screenPoint.x, p2a),
|
||||||
|
|
@ -237,7 +238,7 @@ LayoutDeviceIntRect nsView::CalcWidgetBounds(nsWindowType aType) {
|
||||||
// rounding to the nearest value that won't yield a fractional display pixel.
|
// rounding to the nearest value that won't yield a fractional display pixel.
|
||||||
nsIWidget* widget = parentWidget ? parentWidget : mWindow.get();
|
nsIWidget* widget = parentWidget ? parentWidget : mWindow.get();
|
||||||
uint32_t round;
|
uint32_t round;
|
||||||
if (aType == eWindowType_popup && widget &&
|
if (aType == WindowType::Popup && widget &&
|
||||||
((round = widget->RoundsWidgetCoordinatesTo()) > 1)) {
|
((round = widget->RoundsWidgetCoordinatesTo()) > 1)) {
|
||||||
LayoutDeviceIntSize pixelRoundedSize = newBounds.Size();
|
LayoutDeviceIntSize pixelRoundedSize = newBounds.Size();
|
||||||
// round the top left and bottom right to the nearest round pixel
|
// round the top left and bottom right to the nearest round pixel
|
||||||
|
|
@ -300,12 +301,12 @@ void nsView::DoResetWidgetBounds(bool aMoveOnly, bool aInvalidateChangedSize) {
|
||||||
// from sync painting/flushing from Show/Move/Resize on the widget).
|
// from sync painting/flushing from Show/Move/Resize on the widget).
|
||||||
LayoutDeviceIntRect newBounds;
|
LayoutDeviceIntRect newBounds;
|
||||||
|
|
||||||
nsWindowType type = widget->WindowType();
|
WindowType type = widget->GetWindowType();
|
||||||
|
|
||||||
LayoutDeviceIntRect curBounds = widget->GetClientBounds();
|
LayoutDeviceIntRect curBounds = widget->GetClientBounds();
|
||||||
bool invisiblePopup = type == eWindowType_popup &&
|
bool invisiblePopup = type == WindowType::Popup &&
|
||||||
((curBounds.IsEmpty() && mDimBounds.IsEmpty()) ||
|
((curBounds.IsEmpty() && mDimBounds.IsEmpty()) ||
|
||||||
mVis == nsViewVisibility_kHide);
|
mVis == ViewVisibility::Hide);
|
||||||
|
|
||||||
if (invisiblePopup) {
|
if (invisiblePopup) {
|
||||||
// We're going to hit the early exit below, avoid calling CalcWidgetBounds.
|
// We're going to hit the early exit below, avoid calling CalcWidgetBounds.
|
||||||
|
|
@ -395,7 +396,7 @@ void nsView::NotifyEffectiveVisibilityChanged(bool aEffectivelyVisible) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (nsView* child = mFirstChild; child; child = child->mNextSibling) {
|
for (nsView* child = mFirstChild; child; child = child->mNextSibling) {
|
||||||
if (child->mVis == nsViewVisibility_kHide) {
|
if (child->mVis == ViewVisibility::Hide) {
|
||||||
// It was effectively hidden and still is
|
// It was effectively hidden and still is
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -404,7 +405,7 @@ void nsView::NotifyEffectiveVisibilityChanged(bool aEffectivelyVisible) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsView::SetVisibility(nsViewVisibility aVisibility) {
|
void nsView::SetVisibility(ViewVisibility aVisibility) {
|
||||||
mVis = aVisibility;
|
mVis = aVisibility;
|
||||||
NotifyEffectiveVisibilityChanged(IsEffectivelyVisible());
|
NotifyEffectiveVisibilityChanged(IsEffectivelyVisible());
|
||||||
}
|
}
|
||||||
|
|
@ -514,19 +515,19 @@ static int32_t FindNonAutoZIndex(nsView* aView) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DefaultWidgetInitData : public nsWidgetInitData {
|
struct DefaultWidgetInitData : public widget::InitData {
|
||||||
DefaultWidgetInitData() : nsWidgetInitData() {
|
DefaultWidgetInitData() : widget::InitData() {
|
||||||
mWindowType = eWindowType_child;
|
mWindowType = WindowType::Child;
|
||||||
mClipChildren = true;
|
mClipChildren = true;
|
||||||
mClipSiblings = true;
|
mClipSiblings = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
nsresult nsView::CreateWidget(nsWidgetInitData* aWidgetInitData,
|
nsresult nsView::CreateWidget(widget::InitData* aWidgetInitData,
|
||||||
bool aEnableDragDrop, bool aResetVisibility) {
|
bool aEnableDragDrop, bool aResetVisibility) {
|
||||||
AssertNoWindow();
|
AssertNoWindow();
|
||||||
MOZ_ASSERT(
|
MOZ_ASSERT(
|
||||||
!aWidgetInitData || aWidgetInitData->mWindowType != eWindowType_popup,
|
!aWidgetInitData || aWidgetInitData->mWindowType != WindowType::Popup,
|
||||||
"Use CreateWidgetForPopup");
|
"Use CreateWidgetForPopup");
|
||||||
|
|
||||||
DefaultWidgetInitData defaultInitData;
|
DefaultWidgetInitData defaultInitData;
|
||||||
|
|
@ -553,12 +554,12 @@ nsresult nsView::CreateWidget(nsWidgetInitData* aWidgetInitData,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsView::CreateWidgetForParent(nsIWidget* aParentWidget,
|
nsresult nsView::CreateWidgetForParent(nsIWidget* aParentWidget,
|
||||||
nsWidgetInitData* aWidgetInitData,
|
widget::InitData* aWidgetInitData,
|
||||||
bool aEnableDragDrop,
|
bool aEnableDragDrop,
|
||||||
bool aResetVisibility) {
|
bool aResetVisibility) {
|
||||||
AssertNoWindow();
|
AssertNoWindow();
|
||||||
MOZ_ASSERT(
|
MOZ_ASSERT(
|
||||||
!aWidgetInitData || aWidgetInitData->mWindowType != eWindowType_popup,
|
!aWidgetInitData || aWidgetInitData->mWindowType != WindowType::Popup,
|
||||||
"Use CreateWidgetForPopup");
|
"Use CreateWidgetForPopup");
|
||||||
MOZ_ASSERT(aParentWidget, "Parent widget required");
|
MOZ_ASSERT(aParentWidget, "Parent widget required");
|
||||||
|
|
||||||
|
|
@ -577,13 +578,13 @@ nsresult nsView::CreateWidgetForParent(nsIWidget* aParentWidget,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsView::CreateWidgetForPopup(nsWidgetInitData* aWidgetInitData,
|
nsresult nsView::CreateWidgetForPopup(widget::InitData* aWidgetInitData,
|
||||||
nsIWidget* aParentWidget,
|
nsIWidget* aParentWidget,
|
||||||
bool aEnableDragDrop,
|
bool aEnableDragDrop,
|
||||||
bool aResetVisibility) {
|
bool aResetVisibility) {
|
||||||
AssertNoWindow();
|
AssertNoWindow();
|
||||||
MOZ_ASSERT(aWidgetInitData, "Widget init data required");
|
MOZ_ASSERT(aWidgetInitData, "Widget init data required");
|
||||||
MOZ_ASSERT(aWidgetInitData->mWindowType == eWindowType_popup,
|
MOZ_ASSERT(aWidgetInitData->mWindowType == WindowType::Popup,
|
||||||
"Use one of the other CreateWidget methods");
|
"Use one of the other CreateWidget methods");
|
||||||
|
|
||||||
LayoutDeviceIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
|
LayoutDeviceIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
|
||||||
|
|
@ -663,14 +664,14 @@ nsresult nsView::AttachToTopLevelWidget(nsIWidget* aWidget) {
|
||||||
mWindow = aWidget;
|
mWindow = aWidget;
|
||||||
|
|
||||||
mWindow->SetAttachedWidgetListener(this);
|
mWindow->SetAttachedWidgetListener(this);
|
||||||
if (mWindow->WindowType() != eWindowType_invisible) {
|
if (mWindow->GetWindowType() != WindowType::Invisible) {
|
||||||
nsresult rv = mWindow->AsyncEnableDragDrop(true);
|
nsresult rv = mWindow->AsyncEnableDragDrop(true);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
mWidgetIsTopLevel = true;
|
mWidgetIsTopLevel = true;
|
||||||
|
|
||||||
// Refresh the view bounds
|
// Refresh the view bounds
|
||||||
CalcWidgetBounds(mWindow->WindowType());
|
CalcWidgetBounds(mWindow->GetWindowType());
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -760,8 +761,8 @@ void nsView::List(FILE* out, int32_t aIndent) const {
|
||||||
nsRect brect = GetBounds();
|
nsRect brect = GetBounds();
|
||||||
fprintf(out, "{%d,%d,%d,%d} @ %d,%d", brect.X(), brect.Y(), brect.Width(),
|
fprintf(out, "{%d,%d,%d,%d} @ %d,%d", brect.X(), brect.Y(), brect.Width(),
|
||||||
brect.Height(), mPosX, mPosY);
|
brect.Height(), mPosX, mPosY);
|
||||||
fprintf(out, " flags=%x z=%d vis=%d frame=%p <\n", mVFlags, mZIndex, mVis,
|
fprintf(out, " flags=%x z=%d vis=%d frame=%p <\n", mVFlags, mZIndex,
|
||||||
static_cast<void*>(mFrame));
|
int(mVis), mFrame);
|
||||||
for (nsView* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
|
for (nsView* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
|
||||||
NS_ASSERTION(kid->GetParent() == this, "incorrect parent");
|
NS_ASSERTION(kid->GetParent() == this, "incorrect parent");
|
||||||
kid->List(out, aIndent + 1);
|
kid->List(out, aIndent + 1);
|
||||||
|
|
@ -914,7 +915,7 @@ nsPoint nsView::ConvertFromParentCoords(nsPoint aPt) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsPopupWidget(nsIWidget* aWidget) {
|
static bool IsPopupWidget(nsIWidget* aWidget) {
|
||||||
return (aWidget->WindowType() == eWindowType_popup);
|
return aWidget->GetWindowType() == WindowType::Popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
PresShell* nsView::GetPresShell() { return GetViewManager()->GetPresShell(); }
|
PresShell* nsView::GetPresShell() { return GetViewManager()->GetPresShell(); }
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
#include "nsRegion.h"
|
#include "nsRegion.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsWidgetInitData.h" // for nsWindowType
|
|
||||||
#include "nsIWidgetListener.h"
|
#include "nsIWidgetListener.h"
|
||||||
#include "Units.h"
|
#include "Units.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
|
@ -25,6 +24,10 @@ class nsIFrame;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class PresShell;
|
class PresShell;
|
||||||
|
namespace widget {
|
||||||
|
struct InitData;
|
||||||
|
enum class WindowType : uint8_t;
|
||||||
|
} // namespace widget
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -90,10 +93,7 @@ class PresShell;
|
||||||
// hide - the layer is not shown.
|
// hide - the layer is not shown.
|
||||||
// show - the layer is shown irrespective of the visibility of
|
// show - the layer is shown irrespective of the visibility of
|
||||||
// the layer's parent.
|
// the layer's parent.
|
||||||
enum nsViewVisibility {
|
enum class ViewVisibility : uint8_t { Hide = 0, Show = 1 };
|
||||||
nsViewVisibility_kHide = 0,
|
|
||||||
nsViewVisibility_kShow = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
// Public view flags
|
// Public view flags
|
||||||
|
|
||||||
|
|
@ -228,7 +228,7 @@ class nsView final : public nsIWidgetListener {
|
||||||
* Called to query the visibility state of a view.
|
* Called to query the visibility state of a view.
|
||||||
* @result current visibility state
|
* @result current visibility state
|
||||||
*/
|
*/
|
||||||
nsViewVisibility GetVisibility() const { return mVis; }
|
ViewVisibility GetVisibility() const { return mVis; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether the view "floats" above all other views,
|
* Get whether the view "floats" above all other views,
|
||||||
|
|
@ -289,7 +289,7 @@ class nsView final : public nsIWidgetListener {
|
||||||
* its create is called.
|
* its create is called.
|
||||||
* @return error status
|
* @return error status
|
||||||
*/
|
*/
|
||||||
nsresult CreateWidget(nsWidgetInitData* aWidgetInitData = nullptr,
|
nsresult CreateWidget(mozilla::widget::InitData* aWidgetInitData = nullptr,
|
||||||
bool aEnableDragDrop = true,
|
bool aEnableDragDrop = true,
|
||||||
bool aResetVisibility = true);
|
bool aResetVisibility = true);
|
||||||
|
|
||||||
|
|
@ -299,7 +299,7 @@ class nsView final : public nsIWidgetListener {
|
||||||
* as for |CreateWidget()|.
|
* as for |CreateWidget()|.
|
||||||
*/
|
*/
|
||||||
nsresult CreateWidgetForParent(nsIWidget* aParentWidget,
|
nsresult CreateWidgetForParent(nsIWidget* aParentWidget,
|
||||||
nsWidgetInitData* aWidgetInitData = nullptr,
|
mozilla::widget::InitData* = nullptr,
|
||||||
bool aEnableDragDrop = true,
|
bool aEnableDragDrop = true,
|
||||||
bool aResetVisibility = true);
|
bool aResetVisibility = true);
|
||||||
|
|
||||||
|
|
@ -310,7 +310,7 @@ class nsView final : public nsIWidgetListener {
|
||||||
* other params are the same as for |CreateWidget()|, except that
|
* other params are the same as for |CreateWidget()|, except that
|
||||||
* |aWidgetInitData| must be nonnull.
|
* |aWidgetInitData| must be nonnull.
|
||||||
*/
|
*/
|
||||||
nsresult CreateWidgetForPopup(nsWidgetInitData* aWidgetInitData,
|
nsresult CreateWidgetForPopup(mozilla::widget::InitData*,
|
||||||
nsIWidget* aParentWidget = nullptr,
|
nsIWidget* aParentWidget = nullptr,
|
||||||
bool aEnableDragDrop = true,
|
bool aEnableDragDrop = true,
|
||||||
bool aResetVisibility = true);
|
bool aResetVisibility = true);
|
||||||
|
|
@ -395,7 +395,7 @@ class nsView final : public nsIWidgetListener {
|
||||||
*/
|
*/
|
||||||
bool IsRoot() const;
|
bool IsRoot() const;
|
||||||
|
|
||||||
LayoutDeviceIntRect CalcWidgetBounds(nsWindowType aType);
|
LayoutDeviceIntRect CalcWidgetBounds(mozilla::widget::WindowType);
|
||||||
|
|
||||||
// This is an app unit offset to add when converting view coordinates to
|
// This is an app unit offset to add when converting view coordinates to
|
||||||
// widget coordinates. It is the offset in view coordinates from widget
|
// widget coordinates. It is the offset in view coordinates from widget
|
||||||
|
|
@ -481,8 +481,8 @@ class nsView final : public nsIWidgetListener {
|
||||||
bool IsPrimaryFramePaintSuppressed();
|
bool IsPrimaryFramePaintSuppressed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit nsView(nsViewManager* aViewManager = nullptr,
|
explicit nsView(nsViewManager* = nullptr,
|
||||||
nsViewVisibility aVisibility = nsViewVisibility_kShow);
|
ViewVisibility = ViewVisibility::Show);
|
||||||
|
|
||||||
bool ForcedRepaint() { return mForcedRepaint; }
|
bool ForcedRepaint() { return mForcedRepaint; }
|
||||||
|
|
||||||
|
|
@ -507,7 +507,7 @@ class nsView final : public nsIWidgetListener {
|
||||||
* changed.
|
* changed.
|
||||||
* @param visibility new visibility state
|
* @param visibility new visibility state
|
||||||
*/
|
*/
|
||||||
void SetVisibility(nsViewVisibility visibility);
|
void SetVisibility(ViewVisibility visibility);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Get whether the view "floats" above all other views,
|
* Set/Get whether the view "floats" above all other views,
|
||||||
|
|
@ -550,7 +550,7 @@ class nsView final : public nsIWidgetListener {
|
||||||
nsIFrame* mFrame;
|
nsIFrame* mFrame;
|
||||||
mozilla::UniquePtr<nsRegion> mDirtyRegion;
|
mozilla::UniquePtr<nsRegion> mDirtyRegion;
|
||||||
int32_t mZIndex;
|
int32_t mZIndex;
|
||||||
nsViewVisibility mVis;
|
ViewVisibility mVis;
|
||||||
// position relative our parent view origin but in our appunits
|
// position relative our parent view origin but in our appunits
|
||||||
nscoord mPosX, mPosY;
|
nscoord mPosX, mPosY;
|
||||||
// relative to parent, but in our appunits
|
// relative to parent, but in our appunits
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ nsresult nsViewManager::Init(nsDeviceContext* aContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nsView* nsViewManager::CreateView(const nsRect& aBounds, nsView* aParent,
|
nsView* nsViewManager::CreateView(const nsRect& aBounds, nsView* aParent,
|
||||||
nsViewVisibility aVisibilityFlag) {
|
ViewVisibility aVisibilityFlag) {
|
||||||
auto* v = new nsView(this, aVisibilityFlag);
|
auto* v = new nsView(this, aVisibilityFlag);
|
||||||
v->SetParent(aParent);
|
v->SetParent(aParent);
|
||||||
v->SetPosition(aBounds.X(), aBounds.Y());
|
v->SetPosition(aBounds.X(), aBounds.Y());
|
||||||
|
|
@ -251,7 +251,7 @@ nsView* nsViewManager::GetDisplayRootFor(nsView* aView) {
|
||||||
// distinguish this situation. We do this by looking for a widget. Any view
|
// distinguish this situation. We do this by looking for a widget. Any view
|
||||||
// with a widget is a display root.
|
// with a widget is a display root.
|
||||||
nsIWidget* widget = displayRoot->GetWidget();
|
nsIWidget* widget = displayRoot->GetWidget();
|
||||||
if (widget && widget->WindowType() == eWindowType_popup) {
|
if (widget && widget->GetWindowType() == widget::WindowType::Popup) {
|
||||||
NS_ASSERTION(displayRoot->GetFloating() && displayParent->GetFloating(),
|
NS_ASSERTION(displayRoot->GetFloating() && displayParent->GetFloating(),
|
||||||
"this should only happen with floating views that have "
|
"this should only happen with floating views that have "
|
||||||
"floating parents");
|
"floating parents");
|
||||||
|
|
@ -836,8 +836,7 @@ void nsViewManager::SetViewFloating(nsView* aView, bool aFloating) {
|
||||||
aView->SetFloating(aFloating);
|
aView->SetFloating(aFloating);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsViewManager::SetViewVisibility(nsView* aView,
|
void nsViewManager::SetViewVisibility(nsView* aView, ViewVisibility aVisible) {
|
||||||
nsViewVisibility aVisible) {
|
|
||||||
NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
|
NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
|
||||||
|
|
||||||
if (aVisible != aView->GetVisibility()) {
|
if (aVisible != aView->GetVisibility()) {
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class nsViewManager final {
|
||||||
* @result The new view. Never null.
|
* @result The new view. Never null.
|
||||||
*/
|
*/
|
||||||
nsView* CreateView(const nsRect& aBounds, nsView* aParent,
|
nsView* CreateView(const nsRect& aBounds, nsView* aParent,
|
||||||
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
|
ViewVisibility aVisibilityFlag = ViewVisibility::Show);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the root of the view tree.
|
* Get the root of the view tree.
|
||||||
|
|
@ -198,7 +198,7 @@ class nsViewManager final {
|
||||||
* @param aView view to change visibility state of
|
* @param aView view to change visibility state of
|
||||||
* @param visible new visibility state
|
* @param visible new visibility state
|
||||||
*/
|
*/
|
||||||
void SetViewVisibility(nsView* aView, nsViewVisibility aVisible);
|
void SetViewVisibility(nsView* aView, ViewVisibility aVisible);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the z-index of a view. Positive z-indices mean that a view
|
* Set the z-index of a view. Positive z-indices mean that a view
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ LayoutDeviceIntRegion CompositorWidget::GetTransparentRegion() {
|
||||||
// transparent. Widgets wanting more complex transparency region determination
|
// transparent. Widgets wanting more complex transparency region determination
|
||||||
// should override this method.
|
// should override this method.
|
||||||
auto* widget = RealWidget();
|
auto* widget = RealWidget();
|
||||||
if (!widget || widget->GetTransparencyMode() != eTransparencyOpaque ||
|
if (!widget || widget->GetTransparencyMode() != TransparencyMode::Opaque ||
|
||||||
widget->WidgetPaintsBackground()) {
|
widget->WidgetPaintsBackground()) {
|
||||||
return LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0), GetClientSize());
|
return LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0), GetClientSize());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
105
widget/InitData.h
Normal file
105
widget/InitData.h
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#ifndef mozilla_widget_InitData_h__
|
||||||
|
#define mozilla_widget_InitData_h__
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include "mozilla/TypedEnumBits.h"
|
||||||
|
#include "X11UndefineNone.h"
|
||||||
|
|
||||||
|
namespace mozilla::widget {
|
||||||
|
|
||||||
|
// Window types
|
||||||
|
enum class WindowType : uint8_t {
|
||||||
|
TopLevel, // default top level window
|
||||||
|
Dialog, // top level window but usually handled differently
|
||||||
|
// by the OS
|
||||||
|
Sheet, // MacOSX sheet (special dialog class)
|
||||||
|
Popup, // used for combo boxes, etc
|
||||||
|
Child, // child windows (contained inside a window on the
|
||||||
|
// desktop (has no border))
|
||||||
|
Invisible, // windows that are invisible or offscreen
|
||||||
|
};
|
||||||
|
|
||||||
|
// Popup types for WindowType::Popup
|
||||||
|
enum class PopupType : uint8_t {
|
||||||
|
Panel,
|
||||||
|
Menu,
|
||||||
|
Tooltip,
|
||||||
|
Any, // used only to pass to nsXULPopupManager::GetTopPopup
|
||||||
|
};
|
||||||
|
|
||||||
|
// Popup levels specify the window ordering behaviour.
|
||||||
|
enum class PopupLevel : uint8_t {
|
||||||
|
// The popup appears just above its parent and maintains its position
|
||||||
|
// relative to the parent.
|
||||||
|
Parent,
|
||||||
|
// The popup is a floating popup used for tool palettes. A parent window must
|
||||||
|
// be specified, but a platform implementation need not use this. On Windows,
|
||||||
|
// floating is generally equivalent to parent. On Mac, floating puts the
|
||||||
|
// popup at toplevel, but it will hide when the application is deactivated.
|
||||||
|
Floating,
|
||||||
|
// The popup appears on top of other windows, including those of other
|
||||||
|
// applications.
|
||||||
|
Top,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Border styles
|
||||||
|
enum class BorderStyle : int16_t {
|
||||||
|
None = 0, // no border, titlebar, etc.. opposite of all
|
||||||
|
All = 1 << 0, // all window decorations
|
||||||
|
Border = 1 << 1, // enables the border on the window. these
|
||||||
|
// are only for decoration and are not
|
||||||
|
// resize handles
|
||||||
|
ResizeH = 1 << 2, // enables the resize handles for the
|
||||||
|
// window. if this is set, border is
|
||||||
|
// implied to also be set
|
||||||
|
Title = 1 << 3, // enables the titlebar for the window
|
||||||
|
Menu = 1 << 4, // enables the window menu button on the
|
||||||
|
// title bar. this being on should force
|
||||||
|
// the title bar to display
|
||||||
|
Minimize = 1 << 5, // enables the minimize button so the user
|
||||||
|
// can minimize the window. turned off for
|
||||||
|
// tranient windows since they can not be
|
||||||
|
// minimized separate from their parent
|
||||||
|
Maximize = 1 << 6, // enables the maxmize button so the user
|
||||||
|
// can maximize the window
|
||||||
|
Close = 1 << 7, // show the close button
|
||||||
|
Default = -1 // whatever the OS wants... i.e. don't do anything
|
||||||
|
};
|
||||||
|
|
||||||
|
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(BorderStyle)
|
||||||
|
|
||||||
|
// Basic struct for widget initialization data.
|
||||||
|
// @see Create member function of nsIWidget
|
||||||
|
struct InitData {
|
||||||
|
WindowType mWindowType = WindowType::Child;
|
||||||
|
BorderStyle mBorderStyle = BorderStyle::Default;
|
||||||
|
PopupType mPopupHint = PopupType::Panel;
|
||||||
|
PopupLevel mPopupLevel = PopupLevel::Top;
|
||||||
|
// when painting exclude area occupied by child windows and sibling windows
|
||||||
|
bool mClipChildren = false;
|
||||||
|
bool mClipSiblings = false;
|
||||||
|
bool mForMenupopupFrame = false;
|
||||||
|
bool mRTL = false;
|
||||||
|
bool mNoAutoHide = false; // true for noautohide panels
|
||||||
|
bool mIsDragPopup = false; // true for drag feedback panels
|
||||||
|
// true if window creation animation is suppressed, e.g. for session restore
|
||||||
|
bool mIsAnimationSuppressed = false;
|
||||||
|
// true if the window should support an alpha channel, if available.
|
||||||
|
bool mSupportTranslucency = false;
|
||||||
|
bool mHasRemoteContent = false;
|
||||||
|
bool mAlwaysOnTop = false;
|
||||||
|
// Is PictureInPicture window
|
||||||
|
bool mPIPWindow = false;
|
||||||
|
// True if the window is user-resizable.
|
||||||
|
bool mResizable = false;
|
||||||
|
bool mIsPrivate = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mozilla::widget
|
||||||
|
|
||||||
|
#endif // mozilla_widget_InitData
|
||||||
|
|
@ -58,11 +58,11 @@ already_AddRefed<nsIWidget> nsIWidget::CreatePuppetWidget(
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace widget {
|
namespace widget {
|
||||||
|
|
||||||
static bool IsPopup(const nsWidgetInitData* aInitData) {
|
static bool IsPopup(const widget::InitData* aInitData) {
|
||||||
return aInitData && aInitData->mWindowType == eWindowType_popup;
|
return aInitData && aInitData->mWindowType == WindowType::Popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool MightNeedIMEFocus(const nsWidgetInitData* aInitData) {
|
static bool MightNeedIMEFocus(const widget::InitData* aInitData) {
|
||||||
// In the puppet-widget world, popup widgets are just dummies and
|
// In the puppet-widget world, popup widgets are just dummies and
|
||||||
// shouldn't try to mess with IME state.
|
// shouldn't try to mess with IME state.
|
||||||
#ifdef MOZ_CROSS_PROCESS_IME
|
#ifdef MOZ_CROSS_PROCESS_IME
|
||||||
|
|
@ -95,7 +95,7 @@ PuppetWidget::~PuppetWidget() { Destroy(); }
|
||||||
void PuppetWidget::InfallibleCreate(nsIWidget* aParent,
|
void PuppetWidget::InfallibleCreate(nsIWidget* aParent,
|
||||||
nsNativeWidget aNativeParent,
|
nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData) {
|
widget::InitData* aInitData) {
|
||||||
MOZ_ASSERT(!aNativeParent, "got a non-Puppet native parent");
|
MOZ_ASSERT(!aNativeParent, "got a non-Puppet native parent");
|
||||||
|
|
||||||
BaseCreate(nullptr, aInitData);
|
BaseCreate(nullptr, aInitData);
|
||||||
|
|
@ -121,7 +121,7 @@ void PuppetWidget::InfallibleCreate(nsIWidget* aParent,
|
||||||
|
|
||||||
nsresult PuppetWidget::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
nsresult PuppetWidget::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData) {
|
widget::InitData* aInitData) {
|
||||||
InfallibleCreate(aParent, aNativeParent, aRect, aInitData);
|
InfallibleCreate(aParent, aNativeParent, aRect, aInitData);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -137,7 +137,7 @@ void PuppetWidget::InitIMEState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsIWidget> PuppetWidget::CreateChild(
|
already_AddRefed<nsIWidget> PuppetWidget::CreateChild(
|
||||||
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData,
|
const LayoutDeviceIntRect& aRect, widget::InitData* aInitData,
|
||||||
bool aForceUseIWidgetParent) {
|
bool aForceUseIWidgetParent) {
|
||||||
bool isPopup = IsPopup(aInitData);
|
bool isPopup = IsPopup(aInitData);
|
||||||
nsCOMPtr<nsIWidget> widget = nsIWidget::CreatePuppetWidget(mBrowserChild);
|
nsCOMPtr<nsIWidget> widget = nsIWidget::CreatePuppetWidget(mBrowserChild);
|
||||||
|
|
@ -273,7 +273,7 @@ nsresult PuppetWidget::DispatchEvent(WidgetGUIEvent* aEvent,
|
||||||
debug_DumpEvent(stdout, aEvent->mWidget, aEvent, "PuppetWidget", 0);
|
debug_DumpEvent(stdout, aEvent->mWidget, aEvent, "PuppetWidget", 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MOZ_ASSERT(!mChild || mChild->mWindowType == eWindowType_popup,
|
MOZ_ASSERT(!mChild || mChild->mWindowType == WindowType::Popup,
|
||||||
"Unexpected event dispatch!");
|
"Unexpected event dispatch!");
|
||||||
|
|
||||||
MOZ_ASSERT(!aEvent->AsKeyboardEvent() ||
|
MOZ_ASSERT(!aEvent->AsKeyboardEvent() ||
|
||||||
|
|
@ -994,7 +994,7 @@ bool PuppetWidget::NeedsPaint() {
|
||||||
// here
|
// here
|
||||||
if (XRE_IsContentProcess() &&
|
if (XRE_IsContentProcess() &&
|
||||||
StaticPrefs::browser_tabs_remote_desktopbehavior() &&
|
StaticPrefs::browser_tabs_remote_desktopbehavior() &&
|
||||||
mWindowType == eWindowType_popup) {
|
mWindowType == WindowType::Popup) {
|
||||||
NS_WARNING("Trying to paint an e10s popup in the child process!");
|
NS_WARNING("Trying to paint an e10s popup in the child process!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,15 +73,15 @@ class PuppetWidget : public nsBaseWidget,
|
||||||
using nsBaseWidget::Create; // for Create signature not overridden here
|
using nsBaseWidget::Create; // for Create signature not overridden here
|
||||||
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) override;
|
widget::InitData* aInitData = nullptr) override;
|
||||||
void InfallibleCreate(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
void InfallibleCreate(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr);
|
widget::InitData* aInitData = nullptr);
|
||||||
|
|
||||||
void InitIMEState();
|
void InitIMEState();
|
||||||
|
|
||||||
virtual already_AddRefed<nsIWidget> CreateChild(
|
virtual already_AddRefed<nsIWidget> CreateChild(
|
||||||
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData = nullptr,
|
const LayoutDeviceIntRect& aRect, widget::InitData* aInitData = nullptr,
|
||||||
bool aForceUseIWidgetParent = false) override;
|
bool aForceUseIWidgetParent = false) override;
|
||||||
|
|
||||||
virtual void Destroy() override;
|
virtual void Destroy() override;
|
||||||
|
|
@ -171,8 +171,8 @@ class PuppetWidget : public nsBaseWidget,
|
||||||
// same-process subdocuments, we force the widget here to be
|
// same-process subdocuments, we force the widget here to be
|
||||||
// transparent, which in turn will cause layout to use a transparent
|
// transparent, which in turn will cause layout to use a transparent
|
||||||
// backstop background color.
|
// backstop background color.
|
||||||
virtual nsTransparencyMode GetTransparencyMode() override {
|
virtual TransparencyMode GetTransparencyMode() override {
|
||||||
return eTransparencyTransparent;
|
return TransparencyMode::Transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WindowRenderer* GetWindowRenderer() override;
|
virtual WindowRenderer* GetWindowRenderer() override;
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,11 @@ struct ParamTraits<mozilla::LookAndFeel::ColorID>
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ParamTraits<nsTransparencyMode>
|
struct ParamTraits<mozilla::widget::TransparencyMode>
|
||||||
: ContiguousEnumSerializerInclusive<nsTransparencyMode, eTransparencyOpaque,
|
: ContiguousEnumSerializerInclusive<
|
||||||
eTransparencyBorderlessGlass> {};
|
mozilla::widget::TransparencyMode,
|
||||||
|
mozilla::widget::TransparencyMode::Opaque,
|
||||||
|
mozilla::widget::TransparencyMode::BorderlessGlass> {};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ParamTraits<nsCursor>
|
struct ParamTraits<nsCursor>
|
||||||
|
|
|
||||||
|
|
@ -1898,7 +1898,7 @@ already_AddRefed<nsWindow> nsWindow::From(nsIWidget* aWidget) {
|
||||||
// widget is a top-level window and that its NS_NATIVE_WIDGET value is
|
// widget is a top-level window and that its NS_NATIVE_WIDGET value is
|
||||||
// non-null, which is not the case for non-native widgets like
|
// non-null, which is not the case for non-native widgets like
|
||||||
// PuppetWidget.
|
// PuppetWidget.
|
||||||
if (aWidget && aWidget->WindowType() == nsWindowType::eWindowType_toplevel &&
|
if (aWidget && aWidget->GetWindowType() == WindowType::TopLevel &&
|
||||||
aWidget->GetNativeData(NS_NATIVE_WIDGET) == aWidget) {
|
aWidget->GetNativeData(NS_NATIVE_WIDGET) == aWidget) {
|
||||||
RefPtr<nsWindow> window = static_cast<nsWindow*>(aWidget);
|
RefPtr<nsWindow> window = static_cast<nsWindow*>(aWidget);
|
||||||
return window.forget();
|
return window.forget();
|
||||||
|
|
@ -1918,7 +1918,7 @@ void nsWindow::LogWindow(nsWindow* win, int index, int indent) {
|
||||||
ALOG("%s [% 2d] 0x%p [parent 0x%p] [% 3d,% 3dx% 3d,% 3d] vis %d type %d",
|
ALOG("%s [% 2d] 0x%p [parent 0x%p] [% 3d,% 3dx% 3d,% 3d] vis %d type %d",
|
||||||
spaces, index, win, win->mParent, win->mBounds.x, win->mBounds.y,
|
spaces, index, win, win->mParent, win->mBounds.x, win->mBounds.y,
|
||||||
win->mBounds.width, win->mBounds.height, win->mIsVisible,
|
win->mBounds.width, win->mBounds.height, win->mIsVisible,
|
||||||
win->mWindowType);
|
int(win->mWindowType));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1951,14 +1951,14 @@ nsWindow::~nsWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsWindow::IsTopLevel() {
|
bool nsWindow::IsTopLevel() {
|
||||||
return mWindowType == eWindowType_toplevel ||
|
return mWindowType == WindowType::TopLevel ||
|
||||||
mWindowType == eWindowType_dialog ||
|
mWindowType == WindowType::Dialog ||
|
||||||
mWindowType == eWindowType_invisible;
|
mWindowType == WindowType::Invisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData) {
|
InitData* aInitData) {
|
||||||
ALOG("nsWindow[%p]::Create %p [%d %d %d %d]", (void*)this, (void*)aParent,
|
ALOG("nsWindow[%p]::Create %p [%d %d %d %d]", (void*)this, (void*)aParent,
|
||||||
aRect.x, aRect.y, aRect.width, aRect.height);
|
aRect.x, aRect.y, aRect.width, aRect.height);
|
||||||
|
|
||||||
|
|
@ -2167,7 +2167,7 @@ double nsWindow::GetDefaultScaleInternal() {
|
||||||
void nsWindow::Show(bool aState) {
|
void nsWindow::Show(bool aState) {
|
||||||
ALOG("nsWindow[%p]::Show %d", (void*)this, aState);
|
ALOG("nsWindow[%p]::Show %d", (void*)this, aState);
|
||||||
|
|
||||||
if (mWindowType == eWindowType_invisible) {
|
if (mWindowType == WindowType::Invisible) {
|
||||||
ALOG("trying to show invisible window! ignoring..");
|
ALOG("trying to show invisible window! ignoring..");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2420,7 +2420,7 @@ void nsWindow::CreateLayerManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nsWindow* topLevelWindow = FindTopLevel();
|
nsWindow* topLevelWindow = FindTopLevel();
|
||||||
if (!topLevelWindow || topLevelWindow->mWindowType == eWindowType_invisible) {
|
if (!topLevelWindow || topLevelWindow->mWindowType == WindowType::Invisible) {
|
||||||
// don't create a layer manager for an invisible top-level window
|
// don't create a layer manager for an invisible top-level window
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ class nsWindow final : public nsBaseWidget {
|
||||||
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent,
|
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent,
|
||||||
nsNativeWidget aNativeParent,
|
nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData) override;
|
InitData* aInitData) override;
|
||||||
virtual void Destroy() override;
|
virtual void Destroy() override;
|
||||||
virtual void SetParent(nsIWidget* aNewParent) override;
|
virtual void SetParent(nsIWidget* aNewParent) override;
|
||||||
virtual nsIWidget* GetParent(void) override;
|
virtual nsIWidget* GetParent(void) override;
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,7 @@ class nsChildView final : public nsBaseWidget {
|
||||||
// nsIWidget interface
|
// nsIWidget interface
|
||||||
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) override;
|
InitData* = nullptr) override;
|
||||||
|
|
||||||
virtual void Destroy() override;
|
virtual void Destroy() override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ nsChildView::~nsChildView() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsChildView::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
nsresult nsChildView::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData) {
|
const LayoutDeviceIntRect& aRect, widget::InitData* aInitData) {
|
||||||
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
||||||
|
|
||||||
// Because the hidden window is created outside of an event loop,
|
// Because the hidden window is created outside of an event loop,
|
||||||
|
|
@ -1257,7 +1257,7 @@ nsresult nsChildView::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatu
|
||||||
// listener from the parent popup instead.
|
// listener from the parent popup instead.
|
||||||
nsCOMPtr<nsIWidget> parentWidget = mParentWidget;
|
nsCOMPtr<nsIWidget> parentWidget = mParentWidget;
|
||||||
if (!listener && parentWidget) {
|
if (!listener && parentWidget) {
|
||||||
if (parentWidget->WindowType() == eWindowType_popup) {
|
if (parentWidget->GetWindowType() == WindowType::Popup) {
|
||||||
// Check just in case event->mWidget isn't this widget
|
// Check just in case event->mWidget isn't this widget
|
||||||
if (event->mWidget) {
|
if (event->mWidget) {
|
||||||
listener = event->mWidget->GetWidgetListener();
|
listener = event->mWidget->GetWidgetListener();
|
||||||
|
|
@ -1276,7 +1276,7 @@ nsresult nsChildView::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatu
|
||||||
|
|
||||||
nsIWidget* nsChildView::GetWidgetForListenerEvents() {
|
nsIWidget* nsChildView::GetWidgetForListenerEvents() {
|
||||||
// If there is no listener, use the parent popup's listener if that exists.
|
// If there is no listener, use the parent popup's listener if that exists.
|
||||||
if (!mWidgetListener && mParentWidget && mParentWidget->WindowType() == eWindowType_popup) {
|
if (!mWidgetListener && mParentWidget && mParentWidget->GetWindowType() == WindowType::Popup) {
|
||||||
return mParentWidget;
|
return mParentWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4883,21 +4883,21 @@ BOOL ChildViewMouseTracker::WindowAcceptsEvent(NSWindow* aWindow, NSEvent* aEven
|
||||||
|
|
||||||
NSWindow* topLevelWindow = nil;
|
NSWindow* topLevelWindow = nil;
|
||||||
|
|
||||||
switch (windowWidget->WindowType()) {
|
switch (windowWidget->GetWindowType()) {
|
||||||
case eWindowType_popup:
|
case WindowType::Popup:
|
||||||
// If this is a context menu, it won't have a parent. So we'll always
|
// If this is a context menu, it won't have a parent. So we'll always
|
||||||
// accept mouse move events on context menus even when none of our windows
|
// accept mouse move events on context menus even when none of our windows
|
||||||
// is active, which is the right thing to do.
|
// is active, which is the right thing to do.
|
||||||
// For panels, the parent window is the XUL window that owns the panel.
|
// For panels, the parent window is the XUL window that owns the panel.
|
||||||
return WindowAcceptsEvent([aWindow parentWindow], aEvent, aView, aIsClickThrough);
|
return WindowAcceptsEvent([aWindow parentWindow], aEvent, aView, aIsClickThrough);
|
||||||
|
|
||||||
case eWindowType_toplevel:
|
case WindowType::TopLevel:
|
||||||
case eWindowType_dialog:
|
case WindowType::Dialog:
|
||||||
if ([aWindow attachedSheet]) return NO;
|
if ([aWindow attachedSheet]) return NO;
|
||||||
|
|
||||||
topLevelWindow = aWindow;
|
topLevelWindow = aWindow;
|
||||||
break;
|
break;
|
||||||
case eWindowType_sheet: {
|
case WindowType::Sheet: {
|
||||||
nsIWidget* parentWidget = windowWidget->GetSheetWindowParent();
|
nsIWidget* parentWidget = windowWidget->GetSheetWindowParent();
|
||||||
if (!parentWidget) return YES;
|
if (!parentWidget) return YES;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -227,12 +227,11 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
|
||||||
NS_DECL_NSPIWIDGETCOCOA; // semicolon for clang-format bug 1629756
|
NS_DECL_NSPIWIDGETCOCOA; // semicolon for clang-format bug 1629756
|
||||||
|
|
||||||
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const DesktopIntRect& aRect,
|
const DesktopIntRect& aRect, InitData* = nullptr) override;
|
||||||
nsWidgetInitData* aInitData = nullptr) override;
|
|
||||||
|
|
||||||
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) override;
|
InitData* = nullptr) override;
|
||||||
|
|
||||||
virtual void Destroy() override;
|
virtual void Destroy() override;
|
||||||
|
|
||||||
|
|
@ -304,8 +303,8 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
|
||||||
virtual void CaptureRollupEvents(bool aDoCapture) override;
|
virtual void CaptureRollupEvents(bool aDoCapture) override;
|
||||||
[[nodiscard]] virtual nsresult GetAttention(int32_t aCycleCount) override;
|
[[nodiscard]] virtual nsresult GetAttention(int32_t aCycleCount) override;
|
||||||
virtual bool HasPendingInputEvent() override;
|
virtual bool HasPendingInputEvent() override;
|
||||||
virtual nsTransparencyMode GetTransparencyMode() override;
|
virtual TransparencyMode GetTransparencyMode() override;
|
||||||
virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
|
virtual void SetTransparencyMode(TransparencyMode aMode) override;
|
||||||
virtual void SetWindowShadowStyle(mozilla::StyleWindowShadow aStyle) override;
|
virtual void SetWindowShadowStyle(mozilla::StyleWindowShadow aStyle) override;
|
||||||
virtual void SetWindowOpacity(float aOpacity) override;
|
virtual void SetWindowOpacity(float aOpacity) override;
|
||||||
virtual void SetWindowTransform(const mozilla::gfx::Matrix& aTransform) override;
|
virtual void SetWindowTransform(const mozilla::gfx::Matrix& aTransform) override;
|
||||||
|
|
@ -367,9 +366,8 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsCocoaWindow();
|
virtual ~nsCocoaWindow();
|
||||||
|
|
||||||
nsresult CreateNativeWindow(const NSRect& aRect, nsBorderStyle aBorderStyle,
|
nsresult CreateNativeWindow(const NSRect& aRect, BorderStyle aBorderStyle, bool aRectIsFrameRect);
|
||||||
bool aRectIsFrameRect);
|
nsresult CreatePopupContentView(const LayoutDeviceIntRect& aRect, InitData*);
|
||||||
nsresult CreatePopupContentView(const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData);
|
|
||||||
void DestroyNativeWindow();
|
void DestroyNativeWindow();
|
||||||
void UpdateBounds();
|
void UpdateBounds();
|
||||||
int32_t GetWorkspaceID();
|
int32_t GetWorkspaceID();
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ extern CGError CGSSetWindowTransform(CGSConnection cid, CGSWindow wid, CGAffineT
|
||||||
NS_IMPL_ISUPPORTS_INHERITED(nsCocoaWindow, Inherited, nsPIWidgetCocoa)
|
NS_IMPL_ISUPPORTS_INHERITED(nsCocoaWindow, Inherited, nsPIWidgetCocoa)
|
||||||
|
|
||||||
// A note on testing to see if your object is a sheet...
|
// A note on testing to see if your object is a sheet...
|
||||||
// |mWindowType == eWindowType_sheet| is true if your gecko nsIWidget is a sheet
|
// |mWindowType == WindowType::Sheet| is true if your gecko nsIWidget is a sheet
|
||||||
// widget - whether or not the sheet is showing. |[mWindow isSheet]| will return
|
// widget - whether or not the sheet is showing. |[mWindow isSheet]| will return
|
||||||
// true *only when the sheet is actually showing*. Choose your test wisely.
|
// true *only when the sheet is actually showing*. Choose your test wisely.
|
||||||
|
|
||||||
|
|
@ -178,12 +178,12 @@ nsCocoaWindow::~nsCocoaWindow() {
|
||||||
|
|
||||||
// Notify the children that we're gone. Popup windows (e.g. tooltips) can
|
// Notify the children that we're gone. Popup windows (e.g. tooltips) can
|
||||||
// have nsChildView children. 'kid' is an nsChildView object if and only if
|
// have nsChildView children. 'kid' is an nsChildView object if and only if
|
||||||
// its 'type' is 'eWindowType_child'.
|
// its 'type' is 'WindowType::Child'.
|
||||||
// childView->ResetParent() can change our list of children while it's
|
// childView->ResetParent() can change our list of children while it's
|
||||||
// being iterated, so the way we iterate the list must allow for this.
|
// being iterated, so the way we iterate the list must allow for this.
|
||||||
for (nsIWidget* kid = mLastChild; kid;) {
|
for (nsIWidget* kid = mLastChild; kid;) {
|
||||||
nsWindowType kidType = kid->WindowType();
|
WindowType kidType = kid->GetWindowType();
|
||||||
if (kidType == eWindowType_child) {
|
if (kidType == WindowType::Child) {
|
||||||
nsChildView* childView = static_cast<nsChildView*>(kid);
|
nsChildView* childView = static_cast<nsChildView*>(kid);
|
||||||
kid = kid->GetPrevSibling();
|
kid = kid->GetPrevSibling();
|
||||||
childView->ResetParent();
|
childView->ResetParent();
|
||||||
|
|
@ -280,7 +280,7 @@ DesktopToLayoutDeviceScale ParentBackingScaleFactor(nsIWidget* aParent, NSView*
|
||||||
static DesktopRect GetWidgetScreenRectForChildren(nsIWidget* aWidget, NSView* aView) {
|
static DesktopRect GetWidgetScreenRectForChildren(nsIWidget* aWidget, NSView* aView) {
|
||||||
if (aWidget) {
|
if (aWidget) {
|
||||||
mozilla::DesktopToLayoutDeviceScale scale = aWidget->GetDesktopToDeviceScale();
|
mozilla::DesktopToLayoutDeviceScale scale = aWidget->GetDesktopToDeviceScale();
|
||||||
if (aWidget->WindowType() == eWindowType_child) {
|
if (aWidget->GetWindowType() == WindowType::Child) {
|
||||||
return aWidget->GetScreenBounds() / scale;
|
return aWidget->GetScreenBounds() / scale;
|
||||||
}
|
}
|
||||||
return aWidget->GetClientBounds() / scale;
|
return aWidget->GetClientBounds() / scale;
|
||||||
|
|
@ -307,7 +307,7 @@ static DesktopRect GetWidgetScreenRectForChildren(nsIWidget* aWidget, NSView* aV
|
||||||
// aRect.{x,y} are offsets from the origin of the parent window and not an
|
// aRect.{x,y} are offsets from the origin of the parent window and not an
|
||||||
// absolute position.
|
// absolute position.
|
||||||
nsresult nsCocoaWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
nsresult nsCocoaWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const DesktopIntRect& aRect, nsWidgetInitData* aInitData) {
|
const DesktopIntRect& aRect, widget::InitData* aInitData) {
|
||||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||||
|
|
||||||
// Because the hidden window is created outside of an event loop,
|
// Because the hidden window is created outside of an event loop,
|
||||||
|
|
@ -318,8 +318,8 @@ nsresult nsCocoaWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
FitRectToVisibleAreaForScreen(newBounds, nullptr);
|
FitRectToVisibleAreaForScreen(newBounds, nullptr);
|
||||||
|
|
||||||
// Set defaults which can be overriden from aInitData in BaseCreate
|
// Set defaults which can be overriden from aInitData in BaseCreate
|
||||||
mWindowType = eWindowType_toplevel;
|
mWindowType = WindowType::TopLevel;
|
||||||
mBorderStyle = eBorderStyle_default;
|
mBorderStyle = BorderStyle::Default;
|
||||||
|
|
||||||
// Ensure that the toolkit is created.
|
// Ensure that the toolkit is created.
|
||||||
nsToolkit::GetToolkit();
|
nsToolkit::GetToolkit();
|
||||||
|
|
@ -347,7 +347,7 @@ nsresult nsCocoaWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
CreateNativeWindow(nsCocoaUtils::GeckoRectToCocoaRect(widgetRect), mBorderStyle, false);
|
CreateNativeWindow(nsCocoaUtils::GeckoRectToCocoaRect(widgetRect), mBorderStyle, false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
// now we can convert widgetRect to device pixels for the window we created,
|
// now we can convert widgetRect to device pixels for the window we created,
|
||||||
// as the child view expects a rect expressed in the dev pix of its parent
|
// as the child view expects a rect expressed in the dev pix of its parent
|
||||||
LayoutDeviceIntRect devRect = RoundedToInt(newBounds * GetDesktopToDeviceScale());
|
LayoutDeviceIntRect devRect = RoundedToInt(newBounds * GetDesktopToDeviceScale());
|
||||||
|
|
@ -362,22 +362,22 @@ nsresult nsCocoaWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsCocoaWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
nsresult nsCocoaWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData) {
|
const LayoutDeviceIntRect& aRect, widget::InitData* aInitData) {
|
||||||
DesktopIntRect desktopRect =
|
DesktopIntRect desktopRect =
|
||||||
RoundedToInt(aRect / ParentBackingScaleFactor(aParent, (NSView*)aNativeParent));
|
RoundedToInt(aRect / ParentBackingScaleFactor(aParent, (NSView*)aNativeParent));
|
||||||
return Create(aParent, aNativeParent, desktopRect, aInitData);
|
return Create(aParent, aNativeParent, desktopRect, aInitData);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int WindowMaskForBorderStyle(nsBorderStyle aBorderStyle) {
|
static unsigned int WindowMaskForBorderStyle(BorderStyle aBorderStyle) {
|
||||||
bool allOrDefault = (aBorderStyle == eBorderStyle_all || aBorderStyle == eBorderStyle_default);
|
bool allOrDefault = (aBorderStyle == BorderStyle::All || aBorderStyle == BorderStyle::Default);
|
||||||
|
|
||||||
/* Apple's docs on NSWindow styles say that "a window's style mask should
|
/* Apple's docs on NSWindow styles say that "a window's style mask should
|
||||||
* include NSWindowStyleMaskTitled if it includes any of the others [besides
|
* include NSWindowStyleMaskTitled if it includes any of the others [besides
|
||||||
* NSWindowStyleMaskBorderless]". This implies that a borderless window
|
* NSWindowStyleMaskBorderless]". This implies that a borderless window
|
||||||
* shouldn't have any other styles than NSWindowStyleMaskBorderless.
|
* shouldn't have any other styles than NSWindowStyleMaskBorderless.
|
||||||
*/
|
*/
|
||||||
if (!allOrDefault && !(aBorderStyle & eBorderStyle_title)) {
|
if (!allOrDefault && !(aBorderStyle & BorderStyle::Title)) {
|
||||||
if (aBorderStyle & eBorderStyle_minimize) {
|
if (aBorderStyle & BorderStyle::Minimize) {
|
||||||
/* It appears that at a minimum, borderless windows can be miniaturizable,
|
/* It appears that at a minimum, borderless windows can be miniaturizable,
|
||||||
* effectively contradicting some of Apple's documentation referenced
|
* effectively contradicting some of Apple's documentation referenced
|
||||||
* above. One such exception is the screen share indicator, see
|
* above. One such exception is the screen share indicator, see
|
||||||
|
|
@ -389,13 +389,13 @@ static unsigned int WindowMaskForBorderStyle(nsBorderStyle aBorderStyle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int mask = NSWindowStyleMaskTitled;
|
unsigned int mask = NSWindowStyleMaskTitled;
|
||||||
if (allOrDefault || aBorderStyle & eBorderStyle_close) {
|
if (allOrDefault || aBorderStyle & BorderStyle::Close) {
|
||||||
mask |= NSWindowStyleMaskClosable;
|
mask |= NSWindowStyleMaskClosable;
|
||||||
}
|
}
|
||||||
if (allOrDefault || aBorderStyle & eBorderStyle_minimize) {
|
if (allOrDefault || aBorderStyle & BorderStyle::Minimize) {
|
||||||
mask |= NSWindowStyleMaskMiniaturizable;
|
mask |= NSWindowStyleMaskMiniaturizable;
|
||||||
}
|
}
|
||||||
if (allOrDefault || aBorderStyle & eBorderStyle_resizeh) {
|
if (allOrDefault || aBorderStyle & BorderStyle::ResizeH) {
|
||||||
mask |= NSWindowStyleMaskResizable;
|
mask |= NSWindowStyleMaskResizable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -406,7 +406,7 @@ static unsigned int WindowMaskForBorderStyle(nsBorderStyle aBorderStyle) {
|
||||||
// Otherwise, aRect.x/y specify the position of the window's frame relative to
|
// Otherwise, aRect.x/y specify the position of the window's frame relative to
|
||||||
// the bottom of the menubar and aRect.width/height specify the size of the
|
// the bottom of the menubar and aRect.width/height specify the size of the
|
||||||
// content rect.
|
// content rect.
|
||||||
nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, nsBorderStyle aBorderStyle,
|
nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, BorderStyle aBorderStyle,
|
||||||
bool aRectIsFrameRect) {
|
bool aRectIsFrameRect) {
|
||||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||||
|
|
||||||
|
|
@ -415,23 +415,24 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, nsBorderStyle aB
|
||||||
|
|
||||||
// Configure the window we will create based on the window type.
|
// Configure the window we will create based on the window type.
|
||||||
switch (mWindowType) {
|
switch (mWindowType) {
|
||||||
case eWindowType_invisible:
|
case WindowType::Invisible:
|
||||||
case eWindowType_child:
|
case WindowType::Child:
|
||||||
break;
|
break;
|
||||||
case eWindowType_popup:
|
case WindowType::Popup:
|
||||||
if (aBorderStyle != eBorderStyle_default && mBorderStyle & eBorderStyle_title) {
|
if (aBorderStyle != BorderStyle::Default && mBorderStyle & BorderStyle::Title) {
|
||||||
features |= NSWindowStyleMaskTitled;
|
features |= NSWindowStyleMaskTitled;
|
||||||
if (aBorderStyle & eBorderStyle_close) {
|
if (aBorderStyle & BorderStyle::Close) {
|
||||||
features |= NSWindowStyleMaskClosable;
|
features |= NSWindowStyleMaskClosable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eWindowType_toplevel:
|
case WindowType::TopLevel:
|
||||||
case eWindowType_dialog:
|
case WindowType::Dialog:
|
||||||
features = WindowMaskForBorderStyle(aBorderStyle);
|
features = WindowMaskForBorderStyle(aBorderStyle);
|
||||||
break;
|
break;
|
||||||
case eWindowType_sheet:
|
case WindowType::Sheet:
|
||||||
if (mParent->WindowType() != eWindowType_invisible && aBorderStyle & eBorderStyle_resizeh) {
|
if (mParent->GetWindowType() != WindowType::Invisible &&
|
||||||
|
aBorderStyle & BorderStyle::ResizeH) {
|
||||||
features = NSWindowStyleMaskResizable;
|
features = NSWindowStyleMaskResizable;
|
||||||
} else {
|
} else {
|
||||||
features = NSWindowStyleMaskMiniaturizable;
|
features = NSWindowStyleMaskMiniaturizable;
|
||||||
|
|
@ -473,7 +474,7 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, nsBorderStyle aB
|
||||||
contentRect = aRect;
|
contentRect = aRect;
|
||||||
contentRect.origin.y -= (newWindowFrame.size.height - aRect.size.height);
|
contentRect.origin.y -= (newWindowFrame.size.height - aRect.size.height);
|
||||||
|
|
||||||
if (mWindowType != eWindowType_popup) contentRect.origin.y -= [[NSApp mainMenu] menuBarHeight];
|
if (mWindowType != WindowType::Popup) contentRect.origin.y -= [[NSApp mainMenu] menuBarHeight];
|
||||||
}
|
}
|
||||||
|
|
||||||
// NSLog(@"Top-level window being created at Cocoa rect: %f, %f, %f, %f\n",
|
// NSLog(@"Top-level window being created at Cocoa rect: %f, %f, %f, %f\n",
|
||||||
|
|
@ -484,11 +485,11 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, nsBorderStyle aB
|
||||||
// titlebar color (for unified windows), so use the special ToolbarWindow class.
|
// titlebar color (for unified windows), so use the special ToolbarWindow class.
|
||||||
// Note that we need to check the window type because we mark sheets as
|
// Note that we need to check the window type because we mark sheets as
|
||||||
// having titlebars.
|
// having titlebars.
|
||||||
if ((mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog) &&
|
if ((mWindowType == WindowType::TopLevel || mWindowType == WindowType::Dialog) &&
|
||||||
(features & NSWindowStyleMaskTitled))
|
(features & NSWindowStyleMaskTitled))
|
||||||
windowClass = [ToolbarWindow class];
|
windowClass = [ToolbarWindow class];
|
||||||
// If we're a popup window we need to use the PopupWindow class.
|
// If we're a popup window we need to use the PopupWindow class.
|
||||||
else if (mWindowType == eWindowType_popup)
|
else if (mWindowType == WindowType::Popup)
|
||||||
windowClass = [PopupWindow class];
|
windowClass = [PopupWindow class];
|
||||||
// If we're a non-popup borderless window we need to use the
|
// If we're a non-popup borderless window we need to use the
|
||||||
// BorderlessWindow class.
|
// BorderlessWindow class.
|
||||||
|
|
@ -518,11 +519,11 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, nsBorderStyle aB
|
||||||
}
|
}
|
||||||
UpdateBounds();
|
UpdateBounds();
|
||||||
|
|
||||||
if (mWindowType == eWindowType_invisible) {
|
if (mWindowType == WindowType::Invisible) {
|
||||||
[mWindow setLevel:kCGDesktopWindowLevelKey];
|
[mWindow setLevel:kCGDesktopWindowLevelKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
SetPopupWindowLevel();
|
SetPopupWindowLevel();
|
||||||
[mWindow setBackgroundColor:[NSColor clearColor]];
|
[mWindow setBackgroundColor:[NSColor clearColor]];
|
||||||
[mWindow setOpaque:NO];
|
[mWindow setOpaque:NO];
|
||||||
|
|
@ -574,7 +575,7 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect, nsBorderStyle aB
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsCocoaWindow::CreatePopupContentView(const LayoutDeviceIntRect& aRect,
|
nsresult nsCocoaWindow::CreatePopupContentView(const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData) {
|
widget::InitData* aInitData) {
|
||||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||||
|
|
||||||
// We need to make our content view a ChildView.
|
// We need to make our content view a ChildView.
|
||||||
|
|
@ -647,9 +648,9 @@ void nsCocoaWindow::Destroy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIWidget* nsCocoaWindow::GetSheetWindowParent(void) {
|
nsIWidget* nsCocoaWindow::GetSheetWindowParent(void) {
|
||||||
if (mWindowType != eWindowType_sheet) return nullptr;
|
if (mWindowType != WindowType::Sheet) return nullptr;
|
||||||
nsCocoaWindow* parent = static_cast<nsCocoaWindow*>(mParent);
|
nsCocoaWindow* parent = static_cast<nsCocoaWindow*>(mParent);
|
||||||
while (parent && (parent->mWindowType == eWindowType_sheet))
|
while (parent && (parent->mWindowType == WindowType::Sheet))
|
||||||
parent = static_cast<nsCocoaWindow*>(parent->mParent);
|
parent = static_cast<nsCocoaWindow*>(parent->mParent);
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
@ -731,11 +732,11 @@ void nsCocoaWindow::SetModal(bool aState) {
|
||||||
// methods) that's incompatible with the modal event loop in AppWindow::
|
// methods) that's incompatible with the modal event loop in AppWindow::
|
||||||
// ShowModal() (each of these event loops is "exclusive", and can't run at
|
// ShowModal() (each of these event loops is "exclusive", and can't run at
|
||||||
// the same time as other (similar) event loops).
|
// the same time as other (similar) event loops).
|
||||||
if (mWindowType != eWindowType_sheet) {
|
if (mWindowType != WindowType::Sheet) {
|
||||||
while (ancestor) {
|
while (ancestor) {
|
||||||
if (ancestor->mNumModalDescendents++ == 0) {
|
if (ancestor->mNumModalDescendents++ == 0) {
|
||||||
NSWindow* aWindow = ancestor->GetCocoaWindow();
|
NSWindow* aWindow = ancestor->GetCocoaWindow();
|
||||||
if (ancestor->mWindowType != eWindowType_invisible) {
|
if (ancestor->mWindowType != WindowType::Invisible) {
|
||||||
[[aWindow standardWindowButton:NSWindowCloseButton] setEnabled:NO];
|
[[aWindow standardWindowButton:NSWindowCloseButton] setEnabled:NO];
|
||||||
[[aWindow standardWindowButton:NSWindowMiniaturizeButton] setEnabled:NO];
|
[[aWindow standardWindowButton:NSWindowMiniaturizeButton] setEnabled:NO];
|
||||||
[[aWindow standardWindowButton:NSWindowZoomButton] setEnabled:NO];
|
[[aWindow standardWindowButton:NSWindowZoomButton] setEnabled:NO];
|
||||||
|
|
@ -754,11 +755,11 @@ void nsCocoaWindow::SetModal(bool aState) {
|
||||||
} else {
|
} else {
|
||||||
--gXULModalLevel;
|
--gXULModalLevel;
|
||||||
NS_ASSERTION(gXULModalLevel >= 0, "Mismatched call to nsCocoaWindow::SetModal(false)!");
|
NS_ASSERTION(gXULModalLevel >= 0, "Mismatched call to nsCocoaWindow::SetModal(false)!");
|
||||||
if (mWindowType != eWindowType_sheet) {
|
if (mWindowType != WindowType::Sheet) {
|
||||||
while (ancestor) {
|
while (ancestor) {
|
||||||
if (--ancestor->mNumModalDescendents == 0) {
|
if (--ancestor->mNumModalDescendents == 0) {
|
||||||
NSWindow* aWindow = ancestor->GetCocoaWindow();
|
NSWindow* aWindow = ancestor->GetCocoaWindow();
|
||||||
if (ancestor->mWindowType != eWindowType_invisible) {
|
if (ancestor->mWindowType != WindowType::Invisible) {
|
||||||
[[aWindow standardWindowButton:NSWindowCloseButton] setEnabled:YES];
|
[[aWindow standardWindowButton:NSWindowCloseButton] setEnabled:YES];
|
||||||
[[aWindow standardWindowButton:NSWindowMiniaturizeButton] setEnabled:YES];
|
[[aWindow standardWindowButton:NSWindowMiniaturizeButton] setEnabled:YES];
|
||||||
[[aWindow standardWindowButton:NSWindowZoomButton] setEnabled:YES];
|
[[aWindow standardWindowButton:NSWindowZoomButton] setEnabled:YES];
|
||||||
|
|
@ -774,7 +775,7 @@ void nsCocoaWindow::SetModal(bool aState) {
|
||||||
gGeckoAppModalWindowList = gGeckoAppModalWindowList->prev;
|
gGeckoAppModalWindowList = gGeckoAppModalWindowList->prev;
|
||||||
delete saved; // "window" not ADDREFed
|
delete saved; // "window" not ADDREFed
|
||||||
}
|
}
|
||||||
if (mWindowType == eWindowType_popup)
|
if (mWindowType == WindowType::Popup)
|
||||||
SetPopupWindowLevel();
|
SetPopupWindowLevel();
|
||||||
else
|
else
|
||||||
[mWindow setLevel:NSNormalWindowLevel];
|
[mWindow setLevel:NSNormalWindowLevel];
|
||||||
|
|
@ -824,7 +825,7 @@ void nsCocoaWindow::Show(bool bState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't try to show a popup when the parent isn't visible or is minimized.
|
// Don't try to show a popup when the parent isn't visible or is minimized.
|
||||||
if (mWindowType == eWindowType_popup && nativeParentWindow) {
|
if (mWindowType == WindowType::Popup && nativeParentWindow) {
|
||||||
if (![nativeParentWindow isVisible] || [nativeParentWindow isMiniaturized]) {
|
if (![nativeParentWindow isVisible] || [nativeParentWindow isMiniaturized]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -835,7 +836,7 @@ void nsCocoaWindow::Show(bool bState) {
|
||||||
mPopupContentView->Show(true);
|
mPopupContentView->Show(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType == eWindowType_sheet) {
|
if (mWindowType == WindowType::Sheet) {
|
||||||
// bail if no parent window (its basically what we do in Carbon)
|
// bail if no parent window (its basically what we do in Carbon)
|
||||||
if (!nativeParentWindow || !piParentWidget) return;
|
if (!nativeParentWindow || !piParentWidget) return;
|
||||||
|
|
||||||
|
|
@ -905,7 +906,7 @@ void nsCocoaWindow::Show(bool bState) {
|
||||||
// mSheetNeedsShow set will have their opportunities to display.
|
// mSheetNeedsShow set will have their opportunities to display.
|
||||||
mSheetNeedsShow = true;
|
mSheetNeedsShow = true;
|
||||||
}
|
}
|
||||||
} else if (mWindowType == eWindowType_popup) {
|
} else if (mWindowType == WindowType::Popup) {
|
||||||
// For reasons that aren't yet clear, calls to [NSWindow orderFront:] or
|
// For reasons that aren't yet clear, calls to [NSWindow orderFront:] or
|
||||||
// [NSWindow makeKeyAndOrderFront:] can sometimes trigger "Error (1000)
|
// [NSWindow makeKeyAndOrderFront:] can sometimes trigger "Error (1000)
|
||||||
// creating CGSWindow", which in turn triggers an internal inconsistency
|
// creating CGSWindow", which in turn triggers an internal inconsistency
|
||||||
|
|
@ -930,11 +931,11 @@ void nsCocoaWindow::Show(bool bState) {
|
||||||
// appear above the parent and move when the parent does. Setting this
|
// appear above the parent and move when the parent does. Setting this
|
||||||
// needs to happen after the _setWindowNumber calls above, otherwise the
|
// needs to happen after the _setWindowNumber calls above, otherwise the
|
||||||
// window doesn't focus properly.
|
// window doesn't focus properly.
|
||||||
if (nativeParentWindow && mPopupLevel == ePopupLevelParent)
|
if (nativeParentWindow && mPopupLevel == PopupLevel::Parent)
|
||||||
[nativeParentWindow addChildWindow:mWindow ordered:NSWindowAbove];
|
[nativeParentWindow addChildWindow:mWindow ordered:NSWindowAbove];
|
||||||
} else {
|
} else {
|
||||||
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
||||||
if (mWindowType == eWindowType_toplevel &&
|
if (mWindowType == WindowType::TopLevel &&
|
||||||
[mWindow respondsToSelector:@selector(setAnimationBehavior:)]) {
|
[mWindow respondsToSelector:@selector(setAnimationBehavior:)]) {
|
||||||
NSWindowAnimationBehavior behavior;
|
NSWindowAnimationBehavior behavior;
|
||||||
if (mIsAnimationSuppressed) {
|
if (mIsAnimationSuppressed) {
|
||||||
|
|
@ -967,10 +968,10 @@ void nsCocoaWindow::Show(bool bState) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// roll up any popups if a top-level window is going away
|
// roll up any popups if a top-level window is going away
|
||||||
if (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog) RollUpPopups();
|
if (mWindowType == WindowType::TopLevel || mWindowType == WindowType::Dialog) RollUpPopups();
|
||||||
|
|
||||||
// now get rid of the window/sheet
|
// now get rid of the window/sheet
|
||||||
if (mWindowType == eWindowType_sheet) {
|
if (mWindowType == WindowType::Sheet) {
|
||||||
if (mSheetNeedsShow) {
|
if (mSheetNeedsShow) {
|
||||||
// This is an attempt to hide a sheet that never had a chance to
|
// This is an attempt to hide a sheet that never had a chance to
|
||||||
// be shown. There's nothing to do other than make sure that it
|
// be shown. There's nothing to do other than make sure that it
|
||||||
|
|
@ -1061,7 +1062,7 @@ void nsCocoaWindow::Show(bool bState) {
|
||||||
// If the window is a popup window with a parent window we need to
|
// If the window is a popup window with a parent window we need to
|
||||||
// unhook it here before ordering it out. When you order out the child
|
// unhook it here before ordering it out. When you order out the child
|
||||||
// of a window it hides the parent window.
|
// of a window it hides the parent window.
|
||||||
if (mWindowType == eWindowType_popup && nativeParentWindow)
|
if (mWindowType == WindowType::Popup && nativeParentWindow)
|
||||||
[nativeParentWindow removeChildWindow:mWindow];
|
[nativeParentWindow removeChildWindow:mWindow];
|
||||||
|
|
||||||
[mWindow orderOut:nil];
|
[mWindow orderOut:nil];
|
||||||
|
|
@ -1089,7 +1090,7 @@ void nsCocoaWindow::Show(bool bState) {
|
||||||
bool nsCocoaWindow::NeedsRecreateToReshow() {
|
bool nsCocoaWindow::NeedsRecreateToReshow() {
|
||||||
// Limit the workaround to popup windows because only they need to override
|
// Limit the workaround to popup windows because only they need to override
|
||||||
// the "Assign To" setting. i.e., to display where the parent window is.
|
// the "Assign To" setting. i.e., to display where the parent window is.
|
||||||
return (mWindowType == eWindowType_popup) && mWasShown && ([[NSScreen screens] count] > 1);
|
return (mWindowType == WindowType::Popup) && mWasShown && ([[NSScreen screens] count] > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowRenderer* nsCocoaWindow::GetWindowRenderer() {
|
WindowRenderer* nsCocoaWindow::GetWindowRenderer() {
|
||||||
|
|
@ -1099,24 +1100,25 @@ WindowRenderer* nsCocoaWindow::GetWindowRenderer() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTransparencyMode nsCocoaWindow::GetTransparencyMode() {
|
TransparencyMode nsCocoaWindow::GetTransparencyMode() {
|
||||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||||
|
|
||||||
return (!mWindow || [mWindow isOpaque]) ? eTransparencyOpaque : eTransparencyTransparent;
|
return (!mWindow || [mWindow isOpaque]) ? TransparencyMode::Opaque
|
||||||
|
: TransparencyMode::Transparent;
|
||||||
|
|
||||||
NS_OBJC_END_TRY_BLOCK_RETURN(eTransparencyOpaque);
|
NS_OBJC_END_TRY_BLOCK_RETURN(TransparencyMode::Opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called from nsMenuPopupFrame when making a popup transparent.
|
// This is called from nsMenuPopupFrame when making a popup transparent.
|
||||||
void nsCocoaWindow::SetTransparencyMode(nsTransparencyMode aMode) {
|
void nsCocoaWindow::SetTransparencyMode(TransparencyMode aMode) {
|
||||||
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
||||||
|
|
||||||
// Only respect calls for popup windows.
|
// Only respect calls for popup windows.
|
||||||
if (!mWindow || mWindowType != eWindowType_popup) {
|
if (!mWindow || mWindowType != WindowType::Popup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL isTransparent = aMode == eTransparencyTransparent;
|
BOOL isTransparent = aMode == TransparencyMode::Transparent;
|
||||||
BOOL currentTransparency = ![mWindow isOpaque];
|
BOOL currentTransparency = ![mWindow isOpaque];
|
||||||
if (isTransparent != currentTransparency) {
|
if (isTransparent != currentTransparency) {
|
||||||
[mWindow setOpaque:!isTransparent];
|
[mWindow setOpaque:!isTransparent];
|
||||||
|
|
@ -1193,7 +1195,7 @@ void nsCocoaWindow::SetSizeConstraints(const SizeConstraints& aConstraints) {
|
||||||
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
||||||
|
|
||||||
// Popups can be smaller than (32, 32)
|
// Popups can be smaller than (32, 32)
|
||||||
NSRect rect = (mWindowType == eWindowType_popup) ? NSZeroRect : NSMakeRect(0.0, 0.0, 32, 32);
|
NSRect rect = (mWindowType == WindowType::Popup) ? NSZeroRect : NSMakeRect(0.0, 0.0, 32, 32);
|
||||||
rect = [mWindow frameRectForChildViewRect:rect];
|
rect = [mWindow frameRectForChildViewRect:rect];
|
||||||
|
|
||||||
SizeConstraints c = aConstraints;
|
SizeConstraints c = aConstraints;
|
||||||
|
|
@ -1469,7 +1471,7 @@ void nsCocoaWindow::HideWindowChrome(bool aShouldHide) {
|
||||||
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
||||||
|
|
||||||
if (!mWindow || !mWindowMadeHere ||
|
if (!mWindow || !mWindowMadeHere ||
|
||||||
(mWindowType != eWindowType_toplevel && mWindowType != eWindowType_dialog))
|
(mWindowType != WindowType::TopLevel && mWindowType != WindowType::Dialog))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BOOL isVisible = [mWindow isVisible];
|
BOOL isVisible = [mWindow isVisible];
|
||||||
|
|
@ -1495,7 +1497,7 @@ void nsCocoaWindow::HideWindowChrome(bool aShouldHide) {
|
||||||
// Recreate the window with the right border style.
|
// Recreate the window with the right border style.
|
||||||
NSRect frameRect = [mWindow frame];
|
NSRect frameRect = [mWindow frame];
|
||||||
DestroyNativeWindow();
|
DestroyNativeWindow();
|
||||||
nsresult rv = CreateNativeWindow(frameRect, aShouldHide ? eBorderStyle_none : mBorderStyle, true);
|
nsresult rv = CreateNativeWindow(frameRect, aShouldHide ? BorderStyle::None : mBorderStyle, true);
|
||||||
NS_ENSURE_SUCCESS_VOID(rv);
|
NS_ENSURE_SUCCESS_VOID(rv);
|
||||||
|
|
||||||
// Re-import state.
|
// Re-import state.
|
||||||
|
|
@ -1999,7 +2001,7 @@ NS_IMETHODIMP nsCocoaWindow::GetChildSheet(bool aShown, nsIWidget** _retval) {
|
||||||
nsIWidget* child = GetFirstChild();
|
nsIWidget* child = GetFirstChild();
|
||||||
|
|
||||||
while (child) {
|
while (child) {
|
||||||
if (child->WindowType() == eWindowType_sheet) {
|
if (child->GetWindowType() == WindowType::Sheet) {
|
||||||
// if it's a sheet, it must be an nsCocoaWindow
|
// if it's a sheet, it must be an nsCocoaWindow
|
||||||
nsCocoaWindow* cocoaWindow = static_cast<nsCocoaWindow*>(child);
|
nsCocoaWindow* cocoaWindow = static_cast<nsCocoaWindow*>(child);
|
||||||
if (cocoaWindow->mWindow && ((aShown && [cocoaWindow->mWindow isVisible]) ||
|
if (cocoaWindow->mWindow && ((aShown && [cocoaWindow->mWindow isVisible]) ||
|
||||||
|
|
@ -2023,7 +2025,7 @@ NS_IMETHODIMP nsCocoaWindow::GetRealParent(nsIWidget** parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCocoaWindow::GetIsSheet(bool* isSheet) {
|
NS_IMETHODIMP nsCocoaWindow::GetIsSheet(bool* isSheet) {
|
||||||
mWindowType == eWindowType_sheet ? * isSheet = true : * isSheet = false;
|
mWindowType == WindowType::Sheet ? * isSheet = true : * isSheet = false;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2277,13 +2279,13 @@ void nsCocoaWindow::CaptureRollupEvents(bool aDoCapture) {
|
||||||
// here we fiddle with a non-native popup window's level to make sure the
|
// here we fiddle with a non-native popup window's level to make sure the
|
||||||
// "active" one is always above any other non-native popup windows that
|
// "active" one is always above any other non-native popup windows that
|
||||||
// may be visible.
|
// may be visible.
|
||||||
if (mWindow && (mWindowType == eWindowType_popup)) SetPopupWindowLevel();
|
if (mWindow && (mWindowType == WindowType::Popup)) SetPopupWindowLevel();
|
||||||
} else {
|
} else {
|
||||||
nsToolkit::GetToolkit()->StopMonitoringAllProcessMouseEvents();
|
nsToolkit::GetToolkit()->StopMonitoringAllProcessMouseEvents();
|
||||||
|
|
||||||
// XXXndeakin this doesn't make sense.
|
// XXXndeakin this doesn't make sense.
|
||||||
// Why is the new window assumed to be a modal panel?
|
// Why is the new window assumed to be a modal panel?
|
||||||
if (mWindow && (mWindowType == eWindowType_popup)) [mWindow setLevel:NSModalPanelWindowLevel];
|
if (mWindow && (mWindowType == WindowType::Popup)) [mWindow setLevel:NSModalPanelWindowLevel];
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_OBJC_END_TRY_IGNORE_BLOCK;
|
NS_OBJC_END_TRY_IGNORE_BLOCK;
|
||||||
|
|
@ -2305,7 +2307,7 @@ void nsCocoaWindow::SetWindowShadowStyle(StyleWindowShadow aStyle) {
|
||||||
|
|
||||||
mShadowStyle = aStyle;
|
mShadowStyle = aStyle;
|
||||||
|
|
||||||
if (!mWindow || mWindowType != eWindowType_popup) {
|
if (!mWindow || mWindowType != WindowType::Popup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2418,7 +2420,7 @@ void nsCocoaWindow::SetWindowTransform(const gfx::Matrix& aTransform) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsCocoaWindow::SetInputRegion(const InputRegion& aInputRegion) {
|
void nsCocoaWindow::SetInputRegion(const InputRegion& aInputRegion) {
|
||||||
MOZ_ASSERT(mWindowType == eWindowType_popup, "This should only be called on popup windows.");
|
MOZ_ASSERT(mWindowType == WindowType::Popup, "This should only be called on popup windows.");
|
||||||
// TODO: Somehow support aInputRegion.mMargin? Though maybe not.
|
// TODO: Somehow support aInputRegion.mMargin? Though maybe not.
|
||||||
if (aInputRegion.mFullyTransparent) {
|
if (aInputRegion.mFullyTransparent) {
|
||||||
[mWindow setIgnoresMouseEvents:YES];
|
[mWindow setIgnoresMouseEvents:YES];
|
||||||
|
|
@ -2562,7 +2564,7 @@ void nsCocoaWindow::SetPopupWindowLevel() {
|
||||||
|
|
||||||
// Floating popups are at the floating level and hide when the window is
|
// Floating popups are at the floating level and hide when the window is
|
||||||
// deactivated.
|
// deactivated.
|
||||||
if (mPopupLevel == ePopupLevelFloating) {
|
if (mPopupLevel == PopupLevel::Floating) {
|
||||||
[mWindow setLevel:NSFloatingWindowLevel];
|
[mWindow setLevel:NSFloatingWindowLevel];
|
||||||
[mWindow setHidesOnDeactivate:YES];
|
[mWindow setHidesOnDeactivate:YES];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -374,8 +374,12 @@ static BOOL FrameIsInActiveWindow(nsIFrame* aFrame) {
|
||||||
|
|
||||||
// XUL popups, e.g. the toolbar customization popup, can't become key windows,
|
// XUL popups, e.g. the toolbar customization popup, can't become key windows,
|
||||||
// but controls in these windows should still get the active look.
|
// but controls in these windows should still get the active look.
|
||||||
if (topLevelWidget->WindowType() == eWindowType_popup) return YES;
|
if (topLevelWidget->GetWindowType() == widget::WindowType::Popup) {
|
||||||
if ([win isSheet]) return [win isKeyWindow];
|
return YES;
|
||||||
|
}
|
||||||
|
if ([win isSheet]) {
|
||||||
|
return [win isKeyWindow];
|
||||||
|
}
|
||||||
return [win isMainWindow] && ![win attachedSheet];
|
return [win isMainWindow] && ![win attachedSheet];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ already_AddRefed<DrawTarget> WindowSurfaceWaylandMB::Lock(
|
||||||
lockRect.height, aInvalidRegion.GetNumRects());
|
lockRect.height, aInvalidRegion.GetNumRects());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mWindow->WindowType() == eWindowType_invisible) {
|
if (mWindow->GetWindowType() == WindowType::Invisible) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
mFrameInProcess = true;
|
mFrameInProcess = true;
|
||||||
|
|
|
||||||
|
|
@ -433,7 +433,7 @@ nsWindow::nsWindow()
|
||||||
mConfiguredClearColor(false),
|
mConfiguredClearColor(false),
|
||||||
mGotNonBlankPaint(false),
|
mGotNonBlankPaint(false),
|
||||||
mNeedsToRetryCapturingMouse(false) {
|
mNeedsToRetryCapturingMouse(false) {
|
||||||
mWindowType = eWindowType_child;
|
mWindowType = WindowType::Child;
|
||||||
mSizeConstraints.mMaxSize = GetSafeWindowSize(mSizeConstraints.mMaxSize);
|
mSizeConstraints.mMaxSize = GetSafeWindowSize(mSizeConstraints.mMaxSize);
|
||||||
|
|
||||||
if (!gGlobalsInitialized) {
|
if (!gGlobalsInitialized) {
|
||||||
|
|
@ -518,7 +518,7 @@ void nsWindow::MaybeDispatchResized() {
|
||||||
<< mBounds << " size state " << mSizeMode;
|
<< mBounds << " size state " << mSizeMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType == eWindowType_toplevel) {
|
if (mWindowType == WindowType::TopLevel) {
|
||||||
UpdateTopLevelOpaqueRegion();
|
UpdateTopLevelOpaqueRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -760,7 +760,7 @@ void nsWindow::SetParent(nsIWidget* aNewParent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsWindow::WidgetTypeSupportsAcceleration() {
|
bool nsWindow::WidgetTypeSupportsAcceleration() {
|
||||||
if (mWindowType == eWindowType_invisible) {
|
if (mWindowType == WindowType::Invisible) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -770,7 +770,7 @@ bool nsWindow::WidgetTypeSupportsAcceleration() {
|
||||||
// Workaround for Bug 1479135
|
// Workaround for Bug 1479135
|
||||||
// We draw transparent popups on non-compositing screens by SW as we don't
|
// We draw transparent popups on non-compositing screens by SW as we don't
|
||||||
// implement X shape masks in WebRender.
|
// implement X shape masks in WebRender.
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
return HasRemoteContent() && mCompositedScreen;
|
return HasRemoteContent() && mCompositedScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1072,8 +1072,8 @@ void nsWindow::Move(double aX, double aY) {
|
||||||
|
|
||||||
LOG("nsWindow::Move to %d x %d\n", x, y);
|
LOG("nsWindow::Move to %d x %d\n", x, y);
|
||||||
|
|
||||||
if (mSizeMode != nsSizeMode_Normal && (mWindowType == eWindowType_toplevel ||
|
if (mSizeMode != nsSizeMode_Normal && (mWindowType == WindowType::TopLevel ||
|
||||||
mWindowType == eWindowType_dialog)) {
|
mWindowType == WindowType::Dialog)) {
|
||||||
LOG(" size state is not normal, bailing");
|
LOG(" size state is not normal, bailing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1082,7 +1082,7 @@ void nsWindow::Move(double aX, double aY) {
|
||||||
// the parent, the parent might have moved so we always move a
|
// the parent, the parent might have moved so we always move a
|
||||||
// popup window.
|
// popup window.
|
||||||
LOG(" bounds %d x %d\n", mBounds.x, mBounds.y);
|
LOG(" bounds %d x %d\n", mBounds.x, mBounds.y);
|
||||||
if (x == mBounds.x && y == mBounds.y && mWindowType != eWindowType_popup) {
|
if (x == mBounds.x && y == mBounds.y && mWindowType != WindowType::Popup) {
|
||||||
LOG(" position is the same, return\n");
|
LOG(" position is the same, return\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1100,7 +1100,7 @@ void nsWindow::Move(double aX, double aY) {
|
||||||
NativeMoveResize(/* move */ true, /* resize */ false);
|
NativeMoveResize(/* move */ true, /* resize */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsWindow::IsPopup() const { return mWindowType == eWindowType_popup; }
|
bool nsWindow::IsPopup() const { return mWindowType == WindowType::Popup; }
|
||||||
|
|
||||||
bool nsWindow::IsWaylandPopup() const {
|
bool nsWindow::IsWaylandPopup() const {
|
||||||
return GdkIsWaylandDisplay() && IsPopup();
|
return GdkIsWaylandDisplay() && IsPopup();
|
||||||
|
|
@ -1305,7 +1305,7 @@ void nsWindow::WaylandPopupHideTooltips() {
|
||||||
|
|
||||||
nsWindow* popup = mWaylandPopupNext;
|
nsWindow* popup = mWaylandPopupNext;
|
||||||
while (popup && popup->mWaylandPopupNext) {
|
while (popup && popup->mWaylandPopupNext) {
|
||||||
if (popup->mPopupType == ePopupTypeTooltip) {
|
if (popup->mPopupType == PopupType::Tooltip) {
|
||||||
LOG(" hidding tooltip [%p]", popup);
|
LOG(" hidding tooltip [%p]", popup);
|
||||||
popup->WaylandPopupMarkAsClosed();
|
popup->WaylandPopupMarkAsClosed();
|
||||||
}
|
}
|
||||||
|
|
@ -1425,7 +1425,7 @@ void nsWindow::WaylandPopupHierarchyHideByLayout(
|
||||||
nsWindow* popup = mWaylandPopupNext;
|
nsWindow* popup = mWaylandPopupNext;
|
||||||
while (popup) {
|
while (popup) {
|
||||||
// Don't check closed popups and drag source popups and tooltips.
|
// Don't check closed popups and drag source popups and tooltips.
|
||||||
if (!popup->mPopupClosed && popup->mPopupType != ePopupTypeTooltip &&
|
if (!popup->mPopupClosed && popup->mPopupType != PopupType::Tooltip &&
|
||||||
!popup->mSourceDragContext) {
|
!popup->mSourceDragContext) {
|
||||||
if (!popup->IsPopupInLayoutPopupChain(aLayoutWidgetHierarchy,
|
if (!popup->IsPopupInLayoutPopupChain(aLayoutWidgetHierarchy,
|
||||||
/* aMustMatchParent */ false)) {
|
/* aMustMatchParent */ false)) {
|
||||||
|
|
@ -1443,7 +1443,7 @@ void nsWindow::WaylandPopupHierarchyValidateByLayout(
|
||||||
LOG("nsWindow::WaylandPopupHierarchyValidateByLayout");
|
LOG("nsWindow::WaylandPopupHierarchyValidateByLayout");
|
||||||
nsWindow* popup = mWaylandPopupNext;
|
nsWindow* popup = mWaylandPopupNext;
|
||||||
while (popup) {
|
while (popup) {
|
||||||
if (popup->mPopupType == ePopupTypeTooltip) {
|
if (popup->mPopupType == PopupType::Tooltip) {
|
||||||
popup->mPopupMatchesLayout = true;
|
popup->mPopupMatchesLayout = true;
|
||||||
} else if (!popup->mPopupClosed) {
|
} else if (!popup->mPopupClosed) {
|
||||||
popup->mPopupMatchesLayout = popup->IsPopupInLayoutPopupChain(
|
popup->mPopupMatchesLayout = popup->IsPopupInLayoutPopupChain(
|
||||||
|
|
@ -1545,7 +1545,7 @@ void nsWindow::WaylandPopupHierarchyCalculatePositions() {
|
||||||
bool nsWindow::WaylandPopupIsMenu() {
|
bool nsWindow::WaylandPopupIsMenu() {
|
||||||
nsMenuPopupFrame* menuPopupFrame = GetMenuPopupFrame(GetFrame());
|
nsMenuPopupFrame* menuPopupFrame = GetMenuPopupFrame(GetFrame());
|
||||||
if (menuPopupFrame) {
|
if (menuPopupFrame) {
|
||||||
return mPopupType == ePopupTypeMenu && !menuPopupFrame->IsMenuList();
|
return mPopupType == PopupType::Menu && !menuPopupFrame->IsMenuList();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1706,7 +1706,7 @@ bool nsWindow::WaylandPopupConfigure() {
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("nsWindow::WaylandPopupConfigure tracked %d anchored %d hint %d\n",
|
LOG("nsWindow::WaylandPopupConfigure tracked %d anchored %d hint %d\n",
|
||||||
mPopupTrackInHierarchy, mPopupAnchored, mPopupHint);
|
mPopupTrackInHierarchy, mPopupAnchored, int(mPopupHint));
|
||||||
|
|
||||||
// Permanent state changed and popup is mapped.
|
// Permanent state changed and popup is mapped.
|
||||||
// We need to switch popup type but that's done when popup is mapped
|
// We need to switch popup type but that's done when popup is mapped
|
||||||
|
|
@ -1725,13 +1725,13 @@ bool nsWindow::WaylandPopupConfigure() {
|
||||||
// should_map_as_popup()/should_map_as_subsurface()
|
// should_map_as_popup()/should_map_as_subsurface()
|
||||||
GdkWindowTypeHint gtkTypeHint;
|
GdkWindowTypeHint gtkTypeHint;
|
||||||
switch (mPopupHint) {
|
switch (mPopupHint) {
|
||||||
case ePopupTypeMenu:
|
case PopupType::Menu:
|
||||||
// GDK_WINDOW_TYPE_HINT_POPUP_MENU is mapped as xdg_popup by default.
|
// GDK_WINDOW_TYPE_HINT_POPUP_MENU is mapped as xdg_popup by default.
|
||||||
// We use this type for all menu popups.
|
// We use this type for all menu popups.
|
||||||
gtkTypeHint = GDK_WINDOW_TYPE_HINT_POPUP_MENU;
|
gtkTypeHint = GDK_WINDOW_TYPE_HINT_POPUP_MENU;
|
||||||
LOG(" popup type Menu");
|
LOG(" popup type Menu");
|
||||||
break;
|
break;
|
||||||
case ePopupTypeTooltip:
|
case PopupType::Tooltip:
|
||||||
gtkTypeHint = GDK_WINDOW_TYPE_HINT_TOOLTIP;
|
gtkTypeHint = GDK_WINDOW_TYPE_HINT_TOOLTIP;
|
||||||
LOG(" popup type Tooltip");
|
LOG(" popup type Tooltip");
|
||||||
break;
|
break;
|
||||||
|
|
@ -1879,12 +1879,12 @@ void nsWindow::UpdateWaylandPopupHierarchy() {
|
||||||
// popups are adjacent.
|
// popups are adjacent.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (popup->mPopupHint == ePopupTypePanel &&
|
if (popup->mPopupHint == PopupType::Panel &&
|
||||||
popup->WaylandPopupIsFirst() &&
|
popup->WaylandPopupIsFirst() &&
|
||||||
popup->WaylandPopupFitsToplevelWindow(/* aMove */ true)) {
|
popup->WaylandPopupFitsToplevelWindow(/* aMove */ true)) {
|
||||||
// Workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/1986
|
// Workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/1986
|
||||||
//
|
//
|
||||||
// ePopupTypePanel types are used for extension popups which may be
|
// PopupType::Panel types are used for extension popups which may be
|
||||||
// resized. If such popup uses move-to-rect, we need to hide it before
|
// resized. If such popup uses move-to-rect, we need to hide it before
|
||||||
// resize and show it again. That leads to massive flickering
|
// resize and show it again. That leads to massive flickering
|
||||||
// so use plain move if possible to avoid it.
|
// so use plain move if possible to avoid it.
|
||||||
|
|
@ -2490,7 +2490,7 @@ nsWindow::WaylandPopupGetPositionFromLayout() {
|
||||||
// We want tooltips to flip verticaly or slide only.
|
// We want tooltips to flip verticaly or slide only.
|
||||||
// See nsMenuPopupFrame::SetPopupPosition().
|
// See nsMenuPopupFrame::SetPopupPosition().
|
||||||
// https://searchfox.org/mozilla-central/rev/d0f5bc50aff3462c9d1546b88d60c5cb020eb15c/layout/xul/nsMenuPopupFrame.cpp#1603
|
// https://searchfox.org/mozilla-central/rev/d0f5bc50aff3462c9d1546b88d60c5cb020eb15c/layout/xul/nsMenuPopupFrame.cpp#1603
|
||||||
if (mPopupType == ePopupTypeTooltip) {
|
if (mPopupType == PopupType::Tooltip) {
|
||||||
hints = GdkAnchorHints(GDK_ANCHOR_FLIP_Y | GDK_ANCHOR_SLIDE);
|
hints = GdkAnchorHints(GDK_ANCHOR_FLIP_Y | GDK_ANCHOR_SLIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2587,7 +2587,7 @@ bool nsWindow::WaylandPopupCheckAndGetAnchor(GdkRectangle* aPopupAnchor,
|
||||||
void nsWindow::WaylandPopupPrepareForMove() {
|
void nsWindow::WaylandPopupPrepareForMove() {
|
||||||
LOG("nsWindow::WaylandPopupPrepareForMove()");
|
LOG("nsWindow::WaylandPopupPrepareForMove()");
|
||||||
|
|
||||||
if (mPopupHint == ePopupTypeTooltip) {
|
if (mPopupHint == PopupType::Tooltip) {
|
||||||
// Don't fiddle with tooltips type, just hide it before move-to-rect
|
// Don't fiddle with tooltips type, just hide it before move-to-rect
|
||||||
if (mPopupUseMoveToRect && gtk_widget_is_visible(mShell)) {
|
if (mPopupUseMoveToRect && gtk_widget_is_visible(mShell)) {
|
||||||
HideWaylandPopupWindow(/* aTemporaryHide */ true,
|
HideWaylandPopupWindow(/* aTemporaryHide */ true,
|
||||||
|
|
@ -2948,7 +2948,7 @@ void nsWindow::MoveToWorkspace(const nsAString& workspaceIDStr) {
|
||||||
|
|
||||||
void nsWindow::SetUserTimeAndStartupTokenForActivatedWindow() {
|
void nsWindow::SetUserTimeAndStartupTokenForActivatedWindow() {
|
||||||
nsGTKToolkit* toolkit = nsGTKToolkit::GetToolkit();
|
nsGTKToolkit* toolkit = nsGTKToolkit::GetToolkit();
|
||||||
if (!toolkit || MOZ_UNLIKELY(mWindowType == eWindowType_invisible)) {
|
if (!toolkit || MOZ_UNLIKELY(mWindowType == WindowType::Invisible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3135,7 +3135,7 @@ void nsWindow::SetFocus(Raise aRaise, mozilla::dom::CallerType aCallerType) {
|
||||||
// Ensure GTK_WIDGET(mContainer) is the focused GtkWidget within its toplevel
|
// Ensure GTK_WIDGET(mContainer) is the focused GtkWidget within its toplevel
|
||||||
// window.
|
// window.
|
||||||
//
|
//
|
||||||
// For eWindowType_popup, this GtkWidget may not actually be the one that
|
// For WindowType::Popup, this GtkWidget may not actually be the one that
|
||||||
// receives the key events as it may be the parent window that is active.
|
// receives the key events as it may be the parent window that is active.
|
||||||
if (!gtk_widget_is_focus(GTK_WIDGET(mContainer))) {
|
if (!gtk_widget_is_focus(GTK_WIDGET(mContainer))) {
|
||||||
// This is synchronous. It takes focus from a plugin or from a widget
|
// This is synchronous. It takes focus from a plugin or from a widget
|
||||||
|
|
@ -3172,7 +3172,7 @@ LayoutDeviceIntRect nsWindow::GetScreenBounds() {
|
||||||
// HiDPI screens, and those don't have window decorations anyways.
|
// HiDPI screens, and those don't have window decorations anyways.
|
||||||
//
|
//
|
||||||
// See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4820
|
// See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4820
|
||||||
if (mContainer && mWindowType != eWindowType_popup) {
|
if (mContainer && mWindowType != WindowType::Popup) {
|
||||||
gint x, y;
|
gint x, y;
|
||||||
gdk_window_get_root_origin(gtk_widget_get_window(GTK_WIDGET(mContainer)),
|
gdk_window_get_root_origin(gtk_widget_get_window(GTK_WIDGET(mContainer)),
|
||||||
&x, &y);
|
&x, &y);
|
||||||
|
|
@ -3216,8 +3216,8 @@ LayoutDeviceIntRect nsWindow::GetClientBounds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsWindow::RecomputeClientOffset(bool aNotify) {
|
void nsWindow::RecomputeClientOffset(bool aNotify) {
|
||||||
if (mWindowType != eWindowType_dialog &&
|
if (mWindowType != WindowType::Dialog &&
|
||||||
mWindowType != eWindowType_toplevel) {
|
mWindowType != WindowType::TopLevel) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3798,7 +3798,7 @@ gboolean nsWindow::OnExposeEvent(cairo_t* cr) {
|
||||||
region.And(region, LayoutDeviceIntRect(0, 0, mBounds.width, mBounds.height));
|
region.And(region, LayoutDeviceIntRect(0, 0, mBounds.width, mBounds.height));
|
||||||
|
|
||||||
bool shaped = false;
|
bool shaped = false;
|
||||||
if (eTransparencyTransparent == GetTransparencyMode()) {
|
if (TransparencyMode::Transparent == GetTransparencyMode()) {
|
||||||
auto* window = static_cast<nsWindow*>(GetTopLevelWidget());
|
auto* window = static_cast<nsWindow*>(GetTopLevelWidget());
|
||||||
if (mTransparencyBitmapForTitlebar) {
|
if (mTransparencyBitmapForTitlebar) {
|
||||||
if (mSizeMode == nsSizeMode_Normal) {
|
if (mSizeMode == nsSizeMode_Normal) {
|
||||||
|
|
@ -3888,7 +3888,7 @@ gboolean nsWindow::OnExposeEvent(cairo_t* cr) {
|
||||||
bool painted = false;
|
bool painted = false;
|
||||||
{
|
{
|
||||||
if (renderer->GetBackendType() == LayersBackend::LAYERS_NONE) {
|
if (renderer->GetBackendType() == LayersBackend::LAYERS_NONE) {
|
||||||
if (GetTransparencyMode() == eTransparencyTransparent &&
|
if (GetTransparencyMode() == TransparencyMode::Transparent &&
|
||||||
layerBuffering == BufferMode::BUFFER_NONE && mHasAlphaVisual) {
|
layerBuffering == BufferMode::BUFFER_NONE && mHasAlphaVisual) {
|
||||||
// If our draw target is unbuffered and we use an alpha channel,
|
// If our draw target is unbuffered and we use an alpha channel,
|
||||||
// clear the image beforehand to ensure we don't get artifacts from a
|
// clear the image beforehand to ensure we don't get artifacts from a
|
||||||
|
|
@ -4001,8 +4001,8 @@ gboolean nsWindow::OnConfigureEvent(GtkWidget* aWidget,
|
||||||
|
|
||||||
// Don't fire configure event for scale changes, we handle that
|
// Don't fire configure event for scale changes, we handle that
|
||||||
// OnScaleChanged event. Skip that for toplevel windows only.
|
// OnScaleChanged event. Skip that for toplevel windows only.
|
||||||
if (mGdkWindow && (mWindowType == eWindowType_toplevel ||
|
if (mGdkWindow && (mWindowType == WindowType::TopLevel ||
|
||||||
mWindowType == eWindowType_dialog)) {
|
mWindowType == WindowType::Dialog)) {
|
||||||
if (mWindowScaleFactor != gdk_window_get_scale_factor(mGdkWindow)) {
|
if (mWindowScaleFactor != gdk_window_get_scale_factor(mGdkWindow)) {
|
||||||
LOG(" scale factor changed to %d,return early",
|
LOG(" scale factor changed to %d,return early",
|
||||||
gdk_window_get_scale_factor(mGdkWindow));
|
gdk_window_get_scale_factor(mGdkWindow));
|
||||||
|
|
@ -4012,8 +4012,8 @@ gboolean nsWindow::OnConfigureEvent(GtkWidget* aWidget,
|
||||||
|
|
||||||
LayoutDeviceIntRect screenBounds = GetScreenBounds();
|
LayoutDeviceIntRect screenBounds = GetScreenBounds();
|
||||||
|
|
||||||
if (mWindowType == eWindowType_toplevel ||
|
if (mWindowType == WindowType::TopLevel ||
|
||||||
mWindowType == eWindowType_dialog) {
|
mWindowType == WindowType::Dialog) {
|
||||||
// This check avoids unwanted rollup on spurious configure events from
|
// This check avoids unwanted rollup on spurious configure events from
|
||||||
// Cygwin/X (bug 672103).
|
// Cygwin/X (bug 672103).
|
||||||
if (mBounds.x != screenBounds.x || mBounds.y != screenBounds.y) {
|
if (mBounds.x != screenBounds.x || mBounds.y != screenBounds.y) {
|
||||||
|
|
@ -4272,7 +4272,7 @@ void nsWindow::OnLeaveNotifyEvent(GdkEventCrossing* aEvent) {
|
||||||
// The filter out for subwindows should make sure that this is targeted to
|
// The filter out for subwindows should make sure that this is targeted to
|
||||||
// this nsWindow.
|
// this nsWindow.
|
||||||
const bool leavingTopLevel =
|
const bool leavingTopLevel =
|
||||||
mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog;
|
mWindowType == WindowType::TopLevel || mWindowType == WindowType::Dialog;
|
||||||
|
|
||||||
if (leavingTopLevel && IsBogusLeaveNotifyEvent(mGdkWindow, aEvent)) {
|
if (leavingTopLevel && IsBogusLeaveNotifyEvent(mGdkWindow, aEvent)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -4762,8 +4762,8 @@ void nsWindow::OnContainerFocusInEvent(GdkEventFocus* aEvent) {
|
||||||
void nsWindow::OnContainerFocusOutEvent(GdkEventFocus* aEvent) {
|
void nsWindow::OnContainerFocusOutEvent(GdkEventFocus* aEvent) {
|
||||||
LOG("OnContainerFocusOutEvent");
|
LOG("OnContainerFocusOutEvent");
|
||||||
|
|
||||||
if (mWindowType == eWindowType_toplevel ||
|
if (mWindowType == WindowType::TopLevel ||
|
||||||
mWindowType == eWindowType_dialog) {
|
mWindowType == WindowType::Dialog) {
|
||||||
// Rollup menus when a window is focused out unless a drag is occurring.
|
// Rollup menus when a window is focused out unless a drag is occurring.
|
||||||
// This check is because drags grab the keyboard and cause a focus out on
|
// This check is because drags grab the keyboard and cause a focus out on
|
||||||
// versions of GTK before 2.18.
|
// versions of GTK before 2.18.
|
||||||
|
|
@ -5316,7 +5316,7 @@ void nsWindow::OnDragDataReceivedEvent(GtkWidget* aWidget,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsWindow* nsWindow::GetTransientForWindowIfPopup() {
|
nsWindow* nsWindow::GetTransientForWindowIfPopup() {
|
||||||
if (mWindowType != eWindowType_popup) {
|
if (mWindowType != WindowType::Popup) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
GtkWindow* toplevel = gtk_window_get_transient_for(GTK_WINDOW(mShell));
|
GtkWindow* toplevel = gtk_window_get_transient_for(GTK_WINDOW(mShell));
|
||||||
|
|
@ -5587,11 +5587,11 @@ nsAutoCString nsWindow::GetFrameTag() const {
|
||||||
|
|
||||||
nsCString nsWindow::GetPopupTypeName() {
|
nsCString nsWindow::GetPopupTypeName() {
|
||||||
switch (mPopupHint) {
|
switch (mPopupHint) {
|
||||||
case ePopupTypeMenu:
|
case PopupType::Menu:
|
||||||
return nsCString("Menu");
|
return nsCString("Menu");
|
||||||
case ePopupTypeTooltip:
|
case PopupType::Tooltip:
|
||||||
return nsCString("Tooltip");
|
return nsCString("Tooltip");
|
||||||
case ePopupTypePanel:
|
case PopupType::Panel:
|
||||||
return nsCString("Panel/Utility");
|
return nsCString("Panel/Utility");
|
||||||
default:
|
default:
|
||||||
return nsCString("Unknown");
|
return nsCString("Unknown");
|
||||||
|
|
@ -5718,7 +5718,7 @@ void nsWindow::ConfigureGdkWindow() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
if (mNoAutoHide) {
|
if (mNoAutoHide) {
|
||||||
gint wmd = ConvertBorderStyles(mBorderStyle);
|
gint wmd = ConvertBorderStyles(mBorderStyle);
|
||||||
if (wmd != -1) {
|
if (wmd != -1) {
|
||||||
|
|
@ -5758,15 +5758,15 @@ void nsWindow::ReleaseGdkWindow() {
|
||||||
|
|
||||||
nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData) {
|
widget::InitData* aInitData) {
|
||||||
LOG("nsWindow::Create\n");
|
LOG("nsWindow::Create\n");
|
||||||
|
|
||||||
// only set the base parent if we're going to be a dialog or a
|
// only set the base parent if we're going to be a dialog or a
|
||||||
// toplevel
|
// toplevel
|
||||||
nsIWidget* baseParent =
|
nsIWidget* baseParent =
|
||||||
aInitData && (aInitData->mWindowType == eWindowType_dialog ||
|
aInitData && (aInitData->mWindowType == WindowType::Dialog ||
|
||||||
aInitData->mWindowType == eWindowType_toplevel ||
|
aInitData->mWindowType == WindowType::TopLevel ||
|
||||||
aInitData->mWindowType == eWindowType_invisible)
|
aInitData->mWindowType == WindowType::Invisible)
|
||||||
? nullptr
|
? nullptr
|
||||||
: aParent;
|
: aParent;
|
||||||
|
|
||||||
|
|
@ -5801,10 +5801,10 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
mLastSizeRequest = mBounds.Size();
|
mLastSizeRequest = mBounds.Size();
|
||||||
|
|
||||||
GtkWidget* eventWidget = nullptr;
|
GtkWidget* eventWidget = nullptr;
|
||||||
bool popupNeedsAlphaVisual = (mWindowType == eWindowType_popup &&
|
bool popupNeedsAlphaVisual = (mWindowType == WindowType::Popup &&
|
||||||
(aInitData && aInitData->mSupportTranslucency));
|
(aInitData && aInitData->mSupportTranslucency));
|
||||||
|
|
||||||
// Figure out our parent window - only used for eWindowType_child
|
// Figure out our parent window - only used for WindowType::Child
|
||||||
GdkWindow* parentGdkWindow = nullptr;
|
GdkWindow* parentGdkWindow = nullptr;
|
||||||
nsWindow* parentnsWindow = nullptr;
|
nsWindow* parentnsWindow = nullptr;
|
||||||
|
|
||||||
|
|
@ -5819,10 +5819,10 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType == eWindowType_child) {
|
if (mWindowType == WindowType::Child) {
|
||||||
// We don't support eWindowType_child directly but emulate it by popup
|
// We don't support WindowType::Child directly but emulate it by popup
|
||||||
// windows.
|
// windows.
|
||||||
mWindowType = eWindowType_popup;
|
mWindowType = WindowType::Popup;
|
||||||
if (!parentnsWindow) {
|
if (!parentnsWindow) {
|
||||||
if (aNativeParent && GTK_IS_CONTAINER(aNativeParent)) {
|
if (aNativeParent && GTK_IS_CONTAINER(aNativeParent)) {
|
||||||
parentnsWindow = get_window_for_gtk_widget(GTK_WIDGET(aNativeParent));
|
parentnsWindow = get_window_for_gtk_widget(GTK_WIDGET(aNativeParent));
|
||||||
|
|
@ -5832,20 +5832,20 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
LOG(" child widget, switch to popup. parent nsWindow %p", parentnsWindow);
|
LOG(" child widget, switch to popup. parent nsWindow %p", parentnsWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType == eWindowType_popup && !parentnsWindow) {
|
if (mWindowType == WindowType::Popup && !parentnsWindow) {
|
||||||
LOG(" popup window without parent!");
|
LOG(" popup window without parent!");
|
||||||
if (GdkIsWaylandDisplay()) {
|
if (GdkIsWaylandDisplay()) {
|
||||||
LOG(" switch to toplevel on Wayland.");
|
LOG(" switch to toplevel on Wayland.");
|
||||||
// Wayland does not allow to create popup without parent so switch to
|
// Wayland does not allow to create popup without parent so switch to
|
||||||
// toplevel and mark as wayland panel.
|
// toplevel and mark as wayland panel.
|
||||||
mIsWaylandPanelWindow = true;
|
mIsWaylandPanelWindow = true;
|
||||||
mWindowType = eWindowType_toplevel;
|
mWindowType = WindowType::TopLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType != eWindowType_dialog && mWindowType != eWindowType_popup &&
|
if (mWindowType != WindowType::Dialog && mWindowType != WindowType::Popup &&
|
||||||
mWindowType != eWindowType_toplevel &&
|
mWindowType != WindowType::TopLevel &&
|
||||||
mWindowType != eWindowType_invisible) {
|
mWindowType != WindowType::Invisible) {
|
||||||
MOZ_ASSERT_UNREACHABLE("Unexpected eWindowType");
|
MOZ_ASSERT_UNREACHABLE("Unexpected eWindowType");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
@ -5868,7 +5868,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
// For Wayland we have to always use GTK_WINDOW_POPUP to control
|
// For Wayland we have to always use GTK_WINDOW_POPUP to control
|
||||||
// popup window position.
|
// popup window position.
|
||||||
GtkWindowType type = GTK_WINDOW_TOPLEVEL;
|
GtkWindowType type = GTK_WINDOW_TOPLEVEL;
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
MOZ_ASSERT(aInitData);
|
MOZ_ASSERT(aInitData);
|
||||||
type = GTK_WINDOW_POPUP;
|
type = GTK_WINDOW_POPUP;
|
||||||
if (GdkIsX11Display() && mNoAutoHide) {
|
if (GdkIsX11Display() && mNoAutoHide) {
|
||||||
|
|
@ -5881,14 +5881,14 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
// gfxVars, used below.
|
// gfxVars, used below.
|
||||||
Unused << gfxPlatform::GetPlatform();
|
Unused << gfxPlatform::GetPlatform();
|
||||||
|
|
||||||
if (mWindowType == eWindowType_toplevel ||
|
if (mWindowType == WindowType::TopLevel ||
|
||||||
mWindowType == eWindowType_dialog) {
|
mWindowType == WindowType::Dialog) {
|
||||||
mGtkWindowDecoration = GetSystemGtkWindowDecoration();
|
mGtkWindowDecoration = GetSystemGtkWindowDecoration();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't use transparency for PictureInPicture windows.
|
// Don't use transparency for PictureInPicture windows.
|
||||||
bool toplevelNeedsAlphaVisual = false;
|
bool toplevelNeedsAlphaVisual = false;
|
||||||
if (mWindowType == eWindowType_toplevel && !mIsPIPWindow) {
|
if (mWindowType == WindowType::TopLevel && !mIsPIPWindow) {
|
||||||
toplevelNeedsAlphaVisual = IsToplevelWindowTransparent();
|
toplevelNeedsAlphaVisual = IsToplevelWindowTransparent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5923,9 +5923,9 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
|
|
||||||
// We have a toplevel window with transparency.
|
// We have a toplevel window with transparency.
|
||||||
// Calls to UpdateTitlebarTransparencyBitmap() from OnExposeEvent()
|
// Calls to UpdateTitlebarTransparencyBitmap() from OnExposeEvent()
|
||||||
// occur before SetTransparencyMode() receives eTransparencyTransparent
|
// occur before SetTransparencyMode() receives TransparencyMode::Transparent
|
||||||
// from layout, so set mIsTransparent here.
|
// from layout, so set mIsTransparent here.
|
||||||
if (mWindowType == eWindowType_toplevel &&
|
if (mWindowType == WindowType::TopLevel &&
|
||||||
(mHasAlphaVisual || mTransparencyBitmapForTitlebar)) {
|
(mHasAlphaVisual || mTransparencyBitmapForTitlebar)) {
|
||||||
mIsTransparent = true;
|
mIsTransparent = true;
|
||||||
}
|
}
|
||||||
|
|
@ -5940,7 +5940,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
gtk_window_resize(GTK_WINDOW(mShell), size.width, size.height);
|
gtk_window_resize(GTK_WINDOW(mShell), size.width, size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType == eWindowType_dialog) {
|
if (mWindowType == WindowType::Dialog) {
|
||||||
mGtkWindowRoleName = "Dialog";
|
mGtkWindowRoleName = "Dialog";
|
||||||
|
|
||||||
SetDefaultIcon();
|
SetDefaultIcon();
|
||||||
|
|
@ -5951,7 +5951,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
GTK_WINDOW(parentnsWindow->GetGtkWidget()));
|
GTK_WINDOW(parentnsWindow->GetGtkWidget()));
|
||||||
LOG(" set parent window [%p]\n", parentnsWindow);
|
LOG(" set parent window [%p]\n", parentnsWindow);
|
||||||
}
|
}
|
||||||
} else if (mWindowType == eWindowType_popup) {
|
} else if (mWindowType == WindowType::Popup) {
|
||||||
MOZ_ASSERT(aInitData);
|
MOZ_ASSERT(aInitData);
|
||||||
mGtkWindowRoleName = "Popup";
|
mGtkWindowRoleName = "Popup";
|
||||||
mPopupHint = aInitData->mPopupHint;
|
mPopupHint = aInitData->mPopupHint;
|
||||||
|
|
@ -5961,14 +5961,14 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
if (mNoAutoHide) {
|
if (mNoAutoHide) {
|
||||||
// ... but the window manager does not decorate this window,
|
// ... but the window manager does not decorate this window,
|
||||||
// nor provide a separate taskbar icon.
|
// nor provide a separate taskbar icon.
|
||||||
if (mBorderStyle == eBorderStyle_default) {
|
if (mBorderStyle == BorderStyle::Default) {
|
||||||
gtk_window_set_decorated(GTK_WINDOW(mShell), FALSE);
|
gtk_window_set_decorated(GTK_WINDOW(mShell), FALSE);
|
||||||
} else {
|
} else {
|
||||||
bool decorate = mBorderStyle & eBorderStyle_title;
|
bool decorate = bool(mBorderStyle & BorderStyle::Title);
|
||||||
gtk_window_set_decorated(GTK_WINDOW(mShell), decorate);
|
gtk_window_set_decorated(GTK_WINDOW(mShell), decorate);
|
||||||
if (decorate) {
|
if (decorate) {
|
||||||
gtk_window_set_deletable(GTK_WINDOW(mShell),
|
gtk_window_set_deletable(GTK_WINDOW(mShell),
|
||||||
mBorderStyle & eBorderStyle_close);
|
bool(mBorderStyle & BorderStyle::Close));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mShell), TRUE);
|
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mShell), TRUE);
|
||||||
|
|
@ -5996,10 +5996,10 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
// at WaylandPopupConfigure().
|
// at WaylandPopupConfigure().
|
||||||
GdkWindowTypeHint gtkTypeHint;
|
GdkWindowTypeHint gtkTypeHint;
|
||||||
switch (mPopupHint) {
|
switch (mPopupHint) {
|
||||||
case ePopupTypeMenu:
|
case PopupType::Menu:
|
||||||
gtkTypeHint = GDK_WINDOW_TYPE_HINT_POPUP_MENU;
|
gtkTypeHint = GDK_WINDOW_TYPE_HINT_POPUP_MENU;
|
||||||
break;
|
break;
|
||||||
case ePopupTypeTooltip:
|
case PopupType::Tooltip:
|
||||||
gtkTypeHint = GDK_WINDOW_TYPE_HINT_TOOLTIP;
|
gtkTypeHint = GDK_WINDOW_TYPE_HINT_TOOLTIP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -6016,7 +6016,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
GtkWindowSetTransientFor(GTK_WINDOW(mShell), parentWidget);
|
GtkWindowSetTransientFor(GTK_WINDOW(mShell), parentWidget);
|
||||||
|
|
||||||
// If popup parent is modal, we need to make popup modal on Wayland too.
|
// If popup parent is modal, we need to make popup modal on Wayland too.
|
||||||
if (GdkIsWaylandDisplay() && mPopupHint != ePopupTypeTooltip &&
|
if (GdkIsWaylandDisplay() && mPopupHint != PopupType::Tooltip &&
|
||||||
gtk_window_get_modal(parentWidget)) {
|
gtk_window_get_modal(parentWidget)) {
|
||||||
gtk_window_set_modal(GTK_WINDOW(mShell), true);
|
gtk_window_set_modal(GTK_WINDOW(mShell), true);
|
||||||
}
|
}
|
||||||
|
|
@ -6034,7 +6034,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
GdkRectangle rect = DevicePixelsToGdkRectRoundOut(mBounds);
|
GdkRectangle rect = DevicePixelsToGdkRectRoundOut(mBounds);
|
||||||
mPopupPosition = {rect.x, rect.y};
|
mPopupPosition = {rect.x, rect.y};
|
||||||
}
|
}
|
||||||
} else { // must be eWindowType_toplevel
|
} else { // must be WindowType::TopLevel
|
||||||
mGtkWindowRoleName = "Toplevel";
|
mGtkWindowRoleName = "Toplevel";
|
||||||
SetDefaultIcon();
|
SetDefaultIcon();
|
||||||
|
|
||||||
|
|
@ -6128,7 +6128,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
MOZ_ASSERT(aInitData);
|
MOZ_ASSERT(aInitData);
|
||||||
// gdk does not automatically set the cursor for "temporary"
|
// gdk does not automatically set the cursor for "temporary"
|
||||||
// windows, which are what gtk uses for popups.
|
// windows, which are what gtk uses for popups.
|
||||||
|
|
@ -6172,7 +6172,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
g_signal_connect(mShell, "property-notify-event",
|
g_signal_connect(mShell, "property-notify-event",
|
||||||
G_CALLBACK(property_notify_event_cb), nullptr);
|
G_CALLBACK(property_notify_event_cb), nullptr);
|
||||||
|
|
||||||
if (mWindowType == eWindowType_toplevel) {
|
if (mWindowType == WindowType::TopLevel) {
|
||||||
g_signal_connect_after(mShell, "size_allocate",
|
g_signal_connect_after(mShell, "size_allocate",
|
||||||
G_CALLBACK(toplevel_window_size_allocate_cb),
|
G_CALLBACK(toplevel_window_size_allocate_cb),
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
@ -6245,7 +6245,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
// Only use for toplevel windows for now, see bug 1619246.
|
// Only use for toplevel windows for now, see bug 1619246.
|
||||||
if (GdkIsWaylandDisplay() &&
|
if (GdkIsWaylandDisplay() &&
|
||||||
StaticPrefs::widget_wayland_vsync_enabled_AtStartup() &&
|
StaticPrefs::widget_wayland_vsync_enabled_AtStartup() &&
|
||||||
mWindowType == eWindowType_toplevel) {
|
mWindowType == WindowType::TopLevel) {
|
||||||
mWaylandVsyncSource = new WaylandVsyncSource(this);
|
mWaylandVsyncSource = new WaylandVsyncSource(this);
|
||||||
mWaylandVsyncDispatcher = new VsyncDispatcher(mWaylandVsyncSource);
|
mWaylandVsyncDispatcher = new VsyncDispatcher(mWaylandVsyncSource);
|
||||||
LOG_VSYNC(" created WaylandVsyncSource)");
|
LOG_VSYNC(" created WaylandVsyncSource)");
|
||||||
|
|
@ -6255,7 +6255,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
|
|
||||||
// We create input contexts for all containers, except for
|
// We create input contexts for all containers, except for
|
||||||
// toplevel popup windows
|
// toplevel popup windows
|
||||||
if (mWindowType != eWindowType_popup) {
|
if (mWindowType != WindowType::Popup) {
|
||||||
mIMContext = new IMContextWrapper(this);
|
mIMContext = new IMContextWrapper(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6282,7 +6282,8 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
g_signal_connect(eventWidget, "touch-event", G_CALLBACK(touch_event_cb),
|
g_signal_connect(eventWidget, "touch-event", G_CALLBACK(touch_event_cb),
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
LOG(" nsWindow type %d %s\n", mWindowType, mIsPIPWindow ? "PIP window" : "");
|
LOG(" nsWindow type %d %s\n", int(mWindowType),
|
||||||
|
mIsPIPWindow ? "PIP window" : "");
|
||||||
LOG(" mShell %p mContainer %p mGdkWindow %p XID 0x%lx\n", mShell, mContainer,
|
LOG(" mShell %p mContainer %p mGdkWindow %p XID 0x%lx\n", mShell, mContainer,
|
||||||
mGdkWindow, GetX11Window());
|
mGdkWindow, GetX11Window());
|
||||||
|
|
||||||
|
|
@ -6437,7 +6438,7 @@ void nsWindow::NativeMoveResize(bool aMoved, bool aResized) {
|
||||||
#define COMPOSITOR_PAUSE_TIMEOUT (1000)
|
#define COMPOSITOR_PAUSE_TIMEOUT (1000)
|
||||||
|
|
||||||
void nsWindow::PauseCompositorFlickering() {
|
void nsWindow::PauseCompositorFlickering() {
|
||||||
bool pauseCompositor = (mWindowType == eWindowType_toplevel) &&
|
bool pauseCompositor = (mWindowType == WindowType::TopLevel) &&
|
||||||
mCompositorState == COMPOSITOR_ENABLED &&
|
mCompositorState == COMPOSITOR_ENABLED &&
|
||||||
mCompositorWidgetDelegate && !mIsDestroyed;
|
mCompositorWidgetDelegate && !mIsDestroyed;
|
||||||
if (!pauseCompositor) {
|
if (!pauseCompositor) {
|
||||||
|
|
@ -6685,14 +6686,14 @@ LayoutDeviceIntSize nsWindow::GetSafeWindowSize(LayoutDeviceIntSize aSize) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsWindow::SetTransparencyMode(nsTransparencyMode aMode) {
|
void nsWindow::SetTransparencyMode(TransparencyMode aMode) {
|
||||||
bool isTransparent = aMode == eTransparencyTransparent;
|
bool isTransparent = aMode == TransparencyMode::Transparent;
|
||||||
|
|
||||||
if (mIsTransparent == isTransparent) {
|
if (mIsTransparent == isTransparent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType != eWindowType_popup) {
|
if (mWindowType != WindowType::Popup) {
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1344839 reported
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1344839 reported
|
||||||
// problems cleaning the layer manager for toplevel windows.
|
// problems cleaning the layer manager for toplevel windows.
|
||||||
// Ignore the request so as to workaround that.
|
// Ignore the request so as to workaround that.
|
||||||
|
|
@ -6718,8 +6719,9 @@ void nsWindow::SetTransparencyMode(nsTransparencyMode aMode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTransparencyMode nsWindow::GetTransparencyMode() {
|
TransparencyMode nsWindow::GetTransparencyMode() {
|
||||||
return mIsTransparent ? eTransparencyTransparent : eTransparencyOpaque;
|
return mIsTransparent ? TransparencyMode::Transparent
|
||||||
|
: TransparencyMode::Opaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint nsWindow::GetInputRegionMarginInGdkCoords() {
|
gint nsWindow::GetInputRegionMarginInGdkCoords() {
|
||||||
|
|
@ -6843,7 +6845,7 @@ void nsWindow::UpdateTopLevelOpaqueRegion(void) {
|
||||||
|
|
||||||
bool nsWindow::IsChromeWindowTitlebar() {
|
bool nsWindow::IsChromeWindowTitlebar() {
|
||||||
return mDrawInTitlebar && !mIsPIPWindow &&
|
return mDrawInTitlebar && !mIsPIPWindow &&
|
||||||
mWindowType == eWindowType_toplevel;
|
mWindowType == WindowType::TopLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsWindow::DoDrawTilebarCorners() {
|
bool nsWindow::DoDrawTilebarCorners() {
|
||||||
|
|
@ -7126,19 +7128,19 @@ void nsWindow::SetUrgencyHint(GtkWidget* top_window, bool state) {
|
||||||
|
|
||||||
void nsWindow::SetDefaultIcon(void) { SetIcon(u"default"_ns); }
|
void nsWindow::SetDefaultIcon(void) { SetIcon(u"default"_ns); }
|
||||||
|
|
||||||
gint nsWindow::ConvertBorderStyles(nsBorderStyle aStyle) {
|
gint nsWindow::ConvertBorderStyles(BorderStyle aStyle) {
|
||||||
gint w = 0;
|
gint w = 0;
|
||||||
|
|
||||||
if (aStyle == eBorderStyle_default) return -1;
|
if (aStyle == BorderStyle::Default) return -1;
|
||||||
|
|
||||||
// note that we don't handle eBorderStyle_close yet
|
// note that we don't handle BorderStyle::Close yet
|
||||||
if (aStyle & eBorderStyle_all) w |= GDK_DECOR_ALL;
|
if (aStyle & BorderStyle::All) w |= GDK_DECOR_ALL;
|
||||||
if (aStyle & eBorderStyle_border) w |= GDK_DECOR_BORDER;
|
if (aStyle & BorderStyle::Border) w |= GDK_DECOR_BORDER;
|
||||||
if (aStyle & eBorderStyle_resizeh) w |= GDK_DECOR_RESIZEH;
|
if (aStyle & BorderStyle::ResizeH) w |= GDK_DECOR_RESIZEH;
|
||||||
if (aStyle & eBorderStyle_title) w |= GDK_DECOR_TITLE;
|
if (aStyle & BorderStyle::Title) w |= GDK_DECOR_TITLE;
|
||||||
if (aStyle & eBorderStyle_menu) w |= GDK_DECOR_MENU;
|
if (aStyle & BorderStyle::Menu) w |= GDK_DECOR_MENU;
|
||||||
if (aStyle & eBorderStyle_minimize) w |= GDK_DECOR_MINIMIZE;
|
if (aStyle & BorderStyle::Minimize) w |= GDK_DECOR_MINIMIZE;
|
||||||
if (aStyle & eBorderStyle_maximize) w |= GDK_DECOR_MAXIMIZE;
|
if (aStyle & BorderStyle::Maximize) w |= GDK_DECOR_MAXIMIZE;
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
@ -7352,8 +7354,8 @@ nsresult nsWindow::MakeFullScreen(bool aFullScreen) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsWindow::SetWindowDecoration(nsBorderStyle aStyle) {
|
void nsWindow::SetWindowDecoration(BorderStyle aStyle) {
|
||||||
LOG("nsWindow::SetWindowDecoration() Border style %x\n", aStyle);
|
LOG("nsWindow::SetWindowDecoration() Border style %x\n", int(aStyle));
|
||||||
|
|
||||||
// We can't use mGdkWindow directly here as it can be
|
// We can't use mGdkWindow directly here as it can be
|
||||||
// derived from mContainer which is not a top-level GdkWindow.
|
// derived from mContainer which is not a top-level GdkWindow.
|
||||||
|
|
@ -7389,7 +7391,7 @@ void nsWindow::SetWindowDecoration(nsBorderStyle aStyle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsWindow::HideWindowChrome(bool aShouldHide) {
|
void nsWindow::HideWindowChrome(bool aShouldHide) {
|
||||||
SetWindowDecoration(aShouldHide ? eBorderStyle_none : mBorderStyle);
|
SetWindowDecoration(aShouldHide ? BorderStyle::None : mBorderStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsWindow::CheckForRollup(gdouble aMouseX, gdouble aMouseY, bool aIsWheel,
|
bool nsWindow::CheckForRollup(gdouble aMouseX, gdouble aMouseY, bool aIsWheel,
|
||||||
|
|
@ -8694,7 +8696,7 @@ void nsWindow::SetDrawsInTitlebar(bool aState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mGtkWindowDecoration == GTK_DECORATION_SYSTEM) {
|
if (mGtkWindowDecoration == GTK_DECORATION_SYSTEM) {
|
||||||
SetWindowDecoration(aState ? eBorderStyle_border : mBorderStyle);
|
SetWindowDecoration(aState ? BorderStyle::Border : mBorderStyle);
|
||||||
} else if (mGtkWindowDecoration == GTK_DECORATION_CLIENT) {
|
} else if (mGtkWindowDecoration == GTK_DECORATION_CLIENT) {
|
||||||
LOG(" Using CSD mode\n");
|
LOG(" Using CSD mode\n");
|
||||||
|
|
||||||
|
|
@ -8790,7 +8792,7 @@ GtkWindow* nsWindow::GetCurrentTopmostWindow() const {
|
||||||
gint nsWindow::GdkCeiledScaleFactor() {
|
gint nsWindow::GdkCeiledScaleFactor() {
|
||||||
// We depend on notify::scale-factor callback which is reliable for toplevel
|
// We depend on notify::scale-factor callback which is reliable for toplevel
|
||||||
// windows only, so don't use scale cache for popup windows.
|
// windows only, so don't use scale cache for popup windows.
|
||||||
if (mWindowType == eWindowType_toplevel && !mWindowScaleFactorChanged) {
|
if (mWindowType == WindowType::TopLevel && !mWindowScaleFactorChanged) {
|
||||||
return mWindowScaleFactor;
|
return mWindowScaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8799,7 +8801,7 @@ gint nsWindow::GdkCeiledScaleFactor() {
|
||||||
// For popup windows/dialogs with parent window we need to get scale factor
|
// For popup windows/dialogs with parent window we need to get scale factor
|
||||||
// of the topmost window. Otherwise the scale factor of the popup is
|
// of the topmost window. Otherwise the scale factor of the popup is
|
||||||
// not updated during it's hidden.
|
// not updated during it's hidden.
|
||||||
if (mWindowType == eWindowType_popup || mWindowType == eWindowType_dialog) {
|
if (mWindowType == WindowType::Popup || mWindowType == WindowType::Dialog) {
|
||||||
// Get toplevel window for scale factor:
|
// Get toplevel window for scale factor:
|
||||||
GtkWindow* topmostParentWindow = GetCurrentTopmostWindow();
|
GtkWindow* topmostParentWindow = GetCurrentTopmostWindow();
|
||||||
if (topmostParentWindow) {
|
if (topmostParentWindow) {
|
||||||
|
|
@ -9667,7 +9669,7 @@ void nsWindow::ClearRenderingQueue() {
|
||||||
//
|
//
|
||||||
bool nsWindow::ApplyEnterLeaveMutterWorkaround() {
|
bool nsWindow::ApplyEnterLeaveMutterWorkaround() {
|
||||||
// Leave (toplevel) case
|
// Leave (toplevel) case
|
||||||
if (mWindowType == eWindowType_toplevel && mWaylandPopupNext &&
|
if (mWindowType == WindowType::TopLevel && mWaylandPopupNext &&
|
||||||
mWaylandPopupNext->mWaylandPopupNext &&
|
mWaylandPopupNext->mWaylandPopupNext &&
|
||||||
gtk_window_get_type_hint(GTK_WINDOW(mWaylandPopupNext->GetGtkWidget())) ==
|
gtk_window_get_type_hint(GTK_WINDOW(mWaylandPopupNext->GetGtkWidget())) ==
|
||||||
GDK_WINDOW_TYPE_HINT_UTILITY) {
|
GDK_WINDOW_TYPE_HINT_UTILITY) {
|
||||||
|
|
@ -9685,7 +9687,7 @@ bool nsWindow::ApplyEnterLeaveMutterWorkaround() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsWindow::NotifyOcclusionState(mozilla::widget::OcclusionState aState) {
|
void nsWindow::NotifyOcclusionState(mozilla::widget::OcclusionState aState) {
|
||||||
if (mWindowType != eWindowType_toplevel) {
|
if (mWindowType != WindowType::TopLevel) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ class nsWindow final : public nsBaseWidget {
|
||||||
[[nodiscard]] nsresult Create(nsIWidget* aParent,
|
[[nodiscard]] nsresult Create(nsIWidget* aParent,
|
||||||
nsNativeWidget aNativeParent,
|
nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData) override;
|
InitData* aInitData) override;
|
||||||
void Destroy() override;
|
void Destroy() override;
|
||||||
nsIWidget* GetParent() override;
|
nsIWidget* GetParent() override;
|
||||||
float GetDPI() override;
|
float GetDPI() override;
|
||||||
|
|
@ -209,7 +209,7 @@ class nsWindow final : public nsBaseWidget {
|
||||||
|
|
||||||
// utility method, -1 if no change should be made, otherwise returns a
|
// utility method, -1 if no change should be made, otherwise returns a
|
||||||
// value that can be passed to gdk_window_set_decorations
|
// value that can be passed to gdk_window_set_decorations
|
||||||
gint ConvertBorderStyles(nsBorderStyle aStyle);
|
gint ConvertBorderStyles(BorderStyle aStyle);
|
||||||
|
|
||||||
mozilla::widget::IMContextWrapper* GetIMContext() const { return mIMContext; }
|
mozilla::widget::IMContextWrapper* GetIMContext() const { return mIMContext; }
|
||||||
|
|
||||||
|
|
@ -311,8 +311,8 @@ class nsWindow final : public nsBaseWidget {
|
||||||
void ApplyTransparencyBitmap();
|
void ApplyTransparencyBitmap();
|
||||||
void ClearTransparencyBitmap();
|
void ClearTransparencyBitmap();
|
||||||
|
|
||||||
void SetTransparencyMode(nsTransparencyMode aMode) override;
|
void SetTransparencyMode(TransparencyMode aMode) override;
|
||||||
nsTransparencyMode GetTransparencyMode() override;
|
TransparencyMode GetTransparencyMode() override;
|
||||||
void SetInputRegion(const InputRegion&) override;
|
void SetInputRegion(const InputRegion&) override;
|
||||||
nsresult UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
|
nsresult UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
|
||||||
uint8_t* aAlphas,
|
uint8_t* aAlphas,
|
||||||
|
|
@ -470,7 +470,7 @@ class nsWindow final : public nsBaseWidget {
|
||||||
void RegisterTouchWindow() override;
|
void RegisterTouchWindow() override;
|
||||||
|
|
||||||
nsCOMPtr<nsIWidget> mParent;
|
nsCOMPtr<nsIWidget> mParent;
|
||||||
nsPopupType mPopupHint{};
|
PopupType mPopupHint{};
|
||||||
int mWindowScaleFactor = 1;
|
int mWindowScaleFactor = 1;
|
||||||
|
|
||||||
void UpdateAlpha(mozilla::gfx::SourceSurface* aSourceSurface,
|
void UpdateAlpha(mozilla::gfx::SourceSurface* aSourceSurface,
|
||||||
|
|
@ -498,7 +498,7 @@ class nsWindow final : public nsBaseWidget {
|
||||||
void EnsureGdkWindow();
|
void EnsureGdkWindow();
|
||||||
void SetUrgencyHint(GtkWidget* top_window, bool state);
|
void SetUrgencyHint(GtkWidget* top_window, bool state);
|
||||||
void SetDefaultIcon(void);
|
void SetDefaultIcon(void);
|
||||||
void SetWindowDecoration(nsBorderStyle aStyle);
|
void SetWindowDecoration(BorderStyle aStyle);
|
||||||
void InitButtonEvent(mozilla::WidgetMouseEvent& aEvent,
|
void InitButtonEvent(mozilla::WidgetMouseEvent& aEvent,
|
||||||
GdkEventButton* aGdkEvent,
|
GdkEventButton* aGdkEvent,
|
||||||
const mozilla::LayoutDeviceIntPoint& aRefPoint);
|
const mozilla::LayoutDeviceIntPoint& aRefPoint);
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ void HeadlessWidget::Destroy() {
|
||||||
nsresult HeadlessWidget::Create(nsIWidget* aParent,
|
nsresult HeadlessWidget::Create(nsIWidget* aParent,
|
||||||
nsNativeWidget aNativeParent,
|
nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData) {
|
widget::InitData* aInitData) {
|
||||||
MOZ_ASSERT(!aNativeParent, "No native parents for headless widgets.");
|
MOZ_ASSERT(!aNativeParent, "No native parents for headless widgets.");
|
||||||
|
|
||||||
BaseCreate(nullptr, aInitData);
|
BaseCreate(nullptr, aInitData);
|
||||||
|
|
@ -135,7 +135,7 @@ nsresult HeadlessWidget::Create(nsIWidget* aParent,
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsIWidget> HeadlessWidget::CreateChild(
|
already_AddRefed<nsIWidget> HeadlessWidget::CreateChild(
|
||||||
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData,
|
const LayoutDeviceIntRect& aRect, widget::InitData* aInitData,
|
||||||
bool aForceUseIWidgetParent) {
|
bool aForceUseIWidgetParent) {
|
||||||
nsCOMPtr<nsIWidget> widget = nsIWidget::CreateHeadlessWidget();
|
nsCOMPtr<nsIWidget> widget = nsIWidget::CreateHeadlessWidget();
|
||||||
if (!widget) {
|
if (!widget) {
|
||||||
|
|
@ -156,8 +156,8 @@ void HeadlessWidget::GetCompositorWidgetInitData(
|
||||||
nsIWidget* HeadlessWidget::GetTopLevelWidget() { return mTopLevel; }
|
nsIWidget* HeadlessWidget::GetTopLevelWidget() { return mTopLevel; }
|
||||||
|
|
||||||
void HeadlessWidget::RaiseWindow() {
|
void HeadlessWidget::RaiseWindow() {
|
||||||
MOZ_ASSERT(mTopLevel == this || mWindowType == eWindowType_dialog ||
|
MOZ_ASSERT(mTopLevel == this || mWindowType == WindowType::Dialog ||
|
||||||
mWindowType == eWindowType_sheet,
|
mWindowType == WindowType::Sheet,
|
||||||
"Raising a non-toplevel window.");
|
"Raising a non-toplevel window.");
|
||||||
|
|
||||||
// Do nothing if this is the currently active window.
|
// Do nothing if this is the currently active window.
|
||||||
|
|
@ -195,8 +195,8 @@ void HeadlessWidget::Show(bool aState) {
|
||||||
LOG(("HeadlessWidget::Show [%p] state %d\n", (void*)this, aState));
|
LOG(("HeadlessWidget::Show [%p] state %d\n", (void*)this, aState));
|
||||||
|
|
||||||
// Top-level window and dialogs are activated/raised when shown.
|
// Top-level window and dialogs are activated/raised when shown.
|
||||||
if (aState && (mTopLevel == this || mWindowType == eWindowType_dialog ||
|
if (aState && (mTopLevel == this || mWindowType == WindowType::Dialog ||
|
||||||
mWindowType == eWindowType_sheet)) {
|
mWindowType == WindowType::Sheet)) {
|
||||||
RaiseWindow();
|
RaiseWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,8 +231,8 @@ void HeadlessWidget::Move(double aX, double aY) {
|
||||||
int32_t x = NSToIntRound(aX * scale);
|
int32_t x = NSToIntRound(aX * scale);
|
||||||
int32_t y = NSToIntRound(aY * scale);
|
int32_t y = NSToIntRound(aY * scale);
|
||||||
|
|
||||||
if (mWindowType == eWindowType_toplevel ||
|
if (mWindowType == WindowType::TopLevel ||
|
||||||
mWindowType == eWindowType_dialog) {
|
mWindowType == WindowType::Dialog) {
|
||||||
SetSizeMode(nsSizeMode_Normal);
|
SetSizeMode(nsSizeMode_Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,7 +243,7 @@ void HeadlessWidget::MoveInternal(int32_t aX, int32_t aY) {
|
||||||
// Since a popup window's x/y coordinates are in relation to
|
// Since a popup window's x/y coordinates are in relation to
|
||||||
// the parent, the parent might have moved so we always move a
|
// the parent, the parent might have moved so we always move a
|
||||||
// popup window.
|
// popup window.
|
||||||
if (mBounds.IsEqualXY(aX, aY) && mWindowType != eWindowType_popup) {
|
if (mBounds.IsEqualXY(aX, aY) && mWindowType != WindowType::Popup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,10 @@ class HeadlessWidget : public nsBaseWidget {
|
||||||
|
|
||||||
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) override;
|
widget::InitData* aInitData = nullptr) override;
|
||||||
using nsBaseWidget::Create; // for Create signature not overridden here
|
using nsBaseWidget::Create; // for Create signature not overridden here
|
||||||
virtual already_AddRefed<nsIWidget> CreateChild(
|
virtual already_AddRefed<nsIWidget> CreateChild(
|
||||||
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData = nullptr,
|
const LayoutDeviceIntRect& aRect, widget::InitData* aInitData = nullptr,
|
||||||
bool aForceUseIWidgetParent = false) override;
|
bool aForceUseIWidgetParent = false) override;
|
||||||
|
|
||||||
virtual nsIWidget* GetTopLevelWidget() override;
|
virtual nsIWidget* GetTopLevelWidget() override;
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,6 @@ EXPORTS += [
|
||||||
"nsPaper.h",
|
"nsPaper.h",
|
||||||
"nsPrinterListBase.h",
|
"nsPrinterListBase.h",
|
||||||
"nsUserIdleService.h",
|
"nsUserIdleService.h",
|
||||||
"nsWidgetInitData.h",
|
|
||||||
"nsWidgetsCID.h",
|
"nsWidgetsCID.h",
|
||||||
"PuppetWidget.h",
|
"PuppetWidget.h",
|
||||||
]
|
]
|
||||||
|
|
@ -195,6 +194,7 @@ EXPORTS.mozilla.widget += [
|
||||||
"CompositorWidget.h",
|
"CompositorWidget.h",
|
||||||
"IconLoader.h",
|
"IconLoader.h",
|
||||||
"IMEData.h",
|
"IMEData.h",
|
||||||
|
"InitData.h",
|
||||||
"InProcessCompositorWidget.h",
|
"InProcessCompositorWidget.h",
|
||||||
"MediaKeysEventSourceFactory.h",
|
"MediaKeysEventSourceFactory.h",
|
||||||
"NativeMenu.h",
|
"NativeMenu.h",
|
||||||
|
|
|
||||||
|
|
@ -135,9 +135,9 @@ NS_IMPL_ISUPPORTS(nsBaseWidget, nsIWidget, nsISupportsWeakReference)
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
nsBaseWidget::nsBaseWidget() : nsBaseWidget(eBorderStyle_none) {}
|
nsBaseWidget::nsBaseWidget() : nsBaseWidget(BorderStyle::None) {}
|
||||||
|
|
||||||
nsBaseWidget::nsBaseWidget(nsBorderStyle aBorderStyle)
|
nsBaseWidget::nsBaseWidget(BorderStyle aBorderStyle)
|
||||||
: mWidgetListener(nullptr),
|
: mWidgetListener(nullptr),
|
||||||
mAttachedWidgetListener(nullptr),
|
mAttachedWidgetListener(nullptr),
|
||||||
mPreviouslyAttachedWidgetListener(nullptr),
|
mPreviouslyAttachedWidgetListener(nullptr),
|
||||||
|
|
@ -145,8 +145,8 @@ nsBaseWidget::nsBaseWidget(nsBorderStyle aBorderStyle)
|
||||||
mBorderStyle(aBorderStyle),
|
mBorderStyle(aBorderStyle),
|
||||||
mBounds(0, 0, 0, 0),
|
mBounds(0, 0, 0, 0),
|
||||||
mIsTiled(false),
|
mIsTiled(false),
|
||||||
mPopupLevel(ePopupLevelTop),
|
mPopupLevel(PopupLevel::Top),
|
||||||
mPopupType(ePopupTypeAny),
|
mPopupType(PopupType::Any),
|
||||||
mHasRemoteContent(false),
|
mHasRemoteContent(false),
|
||||||
mUpdateCursor(true),
|
mUpdateCursor(true),
|
||||||
mUseAttachedEvents(false),
|
mUseAttachedEvents(false),
|
||||||
|
|
@ -412,7 +412,7 @@ nsBaseWidget::~nsBaseWidget() {
|
||||||
// Basic create.
|
// Basic create.
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
void nsBaseWidget::BaseCreate(nsIWidget* aParent, nsWidgetInitData* aInitData) {
|
void nsBaseWidget::BaseCreate(nsIWidget* aParent, widget::InitData* aInitData) {
|
||||||
if (aInitData) {
|
if (aInitData) {
|
||||||
mWindowType = aInitData->mWindowType;
|
mWindowType = aInitData->mWindowType;
|
||||||
mBorderStyle = aInitData->mBorderStyle;
|
mBorderStyle = aInitData->mBorderStyle;
|
||||||
|
|
@ -441,7 +441,7 @@ void nsBaseWidget::SetWidgetListener(nsIWidgetListener* aWidgetListener) {
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsIWidget> nsBaseWidget::CreateChild(
|
already_AddRefed<nsIWidget> nsBaseWidget::CreateChild(
|
||||||
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData,
|
const LayoutDeviceIntRect& aRect, widget::InitData* aInitData,
|
||||||
bool aForceUseIWidgetParent) {
|
bool aForceUseIWidgetParent) {
|
||||||
nsIWidget* parent = this;
|
nsIWidget* parent = this;
|
||||||
nsNativeWidget nativeParent = nullptr;
|
nsNativeWidget nativeParent = nullptr;
|
||||||
|
|
@ -456,7 +456,7 @@ already_AddRefed<nsIWidget> nsBaseWidget::CreateChild(
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIWidget> widget;
|
nsCOMPtr<nsIWidget> widget;
|
||||||
if (aInitData && aInitData->mWindowType == eWindowType_popup) {
|
if (aInitData && aInitData->mWindowType == WindowType::Popup) {
|
||||||
widget = AllocateChildPopupWidget();
|
widget = AllocateChildPopupWidget();
|
||||||
} else {
|
} else {
|
||||||
widget = nsIWidget::CreateChildWindow();
|
widget = nsIWidget::CreateChildWindow();
|
||||||
|
|
@ -476,10 +476,10 @@ already_AddRefed<nsIWidget> nsBaseWidget::CreateChild(
|
||||||
|
|
||||||
// Attach a view to our widget which we'll send events to.
|
// Attach a view to our widget which we'll send events to.
|
||||||
void nsBaseWidget::AttachViewToTopLevel(bool aUseAttachedEvents) {
|
void nsBaseWidget::AttachViewToTopLevel(bool aUseAttachedEvents) {
|
||||||
NS_ASSERTION((mWindowType == eWindowType_toplevel ||
|
NS_ASSERTION((mWindowType == WindowType::TopLevel ||
|
||||||
mWindowType == eWindowType_dialog ||
|
mWindowType == WindowType::Dialog ||
|
||||||
mWindowType == eWindowType_invisible ||
|
mWindowType == WindowType::Invisible ||
|
||||||
mWindowType == eWindowType_child),
|
mWindowType == WindowType::Child),
|
||||||
"Can't attach to window of that type");
|
"Can't attach to window of that type");
|
||||||
|
|
||||||
mUseAttachedEvents = aUseAttachedEvents;
|
mUseAttachedEvents = aUseAttachedEvents;
|
||||||
|
|
@ -700,10 +700,10 @@ void nsBaseWidget::SetCursor(const Cursor& aCursor) { mCursor = aCursor; }
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
void nsBaseWidget::SetTransparencyMode(nsTransparencyMode aMode) {}
|
void nsBaseWidget::SetTransparencyMode(TransparencyMode aMode) {}
|
||||||
|
|
||||||
nsTransparencyMode nsBaseWidget::GetTransparencyMode() {
|
TransparencyMode nsBaseWidget::GetTransparencyMode() {
|
||||||
return eTransparencyOpaque;
|
return TransparencyMode::Opaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */
|
/* virtual */
|
||||||
|
|
@ -956,7 +956,7 @@ nsBaseWidget::AutoLayerManagerSetup::~AutoLayerManagerSetup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsBaseWidget::IsSmallPopup() const {
|
bool nsBaseWidget::IsSmallPopup() const {
|
||||||
return mWindowType == eWindowType_popup && mPopupType != ePopupTypePanel;
|
return mWindowType == WindowType::Popup && mPopupType != PopupType::Panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsBaseWidget::ComputeShouldAccelerate() {
|
bool nsBaseWidget::ComputeShouldAccelerate() {
|
||||||
|
|
@ -967,10 +967,10 @@ bool nsBaseWidget::ComputeShouldAccelerate() {
|
||||||
|
|
||||||
bool nsBaseWidget::UseAPZ() {
|
bool nsBaseWidget::UseAPZ() {
|
||||||
return (gfxPlatform::AsyncPanZoomEnabled() &&
|
return (gfxPlatform::AsyncPanZoomEnabled() &&
|
||||||
(WindowType() == eWindowType_toplevel ||
|
(mWindowType == WindowType::TopLevel ||
|
||||||
WindowType() == eWindowType_child ||
|
mWindowType == WindowType::Child ||
|
||||||
((WindowType() == eWindowType_popup ||
|
((mWindowType == WindowType::Popup ||
|
||||||
WindowType() == eWindowType_dialog) &&
|
mWindowType == WindowType::Dialog) &&
|
||||||
HasRemoteContent() && StaticPrefs::apz_popups_enabled())));
|
HasRemoteContent() && StaticPrefs::apz_popups_enabled())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1496,7 +1496,7 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight) {
|
||||||
#if defined(XP_MACOSX)
|
#if defined(XP_MACOSX)
|
||||||
bool getCompositorFromThisWindow = true;
|
bool getCompositorFromThisWindow = true;
|
||||||
#else
|
#else
|
||||||
bool getCompositorFromThisWindow = (mWindowType == eWindowType_toplevel);
|
bool getCompositorFromThisWindow = mWindowType == WindowType::TopLevel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (getCompositorFromThisWindow) {
|
if (getCompositorFromThisWindow) {
|
||||||
|
|
@ -1775,7 +1775,7 @@ void nsBaseWidget::SetSizeConstraints(const SizeConstraints& aConstraints) {
|
||||||
//
|
//
|
||||||
// The right fix here is probably making constraint changes go through the
|
// The right fix here is probably making constraint changes go through the
|
||||||
// view manager and such.
|
// view manager and such.
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||||
public:
|
public:
|
||||||
nsBaseWidget();
|
nsBaseWidget();
|
||||||
|
|
||||||
explicit nsBaseWidget(nsBorderStyle aBorderStyle);
|
explicit nsBaseWidget(BorderStyle aBorderStyle);
|
||||||
|
|
||||||
NS_DECL_THREADSAFE_ISUPPORTS
|
NS_DECL_THREADSAFE_ISUPPORTS
|
||||||
|
|
||||||
|
|
@ -191,8 +191,8 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||||
mCursor = {};
|
mCursor = {};
|
||||||
mUpdateCursor = true;
|
mUpdateCursor = true;
|
||||||
}
|
}
|
||||||
void SetTransparencyMode(nsTransparencyMode aMode) override;
|
void SetTransparencyMode(TransparencyMode aMode) override;
|
||||||
nsTransparencyMode GetTransparencyMode() override;
|
TransparencyMode GetTransparencyMode() override;
|
||||||
void SetWindowShadowStyle(mozilla::StyleWindowShadow aStyle) override {}
|
void SetWindowShadowStyle(mozilla::StyleWindowShadow aStyle) override {}
|
||||||
void SetShowsToolbarButton(bool aShow) override {}
|
void SetShowsToolbarButton(bool aShow) override {}
|
||||||
void SetSupportsNativeFullscreen(bool aSupportsNativeFullscreen) override {}
|
void SetSupportsNativeFullscreen(bool aSupportsNativeFullscreen) override {}
|
||||||
|
|
@ -241,7 +241,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||||
// -setting- them (i.e. moving or resizing the widget) will always return
|
// -setting- them (i.e. moving or resizing the widget) will always return
|
||||||
// values in the widget's device pixels.
|
// values in the widget's device pixels.
|
||||||
bool BoundsUseDesktopPixels() const {
|
bool BoundsUseDesktopPixels() const {
|
||||||
return mWindowType <= eWindowType_popup;
|
return mWindowType <= WindowType::Popup;
|
||||||
}
|
}
|
||||||
// Default implementation, to be overridden by platforms where desktop coords
|
// Default implementation, to be overridden by platforms where desktop coords
|
||||||
// are virtualized and may not correspond to device pixels on the screen.
|
// are virtualized and may not correspond to device pixels on the screen.
|
||||||
|
|
@ -290,7 +290,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
already_AddRefed<nsIWidget> CreateChild(
|
already_AddRefed<nsIWidget> CreateChild(
|
||||||
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData = nullptr,
|
const LayoutDeviceIntRect& aRect, InitData* aInitData = nullptr,
|
||||||
bool aForceUseIWidgetParent = false) override;
|
bool aForceUseIWidgetParent = false) override;
|
||||||
void AttachViewToTopLevel(bool aUseAttachedEvents) override;
|
void AttachViewToTopLevel(bool aUseAttachedEvents) override;
|
||||||
nsIWidgetListener* GetAttachedWidgetListener() const override;
|
nsIWidgetListener* GetAttachedWidgetListener() const override;
|
||||||
|
|
@ -363,7 +363,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||||
// accelerating)
|
// accelerating)
|
||||||
bool IsSmallPopup() const;
|
bool IsSmallPopup() const;
|
||||||
|
|
||||||
nsPopupLevel PopupLevel() { return mPopupLevel; }
|
PopupLevel GetPopupLevel() { return mPopupLevel; }
|
||||||
|
|
||||||
LayoutDeviceIntSize ClientToWindowSize(
|
LayoutDeviceIntSize ClientToWindowSize(
|
||||||
const LayoutDeviceIntSize& aClientSize) override {
|
const LayoutDeviceIntSize& aClientSize) override {
|
||||||
|
|
@ -372,9 +372,9 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||||
|
|
||||||
// return true if this is a popup widget with a native titlebar
|
// return true if this is a popup widget with a native titlebar
|
||||||
bool IsPopupWithTitleBar() const {
|
bool IsPopupWithTitleBar() const {
|
||||||
return (mWindowType == eWindowType_popup &&
|
return (mWindowType == WindowType::Popup &&
|
||||||
mBorderStyle != eBorderStyle_default &&
|
mBorderStyle != BorderStyle::Default &&
|
||||||
mBorderStyle & eBorderStyle_title);
|
mBorderStyle & BorderStyle::Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReparentNativeWidget(nsIWidget* aNewParent) override {}
|
void ReparentNativeWidget(nsIWidget* aNewParent) override {}
|
||||||
|
|
@ -473,7 +473,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||||
void ResolveIconName(const nsAString& aIconName, const nsAString& aIconSuffix,
|
void ResolveIconName(const nsAString& aIconName, const nsAString& aIconSuffix,
|
||||||
nsIFile** aResult);
|
nsIFile** aResult);
|
||||||
virtual void OnDestroy();
|
virtual void OnDestroy();
|
||||||
void BaseCreate(nsIWidget* aParent, nsWidgetInitData* aInitData);
|
void BaseCreate(nsIWidget* aParent, InitData* aInitData);
|
||||||
|
|
||||||
virtual void ConfigureAPZCTreeManager();
|
virtual void ConfigureAPZCTreeManager();
|
||||||
virtual void ConfigureAPZControllerThread();
|
virtual void ConfigureAPZControllerThread();
|
||||||
|
|
@ -580,7 +580,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||||
|
|
||||||
WindowRenderer* CreateFallbackRenderer();
|
WindowRenderer* CreateFallbackRenderer();
|
||||||
|
|
||||||
nsPopupType PopupType() const { return mPopupType; }
|
PopupType GetPopupType() const { return mPopupType; }
|
||||||
|
|
||||||
bool HasRemoteContent() const { return mHasRemoteContent; }
|
bool HasRemoteContent() const { return mHasRemoteContent; }
|
||||||
|
|
||||||
|
|
@ -699,11 +699,11 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||||
RefPtr<mozilla::SwipeTracker> mSwipeTracker;
|
RefPtr<mozilla::SwipeTracker> mSwipeTracker;
|
||||||
mozilla::UniquePtr<mozilla::SwipeEventQueue> mSwipeEventQueue;
|
mozilla::UniquePtr<mozilla::SwipeEventQueue> mSwipeEventQueue;
|
||||||
Cursor mCursor;
|
Cursor mCursor;
|
||||||
nsBorderStyle mBorderStyle;
|
BorderStyle mBorderStyle;
|
||||||
LayoutDeviceIntRect mBounds;
|
LayoutDeviceIntRect mBounds;
|
||||||
bool mIsTiled;
|
bool mIsTiled;
|
||||||
nsPopupLevel mPopupLevel;
|
PopupLevel mPopupLevel;
|
||||||
nsPopupType mPopupType;
|
PopupType mPopupType;
|
||||||
SizeConstraints mSizeConstraints;
|
SizeConstraints mSizeConstraints;
|
||||||
bool mHasRemoteContent;
|
bool mHasRemoteContent;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
#include "nsStringFwd.h"
|
#include "nsStringFwd.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "nsTHashMap.h"
|
#include "nsTHashMap.h"
|
||||||
#include "nsWidgetInitData.h"
|
#include "mozilla/widget/InitData.h"
|
||||||
#include "nsXULAppAPI.h"
|
#include "nsXULAppAPI.h"
|
||||||
|
|
||||||
// forward declarations
|
// forward declarations
|
||||||
|
|
@ -163,16 +163,20 @@ typedef void* nsNativeWidget;
|
||||||
* Transparency modes
|
* Transparency modes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum nsTransparencyMode {
|
namespace mozilla::widget {
|
||||||
eTransparencyOpaque = 0, // Fully opaque
|
|
||||||
eTransparencyTransparent, // Parts of the window may be transparent
|
enum class TransparencyMode : uint8_t {
|
||||||
eTransparencyBorderlessGlass // Transparent parts of the window has windows 7
|
Opaque = 0, // Fully opaque
|
||||||
// glass effect, without a border around opaque
|
Transparent, // Parts of the window may be transparent
|
||||||
// areas.
|
BorderlessGlass, // Transparent parts of the window has windows 7
|
||||||
|
// glass effect, without a border around opaque
|
||||||
|
// areas.
|
||||||
// If you add to the end here, you must update the serialization code in
|
// If you add to the end here, you must update the serialization code in
|
||||||
// WidgetMessageUtils.h
|
// WidgetMessageUtils.h
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cursor types.
|
* Cursor types.
|
||||||
*/
|
*/
|
||||||
|
|
@ -393,6 +397,13 @@ class nsIWidget : public nsISupports {
|
||||||
typedef mozilla::CSSPoint CSSPoint;
|
typedef mozilla::CSSPoint CSSPoint;
|
||||||
typedef mozilla::CSSRect CSSRect;
|
typedef mozilla::CSSRect CSSRect;
|
||||||
|
|
||||||
|
using InitData = mozilla::widget::InitData;
|
||||||
|
using WindowType = mozilla::widget::WindowType;
|
||||||
|
using PopupType = mozilla::widget::PopupType;
|
||||||
|
using PopupLevel = mozilla::widget::PopupLevel;
|
||||||
|
using BorderStyle = mozilla::widget::BorderStyle;
|
||||||
|
using TransparencyMode = mozilla::widget::TransparencyMode;
|
||||||
|
|
||||||
// Used in UpdateThemeGeometries.
|
// Used in UpdateThemeGeometries.
|
||||||
struct ThemeGeometry {
|
struct ThemeGeometry {
|
||||||
// The ThemeGeometryType value for the themed widget, see
|
// The ThemeGeometryType value for the themed widget, see
|
||||||
|
|
@ -412,7 +423,7 @@ class nsIWidget : public nsISupports {
|
||||||
: mLastChild(nullptr),
|
: mLastChild(nullptr),
|
||||||
mPrevSibling(nullptr),
|
mPrevSibling(nullptr),
|
||||||
mOnDestroyCalled(false),
|
mOnDestroyCalled(false),
|
||||||
mWindowType(eWindowType_child),
|
mWindowType(WindowType::Child),
|
||||||
mZIndex(0)
|
mZIndex(0)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -450,10 +461,10 @@ class nsIWidget : public nsISupports {
|
||||||
* @param aInitData data that is used for widget initialization
|
* @param aInitData data that is used for widget initialization
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual nsresult Create(
|
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent,
|
||||||
nsIWidget* aParent, nsNativeWidget aNativeParent,
|
nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) = 0;
|
InitData* = nullptr) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As above, but with aRect specified in DesktopPixel units (for top-level
|
* As above, but with aRect specified in DesktopPixel units (for top-level
|
||||||
|
|
@ -466,7 +477,7 @@ class nsIWidget : public nsISupports {
|
||||||
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent,
|
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent,
|
||||||
nsNativeWidget aNativeParent,
|
nsNativeWidget aNativeParent,
|
||||||
const DesktopIntRect& aRect,
|
const DesktopIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) {
|
InitData* aInitData = nullptr) {
|
||||||
LayoutDeviceIntRect devPixRect =
|
LayoutDeviceIntRect devPixRect =
|
||||||
RoundedToInt(aRect * GetDesktopToDeviceScale());
|
RoundedToInt(aRect * GetDesktopToDeviceScale());
|
||||||
return Create(aParent, aNativeParent, devPixRect, aInitData);
|
return Create(aParent, aNativeParent, devPixRect, aInitData);
|
||||||
|
|
@ -489,7 +500,7 @@ class nsIWidget : public nsISupports {
|
||||||
* understood code, and shouldn't be used in new code.
|
* understood code, and shouldn't be used in new code.
|
||||||
*/
|
*/
|
||||||
virtual already_AddRefed<nsIWidget> CreateChild(
|
virtual already_AddRefed<nsIWidget> CreateChild(
|
||||||
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData = nullptr,
|
const LayoutDeviceIntRect& aRect, InitData* = nullptr,
|
||||||
bool aForceUseIWidgetParent = false) = 0;
|
bool aForceUseIWidgetParent = false) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1019,7 +1030,7 @@ class nsIWidget : public nsISupports {
|
||||||
/**
|
/**
|
||||||
* Get the window type of this widget.
|
* Get the window type of this widget.
|
||||||
*/
|
*/
|
||||||
nsWindowType WindowType() { return mWindowType; }
|
WindowType GetWindowType() const { return mWindowType; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the transparency mode of the top-level window containing this widget.
|
* Set the transparency mode of the top-level window containing this widget.
|
||||||
|
|
@ -1038,13 +1049,13 @@ class nsIWidget : public nsISupports {
|
||||||
* all pixels are reset to 1.
|
* all pixels are reset to 1.
|
||||||
* Pixel RGB color values are already premultiplied with alpha channel values.
|
* Pixel RGB color values are already premultiplied with alpha channel values.
|
||||||
*/
|
*/
|
||||||
virtual void SetTransparencyMode(nsTransparencyMode aMode) = 0;
|
virtual void SetTransparencyMode(TransparencyMode aMode) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the transparency mode of the top-level window that contains this
|
* Get the transparency mode of the top-level window that contains this
|
||||||
* widget.
|
* widget.
|
||||||
*/
|
*/
|
||||||
virtual nsTransparencyMode GetTransparencyMode() = 0;
|
virtual TransparencyMode GetTransparencyMode() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the shadow style of the window.
|
* Set the shadow style of the window.
|
||||||
|
|
@ -2130,7 +2141,7 @@ class nsIWidget : public nsISupports {
|
||||||
nsIWidget* MOZ_NON_OWNING_REF mPrevSibling;
|
nsIWidget* MOZ_NON_OWNING_REF mPrevSibling;
|
||||||
// When Destroy() is called, the sub class should set this true.
|
// When Destroy() is called, the sub class should set this true.
|
||||||
bool mOnDestroyCalled;
|
bool mOnDestroyCalled;
|
||||||
nsWindowType mWindowType;
|
WindowType mWindowType;
|
||||||
int32_t mZIndex;
|
int32_t mZIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#ifndef nsWidgetInitData_h__
|
|
||||||
#define nsWidgetInitData_h__
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Window types
|
|
||||||
*
|
|
||||||
* Don't alter previously encoded enum values - 3rd party apps may look at
|
|
||||||
* these.
|
|
||||||
*/
|
|
||||||
enum nsWindowType {
|
|
||||||
eWindowType_toplevel, // default top level window
|
|
||||||
eWindowType_dialog, // top level window but usually handled differently
|
|
||||||
// by the OS
|
|
||||||
eWindowType_sheet, // MacOSX sheet (special dialog class)
|
|
||||||
eWindowType_popup, // used for combo boxes, etc
|
|
||||||
eWindowType_child, // child windows (contained inside a window on the
|
|
||||||
// desktop (has no border))
|
|
||||||
eWindowType_invisible, // windows that are invisible or offscreen
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Popup types
|
|
||||||
*
|
|
||||||
* For eWindowType_popup
|
|
||||||
*/
|
|
||||||
enum nsPopupType {
|
|
||||||
ePopupTypePanel,
|
|
||||||
ePopupTypeMenu,
|
|
||||||
ePopupTypeTooltip,
|
|
||||||
ePopupTypeAny = 0xF000 // used only to pass to
|
|
||||||
// nsXULPopupManager::GetTopPopup
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Popup levels specify the window ordering behaviour.
|
|
||||||
*/
|
|
||||||
enum nsPopupLevel {
|
|
||||||
// the popup appears just above its parent and maintains its position
|
|
||||||
// relative to the parent
|
|
||||||
ePopupLevelParent,
|
|
||||||
// the popup is a floating popup used for tool palettes. A parent window
|
|
||||||
// must be specified, but a platform implementation need not use this.
|
|
||||||
// On Windows, floating is generally equivalent to parent. On Mac, floating
|
|
||||||
// puts the popup at toplevel, but it will hide when the application is
|
|
||||||
// deactivated
|
|
||||||
ePopupLevelFloating,
|
|
||||||
// the popup appears on top of other windows, including those of other
|
|
||||||
// applications
|
|
||||||
ePopupLevelTop
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Border styles
|
|
||||||
*/
|
|
||||||
enum nsBorderStyle {
|
|
||||||
eBorderStyle_none = 0, // no border, titlebar, etc.. opposite of
|
|
||||||
// all
|
|
||||||
eBorderStyle_all = 1 << 0, // all window decorations
|
|
||||||
eBorderStyle_border = 1 << 1, // enables the border on the window. these
|
|
||||||
// are only for decoration and are not
|
|
||||||
// resize handles
|
|
||||||
eBorderStyle_resizeh = 1 << 2, // enables the resize handles for the
|
|
||||||
// window. if this is set, border is
|
|
||||||
// implied to also be set
|
|
||||||
eBorderStyle_title = 1 << 3, // enables the titlebar for the window
|
|
||||||
eBorderStyle_menu = 1 << 4, // enables the window menu button on the
|
|
||||||
// title bar. this being on should force
|
|
||||||
// the title bar to display
|
|
||||||
eBorderStyle_minimize = 1 << 5, // enables the minimize button so the user
|
|
||||||
// can minimize the window. turned off for
|
|
||||||
// tranient windows since they can not be
|
|
||||||
// minimized separate from their parent
|
|
||||||
eBorderStyle_maximize = 1 << 6, // enables the maxmize button so the user
|
|
||||||
// can maximize the window
|
|
||||||
eBorderStyle_close = 1 << 7, // show the close button
|
|
||||||
eBorderStyle_default = -1 // whatever the OS wants... i.e. don't do
|
|
||||||
// anything
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Basic struct for widget initialization data.
|
|
||||||
* @see Create member function of nsIWidget
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct nsWidgetInitData {
|
|
||||||
nsWidgetInitData() = default;
|
|
||||||
|
|
||||||
nsWindowType mWindowType = eWindowType_child;
|
|
||||||
nsBorderStyle mBorderStyle = eBorderStyle_default;
|
|
||||||
nsPopupType mPopupHint = ePopupTypePanel;
|
|
||||||
nsPopupLevel mPopupLevel = ePopupLevelTop;
|
|
||||||
// when painting exclude area occupied by child windows and sibling windows
|
|
||||||
bool mClipChildren = false;
|
|
||||||
bool mClipSiblings = false;
|
|
||||||
bool mForMenupopupFrame = false;
|
|
||||||
bool mRTL = false;
|
|
||||||
bool mNoAutoHide = false; // true for noautohide panels
|
|
||||||
bool mIsDragPopup = false; // true for drag feedback panels
|
|
||||||
// true if window creation animation is suppressed, e.g. for session restore
|
|
||||||
bool mIsAnimationSuppressed = false;
|
|
||||||
// true if the window should support an alpha channel, if available.
|
|
||||||
bool mSupportTranslucency = false;
|
|
||||||
bool mHasRemoteContent = false;
|
|
||||||
bool mAlwaysOnTop = false;
|
|
||||||
// Is PictureInPicture window
|
|
||||||
bool mPIPWindow = false;
|
|
||||||
// True if the window is user-resizable.
|
|
||||||
bool mResizable = false;
|
|
||||||
bool mIsPrivate = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // nsWidgetInitData_h__
|
|
||||||
|
|
@ -36,12 +36,12 @@ class MockWinWidget : public nsBaseWidget {
|
||||||
|
|
||||||
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) override {
|
InitData* aInitData = nullptr) override {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const DesktopIntRect& aRect,
|
const DesktopIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) override {
|
InitData* aInitData = nullptr) override {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
virtual void Show(bool aState) override {}
|
virtual void Show(bool aState) override {}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class nsWindow final : public nsBaseWidget {
|
||||||
|
|
||||||
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
[[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) override;
|
widget::InitData* aInitData = nullptr) override;
|
||||||
virtual void Destroy() override;
|
virtual void Destroy() override;
|
||||||
virtual void Show(bool aState) override;
|
virtual void Show(bool aState) override;
|
||||||
virtual void Enable(bool aState) override {}
|
virtual void Enable(bool aState) override {}
|
||||||
|
|
|
||||||
|
|
@ -396,8 +396,8 @@ void nsWindow::TearDownView() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsWindow::IsTopLevel() {
|
bool nsWindow::IsTopLevel() {
|
||||||
return mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog ||
|
return mWindowType == WindowType::TopLevel || mWindowType == WindowType::Dialog ||
|
||||||
mWindowType == eWindowType_invisible;
|
mWindowType == WindowType::Invisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -405,7 +405,7 @@ bool nsWindow::IsTopLevel() {
|
||||||
//
|
//
|
||||||
|
|
||||||
nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData) {
|
const LayoutDeviceIntRect& aRect, widget::InitData* aInitData) {
|
||||||
ALOG("nsWindow[%p]::Create %p/%p [%d %d %d %d]", (void*)this, (void*)aParent,
|
ALOG("nsWindow[%p]::Create %p/%p [%d %d %d %d]", (void*)this, (void*)aParent,
|
||||||
(void*)aNativeParent, aRect.x, aRect.y, aRect.width, aRect.height);
|
(void*)aNativeParent, aRect.x, aRect.y, aRect.width, aRect.height);
|
||||||
nsWindow* parent = (nsWindow*)aParent;
|
nsWindow* parent = (nsWindow*)aParent;
|
||||||
|
|
@ -433,8 +433,8 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
mBounds.height);
|
mBounds.height);
|
||||||
|
|
||||||
// Set defaults which can be overriden from aInitData in BaseCreate
|
// Set defaults which can be overriden from aInitData in BaseCreate
|
||||||
mWindowType = eWindowType_toplevel;
|
mWindowType = WindowType::TopLevel;
|
||||||
mBorderStyle = eBorderStyle_default;
|
mBorderStyle = BorderStyle::Default;
|
||||||
|
|
||||||
Inherited::BaseCreate(aParent, aInitData);
|
Inherited::BaseCreate(aParent, aInitData);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ bool CompositorWidgetChild::OnWindowResize(const LayoutDeviceIntSize& aSize) {
|
||||||
|
|
||||||
void CompositorWidgetChild::OnWindowModeChange(nsSizeMode aSizeMode) {}
|
void CompositorWidgetChild::OnWindowModeChange(nsSizeMode aSizeMode) {}
|
||||||
|
|
||||||
void CompositorWidgetChild::UpdateTransparency(nsTransparencyMode aMode) {
|
void CompositorWidgetChild::UpdateTransparency(TransparencyMode aMode) {
|
||||||
mTransparencyMode = aMode;
|
mTransparencyMode = aMode;
|
||||||
mRemoteBackbufferProvider->UpdateTransparencyMode(aMode);
|
mRemoteBackbufferProvider->UpdateTransparencyMode(aMode);
|
||||||
Unused << SendUpdateTransparency(aMode);
|
Unused << SendUpdateTransparency(aMode);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class CompositorWidgetChild final : public PCompositorWidgetChild,
|
||||||
void OnDestroyWindow() override;
|
void OnDestroyWindow() override;
|
||||||
bool OnWindowResize(const LayoutDeviceIntSize& aSize) override;
|
bool OnWindowResize(const LayoutDeviceIntSize& aSize) override;
|
||||||
void OnWindowModeChange(nsSizeMode aSizeMode) override;
|
void OnWindowModeChange(nsSizeMode aSizeMode) override;
|
||||||
void UpdateTransparency(nsTransparencyMode aMode) override;
|
void UpdateTransparency(TransparencyMode aMode) override;
|
||||||
void NotifyVisibilityUpdated(nsSizeMode aSizeMode,
|
void NotifyVisibilityUpdated(nsSizeMode aSizeMode,
|
||||||
bool aIsFullyOccluded) override;
|
bool aIsFullyOccluded) override;
|
||||||
void ClearTransparentWindow() override;
|
void ClearTransparentWindow() override;
|
||||||
|
|
@ -51,7 +51,7 @@ class CompositorWidgetChild final : public PCompositorWidgetChild,
|
||||||
HWND mCompositorWnd;
|
HWND mCompositorWnd;
|
||||||
|
|
||||||
HWND mWnd;
|
HWND mWnd;
|
||||||
nsTransparencyMode mTransparencyMode;
|
TransparencyMode mTransparencyMode;
|
||||||
|
|
||||||
std::unique_ptr<remote_backbuffer::Provider> mRemoteBackbufferProvider;
|
std::unique_ptr<remote_backbuffer::Provider> mRemoteBackbufferProvider;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ CompositorWidgetParent::CompositorWidgetParent(
|
||||||
aOptions),
|
aOptions),
|
||||||
mWnd(reinterpret_cast<HWND>(
|
mWnd(reinterpret_cast<HWND>(
|
||||||
aInitData.get_WinCompositorWidgetInitData().hWnd())),
|
aInitData.get_WinCompositorWidgetInitData().hWnd())),
|
||||||
mTransparencyMode(
|
mTransparencyMode(uint32_t(
|
||||||
aInitData.get_WinCompositorWidgetInitData().transparencyMode()),
|
aInitData.get_WinCompositorWidgetInitData().transparencyMode())),
|
||||||
mSizeMode(nsSizeMode_Normal),
|
mSizeMode(nsSizeMode_Normal),
|
||||||
mIsFullyOccluded(false),
|
mIsFullyOccluded(false),
|
||||||
mRemoteBackbufferClient() {
|
mRemoteBackbufferClient() {
|
||||||
|
|
@ -122,7 +122,7 @@ bool CompositorWidgetParent::HasGlass() const {
|
||||||
MOZ_ASSERT(layers::CompositorThreadHolder::IsInCompositorThread() ||
|
MOZ_ASSERT(layers::CompositorThreadHolder::IsInCompositorThread() ||
|
||||||
wr::RenderThread::IsInRenderThread());
|
wr::RenderThread::IsInRenderThread());
|
||||||
|
|
||||||
return mTransparencyMode == eTransparencyBorderlessGlass;
|
return mTransparencyMode == uint32_t(TransparencyMode::BorderlessGlass);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompositorWidgetParent::IsHidden() const { return ::IsIconic(mWnd); }
|
bool CompositorWidgetParent::IsHidden() const { return ::IsIconic(mWnd); }
|
||||||
|
|
@ -144,9 +144,8 @@ mozilla::ipc::IPCResult CompositorWidgetParent::RecvLeavePresentLock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult CompositorWidgetParent::RecvUpdateTransparency(
|
mozilla::ipc::IPCResult CompositorWidgetParent::RecvUpdateTransparency(
|
||||||
const nsTransparencyMode& aMode) {
|
const TransparencyMode& aMode) {
|
||||||
mTransparencyMode = aMode;
|
mTransparencyMode = uint32_t(aMode);
|
||||||
|
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace widget {
|
namespace widget {
|
||||||
|
|
||||||
|
enum class TransparencyMode : uint8_t;
|
||||||
|
|
||||||
namespace remote_backbuffer {
|
namespace remote_backbuffer {
|
||||||
class Client;
|
class Client;
|
||||||
}
|
}
|
||||||
|
|
@ -53,7 +55,7 @@ class CompositorWidgetParent final : public PCompositorWidgetParent,
|
||||||
mozilla::ipc::IPCResult RecvEnterPresentLock() override;
|
mozilla::ipc::IPCResult RecvEnterPresentLock() override;
|
||||||
mozilla::ipc::IPCResult RecvLeavePresentLock() override;
|
mozilla::ipc::IPCResult RecvLeavePresentLock() override;
|
||||||
mozilla::ipc::IPCResult RecvUpdateTransparency(
|
mozilla::ipc::IPCResult RecvUpdateTransparency(
|
||||||
const nsTransparencyMode& aMode) override;
|
const TransparencyMode& aMode) override;
|
||||||
mozilla::ipc::IPCResult RecvNotifyVisibilityUpdated(
|
mozilla::ipc::IPCResult RecvNotifyVisibilityUpdated(
|
||||||
const nsSizeMode& aSizeMode, const bool& aIsFullyOccluded) override;
|
const nsSizeMode& aSizeMode, const bool& aIsFullyOccluded) override;
|
||||||
mozilla::ipc::IPCResult RecvClearTransparentWindow() override;
|
mozilla::ipc::IPCResult RecvClearTransparentWindow() override;
|
||||||
|
|
@ -77,8 +79,7 @@ class CompositorWidgetParent final : public PCompositorWidgetParent,
|
||||||
gfx::CriticalSection mPresentLock;
|
gfx::CriticalSection mPresentLock;
|
||||||
|
|
||||||
// Transparency handling.
|
// Transparency handling.
|
||||||
mozilla::Atomic<nsTransparencyMode, MemoryOrdering::Relaxed>
|
mozilla::Atomic<uint32_t, MemoryOrdering::Relaxed> mTransparencyMode;
|
||||||
mTransparencyMode;
|
|
||||||
|
|
||||||
// Visibility handling.
|
// Visibility handling.
|
||||||
mozilla::Atomic<nsSizeMode, MemoryOrdering::Relaxed> mSizeMode;
|
mozilla::Atomic<nsSizeMode, MemoryOrdering::Relaxed> mSizeMode;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
#include "gfxPlatform.h"
|
#include "gfxPlatform.h"
|
||||||
#include "HeadlessCompositorWidget.h"
|
#include "HeadlessCompositorWidget.h"
|
||||||
#include "HeadlessWidget.h"
|
#include "HeadlessWidget.h"
|
||||||
|
#include "nsIWidget.h"
|
||||||
#include "nsWindow.h"
|
#include "nsWindow.h"
|
||||||
#include "VsyncDispatcher.h"
|
#include "VsyncDispatcher.h"
|
||||||
#include "WinCompositorWindowThread.h"
|
#include "WinCompositorWindowThread.h"
|
||||||
|
|
@ -22,8 +23,7 @@
|
||||||
|
|
||||||
#include <ddraw.h>
|
#include <ddraw.h>
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla::widget {
|
||||||
namespace widget {
|
|
||||||
|
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
@ -51,7 +51,7 @@ InProcessWinCompositorWidget::InProcessWinCompositorWidget(
|
||||||
mWindow(aWindow),
|
mWindow(aWindow),
|
||||||
mWnd(reinterpret_cast<HWND>(aInitData.hWnd())),
|
mWnd(reinterpret_cast<HWND>(aInitData.hWnd())),
|
||||||
mTransparentSurfaceLock("mTransparentSurfaceLock"),
|
mTransparentSurfaceLock("mTransparentSurfaceLock"),
|
||||||
mTransparencyMode(aInitData.transparencyMode()),
|
mTransparencyMode(uint32_t(aInitData.transparencyMode())),
|
||||||
mMemoryDC(nullptr),
|
mMemoryDC(nullptr),
|
||||||
mCompositeDC(nullptr),
|
mCompositeDC(nullptr),
|
||||||
mLockedBackBufferData(nullptr) {
|
mLockedBackBufferData(nullptr) {
|
||||||
|
|
@ -108,7 +108,7 @@ InProcessWinCompositorWidget::StartRemoteDrawing() {
|
||||||
MOZ_ASSERT(!mCompositeDC);
|
MOZ_ASSERT(!mCompositeDC);
|
||||||
|
|
||||||
RefPtr<gfxASurface> surf;
|
RefPtr<gfxASurface> surf;
|
||||||
if (mTransparencyMode == eTransparencyTransparent) {
|
if (TransparencyModeIs(TransparencyMode::Transparent)) {
|
||||||
surf = EnsureTransparentSurface();
|
surf = EnsureTransparentSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ InProcessWinCompositorWidget::StartRemoteDrawing() {
|
||||||
if (!dc) {
|
if (!dc) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
uint32_t flags = (mTransparencyMode == eTransparencyOpaque)
|
uint32_t flags = TransparencyModeIs(TransparencyMode::Opaque)
|
||||||
? 0
|
? 0
|
||||||
: gfxWindowsSurface::FLAG_IS_TRANSPARENT;
|
: gfxWindowsSurface::FLAG_IS_TRANSPARENT;
|
||||||
surf = new gfxWindowsSurface(dc, flags);
|
surf = new gfxWindowsSurface(dc, flags);
|
||||||
|
|
@ -148,7 +148,7 @@ InProcessWinCompositorWidget::StartRemoteDrawing() {
|
||||||
void InProcessWinCompositorWidget::EndRemoteDrawing() {
|
void InProcessWinCompositorWidget::EndRemoteDrawing() {
|
||||||
MOZ_ASSERT(!mLockedBackBufferData);
|
MOZ_ASSERT(!mLockedBackBufferData);
|
||||||
|
|
||||||
if (mTransparencyMode == eTransparencyTransparent) {
|
if (TransparencyModeIs(TransparencyMode::Transparent)) {
|
||||||
MOZ_ASSERT(mTransparentSurface);
|
MOZ_ASSERT(mTransparentSurface);
|
||||||
RedrawTransparentWindow();
|
RedrawTransparentWindow();
|
||||||
}
|
}
|
||||||
|
|
@ -237,7 +237,7 @@ void InProcessWinCompositorWidget::LeavePresentLock() { mPresentLock.Leave(); }
|
||||||
|
|
||||||
RefPtr<gfxASurface> InProcessWinCompositorWidget::EnsureTransparentSurface() {
|
RefPtr<gfxASurface> InProcessWinCompositorWidget::EnsureTransparentSurface() {
|
||||||
mTransparentSurfaceLock.AssertCurrentThreadOwns();
|
mTransparentSurfaceLock.AssertCurrentThreadOwns();
|
||||||
MOZ_ASSERT(mTransparencyMode == eTransparencyTransparent);
|
MOZ_ASSERT(TransparencyModeIs(TransparencyMode::Transparent));
|
||||||
|
|
||||||
IntSize size = GetClientSize().ToUnknownSize();
|
IntSize size = GetClientSize().ToUnknownSize();
|
||||||
if (!mTransparentSurface || mTransparentSurface->GetSize() != size) {
|
if (!mTransparentSurface || mTransparentSurface->GetSize() != size) {
|
||||||
|
|
@ -260,19 +260,18 @@ void InProcessWinCompositorWidget::CreateTransparentSurface(
|
||||||
mMemoryDC = surface->GetDC();
|
mMemoryDC = surface->GetDC();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWinCompositorWidget::UpdateTransparency(
|
void InProcessWinCompositorWidget::UpdateTransparency(TransparencyMode aMode) {
|
||||||
nsTransparencyMode aMode) {
|
|
||||||
gfx::CriticalSectionAutoEnter presentLock(&mPresentLock);
|
gfx::CriticalSectionAutoEnter presentLock(&mPresentLock);
|
||||||
MutexAutoLock lock(mTransparentSurfaceLock);
|
MutexAutoLock lock(mTransparentSurfaceLock);
|
||||||
if (mTransparencyMode == aMode) {
|
if (TransparencyModeIs(aMode)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mTransparencyMode = aMode;
|
mTransparencyMode = uint32_t(aMode);
|
||||||
mTransparentSurface = nullptr;
|
mTransparentSurface = nullptr;
|
||||||
mMemoryDC = nullptr;
|
mMemoryDC = nullptr;
|
||||||
|
|
||||||
if (mTransparencyMode == eTransparencyTransparent) {
|
if (aMode == TransparencyMode::Transparent) {
|
||||||
EnsureTransparentSurface();
|
EnsureTransparentSurface();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -296,7 +295,7 @@ bool InProcessWinCompositorWidget::GetWindowIsFullyOccluded() const {
|
||||||
bool InProcessWinCompositorWidget::HasGlass() const {
|
bool InProcessWinCompositorWidget::HasGlass() const {
|
||||||
MOZ_ASSERT(layers::CompositorThreadHolder::IsInCompositorThread() ||
|
MOZ_ASSERT(layers::CompositorThreadHolder::IsInCompositorThread() ||
|
||||||
wr::RenderThread::IsInRenderThread());
|
wr::RenderThread::IsInRenderThread());
|
||||||
return mTransparencyMode == eTransparencyBorderlessGlass;
|
return TransparencyModeIs(TransparencyMode::BorderlessGlass);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWinCompositorWidget::ClearTransparentWindow() {
|
void InProcessWinCompositorWidget::ClearTransparentWindow() {
|
||||||
|
|
@ -321,7 +320,7 @@ void InProcessWinCompositorWidget::ClearTransparentWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InProcessWinCompositorWidget::RedrawTransparentWindow() {
|
bool InProcessWinCompositorWidget::RedrawTransparentWindow() {
|
||||||
MOZ_ASSERT(mTransparencyMode == eTransparencyTransparent);
|
MOZ_ASSERT(TransparencyModeIs(TransparencyMode::Transparent));
|
||||||
|
|
||||||
LayoutDeviceIntSize size = GetClientSize();
|
LayoutDeviceIntSize size = GetClientSize();
|
||||||
|
|
||||||
|
|
@ -340,12 +339,14 @@ bool InProcessWinCompositorWidget::RedrawTransparentWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
HDC InProcessWinCompositorWidget::GetWindowSurface() {
|
HDC InProcessWinCompositorWidget::GetWindowSurface() {
|
||||||
return eTransparencyTransparent == mTransparencyMode ? mMemoryDC
|
return TransparencyModeIs(TransparencyMode::Transparent) ? mMemoryDC
|
||||||
: ::GetDC(mWnd);
|
: ::GetDC(mWnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InProcessWinCompositorWidget::FreeWindowSurface(HDC dc) {
|
void InProcessWinCompositorWidget::FreeWindowSurface(HDC dc) {
|
||||||
if (eTransparencyTransparent != mTransparencyMode) ::ReleaseDC(mWnd, dc);
|
if (!TransparencyModeIs(TransparencyMode::Transparent)) {
|
||||||
|
::ReleaseDC(mWnd, dc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InProcessWinCompositorWidget::IsHidden() const { return ::IsIconic(mWnd); }
|
bool InProcessWinCompositorWidget::IsHidden() const { return ::IsIconic(mWnd); }
|
||||||
|
|
@ -359,5 +360,4 @@ void InProcessWinCompositorWidget::ObserveVsync(VsyncObserver* aObserver) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace widget
|
} // namespace mozilla::widget
|
||||||
} // namespace mozilla
|
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,7 @@
|
||||||
class nsWindow;
|
class nsWindow;
|
||||||
class gfxASurface;
|
class gfxASurface;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla::widget {
|
||||||
namespace widget {
|
|
||||||
|
|
||||||
// This is the Windows-specific implementation of CompositorWidget. For
|
// This is the Windows-specific implementation of CompositorWidget. For
|
||||||
// the most part it only requires an HWND, however it maintains extra state
|
// the most part it only requires an HWND, however it maintains extra state
|
||||||
|
|
@ -47,7 +46,7 @@ class InProcessWinCompositorWidget final
|
||||||
void OnDestroyWindow() override;
|
void OnDestroyWindow() override;
|
||||||
bool OnWindowResize(const LayoutDeviceIntSize& aSize) override;
|
bool OnWindowResize(const LayoutDeviceIntSize& aSize) override;
|
||||||
void OnWindowModeChange(nsSizeMode aSizeMode) override;
|
void OnWindowModeChange(nsSizeMode aSizeMode) override;
|
||||||
void UpdateTransparency(nsTransparencyMode aMode) override;
|
void UpdateTransparency(TransparencyMode aMode) override;
|
||||||
void NotifyVisibilityUpdated(nsSizeMode aSizeMode,
|
void NotifyVisibilityUpdated(nsSizeMode aSizeMode,
|
||||||
bool aIsFullyOccluded) override;
|
bool aIsFullyOccluded) override;
|
||||||
void ClearTransparentWindow() override;
|
void ClearTransparentWindow() override;
|
||||||
|
|
@ -89,8 +88,11 @@ class InProcessWinCompositorWidget final
|
||||||
|
|
||||||
// Transparency handling.
|
// Transparency handling.
|
||||||
mozilla::Mutex mTransparentSurfaceLock MOZ_UNANNOTATED;
|
mozilla::Mutex mTransparentSurfaceLock MOZ_UNANNOTATED;
|
||||||
mozilla::Atomic<nsTransparencyMode, MemoryOrdering::Relaxed>
|
mozilla::Atomic<uint32_t, MemoryOrdering::Relaxed> mTransparencyMode;
|
||||||
mTransparencyMode;
|
|
||||||
|
bool TransparencyModeIs(TransparencyMode aMode) const {
|
||||||
|
return TransparencyMode(uint32_t(mTransparencyMode)) == aMode;
|
||||||
|
}
|
||||||
|
|
||||||
// Visibility handling.
|
// Visibility handling.
|
||||||
mozilla::Atomic<nsSizeMode, MemoryOrdering::Relaxed> mSizeMode;
|
mozilla::Atomic<nsSizeMode, MemoryOrdering::Relaxed> mSizeMode;
|
||||||
|
|
@ -106,7 +108,6 @@ class InProcessWinCompositorWidget final
|
||||||
bool mNotDeferEndRemoteDrawing;
|
bool mNotDeferEndRemoteDrawing;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace widget
|
} // namespace mozilla::widget
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif // widget_windows_InProcessWinCompositorWidget_h
|
#endif // widget_windows_InProcessWinCompositorWidget_h
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ include "mozilla/widget/WidgetMessageUtils.h";
|
||||||
|
|
||||||
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
|
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
|
||||||
using mozilla::WindowsHandle from "mozilla/ipc/IPCTypes.h";
|
using mozilla::WindowsHandle from "mozilla/ipc/IPCTypes.h";
|
||||||
using nsTransparencyMode from "nsIWidget.h";
|
using TransparencyMode from "nsIWidget.h";
|
||||||
using nsSizeMode from "nsIWidget.h";
|
using nsSizeMode from "nsIWidget.h";
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
@ -33,7 +33,7 @@ parent:
|
||||||
|
|
||||||
sync EnterPresentLock();
|
sync EnterPresentLock();
|
||||||
sync LeavePresentLock();
|
sync LeavePresentLock();
|
||||||
async UpdateTransparency(nsTransparencyMode aMode);
|
async UpdateTransparency(TransparencyMode aMode);
|
||||||
async NotifyVisibilityUpdated(nsSizeMode aSizeMode, bool aIsFullyOccluded);
|
async NotifyVisibilityUpdated(nsSizeMode aSizeMode, bool aIsFullyOccluded);
|
||||||
sync ClearTransparentWindow();
|
sync ClearTransparentWindow();
|
||||||
async __delete__();
|
async __delete__();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ include HeadlessWidgetTypes;
|
||||||
|
|
||||||
using mozilla::WindowsHandle from "mozilla/ipc/IPCTypes.h";
|
using mozilla::WindowsHandle from "mozilla/ipc/IPCTypes.h";
|
||||||
using nsSizeMode from "nsIWidgetListener.h";
|
using nsSizeMode from "nsIWidgetListener.h";
|
||||||
using nsTransparencyMode from "nsIWidget.h";
|
using TransparencyMode from "nsIWidget.h";
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace widget {
|
namespace widget {
|
||||||
|
|
@ -20,7 +20,7 @@ struct WinCompositorWidgetInitData
|
||||||
{
|
{
|
||||||
WindowsHandle hWnd;
|
WindowsHandle hWnd;
|
||||||
uintptr_t widgetKey;
|
uintptr_t widgetKey;
|
||||||
nsTransparencyMode transparencyMode;
|
TransparencyMode transparencyMode;
|
||||||
nsSizeMode sizeMode;
|
nsSizeMode sizeMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -249,9 +249,9 @@ class PresentableSharedImage {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PresentToWindow(HWND aWindowHandle, nsTransparencyMode aTransparencyMode,
|
bool PresentToWindow(HWND aWindowHandle, TransparencyMode aTransparencyMode,
|
||||||
Span<const IpcSafeRect> aDirtyRects) {
|
Span<const IpcSafeRect> aDirtyRects) {
|
||||||
if (aTransparencyMode == eTransparencyTransparent) {
|
if (aTransparencyMode == TransparencyMode::Transparent) {
|
||||||
// If our window is a child window or a child-of-a-child, the window
|
// If our window is a child window or a child-of-a-child, the window
|
||||||
// that needs to be updated is the top level ancestor of the tree
|
// that needs to be updated is the top level ancestor of the tree
|
||||||
HWND topLevelWindow = WinUtils::GetTopLevelHWND(aWindowHandle, true);
|
HWND topLevelWindow = WinUtils::GetTopLevelHWND(aWindowHandle, true);
|
||||||
|
|
@ -385,7 +385,7 @@ Provider::~Provider() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Provider::Initialize(HWND aWindowHandle, DWORD aTargetProcessId,
|
bool Provider::Initialize(HWND aWindowHandle, DWORD aTargetProcessId,
|
||||||
nsTransparencyMode aTransparencyMode) {
|
TransparencyMode aTransparencyMode) {
|
||||||
MOZ_ASSERT(aWindowHandle);
|
MOZ_ASSERT(aWindowHandle);
|
||||||
MOZ_ASSERT(aTargetProcessId);
|
MOZ_ASSERT(aTargetProcessId);
|
||||||
|
|
||||||
|
|
@ -441,7 +441,7 @@ bool Provider::Initialize(HWND aWindowHandle, DWORD aTargetProcessId,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mTransparencyMode = aTransparencyMode;
|
mTransparencyMode = uint32_t(aTransparencyMode);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -453,8 +453,8 @@ Maybe<RemoteBackbufferHandles> Provider::CreateRemoteHandles() {
|
||||||
ipc::FileDescriptor(mResponseReadyEvent)));
|
ipc::FileDescriptor(mResponseReadyEvent)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Provider::UpdateTransparencyMode(nsTransparencyMode aTransparencyMode) {
|
void Provider::UpdateTransparencyMode(TransparencyMode aTransparencyMode) {
|
||||||
mTransparencyMode = aTransparencyMode;
|
mTransparencyMode = uint32_t(aTransparencyMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Provider::ThreadMain() {
|
void Provider::ThreadMain() {
|
||||||
|
|
@ -571,7 +571,7 @@ void Provider::HandlePresentRequest(const PresentRequestData& aRequestData,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mBackbuffer->PresentToWindow(
|
if (!mBackbuffer->PresentToWindow(
|
||||||
mWindowHandle, mTransparencyMode,
|
mWindowHandle, GetTransparencyMode(),
|
||||||
rectSpan.First(aRequestData.lenDirtyRects))) {
|
rectSpan.First(aRequestData.lenDirtyRects))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ class Provider {
|
||||||
~Provider();
|
~Provider();
|
||||||
|
|
||||||
bool Initialize(HWND aWindowHandle, DWORD aTargetProcessId,
|
bool Initialize(HWND aWindowHandle, DWORD aTargetProcessId,
|
||||||
nsTransparencyMode aTransparencyMode);
|
TransparencyMode aTransparencyMode);
|
||||||
|
|
||||||
Maybe<RemoteBackbufferHandles> CreateRemoteHandles();
|
Maybe<RemoteBackbufferHandles> CreateRemoteHandles();
|
||||||
|
|
||||||
void UpdateTransparencyMode(nsTransparencyMode aTransparencyMode);
|
void UpdateTransparencyMode(TransparencyMode aTransparencyMode);
|
||||||
|
|
||||||
Provider(const Provider&) = delete;
|
Provider(const Provider&) = delete;
|
||||||
Provider(Provider&&) = delete;
|
Provider(Provider&&) = delete;
|
||||||
|
|
@ -58,8 +58,10 @@ class Provider {
|
||||||
bool mStopServiceThread;
|
bool mStopServiceThread;
|
||||||
PRThread* mServiceThread;
|
PRThread* mServiceThread;
|
||||||
std::unique_ptr<PresentableSharedImage> mBackbuffer;
|
std::unique_ptr<PresentableSharedImage> mBackbuffer;
|
||||||
mozilla::Atomic<nsTransparencyMode, MemoryOrdering::Relaxed>
|
mozilla::Atomic<uint32_t, MemoryOrdering::Relaxed> mTransparencyMode;
|
||||||
mTransparencyMode;
|
TransparencyMode GetTransparencyMode() const {
|
||||||
|
return TransparencyMode(uint32_t(mTransparencyMode));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Client {
|
class Client {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class PlatformCompositorWidgetDelegate : public CompositorWidgetDelegate {
|
||||||
virtual void OnWindowModeChange(nsSizeMode aSizeMode) = 0;
|
virtual void OnWindowModeChange(nsSizeMode aSizeMode) = 0;
|
||||||
|
|
||||||
// Transparency handling.
|
// Transparency handling.
|
||||||
virtual void UpdateTransparency(nsTransparencyMode aMode) = 0;
|
virtual void UpdateTransparency(TransparencyMode aMode) = 0;
|
||||||
virtual void ClearTransparentWindow() = 0;
|
virtual void ClearTransparentWindow() = 0;
|
||||||
|
|
||||||
// Deliver visibility info
|
// Deliver visibility info
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,7 @@ static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||||
// General purpose user32.dll hook object
|
// General purpose user32.dll hook object
|
||||||
static WindowsDllInterceptor sUser32Intercept;
|
static WindowsDllInterceptor sUser32Intercept;
|
||||||
|
|
||||||
// 2 pixel offset for eTransparencyBorderlessGlass which equals the size of
|
// 2 pixel offset for TransparencyMode::BorderlessGlass which equals the size of
|
||||||
// the default window border Windows paints. Glass will be extended inward
|
// the default window border Windows paints. Glass will be extended inward
|
||||||
// this distance to remove the border.
|
// this distance to remove the border.
|
||||||
static const int32_t kGlassMarginAdjustment = 2;
|
static const int32_t kGlassMarginAdjustment = 2;
|
||||||
|
|
@ -733,7 +733,7 @@ static bool IsCloaked(HWND hwnd) {
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
nsWindow::nsWindow(bool aIsChildWindow)
|
nsWindow::nsWindow(bool aIsChildWindow)
|
||||||
: nsBaseWidget(eBorderStyle_default),
|
: nsBaseWidget(BorderStyle::Default),
|
||||||
mBrush(::CreateSolidBrush(NSRGB_2_COLOREF(::GetSysColor(COLOR_BTNFACE)))),
|
mBrush(::CreateSolidBrush(NSRGB_2_COLOREF(::GetSysColor(COLOR_BTNFACE)))),
|
||||||
mFrameState(std::in_place, this),
|
mFrameState(std::in_place, this),
|
||||||
mIsChildWindow(aIsChildWindow),
|
mIsChildWindow(aIsChildWindow),
|
||||||
|
|
@ -741,7 +741,7 @@ nsWindow::nsWindow(bool aIsChildWindow)
|
||||||
mCachedHitTestTime(TimeStamp::Now()),
|
mCachedHitTestTime(TimeStamp::Now()),
|
||||||
mSizeConstraintsScale(GetDefaultScale().scale),
|
mSizeConstraintsScale(GetDefaultScale().scale),
|
||||||
mDesktopId("DesktopIdMutex") {
|
mDesktopId("DesktopIdMutex") {
|
||||||
MOZ_ASSERT(mWindowType == eWindowType_child);
|
MOZ_ASSERT(mWindowType == WindowType::Child);
|
||||||
|
|
||||||
if (!gInitializedVirtualDesktopManager) {
|
if (!gInitializedVirtualDesktopManager) {
|
||||||
TaskController::Get()->AddTask(
|
TaskController::Get()->AddTask(
|
||||||
|
|
@ -825,11 +825,11 @@ nsWindow::~nsWindow() {
|
||||||
// when the window is created or resized.
|
// when the window is created or resized.
|
||||||
int32_t nsWindow::GetHeight(int32_t aProposedHeight) { return aProposedHeight; }
|
int32_t nsWindow::GetHeight(int32_t aProposedHeight) { return aProposedHeight; }
|
||||||
|
|
||||||
static bool ShouldCacheTitleBarInfo(nsWindowType aWindowType,
|
static bool ShouldCacheTitleBarInfo(WindowType aWindowType,
|
||||||
nsBorderStyle aBorderStyle) {
|
BorderStyle aBorderStyle) {
|
||||||
return (aWindowType == eWindowType_toplevel) &&
|
return (aWindowType == WindowType::TopLevel) &&
|
||||||
(aBorderStyle == eBorderStyle_default ||
|
(aBorderStyle == BorderStyle::Default ||
|
||||||
aBorderStyle == eBorderStyle_all) &&
|
aBorderStyle == BorderStyle::All) &&
|
||||||
(!nsUXThemeData::sTitlebarInfoPopulatedThemed ||
|
(!nsUXThemeData::sTitlebarInfoPopulatedThemed ||
|
||||||
!nsUXThemeData::sTitlebarInfoPopulatedAero);
|
!nsUXThemeData::sTitlebarInfoPopulatedAero);
|
||||||
}
|
}
|
||||||
|
|
@ -887,7 +887,7 @@ void nsWindow::SendAnAPZEvent(InputData& aEvent) {
|
||||||
void nsWindow::RecreateDirectManipulationIfNeeded() {
|
void nsWindow::RecreateDirectManipulationIfNeeded() {
|
||||||
DestroyDirectManipulation();
|
DestroyDirectManipulation();
|
||||||
|
|
||||||
if (mWindowType != eWindowType_toplevel && mWindowType != eWindowType_popup) {
|
if (mWindowType != WindowType::TopLevel && mWindowType != WindowType::Popup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -929,19 +929,19 @@ void nsWindow::DestroyDirectManipulation() {
|
||||||
// Create the proper widget
|
// Create the proper widget
|
||||||
nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData) {
|
widget::InitData* aInitData) {
|
||||||
// Historical note: there was once some belief and/or intent that nsWindows
|
// Historical note: there was once some belief and/or intent that nsWindows
|
||||||
// could be created on arbitrary threads, and this may still be reflected in
|
// could be created on arbitrary threads, and this may still be reflected in
|
||||||
// some comments.
|
// some comments.
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
nsWidgetInitData defaultInitData;
|
widget::InitData defaultInitData;
|
||||||
if (!aInitData) aInitData = &defaultInitData;
|
if (!aInitData) aInitData = &defaultInitData;
|
||||||
|
|
||||||
nsIWidget* baseParent =
|
nsIWidget* baseParent =
|
||||||
aInitData->mWindowType == eWindowType_dialog ||
|
aInitData->mWindowType == WindowType::Dialog ||
|
||||||
aInitData->mWindowType == eWindowType_toplevel ||
|
aInitData->mWindowType == WindowType::TopLevel ||
|
||||||
aInitData->mWindowType == eWindowType_invisible
|
aInitData->mWindowType == WindowType::Invisible
|
||||||
? nullptr
|
? nullptr
|
||||||
: aParent;
|
: aParent;
|
||||||
|
|
||||||
|
|
@ -981,7 +981,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
extendedStyle |= WS_EX_COMPOSITED;
|
extendedStyle |= WS_EX_COMPOSITED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
if (!aParent) {
|
if (!aParent) {
|
||||||
parent = nullptr;
|
parent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -990,7 +990,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
ShouldUseOffMainThreadCompositing()) {
|
ShouldUseOffMainThreadCompositing()) {
|
||||||
extendedStyle |= WS_EX_COMPOSITED;
|
extendedStyle |= WS_EX_COMPOSITED;
|
||||||
}
|
}
|
||||||
} else if (mWindowType == eWindowType_invisible) {
|
} else if (mWindowType == WindowType::Invisible) {
|
||||||
// Make sure CreateWindowEx succeeds at creating a toplevel window
|
// Make sure CreateWindowEx succeeds at creating a toplevel window
|
||||||
style &= ~0x40000000; // WS_CHILDWINDOW
|
style &= ~0x40000000; // WS_CHILDWINDOW
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1009,7 +1009,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
|
|
||||||
// Take specific actions when creating the first top-level window
|
// Take specific actions when creating the first top-level window
|
||||||
static bool sFirstTopLevelWindowCreated = false;
|
static bool sFirstTopLevelWindowCreated = false;
|
||||||
if (aInitData->mWindowType == eWindowType_toplevel && !aParent &&
|
if (aInitData->mWindowType == WindowType::TopLevel && !aParent &&
|
||||||
!sFirstTopLevelWindowCreated) {
|
!sFirstTopLevelWindowCreated) {
|
||||||
sFirstTopLevelWindowCreated = true;
|
sFirstTopLevelWindowCreated = true;
|
||||||
mWnd = ConsumePreXULSkeletonUIHandle();
|
mWnd = ConsumePreXULSkeletonUIHandle();
|
||||||
|
|
@ -1159,7 +1159,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWindowType != eWindowType_invisible &&
|
if (mWindowType != WindowType::Invisible &&
|
||||||
MouseScrollHandler::Device::IsFakeScrollableWindowNeeded()) {
|
MouseScrollHandler::Device::IsFakeScrollableWindowNeeded()) {
|
||||||
// Ugly Thinkpad Driver Hack (Bugs 507222 and 594977)
|
// Ugly Thinkpad Driver Hack (Bugs 507222 and 594977)
|
||||||
//
|
//
|
||||||
|
|
@ -1226,7 +1226,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool a11yPrimed = false;
|
static bool a11yPrimed = false;
|
||||||
if (!a11yPrimed && mWindowType == eWindowType_toplevel) {
|
if (!a11yPrimed && mWindowType == WindowType::TopLevel) {
|
||||||
a11yPrimed = true;
|
a11yPrimed = true;
|
||||||
if (Preferences::GetInt("accessibility.force_disabled", 0) == -1) {
|
if (Preferences::GetInt("accessibility.force_disabled", 0) == -1) {
|
||||||
::PostMessage(mWnd, MOZ_WM_STARTA11Y, 0, 0);
|
::PostMessage(mWnd, MOZ_WM_STARTA11Y, 0, 0);
|
||||||
|
|
@ -1337,15 +1337,15 @@ const wchar_t* nsWindow::RegisterWindowClass(const wchar_t* aClassName,
|
||||||
static LPWSTR const gStockApplicationIcon = MAKEINTRESOURCEW(32512);
|
static LPWSTR const gStockApplicationIcon = MAKEINTRESOURCEW(32512);
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
const wchar_t* nsWindow::ChooseWindowClass(nsWindowType aWindowType,
|
const wchar_t* nsWindow::ChooseWindowClass(WindowType aWindowType,
|
||||||
bool aForMenupopupFrame) {
|
bool aForMenupopupFrame) {
|
||||||
MOZ_ASSERT_IF(aForMenupopupFrame, aWindowType == eWindowType_popup);
|
MOZ_ASSERT_IF(aForMenupopupFrame, aWindowType == WindowType::Popup);
|
||||||
switch (aWindowType) {
|
switch (aWindowType) {
|
||||||
case eWindowType_invisible:
|
case WindowType::Invisible:
|
||||||
return RegisterWindowClass(kClassNameHidden, 0, gStockApplicationIcon);
|
return RegisterWindowClass(kClassNameHidden, 0, gStockApplicationIcon);
|
||||||
case eWindowType_dialog:
|
case WindowType::Dialog:
|
||||||
return RegisterWindowClass(kClassNameDialog, 0, 0);
|
return RegisterWindowClass(kClassNameDialog, 0, 0);
|
||||||
case eWindowType_popup:
|
case WindowType::Popup:
|
||||||
if (aForMenupopupFrame) {
|
if (aForMenupopupFrame) {
|
||||||
return RegisterWindowClass(kClassNameDropShadow, CS_DROPSHADOW,
|
return RegisterWindowClass(kClassNameDropShadow, CS_DROPSHADOW,
|
||||||
gStockApplicationIcon);
|
gStockApplicationIcon);
|
||||||
|
|
@ -1370,18 +1370,18 @@ DWORD nsWindow::WindowStyle() {
|
||||||
DWORD style;
|
DWORD style;
|
||||||
|
|
||||||
switch (mWindowType) {
|
switch (mWindowType) {
|
||||||
case eWindowType_child:
|
case WindowType::Child:
|
||||||
style = WS_OVERLAPPED;
|
style = WS_OVERLAPPED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eWindowType_dialog:
|
case WindowType::Dialog:
|
||||||
style = WS_OVERLAPPED | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_3DLOOK |
|
style = WS_OVERLAPPED | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_3DLOOK |
|
||||||
DS_MODALFRAME | WS_CLIPCHILDREN;
|
DS_MODALFRAME | WS_CLIPCHILDREN;
|
||||||
if (mBorderStyle != eBorderStyle_default)
|
if (mBorderStyle != BorderStyle::Default)
|
||||||
style |= WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
|
style |= WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eWindowType_popup:
|
case WindowType::Popup:
|
||||||
style = WS_POPUP;
|
style = WS_POPUP;
|
||||||
if (!HasGlass()) {
|
if (!HasGlass()) {
|
||||||
style |= WS_OVERLAPPED;
|
style |= WS_OVERLAPPED;
|
||||||
|
|
@ -1392,55 +1392,55 @@ DWORD nsWindow::WindowStyle() {
|
||||||
NS_ERROR("unknown border style");
|
NS_ERROR("unknown border style");
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
|
||||||
case eWindowType_toplevel:
|
case WindowType::TopLevel:
|
||||||
case eWindowType_invisible:
|
case WindowType::Invisible:
|
||||||
style = WS_OVERLAPPED | WS_BORDER | WS_DLGFRAME | WS_SYSMENU |
|
style = WS_OVERLAPPED | WS_BORDER | WS_DLGFRAME | WS_SYSMENU |
|
||||||
WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN;
|
WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBorderStyle != eBorderStyle_default &&
|
if (mBorderStyle != BorderStyle::Default &&
|
||||||
mBorderStyle != eBorderStyle_all) {
|
mBorderStyle != BorderStyle::All) {
|
||||||
if (mBorderStyle == eBorderStyle_none ||
|
if (mBorderStyle == BorderStyle::None ||
|
||||||
!(mBorderStyle & eBorderStyle_border))
|
!(mBorderStyle & BorderStyle::Border))
|
||||||
style &= ~WS_BORDER;
|
style &= ~WS_BORDER;
|
||||||
|
|
||||||
if (mBorderStyle == eBorderStyle_none ||
|
if (mBorderStyle == BorderStyle::None ||
|
||||||
!(mBorderStyle & eBorderStyle_title)) {
|
!(mBorderStyle & BorderStyle::Title)) {
|
||||||
style &= ~WS_DLGFRAME;
|
style &= ~WS_DLGFRAME;
|
||||||
style |= WS_POPUP;
|
style |= WS_POPUP;
|
||||||
style &= ~WS_CHILD;
|
style &= ~WS_CHILD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBorderStyle == eBorderStyle_none ||
|
if (mBorderStyle == BorderStyle::None ||
|
||||||
!(mBorderStyle & eBorderStyle_close))
|
!(mBorderStyle & BorderStyle::Close))
|
||||||
style &= ~0;
|
style &= ~0;
|
||||||
// XXX The close box can only be removed by changing the window class,
|
// XXX The close box can only be removed by changing the window class,
|
||||||
// as far as I know --- roc+moz@cs.cmu.edu
|
// as far as I know --- roc+moz@cs.cmu.edu
|
||||||
|
|
||||||
if (mBorderStyle == eBorderStyle_none ||
|
if (mBorderStyle == BorderStyle::None ||
|
||||||
!(mBorderStyle & (eBorderStyle_menu | eBorderStyle_close)))
|
!(mBorderStyle & (BorderStyle::Menu | BorderStyle::Close)))
|
||||||
style &= ~WS_SYSMENU;
|
style &= ~WS_SYSMENU;
|
||||||
// Looks like getting rid of the system menu also does away with the
|
// Looks like getting rid of the system menu also does away with the
|
||||||
// close box. So, we only get rid of the system menu if you want neither it
|
// close box. So, we only get rid of the system menu if you want neither it
|
||||||
// nor the close box. How does the Windows "Dialog" window class get just
|
// nor the close box. How does the Windows "Dialog" window class get just
|
||||||
// closebox and no sysmenu? Who knows.
|
// closebox and no sysmenu? Who knows.
|
||||||
|
|
||||||
if (mBorderStyle == eBorderStyle_none ||
|
if (mBorderStyle == BorderStyle::None ||
|
||||||
!(mBorderStyle & eBorderStyle_resizeh))
|
!(mBorderStyle & BorderStyle::ResizeH))
|
||||||
style &= ~WS_THICKFRAME;
|
style &= ~WS_THICKFRAME;
|
||||||
|
|
||||||
if (mBorderStyle == eBorderStyle_none ||
|
if (mBorderStyle == BorderStyle::None ||
|
||||||
!(mBorderStyle & eBorderStyle_minimize))
|
!(mBorderStyle & BorderStyle::Minimize))
|
||||||
style &= ~WS_MINIMIZEBOX;
|
style &= ~WS_MINIMIZEBOX;
|
||||||
|
|
||||||
if (mBorderStyle == eBorderStyle_none ||
|
if (mBorderStyle == BorderStyle::None ||
|
||||||
!(mBorderStyle & eBorderStyle_maximize))
|
!(mBorderStyle & BorderStyle::Maximize))
|
||||||
style &= ~WS_MAXIMIZEBOX;
|
style &= ~WS_MAXIMIZEBOX;
|
||||||
|
|
||||||
if (IsPopupWithTitleBar()) {
|
if (IsPopupWithTitleBar()) {
|
||||||
style |= WS_CAPTION;
|
style |= WS_CAPTION;
|
||||||
if (mBorderStyle & eBorderStyle_close) {
|
if (mBorderStyle & BorderStyle::Close) {
|
||||||
style |= WS_SYSMENU;
|
style |= WS_SYSMENU;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1460,23 +1460,23 @@ DWORD nsWindow::WindowStyle() {
|
||||||
// Return nsWindow extended styles
|
// Return nsWindow extended styles
|
||||||
DWORD nsWindow::WindowExStyle() {
|
DWORD nsWindow::WindowExStyle() {
|
||||||
switch (mWindowType) {
|
switch (mWindowType) {
|
||||||
case eWindowType_child:
|
case WindowType::Child:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case eWindowType_dialog:
|
case WindowType::Dialog:
|
||||||
return WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME;
|
return WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME;
|
||||||
|
|
||||||
case eWindowType_popup: {
|
case WindowType::Popup: {
|
||||||
DWORD extendedStyle = WS_EX_TOOLWINDOW;
|
DWORD extendedStyle = WS_EX_TOOLWINDOW;
|
||||||
if (mPopupLevel == ePopupLevelTop) extendedStyle |= WS_EX_TOPMOST;
|
if (mPopupLevel == PopupLevel::Top) extendedStyle |= WS_EX_TOPMOST;
|
||||||
return extendedStyle;
|
return extendedStyle;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
NS_ERROR("unknown border style");
|
NS_ERROR("unknown border style");
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
|
||||||
case eWindowType_toplevel:
|
case WindowType::TopLevel:
|
||||||
case eWindowType_invisible:
|
case WindowType::Invisible:
|
||||||
return WS_EX_WINDOWEDGE;
|
return WS_EX_WINDOWEDGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1579,7 +1579,7 @@ void nsWindow::ReparentNativeWidget(nsIWidget* aNewParent) {
|
||||||
MOZ_ASSERT(aNewParent, "null widget");
|
MOZ_ASSERT(aNewParent, "null widget");
|
||||||
|
|
||||||
mParent = aNewParent;
|
mParent = aNewParent;
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HWND newParent = (HWND)aNewParent->GetNativeData(NS_NATIVE_WINDOW);
|
HWND newParent = (HWND)aNewParent->GetNativeData(NS_NATIVE_WINDOW);
|
||||||
|
|
@ -1701,7 +1701,7 @@ void nsWindow::Show(bool bState) {
|
||||||
MOZ_ASSERT(ChooseWindowClass(mWindowType, mForMenupopupFrame) ==
|
MOZ_ASSERT(ChooseWindowClass(mWindowType, mForMenupopupFrame) ==
|
||||||
kClassNameDropShadow);
|
kClassNameDropShadow);
|
||||||
const bool shouldUseDropShadow = [&] {
|
const bool shouldUseDropShadow = [&] {
|
||||||
if (mTransparencyMode == eTransparencyTransparent) {
|
if (mTransparencyMode == TransparencyMode::Transparent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (HasBogusPopupsDropShadowOnMultiMonitor() &&
|
if (HasBogusPopupsDropShadowOnMultiMonitor() &&
|
||||||
|
|
@ -1747,7 +1747,7 @@ void nsWindow::Show(bool bState) {
|
||||||
|
|
||||||
if (mWnd) {
|
if (mWnd) {
|
||||||
if (bState) {
|
if (bState) {
|
||||||
if (!wasVisible && mWindowType == eWindowType_toplevel) {
|
if (!wasVisible && mWindowType == WindowType::TopLevel) {
|
||||||
// speed up the initial paint after show for
|
// speed up the initial paint after show for
|
||||||
// top level windows:
|
// top level windows:
|
||||||
syncInvalidate = true;
|
syncInvalidate = true;
|
||||||
|
|
@ -1783,7 +1783,7 @@ void nsWindow::Show(bool bState) {
|
||||||
if (wasVisible) flags |= SWP_NOZORDER;
|
if (wasVisible) flags |= SWP_NOZORDER;
|
||||||
if (mAlwaysOnTop) flags |= SWP_NOACTIVATE;
|
if (mAlwaysOnTop) flags |= SWP_NOACTIVATE;
|
||||||
|
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
// ensure popups are the topmost of the TOPMOST
|
// ensure popups are the topmost of the TOPMOST
|
||||||
// layer. Remember not to set the SWP_NOZORDER
|
// layer. Remember not to set the SWP_NOZORDER
|
||||||
// flag as that might allow the taskbar to overlap
|
// flag as that might allow the taskbar to overlap
|
||||||
|
|
@ -1791,10 +1791,10 @@ void nsWindow::Show(bool bState) {
|
||||||
flags |= SWP_NOACTIVATE;
|
flags |= SWP_NOACTIVATE;
|
||||||
HWND owner = ::GetWindow(mWnd, GW_OWNER);
|
HWND owner = ::GetWindow(mWnd, GW_OWNER);
|
||||||
if (owner) {
|
if (owner) {
|
||||||
// ePopupLevelTop popups should be above all else. All other
|
// PopupLevel::Top popups should be above all else. All other
|
||||||
// types should be placed in front of their owner, without
|
// types should be placed in front of their owner, without
|
||||||
// changing the owner's z-level relative to other windows.
|
// changing the owner's z-level relative to other windows.
|
||||||
if (PopupLevel() != ePopupLevelTop) {
|
if (mPopupLevel != PopupLevel::Top) {
|
||||||
::SetWindowPos(mWnd, owner, 0, 0, 0, 0, flags);
|
::SetWindowPos(mWnd, owner, 0, 0, 0, 0, flags);
|
||||||
::SetWindowPos(owner, mWnd, 0, 0, 0, 0,
|
::SetWindowPos(owner, mWnd, 0, 0, 0, 0,
|
||||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||||
|
|
@ -1805,7 +1805,7 @@ void nsWindow::Show(bool bState) {
|
||||||
::SetWindowPos(mWnd, HWND_TOPMOST, 0, 0, 0, 0, flags);
|
::SetWindowPos(mWnd, HWND_TOPMOST, 0, 0, 0, 0, flags);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mWindowType == eWindowType_dialog && !CanTakeFocus())
|
if (mWindowType == WindowType::Dialog && !CanTakeFocus())
|
||||||
flags |= SWP_NOACTIVATE;
|
flags |= SWP_NOACTIVATE;
|
||||||
|
|
||||||
::SetWindowPos(mWnd, HWND_TOP, 0, 0, 0, 0, flags);
|
::SetWindowPos(mWnd, HWND_TOP, 0, 0, 0, 0, flags);
|
||||||
|
|
@ -1814,12 +1814,12 @@ void nsWindow::Show(bool bState) {
|
||||||
} else {
|
} else {
|
||||||
// Clear contents to avoid ghosting of old content if we display
|
// Clear contents to avoid ghosting of old content if we display
|
||||||
// this window again.
|
// this window again.
|
||||||
if (wasVisible && mTransparencyMode == eTransparencyTransparent) {
|
if (wasVisible && mTransparencyMode == TransparencyMode::Transparent) {
|
||||||
if (mCompositorWidgetDelegate) {
|
if (mCompositorWidgetDelegate) {
|
||||||
mCompositorWidgetDelegate->ClearTransparentWindow();
|
mCompositorWidgetDelegate->ClearTransparentWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mWindowType != eWindowType_dialog) {
|
if (mWindowType != WindowType::Dialog) {
|
||||||
::ShowWindow(mWnd, SW_HIDE);
|
::ShowWindow(mWnd, SW_HIDE);
|
||||||
} else {
|
} else {
|
||||||
::SetWindowPos(mWnd, 0, 0, 0, 0, 0,
|
::SetWindowPos(mWnd, 0, 0, 0, 0, 0,
|
||||||
|
|
@ -1869,8 +1869,8 @@ bool nsWindow::IsVisible() const { return mIsVisible; }
|
||||||
// XXX this is apparently still needed in Windows 7 and later
|
// XXX this is apparently still needed in Windows 7 and later
|
||||||
void nsWindow::ClearThemeRegion() {
|
void nsWindow::ClearThemeRegion() {
|
||||||
if (!HasGlass() &&
|
if (!HasGlass() &&
|
||||||
(mWindowType == eWindowType_popup && !IsPopupWithTitleBar() &&
|
(mWindowType == WindowType::Popup && !IsPopupWithTitleBar() &&
|
||||||
(mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) {
|
(mPopupType == PopupType::Tooltip || mPopupType == PopupType::Panel))) {
|
||||||
SetWindowRgn(mWnd, nullptr, false);
|
SetWindowRgn(mWnd, nullptr, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1935,7 +1935,7 @@ void nsWindow::SetInputRegion(const InputRegion& aInputRegion) {
|
||||||
void nsWindow::SetSizeConstraints(const SizeConstraints& aConstraints) {
|
void nsWindow::SetSizeConstraints(const SizeConstraints& aConstraints) {
|
||||||
SizeConstraints c = aConstraints;
|
SizeConstraints c = aConstraints;
|
||||||
|
|
||||||
if (mWindowType != eWindowType_popup && mResizable) {
|
if (mWindowType != WindowType::Popup && mResizable) {
|
||||||
c.mMinSize.width =
|
c.mMinSize.width =
|
||||||
std::max(int32_t(::GetSystemMetrics(SM_CXMINTRACK)), c.mMinSize.width);
|
std::max(int32_t(::GetSystemMetrics(SM_CXMINTRACK)), c.mMinSize.width);
|
||||||
c.mMinSize.height =
|
c.mMinSize.height =
|
||||||
|
|
@ -1979,8 +1979,8 @@ const SizeConstraints nsWindow::GetSizeConstraints() {
|
||||||
|
|
||||||
// Move this component
|
// Move this component
|
||||||
void nsWindow::Move(double aX, double aY) {
|
void nsWindow::Move(double aX, double aY) {
|
||||||
if (mWindowType == eWindowType_toplevel ||
|
if (mWindowType == WindowType::TopLevel ||
|
||||||
mWindowType == eWindowType_dialog) {
|
mWindowType == WindowType::Dialog) {
|
||||||
SetSizeMode(nsSizeMode_Normal);
|
SetSizeMode(nsSizeMode_Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1999,7 +1999,7 @@ void nsWindow::Move(double aX, double aY) {
|
||||||
// Only perform this check for non-popup windows, since the positioning can
|
// Only perform this check for non-popup windows, since the positioning can
|
||||||
// in fact change even when the x/y do not. We always need to perform the
|
// in fact change even when the x/y do not. We always need to perform the
|
||||||
// check. See bug #97805 for details.
|
// check. See bug #97805 for details.
|
||||||
if (mWindowType != eWindowType_popup && mBounds.IsEqualXY(x, y)) {
|
if (mWindowType != WindowType::Popup && mBounds.IsEqualXY(x, y)) {
|
||||||
// Nothing to do, since it is already positioned correctly.
|
// Nothing to do, since it is already positioned correctly.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2536,7 +2536,7 @@ LayoutDeviceIntRect nsWindow::GetBounds() {
|
||||||
|
|
||||||
// popup window bounds' are in screen coordinates, not relative to parent
|
// popup window bounds' are in screen coordinates, not relative to parent
|
||||||
// window
|
// window
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
rect.MoveTo(r.left, r.top);
|
rect.MoveTo(r.left, r.top);
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
@ -2788,8 +2788,9 @@ bool nsWindow::UpdateNonClientMargins(bool aReflowWindow) {
|
||||||
|
|
||||||
const nsSizeMode sizeMode = mFrameState->GetSizeMode();
|
const nsSizeMode sizeMode = mFrameState->GetSizeMode();
|
||||||
|
|
||||||
bool hasCaption = (mBorderStyle & (eBorderStyle_all | eBorderStyle_title |
|
bool hasCaption =
|
||||||
eBorderStyle_menu | eBorderStyle_default));
|
bool(mBorderStyle & (BorderStyle::All | BorderStyle::Title |
|
||||||
|
BorderStyle::Menu | BorderStyle::Default));
|
||||||
|
|
||||||
float dpi = GetDPI();
|
float dpi = GetDPI();
|
||||||
|
|
||||||
|
|
@ -2962,7 +2963,7 @@ bool nsWindow::UpdateNonClientMargins(bool aReflowWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsWindow::SetNonClientMargins(LayoutDeviceIntMargin& margins) {
|
nsresult nsWindow::SetNonClientMargins(LayoutDeviceIntMargin& margins) {
|
||||||
if (!mIsTopWidgetWindow || mBorderStyle == eBorderStyle_none)
|
if (!mIsTopWidgetWindow || mBorderStyle == BorderStyle::None)
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
|
|
||||||
if (mHideChrome) {
|
if (mHideChrome) {
|
||||||
|
|
@ -3274,11 +3275,11 @@ void nsWindow::SetCursor(const Cursor& aCursor) {
|
||||||
*
|
*
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
nsTransparencyMode nsWindow::GetTransparencyMode() {
|
TransparencyMode nsWindow::GetTransparencyMode() {
|
||||||
return GetTopLevelWindow(true)->GetWindowTranslucencyInner();
|
return GetTopLevelWindow(true)->GetWindowTranslucencyInner();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsWindow::SetTransparencyMode(nsTransparencyMode aMode) {
|
void nsWindow::SetTransparencyMode(TransparencyMode aMode) {
|
||||||
nsWindow* window = GetTopLevelWindow(true);
|
nsWindow* window = GetTopLevelWindow(true);
|
||||||
MOZ_ASSERT(window);
|
MOZ_ASSERT(window);
|
||||||
|
|
||||||
|
|
@ -3286,7 +3287,7 @@ void nsWindow::SetTransparencyMode(nsTransparencyMode aMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsWindowType::eWindowType_toplevel == window->mWindowType &&
|
if (WindowType::TopLevel == window->mWindowType &&
|
||||||
mTransparencyMode != aMode &&
|
mTransparencyMode != aMode &&
|
||||||
!gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) {
|
!gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) {
|
||||||
NS_WARNING("Cannot set transparency mode on top-level windows.");
|
NS_WARNING("Cannot set transparency mode on top-level windows.");
|
||||||
|
|
@ -3351,7 +3352,7 @@ void nsWindow::UpdateGlass() {
|
||||||
// enabled; the window style is ignored.
|
// enabled; the window style is ignored.
|
||||||
DWMNCRENDERINGPOLICY policy = DWMNCRP_USEWINDOWSTYLE;
|
DWMNCRENDERINGPOLICY policy = DWMNCRP_USEWINDOWSTYLE;
|
||||||
switch (mTransparencyMode) {
|
switch (mTransparencyMode) {
|
||||||
case eTransparencyBorderlessGlass:
|
case TransparencyMode::BorderlessGlass:
|
||||||
// Only adjust if there is some opaque rectangle
|
// Only adjust if there is some opaque rectangle
|
||||||
if (margins.cxLeftWidth >= 0) {
|
if (margins.cxLeftWidth >= 0) {
|
||||||
margins.cxLeftWidth += kGlassMarginAdjustment;
|
margins.cxLeftWidth += kGlassMarginAdjustment;
|
||||||
|
|
@ -3868,7 +3869,7 @@ LayoutDeviceIntPoint nsWindow::WidgetToScreenOffset() {
|
||||||
|
|
||||||
LayoutDeviceIntSize nsWindow::ClientToWindowSize(
|
LayoutDeviceIntSize nsWindow::ClientToWindowSize(
|
||||||
const LayoutDeviceIntSize& aClientSize) {
|
const LayoutDeviceIntSize& aClientSize) {
|
||||||
if (mWindowType == eWindowType_popup && !IsPopupWithTitleBar())
|
if (mWindowType == WindowType::Popup && !IsPopupWithTitleBar())
|
||||||
return aClientSize;
|
return aClientSize;
|
||||||
|
|
||||||
// just use (200, 200) as the position
|
// just use (200, 200) as the position
|
||||||
|
|
@ -4460,7 +4461,7 @@ bool nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam,
|
||||||
// Postpone initialization until first PEN message will be found.
|
// Postpone initialization until first PEN message will be found.
|
||||||
if (MouseEvent_Binding::MOZ_SOURCE_PEN == aInputSource
|
if (MouseEvent_Binding::MOZ_SOURCE_PEN == aInputSource
|
||||||
// Messages should be only at topLevel window.
|
// Messages should be only at topLevel window.
|
||||||
&& nsWindowType::eWindowType_toplevel == mWindowType
|
&& WindowType::TopLevel == mWindowType
|
||||||
// Currently this scheme is used only when pointer events is enabled.
|
// Currently this scheme is used only when pointer events is enabled.
|
||||||
&& InkCollector::sInkCollector) {
|
&& InkCollector::sInkCollector) {
|
||||||
InkCollector::sInkCollector->SetTarget(mWnd);
|
InkCollector::sInkCollector->SetTarget(mWnd);
|
||||||
|
|
@ -4651,8 +4652,8 @@ HWND nsWindow::GetTopLevelForFocus(HWND aCurWnd) {
|
||||||
toplevelWnd = aCurWnd;
|
toplevelWnd = aCurWnd;
|
||||||
nsWindow* win = WinUtils::GetNSWindowPtr(aCurWnd);
|
nsWindow* win = WinUtils::GetNSWindowPtr(aCurWnd);
|
||||||
if (win) {
|
if (win) {
|
||||||
if (win->mWindowType == eWindowType_toplevel ||
|
if (win->mWindowType == WindowType::TopLevel ||
|
||||||
win->mWindowType == eWindowType_dialog) {
|
win->mWindowType == WindowType::Dialog) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5243,7 +5244,7 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
||||||
// We only handle this message for the hidden window,
|
// We only handle this message for the hidden window,
|
||||||
// as we only need to update the (global) font list once
|
// as we only need to update the (global) font list once
|
||||||
// for any given change, not once per window!
|
// for any given change, not once per window!
|
||||||
if (mWindowType != eWindowType_invisible) {
|
if (mWindowType != WindowType::Invisible) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5297,7 +5298,7 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
||||||
// only respond to the hidden top-level window to avoid hammering
|
// only respond to the hidden top-level window to avoid hammering
|
||||||
// layout with a bunch of NotifyThemeChanged() calls)
|
// layout with a bunch of NotifyThemeChanged() calls)
|
||||||
//
|
//
|
||||||
if (mWindowType == eWindowType_invisible) {
|
if (mWindowType == WindowType::Invisible) {
|
||||||
if (!wcscmp(lParamString, L"UserInteractionMode") ||
|
if (!wcscmp(lParamString, L"UserInteractionMode") ||
|
||||||
!wcscmp(lParamString, L"ConvertibleSlateMode") ||
|
!wcscmp(lParamString, L"ConvertibleSlateMode") ||
|
||||||
!wcscmp(lParamString, L"SystemDockMode")) {
|
!wcscmp(lParamString, L"SystemDockMode")) {
|
||||||
|
|
@ -6282,7 +6283,7 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_GESTURENOTIFY: {
|
case WM_GESTURENOTIFY: {
|
||||||
if (mWindowType != eWindowType_invisible) {
|
if (mWindowType != WindowType::Invisible) {
|
||||||
// A GestureNotify event is dispatched to decide which single-finger
|
// A GestureNotify event is dispatched to decide which single-finger
|
||||||
// panning direction should be active (including none) and if pan
|
// panning direction should be active (including none) and if pan
|
||||||
// feedback should be displayed. Java and plugin windows can make their
|
// feedback should be displayed. Java and plugin windows can make their
|
||||||
|
|
@ -6465,7 +6466,7 @@ int32_t nsWindow::ClientMarginHitTestPoint(int32_t aX, int32_t aY) {
|
||||||
const bool isResizable =
|
const bool isResizable =
|
||||||
sizeMode != nsSizeMode_Maximized &&
|
sizeMode != nsSizeMode_Maximized &&
|
||||||
(mBorderStyle &
|
(mBorderStyle &
|
||||||
(eBorderStyle_all | eBorderStyle_resizeh | eBorderStyle_default));
|
(BorderStyle::All | BorderStyle::ResizeH | BorderStyle::Default));
|
||||||
|
|
||||||
// Ensure being accessible to borders of window. Even if contents are in
|
// Ensure being accessible to borders of window. Even if contents are in
|
||||||
// this area, the area must behave as border.
|
// this area, the area must behave as border.
|
||||||
|
|
@ -7033,14 +7034,14 @@ void nsWindow::OnWindowPosChanging(WINDOWPOS* info) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// prevent rude external programs from making hidden window visible
|
// prevent rude external programs from making hidden window visible
|
||||||
if (mWindowType == eWindowType_invisible) info->flags &= ~SWP_SHOWWINDOW;
|
if (mWindowType == WindowType::Invisible) info->flags &= ~SWP_SHOWWINDOW;
|
||||||
|
|
||||||
// When waking from sleep or switching out of tablet mode, Windows 10
|
// When waking from sleep or switching out of tablet mode, Windows 10
|
||||||
// Version 1809 will reopen popup windows that should be hidden. Detect
|
// Version 1809 will reopen popup windows that should be hidden. Detect
|
||||||
// this case and refuse to show the window.
|
// this case and refuse to show the window.
|
||||||
static bool sDWMUnhidesPopups = IsWin10Sep2018UpdateOrLater();
|
static bool sDWMUnhidesPopups = IsWin10Sep2018UpdateOrLater();
|
||||||
if (sDWMUnhidesPopups && (info->flags & SWP_SHOWWINDOW) &&
|
if (sDWMUnhidesPopups && (info->flags & SWP_SHOWWINDOW) &&
|
||||||
mWindowType == eWindowType_popup && mWidgetListener &&
|
mWindowType == WindowType::Popup && mWidgetListener &&
|
||||||
mWidgetListener->ShouldNotBeVisible()) {
|
mWidgetListener->ShouldNotBeVisible()) {
|
||||||
info->flags &= ~SWP_SHOWWINDOW;
|
info->flags &= ~SWP_SHOWWINDOW;
|
||||||
}
|
}
|
||||||
|
|
@ -7500,16 +7501,16 @@ bool nsWindow::OnHotKey(WPARAM wParam, LPARAM lParam) { return true; }
|
||||||
// Can be overriden. Controls auto-erase of background.
|
// Can be overriden. Controls auto-erase of background.
|
||||||
bool nsWindow::AutoErase(HDC dc) { return false; }
|
bool nsWindow::AutoErase(HDC dc) { return false; }
|
||||||
|
|
||||||
bool nsWindow::IsPopup() { return mWindowType == eWindowType_popup; }
|
bool nsWindow::IsPopup() { return mWindowType == WindowType::Popup; }
|
||||||
|
|
||||||
bool nsWindow::ShouldUseOffMainThreadCompositing() {
|
bool nsWindow::ShouldUseOffMainThreadCompositing() {
|
||||||
if (mWindowType == eWindowType_popup && mPopupType == ePopupTypeTooltip) {
|
if (mWindowType == WindowType::Popup && mPopupType == PopupType::Tooltip) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Content rendering of popup is always done by child window.
|
// Content rendering of popup is always done by child window.
|
||||||
// See nsDocumentViewer::ShouldAttachToTopLevel().
|
// See nsDocumentViewer::ShouldAttachToTopLevel().
|
||||||
if (mWindowType == eWindowType_popup && !mIsChildWindow) {
|
if (mWindowType == WindowType::Popup && !mIsChildWindow) {
|
||||||
MOZ_ASSERT(!mParent);
|
MOZ_ASSERT(!mParent);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -7563,7 +7564,7 @@ void nsWindow::OnDPIChanged(int32_t x, int32_t y, int32_t width,
|
||||||
int32_t height) {
|
int32_t height) {
|
||||||
// Don't try to handle WM_DPICHANGED for popup windows (see bug 1239353);
|
// Don't try to handle WM_DPICHANGED for popup windows (see bug 1239353);
|
||||||
// they remain tied to their original parent's resolution.
|
// they remain tied to their original parent's resolution.
|
||||||
if (mWindowType == eWindowType_popup) {
|
if (mWindowType == WindowType::Popup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (StaticPrefs::layout_css_devPixelsPerPx() > 0.0) {
|
if (StaticPrefs::layout_css_devPixelsPerPx() > 0.0) {
|
||||||
|
|
@ -7722,7 +7723,7 @@ a11y::LocalAccessible* nsWindow::GetAccessible() {
|
||||||
if (a11y::PlatformDisabledState() == a11y::ePlatformIsDisabled)
|
if (a11y::PlatformDisabledState() == a11y::ePlatformIsDisabled)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (mInDtor || mOnDestroyCalled || mWindowType == eWindowType_invisible) {
|
if (mInDtor || mOnDestroyCalled || mWindowType == WindowType::Invisible) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7761,7 +7762,7 @@ a11y::LocalAccessible* nsWindow::GetAccessible() {
|
||||||
**************************************************************
|
**************************************************************
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode) {
|
void nsWindow::SetWindowTranslucencyInner(TransparencyMode aMode) {
|
||||||
if (aMode == mTransparencyMode) return;
|
if (aMode == mTransparencyMode) return;
|
||||||
|
|
||||||
// stop on dialogs and popups!
|
// stop on dialogs and popups!
|
||||||
|
|
@ -7778,11 +7779,12 @@ void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode) {
|
||||||
"Setting SetWindowTranslucencyInner on a parent this is not us!");
|
"Setting SetWindowTranslucencyInner on a parent this is not us!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aMode == eTransparencyTransparent) {
|
if (aMode == TransparencyMode::Transparent) {
|
||||||
// If we're switching to the use of a transparent window, hide the chrome
|
// If we're switching to the use of a transparent window, hide the chrome
|
||||||
// on our parent.
|
// on our parent.
|
||||||
HideWindowChrome(true);
|
HideWindowChrome(true);
|
||||||
} else if (mHideChrome && mTransparencyMode == eTransparencyTransparent) {
|
} else if (mHideChrome &&
|
||||||
|
mTransparencyMode == TransparencyMode::Transparent) {
|
||||||
// if we're switching out of transparent, re-enable our parent's chrome.
|
// if we're switching out of transparent, re-enable our parent's chrome.
|
||||||
HideWindowChrome(false);
|
HideWindowChrome(false);
|
||||||
}
|
}
|
||||||
|
|
@ -7799,7 +7801,7 @@ void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aMode == eTransparencyTransparent)
|
if (aMode == TransparencyMode::Transparent)
|
||||||
exStyle |= WS_EX_LAYERED;
|
exStyle |= WS_EX_LAYERED;
|
||||||
else
|
else
|
||||||
exStyle &= ~WS_EX_LAYERED;
|
exStyle &= ~WS_EX_LAYERED;
|
||||||
|
|
@ -8468,8 +8470,8 @@ nsWindow* nsWindow::GetTopLevelWindow(bool aStopOnDialogOrPopup) {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (aStopOnDialogOrPopup) {
|
if (aStopOnDialogOrPopup) {
|
||||||
switch (curWindow->mWindowType) {
|
switch (curWindow->mWindowType) {
|
||||||
case eWindowType_dialog:
|
case WindowType::Dialog:
|
||||||
case eWindowType_popup:
|
case WindowType::Popup:
|
||||||
return curWindow;
|
return curWindow;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -8637,7 +8639,7 @@ bool nsWindow::WidgetTypeSupportsAcceleration() {
|
||||||
// Also see bug 1150376, D3D11 composition can cause issues on some devices
|
// Also see bug 1150376, D3D11 composition can cause issues on some devices
|
||||||
// on Windows 7 where presentation fails randomly for windows with drop
|
// on Windows 7 where presentation fails randomly for windows with drop
|
||||||
// shadows.
|
// shadows.
|
||||||
return mTransparencyMode != eTransparencyTransparent &&
|
return mTransparencyMode != TransparencyMode::Transparent &&
|
||||||
!(IsPopup() && DeviceManagerDx::Get()->IsWARP());
|
!(IsPopup() && DeviceManagerDx::Get()->IsWARP());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ class nsWindow final : public nsBaseWidget {
|
||||||
[[nodiscard]] nsresult Create(nsIWidget* aParent,
|
[[nodiscard]] nsresult Create(nsIWidget* aParent,
|
||||||
nsNativeWidget aNativeParent,
|
nsNativeWidget aNativeParent,
|
||||||
const LayoutDeviceIntRect& aRect,
|
const LayoutDeviceIntRect& aRect,
|
||||||
nsWidgetInitData* aInitData = nullptr) override;
|
InitData* aInitData = nullptr) override;
|
||||||
void Destroy() override;
|
void Destroy() override;
|
||||||
void SetParent(nsIWidget* aNewParent) override;
|
void SetParent(nsIWidget* aNewParent) override;
|
||||||
nsIWidget* GetParent(void) override;
|
nsIWidget* GetParent(void) override;
|
||||||
|
|
@ -270,8 +270,8 @@ class nsWindow final : public nsBaseWidget {
|
||||||
const InputContextAction& aAction) override;
|
const InputContextAction& aAction) override;
|
||||||
InputContext GetInputContext() override;
|
InputContext GetInputContext() override;
|
||||||
TextEventDispatcherListener* GetNativeTextEventDispatcherListener() override;
|
TextEventDispatcherListener* GetNativeTextEventDispatcherListener() override;
|
||||||
void SetTransparencyMode(nsTransparencyMode aMode) override;
|
void SetTransparencyMode(TransparencyMode aMode) override;
|
||||||
nsTransparencyMode GetTransparencyMode() override;
|
TransparencyMode GetTransparencyMode() override;
|
||||||
void UpdateOpaqueRegion(const LayoutDeviceIntRegion& aOpaqueRegion) override;
|
void UpdateOpaqueRegion(const LayoutDeviceIntRegion& aOpaqueRegion) override;
|
||||||
nsresult SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
nsresult SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
||||||
void SetResizeMargin(mozilla::LayoutDeviceIntCoord aResizeMargin) override;
|
void SetResizeMargin(mozilla::LayoutDeviceIntCoord aResizeMargin) override;
|
||||||
|
|
@ -547,14 +547,14 @@ class nsWindow final : public nsBaseWidget {
|
||||||
HRGN ExcludeNonClientFromPaintRegion(HRGN aRegion);
|
HRGN ExcludeNonClientFromPaintRegion(HRGN aRegion);
|
||||||
static const wchar_t* GetMainWindowClass();
|
static const wchar_t* GetMainWindowClass();
|
||||||
bool HasGlass() const {
|
bool HasGlass() const {
|
||||||
return mTransparencyMode == eTransparencyBorderlessGlass;
|
return mTransparencyMode == TransparencyMode::BorderlessGlass;
|
||||||
}
|
}
|
||||||
HWND GetOwnerWnd() const { return ::GetWindow(mWnd, GW_OWNER); }
|
HWND GetOwnerWnd() const { return ::GetWindow(mWnd, GW_OWNER); }
|
||||||
bool IsOwnerForegroundWindow() const {
|
bool IsOwnerForegroundWindow() const {
|
||||||
HWND owner = GetOwnerWnd();
|
HWND owner = GetOwnerWnd();
|
||||||
return owner && owner == ::GetForegroundWindow();
|
return owner && owner == ::GetForegroundWindow();
|
||||||
}
|
}
|
||||||
bool IsPopup() const { return mWindowType == eWindowType_popup; }
|
bool IsPopup() const { return mWindowType == WindowType::Popup; }
|
||||||
bool IsCloaked() const { return mIsCloaked; }
|
bool IsCloaked() const { return mIsCloaked; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -618,8 +618,7 @@ class nsWindow final : public nsBaseWidget {
|
||||||
DWORD WindowStyle();
|
DWORD WindowStyle();
|
||||||
DWORD WindowExStyle();
|
DWORD WindowExStyle();
|
||||||
|
|
||||||
static const wchar_t* ChooseWindowClass(nsWindowType,
|
static const wchar_t* ChooseWindowClass(WindowType, bool aForMenupopupFrame);
|
||||||
bool aForMenupopupFrame);
|
|
||||||
// This method registers the given window class, and returns the class name.
|
// This method registers the given window class, and returns the class name.
|
||||||
static const wchar_t* RegisterWindowClass(const wchar_t* aClassName,
|
static const wchar_t* RegisterWindowClass(const wchar_t* aClassName,
|
||||||
UINT aExtraStyle, LPWSTR aIconID);
|
UINT aExtraStyle, LPWSTR aIconID);
|
||||||
|
|
@ -645,8 +644,8 @@ class nsWindow final : public nsBaseWidget {
|
||||||
/**
|
/**
|
||||||
* Window transparency helpers
|
* Window transparency helpers
|
||||||
*/
|
*/
|
||||||
void SetWindowTranslucencyInner(nsTransparencyMode aMode);
|
void SetWindowTranslucencyInner(TransparencyMode aMode);
|
||||||
nsTransparencyMode GetWindowTranslucencyInner() const {
|
TransparencyMode GetWindowTranslucencyInner() const {
|
||||||
return mTransparencyMode;
|
return mTransparencyMode;
|
||||||
}
|
}
|
||||||
void UpdateGlass();
|
void UpdateGlass();
|
||||||
|
|
@ -825,7 +824,7 @@ class nsWindow final : public nsBaseWidget {
|
||||||
ResizeState mResizeState = NOT_RESIZING;
|
ResizeState mResizeState = NOT_RESIZING;
|
||||||
|
|
||||||
// Transparency
|
// Transparency
|
||||||
nsTransparencyMode mTransparencyMode = eTransparencyOpaque;
|
TransparencyMode mTransparencyMode = TransparencyMode::Opaque;
|
||||||
nsIntRegion mPossiblyTransparentRegion;
|
nsIntRegion mPossiblyTransparentRegion;
|
||||||
MARGINS mGlassMargins = {0, 0, 0, 0};
|
MARGINS mGlassMargins = {0, 0, 0, 0};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) {
|
||||||
mLastPaintBounds = mBounds;
|
mLastPaintBounds = mBounds;
|
||||||
|
|
||||||
if (!aDC && (renderer->GetBackendType() == LayersBackend::LAYERS_NONE) &&
|
if (!aDC && (renderer->GetBackendType() == LayersBackend::LAYERS_NONE) &&
|
||||||
(eTransparencyTransparent == mTransparencyMode)) {
|
(TransparencyMode::Transparent == mTransparencyMode)) {
|
||||||
// For layered translucent windows all drawing should go to memory DC and no
|
// For layered translucent windows all drawing should go to memory DC and no
|
||||||
// WM_PAINT messages are normally generated. To support asynchronous
|
// WM_PAINT messages are normally generated. To support asynchronous
|
||||||
// painting we force generation of WM_PAINT messages by invalidating window
|
// painting we force generation of WM_PAINT messages by invalidating window
|
||||||
|
|
@ -216,7 +216,8 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) {
|
||||||
HDC hDC = aDC ? aDC : (::BeginPaint(mWnd, &ps));
|
HDC hDC = aDC ? aDC : (::BeginPaint(mWnd, &ps));
|
||||||
mPaintDC = hDC;
|
mPaintDC = hDC;
|
||||||
|
|
||||||
bool forceRepaint = aDC || (eTransparencyTransparent == mTransparencyMode);
|
bool forceRepaint =
|
||||||
|
aDC || (TransparencyMode::Transparent == mTransparencyMode);
|
||||||
LayoutDeviceIntRegion region = GetRegionToPaint(forceRepaint, ps, hDC);
|
LayoutDeviceIntRegion region = GetRegionToPaint(forceRepaint, ps, hDC);
|
||||||
|
|
||||||
if (knowsCompositor && layerManager) {
|
if (knowsCompositor && layerManager) {
|
||||||
|
|
@ -258,7 +259,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) {
|
||||||
RefPtr<gfxASurface> targetSurface;
|
RefPtr<gfxASurface> targetSurface;
|
||||||
|
|
||||||
// don't support transparency for non-GDI rendering, for now
|
// don't support transparency for non-GDI rendering, for now
|
||||||
if (eTransparencyTransparent == mTransparencyMode) {
|
if (TransparencyMode::Transparent == mTransparencyMode) {
|
||||||
// This mutex needs to be held when EnsureTransparentSurface is
|
// This mutex needs to be held when EnsureTransparentSurface is
|
||||||
// called.
|
// called.
|
||||||
MutexAutoLock lock(mBasicLayersSurface->GetTransparentSurfaceLock());
|
MutexAutoLock lock(mBasicLayersSurface->GetTransparentSurfaceLock());
|
||||||
|
|
@ -267,7 +268,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) {
|
||||||
|
|
||||||
RefPtr<gfxWindowsSurface> targetSurfaceWin;
|
RefPtr<gfxWindowsSurface> targetSurfaceWin;
|
||||||
if (!targetSurface) {
|
if (!targetSurface) {
|
||||||
uint32_t flags = (mTransparencyMode == eTransparencyOpaque)
|
uint32_t flags = (mTransparencyMode == TransparencyMode::Opaque)
|
||||||
? 0
|
? 0
|
||||||
: gfxWindowsSurface::FLAG_IS_TRANSPARENT;
|
: gfxWindowsSurface::FLAG_IS_TRANSPARENT;
|
||||||
targetSurfaceWin = new gfxWindowsSurface(hDC, flags);
|
targetSurfaceWin = new gfxWindowsSurface(hDC, flags);
|
||||||
|
|
@ -293,12 +294,12 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) {
|
||||||
// don't need to double buffer with anything but GDI
|
// don't need to double buffer with anything but GDI
|
||||||
BufferMode doubleBuffering = mozilla::layers::BufferMode::BUFFER_NONE;
|
BufferMode doubleBuffering = mozilla::layers::BufferMode::BUFFER_NONE;
|
||||||
switch (mTransparencyMode) {
|
switch (mTransparencyMode) {
|
||||||
case eTransparencyBorderlessGlass:
|
case TransparencyMode::BorderlessGlass:
|
||||||
default:
|
default:
|
||||||
// If we're not doing translucency, then double buffer
|
// If we're not doing translucency, then double buffer
|
||||||
doubleBuffering = mozilla::layers::BufferMode::BUFFERED;
|
doubleBuffering = mozilla::layers::BufferMode::BUFFERED;
|
||||||
break;
|
break;
|
||||||
case eTransparencyTransparent:
|
case TransparencyMode::Transparent:
|
||||||
// If we're rendering with translucency, we're going to be
|
// If we're rendering with translucency, we're going to be
|
||||||
// rendering the whole window; make sure we clear it first
|
// rendering the whole window; make sure we clear it first
|
||||||
dt->ClearRect(
|
dt->ClearRect(
|
||||||
|
|
@ -315,7 +316,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) {
|
||||||
result = listener->PaintWindow(this, region);
|
result = listener->PaintWindow(this, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eTransparencyTransparent == mTransparencyMode) {
|
if (TransparencyMode::Transparent == mTransparencyMode) {
|
||||||
// Data from offscreen drawing surface was copied to memory bitmap of
|
// Data from offscreen drawing surface was copied to memory bitmap of
|
||||||
// transparent bitmap. Now it can be read from memory bitmap to apply
|
// transparent bitmap. Now it can be read from memory bitmap to apply
|
||||||
// alpha channel and after that displayed on the screen.
|
// alpha channel and after that displayed on the screen.
|
||||||
|
|
@ -360,7 +361,7 @@ bool nsWindow::NeedsToTrackWindowOcclusionState() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCompositorSession && mWindowType == eWindowType_toplevel) {
|
if (mCompositorSession && mWindowType == WindowType::TopLevel) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ nsWindow::TaskbarConcealer::GetWindowState(HWND aWnd) {
|
||||||
|
|
||||||
// nsWindows of other window-classes include tooltips and drop-shadow-bearing
|
// nsWindows of other window-classes include tooltips and drop-shadow-bearing
|
||||||
// menus.
|
// menus.
|
||||||
if (pWin->mWindowType != eWindowType_toplevel) {
|
if (pWin->mWindowType != WindowType::TopLevel) {
|
||||||
return Nothing();
|
return Nothing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ NS_INTERFACE_MAP_END
|
||||||
nsresult AppWindow::Initialize(nsIAppWindow* aParent, nsIAppWindow* aOpener,
|
nsresult AppWindow::Initialize(nsIAppWindow* aParent, nsIAppWindow* aOpener,
|
||||||
int32_t aInitialWidth, int32_t aInitialHeight,
|
int32_t aInitialWidth, int32_t aInitialHeight,
|
||||||
bool aIsHiddenWindow,
|
bool aIsHiddenWindow,
|
||||||
nsWidgetInitData& widgetInitData) {
|
widget::InitData& widgetInitData) {
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIWidget> parentWidget;
|
nsCOMPtr<nsIWidget> parentWidget;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,20 +37,19 @@
|
||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
#include "nsIXULStore.h"
|
#include "nsIXULStore.h"
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
class Element;
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
class nsAtom;
|
class nsAtom;
|
||||||
class nsXULTooltipListener;
|
class nsXULTooltipListener;
|
||||||
struct nsWidgetInitData;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class PresShell;
|
class PresShell;
|
||||||
class AppWindowTimerCallback;
|
class AppWindowTimerCallback;
|
||||||
class L10nReadyPromiseHandler;
|
class L10nReadyPromiseHandler;
|
||||||
|
namespace dom {
|
||||||
|
class Element;
|
||||||
|
} // namespace dom
|
||||||
|
namespace widget {
|
||||||
|
struct InitData;
|
||||||
|
} // namespace widget
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
// AppWindow
|
// AppWindow
|
||||||
|
|
@ -144,7 +143,7 @@ class AppWindow final : public nsIBaseWindow,
|
||||||
// AppWindow methods...
|
// AppWindow methods...
|
||||||
nsresult Initialize(nsIAppWindow* aParent, nsIAppWindow* aOpener,
|
nsresult Initialize(nsIAppWindow* aParent, nsIAppWindow* aOpener,
|
||||||
int32_t aInitialWidth, int32_t aInitialHeight,
|
int32_t aInitialWidth, int32_t aInitialHeight,
|
||||||
bool aIsHiddenWindow, nsWidgetInitData& widgetInitData);
|
bool aIsHiddenWindow, widget::InitData& widgetInitData);
|
||||||
|
|
||||||
nsDocShell* GetDocShell() { return mDocShell; }
|
nsDocShell* GetDocShell() { return mDocShell; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "AppWindow.h"
|
#include "AppWindow.h"
|
||||||
|
|
||||||
#include "nsWidgetInitData.h"
|
#include "mozilla/widget/InitData.h"
|
||||||
#include "nsWidgetsCID.h"
|
#include "nsWidgetsCID.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include "mozilla/StaticPrefs_fission.h"
|
#include "mozilla/StaticPrefs_fission.h"
|
||||||
#include "mozilla/intl/LocaleService.h"
|
#include "mozilla/intl/LocaleService.h"
|
||||||
#include "mozilla/dom/BrowsingContext.h"
|
#include "mozilla/dom/BrowsingContext.h"
|
||||||
|
#include "mozilla/dom/Document.h"
|
||||||
|
|
||||||
#include "nsEmbedCID.h"
|
#include "nsEmbedCID.h"
|
||||||
#include "nsIWebBrowser.h"
|
#include "nsIWebBrowser.h"
|
||||||
|
|
@ -540,6 +541,7 @@ nsresult nsAppShellService::JustCreateTopWindow(
|
||||||
nsIAppWindow* aParent, nsIURI* aUrl, uint32_t aChromeMask,
|
nsIAppWindow* aParent, nsIURI* aUrl, uint32_t aChromeMask,
|
||||||
int32_t aInitialWidth, int32_t aInitialHeight, bool aIsHiddenWindow,
|
int32_t aInitialWidth, int32_t aInitialHeight, bool aIsHiddenWindow,
|
||||||
AppWindow** aResult) {
|
AppWindow** aResult) {
|
||||||
|
using BorderStyle = widget::BorderStyle;
|
||||||
*aResult = nullptr;
|
*aResult = nullptr;
|
||||||
NS_ENSURE_STATE(!mXPCOMWillShutDown);
|
NS_ENSURE_STATE(!mXPCOMWillShutDown);
|
||||||
|
|
||||||
|
|
@ -555,18 +557,18 @@ nsresult nsAppShellService::JustCreateTopWindow(
|
||||||
if (window && CheckForFullscreenWindow()) window->IgnoreXULSizeMode(true);
|
if (window && CheckForFullscreenWindow()) window->IgnoreXULSizeMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsWidgetInitData widgetInitData;
|
widget::InitData widgetInitData;
|
||||||
|
|
||||||
if (aIsHiddenWindow)
|
if (aIsHiddenWindow)
|
||||||
widgetInitData.mWindowType = eWindowType_invisible;
|
widgetInitData.mWindowType = widget::WindowType::Invisible;
|
||||||
else
|
else
|
||||||
widgetInitData.mWindowType =
|
widgetInitData.mWindowType =
|
||||||
aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG
|
aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG
|
||||||
? eWindowType_dialog
|
? widget::WindowType::Dialog
|
||||||
: eWindowType_toplevel;
|
: widget::WindowType::TopLevel;
|
||||||
|
|
||||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_POPUP)
|
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_POPUP)
|
||||||
widgetInitData.mWindowType = eWindowType_popup;
|
widgetInitData.mWindowType = widget::WindowType::Popup;
|
||||||
|
|
||||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_SUPPRESS_ANIMATION)
|
if (aChromeMask & nsIWebBrowserChrome::CHROME_SUPPRESS_ANIMATION)
|
||||||
widgetInitData.mIsAnimationSuppressed = true;
|
widgetInitData.mIsAnimationSuppressed = true;
|
||||||
|
|
@ -586,7 +588,7 @@ nsresult nsAppShellService::JustCreateTopWindow(
|
||||||
nsIWebBrowserChrome::CHROME_TOOLBAR |
|
nsIWebBrowserChrome::CHROME_TOOLBAR |
|
||||||
nsIWebBrowserChrome::CHROME_LOCATIONBAR |
|
nsIWebBrowserChrome::CHROME_LOCATIONBAR |
|
||||||
nsIWebBrowserChrome::CHROME_STATUSBAR;
|
nsIWebBrowserChrome::CHROME_STATUSBAR;
|
||||||
if (widgetInitData.mWindowType == eWindowType_toplevel &&
|
if (widgetInitData.mWindowType == widget::WindowType::TopLevel &&
|
||||||
((aChromeMask & pipMask) == pipMask) && !(aChromeMask & barMask)) {
|
((aChromeMask & pipMask) == pipMask) && !(aChromeMask & barMask)) {
|
||||||
widgetInitData.mPIPWindow = true;
|
widgetInitData.mPIPWindow = true;
|
||||||
}
|
}
|
||||||
|
|
@ -599,7 +601,7 @@ nsresult nsAppShellService::JustCreateTopWindow(
|
||||||
nsIWebBrowserChrome::CHROME_TOOLBAR |
|
nsIWebBrowserChrome::CHROME_TOOLBAR |
|
||||||
nsIWebBrowserChrome::CHROME_LOCATIONBAR |
|
nsIWebBrowserChrome::CHROME_LOCATIONBAR |
|
||||||
nsIWebBrowserChrome::CHROME_STATUSBAR;
|
nsIWebBrowserChrome::CHROME_STATUSBAR;
|
||||||
if (widgetInitData.mWindowType == eWindowType_dialog &&
|
if (widgetInitData.mWindowType == widget::WindowType::Dialog &&
|
||||||
((aChromeMask & pipMask) == pipMask) && !(aChromeMask & barMask)) {
|
((aChromeMask & pipMask) == pipMask) && !(aChromeMask & barMask)) {
|
||||||
widgetInitData.mPIPWindow = true;
|
widgetInitData.mPIPWindow = true;
|
||||||
}
|
}
|
||||||
|
|
@ -617,52 +619,44 @@ nsresult nsAppShellService::JustCreateTopWindow(
|
||||||
nsIWebBrowserChrome::CHROME_OPENAS_CHROME;
|
nsIWebBrowserChrome::CHROME_OPENAS_CHROME;
|
||||||
if (parent && (parent != mHiddenWindow) &&
|
if (parent && (parent != mHiddenWindow) &&
|
||||||
((aChromeMask & sheetMask) == sheetMask)) {
|
((aChromeMask & sheetMask) == sheetMask)) {
|
||||||
widgetInitData.mWindowType = eWindowType_sheet;
|
widgetInitData.mWindowType = widget::WindowType::Sheet;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
if (widgetInitData.mWindowType == eWindowType_toplevel ||
|
if (widgetInitData.mWindowType == widget::WindowType::TopLevel ||
|
||||||
widgetInitData.mWindowType == eWindowType_dialog)
|
widgetInitData.mWindowType == widget::WindowType::Dialog)
|
||||||
widgetInitData.mClipChildren = true;
|
widgetInitData.mClipChildren = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// note default chrome overrides other OS chrome settings, but
|
// note default chrome overrides other OS chrome settings, but
|
||||||
// not internal chrome
|
// not internal chrome
|
||||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_DEFAULT)
|
if (aChromeMask & nsIWebBrowserChrome::CHROME_DEFAULT)
|
||||||
widgetInitData.mBorderStyle = eBorderStyle_default;
|
widgetInitData.mBorderStyle = BorderStyle::Default;
|
||||||
else if ((aChromeMask & nsIWebBrowserChrome::CHROME_ALL) ==
|
else if ((aChromeMask & nsIWebBrowserChrome::CHROME_ALL) ==
|
||||||
nsIWebBrowserChrome::CHROME_ALL)
|
nsIWebBrowserChrome::CHROME_ALL)
|
||||||
widgetInitData.mBorderStyle = eBorderStyle_all;
|
widgetInitData.mBorderStyle = BorderStyle::All;
|
||||||
else {
|
else {
|
||||||
widgetInitData.mBorderStyle = eBorderStyle_none; // assumes none == 0x00
|
widgetInitData.mBorderStyle = BorderStyle::None; // assumes none == 0x00
|
||||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_BORDERS)
|
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_BORDERS)
|
||||||
widgetInitData.mBorderStyle = static_cast<enum nsBorderStyle>(
|
widgetInitData.mBorderStyle |= BorderStyle::Border;
|
||||||
widgetInitData.mBorderStyle | eBorderStyle_border);
|
|
||||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_TITLEBAR)
|
if (aChromeMask & nsIWebBrowserChrome::CHROME_TITLEBAR)
|
||||||
widgetInitData.mBorderStyle = static_cast<enum nsBorderStyle>(
|
widgetInitData.mBorderStyle |= BorderStyle::Title;
|
||||||
widgetInitData.mBorderStyle | eBorderStyle_title);
|
|
||||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_CLOSE)
|
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_CLOSE)
|
||||||
widgetInitData.mBorderStyle = static_cast<enum nsBorderStyle>(
|
widgetInitData.mBorderStyle |= BorderStyle::Close;
|
||||||
widgetInitData.mBorderStyle | eBorderStyle_close);
|
|
||||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) {
|
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) {
|
||||||
widgetInitData.mResizable = true;
|
widgetInitData.mResizable = true;
|
||||||
widgetInitData.mBorderStyle = static_cast<enum nsBorderStyle>(
|
widgetInitData.mBorderStyle |= BorderStyle::ResizeH;
|
||||||
widgetInitData.mBorderStyle | eBorderStyle_resizeh);
|
|
||||||
// only resizable windows get the maximize button (but not dialogs)
|
// only resizable windows get the maximize button (but not dialogs)
|
||||||
if (!(aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG))
|
if (!(aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG))
|
||||||
widgetInitData.mBorderStyle = static_cast<enum nsBorderStyle>(
|
widgetInitData.mBorderStyle |= BorderStyle::Maximize;
|
||||||
widgetInitData.mBorderStyle | eBorderStyle_maximize);
|
|
||||||
}
|
}
|
||||||
// all windows (except dialogs) get minimize buttons and the system menu
|
// all windows (except dialogs) get minimize buttons and the system menu
|
||||||
if (!(aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG))
|
if (!(aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG))
|
||||||
widgetInitData.mBorderStyle = static_cast<enum nsBorderStyle>(
|
widgetInitData.mBorderStyle |= BorderStyle::Minimize | BorderStyle::Menu;
|
||||||
widgetInitData.mBorderStyle | eBorderStyle_minimize |
|
|
||||||
eBorderStyle_menu);
|
|
||||||
// but anyone can explicitly ask for a minimize button
|
// but anyone can explicitly ask for a minimize button
|
||||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_MIN) {
|
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_MIN) {
|
||||||
widgetInitData.mBorderStyle = static_cast<enum nsBorderStyle>(
|
widgetInitData.mBorderStyle |= BorderStyle::Minimize;
|
||||||
widgetInitData.mBorderStyle | eBorderStyle_minimize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -739,7 +733,7 @@ nsresult nsAppShellService::JustCreateTopWindow(
|
||||||
/* aCsp = */ nullptr, /* aBaseURI = */ nullptr,
|
/* aCsp = */ nullptr, /* aBaseURI = */ nullptr,
|
||||||
/* aIsInitialDocument = */ true);
|
/* aIsInitialDocument = */ true);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
RefPtr<Document> doc = docShell->GetDocument();
|
RefPtr<dom::Document> doc = docShell->GetDocument();
|
||||||
NS_ENSURE_TRUE(!!doc, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(!!doc, NS_ERROR_FAILURE);
|
||||||
MOZ_ASSERT(doc->IsInitialDocument(),
|
MOZ_ASSERT(doc->IsInitialDocument(),
|
||||||
"Document should be an initial document");
|
"Document should be an initial document");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue