2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
#include "nsView.h"
|
|
|
|
#include "nsIWidget.h"
|
2001-11-07 04:05:38 +00:00
|
|
|
#include "nsViewManager.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsIFrame.h"
|
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsIWidget.h"
|
|
|
|
#include "nsIButton.h"
|
|
|
|
#include "nsGUIEvent.h"
|
|
|
|
#include "nsIDeviceContext.h"
|
1999-03-09 09:44:27 +00:00
|
|
|
#include "nsIComponentManager.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsIRenderingContext.h"
|
|
|
|
#include "nsTransform2D.h"
|
1998-04-23 21:51:43 +00:00
|
|
|
#include "nsIScrollableView.h"
|
1998-10-11 01:00:59 +00:00
|
|
|
#include "nsVoidArray.h"
|
1998-10-23 17:58:44 +00:00
|
|
|
#include "nsGfxCIID.h"
|
1998-10-15 04:55:21 +00:00
|
|
|
#include "nsIRegion.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-11-14 02:51:25 +00:00
|
|
|
static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
|
|
|
|
|
1998-11-23 23:50:17 +00:00
|
|
|
//mmptemp
|
|
|
|
|
1998-08-31 19:09:55 +00:00
|
|
|
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
|
|
|
|
|
|
|
|
|
1998-07-11 06:17:09 +00:00
|
|
|
//#define SHOW_VIEW_BORDERS
|
1998-06-16 17:05:42 +00:00
|
|
|
//#define HIDE_ALL_WIDGETS
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
//
|
|
|
|
// Main events handler
|
|
|
|
//
|
|
|
|
nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent)
|
|
|
|
{
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf(" %d %d %d (%d,%d) \n", aEvent->widget, aEvent->widgetSupports,
|
1998-05-29 22:44:13 +00:00
|
|
|
// aEvent->message, aEvent->point.x, aEvent->point.y);
|
1998-08-08 04:23:33 +00:00
|
|
|
nsEventStatus result = nsEventStatus_eIgnore;
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView *view = nsView::GetViewFor(aEvent->widget);
|
1999-04-16 04:23:43 +00:00
|
|
|
|
|
|
|
if (nsnull != view)
|
|
|
|
{
|
2001-11-07 04:05:38 +00:00
|
|
|
nsViewManager *vm = view->GetViewManager();
|
1998-08-30 19:16:11 +00:00
|
|
|
|
1999-11-24 06:03:10 +00:00
|
|
|
vm->DispatchEvent(aEvent, &result);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2001-01-27 23:31:15 +00:00
|
|
|
MOZ_DECL_CTOR_COUNTER(nsView)
|
1999-10-05 14:52:53 +00:00
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
nsView::nsView()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-10-05 14:52:53 +00:00
|
|
|
MOZ_COUNT_CTOR(nsView);
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
mVis = nsViewVisibility_kShow;
|
2002-10-11 01:23:13 +00:00
|
|
|
// Views should be transparent by default. Not being transparent is
|
|
|
|
// a promise that the view will paint all its pixels opaquely. Views
|
|
|
|
// should make this promise explicitly by calling
|
|
|
|
// SetViewContentTransparency.
|
|
|
|
mVFlags = NS_VIEW_FLAG_TRANSPARENT;
|
1998-11-03 06:36:36 +00:00
|
|
|
mOpacity = 1.0f;
|
1999-07-19 19:57:30 +00:00
|
|
|
mViewManager = nsnull;
|
2001-11-30 04:09:36 +00:00
|
|
|
mChildRemoved = PR_FALSE;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2003-02-23 02:53:15 +00:00
|
|
|
void nsView::DropMouseGrabbing() {
|
|
|
|
// check to see if we are grabbing events
|
|
|
|
if (mViewManager->GetMouseEventGrabber() == this) {
|
|
|
|
// we are grabbing events. Move the grab to the parent if we can.
|
|
|
|
PRBool boolResult; //not used
|
|
|
|
// if GetParent() returns null, then we release the grab, which is the best we can do
|
|
|
|
mViewManager->GrabMouseEvents(GetParent(), boolResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
nsView::~nsView()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-10-05 14:52:53 +00:00
|
|
|
MOZ_COUNT_DTOR(nsView);
|
|
|
|
|
2003-02-23 02:53:15 +00:00
|
|
|
while (GetFirstChild())
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2002-02-19 21:33:26 +00:00
|
|
|
nsView* child = GetFirstChild();
|
|
|
|
if (child->GetViewManager() == mViewManager) {
|
|
|
|
child->Destroy();
|
|
|
|
} else {
|
|
|
|
// just unhook it. Someone else will want to destroy this.
|
|
|
|
RemoveChild(child);
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2003-02-23 02:53:15 +00:00
|
|
|
DropMouseGrabbing();
|
|
|
|
|
|
|
|
if (mViewManager)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView *rootView = mViewManager->GetRootView();
|
2000-06-01 00:38:57 +00:00
|
|
|
|
2003-02-23 02:53:15 +00:00
|
|
|
if (rootView)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2002-02-19 21:33:26 +00:00
|
|
|
// Root views can have parents!
|
2003-02-23 02:53:15 +00:00
|
|
|
if (mParent)
|
2002-02-19 21:33:26 +00:00
|
|
|
{
|
|
|
|
mViewManager->RemoveChild(this);
|
|
|
|
}
|
|
|
|
|
1998-05-01 03:13:34 +00:00
|
|
|
if (rootView == this)
|
|
|
|
{
|
1998-08-08 04:23:33 +00:00
|
|
|
// Inform the view manager that the root view has gone away...
|
|
|
|
mViewManager->SetRootView(nsnull);
|
1998-05-01 03:13:34 +00:00
|
|
|
}
|
2002-02-19 21:33:26 +00:00
|
|
|
}
|
2003-02-23 02:53:15 +00:00
|
|
|
else if (mParent)
|
1998-08-08 04:23:33 +00:00
|
|
|
{
|
1998-05-01 03:13:34 +00:00
|
|
|
mParent->RemoveChild(this);
|
1998-08-08 04:23:33 +00:00
|
|
|
}
|
2002-02-19 21:33:26 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
mViewManager = nsnull;
|
|
|
|
}
|
2003-02-23 02:53:15 +00:00
|
|
|
else if (mParent)
|
1998-08-08 04:23:33 +00:00
|
|
|
{
|
1998-05-01 03:13:34 +00:00
|
|
|
mParent->RemoveChild(this);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1998-08-08 04:23:33 +00:00
|
|
|
|
2003-02-23 02:53:15 +00:00
|
|
|
if (mZParent)
|
2000-08-12 19:05:52 +00:00
|
|
|
{
|
2001-11-08 23:11:01 +00:00
|
|
|
mZParent->RemoveReparentedView();
|
2000-08-12 19:05:52 +00:00
|
|
|
mZParent->Destroy();
|
|
|
|
}
|
1998-11-03 06:36:36 +00:00
|
|
|
|
2000-08-12 19:05:52 +00:00
|
|
|
// Destroy and release the widget
|
2003-02-23 02:53:15 +00:00
|
|
|
if (mWindow)
|
1998-11-03 06:36:36 +00:00
|
|
|
{
|
1998-08-08 04:23:33 +00:00
|
|
|
mWindow->SetClientData(nsnull);
|
|
|
|
mWindow->Destroy();
|
|
|
|
NS_RELEASE(mWindow);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1998-10-15 04:55:21 +00:00
|
|
|
NS_IF_RELEASE(mDirtyRegion);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-09-12 03:23:09 +00:00
|
|
|
nsresult nsView::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
if (nsnull == aInstancePtr) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-08-10 00:56:40 +00:00
|
|
|
|
|
|
|
*aInstancePtr = nsnull;
|
|
|
|
|
1999-09-12 03:23:09 +00:00
|
|
|
if (aIID.Equals(NS_GET_IID(nsIView)) || (aIID.Equals(NS_GET_IID(nsISupports)))) {
|
1998-04-13 20:24:54 +00:00
|
|
|
*aInstancePtr = (void*)(nsIView*)this;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsrefcnt nsView::AddRef()
|
|
|
|
{
|
1998-08-08 04:23:33 +00:00
|
|
|
NS_WARNING("not supported for views");
|
|
|
|
return 1;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsrefcnt nsView::Release()
|
|
|
|
{
|
1998-08-08 04:23:33 +00:00
|
|
|
NS_WARNING("not supported for views");
|
|
|
|
return 1;
|
|
|
|
}
|
1998-05-01 03:13:34 +00:00
|
|
|
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView* nsView::GetViewFor(nsIWidget* aWidget)
|
1998-08-08 04:23:33 +00:00
|
|
|
{
|
2001-11-07 04:05:38 +00:00
|
|
|
void* clientData;
|
1998-06-01 22:02:02 +00:00
|
|
|
|
1998-12-16 03:37:56 +00:00
|
|
|
NS_PRECONDITION(nsnull != aWidget, "null widget ptr");
|
|
|
|
|
1998-08-08 04:23:33 +00:00
|
|
|
// The widget's client data points back to the owning view
|
1999-01-08 21:31:56 +00:00
|
|
|
if (aWidget && NS_SUCCEEDED(aWidget->GetClientData(clientData))) {
|
2001-04-11 05:29:36 +00:00
|
|
|
nsISupports* data = (nsISupports*)clientData;
|
|
|
|
|
|
|
|
if (nsnull != data) {
|
2001-11-07 04:05:38 +00:00
|
|
|
nsIView* view = nsnull;
|
|
|
|
if (NS_SUCCEEDED(data->QueryInterface(NS_GET_IID(nsIView), (void **)&view))) {
|
|
|
|
return NS_STATIC_CAST(nsView*, view);
|
2001-04-11 05:29:36 +00:00
|
|
|
}
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
2001-11-07 04:05:38 +00:00
|
|
|
return nsnull;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::Init(nsIViewManager* aManager,
|
1998-08-30 19:16:11 +00:00
|
|
|
const nsRect &aBounds,
|
1998-10-27 03:36:49 +00:00
|
|
|
const nsIView *aParent,
|
1998-08-30 19:16:11 +00:00
|
|
|
nsViewVisibility aVisibilityFlag)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf(" \n callback=%d data=%d", aWidgetCreateCallback, aCallbackData);
|
1998-04-13 20:24:54 +00:00
|
|
|
NS_PRECONDITION(nsnull != aManager, "null ptr");
|
|
|
|
if (nsnull == aManager) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
|
|
|
if (nsnull != mViewManager) {
|
|
|
|
return NS_ERROR_ALREADY_INITIALIZED;
|
|
|
|
}
|
1998-08-08 04:23:33 +00:00
|
|
|
// we don't hold a reference to the view manager
|
2001-11-07 04:05:38 +00:00
|
|
|
mViewManager = NS_STATIC_CAST(nsViewManager*, aManager);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2002-01-27 07:56:23 +00:00
|
|
|
SetPosition(aBounds.x, aBounds.y);
|
|
|
|
nsRect dim(0, 0, aBounds.width, aBounds.height);
|
|
|
|
|
|
|
|
SetDimensions(dim, PR_FALSE);
|
1998-07-07 21:51:57 +00:00
|
|
|
|
1998-10-27 03:36:49 +00:00
|
|
|
//temporarily set it...
|
2001-11-07 04:05:38 +00:00
|
|
|
SetParent(NS_CONST_CAST(nsView*, NS_STATIC_CAST(const nsView*, aParent)));
|
1998-10-27 03:36:49 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
SetVisibility(aVisibilityFlag);
|
|
|
|
|
1998-10-27 05:57:18 +00:00
|
|
|
// XXX Don't clear this or we hork the scrolling view when creating the clip
|
|
|
|
// view's widget. It needs to stay set and later the view manager will reset it
|
|
|
|
// when the view is inserted into the view hierarchy...
|
|
|
|
#if 0
|
1998-10-27 03:36:49 +00:00
|
|
|
//clear this again...
|
|
|
|
SetParent(nsnull);
|
1998-10-27 05:57:18 +00:00
|
|
|
#endif
|
1998-10-27 03:36:49 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::Destroy()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
delete this;
|
1998-08-30 19:16:11 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::GetViewManager(nsIViewManager *&aViewMgr) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
NS_IF_ADDREF(mViewManager);
|
1998-08-30 19:16:11 +00:00
|
|
|
aViewMgr = mViewManager;
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::Paint(nsIRenderingContext& rc, const nsRect& rect,
|
1998-10-11 01:00:59 +00:00
|
|
|
PRUint32 aPaintFlags, PRBool &aResult)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2000-08-24 19:54:46 +00:00
|
|
|
// Just paint, assume compositor knows what it's doing.
|
|
|
|
if (nsnull != mClientData) {
|
|
|
|
nsCOMPtr<nsIViewObserver> observer;
|
|
|
|
if (NS_OK == mViewManager->GetViewObserver(*getter_AddRefs(observer))) {
|
|
|
|
observer->Paint((nsIView *)this, rc, rect);
|
|
|
|
}
|
|
|
|
}
|
2000-01-25 01:53:34 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::Paint(nsIRenderingContext& rc, const nsIRegion& region,
|
1998-08-30 19:16:11 +00:00
|
|
|
PRUint32 aPaintFlags, PRBool &aResult)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
// XXX apply region to rc
|
|
|
|
// XXX get bounding rect from region
|
1998-08-28 03:05:23 +00:00
|
|
|
//if (nsnull != mClientData)
|
|
|
|
//{
|
|
|
|
// nsIViewObserver *obs;
|
|
|
|
//
|
|
|
|
// if (NS_OK == mViewManager->GetViewObserver(obs))
|
|
|
|
// {
|
|
|
|
// obs->Paint((nsIView *)this, rc, rect, aPaintFlags);
|
|
|
|
// NS_RELEASE(obs);
|
|
|
|
// }
|
|
|
|
//}
|
1998-08-30 19:16:11 +00:00
|
|
|
aResult = PR_FALSE;
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2002-02-12 03:46:35 +00:00
|
|
|
nsEventStatus nsView::HandleEvent(nsViewManager* aVM, nsGUIEvent *aEvent, PRBool aCaptured)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2002-02-12 03:46:35 +00:00
|
|
|
return aVM->HandleEvent(this, aEvent, aCaptured);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-12-14 22:21:58 +00:00
|
|
|
// XXX Start Temporary fix for Bug #19416
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::IgnoreSetPosition(PRBool aShouldIgnore)
|
1999-12-14 22:21:58 +00:00
|
|
|
{
|
|
|
|
mShouldIgnoreSetPosition = aShouldIgnore;
|
|
|
|
// resync here
|
|
|
|
if (!mShouldIgnoreSetPosition) {
|
2002-01-27 07:56:23 +00:00
|
|
|
SetPosition(mPosX, mPosY);
|
1999-12-14 22:21:58 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
// XXX End Temporary fix for Bug #19416
|
1999-05-19 22:14:11 +00:00
|
|
|
|
2002-01-27 07:56:23 +00:00
|
|
|
void nsView::SetPosition(nscoord aX, nscoord aY)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2002-01-27 07:56:23 +00:00
|
|
|
mDimBounds.x += aX - mPosX;
|
|
|
|
mDimBounds.y += aY - mPosY;
|
|
|
|
mPosX = aX;
|
|
|
|
mPosY = aY;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-12-14 22:21:58 +00:00
|
|
|
// XXX Start Temporary fix for Bug #19416
|
|
|
|
if (mShouldIgnoreSetPosition) {
|
2002-01-27 07:56:23 +00:00
|
|
|
return;
|
1999-12-14 22:21:58 +00:00
|
|
|
}
|
|
|
|
// XXX End Temporary fix for Bug #19416
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
if (nsnull != mWindow)
|
|
|
|
{
|
2000-04-03 03:55:38 +00:00
|
|
|
// see if we are caching our widget changes. Yes?
|
|
|
|
// mark us as changed. Later we will actually move the
|
|
|
|
// widget.
|
|
|
|
PRBool caching = PR_FALSE;
|
|
|
|
mViewManager->IsCachingWidgetChanges(&caching);
|
|
|
|
if (caching) {
|
2001-12-01 14:31:45 +00:00
|
|
|
mVFlags |= NS_VIEW_FLAG_WIDGET_MOVED;
|
2002-01-27 07:56:23 +00:00
|
|
|
return;
|
2000-04-03 03:55:38 +00:00
|
|
|
}
|
|
|
|
|
1998-08-28 04:56:56 +00:00
|
|
|
nsIDeviceContext *dx;
|
1998-08-28 03:05:23 +00:00
|
|
|
float scale;
|
|
|
|
nsIWidget *pwidget = nsnull;
|
1998-10-19 00:44:28 +00:00
|
|
|
nscoord parx = 0, pary = 0;
|
1998-06-04 02:02:08 +00:00
|
|
|
|
1998-08-28 04:56:56 +00:00
|
|
|
mViewManager->GetDeviceContext(dx);
|
1998-08-28 03:05:23 +00:00
|
|
|
dx->GetAppUnitsToDevUnits(scale);
|
1998-10-19 00:44:28 +00:00
|
|
|
NS_RELEASE(dx);
|
1998-06-04 02:02:08 +00:00
|
|
|
|
1998-08-30 19:16:11 +00:00
|
|
|
GetOffsetFromWidget(&parx, &pary, pwidget);
|
1998-06-16 17:05:42 +00:00
|
|
|
NS_IF_RELEASE(pwidget);
|
1998-08-30 19:16:11 +00:00
|
|
|
|
2002-01-27 07:56:23 +00:00
|
|
|
mWindow->Move(NSTwipsToIntPixels((mDimBounds.x + parx), scale),
|
|
|
|
NSTwipsToIntPixels((mDimBounds.y + pary), scale));
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::SynchWidgetSizePosition()
|
2000-04-03 03:55:38 +00:00
|
|
|
{
|
2000-04-11 23:55:15 +00:00
|
|
|
// if the widget was moved or resized
|
2001-12-01 14:31:45 +00:00
|
|
|
if (mVFlags & NS_VIEW_FLAG_WIDGET_MOVED || mVFlags & NS_VIEW_FLAG_WIDGET_RESIZED)
|
2000-04-03 03:55:38 +00:00
|
|
|
{
|
|
|
|
nsIDeviceContext *dx;
|
|
|
|
float t2p;
|
|
|
|
|
|
|
|
mViewManager->GetDeviceContext(dx);
|
|
|
|
dx->GetAppUnitsToDevUnits(t2p);
|
|
|
|
NS_RELEASE(dx);
|
2001-03-21 05:32:22 +00:00
|
|
|
#if 0
|
2000-04-25 07:10:48 +00:00
|
|
|
/* You would think that doing a move and resize all in one operation would
|
|
|
|
* be faster but its not. Something is really broken here. So I'm comenting
|
2000-05-26 06:42:29 +00:00
|
|
|
* this out for now
|
2001-03-21 05:32:22 +00:00
|
|
|
*/
|
2000-04-11 23:55:15 +00:00
|
|
|
// if we moved and resized do it all in one shot
|
|
|
|
if (mVFlags & NS_VIEW_PUBLIC_FLAG_WIDGET_MOVED && mVFlags & NS_VIEW_PUBLIC_FLAG_WIDGET_RESIZED)
|
2000-04-03 03:55:38 +00:00
|
|
|
{
|
2000-05-26 06:42:29 +00:00
|
|
|
|
2000-04-03 03:55:38 +00:00
|
|
|
nscoord parx = 0, pary = 0;
|
|
|
|
nsIWidget *pwidget = nsnull;
|
|
|
|
|
|
|
|
GetOffsetFromWidget(&parx, &pary, pwidget);
|
|
|
|
NS_IF_RELEASE(pwidget);
|
|
|
|
|
2002-01-27 07:56:23 +00:00
|
|
|
PRInt32 x = NSTwipsToIntPixels(mDimBounds.x + parx, t2p);
|
|
|
|
PRInt32 y = NSTwipsToIntPixels(mDimBounds.y + pary, t2p);
|
|
|
|
PRInt32 width = NSTwipsToIntPixels(mDimBounds.width, t2p);
|
|
|
|
PRInt32 height = NSTwipsToIntPixels(mDimBounds.height, t2p);
|
2000-04-25 07:10:48 +00:00
|
|
|
|
|
|
|
nsRect bounds;
|
|
|
|
mWindow->GetBounds(bounds);
|
|
|
|
if (bounds.x == x && bounds.y == y )
|
2001-12-01 14:31:45 +00:00
|
|
|
mVFlags &= ~NS_VIEW_FLAG_WIDGET_MOVED;
|
2000-04-25 07:10:48 +00:00
|
|
|
else if (bounds.width == width && bounds.height == bounds.height)
|
2001-12-01 14:31:45 +00:00
|
|
|
mVFlags &= ~NS_VIEW_FLAG_WIDGET_RESIZED;
|
2000-04-25 07:10:48 +00:00
|
|
|
else {
|
|
|
|
mWindow->Resize(x,y,width,height, PR_TRUE);
|
2001-12-01 14:31:45 +00:00
|
|
|
mVFlags &= ~NS_VIEW_FLAG_WIDGET_RESIZED;
|
|
|
|
mVFlags &= ~NS_VIEW_FLAG_WIDGET_MOVED;
|
2000-04-25 07:10:48 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2001-03-21 05:32:22 +00:00
|
|
|
#endif
|
2000-04-25 07:10:48 +00:00
|
|
|
// if we just resized do it
|
2001-12-01 14:31:45 +00:00
|
|
|
if (mVFlags & NS_VIEW_FLAG_WIDGET_RESIZED)
|
2000-04-25 07:10:48 +00:00
|
|
|
{
|
|
|
|
|
2002-01-27 07:56:23 +00:00
|
|
|
PRInt32 width = NSTwipsToIntPixels(mDimBounds.width, t2p);
|
|
|
|
PRInt32 height = NSTwipsToIntPixels(mDimBounds.height, t2p);
|
2000-04-25 07:10:48 +00:00
|
|
|
|
|
|
|
nsRect bounds;
|
|
|
|
mWindow->GetBounds(bounds);
|
|
|
|
|
2000-05-26 06:42:29 +00:00
|
|
|
if (bounds.width != width || bounds.height != bounds.height) {
|
2001-03-21 05:32:22 +00:00
|
|
|
#ifdef DEBUG_evaughan
|
2000-10-28 22:17:53 +00:00
|
|
|
printf("%d) Resize(%d,%d)\n", this, width, height);
|
2001-03-21 05:32:22 +00:00
|
|
|
#endif
|
2000-04-25 07:10:48 +00:00
|
|
|
mWindow->Resize(width,height, PR_TRUE);
|
2000-05-26 06:42:29 +00:00
|
|
|
}
|
2000-04-03 03:55:38 +00:00
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
mVFlags &= ~NS_VIEW_FLAG_WIDGET_RESIZED;
|
2000-04-25 07:10:48 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
if (mVFlags & NS_VIEW_FLAG_WIDGET_MOVED) {
|
2000-04-25 07:10:48 +00:00
|
|
|
// if we just moved do it.
|
|
|
|
nscoord parx = 0, pary = 0;
|
|
|
|
nsIWidget *pwidget = nsnull;
|
|
|
|
|
|
|
|
GetOffsetFromWidget(&parx, &pary, pwidget);
|
|
|
|
NS_IF_RELEASE(pwidget);
|
|
|
|
|
2002-01-27 07:56:23 +00:00
|
|
|
PRInt32 x = NSTwipsToIntPixels(mDimBounds.x + parx, t2p);
|
|
|
|
PRInt32 y = NSTwipsToIntPixels(mDimBounds.y + pary, t2p);
|
2000-04-25 07:10:48 +00:00
|
|
|
|
|
|
|
nsRect bounds;
|
|
|
|
mWindow->GetBounds(bounds);
|
|
|
|
|
2000-05-26 06:42:29 +00:00
|
|
|
if (bounds.x != x || bounds.y != y) {
|
2001-03-21 05:32:22 +00:00
|
|
|
#ifdef DEBUG_evaughan
|
2000-10-28 22:17:53 +00:00
|
|
|
printf("%d) Move(%d,%d)\n", this, x, y);
|
2001-03-21 05:32:22 +00:00
|
|
|
#endif
|
2000-04-25 07:10:48 +00:00
|
|
|
mWindow->Move(x,y);
|
2000-05-26 06:42:29 +00:00
|
|
|
}
|
2000-04-25 07:10:48 +00:00
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
mVFlags &= ~NS_VIEW_FLAG_WIDGET_MOVED;
|
2000-04-25 07:10:48 +00:00
|
|
|
}
|
2000-04-03 03:55:38 +00:00
|
|
|
}
|
2000-04-25 07:10:48 +00:00
|
|
|
|
2000-04-03 03:55:38 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::GetPosition(nscoord *x, nscoord *y) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2000-03-23 23:49:18 +00:00
|
|
|
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView *rootView = mViewManager->GetRootView();
|
1998-10-11 01:00:59 +00:00
|
|
|
|
2001-11-07 04:05:38 +00:00
|
|
|
if (this == rootView)
|
1998-07-07 21:51:57 +00:00
|
|
|
*x = *y = 0;
|
|
|
|
else
|
|
|
|
{
|
2002-01-27 07:56:23 +00:00
|
|
|
*x = mPosX;
|
|
|
|
*y = mPosY;
|
1998-07-07 21:51:57 +00:00
|
|
|
}
|
1998-08-30 19:16:11 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2002-01-27 07:56:23 +00:00
|
|
|
void nsView::SetDimensions(const nsRect& aRect, PRBool aPaint)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2002-01-27 07:56:23 +00:00
|
|
|
nsRect dims = aRect;
|
|
|
|
dims.MoveBy(mPosX, mPosY);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2002-01-27 07:56:23 +00:00
|
|
|
if (mDimBounds.x == dims.x && mDimBounds.y == dims.y && mDimBounds.width == dims.width
|
|
|
|
&& mDimBounds.height == dims.height) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nsnull == mWindow)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2002-01-27 07:56:23 +00:00
|
|
|
mDimBounds = dims;
|
1998-04-23 21:51:43 +00:00
|
|
|
}
|
2002-01-27 07:56:23 +00:00
|
|
|
else
|
1998-04-23 21:51:43 +00:00
|
|
|
{
|
2002-01-27 07:56:23 +00:00
|
|
|
PRBool needToMoveWidget = mDimBounds.x != dims.x || mDimBounds.y != dims.y;
|
|
|
|
|
|
|
|
mDimBounds = dims;
|
|
|
|
|
2000-04-03 03:55:38 +00:00
|
|
|
PRBool caching = PR_FALSE;
|
|
|
|
mViewManager->IsCachingWidgetChanges(&caching);
|
|
|
|
if (caching) {
|
2002-01-27 07:56:23 +00:00
|
|
|
mVFlags |= NS_VIEW_FLAG_WIDGET_RESIZED | (needToMoveWidget ? NS_VIEW_FLAG_WIDGET_MOVED : 0);
|
|
|
|
return;
|
2000-04-03 03:55:38 +00:00
|
|
|
}
|
|
|
|
|
1998-08-28 04:56:56 +00:00
|
|
|
nsIDeviceContext *dx;
|
1998-08-28 03:05:23 +00:00
|
|
|
float t2p;
|
2002-01-27 07:56:23 +00:00
|
|
|
nsIWidget *pwidget = nsnull;
|
|
|
|
nscoord parx = 0, pary = 0;
|
1998-04-23 21:51:43 +00:00
|
|
|
|
1998-08-28 04:56:56 +00:00
|
|
|
mViewManager->GetDeviceContext(dx);
|
1998-08-28 03:05:23 +00:00
|
|
|
dx->GetAppUnitsToDevUnits(t2p);
|
|
|
|
|
2002-01-27 07:56:23 +00:00
|
|
|
GetOffsetFromWidget(&parx, &pary, pwidget);
|
|
|
|
NS_IF_RELEASE(pwidget);
|
|
|
|
|
|
|
|
if (needToMoveWidget) {
|
|
|
|
mWindow->Move(NSTwipsToIntPixels((mDimBounds.x + parx), t2p),
|
|
|
|
NSTwipsToIntPixels((mDimBounds.y + pary), t2p));
|
|
|
|
}
|
|
|
|
mWindow->Resize(NSTwipsToIntPixels(mDimBounds.width, t2p), NSTwipsToIntPixels(mDimBounds.height, t2p),
|
1998-08-26 21:24:58 +00:00
|
|
|
aPaint);
|
1998-04-23 21:51:43 +00:00
|
|
|
|
1998-08-28 03:05:23 +00:00
|
|
|
NS_RELEASE(dx);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::GetBounds(nsRect &aBounds) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-07-19 19:57:30 +00:00
|
|
|
NS_ASSERTION(mViewManager, "mViewManager is null!");
|
|
|
|
if (!mViewManager) {
|
|
|
|
aBounds.x = aBounds.y = 0;
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
1998-07-07 21:51:57 +00:00
|
|
|
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView *rootView = mViewManager->GetRootView();
|
2002-01-27 07:56:23 +00:00
|
|
|
aBounds = mDimBounds;
|
1998-07-07 21:51:57 +00:00
|
|
|
|
2001-11-07 04:05:38 +00:00
|
|
|
if (this == rootView)
|
1998-07-07 21:51:57 +00:00
|
|
|
aBounds.x = aBounds.y = 0;
|
1998-08-30 19:16:11 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::SetVisibility(nsViewVisibility aVisibility)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2003-05-22 04:59:30 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
mVis = aVisibility;
|
|
|
|
|
2001-05-04 03:02:55 +00:00
|
|
|
if (aVisibility == nsViewVisibility_kHide)
|
|
|
|
{
|
2003-02-23 02:53:15 +00:00
|
|
|
DropMouseGrabbing();
|
2001-05-04 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
2003-05-22 04:59:30 +00:00
|
|
|
if (nsnull != mWindow)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-06-16 17:05:42 +00:00
|
|
|
#ifndef HIDE_ALL_WIDGETS
|
1998-04-13 20:24:54 +00:00
|
|
|
if (mVis == nsViewVisibility_kShow)
|
|
|
|
mWindow->Show(PR_TRUE);
|
|
|
|
else
|
1998-06-16 17:05:42 +00:00
|
|
|
#endif
|
1998-04-13 20:24:54 +00:00
|
|
|
mWindow->Show(PR_FALSE);
|
|
|
|
}
|
1998-08-30 19:16:11 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::GetVisibility(nsViewVisibility &aVisibility) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-08-30 19:16:11 +00:00
|
|
|
aVisibility = mVis;
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2002-07-02 12:50:14 +00:00
|
|
|
NS_IMETHODIMP nsView::GetZIndex(PRBool &aAuto, PRInt32 &aZIndex, PRBool &aTopMost) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2002-07-02 12:50:14 +00:00
|
|
|
aAuto = (mVFlags & NS_VIEW_FLAG_AUTO_ZINDEX) != 0;
|
2001-12-01 14:31:45 +00:00
|
|
|
aZIndex = mZIndex;
|
2002-07-02 12:50:14 +00:00
|
|
|
aTopMost = (mVFlags & NS_VIEW_FLAG_TOPMOST) != 0;
|
1998-08-30 19:16:11 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2000-01-25 01:53:34 +00:00
|
|
|
NS_IMETHODIMP nsView::SetFloating(PRBool aFloatingView)
|
|
|
|
{
|
|
|
|
if (aFloatingView)
|
2001-12-01 14:31:45 +00:00
|
|
|
mVFlags |= NS_VIEW_FLAG_FLOATING;
|
2000-01-25 01:53:34 +00:00
|
|
|
else
|
2001-12-01 14:31:45 +00:00
|
|
|
mVFlags &= ~NS_VIEW_FLAG_FLOATING;
|
2000-01-25 01:53:34 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
// recursively make all sub-views "floating" grr.
|
|
|
|
nsIView *child = mFirstChild;
|
|
|
|
while (nsnull != child) {
|
|
|
|
child->SetFloating(aFloatingView);
|
|
|
|
child->GetNextSibling(child);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsView::GetFloating(PRBool &aFloatingView) const
|
|
|
|
{
|
2001-12-01 14:31:45 +00:00
|
|
|
aFloatingView = ((mVFlags & NS_VIEW_FLAG_FLOATING) != 0);
|
2000-01-25 01:53:34 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::GetParent(nsIView *&aParent) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-08-30 19:16:11 +00:00
|
|
|
aParent = mParent;
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2002-12-14 16:18:57 +00:00
|
|
|
NS_IMETHODIMP nsView::GetFirstChild(nsIView *&aChild) const
|
|
|
|
{
|
|
|
|
aChild = mFirstChild;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::GetNextSibling(nsIView *&aNextSibling) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-08-30 19:16:11 +00:00
|
|
|
aNextSibling = mNextSibling;
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
void nsView::InsertChild(nsView *aChild, nsView *aSibling)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-11-07 04:05:38 +00:00
|
|
|
NS_PRECONDITION(nsnull != aChild, "null ptr");
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2001-11-07 04:05:38 +00:00
|
|
|
if (nsnull != aChild)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-11-07 04:05:38 +00:00
|
|
|
if (nsnull != aSibling)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-08-30 19:16:11 +00:00
|
|
|
#ifdef NS_DEBUG
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView* siblingParent = aSibling->GetParent();
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_ASSERTION(siblingParent == this, "tried to insert view with invalid sibling");
|
|
|
|
#endif
|
1998-04-13 20:24:54 +00:00
|
|
|
//insert after sibling
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView* siblingNextSibling = aSibling->GetNextSibling();
|
|
|
|
aChild->SetNextSibling(siblingNextSibling);
|
|
|
|
aSibling->SetNextSibling(aChild);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-11-07 04:05:38 +00:00
|
|
|
aChild->SetNextSibling(mFirstChild);
|
|
|
|
mFirstChild = aChild;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
2001-11-07 04:05:38 +00:00
|
|
|
aChild->SetParent(this);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
void nsView::RemoveChild(nsView *child)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(nsnull != child, "null ptr");
|
|
|
|
|
|
|
|
if (nsnull != child)
|
|
|
|
{
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView* prevKid = nsnull;
|
|
|
|
nsView* kid = mFirstChild;
|
1998-04-13 20:24:54 +00:00
|
|
|
PRBool found = PR_FALSE;
|
|
|
|
while (nsnull != kid) {
|
|
|
|
if (kid == child) {
|
|
|
|
if (nsnull != prevKid) {
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView* kidNextSibling = kid->GetNextSibling();
|
1998-08-30 19:16:11 +00:00
|
|
|
prevKid->SetNextSibling(kidNextSibling);
|
1998-04-13 20:24:54 +00:00
|
|
|
} else {
|
2001-11-07 04:05:38 +00:00
|
|
|
mFirstChild = kid->GetNextSibling();
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
child->SetParent(nsnull);
|
|
|
|
found = PR_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
1998-05-01 03:13:34 +00:00
|
|
|
prevKid = kid;
|
2001-11-30 04:09:36 +00:00
|
|
|
mChildRemoved = PR_TRUE;
|
2001-11-07 04:05:38 +00:00
|
|
|
kid = kid->GetNextSibling();
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
NS_ASSERTION(found, "tried to remove non child");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
nsView* nsView::GetChild(PRInt32 aIndex) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-11-07 04:05:38 +00:00
|
|
|
for (nsView* child = GetFirstChild(); child != nsnull; child = child->GetNextSibling()) {
|
|
|
|
if (aIndex == 0) {
|
|
|
|
return child;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
2001-11-07 04:05:38 +00:00
|
|
|
--aIndex;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
2001-11-07 04:05:38 +00:00
|
|
|
return nsnull;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::SetOpacity(float opacity)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-04-28 19:16:24 +00:00
|
|
|
mOpacity = opacity;
|
1998-08-30 19:16:11 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::GetOpacity(float &aOpacity) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-08-30 19:16:11 +00:00
|
|
|
aOpacity = mOpacity;
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::HasTransparency(PRBool &aTransparent) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-12-01 14:31:45 +00:00
|
|
|
aTransparent = (mVFlags & NS_VIEW_FLAG_TRANSPARENT) ? PR_TRUE : PR_FALSE;
|
1998-08-30 19:16:11 +00:00
|
|
|
return NS_OK;
|
1998-06-03 22:49:45 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::SetContentTransparency(PRBool aTransparent)
|
1998-06-03 22:49:45 +00:00
|
|
|
{
|
|
|
|
if (aTransparent == PR_TRUE)
|
2001-12-01 14:31:45 +00:00
|
|
|
mVFlags |= NS_VIEW_FLAG_TRANSPARENT;
|
1998-06-03 22:49:45 +00:00
|
|
|
else
|
2001-12-01 14:31:45 +00:00
|
|
|
mVFlags &= ~NS_VIEW_FLAG_TRANSPARENT;
|
1998-08-30 19:16:11 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::SetClientData(void *aData)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-08-28 03:05:23 +00:00
|
|
|
mClientData = aData;
|
1998-08-30 19:16:11 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::GetClientData(void *&aData) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-08-30 19:16:11 +00:00
|
|
|
aData = mClientData;
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::CreateWidget(const nsIID &aWindowIID,
|
2003-03-06 23:07:00 +00:00
|
|
|
nsWidgetInitData *aWidgetInitData,
|
|
|
|
nsNativeWidget aNative,
|
|
|
|
PRBool aEnableDragDrop,
|
|
|
|
PRBool aResetVisibility,
|
|
|
|
nsContentType aContentType)
|
1998-11-04 04:14:10 +00:00
|
|
|
{
|
|
|
|
nsIDeviceContext *dx;
|
2002-01-27 07:56:23 +00:00
|
|
|
nsRect trect = mDimBounds;
|
1998-11-04 04:14:10 +00:00
|
|
|
float scale;
|
|
|
|
|
|
|
|
NS_IF_RELEASE(mWindow);
|
|
|
|
|
|
|
|
mViewManager->GetDeviceContext(dx);
|
|
|
|
dx->GetAppUnitsToDevUnits(scale);
|
|
|
|
|
|
|
|
trect *= scale;
|
|
|
|
|
|
|
|
if (NS_OK == LoadWidget(aWindowIID))
|
|
|
|
{
|
1998-11-14 01:58:34 +00:00
|
|
|
PRBool usewidgets;
|
|
|
|
|
|
|
|
dx->SupportsNativeWidgets(usewidgets);
|
|
|
|
|
|
|
|
if (PR_TRUE == usewidgets)
|
1998-11-04 04:14:10 +00:00
|
|
|
{
|
2003-03-06 23:07:00 +00:00
|
|
|
PRBool initDataPassedIn = PR_TRUE;
|
|
|
|
nsWidgetInitData initData;
|
|
|
|
if (!aWidgetInitData) {
|
2003-03-11 19:27:30 +00:00
|
|
|
// No initData, we're a child window
|
|
|
|
// Create initData to pass in params
|
2003-03-06 23:07:00 +00:00
|
|
|
initDataPassedIn = PR_FALSE;
|
2003-03-11 19:27:30 +00:00
|
|
|
initData.clipChildren = PR_TRUE; // Clip child window's children
|
2003-03-06 23:07:00 +00:00
|
|
|
aWidgetInitData = &initData;
|
|
|
|
}
|
|
|
|
aWidgetInitData->mContentType = aContentType;
|
|
|
|
|
1998-11-14 01:58:34 +00:00
|
|
|
if (aNative)
|
|
|
|
mWindow->Create(aNative, trect, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
|
|
|
else
|
|
|
|
{
|
2003-03-06 23:07:00 +00:00
|
|
|
if (!initDataPassedIn && GetParent() &&
|
|
|
|
GetParent()->GetViewManager() != mViewManager)
|
|
|
|
initData.mListenForResizes = PR_TRUE;
|
2002-06-12 03:22:35 +00:00
|
|
|
|
1998-11-14 01:58:34 +00:00
|
|
|
nsIWidget *parent;
|
|
|
|
GetOffsetFromWidget(nsnull, nsnull, parent);
|
2002-06-12 03:22:35 +00:00
|
|
|
|
1998-11-14 01:58:34 +00:00
|
|
|
mWindow->Create(parent, trect, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
|
|
|
NS_IF_RELEASE(parent);
|
|
|
|
}
|
1999-08-26 14:41:18 +00:00
|
|
|
if (aEnableDragDrop) {
|
|
|
|
mWindow->EnableDragDrop(PR_TRUE);
|
|
|
|
}
|
1999-09-23 23:26:54 +00:00
|
|
|
|
|
|
|
// propagate the z-index to the widget.
|
2001-12-01 14:31:45 +00:00
|
|
|
mWindow->SetZIndex(mZIndex);
|
1998-11-04 04:14:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//make sure visibility state is accurate
|
2002-04-12 02:05:12 +00:00
|
|
|
|
2001-10-31 05:06:31 +00:00
|
|
|
if (aResetVisibility) {
|
|
|
|
nsViewVisibility vis;
|
|
|
|
|
|
|
|
GetVisibility(vis);
|
|
|
|
SetVisibility(vis);
|
2003-03-05 14:32:07 +00:00
|
|
|
}
|
1998-11-04 04:14:10 +00:00
|
|
|
|
|
|
|
NS_RELEASE(dx);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-07-02 12:50:14 +00:00
|
|
|
void nsView::SetZIndex(PRBool aAuto, PRInt32 aZIndex, PRBool aTopMost)
|
2001-12-01 14:31:45 +00:00
|
|
|
{
|
|
|
|
mVFlags = (mVFlags & ~NS_VIEW_FLAG_AUTO_ZINDEX) | (aAuto ? NS_VIEW_FLAG_AUTO_ZINDEX : 0);
|
|
|
|
mZIndex = aZIndex;
|
2002-07-02 12:50:14 +00:00
|
|
|
SetTopMost(aTopMost);
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
if (nsnull != mWindow) {
|
|
|
|
mWindow->SetZIndex(aZIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsView::SetWidget(nsIWidget *aWidget)
|
1998-11-04 04:14:10 +00:00
|
|
|
{
|
|
|
|
NS_IF_RELEASE(mWindow);
|
|
|
|
mWindow = aWidget;
|
|
|
|
|
|
|
|
if (nsnull != mWindow)
|
|
|
|
{
|
|
|
|
NS_ADDREF(mWindow);
|
|
|
|
mWindow->SetClientData((void *)this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::GetWidget(nsIWidget *&aWidget) const
|
1998-11-04 04:14:10 +00:00
|
|
|
{
|
|
|
|
NS_IF_ADDREF(mWindow);
|
|
|
|
aWidget = mWindow;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-14 02:51:25 +00:00
|
|
|
NS_IMETHODIMP nsView::HasWidget(PRBool *aHasWidget) const
|
|
|
|
{
|
2003-03-05 14:32:07 +00:00
|
|
|
*aHasWidget = (mWindow != nsnull);
|
|
|
|
return NS_OK;
|
1999-11-14 02:51:25 +00:00
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
//
|
|
|
|
// internal window creation functions
|
|
|
|
//
|
2001-12-01 14:31:45 +00:00
|
|
|
nsresult nsView::LoadWidget(const nsCID &aClassIID)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-11-14 02:51:25 +00:00
|
|
|
nsresult rv = nsComponentManager::CreateInstance(aClassIID, nsnull, NS_GET_IID(nsIWidget), (void**)&mWindow);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-11-14 02:51:25 +00:00
|
|
|
if (NS_OK == rv) {
|
1998-08-08 04:23:33 +00:00
|
|
|
// Set the widget's client data
|
|
|
|
mWindow->SetClientData((void*)this);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-11-14 02:51:25 +00:00
|
|
|
NS_IMETHODIMP nsView::List(FILE* out, PRInt32 aIndent) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-08-05 09:02:52 +00:00
|
|
|
PRInt32 i;
|
|
|
|
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
2001-11-07 04:05:38 +00:00
|
|
|
fprintf(out, "%p ", (void*)this);
|
1998-06-04 20:02:30 +00:00
|
|
|
if (nsnull != mWindow) {
|
|
|
|
nsRect windowBounds;
|
1999-03-18 21:04:00 +00:00
|
|
|
nsRect nonclientBounds;
|
|
|
|
float p2t;
|
|
|
|
nsIDeviceContext *dx;
|
|
|
|
mViewManager->GetDeviceContext(dx);
|
|
|
|
dx->GetDevUnitsToAppUnits(p2t);
|
|
|
|
NS_RELEASE(dx);
|
1998-11-04 21:46:00 +00:00
|
|
|
mWindow->GetClientBounds(windowBounds);
|
1999-03-18 21:04:00 +00:00
|
|
|
windowBounds *= p2t;
|
|
|
|
mWindow->GetBounds(nonclientBounds);
|
|
|
|
nonclientBounds *= p2t;
|
1999-04-19 23:22:53 +00:00
|
|
|
nsrefcnt widgetRefCnt = mWindow->AddRef() - 1;
|
|
|
|
mWindow->Release();
|
|
|
|
fprintf(out, "(widget=%p[%d] pos={%d,%d,%d,%d}) ",
|
2001-11-07 04:05:38 +00:00
|
|
|
(void*)mWindow, widgetRefCnt,
|
1999-03-18 21:04:00 +00:00
|
|
|
nonclientBounds.x, nonclientBounds.y,
|
1998-06-04 20:02:30 +00:00
|
|
|
windowBounds.width, windowBounds.height);
|
|
|
|
}
|
1998-07-07 21:51:57 +00:00
|
|
|
nsRect brect;
|
|
|
|
GetBounds(brect);
|
1999-03-18 21:04:00 +00:00
|
|
|
fprintf(out, "{%d,%d,%d,%d}",
|
|
|
|
brect.x, brect.y, brect.width, brect.height);
|
1998-10-11 01:00:59 +00:00
|
|
|
PRBool hasTransparency;
|
|
|
|
HasTransparency(hasTransparency);
|
2001-12-01 14:31:45 +00:00
|
|
|
fprintf(out, " z=%d vis=%d opc=%1.3f tran=%d clientData=%p <\n", mZIndex, mVis, mOpacity, hasTransparency, mClientData);
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView* kid = mFirstChild;
|
1998-04-13 20:24:54 +00:00
|
|
|
while (nsnull != kid) {
|
|
|
|
kid->List(out, aIndent + 1);
|
2001-11-07 04:05:38 +00:00
|
|
|
kid = kid->GetNextSibling();
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1998-08-05 09:02:52 +00:00
|
|
|
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
1998-04-13 20:24:54 +00:00
|
|
|
fputs(">\n", out);
|
1999-11-14 02:51:25 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
NS_IMETHODIMP nsView::GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-11-07 04:05:38 +00:00
|
|
|
nsView *ancestor = GetParent();
|
2000-01-26 23:04:40 +00:00
|
|
|
aWidget = nsnull;
|
1998-08-30 19:16:11 +00:00
|
|
|
|
1998-10-15 04:55:21 +00:00
|
|
|
// XXX aDx and aDy are OUT parameters and so we should initialize them
|
|
|
|
// to 0 rather than relying on the caller to do so...
|
1998-06-16 17:05:42 +00:00
|
|
|
while (nsnull != ancestor)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-08-30 19:16:11 +00:00
|
|
|
ancestor->GetWidget(aWidget);
|
2003-03-05 14:32:07 +00:00
|
|
|
if (nsnull != aWidget) {
|
2002-01-27 07:56:23 +00:00
|
|
|
// the widget's (0,0) is at the top left of the view's bounds, NOT its position
|
|
|
|
nsRect r;
|
|
|
|
ancestor->GetDimensions(r);
|
|
|
|
aDx -= r.x;
|
|
|
|
aDy -= r.y;
|
2003-03-05 14:32:07 +00:00
|
|
|
return NS_OK;
|
2002-01-27 07:56:23 +00:00
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-06-16 17:05:42 +00:00
|
|
|
if ((nsnull != aDx) && (nsnull != aDy))
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2002-01-27 07:56:23 +00:00
|
|
|
ancestor->ConvertToParentCoords(aDx, aDy);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2003-03-05 14:32:07 +00:00
|
|
|
ancestor = ancestor->GetParent();
|
1998-06-16 17:05:42 +00:00
|
|
|
}
|
|
|
|
|
2000-01-26 23:04:40 +00:00
|
|
|
if (nsnull == aWidget) {
|
2003-03-05 14:32:07 +00:00
|
|
|
// The root view doesn't have a widget
|
|
|
|
// but maybe the view manager does.
|
2001-11-07 04:05:38 +00:00
|
|
|
GetViewManager()->GetWidget(&aWidget);
|
2000-01-26 23:04:40 +00:00
|
|
|
}
|
|
|
|
|
1998-08-30 19:16:11 +00:00
|
|
|
return NS_OK;
|
1998-06-16 17:05:42 +00:00
|
|
|
}
|
|
|
|
|
2002-08-30 03:32:05 +00:00
|
|
|
nsresult nsView::GetDirtyRegion(nsIRegion*& aRegion)
|
|
|
|
{
|
|
|
|
if (nsnull == mDirtyRegion) {
|
|
|
|
nsresult rv = GetViewManager()->CreateRegion(&mDirtyRegion);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
}
|
1998-10-15 04:55:21 +00:00
|
|
|
|
2002-08-30 03:32:05 +00:00
|
|
|
aRegion = mDirtyRegion;
|
|
|
|
NS_ADDREF(aRegion);
|
|
|
|
return NS_OK;
|
1998-10-15 04:55:21 +00:00
|
|
|
}
|
|
|
|
|
Bug 109772. Cleanup views. Promote certain members of nsView and nsViewManager to stack variables. Provide non-COM versions of, and deprecate COM usage of, nsIView methods HasWidget, GetWidget, GetFloating, GetParent, GetFirstChild, GetNextSibling, GetOpacity, GetClientData, GetVisibility, GetViewManager, GetZIndex, GetPosition, and GetBounds. r+sr=dbaron
2003-06-24 01:00:46 +00:00
|
|
|
PRBool nsView::IsRoot() const
|
2000-03-23 23:49:18 +00:00
|
|
|
{
|
|
|
|
NS_ASSERTION(mViewManager != nsnull," View manager is null in nsView::IsRoot()");
|
2001-11-07 04:05:38 +00:00
|
|
|
return mViewManager->GetRootView() == this;
|
2000-03-23 23:49:18 +00:00
|
|
|
}
|
2000-04-13 21:56:27 +00:00
|
|
|
|
2001-11-07 04:05:38 +00:00
|
|
|
PRBool nsView::PointIsInside(nsView& aView, nscoord x, nscoord y) const
|
2000-04-13 21:56:27 +00:00
|
|
|
{
|
|
|
|
nsRect clippedRect;
|
|
|
|
PRBool empty;
|
|
|
|
PRBool clipped;
|
|
|
|
aView.GetClippedRect(clippedRect, clipped, empty);
|
|
|
|
if (PR_TRUE == empty) {
|
|
|
|
// Rect is completely clipped out so point can not
|
|
|
|
// be inside it.
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check to see if the point is within the clipped rect.
|
|
|
|
if (clippedRect.Contains(x, y)) {
|
|
|
|
return PR_TRUE;
|
|
|
|
} else {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsView::GetClippedRect(nsRect& aClippedRect, PRBool& aIsClipped, PRBool& aEmpty) const
|
|
|
|
{
|
2002-10-11 01:23:13 +00:00
|
|
|
// Keep track of this view's offset from its ancestor.
|
2002-09-17 04:16:25 +00:00
|
|
|
// This is the origin of this view's parent view in the
|
|
|
|
// coordinate space of 'parentView' below.
|
2000-04-13 21:56:27 +00:00
|
|
|
nscoord ancestorX = 0;
|
|
|
|
nscoord ancestorY = 0;
|
|
|
|
|
|
|
|
aEmpty = PR_FALSE;
|
|
|
|
aIsClipped = PR_FALSE;
|
|
|
|
|
|
|
|
GetBounds(aClippedRect);
|
2002-05-30 01:42:41 +00:00
|
|
|
PRBool lastViewIsFloating = GetFloating();
|
2000-04-13 21:56:27 +00:00
|
|
|
|
|
|
|
// Walk all of the way up the views to see if any
|
2002-05-30 01:42:41 +00:00
|
|
|
// ancestor sets the NS_VIEW_PUBLIC_FLAG_CLIPCHILDREN.
|
|
|
|
// don't consider non-floating ancestors of a floating view.
|
2002-09-17 04:16:25 +00:00
|
|
|
const nsView* view = this;
|
|
|
|
while (PR_TRUE) {
|
|
|
|
const nsView* parentView = view->GetParent();
|
2002-11-10 18:24:31 +00:00
|
|
|
#if 0
|
|
|
|
// For now, we're disabling this code. This means that we only honor clipping
|
|
|
|
// set by parent elements which are containing block ancestors of this content.
|
|
|
|
|
2003-05-23 22:00:34 +00:00
|
|
|
const nsView* zParent = view->GetZParent();
|
2002-09-17 04:16:25 +00:00
|
|
|
if (zParent) {
|
2002-10-11 01:23:13 +00:00
|
|
|
// This view was reparented. We need to continue collecting clip
|
|
|
|
// rects from the zParent.
|
2002-09-17 04:16:25 +00:00
|
|
|
|
2002-10-11 01:23:13 +00:00
|
|
|
// First we need to get ancestorX and ancestorY into the right
|
|
|
|
// coordinate system. They are the offset of this view within
|
|
|
|
// parentView
|
2002-09-17 04:16:25 +00:00
|
|
|
const nsView* zParentChain;
|
2002-10-11 01:23:13 +00:00
|
|
|
for (zParentChain = zParent; zParentChain != parentView && zParentChain != nsnull;
|
2002-09-17 04:16:25 +00:00
|
|
|
zParentChain = zParentChain->GetParent()) {
|
|
|
|
zParentChain->ConvertFromParentCoords(&ancestorX, &ancestorY);
|
|
|
|
}
|
2002-10-11 01:23:13 +00:00
|
|
|
if (zParentChain == nsnull) {
|
|
|
|
// normally we'll hit parentView somewhere, but sometimes we
|
|
|
|
// don't because of odd containing block hierarchies. In this
|
|
|
|
// case we walked from zParentChain all the way up to the
|
|
|
|
// root, subtracting from ancestorX/Y. So now we walk from
|
|
|
|
// parentView up to the root, adding to ancestorX/Y.
|
|
|
|
while (parentView != nsnull) {
|
|
|
|
parentView->ConvertToParentCoords(&ancestorX, &ancestorY);
|
|
|
|
parentView = parentView->GetParent();
|
|
|
|
}
|
|
|
|
}
|
2002-09-17 04:16:25 +00:00
|
|
|
parentView = zParent;
|
|
|
|
// Now start again at zParent to collect all its clip information
|
|
|
|
}
|
2002-11-10 18:24:31 +00:00
|
|
|
#endif
|
2002-09-17 04:16:25 +00:00
|
|
|
|
|
|
|
if (!parentView) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-06-12 03:18:10 +00:00
|
|
|
PRBool parentIsFloating = parentView->GetFloating();
|
|
|
|
if (lastViewIsFloating && !parentIsFloating) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-06-04 04:55:04 +00:00
|
|
|
if (parentView->GetClipChildren()) {
|
2000-04-13 21:56:27 +00:00
|
|
|
// Adjust for clip specified by ancestor
|
|
|
|
nsRect clipRect;
|
2002-08-08 01:03:57 +00:00
|
|
|
parentView->GetChildClip(clipRect);
|
2000-04-13 21:56:27 +00:00
|
|
|
//Offset the cliprect by the amount the child offsets from the parent
|
2002-09-17 04:16:25 +00:00
|
|
|
clipRect.x -= ancestorX;
|
|
|
|
clipRect.y -= ancestorY;
|
2003-02-25 02:38:38 +00:00
|
|
|
|
|
|
|
nsRect oldClippedRect = aClippedRect;
|
2000-04-13 21:56:27 +00:00
|
|
|
PRBool overlap = aClippedRect.IntersectRect(clipRect, aClippedRect);
|
|
|
|
if (!overlap) {
|
2003-02-25 02:38:38 +00:00
|
|
|
aIsClipped = PR_TRUE;
|
2000-04-13 21:56:27 +00:00
|
|
|
aEmpty = PR_TRUE; // Does not intersect so the rect is empty.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2003-02-25 02:38:38 +00:00
|
|
|
|
|
|
|
if (oldClippedRect != aClippedRect) {
|
|
|
|
aIsClipped = PR_TRUE;
|
|
|
|
}
|
2000-04-13 21:56:27 +00:00
|
|
|
}
|
|
|
|
|
2002-09-17 04:16:25 +00:00
|
|
|
parentView->ConvertToParentCoords(&ancestorX, &ancestorY);
|
2000-04-13 21:56:27 +00:00
|
|
|
|
2002-06-04 04:55:04 +00:00
|
|
|
lastViewIsFloating = parentIsFloating;
|
2002-09-17 04:16:25 +00:00
|
|
|
view = parentView;
|
2000-04-13 21:56:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|