зеркало из https://github.com/mozilla/pjs.git
Adding new nsIView/nsIViewManager APIs so that a view can have a different parent for Z-order/clipping purposes than its geometric parent. Bug 39621. r,a=waterson
This commit is contained in:
Родитель
8878b574ca
Коммит
d854e17240
|
@ -236,6 +236,15 @@ public:
|
|||
*/
|
||||
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.
|
||||
* The z-index is relative to all siblings of the view.
|
||||
|
@ -277,7 +286,8 @@ public:
|
|||
NS_IMETHOD GetFloating(PRBool &aFloatingView) const = 0;
|
||||
|
||||
/**
|
||||
* Called to set the parent of the view.
|
||||
* 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;
|
||||
|
|
|
@ -150,6 +150,15 @@ public:
|
|||
*/
|
||||
NS_IMETHOD UpdateAllViews(PRUint32 aUpdateFlags) = 0;
|
||||
|
||||
/**
|
||||
* Called to inform the view manager that a view has scrolled.
|
||||
* The view manager will invalidate any widgets which may need
|
||||
* to be rerendered.
|
||||
* @param aView view to paint. should be root view
|
||||
* @param aUpdateFlags see bottom of nsIViewManager.h for description
|
||||
*/
|
||||
NS_IMETHOD UpdateViewAfterScroll(nsIView *aView, PRInt32 aDX, PRInt32 aDY) = 0;
|
||||
|
||||
/**
|
||||
* Called to dispatch an event to the appropriate view. Often called
|
||||
* as a result of receiving a mouse or keyboard event from the widget
|
||||
|
@ -214,6 +223,9 @@ public:
|
|||
NS_IMETHOD InsertChild(nsIView *aParent, nsIView *aChild,
|
||||
PRInt32 aZIndex) = 0;
|
||||
|
||||
NS_IMETHOD InsertZPlaceholder(nsIView *aParent, nsIView *aZChild,
|
||||
PRInt32 aZIndex) = 0;
|
||||
|
||||
/**
|
||||
* Remove a specific child of a view.
|
||||
* The view manager generates the appopriate dirty regions.
|
||||
|
|
|
@ -512,7 +512,6 @@ NS_IMETHODIMP nsScrollPortView::ScrollByWhole(PRBool aTop)
|
|||
|
||||
PRBool nsScrollPortView::CannotBitBlt(nsIView* aScrolledView)
|
||||
{
|
||||
|
||||
PRBool trans;
|
||||
float opacity;
|
||||
PRUint32 scrolledViewFlags;
|
||||
|
@ -549,6 +548,7 @@ void nsScrollPortView::Scroll(nsIView *aScrolledView, PRInt32 aDx, PRInt32 aDy,
|
|||
// Scroll the contents of the widget by the specfied amount, and scroll
|
||||
// the child widgets
|
||||
scrollWidget->Scroll(aDx, aDy, nsnull);
|
||||
mViewManager->UpdateViewAfterScroll(this, aDx, aDy);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(scrollWidget);
|
||||
|
|
|
@ -1694,6 +1694,7 @@ void nsScrollingView::Scroll(nsIView *aScrolledView, PRInt32 aDx, PRInt32 aDy, f
|
|||
// Scroll the contents of the widget by the specfied amount, and scroll
|
||||
// the child widgets
|
||||
clipWidget->Scroll(aDx, aDy, nsnull);
|
||||
mViewManager->UpdateViewAfterScroll(this, aDx, aDy);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(clipWidget);
|
||||
|
|
|
@ -152,8 +152,13 @@ nsView :: ~nsView()
|
|||
mParent->RemoveChild(this);
|
||||
}
|
||||
|
||||
// Destroy and release the widget
|
||||
if (nsnull != mZParent)
|
||||
{
|
||||
mZParent->RemoveChild(this);
|
||||
mZParent->Destroy();
|
||||
}
|
||||
|
||||
// Destroy and release the widget
|
||||
if (nsnull != mWindow)
|
||||
{
|
||||
mWindow->SetClientData(nsnull);
|
||||
|
@ -1096,6 +1101,18 @@ NS_IMETHODIMP nsView :: GetVisibility(nsViewVisibility &aVisibility) const
|
|||
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)
|
||||
{
|
||||
mZindex = aZIndex;
|
||||
|
|
|
@ -73,6 +73,8 @@ public:
|
|||
NS_IMETHOD GetChildClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom) const;
|
||||
NS_IMETHOD SetVisibility(nsViewVisibility visibility);
|
||||
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const;
|
||||
NS_IMETHOD SetZParent(nsIView *aZParent);
|
||||
NS_IMETHOD GetZParent(nsIView *&aZParent) const;
|
||||
NS_IMETHOD SetZIndex(PRInt32 aZIndex);
|
||||
NS_IMETHOD GetZIndex(PRInt32 &aZIndex) const;
|
||||
NS_IMETHOD SetAutoZIndex(PRBool aAutoZIndex);
|
||||
|
@ -140,6 +142,8 @@ protected:
|
|||
nsIView *mParent;
|
||||
nsIWidget *mWindow;
|
||||
|
||||
nsIView *mZParent;
|
||||
|
||||
//XXX should there be pointers to last child so backward walking is fast?
|
||||
nsIView *mNextSibling;
|
||||
nsIView *mFirstChild;
|
||||
|
|
|
@ -1869,6 +1869,11 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, nsIV
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager :: InsertZPlaceholder(nsIView *parent, nsIView *child, PRInt32 zindex)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, PRInt32 zindex)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != parent, "null ptr");
|
||||
|
@ -2997,5 +3002,11 @@ nsViewManager::CacheWidgetChanges(PRBool aCache)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewManager::UpdateViewAfterScroll(nsIView *aView, PRInt32 aDX, PRInt32 aDY)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ public:
|
|||
NS_IMETHOD UpdateView(nsIView *aView, PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD UpdateAllViews(PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD UpdateViewAfterScroll(nsIView *aView, PRInt32 aDX, PRInt32 aDY);
|
||||
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent *aEvent, nsEventStatus* aStatus);
|
||||
|
||||
|
@ -93,6 +94,9 @@ public:
|
|||
NS_IMETHOD InsertChild(nsIView *parent, nsIView *child,
|
||||
PRInt32 zindex);
|
||||
|
||||
NS_IMETHOD InsertZPlaceholder(nsIView *aParent, nsIView *aZChild,
|
||||
PRInt32 aZIndex);
|
||||
|
||||
NS_IMETHOD RemoveChild(nsIView *parent, nsIView *child);
|
||||
|
||||
NS_IMETHOD MoveViewBy(nsIView *aView, nscoord aX, nscoord aY);
|
||||
|
|
|
@ -1090,6 +1090,12 @@ NS_IMETHODIMP nsViewManager2::Composite()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager2::UpdateViewAfterScroll(nsIView *aView, PRInt32 aDX, PRInt32 aDY)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsViewManager2::UpdateView(nsIView *aView, PRUint32 aUpdateFlags)
|
||||
{
|
||||
// Mark the entire view as damaged
|
||||
|
@ -1559,6 +1565,12 @@ NS_IMETHODIMP nsViewManager2::InsertChild(nsIView *parent, nsIView *child, PRInt
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager2::InsertZPlaceholder(nsIView *aParent, nsIView *aZChild,
|
||||
PRInt32 aZIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager2::RemoveChild(nsIView *parent, nsIView *child)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != parent, "null ptr");
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
NS_IMETHOD UpdateView(nsIView *aView, PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD UpdateAllViews(PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD UpdateViewAfterScroll(nsIView *aView, PRInt32 aDX, PRInt32 aDY);
|
||||
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent *aEvent, nsEventStatus* aStatus);
|
||||
|
||||
|
@ -95,6 +96,9 @@ public:
|
|||
NS_IMETHOD InsertChild(nsIView *parent, nsIView *child,
|
||||
PRInt32 zindex);
|
||||
|
||||
NS_IMETHOD InsertZPlaceholder(nsIView *aParent, nsIView *aZChild,
|
||||
PRInt32 aZIndex);
|
||||
|
||||
NS_IMETHOD RemoveChild(nsIView *parent, nsIView *child);
|
||||
|
||||
NS_IMETHOD MoveViewBy(nsIView *aView, nscoord aX, nscoord aY);
|
||||
|
|
Загрузка…
Ссылка в новой задаче