Bug 1919165 - Remove support for WindowType::Child, which is now unused. r=stransky
We don't take this codepath anymore in any platform. Windows and GTK were already asserting against it. Differential Revision: https://phabricator.services.mozilla.com/D245640
This commit is contained in:
@@ -2405,33 +2405,10 @@ nsRect nsLayoutUtils::TransformFrameRectToAncestor(
|
|||||||
NSFloatPixelsToAppUnits(float(result.height), destAppUnitsPerDevPixel));
|
NSFloatPixelsToAppUnits(float(result.height), destAppUnitsPerDevPixel));
|
||||||
}
|
}
|
||||||
|
|
||||||
static LayoutDeviceIntPoint GetWidgetOffset(nsIWidget* aWidget,
|
|
||||||
nsIWidget*& aRootWidget) {
|
|
||||||
LayoutDeviceIntPoint offset(0, 0);
|
|
||||||
while (aWidget->GetWindowType() == widget::WindowType::Child) {
|
|
||||||
nsIWidget* parent = aWidget->GetParent();
|
|
||||||
if (!parent) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
LayoutDeviceIntRect bounds = aWidget->GetBounds();
|
|
||||||
offset += bounds.TopLeft();
|
|
||||||
aWidget = parent;
|
|
||||||
}
|
|
||||||
aRootWidget = aWidget;
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayoutDeviceIntPoint nsLayoutUtils::WidgetToWidgetOffset(nsIWidget* aFrom,
|
LayoutDeviceIntPoint nsLayoutUtils::WidgetToWidgetOffset(nsIWidget* aFrom,
|
||||||
nsIWidget* aTo) {
|
nsIWidget* aTo) {
|
||||||
nsIWidget* fromRoot;
|
auto fromOffset = aFrom->WidgetToScreenOffset();
|
||||||
LayoutDeviceIntPoint fromOffset = GetWidgetOffset(aFrom, fromRoot);
|
auto toOffset = aTo->WidgetToScreenOffset();
|
||||||
nsIWidget* toRoot;
|
|
||||||
LayoutDeviceIntPoint toOffset = GetWidgetOffset(aTo, toRoot);
|
|
||||||
|
|
||||||
if (fromRoot != toRoot) {
|
|
||||||
fromOffset = aFrom->WidgetToScreenOffset();
|
|
||||||
toOffset = aTo->WidgetToScreenOffset();
|
|
||||||
}
|
|
||||||
return fromOffset - toOffset;
|
return fromOffset - toOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ nsWebBrowser::nsWebBrowser(int aItemType)
|
|||||||
mShouldEnableHistory(true),
|
mShouldEnableHistory(true),
|
||||||
mWillChangeProcess(false),
|
mWillChangeProcess(false),
|
||||||
mProgressListener(nullptr),
|
mProgressListener(nullptr),
|
||||||
mWidgetListenerDelegate(this),
|
|
||||||
mBackgroundColor(0),
|
mBackgroundColor(0),
|
||||||
mPersistCurrentState(nsIWebBrowserPersist::PERSIST_STATE_READY),
|
mPersistCurrentState(nsIWebBrowserPersist::PERSIST_STATE_READY),
|
||||||
mPersistResult(NS_OK),
|
mPersistResult(NS_OK),
|
||||||
@@ -73,25 +72,8 @@ nsWebBrowser::nsWebBrowser(int aItemType)
|
|||||||
nsWebBrowser::~nsWebBrowser() { InternalDestroy(); }
|
nsWebBrowser::~nsWebBrowser() { InternalDestroy(); }
|
||||||
|
|
||||||
nsIWidget* nsWebBrowser::EnsureWidget() {
|
nsIWidget* nsWebBrowser::EnsureWidget() {
|
||||||
if (mParentWidget) {
|
MOZ_DIAGNOSTIC_ASSERT(mParentWidget);
|
||||||
return mParentWidget;
|
return mParentWidget;
|
||||||
}
|
|
||||||
|
|
||||||
mInternalWidget = nsIWidget::CreateChildWindow();
|
|
||||||
if (NS_WARN_IF(!mInternalWidget)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
widget::InitData widgetInit;
|
|
||||||
widgetInit.mClipChildren = true;
|
|
||||||
widgetInit.mWindowType = widget::WindowType::Child;
|
|
||||||
LayoutDeviceIntRect bounds(0, 0, 0, 0);
|
|
||||||
|
|
||||||
mInternalWidget->SetWidgetListener(&mWidgetListenerDelegate);
|
|
||||||
NS_ENSURE_SUCCESS(mInternalWidget->Create(mParentWidget, bounds, &widgetInit),
|
|
||||||
nullptr);
|
|
||||||
|
|
||||||
return mInternalWidget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
@@ -163,12 +145,6 @@ already_AddRefed<nsWebBrowser> nsWebBrowser::Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void nsWebBrowser::InternalDestroy() {
|
void nsWebBrowser::InternalDestroy() {
|
||||||
if (mInternalWidget) {
|
|
||||||
mInternalWidget->SetWidgetListener(nullptr);
|
|
||||||
mInternalWidget->Destroy();
|
|
||||||
mInternalWidget = nullptr; // Force release here.
|
|
||||||
}
|
|
||||||
|
|
||||||
SetDocShell(nullptr);
|
SetDocShell(nullptr);
|
||||||
|
|
||||||
if (mDocShellTreeOwner) {
|
if (mDocShellTreeOwner) {
|
||||||
@@ -941,14 +917,7 @@ nsWebBrowser::SetPositionAndSize(int32_t aX, int32_t aY, int32_t aCX,
|
|||||||
int32_t doc_x = aX;
|
int32_t doc_x = aX;
|
||||||
int32_t doc_y = aY;
|
int32_t doc_y = aY;
|
||||||
|
|
||||||
// If there is an internal widget we need to make the docShell coordinates
|
|
||||||
// relative to the internal widget rather than the calling app's parent.
|
|
||||||
// We also need to resize our widget then.
|
// We also need to resize our widget then.
|
||||||
if (mInternalWidget) {
|
|
||||||
doc_x = doc_y = 0;
|
|
||||||
mInternalWidget->Resize(aX, aY, aCX, aCY,
|
|
||||||
!!(aFlags & nsIBaseWindow::eRepaint));
|
|
||||||
}
|
|
||||||
// Now reposition/ resize the doc
|
// Now reposition/ resize the doc
|
||||||
NS_ENSURE_SUCCESS(
|
NS_ENSURE_SUCCESS(
|
||||||
mDocShell->SetPositionAndSize(doc_x, doc_y, aCX, aCY, aFlags),
|
mDocShell->SetPositionAndSize(doc_x, doc_y, aCX, aCY, aFlags),
|
||||||
@@ -960,24 +929,6 @@ nsWebBrowser::SetPositionAndSize(int32_t aX, int32_t aY, int32_t aCX,
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWebBrowser::GetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aCX,
|
nsWebBrowser::GetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aCX,
|
||||||
int32_t* aCY) {
|
int32_t* aCY) {
|
||||||
if (mInternalWidget) {
|
|
||||||
LayoutDeviceIntRect bounds = mInternalWidget->GetBounds();
|
|
||||||
|
|
||||||
if (aX) {
|
|
||||||
*aX = bounds.X();
|
|
||||||
}
|
|
||||||
if (aY) {
|
|
||||||
*aY = bounds.Y();
|
|
||||||
}
|
|
||||||
if (aCX) {
|
|
||||||
*aCX = bounds.Width();
|
|
||||||
}
|
|
||||||
if (aCY) {
|
|
||||||
*aCY = bounds.Height();
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Can directly return this as it is the
|
// Can directly return this as it is the
|
||||||
// same interface, thus same returns.
|
// same interface, thus same returns.
|
||||||
return mDocShell->GetPositionAndSize(aX, aY, aCX, aCY);
|
return mDocShell->GetPositionAndSize(aX, aY, aCX, aCY);
|
||||||
@@ -1041,9 +992,6 @@ NS_IMETHODIMP
|
|||||||
nsWebBrowser::SetVisibility(bool aVisibility) {
|
nsWebBrowser::SetVisibility(bool aVisibility) {
|
||||||
if (mDocShell) {
|
if (mDocShell) {
|
||||||
NS_ENSURE_SUCCESS(mDocShell->SetVisibility(aVisibility), NS_ERROR_FAILURE);
|
NS_ENSURE_SUCCESS(mDocShell->SetVisibility(aVisibility), NS_ERROR_FAILURE);
|
||||||
if (mInternalWidget) {
|
|
||||||
mInternalWidget->Show(aVisibility);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@@ -1051,35 +999,18 @@ nsWebBrowser::SetVisibility(bool aVisibility) {
|
|||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWebBrowser::GetEnabled(bool* aEnabled) {
|
nsWebBrowser::GetEnabled(bool* aEnabled) {
|
||||||
if (mInternalWidget) {
|
|
||||||
*aEnabled = mInternalWidget->IsEnabled();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWebBrowser::SetEnabled(bool aEnabled) {
|
nsWebBrowser::SetEnabled(bool aEnabled) {
|
||||||
if (mInternalWidget) {
|
|
||||||
mInternalWidget->Enable(aEnabled);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWebBrowser::GetMainWidget(nsIWidget** aMainWidget) {
|
nsWebBrowser::GetMainWidget(nsIWidget** aMainWidget) {
|
||||||
NS_ENSURE_ARG_POINTER(aMainWidget);
|
NS_ENSURE_ARG_POINTER(aMainWidget);
|
||||||
|
NS_IF_ADDREF(*aMainWidget = mParentWidget);
|
||||||
if (mInternalWidget) {
|
|
||||||
*aMainWidget = mInternalWidget;
|
|
||||||
} else {
|
|
||||||
*aMainWidget = mParentWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IF_ADDREF(*aMainWidget);
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1143,42 +1074,6 @@ void nsWebBrowser::EnsureDocShellTreeOwner() {
|
|||||||
mDocShellTreeOwner->WebBrowser(this);
|
mDocShellTreeOwner->WebBrowser(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsWebBrowser::WindowActivated() {
|
|
||||||
#if defined(DEBUG_smaug)
|
|
||||||
RefPtr<dom::Document> document = mDocShell->GetDocument();
|
|
||||||
nsAutoString documentURI;
|
|
||||||
document->GetDocumentURI(documentURI);
|
|
||||||
printf("nsWebBrowser::NS_ACTIVATE %p %s\n", (void*)this,
|
|
||||||
NS_ConvertUTF16toUTF8(documentURI).get());
|
|
||||||
#endif
|
|
||||||
FocusActivate(nsFocusManager::GenerateFocusActionId());
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsWebBrowser::WindowDeactivated() {
|
|
||||||
#if defined(DEBUG_smaug)
|
|
||||||
RefPtr<dom::Document> document = mDocShell->GetDocument();
|
|
||||||
nsAutoString documentURI;
|
|
||||||
document->GetDocumentURI(documentURI);
|
|
||||||
printf("nsWebBrowser::NS_DEACTIVATE %p %s\n", (void*)this,
|
|
||||||
NS_ConvertUTF16toUTF8(documentURI).get());
|
|
||||||
#endif
|
|
||||||
FocusDeactivate(nsFocusManager::GenerateFocusActionId());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nsWebBrowser::PaintWindow(nsIWidget* aWidget,
|
|
||||||
LayoutDeviceIntRegion aRegion) {
|
|
||||||
WindowRenderer* renderer = aWidget->GetWindowRenderer();
|
|
||||||
NS_ASSERTION(renderer, "Must be in paint event");
|
|
||||||
if (FallbackRenderer* fallback = renderer->AsFallback()) {
|
|
||||||
if (fallback->BeginTransaction()) {
|
|
||||||
fallback->EndTransactionWithColor(aRegion.GetBounds().ToUnknownRect(),
|
|
||||||
ToDeviceColor(mBackgroundColor));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsWebBrowser::FocusActivate(uint64_t aActionId) {
|
void nsWebBrowser::FocusActivate(uint64_t aActionId) {
|
||||||
if (RefPtr<nsFocusManager> fm = nsFocusManager::GetFocusManager()) {
|
if (RefPtr<nsFocusManager> fm = nsFocusManager::GetFocusManager()) {
|
||||||
if (nsCOMPtr<nsPIDOMWindowOuter> window = GetWindow()) {
|
if (nsCOMPtr<nsPIDOMWindowOuter> window = GetWindow()) {
|
||||||
@@ -1201,19 +1096,3 @@ void nsWebBrowser::SetWillChangeProcess() {
|
|||||||
nsDocShell::Cast(mDocShell)->SetWillChangeProcess();
|
nsDocShell::Cast(mDocShell)->SetWillChangeProcess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsWebBrowser::WidgetListenerDelegate::WindowActivated() {
|
|
||||||
RefPtr<nsWebBrowser> holder = mWebBrowser;
|
|
||||||
holder->WindowActivated();
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsWebBrowser::WidgetListenerDelegate::WindowDeactivated() {
|
|
||||||
RefPtr<nsWebBrowser> holder = mWebBrowser;
|
|
||||||
holder->WindowDeactivated();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nsWebBrowser::WidgetListenerDelegate::PaintWindow(
|
|
||||||
nsIWidget* aWidget, mozilla::LayoutDeviceIntRegion aRegion) {
|
|
||||||
RefPtr<nsWebBrowser> holder = mWebBrowser;
|
|
||||||
return holder->PaintWindow(aWidget, aRegion);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -72,24 +72,6 @@ class nsWebBrowser final : public nsIWebBrowser,
|
|||||||
friend class nsDocShellTreeOwner;
|
friend class nsDocShellTreeOwner;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// The implementation of non-refcounted nsIWidgetListener, which would hold a
|
|
||||||
// strong reference on stack before calling nsWebBrowser's
|
|
||||||
// MOZ_CAN_RUN_SCRIPT methods.
|
|
||||||
class WidgetListenerDelegate : public nsIWidgetListener {
|
|
||||||
public:
|
|
||||||
explicit WidgetListenerDelegate(nsWebBrowser* aWebBrowser)
|
|
||||||
: mWebBrowser(aWebBrowser) {}
|
|
||||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual void WindowActivated() override;
|
|
||||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual void WindowDeactivated() override;
|
|
||||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual bool PaintWindow(
|
|
||||||
nsIWidget* aWidget, mozilla::LayoutDeviceIntRegion aRegion) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// The lifetime of WidgetListenerDelegate is bound to nsWebBrowser so we
|
|
||||||
// just use raw pointer here.
|
|
||||||
nsWebBrowser* mWebBrowser;
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWebBrowser, nsIWebBrowser)
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWebBrowser, nsIWebBrowser)
|
||||||
|
|
||||||
@@ -122,13 +104,6 @@ class nsWebBrowser final : public nsIWebBrowser,
|
|||||||
void EnsureDocShellTreeOwner();
|
void EnsureDocShellTreeOwner();
|
||||||
|
|
||||||
nsIWidget* EnsureWidget();
|
nsIWidget* EnsureWidget();
|
||||||
|
|
||||||
// nsIWidgetListener methods for WidgetListenerDelegate.
|
|
||||||
MOZ_CAN_RUN_SCRIPT void WindowActivated();
|
|
||||||
MOZ_CAN_RUN_SCRIPT void WindowDeactivated();
|
|
||||||
MOZ_CAN_RUN_SCRIPT bool PaintWindow(nsIWidget* aWidget,
|
|
||||||
mozilla::LayoutDeviceIntRegion aRegion);
|
|
||||||
|
|
||||||
explicit nsWebBrowser(int aItemType);
|
explicit nsWebBrowser(int aItemType);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -136,7 +111,6 @@ class nsWebBrowser final : public nsIWebBrowser,
|
|||||||
RefPtr<nsDocShell> mDocShell;
|
RefPtr<nsDocShell> mDocShell;
|
||||||
mozilla::OriginAttributes mOriginAttributes;
|
mozilla::OriginAttributes mOriginAttributes;
|
||||||
|
|
||||||
nsCOMPtr<nsIWidget> mInternalWidget;
|
|
||||||
nsCOMPtr<nsIWindowWatcher> mWWatch;
|
nsCOMPtr<nsIWindowWatcher> mWWatch;
|
||||||
const uint32_t mContentType;
|
const uint32_t mContentType;
|
||||||
bool mShouldEnableHistory;
|
bool mShouldEnableHistory;
|
||||||
@@ -145,8 +119,6 @@ class nsWebBrowser final : public nsIWebBrowser,
|
|||||||
|
|
||||||
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
||||||
|
|
||||||
WidgetListenerDelegate mWidgetListenerDelegate;
|
|
||||||
|
|
||||||
// cached background color
|
// cached background color
|
||||||
nscolor mBackgroundColor;
|
nscolor mBackgroundColor;
|
||||||
|
|
||||||
|
|||||||
@@ -467,7 +467,6 @@ void nsView::RemoveChild(nsView* child) {
|
|||||||
|
|
||||||
struct DefaultWidgetInitData : public widget::InitData {
|
struct DefaultWidgetInitData : public widget::InitData {
|
||||||
DefaultWidgetInitData() : widget::InitData() {
|
DefaultWidgetInitData() : widget::InitData() {
|
||||||
mWindowType = WindowType::Child;
|
|
||||||
mClipChildren = true;
|
mClipChildren = true;
|
||||||
mClipSiblings = true;
|
mClipSiblings = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ namespace mozilla::widget {
|
|||||||
// Window types
|
// Window types
|
||||||
enum class WindowType : uint8_t {
|
enum class WindowType : uint8_t {
|
||||||
TopLevel, // default top level window
|
TopLevel, // default top level window
|
||||||
Dialog, // top level window but usually handled differently
|
Dialog, // top level window but usually handled differently by the OS
|
||||||
// by the OS
|
|
||||||
Popup, // used for combo boxes, etc
|
Popup, // used for combo boxes, etc
|
||||||
Child, // child windows (contained inside a window on the
|
|
||||||
// desktop (has no border))
|
|
||||||
Invisible, // a special hidden window (not to be created by arbitrary code)
|
Invisible, // a special hidden window (not to be created by arbitrary code)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -77,7 +74,7 @@ enum class TransparencyMode : uint8_t {
|
|||||||
// Basic struct for widget initialization data.
|
// Basic struct for widget initialization data.
|
||||||
// @see Create member function of nsIWidget
|
// @see Create member function of nsIWidget
|
||||||
struct InitData {
|
struct InitData {
|
||||||
WindowType mWindowType = WindowType::Child;
|
WindowType mWindowType = WindowType::TopLevel;
|
||||||
BorderStyle mBorderStyle = BorderStyle::Default;
|
BorderStyle mBorderStyle = BorderStyle::Default;
|
||||||
PopupType mPopupHint = PopupType::Panel;
|
PopupType mPopupHint = PopupType::Panel;
|
||||||
PopupLevel mPopupLevel = PopupLevel::Top;
|
PopupLevel mPopupLevel = PopupLevel::Top;
|
||||||
|
|||||||
@@ -4552,9 +4552,6 @@ DesktopToLayoutDeviceScale ParentBackingScaleFactor(nsIWidget* aParent) {
|
|||||||
static DesktopRect GetWidgetScreenRectForChildren(nsIWidget* aWidget) {
|
static DesktopRect GetWidgetScreenRectForChildren(nsIWidget* aWidget) {
|
||||||
mozilla::DesktopToLayoutDeviceScale scale =
|
mozilla::DesktopToLayoutDeviceScale scale =
|
||||||
aWidget->GetDesktopToDeviceScale();
|
aWidget->GetDesktopToDeviceScale();
|
||||||
if (aWidget->GetWindowType() == WindowType::Child) {
|
|
||||||
return aWidget->GetScreenBounds() / scale;
|
|
||||||
}
|
|
||||||
return aWidget->GetClientBounds() / scale;
|
return aWidget->GetClientBounds() / scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4686,7 +4683,6 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect,
|
|||||||
// Configure the window we will create based on the window type.
|
// Configure the window we will create based on the window type.
|
||||||
switch (mWindowType) {
|
switch (mWindowType) {
|
||||||
case WindowType::Invisible:
|
case WindowType::Invisible:
|
||||||
case WindowType::Child:
|
|
||||||
break;
|
break;
|
||||||
case WindowType::Popup:
|
case WindowType::Popup:
|
||||||
if (aBorderStyle != BorderStyle::Default &&
|
if (aBorderStyle != BorderStyle::Default &&
|
||||||
@@ -4978,9 +4974,6 @@ void nsCocoaWindow::SetModal(bool aModal) {
|
|||||||
// (similar) event loops).
|
// (similar) event loops).
|
||||||
for (auto* ancestorWidget = mParent; ancestorWidget;
|
for (auto* ancestorWidget = mParent; ancestorWidget;
|
||||||
ancestorWidget = ancestorWidget->GetParent()) {
|
ancestorWidget = ancestorWidget->GetParent()) {
|
||||||
if (ancestorWidget->GetWindowType() == WindowType::Child) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
auto* ancestor = static_cast<nsCocoaWindow*>(ancestorWidget);
|
auto* ancestor = static_cast<nsCocoaWindow*>(ancestorWidget);
|
||||||
const bool changed = aModal ? ancestor->mNumModalDescendants++ == 0
|
const bool changed = aModal ? ancestor->mNumModalDescendants++ == 0
|
||||||
: --ancestor->mNumModalDescendants == 0;
|
: --ancestor->mNumModalDescendants == 0;
|
||||||
|
|||||||
@@ -467,7 +467,6 @@ nsWindow::nsWindow()
|
|||||||
mConfiguredClearColor(false),
|
mConfiguredClearColor(false),
|
||||||
mGotNonBlankPaint(false),
|
mGotNonBlankPaint(false),
|
||||||
mNeedsToRetryCapturingMouse(false) {
|
mNeedsToRetryCapturingMouse(false) {
|
||||||
mWindowType = WindowType::Child;
|
|
||||||
mSizeConstraints.mMaxSize = GetSafeWindowSize(mSizeConstraints.mMaxSize);
|
mSizeConstraints.mMaxSize = GetSafeWindowSize(mSizeConstraints.mMaxSize);
|
||||||
|
|
||||||
if (!gGlobalsInitialized) {
|
if (!gGlobalsInitialized) {
|
||||||
@@ -6016,8 +6015,6 @@ nsresult nsWindow::Create(nsIWidget* aParent, const LayoutDeviceIntRect& aRect,
|
|||||||
auto* parentnsWindow = static_cast<nsWindow*>(aParent);
|
auto* parentnsWindow = static_cast<nsWindow*>(aParent);
|
||||||
LOG(" parent window [%p]", parentnsWindow);
|
LOG(" parent window [%p]", parentnsWindow);
|
||||||
|
|
||||||
MOZ_DIAGNOSTIC_ASSERT(mWindowType != WindowType::Child);
|
|
||||||
|
|
||||||
MOZ_ASSERT_IF(mWindowType == WindowType::Popup, parentnsWindow);
|
MOZ_ASSERT_IF(mWindowType == WindowType::Popup, parentnsWindow);
|
||||||
|
|
||||||
if (mWindowType != WindowType::Dialog && mWindowType != WindowType::Popup &&
|
if (mWindowType != WindowType::Dialog && mWindowType != WindowType::Popup &&
|
||||||
|
|||||||
@@ -516,10 +516,9 @@ already_AddRefed<nsIWidget> nsBaseWidget::CreateChild(
|
|||||||
|
|
||||||
// Attach a view to our widget which we'll send events to.
|
// Attach a view to our widget which we'll send events to.
|
||||||
void nsBaseWidget::AttachViewToTopLevel(bool aUseAttachedEvents) {
|
void nsBaseWidget::AttachViewToTopLevel(bool aUseAttachedEvents) {
|
||||||
NS_ASSERTION((mWindowType == WindowType::TopLevel ||
|
NS_ASSERTION(mWindowType == WindowType::TopLevel ||
|
||||||
mWindowType == WindowType::Dialog ||
|
mWindowType == WindowType::Dialog ||
|
||||||
mWindowType == WindowType::Invisible ||
|
mWindowType == WindowType::Invisible,
|
||||||
mWindowType == WindowType::Child),
|
|
||||||
"Can't attach to window of that type");
|
"Can't attach to window of that type");
|
||||||
|
|
||||||
mUseAttachedEvents = aUseAttachedEvents;
|
mUseAttachedEvents = aUseAttachedEvents;
|
||||||
@@ -969,8 +968,8 @@ bool nsBaseWidget::UseAPZ() const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always use APZ for top-level windows
|
// Always use APZ for top-level windows. XXX what about Dialog?
|
||||||
if (mWindowType == WindowType::TopLevel || mWindowType == WindowType::Child) {
|
if (mWindowType == WindowType::TopLevel) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -986,7 +985,9 @@ bool nsBaseWidget::UseAPZ() const {
|
|||||||
if (HasRemoteContent()) {
|
if (HasRemoteContent()) {
|
||||||
return mWindowType == WindowType::Dialog ||
|
return mWindowType == WindowType::Dialog ||
|
||||||
mWindowType == WindowType::Popup;
|
mWindowType == WindowType::Popup;
|
||||||
} else if (StaticPrefs::apz_popups_without_remote_enabled()) {
|
}
|
||||||
|
|
||||||
|
if (StaticPrefs::apz_popups_without_remote_enabled()) {
|
||||||
return mWindowType == WindowType::Popup;
|
return mWindowType == WindowType::Popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2094,7 +2094,7 @@ class nsIWidget : public nsISupports {
|
|||||||
nsIWidget* MOZ_NON_OWNING_REF mParent = nullptr;
|
nsIWidget* MOZ_NON_OWNING_REF mParent = nullptr;
|
||||||
// When Destroy() is called, the sub class should set this true.
|
// When Destroy() is called, the sub class should set this true.
|
||||||
bool mOnDestroyCalled = false;
|
bool mOnDestroyCalled = false;
|
||||||
WindowType mWindowType = WindowType::Child;
|
WindowType mWindowType = WindowType::TopLevel;
|
||||||
WidgetType mWidgetType = WidgetType::Native;
|
WidgetType mWidgetType = WidgetType::Native;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -671,8 +671,6 @@ nsWindow::nsWindow()
|
|||||||
mCachedHitTestTime(TimeStamp::Now()),
|
mCachedHitTestTime(TimeStamp::Now()),
|
||||||
mSizeConstraintsScale(GetDefaultScale().scale),
|
mSizeConstraintsScale(GetDefaultScale().scale),
|
||||||
mDesktopId("DesktopIdMutex") {
|
mDesktopId("DesktopIdMutex") {
|
||||||
MOZ_ASSERT(mWindowType == WindowType::Child);
|
|
||||||
|
|
||||||
if (!gInitializedVirtualDesktopManager) {
|
if (!gInitializedVirtualDesktopManager) {
|
||||||
TaskController::Get()->AddTask(
|
TaskController::Get()->AddTask(
|
||||||
MakeAndAddRef<InitializeVirtualDesktopManagerTask>());
|
MakeAndAddRef<InitializeVirtualDesktopManagerTask>());
|
||||||
@@ -873,7 +871,6 @@ nsresult nsWindow::Create(nsIWidget* aParent, const LayoutDeviceIntRect& aRect,
|
|||||||
if (!aInitData) aInitData = &defaultInitData;
|
if (!aInitData) aInitData = &defaultInitData;
|
||||||
|
|
||||||
MOZ_DIAGNOSTIC_ASSERT(aInitData->mWindowType != WindowType::Invisible);
|
MOZ_DIAGNOSTIC_ASSERT(aInitData->mWindowType != WindowType::Invisible);
|
||||||
MOZ_DIAGNOSTIC_ASSERT(aInitData->mWindowType != WindowType::Child);
|
|
||||||
|
|
||||||
mBounds = aRect;
|
mBounds = aRect;
|
||||||
|
|
||||||
@@ -1310,10 +1307,6 @@ static DWORD WindowStylesRemovedForBorderStyle(BorderStyle aStyle) {
|
|||||||
DWORD nsWindow::WindowStyle() {
|
DWORD nsWindow::WindowStyle() {
|
||||||
DWORD style;
|
DWORD style;
|
||||||
switch (mWindowType) {
|
switch (mWindowType) {
|
||||||
case WindowType::Child:
|
|
||||||
style = WS_OVERLAPPED;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WindowType::Dialog:
|
case WindowType::Dialog:
|
||||||
style = WS_OVERLAPPED | WS_BORDER | WS_DLGFRAME | WS_SYSMENU |
|
style = WS_OVERLAPPED | WS_BORDER | WS_DLGFRAME | WS_SYSMENU |
|
||||||
DS_MODALFRAME | WS_CLIPCHILDREN;
|
DS_MODALFRAME | WS_CLIPCHILDREN;
|
||||||
@@ -1345,8 +1338,6 @@ DWORD nsWindow::WindowStyle() {
|
|||||||
// Return nsWindow extended styles
|
// Return nsWindow extended styles
|
||||||
DWORD nsWindow::WindowExStyle() {
|
DWORD nsWindow::WindowExStyle() {
|
||||||
switch (mWindowType) {
|
switch (mWindowType) {
|
||||||
case WindowType::Child:
|
|
||||||
return 0;
|
|
||||||
case WindowType::Popup: {
|
case WindowType::Popup: {
|
||||||
DWORD extendedStyle = WS_EX_TOOLWINDOW;
|
DWORD extendedStyle = WS_EX_TOOLWINDOW;
|
||||||
if (mPopupLevel == PopupLevel::Top) {
|
if (mPopupLevel == PopupLevel::Top) {
|
||||||
|
|||||||
Reference in New Issue
Block a user