bug #7774: added new bit NS_VIEW_PUBLIC_FLAG_AUTO_ZINDEX, SetAutoZIndex/GetAutoZIndex to support CSS2 auto z-indexing. a=leaf, r=troy

This commit is contained in:
beard%netscape.com 1999-09-23 23:26:54 +00:00
parent 0cc9f5ea7f
commit 9ce828e930
3 changed files with 51 additions and 11 deletions

View File

@ -37,25 +37,23 @@ struct nsRect;
//this is used by the view clipping APIs since the description of
//a clip rect is different than a rect
typedef struct
{
struct nsViewClip {
nscoord mLeft;
nscoord mRight;
nscoord mTop;
nscoord mBottom;
} nsViewClip;
};
// Enumerated type to indicate the visibility of a layer.
// hide - the layer is not shown.
// show - the layer is shown irrespective of the visibility of
// the layer's parent.
// inherit - the layer inherits its visibility from its parent.
typedef enum
{
enum nsViewVisibility {
nsViewVisibility_kHide = 0,
nsViewVisibility_kShow = 1,
nsViewVisibility_kInherit = 2
} nsViewVisibility;
};
// IID for the nsIView interface
#define NS_IVIEW_IID \
@ -246,6 +244,21 @@ public:
*/
NS_IMETHOD GetZIndex(PRInt32 &aZIndex) const = 0;
/**
* Indicate that the z-index of a view is "auto". An "auto" z-index
* means that the view does not define a new stacking context,
* which means that the z-indicies of the view's children are
* relative to the view's siblings.
* @param aAutoZIndex if true then z-index will be auto
*/
NS_IMETHOD SetAutoZIndex(PRBool aAutoZIndex) = 0;
/**
* Returns true if an auto z-index is set for this view.
* @result current state of auto z-indexing
*/
NS_IMETHOD GetAutoZIndex(PRBool &aAutoZIndex) const = 0;
/**
* Called to set the parent of the view.
* @param aParent new parent
@ -516,5 +529,7 @@ private:
//indicates that the view should not be bitblt'd when moved
//or scrolled and instead must be repainted
#define NS_VIEW_PUBLIC_FLAG_DONT_BITBLT 0x0010
// indicates that the view is using auto z-indexing
#define NS_VIEW_PUBLIC_FLAG_AUTO_ZINDEX 0x0020
#endif

View File

@ -1020,18 +1020,38 @@ NS_IMETHODIMP nsView :: GetVisibility(nsViewVisibility &aVisibility) const
return NS_OK;
}
NS_IMETHODIMP nsView :: SetZIndex(PRInt32 zindex)
NS_IMETHODIMP nsView::SetZIndex(PRInt32 aZIndex)
{
mZindex = zindex;
return NS_OK;
mZindex = aZIndex;
if (nsnull != mWindow) {
mWindow->SetZIndex(aZIndex);
}
return NS_OK;
}
NS_IMETHODIMP nsView :: GetZIndex(PRInt32 &aZIndex) const
NS_IMETHODIMP nsView::GetZIndex(PRInt32 &aZIndex) const
{
aZIndex = mZindex;
return NS_OK;
}
NS_IMETHODIMP nsView::SetAutoZIndex(PRBool aAutoZIndex)
{
if (aAutoZIndex)
mVFlags |= NS_VIEW_PUBLIC_FLAG_AUTO_ZINDEX;
else
mVFlags &= ~NS_VIEW_PUBLIC_FLAG_AUTO_ZINDEX;
return NS_OK;
}
NS_IMETHODIMP nsView::GetAutoZIndex(PRBool &aAutoZIndex) const
{
aAutoZIndex = ((mVFlags & NS_VIEW_PUBLIC_FLAG_AUTO_ZINDEX) != 0);
return NS_OK;
}
NS_IMETHODIMP nsView :: SetParent(nsIView *aParent)
{
mParent = aParent;
@ -1236,6 +1256,9 @@ NS_IMETHODIMP nsView :: CreateWidget(const nsIID &aWindowIID,
if (aEnableDragDrop) {
mWindow->EnableDragDrop(PR_TRUE);
}
// propagate the z-index to the widget.
mWindow->SetZIndex(mZindex);
}
}

View File

@ -66,8 +66,10 @@ public:
NS_IMETHOD GetClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom, PRBool &aResult) const;
NS_IMETHOD SetVisibility(nsViewVisibility visibility);
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const;
NS_IMETHOD SetZIndex(PRInt32 zindex);
NS_IMETHOD SetZIndex(PRInt32 aZIndex);
NS_IMETHOD GetZIndex(PRInt32 &aZIndex) const;
NS_IMETHOD SetAutoZIndex(PRBool aAutoZIndex);
NS_IMETHOD GetAutoZIndex(PRBool &aAutoZIndex) const;
NS_IMETHOD SetParent(nsIView *aParent);
NS_IMETHOD GetParent(nsIView *&aParent) const;
NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const;