зеркало из https://github.com/mozilla/pjs.git
Bug 73382. Let the view code work with nsView*/nsViewManager* internally and migrate some methods from public to private to the view module. Also deCOMify those methods for speed. r=kmmclusk,sr=attinasi
This commit is contained in:
Родитель
22591ea16a
Коммит
06d956a0b3
|
@ -255,15 +255,6 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const = 0;
|
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Called to set the Z-order parent of the view. This is the
|
|
||||||
* parent from which we derive our Z-order grouping. It might not
|
|
||||||
* be the same as the geometric parent.
|
|
||||||
* @param aParent new parent
|
|
||||||
*/
|
|
||||||
NS_IMETHOD SetZParent(nsIView *aZParent) = 0;
|
|
||||||
NS_IMETHOD GetZParent(nsIView *&aZParent) const = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to indicate that the z-index of a view has been changed.
|
* Called to indicate that the z-index of a view has been changed.
|
||||||
* The z-index is relative to all siblings of the view.
|
* The z-index is relative to all siblings of the view.
|
||||||
|
@ -304,13 +295,6 @@ public:
|
||||||
NS_IMETHOD SetFloating(PRBool aFloatingView) = 0;
|
NS_IMETHOD SetFloating(PRBool aFloatingView) = 0;
|
||||||
NS_IMETHOD GetFloating(PRBool &aFloatingView) const = 0;
|
NS_IMETHOD GetFloating(PRBool &aFloatingView) const = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Called to set the parent of the view. This is the geometric parent
|
|
||||||
* (from which we derive our coordinate system).
|
|
||||||
* @param aParent new parent
|
|
||||||
*/
|
|
||||||
NS_IMETHOD SetParent(nsIView *aParent) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to query the parent of the view.
|
* Called to query the parent of the view.
|
||||||
* @result view's parent
|
* @result view's parent
|
||||||
|
@ -323,43 +307,6 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const = 0;
|
NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Called to set the next sibling of the view.
|
|
||||||
* @param aNextSibling new next sibling
|
|
||||||
*/
|
|
||||||
NS_IMETHOD SetNextSibling(nsIView* aNextSibling) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to insert a child after the specified sibling. In general,
|
|
||||||
* child insertion will happen through the view manager and it
|
|
||||||
* will determine the ordering of children in the child list.
|
|
||||||
* @param child to insert in this view's child list
|
|
||||||
* @param sibling view to set as previous sibling of child
|
|
||||||
* if nsnull, then child is inserted at head of list
|
|
||||||
*/
|
|
||||||
NS_IMETHOD InsertChild(nsIView *aChild, nsIView *aSibling) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a child from the child list. The removal will be driven
|
|
||||||
* through the view manager.
|
|
||||||
* @param child to remove
|
|
||||||
*/
|
|
||||||
NS_IMETHOD RemoveChild(nsIView *aChild) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the number of children for this view.
|
|
||||||
* @result child count
|
|
||||||
*/
|
|
||||||
NS_IMETHOD GetChildCount(PRInt32 &aCount) const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a child at a specific index. Could be replaced by some sort of
|
|
||||||
* enumeration API.
|
|
||||||
* @param index of desired child view
|
|
||||||
* @result the view at index or nsnull if there is no such child
|
|
||||||
*/
|
|
||||||
NS_IMETHOD GetChild(PRInt32 index, nsIView*& aChild) const = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: This didn't exist in 4.0. Called to set the opacity of a view.
|
* Note: This didn't exist in 4.0. Called to set the opacity of a view.
|
||||||
* A value of 0.0 means completely transparent. A value of 1.0 means
|
* A value of 0.0 means completely transparent. A value of 1.0 means
|
||||||
|
@ -500,14 +447,6 @@ public:
|
||||||
NS_IMETHOD SetCompositorFlags(PRUint32 aFlags) = 0;
|
NS_IMETHOD SetCompositorFlags(PRUint32 aFlags) = 0;
|
||||||
NS_IMETHOD GetCompositorFlags(PRUint32 *aFlags) = 0;
|
NS_IMETHOD GetCompositorFlags(PRUint32 *aFlags) = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the extents of the view tree from 'this' down.
|
|
||||||
* 'this' is the coordinate system origin.
|
|
||||||
* @param aExtents out paramemter for extents
|
|
||||||
* @return error status
|
|
||||||
*/
|
|
||||||
NS_IMETHOD GetExtents(nsRect *aExtents) = 0;
|
|
||||||
|
|
||||||
// XXX Temporary for Bug #19416
|
// XXX Temporary for Bug #19416
|
||||||
NS_IMETHOD IgnoreSetPosition(PRBool aShouldIgnore) = 0;
|
NS_IMETHOD IgnoreSetPosition(PRBool aShouldIgnore) = 0;
|
||||||
|
|
||||||
|
|
|
@ -320,22 +320,6 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD MoveViewBelow(nsIView *aView, nsIView *aOther) = 0;
|
NS_IMETHOD MoveViewBelow(nsIView *aView, nsIView *aOther) = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether a view is actually shown (based on its visibility
|
|
||||||
* and that of its ancestors).
|
|
||||||
* @param aView view to query visibilty of
|
|
||||||
* @result PR_TRUE if visible, else PR_FALSE
|
|
||||||
*/
|
|
||||||
NS_IMETHOD IsViewShown(nsIView *aView, PRBool &aResult) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the clipping area of a view in absolute coordinates.
|
|
||||||
* @param aView view to query clip rect of
|
|
||||||
* @param rect to set with view's clipping rect
|
|
||||||
* @result PR_TRUE if there is a clip rect, else PR_FALSE
|
|
||||||
*/
|
|
||||||
NS_IMETHOD GetViewClipAbsolute(nsIView *aView, nsRect *aRect, PRBool &aResult) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used set the transparency status of the content in a view. see
|
* Used set the transparency status of the content in a view. see
|
||||||
* nsIView.HasTransparency().
|
* nsIView.HasTransparency().
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "nsScrollPortView.h"
|
#include "nsScrollPortView.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "nsUnitConversion.h"
|
#include "nsUnitConversion.h"
|
||||||
#include "nsIViewManager.h"
|
|
||||||
#include "nsIPresContext.h"
|
#include "nsIPresContext.h"
|
||||||
#include "nsIScrollbar.h"
|
#include "nsIScrollbar.h"
|
||||||
#include "nsIDeviceContext.h"
|
#include "nsIDeviceContext.h"
|
||||||
|
@ -52,6 +51,7 @@
|
||||||
#include "nsISupportsArray.h"
|
#include "nsISupportsArray.h"
|
||||||
#include "nsIScrollPositionListener.h"
|
#include "nsIScrollPositionListener.h"
|
||||||
#include "nsIRegion.h"
|
#include "nsIRegion.h"
|
||||||
|
#include "nsViewManager.h"
|
||||||
|
|
||||||
static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);
|
static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);
|
||||||
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||||
|
@ -199,13 +199,8 @@ NS_IMETHODIMP nsScrollPortView::GetContainerSize(nscoord *aWidth, nscoord *aHeig
|
||||||
*aWidth = 0;
|
*aWidth = 0;
|
||||||
*aHeight = 0;
|
*aHeight = 0;
|
||||||
|
|
||||||
nsIView *scrolledView = 0;
|
nsView *scrolledView = GetScrolledView();
|
||||||
|
|
||||||
nsresult result = GetScrolledView(scrolledView);
|
|
||||||
|
|
||||||
if (NS_FAILED(result))
|
|
||||||
return result;
|
|
||||||
|
|
||||||
if (!scrolledView)
|
if (!scrolledView)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
@ -248,7 +243,6 @@ NS_IMETHODIMP nsScrollPortView::ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdat
|
||||||
|
|
||||||
|
|
||||||
PRInt32 dxPx = 0, dyPx = 0;
|
PRInt32 dxPx = 0, dyPx = 0;
|
||||||
nsIView *scrolledView;
|
|
||||||
|
|
||||||
// convert to pixels
|
// convert to pixels
|
||||||
nsIDeviceContext *dev;
|
nsIDeviceContext *dev;
|
||||||
|
@ -264,7 +258,7 @@ NS_IMETHODIMP nsScrollPortView::ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdat
|
||||||
// Update the scrolled view's position
|
// Update the scrolled view's position
|
||||||
|
|
||||||
// make sure the new position in in bounds
|
// make sure the new position in in bounds
|
||||||
GetScrolledView(scrolledView);
|
nsView* scrolledView = GetScrolledView();
|
||||||
|
|
||||||
#ifdef DEBUG_pollmann
|
#ifdef DEBUG_pollmann
|
||||||
NS_ASSERTION(scrolledView, "no scrolled view");
|
NS_ASSERTION(scrolledView, "no scrolled view");
|
||||||
|
@ -374,7 +368,7 @@ NS_IMETHODIMP nsScrollPortView::GetScrollbarVisibility(PRBool *aVerticalVisible,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nsScrollPortView::AdjustChildWidgets(nsScrollPortView *aScrolling, nsIView *aView, nscoord aDx, nscoord aDy, float scale)
|
void nsScrollPortView::AdjustChildWidgets(nsScrollPortView *aScrolling, nsView *aView, nscoord aDx, nscoord aDy, float scale)
|
||||||
{
|
{
|
||||||
|
|
||||||
nscoord offx, offy;
|
nscoord offx, offy;
|
||||||
|
@ -391,8 +385,8 @@ void nsScrollPortView::AdjustChildWidgets(nsScrollPortView *aScrolling, nsIView
|
||||||
aDx += offx;
|
aDx += offx;
|
||||||
aDy += offy;
|
aDy += offy;
|
||||||
|
|
||||||
nsIView *kid;
|
nsView *kid;
|
||||||
for (aView->GetChild(0, kid); kid != nsnull; kid->GetNextSibling(kid))
|
for (kid = aView->GetFirstChild(); kid != nsnull; kid = kid->GetNextSibling())
|
||||||
{
|
{
|
||||||
nsIWidget *win;
|
nsIWidget *win;
|
||||||
kid->GetWidget(win);
|
kid->GetWidget(win);
|
||||||
|
@ -425,16 +419,14 @@ void nsScrollPortView::AdjustChildWidgets(nsScrollPortView *aScrolling, nsIView
|
||||||
|
|
||||||
NS_IMETHODIMP nsScrollPortView::SetScrolledView(nsIView *aScrolledView)
|
NS_IMETHODIMP nsScrollPortView::SetScrolledView(nsIView *aScrolledView)
|
||||||
{
|
{
|
||||||
PRInt32 count = 0;
|
PRInt32 count = GetChildCount();
|
||||||
GetChildCount(count);
|
|
||||||
|
|
||||||
NS_ASSERTION(count <= 1,"Error scroll port has too many children");
|
NS_ASSERTION(count <= 1,"Error scroll port has too many children");
|
||||||
|
|
||||||
// if there is already a child so remove it
|
// if there is already a child so remove it
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
{
|
{
|
||||||
nsIView* child = nsnull;
|
nsView* child = GetFirstChild();
|
||||||
GetChild(0, child);
|
|
||||||
mViewManager->RemoveChild(this, child);
|
mViewManager->RemoveChild(this, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +436,8 @@ NS_IMETHODIMP nsScrollPortView::SetScrolledView(nsIView *aScrolledView)
|
||||||
|
|
||||||
NS_IMETHODIMP nsScrollPortView::GetScrolledView(nsIView *&aScrolledView) const
|
NS_IMETHODIMP nsScrollPortView::GetScrolledView(nsIView *&aScrolledView) const
|
||||||
{
|
{
|
||||||
return GetChild(0, aScrolledView);
|
aScrolledView = GetScrolledView();
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsScrollPortView::GetScrollPosition(nscoord &aX, nscoord &aY) const
|
NS_IMETHODIMP nsScrollPortView::GetScrollPosition(nscoord &aX, nscoord &aY) const
|
||||||
|
@ -523,7 +516,7 @@ NS_IMETHODIMP nsScrollPortView::ScrollByWhole(PRBool aTop)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsScrollPortView::CannotBitBlt(nsIView* aScrolledView)
|
PRBool nsScrollPortView::CannotBitBlt(nsView* aScrolledView)
|
||||||
{
|
{
|
||||||
PRBool trans;
|
PRBool trans;
|
||||||
float opacity;
|
float opacity;
|
||||||
|
@ -539,7 +532,7 @@ PRBool nsScrollPortView::CannotBitBlt(nsIView* aScrolledView)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nsScrollPortView::Scroll(nsIView *aScrolledView, PRInt32 aDx, PRInt32 aDy, float scale, PRUint32 aUpdateFlags)
|
void nsScrollPortView::Scroll(nsView *aScrolledView, PRInt32 aDx, PRInt32 aDy, float scale, PRUint32 aUpdateFlags)
|
||||||
{
|
{
|
||||||
if ((aDx != 0) || (aDy != 0))
|
if ((aDx != 0) || (aDy != 0))
|
||||||
{
|
{
|
||||||
|
@ -588,3 +581,19 @@ NS_IMETHODIMP nsScrollPortView::Paint(nsIRenderingContext& rc, const nsRect& rec
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsScrollPortView::Paint(nsIRenderingContext& aRC, const nsIRegion& aRegion,
|
||||||
|
PRUint32 aPaintFlags, PRBool &aResult)
|
||||||
|
{
|
||||||
|
PRBool clipEmpty;
|
||||||
|
aRC.PushState();
|
||||||
|
nsRect bounds = mBounds;
|
||||||
|
bounds.x = bounds.y = 0;
|
||||||
|
aRC.SetClipRect(bounds, nsClipCombine_kIntersect, clipEmpty);
|
||||||
|
|
||||||
|
nsresult rv = nsView::Paint(aRC, aRegion, aPaintFlags, aResult);
|
||||||
|
|
||||||
|
aRC.PopState(clipEmpty);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
|
@ -98,25 +98,12 @@ public:
|
||||||
NS_IMETHOD AddScrollPositionListener(nsIScrollPositionListener* aListener);
|
NS_IMETHOD AddScrollPositionListener(nsIScrollPositionListener* aListener);
|
||||||
NS_IMETHOD RemoveScrollPositionListener(nsIScrollPositionListener* aListener);
|
NS_IMETHOD RemoveScrollPositionListener(nsIScrollPositionListener* aListener);
|
||||||
|
|
||||||
//locals
|
// local to the view module
|
||||||
//void HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
|
||||||
|
|
||||||
// Set the visibility of a nsScrollPortView's component
|
|
||||||
// @param aView nsScrollPortView component to set visibility for or nsnull.
|
|
||||||
// @param aViewVisibility new setting for the component view If not the same as the current setting
|
|
||||||
// @returns the result of calling the SetVisibility on the component.
|
|
||||||
//nsresult SetComponentVisibility(nsIView* aView, nsViewVisibility aViewVisibility);
|
|
||||||
|
|
||||||
// Update the visibility of the nsScrollPortView's components (ClipView, CornerView, ScrollBarView's)
|
|
||||||
// @param aScrollingViewVisibility Visibility setting of the ScrollingView to consider when
|
|
||||||
// setting the visibility of the components. If aScrollingViewVisibility == nsViewVisibility_kInherit then
|
|
||||||
// UpdateComponent has no effect.
|
|
||||||
// @returns the result of calling SetComponentVisibility for each component.
|
|
||||||
//nsresult UpdateComponentVisibility(nsViewVisibility aScrollingViewVisibility);
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsRect& rect,
|
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||||
PRUint32 aPaintFlags, PRBool &Result);
|
PRUint32 aPaintFlags, PRBool &Result);
|
||||||
|
NS_IMETHOD Paint(nsIRenderingContext& aRC, const nsIRegion& aRegion,
|
||||||
|
PRUint32 aPaintFlags, PRBool &Result);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||||
|
@ -129,22 +116,13 @@ protected:
|
||||||
//NS_IMETHOD_(void) Notify(nsITimer *timer);
|
//NS_IMETHOD_(void) Notify(nsITimer *timer);
|
||||||
|
|
||||||
//private
|
//private
|
||||||
void AdjustChildWidgets(nsScrollPortView *aScrolling, nsIView *aView, nscoord aDx, nscoord aDy, float aScale);
|
nsView* GetScrolledView() const { return GetFirstChild(); }
|
||||||
//void UpdateScrollControls(PRBool aPaint);
|
void AdjustChildWidgets(nsScrollPortView *aScrolling, nsView *aView, nscoord aDx, nscoord aDy, float aScale);
|
||||||
void Scroll(nsIView *aScrolledView, PRInt32 aDx, PRInt32 aDy, float scale, PRUint32 aUpdateFlags);
|
void Scroll(nsView *aScrolledView, PRInt32 aDx, PRInt32 aDy, float scale, PRUint32 aUpdateFlags);
|
||||||
PRBool CannotBitBlt(nsIView* aScrolledView);
|
PRBool CannotBitBlt(nsView* aScrolledView);
|
||||||
protected:
|
protected:
|
||||||
//nscoord mSizeX, mSizeY;
|
|
||||||
nscoord mOffsetX, mOffsetY;
|
nscoord mOffsetX, mOffsetY;
|
||||||
nscoord mOffsetXpx, mOffsetYpx;
|
nscoord mOffsetXpx, mOffsetYpx;
|
||||||
//nsIView *mClipView;
|
|
||||||
//nsIView *mVScrollBarView;
|
|
||||||
//nsIView *mHScrollBarView;
|
|
||||||
//nsIView *mCornerView;
|
|
||||||
//nsScrollPreference mScrollPref;
|
|
||||||
//nsMargin mInsets;
|
|
||||||
//nsITimer *mScrollingTimer;
|
|
||||||
//nscoord mScrollingDelta;
|
|
||||||
PRUint32 mScrollProperties;
|
PRUint32 mScrollProperties;
|
||||||
nscoord mLineHeight;
|
nscoord mLineHeight;
|
||||||
nsISupportsArray *mListeners;
|
nsISupportsArray *mListeners;
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "nsScrollingView.h"
|
#include "nsScrollingView.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "nsUnitConversion.h"
|
#include "nsUnitConversion.h"
|
||||||
#include "nsIViewManager.h"
|
|
||||||
#include "nsIPresContext.h"
|
#include "nsIPresContext.h"
|
||||||
#include "nsIScrollbar.h"
|
#include "nsIScrollbar.h"
|
||||||
#include "nsIDeviceContext.h"
|
#include "nsIDeviceContext.h"
|
||||||
|
@ -52,6 +51,7 @@
|
||||||
#include "nsISupportsArray.h"
|
#include "nsISupportsArray.h"
|
||||||
#include "nsIScrollPositionListener.h"
|
#include "nsIScrollPositionListener.h"
|
||||||
#include "nsIRegion.h"
|
#include "nsIRegion.h"
|
||||||
|
#include "nsViewManager.h"
|
||||||
|
|
||||||
static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);
|
static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);
|
||||||
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||||
|
@ -535,7 +535,6 @@ NS_IMETHODIMP nsScrollingView::SetPosition(nscoord aX, nscoord aY)
|
||||||
nsIWidget *thiswin;
|
nsIWidget *thiswin;
|
||||||
GetWidget(thiswin);
|
GetWidget(thiswin);
|
||||||
float t2p;
|
float t2p;
|
||||||
nsIView *scrolledView;
|
|
||||||
|
|
||||||
if (nsnull == thiswin)
|
if (nsnull == thiswin)
|
||||||
GetOffsetFromWidget(nsnull, nsnull, thiswin);
|
GetOffsetFromWidget(nsnull, nsnull, thiswin);
|
||||||
|
@ -548,8 +547,7 @@ NS_IMETHODIMP nsScrollingView::SetPosition(nscoord aX, nscoord aY)
|
||||||
mViewManager->GetDeviceContext(dx);
|
mViewManager->GetDeviceContext(dx);
|
||||||
dx->GetAppUnitsToDevUnits(t2p);
|
dx->GetAppUnitsToDevUnits(t2p);
|
||||||
|
|
||||||
GetScrolledView(scrolledView);
|
nsView* scrolledView = GetScrolledView();
|
||||||
|
|
||||||
if (scrolledView)
|
if (scrolledView)
|
||||||
{
|
{
|
||||||
// Adjust the positions of the scrollbars and clip view's widget
|
// Adjust the positions of the scrollbars and clip view's widget
|
||||||
|
@ -568,7 +566,7 @@ NS_IMETHODIMP nsScrollingView::SetPosition(nscoord aX, nscoord aY)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsScrollingView::SetComponentVisibility(nsIView* aView, nsViewVisibility aViewVisibility)
|
nsScrollingView::SetComponentVisibility(nsView* aView, nsViewVisibility aViewVisibility)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
if (nsnull != aView) {
|
if (nsnull != aView) {
|
||||||
|
@ -757,8 +755,7 @@ void nsScrollingView::HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags
|
||||||
mOffsetY = offsetY;
|
mOffsetY = offsetY;
|
||||||
|
|
||||||
// Position the scrolled view
|
// Position the scrolled view
|
||||||
nsIView *scrolledView;
|
nsView *scrolledView = GetScrolledView();
|
||||||
GetScrolledView(scrolledView);
|
|
||||||
if(scrolledView) {
|
if(scrolledView) {
|
||||||
scrolledView->SetPosition(-mOffsetX, -mOffsetY);
|
scrolledView->SetPosition(-mOffsetX, -mOffsetY);
|
||||||
Scroll(scrolledView, dx, dy, t2p, 0);
|
Scroll(scrolledView, dx, dy, t2p, 0);
|
||||||
|
@ -769,8 +766,6 @@ void nsScrollingView::HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags
|
||||||
NS_IMETHODIMP_(void) nsScrollingView::Notify(nsITimer * aTimer)
|
NS_IMETHODIMP_(void) nsScrollingView::Notify(nsITimer * aTimer)
|
||||||
{
|
{
|
||||||
nscoord xoff, yoff;
|
nscoord xoff, yoff;
|
||||||
nsIView *view;
|
|
||||||
GetScrolledView(view);
|
|
||||||
|
|
||||||
// First do the scrolling of the view
|
// First do the scrolling of the view
|
||||||
xoff = mOffsetX;
|
xoff = mOffsetX;
|
||||||
|
@ -896,11 +891,10 @@ NS_IMETHODIMP nsScrollingView::CreateScrollControls(nsNativeWidget aNative)
|
||||||
|
|
||||||
// Find Parent view with window and remember the window
|
// Find Parent view with window and remember the window
|
||||||
nsIWidget * win = nsnull;
|
nsIWidget * win = nsnull;
|
||||||
nsIView * view = (nsIView *)this;
|
nsView * view = this;
|
||||||
view->GetWidget(win);
|
view->GetWidget(win);
|
||||||
while (win == nsnull) {
|
while (win == nsnull) {
|
||||||
nsIView * parent;
|
nsView * parent = view->GetParent();
|
||||||
view->GetParent(parent);
|
|
||||||
if (nsnull == parent) {
|
if (nsnull == parent) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -973,8 +967,7 @@ NS_IMETHODIMP nsScrollingView::SetZIndex(PRInt32 aZIndex)
|
||||||
|
|
||||||
NS_IMETHODIMP nsScrollingView::ComputeScrollOffsets(PRBool aAdjustWidgets)
|
NS_IMETHODIMP nsScrollingView::ComputeScrollOffsets(PRBool aAdjustWidgets)
|
||||||
{
|
{
|
||||||
nsIView *scrolledView;
|
nsView *scrolledView = GetScrolledView();
|
||||||
GetScrolledView(scrolledView);
|
|
||||||
nsIScrollbar *scrollv = nsnull, *scrollh = nsnull;
|
nsIScrollbar *scrollv = nsnull, *scrollh = nsnull;
|
||||||
PRBool hasVertical = PR_TRUE, hasHorizontal = PR_FALSE;
|
PRBool hasVertical = PR_TRUE, hasHorizontal = PR_FALSE;
|
||||||
nsIWidget *win;
|
nsIWidget *win;
|
||||||
|
@ -1280,7 +1273,6 @@ NS_IMETHODIMP nsScrollingView::ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdate
|
||||||
nsSize clipSize;
|
nsSize clipSize;
|
||||||
nsIWidget *widget;
|
nsIWidget *widget;
|
||||||
PRInt32 dx = 0, dy = 0;
|
PRInt32 dx = 0, dy = 0;
|
||||||
nsIView *scrolledView;
|
|
||||||
|
|
||||||
mViewManager->GetDeviceContext(dev);
|
mViewManager->GetDeviceContext(dev);
|
||||||
dev->GetAppUnitsToDevUnits(t2p);
|
dev->GetAppUnitsToDevUnits(t2p);
|
||||||
|
@ -1353,7 +1345,7 @@ NS_IMETHODIMP nsScrollingView::ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdate
|
||||||
|
|
||||||
// Update the scrolled view's position
|
// Update the scrolled view's position
|
||||||
|
|
||||||
GetScrolledView(scrolledView);
|
nsView* scrolledView = GetScrolledView();
|
||||||
|
|
||||||
NotifyScrollPositionWillChange(aX, aY);
|
NotifyScrollPositionWillChange(aX, aY);
|
||||||
|
|
||||||
|
@ -1392,7 +1384,8 @@ NS_IMETHODIMP nsScrollingView::GetScrollbarVisibility(PRBool *aVerticalVisible,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsScrollingView::AdjustChildWidgets(nsScrollingView *aScrolling, nsIView *aView, nscoord aDx, nscoord aDy, float scale)
|
void nsScrollingView::AdjustChildWidgets(nsScrollingView *aScrolling, nsView *aView,
|
||||||
|
nscoord aDx, nscoord aDy, float scale)
|
||||||
{
|
{
|
||||||
nscoord offx, offy;
|
nscoord offx, offy;
|
||||||
PRBool isscroll = PR_FALSE;
|
PRBool isscroll = PR_FALSE;
|
||||||
|
@ -1409,8 +1402,8 @@ void nsScrollingView::AdjustChildWidgets(nsScrollingView *aScrolling, nsIView *a
|
||||||
aDx += offx;
|
aDx += offx;
|
||||||
aDy += offy;
|
aDy += offy;
|
||||||
|
|
||||||
nsIView *kid;
|
nsView* kid;
|
||||||
for (aView->GetChild(0, kid); kid != nsnull; kid->GetNextSibling(kid))
|
for (kid = aView->GetFirstChild(); kid != nsnull; kid = kid->GetNextSibling())
|
||||||
{
|
{
|
||||||
nsIWidget *win;
|
nsIWidget *win;
|
||||||
kid->GetWidget(win);
|
kid->GetWidget(win);
|
||||||
|
@ -1528,15 +1521,19 @@ NS_IMETHODIMP nsScrollingView::SetScrolledView(nsIView *aScrolledView)
|
||||||
return mViewManager->InsertChild(mClipView, aScrolledView, 0);
|
return mViewManager->InsertChild(mClipView, aScrolledView, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsView* nsScrollingView::GetScrolledView() const
|
||||||
|
{
|
||||||
|
if (nsnull != mClipView) {
|
||||||
|
return mClipView->GetFirstChild();
|
||||||
|
} else {
|
||||||
|
return nsnull;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsScrollingView::GetScrolledView(nsIView *&aScrolledView) const
|
NS_IMETHODIMP nsScrollingView::GetScrolledView(nsIView *&aScrolledView) const
|
||||||
{
|
{
|
||||||
if (nsnull != mClipView)
|
aScrolledView = GetScrolledView();
|
||||||
return mClipView->GetChild(0, aScrolledView);
|
return NS_OK;
|
||||||
else
|
|
||||||
{
|
|
||||||
aScrolledView = nsnull;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsScrollingView::GetScrollPosition(nscoord &aX, nscoord &aY) const
|
NS_IMETHODIMP nsScrollingView::GetScrollPosition(nscoord &aX, nscoord &aY) const
|
||||||
|
@ -1673,7 +1670,7 @@ NS_IMETHODIMP nsScrollingView::ScrollByWhole(PRBool aTop)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsScrollingView::CannotBitBlt(nsIView* aScrolledView)
|
PRBool nsScrollingView::CannotBitBlt(nsView* aScrolledView)
|
||||||
{
|
{
|
||||||
PRBool trans;
|
PRBool trans;
|
||||||
float opacity;
|
float opacity;
|
||||||
|
@ -1688,7 +1685,8 @@ PRBool nsScrollingView::CannotBitBlt(nsIView* aScrolledView)
|
||||||
(scrolledViewFlags & NS_VIEW_PUBLIC_FLAG_DONT_BITBLT);
|
(scrolledViewFlags & NS_VIEW_PUBLIC_FLAG_DONT_BITBLT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsScrollingView::Scroll(nsIView *aScrolledView, PRInt32 aDx, PRInt32 aDy, float scale, PRUint32 aUpdateFlags)
|
void nsScrollingView::Scroll(nsView *aScrolledView, PRInt32 aDx, PRInt32 aDy,
|
||||||
|
float scale, PRUint32 aUpdateFlags)
|
||||||
{
|
{
|
||||||
if ((aDx != 0) || (aDy != 0))
|
if ((aDx != 0) || (aDy != 0))
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,14 +102,14 @@ public:
|
||||||
NS_IMETHOD AddScrollPositionListener(nsIScrollPositionListener* aListener);
|
NS_IMETHOD AddScrollPositionListener(nsIScrollPositionListener* aListener);
|
||||||
NS_IMETHOD RemoveScrollPositionListener(nsIScrollPositionListener* aListener);
|
NS_IMETHOD RemoveScrollPositionListener(nsIScrollPositionListener* aListener);
|
||||||
|
|
||||||
//locals
|
// local to view module
|
||||||
void HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
void HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
||||||
|
|
||||||
// Set the visibility of a nsScrollingView's component
|
// Set the visibility of a nsScrollingView's component
|
||||||
// @param aView nsScrollingView component to set visibility for or nsnull.
|
// @param aView nsScrollingView component to set visibility for or nsnull.
|
||||||
// @param aViewVisibility new setting for the component view If not the same as the current setting
|
// @param aViewVisibility new setting for the component view If not the same as the current setting
|
||||||
// @returns the result of calling the SetVisibility on the component.
|
// @returns the result of calling the SetVisibility on the component.
|
||||||
nsresult SetComponentVisibility(nsIView* aView, nsViewVisibility aViewVisibility);
|
nsresult SetComponentVisibility(nsView* aView, nsViewVisibility aViewVisibility);
|
||||||
|
|
||||||
// Update the visibility of the nsScrollingView's components (ClipView, CornerView, ScrollBarView's)
|
// Update the visibility of the nsScrollingView's components (ClipView, CornerView, ScrollBarView's)
|
||||||
// @param aScrollingViewVisibility Visibility setting of the ScrollingView to consider when
|
// @param aScrollingViewVisibility Visibility setting of the ScrollingView to consider when
|
||||||
|
@ -121,6 +121,7 @@ public:
|
||||||
nsresult NotifyScrollPositionWillChange(nscoord aX, nscoord aY);
|
nsresult NotifyScrollPositionWillChange(nscoord aX, nscoord aY);
|
||||||
nsresult NotifyScrollPositionDidChange(nscoord aX, nscoord aY);
|
nsresult NotifyScrollPositionDidChange(nscoord aX, nscoord aY);
|
||||||
|
|
||||||
|
nsView* GetScrolledView() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||||
|
@ -133,19 +134,18 @@ protected:
|
||||||
NS_IMETHOD_(void) Notify(nsITimer *timer);
|
NS_IMETHOD_(void) Notify(nsITimer *timer);
|
||||||
|
|
||||||
//private
|
//private
|
||||||
void AdjustChildWidgets(nsScrollingView *aScrolling, nsIView *aView, nscoord aDx, nscoord aDy, float aScale);
|
void AdjustChildWidgets(nsScrollingView *aScrolling, nsView *aView, nscoord aDx, nscoord aDy, float aScale);
|
||||||
void UpdateScrollControls(PRBool aPaint);
|
void UpdateScrollControls(PRBool aPaint);
|
||||||
void Scroll(nsIView *aScrolledView, PRInt32 aDx, PRInt32 aDy, float scale, PRUint32 aUpdateFlags);
|
void Scroll(nsView *aScrolledView, PRInt32 aDx, PRInt32 aDy, float scale, PRUint32 aUpdateFlags);
|
||||||
PRBool CannotBitBlt(nsIView* aScrolledView);
|
PRBool CannotBitBlt(nsView* aScrolledView);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nscoord mSizeX, mSizeY;
|
nscoord mSizeX, mSizeY;
|
||||||
nscoord mOffsetX, mOffsetY;
|
nscoord mOffsetX, mOffsetY;
|
||||||
nsIView *mClipView;
|
nsView *mClipView;
|
||||||
nsIView *mVScrollBarView;
|
nsView *mVScrollBarView;
|
||||||
nsIView *mHScrollBarView;
|
nsView *mHScrollBarView;
|
||||||
nsIView *mCornerView;
|
nsView *mCornerView;
|
||||||
nsScrollPreference mScrollPref;
|
nsScrollPreference mScrollPref;
|
||||||
nsMargin mInsets;
|
nsMargin mInsets;
|
||||||
nsCOMPtr<nsITimer> mScrollingTimer;
|
nsCOMPtr<nsITimer> mScrollingTimer;
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#include "nsView.h"
|
#include "nsView.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "nsIViewManager.h"
|
#include "nsViewManager.h"
|
||||||
#include "nsIFrame.h"
|
#include "nsIFrame.h"
|
||||||
#include "nsIPresContext.h"
|
#include "nsIPresContext.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
|
@ -72,15 +72,13 @@ nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent)
|
||||||
//printf(" %d %d %d (%d,%d) \n", aEvent->widget, aEvent->widgetSupports,
|
//printf(" %d %d %d (%d,%d) \n", aEvent->widget, aEvent->widgetSupports,
|
||||||
// aEvent->message, aEvent->point.x, aEvent->point.y);
|
// aEvent->message, aEvent->point.x, aEvent->point.y);
|
||||||
nsEventStatus result = nsEventStatus_eIgnore;
|
nsEventStatus result = nsEventStatus_eIgnore;
|
||||||
nsIView *view = nsView::GetViewFor(aEvent->widget);
|
nsView *view = nsView::GetViewFor(aEvent->widget);
|
||||||
|
|
||||||
if (nsnull != view)
|
if (nsnull != view)
|
||||||
{
|
{
|
||||||
nsIViewManager *vm;
|
nsViewManager *vm = view->GetViewManager();
|
||||||
|
|
||||||
view->GetViewManager(vm);
|
|
||||||
vm->DispatchEvent(aEvent, &result);
|
vm->DispatchEvent(aEvent, &result);
|
||||||
NS_RELEASE(vm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -105,24 +103,14 @@ nsView :: ~nsView()
|
||||||
|
|
||||||
mVFlags |= NS_VIEW_PUBLIC_FLAG_DYING;
|
mVFlags |= NS_VIEW_PUBLIC_FLAG_DYING;
|
||||||
|
|
||||||
PRInt32 numKids;
|
while (GetFirstChild() != nsnull)
|
||||||
GetChildCount(numKids);
|
|
||||||
if (numKids > 0)
|
|
||||||
{
|
{
|
||||||
nsIView *kid;
|
GetFirstChild()->Destroy();
|
||||||
|
|
||||||
//nuke the kids
|
|
||||||
do {
|
|
||||||
GetChild(0, kid);
|
|
||||||
if (nsnull != kid)
|
|
||||||
kid->Destroy();
|
|
||||||
} while (nsnull != kid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsnull != mViewManager)
|
if (nsnull != mViewManager)
|
||||||
{
|
{
|
||||||
nsIView *rootView;
|
nsView *rootView = mViewManager->GetRootView();
|
||||||
mViewManager->GetRootView(rootView);
|
|
||||||
|
|
||||||
if (nsnull != rootView)
|
if (nsnull != rootView)
|
||||||
{
|
{
|
||||||
|
@ -144,8 +132,7 @@ nsView :: ~nsView()
|
||||||
mParent->RemoveChild(this);
|
mParent->RemoveChild(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIView* grabbingView; //check to see if we are capturing!!!
|
nsView* grabbingView = mViewManager->GetMouseEventGrabber(); //check to see if we are capturing!!!
|
||||||
mViewManager->GetMouseEventGrabber(grabbingView);
|
|
||||||
if (grabbingView == this)
|
if (grabbingView == this)
|
||||||
{
|
{
|
||||||
PRBool boolResult;//not used
|
PRBool boolResult;//not used
|
||||||
|
@ -203,26 +190,24 @@ nsrefcnt nsView::Release()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIView* nsView::GetViewFor(nsIWidget* aWidget)
|
nsView* nsView::GetViewFor(nsIWidget* aWidget)
|
||||||
{
|
{
|
||||||
nsIView* view = nsnull;
|
void* clientData;
|
||||||
void* clientData;
|
|
||||||
|
|
||||||
NS_PRECONDITION(nsnull != aWidget, "null widget ptr");
|
NS_PRECONDITION(nsnull != aWidget, "null widget ptr");
|
||||||
|
|
||||||
// The widget's client data points back to the owning view
|
// The widget's client data points back to the owning view
|
||||||
if (aWidget && NS_SUCCEEDED(aWidget->GetClientData(clientData))) {
|
if (aWidget && NS_SUCCEEDED(aWidget->GetClientData(clientData))) {
|
||||||
view = (nsIView*)clientData;
|
|
||||||
|
|
||||||
nsISupports* data = (nsISupports*)clientData;
|
nsISupports* data = (nsISupports*)clientData;
|
||||||
|
|
||||||
if (nsnull != data) {
|
if (nsnull != data) {
|
||||||
if (NS_FAILED(data->QueryInterface(NS_GET_IID(nsIView), (void **)&view))) {
|
nsIView* view = nsnull;
|
||||||
return nsnull; // return null if client data isn't a view
|
if (NS_SUCCEEDED(data->QueryInterface(NS_GET_IID(nsIView), (void **)&view))) {
|
||||||
|
return NS_STATIC_CAST(nsView*, view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return view;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: Init(nsIViewManager* aManager,
|
NS_IMETHODIMP nsView :: Init(nsIViewManager* aManager,
|
||||||
|
@ -239,7 +224,7 @@ NS_IMETHODIMP nsView :: Init(nsIViewManager* aManager,
|
||||||
return NS_ERROR_ALREADY_INITIALIZED;
|
return NS_ERROR_ALREADY_INITIALIZED;
|
||||||
}
|
}
|
||||||
// we don't hold a reference to the view manager
|
// we don't hold a reference to the view manager
|
||||||
mViewManager = aManager;
|
mViewManager = NS_STATIC_CAST(nsViewManager*, aManager);
|
||||||
|
|
||||||
mChildClip.mLeft = 0;
|
mChildClip.mLeft = 0;
|
||||||
mChildClip.mRight = 0;
|
mChildClip.mRight = 0;
|
||||||
|
@ -249,7 +234,7 @@ NS_IMETHODIMP nsView :: Init(nsIViewManager* aManager,
|
||||||
SetBounds(aBounds);
|
SetBounds(aBounds);
|
||||||
|
|
||||||
//temporarily set it...
|
//temporarily set it...
|
||||||
SetParent((nsIView *)aParent);
|
SetParent(NS_CONST_CAST(nsView*, NS_STATIC_CAST(const nsView*, aParent)));
|
||||||
|
|
||||||
SetVisibility(aVisibilityFlag);
|
SetVisibility(aVisibilityFlag);
|
||||||
|
|
||||||
|
@ -335,18 +320,16 @@ NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags,
|
||||||
|
|
||||||
//see if any of this view's children can process the event
|
//see if any of this view's children can process the event
|
||||||
if ( !(mVFlags & NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN) ) {
|
if ( !(mVFlags & NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN) ) {
|
||||||
PRInt32 numkids;
|
PRInt32 numkids = GetChildCount();
|
||||||
nsRect trect;
|
nsRect trect;
|
||||||
nscoord x, y;
|
nscoord x, y;
|
||||||
|
|
||||||
GetChildCount(numkids);
|
|
||||||
x = event->point.x;
|
x = event->point.x;
|
||||||
y = event->point.y;
|
y = event->point.y;
|
||||||
|
|
||||||
for (PRInt32 cnt = 0; cnt < numkids && !aHandled; cnt++)
|
for (PRInt32 cnt = 0; cnt < numkids && !aHandled; cnt++)
|
||||||
{
|
{
|
||||||
nsIView *pKid;
|
nsView *pKid = GetChild(cnt);
|
||||||
GetChild(cnt, pKid);
|
|
||||||
if (!pKid) break;
|
if (!pKid) break;
|
||||||
|
|
||||||
pKid->GetBounds(trect);
|
pKid->GetBounds(trect);
|
||||||
|
@ -555,11 +538,9 @@ NS_IMETHODIMP nsView :: SynchWidgetSizePosition()
|
||||||
NS_IMETHODIMP nsView :: GetPosition(nscoord *x, nscoord *y) const
|
NS_IMETHODIMP nsView :: GetPosition(nscoord *x, nscoord *y) const
|
||||||
{
|
{
|
||||||
|
|
||||||
nsIView *rootView;
|
nsView *rootView = mViewManager->GetRootView();
|
||||||
|
|
||||||
mViewManager->GetRootView(rootView);
|
if (this == rootView)
|
||||||
|
|
||||||
if (this == ((const nsView*)rootView))
|
|
||||||
*x = *y = 0;
|
*x = *y = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -648,18 +629,16 @@ NS_IMETHODIMP nsView :: SetBounds(nscoord aX, nscoord aY, nscoord aWidth, nscoor
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: GetBounds(nsRect &aBounds) const
|
NS_IMETHODIMP nsView :: GetBounds(nsRect &aBounds) const
|
||||||
{
|
{
|
||||||
nsIView *rootView = nsnull;
|
|
||||||
|
|
||||||
NS_ASSERTION(mViewManager, "mViewManager is null!");
|
NS_ASSERTION(mViewManager, "mViewManager is null!");
|
||||||
if (!mViewManager) {
|
if (!mViewManager) {
|
||||||
aBounds.x = aBounds.y = 0;
|
aBounds.x = aBounds.y = 0;
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mViewManager->GetRootView(rootView);
|
nsView *rootView = mViewManager->GetRootView();
|
||||||
aBounds = mBounds;
|
aBounds = mBounds;
|
||||||
|
|
||||||
if ((nsIView *)this == rootView)
|
if (this == rootView)
|
||||||
aBounds.x = aBounds.y = 0;
|
aBounds.x = aBounds.y = 0;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -692,8 +671,7 @@ NS_IMETHODIMP nsView :: SetVisibility(nsViewVisibility aVisibility)
|
||||||
|
|
||||||
if (aVisibility == nsViewVisibility_kHide)
|
if (aVisibility == nsViewVisibility_kHide)
|
||||||
{
|
{
|
||||||
nsIView* grabbingView; //check to see if we are grabbing events
|
nsView* grabbingView = mViewManager->GetMouseEventGrabber(); //check to see if we are grabbing events
|
||||||
mViewManager->GetMouseEventGrabber(grabbingView);
|
|
||||||
if (grabbingView == this)
|
if (grabbingView == this)
|
||||||
{
|
{
|
||||||
//if yes then we must release them before we become hidden and can't get them
|
//if yes then we must release them before we become hidden and can't get them
|
||||||
|
@ -721,18 +699,6 @@ NS_IMETHODIMP nsView :: GetVisibility(nsViewVisibility &aVisibility) const
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: SetZParent(nsIView *aZParent)
|
|
||||||
{
|
|
||||||
mZParent = aZParent;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: GetZParent(nsIView *&aZParent) const
|
|
||||||
{
|
|
||||||
aZParent = mZParent;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsView::SetZIndex(PRInt32 aZIndex)
|
NS_IMETHODIMP nsView::SetZIndex(PRInt32 aZIndex)
|
||||||
{
|
{
|
||||||
mZindex = aZIndex;
|
mZindex = aZIndex;
|
||||||
|
@ -791,12 +757,6 @@ NS_IMETHODIMP nsView::GetFloating(PRBool &aFloatingView) const
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: SetParent(nsIView *aParent)
|
|
||||||
{
|
|
||||||
mParent = aParent;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: GetParent(nsIView *&aParent) const
|
NS_IMETHODIMP nsView :: GetParent(nsIView *&aParent) const
|
||||||
{
|
{
|
||||||
aParent = mParent;
|
aParent = mParent;
|
||||||
|
@ -809,59 +769,49 @@ NS_IMETHODIMP nsView :: GetNextSibling(nsIView *&aNextSibling) const
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsView::SetNextSibling(nsIView* aView)
|
void nsView :: InsertChild(nsView *aChild, nsView *aSibling)
|
||||||
{
|
{
|
||||||
mNextSibling = aView;
|
NS_PRECONDITION(nsnull != aChild, "null ptr");
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: InsertChild(nsIView *child, nsIView *sibling)
|
if (nsnull != aChild)
|
||||||
{
|
|
||||||
NS_PRECONDITION(nsnull != child, "null ptr");
|
|
||||||
if (nsnull != child)
|
|
||||||
{
|
{
|
||||||
if (nsnull != sibling)
|
if (nsnull != aSibling)
|
||||||
{
|
{
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
nsIView* siblingParent;
|
nsView* siblingParent = aSibling->GetParent();
|
||||||
sibling->GetParent(siblingParent);
|
|
||||||
NS_ASSERTION(siblingParent == this, "tried to insert view with invalid sibling");
|
NS_ASSERTION(siblingParent == this, "tried to insert view with invalid sibling");
|
||||||
#endif
|
#endif
|
||||||
//insert after sibling
|
//insert after sibling
|
||||||
nsIView* siblingNextSibling;
|
nsView* siblingNextSibling = aSibling->GetNextSibling();
|
||||||
sibling->GetNextSibling(siblingNextSibling);
|
aChild->SetNextSibling(siblingNextSibling);
|
||||||
child->SetNextSibling(siblingNextSibling);
|
aSibling->SetNextSibling(aChild);
|
||||||
sibling->SetNextSibling(child);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
child->SetNextSibling(mFirstChild);
|
aChild->SetNextSibling(mFirstChild);
|
||||||
mFirstChild = child;
|
mFirstChild = aChild;
|
||||||
}
|
}
|
||||||
child->SetParent(this);
|
aChild->SetParent(this);
|
||||||
mNumKids++;
|
mNumKids++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: RemoveChild(nsIView *child)
|
void nsView :: RemoveChild(nsView *child)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(nsnull != child, "null ptr");
|
NS_PRECONDITION(nsnull != child, "null ptr");
|
||||||
|
|
||||||
if (nsnull != child)
|
if (nsnull != child)
|
||||||
{
|
{
|
||||||
nsIView* prevKid = nsnull;
|
nsView* prevKid = nsnull;
|
||||||
nsIView* kid = mFirstChild;
|
nsView* kid = mFirstChild;
|
||||||
PRBool found = PR_FALSE;
|
PRBool found = PR_FALSE;
|
||||||
while (nsnull != kid) {
|
while (nsnull != kid) {
|
||||||
if (kid == child) {
|
if (kid == child) {
|
||||||
if (nsnull != prevKid) {
|
if (nsnull != prevKid) {
|
||||||
nsIView* kidNextSibling;
|
nsView* kidNextSibling = kid->GetNextSibling();
|
||||||
kid->GetNextSibling(kidNextSibling);
|
|
||||||
prevKid->SetNextSibling(kidNextSibling);
|
prevKid->SetNextSibling(kidNextSibling);
|
||||||
} else {
|
} else {
|
||||||
kid->GetNextSibling(mFirstChild);
|
mFirstChild = kid->GetNextSibling();
|
||||||
}
|
}
|
||||||
child->SetParent(nsnull);
|
child->SetParent(nsnull);
|
||||||
mNumKids--;
|
mNumKids--;
|
||||||
|
@ -869,34 +819,21 @@ NS_IMETHODIMP nsView :: RemoveChild(nsIView *child)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
prevKid = kid;
|
prevKid = kid;
|
||||||
kid->GetNextSibling(kid);
|
kid = kid->GetNextSibling();
|
||||||
}
|
}
|
||||||
NS_ASSERTION(found, "tried to remove non child");
|
NS_ASSERTION(found, "tried to remove non child");
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: GetChildCount(PRInt32 &aCount) const
|
nsView* nsView :: GetChild(PRInt32 aIndex) const
|
||||||
{
|
|
||||||
aCount = mNumKids;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: GetChild(PRInt32 index, nsIView *&aChild) const
|
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(!(index > mNumKids), "bad index");
|
for (nsView* child = GetFirstChild(); child != nsnull; child = child->GetNextSibling()) {
|
||||||
|
if (aIndex == 0) {
|
||||||
aChild = nsnull;
|
return child;
|
||||||
if (index < mNumKids)
|
|
||||||
{
|
|
||||||
aChild = mFirstChild;
|
|
||||||
for (PRInt32 cnt = 0; (cnt < index) && (nsnull != aChild); cnt++) {
|
|
||||||
aChild->GetNextSibling(aChild);
|
|
||||||
}
|
}
|
||||||
|
--aIndex;
|
||||||
}
|
}
|
||||||
|
return nsnull;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: SetOpacity(float opacity)
|
NS_IMETHODIMP nsView :: SetOpacity(float opacity)
|
||||||
|
@ -1042,7 +979,7 @@ NS_IMETHODIMP nsView::List(FILE* out, PRInt32 aIndent) const
|
||||||
{
|
{
|
||||||
PRInt32 i;
|
PRInt32 i;
|
||||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||||
fprintf(out, "%p ", this);
|
fprintf(out, "%p ", (void*)this);
|
||||||
if (nsnull != mWindow) {
|
if (nsnull != mWindow) {
|
||||||
nsRect windowBounds;
|
nsRect windowBounds;
|
||||||
nsRect nonclientBounds;
|
nsRect nonclientBounds;
|
||||||
|
@ -1058,7 +995,7 @@ NS_IMETHODIMP nsView::List(FILE* out, PRInt32 aIndent) const
|
||||||
nsrefcnt widgetRefCnt = mWindow->AddRef() - 1;
|
nsrefcnt widgetRefCnt = mWindow->AddRef() - 1;
|
||||||
mWindow->Release();
|
mWindow->Release();
|
||||||
fprintf(out, "(widget=%p[%d] pos={%d,%d,%d,%d}) ",
|
fprintf(out, "(widget=%p[%d] pos={%d,%d,%d,%d}) ",
|
||||||
mWindow, widgetRefCnt,
|
(void*)mWindow, widgetRefCnt,
|
||||||
nonclientBounds.x, nonclientBounds.y,
|
nonclientBounds.x, nonclientBounds.y,
|
||||||
windowBounds.width, windowBounds.height);
|
windowBounds.width, windowBounds.height);
|
||||||
}
|
}
|
||||||
|
@ -1069,10 +1006,10 @@ NS_IMETHODIMP nsView::List(FILE* out, PRInt32 aIndent) const
|
||||||
PRBool hasTransparency;
|
PRBool hasTransparency;
|
||||||
HasTransparency(hasTransparency);
|
HasTransparency(hasTransparency);
|
||||||
fprintf(out, " z=%d vis=%d opc=%1.3f tran=%d clientData=%p <\n", mZindex, mVis, mOpacity, hasTransparency, mClientData);
|
fprintf(out, " z=%d vis=%d opc=%1.3f tran=%d clientData=%p <\n", mZindex, mVis, mOpacity, hasTransparency, mClientData);
|
||||||
nsIView* kid = mFirstChild;
|
nsView* kid = mFirstChild;
|
||||||
while (nsnull != kid) {
|
while (nsnull != kid) {
|
||||||
kid->List(out, aIndent + 1);
|
kid->List(out, aIndent + 1);
|
||||||
kid->GetNextSibling(kid);
|
kid = kid->GetNextSibling();
|
||||||
}
|
}
|
||||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||||
fputs(">\n", out);
|
fputs(">\n", out);
|
||||||
|
@ -1100,12 +1037,11 @@ NS_IMETHODIMP nsView :: GetViewFlags(PRUint32 *aFlags) const
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget)
|
NS_IMETHODIMP nsView :: GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget)
|
||||||
{
|
{
|
||||||
nsIView *ancestor;
|
nsView *ancestor = GetParent();
|
||||||
aWidget = nsnull;
|
aWidget = nsnull;
|
||||||
|
|
||||||
// XXX aDx and aDy are OUT parameters and so we should initialize them
|
// XXX aDx and aDy are OUT parameters and so we should initialize them
|
||||||
// to 0 rather than relying on the caller to do so...
|
// to 0 rather than relying on the caller to do so...
|
||||||
GetParent(ancestor);
|
|
||||||
while (nsnull != ancestor)
|
while (nsnull != ancestor)
|
||||||
{
|
{
|
||||||
ancestor->GetWidget(aWidget);
|
ancestor->GetWidget(aWidget);
|
||||||
|
@ -1122,16 +1058,14 @@ NS_IMETHODIMP nsView :: GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidge
|
||||||
*aDy += offy;
|
*aDy += offy;
|
||||||
}
|
}
|
||||||
|
|
||||||
ancestor->GetParent(ancestor);
|
ancestor = ancestor->GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (nsnull == aWidget) {
|
if (nsnull == aWidget) {
|
||||||
// The root view doesn't have a widget
|
// The root view doesn't have a widget
|
||||||
// but maybe the view manager does.
|
// but maybe the view manager does.
|
||||||
nsCOMPtr<nsIViewManager> vm;
|
GetViewManager()->GetWidget(&aWidget);
|
||||||
GetViewManager(*getter_AddRefs(vm));
|
|
||||||
vm->GetWidget(&aWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -1174,59 +1108,13 @@ NS_IMETHODIMP nsView::GetCompositorFlags(PRUint32 *aFlags)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void calc_extents(nsIView *view, nsRect *extents, nscoord ox, nscoord oy)
|
|
||||||
{
|
|
||||||
nsIView *kid;
|
|
||||||
nsRect bounds;
|
|
||||||
nsIClipView *cview;
|
|
||||||
|
|
||||||
view->GetChild(0, kid);
|
|
||||||
while (nsnull != kid)
|
|
||||||
{
|
|
||||||
kid->GetBounds(bounds);
|
|
||||||
|
|
||||||
bounds.x += ox;
|
|
||||||
bounds.y += oy;
|
|
||||||
|
|
||||||
extents->UnionRect(*extents, bounds);
|
|
||||||
|
|
||||||
cview = nsnull;
|
|
||||||
|
|
||||||
kid->QueryInterface(NS_GET_IID(nsIClipView), (void **)&cview);
|
|
||||||
|
|
||||||
if (!cview)
|
|
||||||
calc_extents(kid, extents, bounds.x, bounds.y);
|
|
||||||
|
|
||||||
kid->GetNextSibling(kid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: GetExtents(nsRect *aExtents)
|
|
||||||
{
|
|
||||||
GetBounds(*aExtents);
|
|
||||||
|
|
||||||
aExtents->x = 0;
|
|
||||||
aExtents->y = 0;
|
|
||||||
|
|
||||||
calc_extents(this, aExtents, 0, 0);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool nsView :: IsRoot()
|
PRBool nsView :: IsRoot()
|
||||||
{
|
{
|
||||||
nsIView *rootView;
|
|
||||||
|
|
||||||
NS_ASSERTION(mViewManager != nsnull," View manager is null in nsView::IsRoot()");
|
NS_ASSERTION(mViewManager != nsnull," View manager is null in nsView::IsRoot()");
|
||||||
mViewManager->GetRootView(rootView);
|
return mViewManager->GetRootView() == this;
|
||||||
if (rootView == this) {
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsView::PointIsInside(nsIView& aView, nscoord x, nscoord y) const
|
PRBool nsView::PointIsInside(nsView& aView, nscoord x, nscoord y) const
|
||||||
{
|
{
|
||||||
nsRect clippedRect;
|
nsRect clippedRect;
|
||||||
PRBool empty;
|
PRBool empty;
|
||||||
|
@ -1258,8 +1146,7 @@ NS_IMETHODIMP nsView::GetClippedRect(nsRect& aClippedRect, PRBool& aIsClipped, P
|
||||||
aIsClipped = PR_FALSE;
|
aIsClipped = PR_FALSE;
|
||||||
|
|
||||||
GetBounds(aClippedRect);
|
GetBounds(aClippedRect);
|
||||||
nsIView* parentView;
|
nsView* parentView = GetParent();
|
||||||
GetParent(parentView);
|
|
||||||
|
|
||||||
// Walk all of the way up the views to see if any
|
// Walk all of the way up the views to see if any
|
||||||
// ancestor sets the NS_VIEW_PUBLIC_FLAG_CLIPCHILDREN
|
// ancestor sets the NS_VIEW_PUBLIC_FLAG_CLIPCHILDREN
|
||||||
|
@ -1292,7 +1179,7 @@ NS_IMETHODIMP nsView::GetClippedRect(nsRect& aClippedRect, PRBool& aIsClipped, P
|
||||||
ancestorX -= bounds.x;
|
ancestorX -= bounds.x;
|
||||||
ancestorY -= bounds.y;
|
ancestorY -= bounds.y;
|
||||||
|
|
||||||
parentView->GetParent(parentView);
|
parentView = parentView->GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -49,6 +49,8 @@
|
||||||
|
|
||||||
class nsIPresContext;
|
class nsIPresContext;
|
||||||
class nsIViewManager;
|
class nsIViewManager;
|
||||||
|
class nsViewManager;
|
||||||
|
class nsZPlaceholderView;
|
||||||
|
|
||||||
class nsView : public nsIView
|
class nsView : public nsIView
|
||||||
{
|
{
|
||||||
|
@ -88,22 +90,14 @@ public:
|
||||||
NS_IMETHOD GetChildClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom) const;
|
NS_IMETHOD GetChildClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom) const;
|
||||||
NS_IMETHOD SetVisibility(nsViewVisibility visibility);
|
NS_IMETHOD SetVisibility(nsViewVisibility visibility);
|
||||||
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const;
|
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const;
|
||||||
NS_IMETHOD SetZParent(nsIView *aZParent);
|
|
||||||
NS_IMETHOD GetZParent(nsIView *&aZParent) const;
|
|
||||||
NS_IMETHOD SetZIndex(PRInt32 aZIndex);
|
NS_IMETHOD SetZIndex(PRInt32 aZIndex);
|
||||||
NS_IMETHOD GetZIndex(PRInt32 &aZIndex) const;
|
NS_IMETHOD GetZIndex(PRInt32 &aZIndex) const;
|
||||||
NS_IMETHOD SetAutoZIndex(PRBool aAutoZIndex);
|
NS_IMETHOD SetAutoZIndex(PRBool aAutoZIndex);
|
||||||
NS_IMETHOD GetAutoZIndex(PRBool &aAutoZIndex) const;
|
NS_IMETHOD GetAutoZIndex(PRBool &aAutoZIndex) const;
|
||||||
NS_IMETHOD SetFloating(PRBool aFloatingView);
|
NS_IMETHOD SetFloating(PRBool aFloatingView);
|
||||||
NS_IMETHOD GetFloating(PRBool &aFloatingView) const;
|
NS_IMETHOD GetFloating(PRBool &aFloatingView) const;
|
||||||
NS_IMETHOD SetParent(nsIView *aParent);
|
|
||||||
NS_IMETHOD GetParent(nsIView *&aParent) const;
|
NS_IMETHOD GetParent(nsIView *&aParent) const;
|
||||||
NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const;
|
NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const;
|
||||||
NS_IMETHOD SetNextSibling(nsIView* aNextSibling);
|
|
||||||
NS_IMETHOD InsertChild(nsIView *child, nsIView *sibling);
|
|
||||||
NS_IMETHOD RemoveChild(nsIView *child);
|
|
||||||
NS_IMETHOD GetChildCount(PRInt32 &aCount) const;
|
|
||||||
NS_IMETHOD GetChild(PRInt32 index, nsIView*& aChild) const;
|
|
||||||
NS_IMETHOD SetOpacity(float opacity);
|
NS_IMETHOD SetOpacity(float opacity);
|
||||||
NS_IMETHOD GetOpacity(float &aOpacity) const;
|
NS_IMETHOD GetOpacity(float &aOpacity) const;
|
||||||
NS_IMETHOD HasTransparency(PRBool &aTransparent) const;
|
NS_IMETHOD HasTransparency(PRBool &aTransparent) const;
|
||||||
|
@ -126,7 +120,6 @@ public:
|
||||||
NS_IMETHOD GetViewFlags(PRUint32 *aFlags) const;
|
NS_IMETHOD GetViewFlags(PRUint32 *aFlags) const;
|
||||||
NS_IMETHOD SetCompositorFlags(PRUint32 aFlags);
|
NS_IMETHOD SetCompositorFlags(PRUint32 aFlags);
|
||||||
NS_IMETHOD GetCompositorFlags(PRUint32 *aFlags);
|
NS_IMETHOD GetCompositorFlags(PRUint32 *aFlags);
|
||||||
NS_IMETHOD GetExtents(nsRect *aExtents);
|
|
||||||
NS_IMETHOD GetClippedRect(nsRect& aClippedRect, PRBool& aIsClipped, PRBool& aEmpty) const;
|
NS_IMETHOD GetClippedRect(nsRect& aClippedRect, PRBool& aIsClipped, PRBool& aEmpty) const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,13 +130,30 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// Helper function to get the view that's associated with a widget
|
// Helper function to get the view that's associated with a widget
|
||||||
static nsIView* GetViewFor(nsIWidget* aWidget);
|
static nsView* GetViewFor(nsIWidget* aWidget);
|
||||||
|
|
||||||
// Helper function to determine if the view instance is the root view
|
// Helper function to determine if the view instance is the root view
|
||||||
PRBool IsRoot();
|
PRBool IsRoot();
|
||||||
|
|
||||||
// Helper function to determine if the view point is inside of a view
|
// Helper function to determine if the view point is inside of a view
|
||||||
PRBool PointIsInside(nsIView& aView, nscoord x, nscoord y) const;
|
PRBool PointIsInside(nsView& aView, nscoord x, nscoord y) const;
|
||||||
|
|
||||||
|
public: // NOT in nsIView, so only available in view module
|
||||||
|
nsView* GetFirstChild() const { return mFirstChild; }
|
||||||
|
nsView* GetNextSibling() const { return mNextSibling; }
|
||||||
|
nsView* GetParent() const { return mParent; }
|
||||||
|
nsZPlaceholderView* GetZParent() const { return mZParent; }
|
||||||
|
nsViewManager* GetViewManager() const { return mViewManager; }
|
||||||
|
|
||||||
|
PRInt32 GetChildCount() const { return mNumKids; }
|
||||||
|
nsView* GetChild(PRInt32 aIndex) const;
|
||||||
|
|
||||||
|
void InsertChild(nsView *aChild, nsView *aSibling);
|
||||||
|
void RemoveChild(nsView *aChild);
|
||||||
|
|
||||||
|
void SetParent(nsView *aParent) { mParent = aParent; }
|
||||||
|
void SetZParent(nsZPlaceholderView *aZParent) { mZParent = aZParent; }
|
||||||
|
void SetNextSibling(nsView *aSibling) { mNextSibling = aSibling; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsView();
|
virtual ~nsView();
|
||||||
|
@ -151,15 +161,15 @@ protected:
|
||||||
virtual nsresult LoadWidget(const nsCID &aClassIID);
|
virtual nsresult LoadWidget(const nsCID &aClassIID);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsIViewManager *mViewManager;
|
nsViewManager *mViewManager;
|
||||||
nsIView *mParent;
|
nsView *mParent;
|
||||||
nsIWidget *mWindow;
|
nsIWidget *mWindow;
|
||||||
|
|
||||||
nsIView *mZParent;
|
nsZPlaceholderView*mZParent;
|
||||||
|
|
||||||
//XXX should there be pointers to last child so backward walking is fast?
|
//XXX should there be pointers to last child so backward walking is fast?
|
||||||
nsIView *mNextSibling;
|
nsView *mNextSibling;
|
||||||
nsIView *mFirstChild;
|
nsView *mFirstChild;
|
||||||
void *mClientData;
|
void *mClientData;
|
||||||
PRInt32 mZindex;
|
PRInt32 mZindex;
|
||||||
nsViewVisibility mVis;
|
nsViewVisibility mVis;
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,4 +1,4 @@
|
||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: true; c-basic-offset: 4 -*- */
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
|
@ -51,11 +51,13 @@
|
||||||
#include "nsIRegion.h"
|
#include "nsIRegion.h"
|
||||||
#include "nsIBlender.h"
|
#include "nsIBlender.h"
|
||||||
#include "nsIEventQueue.h"
|
#include "nsIEventQueue.h"
|
||||||
|
#include "nsView.h"
|
||||||
#include "nsIEventProcessor.h"
|
#include "nsIEventProcessor.h"
|
||||||
|
|
||||||
class nsISupportsArray;
|
class nsISupportsArray;
|
||||||
struct DisplayListElement2;
|
struct DisplayListElement2;
|
||||||
struct DisplayZTreeNode;
|
struct DisplayZTreeNode;
|
||||||
|
class nsView;
|
||||||
|
|
||||||
//Uncomment the following line to enable generation of viewmanager performance data.
|
//Uncomment the following line to enable generation of viewmanager performance data.
|
||||||
#ifdef MOZ_PERF_METRICS
|
#ifdef MOZ_PERF_METRICS
|
||||||
|
@ -66,6 +68,57 @@ struct DisplayZTreeNode;
|
||||||
#include "nsTimer.h"
|
#include "nsTimer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// compositor per-view flags
|
||||||
|
#define IS_PARENT_OF_REFRESHED_VIEW 0x00000001
|
||||||
|
#define IS_Z_PLACEHOLDER_VIEW 0x80000000
|
||||||
|
|
||||||
|
/**
|
||||||
|
FIXED-POSITION FRAMES AND Z-ORDERING
|
||||||
|
|
||||||
|
Fixed-position frames are special. They have TWO views. There is the "real" view, which is
|
||||||
|
a child of the root view for the viewport (which is the root view of the view manager).
|
||||||
|
There is also a "placeholder" view (of class nsZPlaceholderView) which never really
|
||||||
|
participates in any view operations. It is a child of the view that would have contained
|
||||||
|
the fixed-position element if it had not been fixed-position. The real view keeps track
|
||||||
|
of the placeholder view and returns the placeholder view when you call GetZParent on the
|
||||||
|
real view.
|
||||||
|
|
||||||
|
(Although currently all views which have a placeholder view are themselves children of the
|
||||||
|
root view, we don't want to depend on this. Later we might want to support views that
|
||||||
|
are fixed relative to some container other than the viewport.)
|
||||||
|
|
||||||
|
As we build the display list in CreateDisplayList, once we've processed the parent of
|
||||||
|
real views (i.e., the root), we move those real views from their current position in the
|
||||||
|
display list over to where their placeholder views are in the display list. This ensures that
|
||||||
|
views get repainted in the order they would have been repainted in the absence of
|
||||||
|
fixed-position frames.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class nsZPlaceholderView : public nsView
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nsZPlaceholderView(nsView* aParent) : nsView() {
|
||||||
|
SetParent(aParent);
|
||||||
|
SetVisibility(nsViewVisibility_kHide);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RemoveReparentedView() { mReparentedView = nsnull; }
|
||||||
|
void SetReparentedView(nsView* aView) { mReparentedView = aView; }
|
||||||
|
nsView* GetReparentedView() { return mReparentedView; }
|
||||||
|
|
||||||
|
NS_IMETHOD GetCompositorFlags(PRUint32 *aFlags)
|
||||||
|
{ nsView::GetCompositorFlags(aFlags); *aFlags |= IS_Z_PLACEHOLDER_VIEW; return NS_OK; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~nsZPlaceholderView() {
|
||||||
|
if (nsnull != mReparentedView) {
|
||||||
|
mReparentedView->SetZParent(nsnull);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
nsView *mReparentedView;
|
||||||
|
};
|
||||||
|
|
||||||
class nsViewManager : public nsIViewManager {
|
class nsViewManager : public nsIViewManager {
|
||||||
public:
|
public:
|
||||||
|
@ -128,10 +181,6 @@ public:
|
||||||
NS_IMETHOD MoveViewAbove(nsIView *aView, nsIView *aOther);
|
NS_IMETHOD MoveViewAbove(nsIView *aView, nsIView *aOther);
|
||||||
NS_IMETHOD MoveViewBelow(nsIView *aView, nsIView *aOther);
|
NS_IMETHOD MoveViewBelow(nsIView *aView, nsIView *aOther);
|
||||||
|
|
||||||
NS_IMETHOD IsViewShown(nsIView *aView, PRBool& aResult);
|
|
||||||
|
|
||||||
NS_IMETHOD GetViewClipAbsolute(nsIView *aView, nsRect *aRect, PRBool &aResult);
|
|
||||||
|
|
||||||
NS_IMETHOD SetViewContentTransparency(nsIView *aView, PRBool aTransparent);
|
NS_IMETHOD SetViewContentTransparency(nsIView *aView, PRBool aTransparent);
|
||||||
NS_IMETHOD SetViewOpacity(nsIView *aView, float aOpacity);
|
NS_IMETHOD SetViewOpacity(nsIView *aView, float aOpacity);
|
||||||
|
|
||||||
|
@ -177,94 +226,6 @@ public:
|
||||||
static PRInt32 GetViewManagerCount();
|
static PRInt32 GetViewManagerCount();
|
||||||
static const nsVoidArray* GetViewManagerArray();
|
static const nsVoidArray* GetViewManagerArray();
|
||||||
static PRUint32 gLastUserEventTime;
|
static PRUint32 gLastUserEventTime;
|
||||||
protected:
|
|
||||||
virtual ~nsViewManager();
|
|
||||||
void ProcessPendingUpdates(nsIView *aView);
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsIRenderingContext *CreateRenderingContext(nsIView &aView);
|
|
||||||
void AddRectToDirtyRegion(nsIView* aView, const nsRect &aRect) const;
|
|
||||||
void UpdateTransCnt(nsIView *oldview, nsIView *newview);
|
|
||||||
|
|
||||||
PRBool UpdateAllCoveringWidgets(nsIView *aView, nsIView *aTarget, nsRect &aDamagedRect, PRBool aOnlyRepaintIfUnblittable);
|
|
||||||
|
|
||||||
|
|
||||||
void UpdateViews(nsIView *aView, PRUint32 aUpdateFlags);
|
|
||||||
|
|
||||||
void Refresh(nsIView *aView, nsIRenderingContext *aContext,
|
|
||||||
nsIRegion *region, PRUint32 aUpdateFlags);
|
|
||||||
void DefaultRefresh(nsIView* aView, const nsRect* aRect);
|
|
||||||
void RenderViews(nsIView *aRootView, nsIRenderingContext& aRC, const nsRect& aRect,
|
|
||||||
PRBool &aResult);
|
|
||||||
|
|
||||||
void RenderView(nsIView *aView, nsIRenderingContext &aRC,
|
|
||||||
const nsRect &aDamageRect, nsRect &aGlobalRect, PRBool &aResult);
|
|
||||||
|
|
||||||
void RenderDisplayListElement(DisplayListElement2* element, nsIRenderingContext &aRC);
|
|
||||||
|
|
||||||
void PaintView(nsIView *aView, nsIRenderingContext &aRC, nscoord x, nscoord y,
|
|
||||||
const nsRect &aDamageRect);
|
|
||||||
|
|
||||||
nsresult CreateBlendingBuffers(nsIRenderingContext &aRC);
|
|
||||||
|
|
||||||
PRBool CreateDisplayList(nsIView *aView, PRBool aReparentedViewsPresent, DisplayZTreeNode* &aResult, nscoord aOriginX, nscoord aOriginY,
|
|
||||||
PRBool aInsideRealView, nsIView *aRealView, const nsRect *aDamageRect,
|
|
||||||
nsIView *aTopView, nscoord aX, nscoord aY, PRBool aPaintFloaters);
|
|
||||||
PRBool AddToDisplayList(nsIView *aView, DisplayZTreeNode* &aParent, nsRect &aClipRect, nsRect& aDirtyRect, PRUint32 aFlags, nscoord aAbsX, nscoord aAbsY);
|
|
||||||
void ReapplyClipInstructions(PRBool aHaveClip, nsRect& aClipRect, PRInt32& aIndex);
|
|
||||||
nsresult OptimizeDisplayList(const nsRect& aDamageRect, nsRect& aFinalTransparentRect);
|
|
||||||
// Remove redundant PUSH/POP_CLIP pairs.
|
|
||||||
void OptimizeDisplayListClipping(PRBool aHaveClip, nsRect& aClipRect, PRInt32& aIndex,
|
|
||||||
PRBool& aAnyRendered);
|
|
||||||
#ifdef NS_DEBUG
|
|
||||||
void ShowDisplayList(PRInt32 flatlen);
|
|
||||||
#endif
|
|
||||||
void ComputeViewOffset(nsIView *aView, nsPoint *aOrigin);
|
|
||||||
|
|
||||||
void AddCoveringWidgetsToOpaqueRegion(nsIRegion* aRgn, nsIDeviceContext* aContext,
|
|
||||||
nsIView* aRootView);
|
|
||||||
|
|
||||||
// Predicates
|
|
||||||
PRBool DoesViewHaveNativeWidget(nsIView* aView);
|
|
||||||
PRBool IsClipView(nsIView* aView);
|
|
||||||
|
|
||||||
void PauseTimer(void);
|
|
||||||
void RestartTimer(void);
|
|
||||||
|
|
||||||
// Utilities
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the nearest parent view with an attached widget. Can be the
|
|
||||||
* same view as passed-in.
|
|
||||||
*/
|
|
||||||
nsIView* GetWidgetView(nsIView *aView) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms a rectangle from specified view's coordinate system to
|
|
||||||
* the first parent that has an attached widget.
|
|
||||||
*/
|
|
||||||
void ViewToWidget(nsIView *aView, nsIView* aWidgetView, nsRect &aRect) const;
|
|
||||||
// void WidgetToView(nsIView* aView, nsRect &aWidgetRect);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms a rectangle from specified view's coordinate system to
|
|
||||||
* an absolute coordinate rectangle which can be compared against the
|
|
||||||
* rectangle returned by GetVisibleRect to determine visibility.
|
|
||||||
* @param aView view that aRect coordinates are specified relative to
|
|
||||||
* @param aRect rectangle in twips to convert to absolute coordinates
|
|
||||||
* @param aAbsRect rectangle in absolute coorindates.
|
|
||||||
* @returns NS_OK if successful otherwise, NS_ERROR_FAILURE
|
|
||||||
*/
|
|
||||||
|
|
||||||
nsresult GetAbsoluteRect(nsIView *aView, const nsRect &aRect,
|
|
||||||
nsRect& aAbsRect);
|
|
||||||
/**
|
|
||||||
* Determine the visible rect
|
|
||||||
* @param aVisibleRect visible rectangle in twips
|
|
||||||
* @returns NS_OK if successful, otherwise NS_ERROR_FAILURE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
nsresult GetVisibleRect(nsRect& aVisibleRect);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a rectangle specified in the view's coordinate system
|
* Determine if a rectangle specified in the view's coordinate system
|
||||||
|
@ -275,68 +236,160 @@ private:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD IsRectVisible(nsIView *aView, const nsRect &aRect, PRBool aMustBeFullyVisible, PRBool *isVisible);
|
NS_IMETHOD IsRectVisible(nsIView *aView, const nsRect &aRect, PRBool aMustBeFullyVisible, PRBool *isVisible);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~nsViewManager();
|
||||||
|
void ProcessPendingUpdates(nsView *aView);
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsIRenderingContext *CreateRenderingContext(nsView &aView);
|
||||||
|
void AddRectToDirtyRegion(nsView* aView, const nsRect &aRect) const;
|
||||||
|
void UpdateTransCnt(nsView *oldview, nsView *newview);
|
||||||
|
|
||||||
|
PRBool UpdateAllCoveringWidgets(nsView *aView, nsView *aTarget, nsRect &aDamagedRect, PRBool aOnlyRepaintIfUnblittable);
|
||||||
|
|
||||||
|
|
||||||
|
void UpdateViews(nsView *aView, PRUint32 aUpdateFlags);
|
||||||
|
|
||||||
|
void Refresh(nsView *aView, nsIRenderingContext *aContext,
|
||||||
|
nsIRegion *region, PRUint32 aUpdateFlags);
|
||||||
|
void DefaultRefresh(nsView* aView, const nsRect* aRect);
|
||||||
|
void RenderViews(nsView *aRootView, nsIRenderingContext& aRC, const nsRect& aRect,
|
||||||
|
PRBool &aResult);
|
||||||
|
|
||||||
|
void RenderView(nsView *aView, nsIRenderingContext &aRC,
|
||||||
|
const nsRect &aDamageRect, nsRect &aGlobalRect, PRBool &aResult);
|
||||||
|
|
||||||
|
void RenderDisplayListElement(DisplayListElement2* element, nsIRenderingContext &aRC);
|
||||||
|
|
||||||
|
void PaintView(nsView *aView, nsIRenderingContext &aRC, nscoord x, nscoord y,
|
||||||
|
const nsRect &aDamageRect);
|
||||||
|
|
||||||
|
nsresult CreateBlendingBuffers(nsIRenderingContext &aRC);
|
||||||
|
|
||||||
|
PRBool CreateDisplayList(nsView *aView, PRBool aReparentedViewsPresent, DisplayZTreeNode* &aResult, nscoord aOriginX, nscoord aOriginY,
|
||||||
|
PRBool aInsideRealView, nsView *aRealView, const nsRect *aDamageRect,
|
||||||
|
nsView *aTopView, nscoord aX, nscoord aY, PRBool aPaintFloaters);
|
||||||
|
PRBool AddToDisplayList(nsView *aView, DisplayZTreeNode* &aParent, nsRect &aClipRect, nsRect& aDirtyRect, PRUint32 aFlags, nscoord aAbsX, nscoord aAbsY);
|
||||||
|
void ReapplyClipInstructions(PRBool aHaveClip, nsRect& aClipRect, PRInt32& aIndex);
|
||||||
|
nsresult OptimizeDisplayList(const nsRect& aDamageRect, nsRect& aFinalTransparentRect);
|
||||||
|
// Remove redundant PUSH/POP_CLIP pairs.
|
||||||
|
void ComputeViewOffset(nsView *aView, nsPoint *aOrigin);
|
||||||
|
|
||||||
|
void AddCoveringWidgetsToOpaqueRegion(nsIRegion* aRgn, nsIDeviceContext* aContext,
|
||||||
|
nsView* aRootView);
|
||||||
|
|
||||||
|
// Predicates
|
||||||
|
PRBool DoesViewHaveNativeWidget(nsView* aView);
|
||||||
|
PRBool IsClipView(nsView* aView);
|
||||||
|
|
||||||
|
void PauseTimer(void);
|
||||||
|
void RestartTimer(void);
|
||||||
|
void OptimizeDisplayListClipping(PRBool aHaveClip, nsRect& aClipRect, PRInt32& aIndex,
|
||||||
|
PRBool& aAnyRendered);
|
||||||
|
#ifdef NS_DEBUG
|
||||||
|
void ShowDisplayList(PRInt32 flatlen);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Utilities
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the nearest parent view with an attached widget. Can be the
|
||||||
|
* same view as passed-in.
|
||||||
|
*/
|
||||||
|
nsView* GetWidgetView(nsView *aView) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transforms a rectangle from specified view's coordinate system to
|
||||||
|
* the first parent that has an attached widget.
|
||||||
|
*/
|
||||||
|
void ViewToWidget(nsView *aView, nsView* aWidgetView, nsRect &aRect) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transforms a rectangle from specified view's coordinate system to
|
||||||
|
* an absolute coordinate rectangle which can be compared against the
|
||||||
|
* rectangle returned by GetVisibleRect to determine visibility.
|
||||||
|
* @param aView view that aRect coordinates are specified relative to
|
||||||
|
* @param aRect rectangle in twips to convert to absolute coordinates
|
||||||
|
* @param aAbsRect rectangle in absolute coorindates.
|
||||||
|
* @returns NS_OK if successful otherwise, NS_ERROR_FAILURE
|
||||||
|
*/
|
||||||
|
|
||||||
|
nsresult GetAbsoluteRect(nsView *aView, const nsRect &aRect,
|
||||||
|
nsRect& aAbsRect);
|
||||||
|
/**
|
||||||
|
* Determine the visible rect
|
||||||
|
* @param aVisibleRect visible rectangle in twips
|
||||||
|
* @returns NS_OK if successful, otherwise NS_ERROR_FAILURE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
nsresult GetVisibleRect(nsRect& aVisibleRect);
|
||||||
|
|
||||||
|
nsresult ProcessWidgetChanges(nsView* aView);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs event processor
|
* Installs event processor
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD SetEventProcessor(nsIEventProcessor* aEventProcessor) { mEventProcessor = aEventProcessor; return NS_OK; }
|
NS_IMETHOD SetEventProcessor(nsIEventProcessor* aEventProcessor) { mEventProcessor = aEventProcessor; return NS_OK; }
|
||||||
|
|
||||||
|
|
||||||
nsresult ProcessWidgetChanges(nsIView* aView);
|
|
||||||
|
|
||||||
// Utilities used to size the offscreen drawing surface
|
// Utilities used to size the offscreen drawing surface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the maximum and width and height of all of the
|
* Determine the maximum and width and height of all of the
|
||||||
* view manager's widgets.
|
* view manager's widgets.
|
||||||
*
|
*
|
||||||
* @param aMaxWidgetBounds the maximum width and height of all view managers
|
* @param aMaxWidgetBounds the maximum width and height of all view managers
|
||||||
* widgets on exit.
|
* widgets on exit.
|
||||||
*/
|
*/
|
||||||
void GetMaxWidgetBounds(nsRect& aMaxWidgetBounds) const;
|
void GetMaxWidgetBounds(nsRect& aMaxWidgetBounds) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a rect's width and height will fit within a specified width and height
|
* Determine if a rect's width and height will fit within a specified width and height
|
||||||
* @param aRect rectangle to test
|
* @param aRect rectangle to test
|
||||||
* @param aWidth width to determine if the rectangle's width will fit within
|
* @param aWidth width to determine if the rectangle's width will fit within
|
||||||
* @param aHeight height to determine if the rectangles height will fit within
|
* @param aHeight height to determine if the rectangles height will fit within
|
||||||
* @returns PR_TRUE if the rect width and height fits with aWidth, aHeight, PR_FALSE
|
* @returns PR_TRUE if the rect width and height fits with aWidth, aHeight, PR_FALSE
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
PRBool RectFitsInside(nsRect& aRect, PRInt32 aWidth, PRInt32 aHeight) const;
|
PRBool RectFitsInside(nsRect& aRect, PRInt32 aWidth, PRInt32 aHeight) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if two rectangles width and height will fit within a specified width and height
|
* Determine if two rectangles width and height will fit within a specified width and height
|
||||||
* @param aRect1 first rectangle to test
|
* @param aRect1 first rectangle to test
|
||||||
* @param aRect1 second rectangle to test
|
* @param aRect1 second rectangle to test
|
||||||
* @param aWidth width to determine if both rectangle's width will fit within
|
* @param aWidth width to determine if both rectangle's width will fit within
|
||||||
* @param aHeight height to determine if both rectangles height will fit within
|
* @param aHeight height to determine if both rectangles height will fit within
|
||||||
* @returns PR_TRUE if the rect1's and rect2's width and height fits with aWidth,
|
* @returns PR_TRUE if the rect1's and rect2's width and height fits with aWidth,
|
||||||
* aHeight, PR_FALSE otherwise.
|
* aHeight, PR_FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
PRBool BothRectsFitInside(nsRect& aRect1, nsRect& aRect2, PRInt32 aWidth, PRInt32 aHeight, nsRect& aNewSize) const;
|
PRBool BothRectsFitInside(nsRect& aRect1, nsRect& aRect2, PRInt32 aWidth, PRInt32 aHeight, nsRect& aNewSize) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an offscreen surface size from a set of discrete surface sizes.
|
* Return an offscreen surface size from a set of discrete surface sizes.
|
||||||
* The smallest discrete surface size that can enclose both the Maximum widget
|
* The smallest discrete surface size that can enclose both the Maximum widget
|
||||||
* size (@see GetMaxWidgetBounds) and the requested size is returned.
|
* size (@see GetMaxWidgetBounds) and the requested size is returned.
|
||||||
*
|
*
|
||||||
* @param aRequestedSize Requested size for the offscreen.
|
* @param aRequestedSize Requested size for the offscreen.
|
||||||
* @param aSurfaceSize contains the surface size
|
* @param aSurfaceSize contains the surface size
|
||||||
*/
|
*/
|
||||||
void CalculateDiscreteSurfaceSize(nsRect& aRequestedSize, nsRect& aSize) const;
|
void CalculateDiscreteSurfaceSize(nsRect& aRequestedSize, nsRect& aSize) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of the offscreen drawing surface..
|
* Get the size of the offscreen drawing surface..
|
||||||
*
|
*
|
||||||
* @param aRequestedSize Desired size for the offscreen.
|
* @param aRequestedSize Desired size for the offscreen.
|
||||||
* @param aSurfaceSize Offscreen adjusted to a discrete size which encloses aRequestedSize.
|
* @param aSurfaceSize Offscreen adjusted to a discrete size which encloses aRequestedSize.
|
||||||
*/
|
*/
|
||||||
void GetDrawingSurfaceSize(nsRect& aRequestedSize, nsRect& aSurfaceSize) const;
|
void GetDrawingSurfaceSize(nsRect& aRequestedSize, nsRect& aSurfaceSize) const;
|
||||||
|
|
||||||
|
public: // NOT in nsIViewManager, so private to the view module
|
||||||
|
nsView* GetRootView() const { return mRootView; }
|
||||||
|
nsView* GetMouseEventGrabber() const { return mMouseGrabber; }
|
||||||
|
nsView* GetKeyEventGrabber() const { return mKeyGrabber; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsIDeviceContext *mContext;
|
nsIDeviceContext *mContext;
|
||||||
float mTwipsToPixels;
|
float mTwipsToPixels;
|
||||||
float mPixelsToTwips;
|
float mPixelsToTwips;
|
||||||
nsIViewObserver *mObserver;
|
nsIViewObserver *mObserver;
|
||||||
nsIWidget *mRootWindow;
|
nsIWidget *mRootWindow;
|
||||||
PRIntervalTime mLastRefresh;
|
PRIntervalTime mLastRefresh;
|
||||||
|
@ -344,13 +397,13 @@ private:
|
||||||
PRBool mRefreshEnabled;
|
PRBool mRefreshEnabled;
|
||||||
PRBool mPainting;
|
PRBool mPainting;
|
||||||
PRBool mRecursiveRefreshPending;
|
PRBool mRecursiveRefreshPending;
|
||||||
nsIView *mMouseGrabber;
|
nsView *mMouseGrabber;
|
||||||
nsIView *mKeyGrabber;
|
nsView *mKeyGrabber;
|
||||||
PRInt32 mUpdateCnt;
|
PRInt32 mUpdateCnt;
|
||||||
PRInt32 mUpdateBatchCnt;
|
PRInt32 mUpdateBatchCnt;
|
||||||
PRInt32 mDisplayListCount;
|
PRInt32 mDisplayListCount;
|
||||||
nsAutoVoidArray mDisplayList;
|
nsAutoVoidArray mDisplayList;
|
||||||
PRInt32 mTranslucentViewCount;
|
PRInt32 mTranslucentViewCount;
|
||||||
nsRect mTranslucentArea; // bounding box of all translucent views.
|
nsRect mTranslucentArea; // bounding box of all translucent views.
|
||||||
nsIScrollableView *mRootScrollable;
|
nsIScrollableView *mRootScrollable;
|
||||||
PRInt32 mCachingWidgetChanges;
|
PRInt32 mCachingWidgetChanges;
|
||||||
|
@ -391,7 +444,7 @@ private:
|
||||||
nsISupportsArray *mCompositeListeners;
|
nsISupportsArray *mCompositeListeners;
|
||||||
void DestroyZTreeNode(DisplayZTreeNode* aNode);
|
void DestroyZTreeNode(DisplayZTreeNode* aNode);
|
||||||
protected:
|
protected:
|
||||||
nsIView *mRootView;
|
nsView *mRootView;
|
||||||
nscoord mX;
|
nscoord mX;
|
||||||
nscoord mY;
|
nscoord mY;
|
||||||
PRBool mAllowDoubleBuffering;
|
PRBool mAllowDoubleBuffering;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче