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