зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 5d920a44a901 (bug 698002)
This commit is contained in:
Родитель
d57afd0e9c
Коммит
9b26154c74
|
@ -396,21 +396,20 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
|||
targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree,
|
||||
kNameSpaceID_XUL)) {
|
||||
treeAcc = do_QueryObject(accessible);
|
||||
if (treeAcc) {
|
||||
if (eventType.EqualsLiteral("TreeViewChanged")) {
|
||||
treeAcc->TreeViewChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
|
||||
HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
|
||||
return;
|
||||
}
|
||||
if (eventType.EqualsLiteral("TreeViewChanged")) {
|
||||
treeAcc->TreeViewChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
if (eventType.EqualsLiteral("TreeInvalidated")) {
|
||||
HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
|
||||
return;
|
||||
}
|
||||
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
|
||||
HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
|
||||
return;
|
||||
}
|
||||
|
||||
if (eventType.EqualsLiteral("TreeInvalidated")) {
|
||||
HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1327,7 +1327,6 @@ nsDOMWindowUtils::SendQueryContentEvent(PRUint32 aType,
|
|||
nsIntRect widgetBounds;
|
||||
nsresult rv = widget->GetClientBounds(widgetBounds);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
widgetBounds.MoveTo(0, 0);
|
||||
|
||||
// There is no popup frame at the point and the point isn't in our widget,
|
||||
// we cannot process this request.
|
||||
|
|
|
@ -10324,7 +10324,7 @@ nsGlobalChromeWindow::BeginWindowMove(nsIDOMEvent *aMouseDownEvent, nsIDOMElemen
|
|||
nsIFrame* frame = panel->GetPrimaryFrame();
|
||||
NS_ENSURE_TRUE(frame && frame->GetType() == nsGkAtoms::menuPopupFrame, NS_OK);
|
||||
|
||||
widget = (static_cast<nsMenuPopupFrame*>(frame))->GetWidget();
|
||||
(static_cast<nsMenuPopupFrame*>(frame))->GetWidget(getter_AddRefs(widget));
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
|
|
|
@ -1888,19 +1888,14 @@ DocumentViewerImpl::SetBounds(const nsIntRect& aBounds)
|
|||
// window frame.
|
||||
// Don't have the widget repaint. Layout will generate repaint requests
|
||||
// during reflow.
|
||||
if (mAttachedToParent) {
|
||||
if (aBounds.x != 0 || aBounds.y != 0) {
|
||||
mWindow->ResizeClient(aBounds.x, aBounds.y,
|
||||
aBounds.width, aBounds.height,
|
||||
false);
|
||||
} else {
|
||||
mWindow->ResizeClient(aBounds.width, aBounds.height, false);
|
||||
}
|
||||
} else {
|
||||
if (mAttachedToParent)
|
||||
mWindow->ResizeClient(aBounds.x, aBounds.y,
|
||||
aBounds.width, aBounds.height,
|
||||
false);
|
||||
else
|
||||
mWindow->Resize(aBounds.x, aBounds.y,
|
||||
aBounds.width, aBounds.height,
|
||||
false);
|
||||
}
|
||||
} else if (mPresContext && mViewManager) {
|
||||
PRInt32 p2a = mPresContext->AppUnitsPerDevPixel();
|
||||
mViewManager->SetWindowDimensions(NSIntPixelsToAppUnits(mBounds.width, p2a),
|
||||
|
|
|
@ -115,7 +115,6 @@ nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell, nsStyleContext* aContex
|
|||
:nsBoxFrame(aShell, aContext),
|
||||
mCurrentMenu(nsnull),
|
||||
mPrefSize(-1, -1),
|
||||
mLastClientOffset(0, 0),
|
||||
mPopupType(ePopupTypePanel),
|
||||
mPopupState(ePopupClosed),
|
||||
mPopupAlignment(POPUPALIGNMENT_NONE),
|
||||
|
@ -487,6 +486,21 @@ nsMenuPopupFrame::LayoutPopup(nsBoxLayoutState& aState, nsIFrame* aParentMenu, b
|
|||
nsRect rect = GetRect();
|
||||
rect.x = rect.y = 0;
|
||||
|
||||
// Increase the popup's view size to account for any titlebar or borders.
|
||||
// XXXndeakin this should really be accounted for earlier in
|
||||
// SetPopupPosition so that this extra size is accounted for when flipping
|
||||
// or resizing the popup due to it being too large, but that can be a
|
||||
// followup bug.
|
||||
if (mPopupType == ePopupTypePanel && view) {
|
||||
nsIWidget* widget = view->GetWidget();
|
||||
if (widget) {
|
||||
nsIntSize popupSize = nsIntSize(pc->AppUnitsToDevPixels(rect.width),
|
||||
pc->AppUnitsToDevPixels(rect.height));
|
||||
popupSize = widget->ClientToWindowSize(popupSize);
|
||||
rect.width = pc->DevPixelsToAppUnits(popupSize.width);
|
||||
rect.height = pc->DevPixelsToAppUnits(popupSize.height);
|
||||
}
|
||||
}
|
||||
viewManager->ResizeView(view, rect);
|
||||
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
|
@ -1304,6 +1318,8 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove)
|
|||
|
||||
nsIView* view = GetView();
|
||||
NS_ASSERTION(view, "popup with no view");
|
||||
presContext->GetPresShell()->GetViewManager()->
|
||||
MoveViewTo(view, viewPoint.x, viewPoint.y);
|
||||
|
||||
// Offset the position by the width and height of the borders and titlebar.
|
||||
// Even though GetClientOffset should return (0, 0) when there is no
|
||||
|
@ -1311,14 +1327,11 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove)
|
|||
// to save time since they will never have a titlebar.
|
||||
nsIWidget* widget = view->GetWidget();
|
||||
if (mPopupType == ePopupTypePanel && widget) {
|
||||
mLastClientOffset = widget->GetClientOffset();
|
||||
viewPoint.x += presContext->DevPixelsToAppUnits(mLastClientOffset.x);
|
||||
viewPoint.y += presContext->DevPixelsToAppUnits(mLastClientOffset.y);
|
||||
nsIntPoint offset = widget->GetClientOffset();
|
||||
viewPoint.x += presContext->DevPixelsToAppUnits(offset.x);
|
||||
viewPoint.y += presContext->DevPixelsToAppUnits(offset.y);
|
||||
}
|
||||
|
||||
presContext->GetPresShell()->GetViewManager()->
|
||||
MoveViewTo(view, viewPoint.x, viewPoint.y);
|
||||
|
||||
// Now that we've positioned the view, sync up the frame's origin.
|
||||
nsBoxFrame::SetPosition(viewPoint - GetParent()->GetOffsetTo(rootFrame));
|
||||
|
||||
|
@ -1750,14 +1763,16 @@ nsMenuPopupFrame::LockMenuUntilClosed(bool aLock)
|
|||
}
|
||||
}
|
||||
|
||||
nsIWidget*
|
||||
nsMenuPopupFrame::GetWidget()
|
||||
NS_IMETHODIMP
|
||||
nsMenuPopupFrame::GetWidget(nsIWidget **aWidget)
|
||||
{
|
||||
nsIView * view = GetRootViewForPopup(this);
|
||||
if (!view)
|
||||
return nsnull;
|
||||
return NS_OK;
|
||||
|
||||
return view->GetWidget();
|
||||
*aWidget = view->GetWidget();
|
||||
NS_IF_ADDREF(*aWidget);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1856,11 +1871,8 @@ nsMenuPopupFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
|||
void
|
||||
nsMenuPopupFrame::MoveTo(PRInt32 aLeft, PRInt32 aTop, bool aUpdateAttrs)
|
||||
{
|
||||
nsIWidget* widget = GetWidget();
|
||||
if ((mScreenXPos == aLeft && mScreenYPos == aTop) &&
|
||||
(!widget || widget->GetClientOffset() == mLastClientOffset)) {
|
||||
if (mScreenXPos == aLeft && mScreenYPos == aTop)
|
||||
return;
|
||||
}
|
||||
|
||||
// reposition the popup at the specified coordinates. Don't clear the anchor
|
||||
// and position, because the popup can be reset to its anchor position by
|
||||
|
|
|
@ -176,7 +176,7 @@ public:
|
|||
virtual void LockMenuUntilClosed(bool aLock);
|
||||
virtual bool IsMenuLocked() { return mIsMenuLocked; }
|
||||
|
||||
nsIWidget* GetWidget();
|
||||
NS_IMETHOD GetWidget(nsIWidget **aWidget);
|
||||
|
||||
// The dismissal listener gets created and attached to the window.
|
||||
void AttachedDismissalListener();
|
||||
|
@ -352,9 +352,6 @@ public:
|
|||
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists);
|
||||
|
||||
nsIntPoint GetLastClientOffset() const { return mLastClientOffset; }
|
||||
|
||||
protected:
|
||||
|
||||
// returns the popup's level.
|
||||
|
@ -438,10 +435,6 @@ protected:
|
|||
PRInt32 mYPos;
|
||||
PRInt32 mScreenXPos;
|
||||
PRInt32 mScreenYPos;
|
||||
// The value of the client offset of our widget the last time we positioned
|
||||
// ourselves. We store this so that we can detect when it changes but the
|
||||
// position of our widget didn't change.
|
||||
nsIntPoint mLastClientOffset;
|
||||
|
||||
nsPopupType mPopupType; // type of popup
|
||||
nsPopupState mPopupState; // open state of the popup
|
||||
|
|
|
@ -259,7 +259,8 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
nsIntRect oldRect;
|
||||
nsWeakFrame weakFrame(menuPopupFrame);
|
||||
if (menuPopupFrame) {
|
||||
nsCOMPtr<nsIWidget> widget = menuPopupFrame->GetWidget();
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
menuPopupFrame->GetWidget(getter_AddRefs(widget));
|
||||
if (widget)
|
||||
widget->GetScreenBounds(oldRect);
|
||||
|
||||
|
|
|
@ -161,7 +161,8 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
// move the widget associated with the window
|
||||
if (parent) {
|
||||
nsMenuPopupFrame* menuPopupFrame = static_cast<nsMenuPopupFrame*>(parent);
|
||||
nsCOMPtr<nsIWidget> widget = menuPopupFrame->GetWidget();
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
menuPopupFrame->GetWidget(getter_AddRefs(widget));
|
||||
nsIntRect bounds;
|
||||
widget->GetScreenBounds(bounds);
|
||||
menuPopupFrame->MoveTo(bounds.x + nsMoveBy.x, bounds.y + nsMoveBy.y, false);
|
||||
|
|
|
@ -283,7 +283,8 @@ nsXULPopupManager::GetSubmenuWidgetChain(nsTArray<nsIWidget*> *aWidgetChain)
|
|||
NS_ASSERTION(aWidgetChain, "null parameter");
|
||||
nsMenuChainItem* item = GetTopVisibleMenu();
|
||||
while (item) {
|
||||
nsCOMPtr<nsIWidget> widget = item->Frame()->GetWidget();
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
item->Frame()->GetWidget(getter_AddRefs(widget));
|
||||
NS_ASSERTION(widget, "open popup has no widget");
|
||||
aWidgetChain->AppendElement(widget.get());
|
||||
// In the case when a menulist inside a panel is open, clicking in the
|
||||
|
@ -358,9 +359,7 @@ 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.
|
||||
nsIntPoint currentPnt = menuPopupFrame->ScreenPosition();
|
||||
nsIWidget* widget = menuPopupFrame->GetWidget();
|
||||
if ((aPnt.x != currentPnt.x || aPnt.y != currentPnt.y) || (widget &&
|
||||
widget->GetClientOffset() != menuPopupFrame->GetLastClientOffset())) {
|
||||
if (aPnt.x != currentPnt.x || aPnt.y != currentPnt.y) {
|
||||
// Update the popup's position using SetPopupPosition if the popup is
|
||||
// anchored and at the parent level as these maintain their position
|
||||
// relative to the parent window. Otherwise, just update the popup to
|
||||
|
@ -1465,7 +1464,8 @@ nsXULPopupManager::MayShowPopup(nsMenuPopupFrame* aPopup)
|
|||
}
|
||||
|
||||
// if the popup was just rolled up, don't reopen it
|
||||
nsCOMPtr<nsIWidget> widget = aPopup->GetWidget();
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
aPopup->GetWidget(getter_AddRefs(widget));
|
||||
if (widget && widget->GetLastRollup() == aPopup->GetContent())
|
||||
return false;
|
||||
|
||||
|
@ -1618,7 +1618,8 @@ nsXULPopupManager::SetCaptureState(nsIContent* aOldPopup)
|
|||
|
||||
if (item) {
|
||||
nsMenuPopupFrame* popup = item->Frame();
|
||||
nsCOMPtr<nsIWidget> widget = popup->GetWidget();
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
popup->GetWidget(getter_AddRefs(widget));
|
||||
if (widget) {
|
||||
widget->CaptureRollupEvents(this, true, popup->ConsumeOutsideClicks());
|
||||
mWidget = widget;
|
||||
|
|
|
@ -438,7 +438,7 @@ void nsView::DoResetWidgetBounds(bool aMoveOnly,
|
|||
}
|
||||
|
||||
nsIntRect curBounds;
|
||||
mWindow->GetClientBounds(curBounds);
|
||||
mWindow->GetBounds(curBounds);
|
||||
|
||||
nsWindowType type;
|
||||
mWindow->GetWindowType(type);
|
||||
|
@ -462,16 +462,14 @@ void nsView::DoResetWidgetBounds(bool aMoveOnly,
|
|||
// Child views are never attached to top level widgets, this is safe.
|
||||
if (changedPos) {
|
||||
if (changedSize && !aMoveOnly) {
|
||||
mWindow->ResizeClient(newBounds.x, newBounds.y,
|
||||
newBounds.width, newBounds.height,
|
||||
aInvalidateChangedSize);
|
||||
mWindow->Resize(newBounds.x, newBounds.y, newBounds.width, newBounds.height,
|
||||
aInvalidateChangedSize);
|
||||
} else {
|
||||
mWindow->MoveClient(newBounds.x, newBounds.y);
|
||||
mWindow->Move(newBounds.x, newBounds.y);
|
||||
}
|
||||
} else {
|
||||
if (changedSize && !aMoveOnly) {
|
||||
mWindow->ResizeClient(newBounds.width, newBounds.height,
|
||||
aInvalidateChangedSize);
|
||||
mWindow->Resize(newBounds.width, newBounds.height, aInvalidateChangedSize);
|
||||
} // else do nothing!
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
|
|||
#endif
|
||||
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0x41fc0f2c, 0x65c2, 0x418e, \
|
||||
{ 0x89, 0x91, 0x5f, 0x0c, 0xa7, 0x01, 0x05, 0x34 } }
|
||||
{ 0x34460b01, 0x3dc2, 0x4b58, \
|
||||
{ 0x8e, 0xd3, 0x7e, 0x7c, 0x33, 0xb5, 0x78, 0x8b } }
|
||||
/*
|
||||
* Window shadow styles
|
||||
* Also used for the -moz-window-shadow CSS property
|
||||
|
@ -672,21 +672,6 @@ class nsIWidget : public nsISupports {
|
|||
**/
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Reposition this widget so that the client area has the given offset.
|
||||
*
|
||||
* @param aX the new x offset of the client area expressed as an
|
||||
* offset from the origin of the client area of the parent
|
||||
* widget (for root widgets and popup widgets it is in
|
||||
* screen coordinates)
|
||||
* @param aY the new y offset of the client area expressed as an
|
||||
* offset from the origin of the client area of the parent
|
||||
* widget (for root widgets and popup widgets it is in
|
||||
* screen coordinates)
|
||||
*
|
||||
**/
|
||||
NS_IMETHOD MoveClient(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Resize this widget.
|
||||
*
|
||||
|
@ -716,29 +701,10 @@ class nsIWidget : public nsISupports {
|
|||
bool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Resize the widget so that the inner client area has the given size.
|
||||
* Resize and reposition the inner client area of the widget.
|
||||
*
|
||||
* @param aWidth the new width of the client area.
|
||||
* @param aHeight the new height of the client area.
|
||||
* @param aRepaint whether the widget should be repainted
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD ResizeClient(PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
bool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Resize and reposition the widget so tht inner client area has the given
|
||||
* offset and size.
|
||||
*
|
||||
* @param aX the new x offset of the client area expressed as an
|
||||
* offset from the origin of the client area of the parent
|
||||
* widget (for root widgets and popup widgets it is in
|
||||
* screen coordinates)
|
||||
* @param aY the new y offset of the client area expressed as an
|
||||
* offset from the origin of the client area of the parent
|
||||
* widget (for root widgets and popup widgets it is in
|
||||
* screen coordinates)
|
||||
* @param aX the new x offset expressed in the parent's coordinate system
|
||||
* @param aY the new y offset expressed in the parent's coordinate system
|
||||
* @param aWidth the new width of the client area.
|
||||
* @param aHeight the new height of the client area.
|
||||
* @param aRepaint whether the widget should be repainted
|
||||
|
@ -833,10 +799,9 @@ class nsIWidget : public nsISupports {
|
|||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect) = 0;
|
||||
|
||||
/**
|
||||
* Get this widget's client area bounds, if the window has a 3D border
|
||||
* appearance this returns the area inside the border. The position is the
|
||||
* position of the client area relative to the client area of the parent
|
||||
* widget (for root widgets and popup widgets it is in screen coordinates).
|
||||
* Get this widget's client area dimensions, if the window has a 3D
|
||||
* border appearance this returns the area inside the border. Origin
|
||||
* is always zero.
|
||||
*
|
||||
* @param aRect On return it holds the x. y, width and height of
|
||||
* the client area of this widget.
|
||||
|
|
|
@ -1579,57 +1579,6 @@ nsWindow::GetScreenBounds(nsIntRect &aRect)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::GetClientBounds(nsIntRect &aRect)
|
||||
{
|
||||
// GetBounds returns a rect whose top left represents the top left of the
|
||||
// outer bounds, but whose width/height represent the size of the inner
|
||||
// bounds (which is messed up).
|
||||
GetBounds(aRect);
|
||||
aRect.MoveBy(GetClientOffset());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsWindow::GetClientOffset()
|
||||
{
|
||||
if (!mIsTopLevel) {
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
GdkAtom cardinal_atom = gdk_x11_xatom_to_atom(XA_CARDINAL);
|
||||
|
||||
GdkAtom type_returned;
|
||||
int format_returned;
|
||||
int length_returned;
|
||||
long *frame_extents;
|
||||
|
||||
if (!mShell || !mShell->window ||
|
||||
!gdk_property_get(mShell->window,
|
||||
gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE),
|
||||
cardinal_atom,
|
||||
0, // offset
|
||||
4*4, // length
|
||||
FALSE, // delete
|
||||
&type_returned,
|
||||
&format_returned,
|
||||
&length_returned,
|
||||
(guchar **) &frame_extents) ||
|
||||
length_returned/sizeof(glong) != 4) {
|
||||
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
// data returned is in the order left, right, top, bottom
|
||||
PRInt32 left = PRInt32(frame_extents[0]);
|
||||
PRInt32 top = PRInt32(frame_extents[2]);
|
||||
|
||||
g_free(frame_extents);
|
||||
|
||||
return nsIntPoint(left, top);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::SetForegroundColor(const nscolor &aColor)
|
||||
{
|
||||
|
@ -2390,16 +2339,17 @@ nsWindow::OnConfigureEvent(GtkWidget *aWidget, GdkEventConfigure *aEvent)
|
|||
LOG(("configure event [%p] %d %d %d %d\n", (void *)this,
|
||||
aEvent->x, aEvent->y, aEvent->width, aEvent->height));
|
||||
|
||||
nsIntRect screenBounds;
|
||||
GetScreenBounds(screenBounds);
|
||||
// mBounds.x/y are set to the window manager frame top-left when Move() or
|
||||
// Resize()d from within Gecko, so comparing with the client window
|
||||
// top-left is weird. However, mBounds.x/y are set to client window
|
||||
// position below, so this check avoids unwanted rollup on spurious
|
||||
// configure events from Cygwin/X (bug 672103).
|
||||
if (mBounds.x == aEvent->x &&
|
||||
mBounds.y == aEvent->y)
|
||||
return FALSE;
|
||||
|
||||
if (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog) {
|
||||
// This check avoids unwanted rollup on spurious configure events from
|
||||
// Cygwin/X (bug 672103).
|
||||
if (mBounds.x != screenBounds.x ||
|
||||
mBounds.y != screenBounds.y) {
|
||||
check_for_rollup(aEvent->window, 0, 0, false, true);
|
||||
}
|
||||
check_for_rollup(aEvent->window, 0, 0, false, true);
|
||||
}
|
||||
|
||||
// This event indicates that the window position may have changed.
|
||||
|
@ -2427,7 +2377,11 @@ nsWindow::OnConfigureEvent(GtkWidget *aWidget, GdkEventConfigure *aEvent)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
mBounds.MoveTo(screenBounds.TopLeft());
|
||||
// This is wrong, but noautohide titlebar panels currently depend on it
|
||||
// (bug 601545#c13). mBounds.TopLeft() should refer to the
|
||||
// window-manager frame top-left, but WidgetToScreenOffset() gives the
|
||||
// client window origin.
|
||||
mBounds.MoveTo(WidgetToScreenOffset());
|
||||
|
||||
nsGUIEvent event(true, NS_MOVE, this);
|
||||
|
||||
|
|
|
@ -170,8 +170,6 @@ public:
|
|||
NS_IMETHOD Enable(bool aState);
|
||||
NS_IMETHOD SetFocus(bool aRaise = false);
|
||||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
||||
virtual nsIntPoint GetClientOffset();
|
||||
NS_IMETHOD SetForegroundColor(const nscolor &aColor);
|
||||
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||
|
|
|
@ -769,7 +769,10 @@ NS_METHOD nsWindow::GetBounds(nsIntRect& aRect)
|
|||
|
||||
NS_METHOD nsWindow::GetClientBounds(nsIntRect& aRect)
|
||||
{
|
||||
aRect = mBounds;
|
||||
aRect.x = 0;
|
||||
aRect.y = 0;
|
||||
aRect.width = mBounds.width;
|
||||
aRect.height = mBounds.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1185,8 +1185,6 @@ nsTextStore::GetScreenExt(TsViewCookie vcView,
|
|||
nsresult rv = refWindow->GetClientBounds(boundRect);
|
||||
NS_ENSURE_SUCCESS(rv, E_FAIL);
|
||||
|
||||
boundRect.MoveTo(0, 0);
|
||||
|
||||
// Clip frame rect to window rect
|
||||
boundRect.IntersectRect(event.mReply.mRect, boundRect);
|
||||
if (!boundRect.IsEmpty()) {
|
||||
|
|
|
@ -1523,6 +1523,30 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeig
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Resize the client area and position the widget within it's parent
|
||||
NS_METHOD nsWindow::ResizeClient(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, bool aRepaint)
|
||||
{
|
||||
NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
|
||||
NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
|
||||
|
||||
// Adjust our existing window bounds, based on the new client dims.
|
||||
RECT client;
|
||||
GetClientRect(mWnd, &client);
|
||||
nsIntPoint dims(client.right - client.left, client.bottom - client.top);
|
||||
aWidth = mBounds.width + (aWidth - dims.x);
|
||||
aHeight = mBounds.height + (aHeight - dims.y);
|
||||
|
||||
if (aX || aY) {
|
||||
// offsets
|
||||
nsIntRect bounds;
|
||||
GetScreenBounds(bounds);
|
||||
aX += bounds.x;
|
||||
aY += bounds.y;
|
||||
return Resize(aX, aY, aWidth, aHeight, aRepaint);
|
||||
}
|
||||
return Resize(aWidth, aHeight, aRepaint);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical)
|
||||
{
|
||||
|
@ -1906,9 +1930,9 @@ NS_METHOD nsWindow::GetClientBounds(nsIntRect &aRect)
|
|||
RECT r;
|
||||
VERIFY(::GetClientRect(mWnd, &r));
|
||||
|
||||
nsIntRect bounds;
|
||||
GetBounds(bounds);
|
||||
aRect.MoveTo(bounds.TopLeft() + GetClientOffset());
|
||||
// assign size
|
||||
aRect.x = 0;
|
||||
aRect.y = 0;
|
||||
aRect.width = r.right - r.left;
|
||||
aRect.height = r.bottom - r.top;
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ public:
|
|||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
||||
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
||||
NS_IMETHOD ResizeClient(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
||||
NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
|
||||
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate);
|
||||
NS_IMETHOD SetSizeMode(PRInt32 aMode);
|
||||
|
|
|
@ -300,6 +300,15 @@ NS_IMETHODIMP nsBaseWidget::SetAttachedViewPtr(ViewWrapper* aViewWrapper)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsBaseWidget::ResizeClient(PRInt32 aX,
|
||||
PRInt32 aY,
|
||||
PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
return Resize(aX, aY, aWidth, aHeight, aRepaint);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Close this nsBaseWidget
|
||||
|
@ -910,50 +919,6 @@ NS_METHOD nsBaseWidget::SetWindowClass(const nsAString& xulWinType)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_METHOD nsBaseWidget::MoveClient(PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
nsIntPoint clientOffset(GetClientOffset());
|
||||
aX -= clientOffset.x;
|
||||
aY -= clientOffset.y;
|
||||
return Move(aX, aY);
|
||||
}
|
||||
|
||||
NS_METHOD nsBaseWidget::ResizeClient(PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
|
||||
NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
|
||||
|
||||
nsIntRect clientBounds;
|
||||
GetClientBounds(clientBounds);
|
||||
aWidth = mBounds.width + (aWidth - clientBounds.width);
|
||||
aHeight = mBounds.height + (aHeight - clientBounds.height);
|
||||
|
||||
return Resize(aWidth, aHeight, aRepaint);
|
||||
}
|
||||
|
||||
NS_METHOD nsBaseWidget::ResizeClient(PRInt32 aX,
|
||||
PRInt32 aY,
|
||||
PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
|
||||
NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
|
||||
|
||||
nsIntRect clientBounds;
|
||||
GetClientBounds(clientBounds);
|
||||
aWidth = mBounds.width + (aWidth - clientBounds.width);
|
||||
aHeight = mBounds.height + (aHeight - clientBounds.height);
|
||||
|
||||
nsIntPoint clientOffset(GetClientOffset());
|
||||
aX -= clientOffset.x;
|
||||
aY -= clientOffset.y;
|
||||
|
||||
return Resize(aX, aY, aWidth, aHeight, aRepaint);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Bounds
|
||||
|
|
|
@ -122,15 +122,10 @@ public:
|
|||
virtual gfxASurface* GetThebesSurface();
|
||||
NS_IMETHOD SetModal(bool aModal);
|
||||
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
|
||||
NS_IMETHOD MoveClient(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD ResizeClient(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
||||
NS_IMETHOD ResizeClient(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
||||
NS_IMETHOD SetBounds(const nsIntRect &aRect);
|
||||
NS_IMETHOD GetBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD GetNonClientMargins(nsIntMargin &margins);
|
||||
NS_IMETHOD SetNonClientMargins(nsIntMargin &margins);
|
||||
virtual nsIntPoint GetClientOffset();
|
||||
NS_IMETHOD EnableDragDrop(bool aEnable);
|
||||
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
||||
|
@ -168,6 +163,9 @@ public:
|
|||
NS_IMETHOD AttachViewToTopLevel(EVENT_CALLBACK aViewEventFunction, nsDeviceContext *aContext);
|
||||
virtual ViewWrapper* GetAttachedViewPtr();
|
||||
NS_IMETHOD SetAttachedViewPtr(ViewWrapper* aViewWrapper);
|
||||
NS_IMETHOD ResizeClient(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
||||
NS_IMETHOD GetNonClientMargins(nsIntMargin &margins);
|
||||
NS_IMETHOD SetNonClientMargins(nsIntMargin &margins);
|
||||
NS_IMETHOD RegisterTouchWindow();
|
||||
NS_IMETHOD UnregisterTouchWindow();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче