зеркало из 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,
|
targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree,
|
||||||
kNameSpaceID_XUL)) {
|
kNameSpaceID_XUL)) {
|
||||||
treeAcc = do_QueryObject(accessible);
|
treeAcc = do_QueryObject(accessible);
|
||||||
if (treeAcc) {
|
|
||||||
if (eventType.EqualsLiteral("TreeViewChanged")) {
|
|
||||||
treeAcc->TreeViewChanged();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
|
if (eventType.EqualsLiteral("TreeViewChanged")) {
|
||||||
HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
|
treeAcc->TreeViewChanged();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventType.EqualsLiteral("TreeInvalidated")) {
|
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
|
||||||
HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
|
HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (eventType.EqualsLiteral("TreeInvalidated")) {
|
||||||
|
HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1327,7 +1327,6 @@ nsDOMWindowUtils::SendQueryContentEvent(PRUint32 aType,
|
||||||
nsIntRect widgetBounds;
|
nsIntRect widgetBounds;
|
||||||
nsresult rv = widget->GetClientBounds(widgetBounds);
|
nsresult rv = widget->GetClientBounds(widgetBounds);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
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,
|
// There is no popup frame at the point and the point isn't in our widget,
|
||||||
// we cannot process this request.
|
// we cannot process this request.
|
||||||
|
|
|
@ -10324,7 +10324,7 @@ nsGlobalChromeWindow::BeginWindowMove(nsIDOMEvent *aMouseDownEvent, nsIDOMElemen
|
||||||
nsIFrame* frame = panel->GetPrimaryFrame();
|
nsIFrame* frame = panel->GetPrimaryFrame();
|
||||||
NS_ENSURE_TRUE(frame && frame->GetType() == nsGkAtoms::menuPopupFrame, NS_OK);
|
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 {
|
else {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1888,19 +1888,14 @@ DocumentViewerImpl::SetBounds(const nsIntRect& aBounds)
|
||||||
// window frame.
|
// window frame.
|
||||||
// Don't have the widget repaint. Layout will generate repaint requests
|
// Don't have the widget repaint. Layout will generate repaint requests
|
||||||
// during reflow.
|
// during reflow.
|
||||||
if (mAttachedToParent) {
|
if (mAttachedToParent)
|
||||||
if (aBounds.x != 0 || aBounds.y != 0) {
|
mWindow->ResizeClient(aBounds.x, aBounds.y,
|
||||||
mWindow->ResizeClient(aBounds.x, aBounds.y,
|
aBounds.width, aBounds.height,
|
||||||
aBounds.width, aBounds.height,
|
false);
|
||||||
false);
|
else
|
||||||
} else {
|
|
||||||
mWindow->ResizeClient(aBounds.width, aBounds.height, false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mWindow->Resize(aBounds.x, aBounds.y,
|
mWindow->Resize(aBounds.x, aBounds.y,
|
||||||
aBounds.width, aBounds.height,
|
aBounds.width, aBounds.height,
|
||||||
false);
|
false);
|
||||||
}
|
|
||||||
} else if (mPresContext && mViewManager) {
|
} else if (mPresContext && mViewManager) {
|
||||||
PRInt32 p2a = mPresContext->AppUnitsPerDevPixel();
|
PRInt32 p2a = mPresContext->AppUnitsPerDevPixel();
|
||||||
mViewManager->SetWindowDimensions(NSIntPixelsToAppUnits(mBounds.width, p2a),
|
mViewManager->SetWindowDimensions(NSIntPixelsToAppUnits(mBounds.width, p2a),
|
||||||
|
|
|
@ -115,7 +115,6 @@ nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell, nsStyleContext* aContex
|
||||||
:nsBoxFrame(aShell, aContext),
|
:nsBoxFrame(aShell, aContext),
|
||||||
mCurrentMenu(nsnull),
|
mCurrentMenu(nsnull),
|
||||||
mPrefSize(-1, -1),
|
mPrefSize(-1, -1),
|
||||||
mLastClientOffset(0, 0),
|
|
||||||
mPopupType(ePopupTypePanel),
|
mPopupType(ePopupTypePanel),
|
||||||
mPopupState(ePopupClosed),
|
mPopupState(ePopupClosed),
|
||||||
mPopupAlignment(POPUPALIGNMENT_NONE),
|
mPopupAlignment(POPUPALIGNMENT_NONE),
|
||||||
|
@ -487,6 +486,21 @@ nsMenuPopupFrame::LayoutPopup(nsBoxLayoutState& aState, nsIFrame* aParentMenu, b
|
||||||
nsRect rect = GetRect();
|
nsRect rect = GetRect();
|
||||||
rect.x = rect.y = 0;
|
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->ResizeView(view, rect);
|
||||||
|
|
||||||
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||||
|
@ -1304,6 +1318,8 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove)
|
||||||
|
|
||||||
nsIView* view = GetView();
|
nsIView* view = GetView();
|
||||||
NS_ASSERTION(view, "popup with no view");
|
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.
|
// Offset the position by the width and height of the borders and titlebar.
|
||||||
// Even though GetClientOffset should return (0, 0) when there is no
|
// 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.
|
// to save time since they will never have a titlebar.
|
||||||
nsIWidget* widget = view->GetWidget();
|
nsIWidget* widget = view->GetWidget();
|
||||||
if (mPopupType == ePopupTypePanel && widget) {
|
if (mPopupType == ePopupTypePanel && widget) {
|
||||||
mLastClientOffset = widget->GetClientOffset();
|
nsIntPoint offset = widget->GetClientOffset();
|
||||||
viewPoint.x += presContext->DevPixelsToAppUnits(mLastClientOffset.x);
|
viewPoint.x += presContext->DevPixelsToAppUnits(offset.x);
|
||||||
viewPoint.y += presContext->DevPixelsToAppUnits(mLastClientOffset.y);
|
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.
|
// Now that we've positioned the view, sync up the frame's origin.
|
||||||
nsBoxFrame::SetPosition(viewPoint - GetParent()->GetOffsetTo(rootFrame));
|
nsBoxFrame::SetPosition(viewPoint - GetParent()->GetOffsetTo(rootFrame));
|
||||||
|
|
||||||
|
@ -1750,14 +1763,16 @@ nsMenuPopupFrame::LockMenuUntilClosed(bool aLock)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIWidget*
|
NS_IMETHODIMP
|
||||||
nsMenuPopupFrame::GetWidget()
|
nsMenuPopupFrame::GetWidget(nsIWidget **aWidget)
|
||||||
{
|
{
|
||||||
nsIView * view = GetRootViewForPopup(this);
|
nsIView * view = GetRootViewForPopup(this);
|
||||||
if (!view)
|
if (!view)
|
||||||
return nsnull;
|
return NS_OK;
|
||||||
|
|
||||||
return view->GetWidget();
|
*aWidget = view->GetWidget();
|
||||||
|
NS_IF_ADDREF(*aWidget);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1856,11 +1871,8 @@ nsMenuPopupFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||||
void
|
void
|
||||||
nsMenuPopupFrame::MoveTo(PRInt32 aLeft, PRInt32 aTop, bool aUpdateAttrs)
|
nsMenuPopupFrame::MoveTo(PRInt32 aLeft, PRInt32 aTop, bool aUpdateAttrs)
|
||||||
{
|
{
|
||||||
nsIWidget* widget = GetWidget();
|
if (mScreenXPos == aLeft && mScreenYPos == aTop)
|
||||||
if ((mScreenXPos == aLeft && mScreenYPos == aTop) &&
|
|
||||||
(!widget || widget->GetClientOffset() == mLastClientOffset)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// reposition the popup at the specified coordinates. Don't clear the anchor
|
// 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
|
// and position, because the popup can be reset to its anchor position by
|
||||||
|
|
|
@ -176,7 +176,7 @@ public:
|
||||||
virtual void LockMenuUntilClosed(bool aLock);
|
virtual void LockMenuUntilClosed(bool aLock);
|
||||||
virtual bool IsMenuLocked() { return mIsMenuLocked; }
|
virtual bool IsMenuLocked() { return mIsMenuLocked; }
|
||||||
|
|
||||||
nsIWidget* GetWidget();
|
NS_IMETHOD GetWidget(nsIWidget **aWidget);
|
||||||
|
|
||||||
// The dismissal listener gets created and attached to the window.
|
// The dismissal listener gets created and attached to the window.
|
||||||
void AttachedDismissalListener();
|
void AttachedDismissalListener();
|
||||||
|
@ -352,9 +352,6 @@ public:
|
||||||
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsDisplayListSet& aLists);
|
const nsDisplayListSet& aLists);
|
||||||
|
|
||||||
nsIntPoint GetLastClientOffset() const { return mLastClientOffset; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// returns the popup's level.
|
// returns the popup's level.
|
||||||
|
@ -438,10 +435,6 @@ protected:
|
||||||
PRInt32 mYPos;
|
PRInt32 mYPos;
|
||||||
PRInt32 mScreenXPos;
|
PRInt32 mScreenXPos;
|
||||||
PRInt32 mScreenYPos;
|
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
|
nsPopupType mPopupType; // type of popup
|
||||||
nsPopupState mPopupState; // open state of the popup
|
nsPopupState mPopupState; // open state of the popup
|
||||||
|
|
|
@ -259,7 +259,8 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
||||||
nsIntRect oldRect;
|
nsIntRect oldRect;
|
||||||
nsWeakFrame weakFrame(menuPopupFrame);
|
nsWeakFrame weakFrame(menuPopupFrame);
|
||||||
if (menuPopupFrame) {
|
if (menuPopupFrame) {
|
||||||
nsCOMPtr<nsIWidget> widget = menuPopupFrame->GetWidget();
|
nsCOMPtr<nsIWidget> widget;
|
||||||
|
menuPopupFrame->GetWidget(getter_AddRefs(widget));
|
||||||
if (widget)
|
if (widget)
|
||||||
widget->GetScreenBounds(oldRect);
|
widget->GetScreenBounds(oldRect);
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,8 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
||||||
// move the widget associated with the window
|
// move the widget associated with the window
|
||||||
if (parent) {
|
if (parent) {
|
||||||
nsMenuPopupFrame* menuPopupFrame = static_cast<nsMenuPopupFrame*>(parent);
|
nsMenuPopupFrame* menuPopupFrame = static_cast<nsMenuPopupFrame*>(parent);
|
||||||
nsCOMPtr<nsIWidget> widget = menuPopupFrame->GetWidget();
|
nsCOMPtr<nsIWidget> widget;
|
||||||
|
menuPopupFrame->GetWidget(getter_AddRefs(widget));
|
||||||
nsIntRect bounds;
|
nsIntRect bounds;
|
||||||
widget->GetScreenBounds(bounds);
|
widget->GetScreenBounds(bounds);
|
||||||
menuPopupFrame->MoveTo(bounds.x + nsMoveBy.x, bounds.y + nsMoveBy.y, false);
|
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");
|
NS_ASSERTION(aWidgetChain, "null parameter");
|
||||||
nsMenuChainItem* item = GetTopVisibleMenu();
|
nsMenuChainItem* item = GetTopVisibleMenu();
|
||||||
while (item) {
|
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");
|
NS_ASSERTION(widget, "open popup has no widget");
|
||||||
aWidgetChain->AppendElement(widget.get());
|
aWidgetChain->AppendElement(widget.get());
|
||||||
// In the case when a menulist inside a panel is open, clicking in the
|
// 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
|
// Don't do anything if the popup is already at the specified location. This
|
||||||
// prevents recursive calls when a popup is positioned.
|
// prevents recursive calls when a popup is positioned.
|
||||||
nsIntPoint currentPnt = menuPopupFrame->ScreenPosition();
|
nsIntPoint currentPnt = menuPopupFrame->ScreenPosition();
|
||||||
nsIWidget* widget = menuPopupFrame->GetWidget();
|
if (aPnt.x != currentPnt.x || aPnt.y != currentPnt.y) {
|
||||||
if ((aPnt.x != currentPnt.x || aPnt.y != currentPnt.y) || (widget &&
|
|
||||||
widget->GetClientOffset() != menuPopupFrame->GetLastClientOffset())) {
|
|
||||||
// Update the popup's position using SetPopupPosition if the popup is
|
// Update the popup's position using SetPopupPosition if the popup is
|
||||||
// anchored and at the parent level as these maintain their position
|
// anchored and at the parent level as these maintain their position
|
||||||
// relative to the parent window. Otherwise, just update the popup to
|
// 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
|
// 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())
|
if (widget && widget->GetLastRollup() == aPopup->GetContent())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1618,7 +1618,8 @@ nsXULPopupManager::SetCaptureState(nsIContent* aOldPopup)
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
nsMenuPopupFrame* popup = item->Frame();
|
nsMenuPopupFrame* popup = item->Frame();
|
||||||
nsCOMPtr<nsIWidget> widget = popup->GetWidget();
|
nsCOMPtr<nsIWidget> widget;
|
||||||
|
popup->GetWidget(getter_AddRefs(widget));
|
||||||
if (widget) {
|
if (widget) {
|
||||||
widget->CaptureRollupEvents(this, true, popup->ConsumeOutsideClicks());
|
widget->CaptureRollupEvents(this, true, popup->ConsumeOutsideClicks());
|
||||||
mWidget = widget;
|
mWidget = widget;
|
||||||
|
|
|
@ -438,7 +438,7 @@ void nsView::DoResetWidgetBounds(bool aMoveOnly,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect curBounds;
|
nsIntRect curBounds;
|
||||||
mWindow->GetClientBounds(curBounds);
|
mWindow->GetBounds(curBounds);
|
||||||
|
|
||||||
nsWindowType type;
|
nsWindowType type;
|
||||||
mWindow->GetWindowType(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.
|
// Child views are never attached to top level widgets, this is safe.
|
||||||
if (changedPos) {
|
if (changedPos) {
|
||||||
if (changedSize && !aMoveOnly) {
|
if (changedSize && !aMoveOnly) {
|
||||||
mWindow->ResizeClient(newBounds.x, newBounds.y,
|
mWindow->Resize(newBounds.x, newBounds.y, newBounds.width, newBounds.height,
|
||||||
newBounds.width, newBounds.height,
|
aInvalidateChangedSize);
|
||||||
aInvalidateChangedSize);
|
|
||||||
} else {
|
} else {
|
||||||
mWindow->MoveClient(newBounds.x, newBounds.y);
|
mWindow->Move(newBounds.x, newBounds.y);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (changedSize && !aMoveOnly) {
|
if (changedSize && !aMoveOnly) {
|
||||||
mWindow->ResizeClient(newBounds.width, newBounds.height,
|
mWindow->Resize(newBounds.width, newBounds.height, aInvalidateChangedSize);
|
||||||
aInvalidateChangedSize);
|
|
||||||
} // else do nothing!
|
} // else do nothing!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,8 +118,8 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NS_IWIDGET_IID \
|
#define NS_IWIDGET_IID \
|
||||||
{ 0x41fc0f2c, 0x65c2, 0x418e, \
|
{ 0x34460b01, 0x3dc2, 0x4b58, \
|
||||||
{ 0x89, 0x91, 0x5f, 0x0c, 0xa7, 0x01, 0x05, 0x34 } }
|
{ 0x8e, 0xd3, 0x7e, 0x7c, 0x33, 0xb5, 0x78, 0x8b } }
|
||||||
/*
|
/*
|
||||||
* Window shadow styles
|
* Window shadow styles
|
||||||
* Also used for the -moz-window-shadow CSS property
|
* 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;
|
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.
|
* Resize this widget.
|
||||||
*
|
*
|
||||||
|
@ -716,29 +701,10 @@ class nsIWidget : public nsISupports {
|
||||||
bool aRepaint) = 0;
|
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 aX the new x offset expressed in the parent's coordinate system
|
||||||
* @param aHeight the new height of the client area.
|
* @param aY the new y offset expressed in the parent's coordinate system
|
||||||
* @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 aWidth the new width of the client area.
|
* @param aWidth the new width of the client area.
|
||||||
* @param aHeight the new height of the client area.
|
* @param aHeight the new height of the client area.
|
||||||
* @param aRepaint whether the widget should be repainted
|
* @param aRepaint whether the widget should be repainted
|
||||||
|
@ -833,10 +799,9 @@ class nsIWidget : public nsISupports {
|
||||||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect) = 0;
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this widget's client area bounds, if the window has a 3D border
|
* Get this widget's client area dimensions, if the window has a 3D
|
||||||
* appearance this returns the area inside the border. The position is the
|
* border appearance this returns the area inside the border. Origin
|
||||||
* position of the client area relative to the client area of the parent
|
* is always zero.
|
||||||
* widget (for root widgets and popup widgets it is in screen coordinates).
|
|
||||||
*
|
*
|
||||||
* @param aRect On return it holds the x. y, width and height of
|
* @param aRect On return it holds the x. y, width and height of
|
||||||
* the client area of this widget.
|
* the client area of this widget.
|
||||||
|
|
|
@ -1579,57 +1579,6 @@ nsWindow::GetScreenBounds(nsIntRect &aRect)
|
||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsWindow::SetForegroundColor(const nscolor &aColor)
|
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,
|
LOG(("configure event [%p] %d %d %d %d\n", (void *)this,
|
||||||
aEvent->x, aEvent->y, aEvent->width, aEvent->height));
|
aEvent->x, aEvent->y, aEvent->width, aEvent->height));
|
||||||
|
|
||||||
nsIntRect screenBounds;
|
// mBounds.x/y are set to the window manager frame top-left when Move() or
|
||||||
GetScreenBounds(screenBounds);
|
// 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) {
|
if (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog) {
|
||||||
// This check avoids unwanted rollup on spurious configure events from
|
check_for_rollup(aEvent->window, 0, 0, false, true);
|
||||||
// Cygwin/X (bug 672103).
|
|
||||||
if (mBounds.x != screenBounds.x ||
|
|
||||||
mBounds.y != screenBounds.y) {
|
|
||||||
check_for_rollup(aEvent->window, 0, 0, false, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This event indicates that the window position may have changed.
|
// This event indicates that the window position may have changed.
|
||||||
|
@ -2427,7 +2377,11 @@ nsWindow::OnConfigureEvent(GtkWidget *aWidget, GdkEventConfigure *aEvent)
|
||||||
return FALSE;
|
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);
|
nsGUIEvent event(true, NS_MOVE, this);
|
||||||
|
|
||||||
|
|
|
@ -170,8 +170,6 @@ public:
|
||||||
NS_IMETHOD Enable(bool aState);
|
NS_IMETHOD Enable(bool aState);
|
||||||
NS_IMETHOD SetFocus(bool aRaise = false);
|
NS_IMETHOD SetFocus(bool aRaise = false);
|
||||||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
||||||
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
|
||||||
virtual nsIntPoint GetClientOffset();
|
|
||||||
NS_IMETHOD SetForegroundColor(const nscolor &aColor);
|
NS_IMETHOD SetForegroundColor(const nscolor &aColor);
|
||||||
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
||||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||||
|
|
|
@ -769,7 +769,10 @@ NS_METHOD nsWindow::GetBounds(nsIntRect& aRect)
|
||||||
|
|
||||||
NS_METHOD nsWindow::GetClientBounds(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;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1185,8 +1185,6 @@ nsTextStore::GetScreenExt(TsViewCookie vcView,
|
||||||
nsresult rv = refWindow->GetClientBounds(boundRect);
|
nsresult rv = refWindow->GetClientBounds(boundRect);
|
||||||
NS_ENSURE_SUCCESS(rv, E_FAIL);
|
NS_ENSURE_SUCCESS(rv, E_FAIL);
|
||||||
|
|
||||||
boundRect.MoveTo(0, 0);
|
|
||||||
|
|
||||||
// Clip frame rect to window rect
|
// Clip frame rect to window rect
|
||||||
boundRect.IntersectRect(event.mReply.mRect, boundRect);
|
boundRect.IntersectRect(event.mReply.mRect, boundRect);
|
||||||
if (!boundRect.IsEmpty()) {
|
if (!boundRect.IsEmpty()) {
|
||||||
|
|
|
@ -1523,6 +1523,30 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeig
|
||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsWindow::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical)
|
nsWindow::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical)
|
||||||
{
|
{
|
||||||
|
@ -1906,9 +1930,9 @@ NS_METHOD nsWindow::GetClientBounds(nsIntRect &aRect)
|
||||||
RECT r;
|
RECT r;
|
||||||
VERIFY(::GetClientRect(mWnd, &r));
|
VERIFY(::GetClientRect(mWnd, &r));
|
||||||
|
|
||||||
nsIntRect bounds;
|
// assign size
|
||||||
GetBounds(bounds);
|
aRect.x = 0;
|
||||||
aRect.MoveTo(bounds.TopLeft() + GetClientOffset());
|
aRect.y = 0;
|
||||||
aRect.width = r.right - r.left;
|
aRect.width = r.right - r.left;
|
||||||
aRect.height = r.bottom - r.top;
|
aRect.height = r.bottom - r.top;
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,7 @@ public:
|
||||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
|
||||||
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
||||||
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, 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 BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
|
||||||
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate);
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate);
|
||||||
NS_IMETHOD SetSizeMode(PRInt32 aMode);
|
NS_IMETHOD SetSizeMode(PRInt32 aMode);
|
||||||
|
|
|
@ -300,6 +300,15 @@ NS_IMETHODIMP nsBaseWidget::SetAttachedViewPtr(ViewWrapper* aViewWrapper)
|
||||||
return NS_OK;
|
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
|
// Close this nsBaseWidget
|
||||||
|
@ -910,50 +919,6 @@ NS_METHOD nsBaseWidget::SetWindowClass(const nsAString& xulWinType)
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
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
|
// Bounds
|
||||||
|
|
|
@ -122,15 +122,10 @@ public:
|
||||||
virtual gfxASurface* GetThebesSurface();
|
virtual gfxASurface* GetThebesSurface();
|
||||||
NS_IMETHOD SetModal(bool aModal);
|
NS_IMETHOD SetModal(bool aModal);
|
||||||
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
|
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 SetBounds(const nsIntRect &aRect);
|
||||||
NS_IMETHOD GetBounds(nsIntRect &aRect);
|
NS_IMETHOD GetBounds(nsIntRect &aRect);
|
||||||
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
||||||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
||||||
NS_IMETHOD GetNonClientMargins(nsIntMargin &margins);
|
|
||||||
NS_IMETHOD SetNonClientMargins(nsIntMargin &margins);
|
|
||||||
virtual nsIntPoint GetClientOffset();
|
virtual nsIntPoint GetClientOffset();
|
||||||
NS_IMETHOD EnableDragDrop(bool aEnable);
|
NS_IMETHOD EnableDragDrop(bool aEnable);
|
||||||
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
||||||
|
@ -168,6 +163,9 @@ public:
|
||||||
NS_IMETHOD AttachViewToTopLevel(EVENT_CALLBACK aViewEventFunction, nsDeviceContext *aContext);
|
NS_IMETHOD AttachViewToTopLevel(EVENT_CALLBACK aViewEventFunction, nsDeviceContext *aContext);
|
||||||
virtual ViewWrapper* GetAttachedViewPtr();
|
virtual ViewWrapper* GetAttachedViewPtr();
|
||||||
NS_IMETHOD SetAttachedViewPtr(ViewWrapper* aViewWrapper);
|
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 RegisterTouchWindow();
|
||||||
NS_IMETHOD UnregisterTouchWindow();
|
NS_IMETHOD UnregisterTouchWindow();
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче