зеркало из https://github.com/mozilla/pjs.git
Bug 587542. If painting is suppressed in the presshell, drop invalidations that come through the view subsystem as well as through the usual frame invalidation path. r=roc
This commit is contained in:
Родитель
b7a5b9478f
Коммит
2a8500fa19
|
@ -836,6 +836,7 @@ public:
|
|||
nsEventStatus* aStatus);
|
||||
NS_IMETHOD ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD_(PRBool) IsVisible();
|
||||
NS_IMETHOD_(PRBool) ShouldIgnoreInvalidation();
|
||||
NS_IMETHOD_(void) WillPaint(PRBool aWillSendDidPaint);
|
||||
NS_IMETHOD_(void) DidPaint();
|
||||
NS_IMETHOD_(void) DispatchSynthMouseMove(nsGUIEvent *aEvent,
|
||||
|
@ -7195,6 +7196,12 @@ PresShell::IsVisible()
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
PresShell::ShouldIgnoreInvalidation()
|
||||
{
|
||||
return mPaintingSuppressed;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
PresShell::WillPaint(PRBool aWillSendDidPaint)
|
||||
{
|
||||
|
|
|
@ -4024,7 +4024,7 @@ nsIFrame::InvalidateRoot(const nsRect& aDamageRect, PRUint32 aFlags)
|
|||
|
||||
nsIView* view = GetView();
|
||||
NS_ASSERTION(view, "This can only be called on frames with views");
|
||||
view->GetViewManager()->UpdateView(view, rect, flags);
|
||||
view->GetViewManager()->UpdateViewNoSuppression(view, rect, flags);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -50,8 +50,8 @@ class nsIDeviceContext;
|
|||
class nsIViewObserver;
|
||||
|
||||
#define NS_IVIEWMANAGER_IID \
|
||||
{ 0x35c07b12, 0x5d96, 0x49f9, \
|
||||
{ 0x91, 0xa3, 0x2f, 0xad, 0x3e, 0x84, 0x0c, 0x91 } }
|
||||
{ 0x4017112c, 0x64d7, 0x47bc, \
|
||||
{ 0xab, 0x66, 0x4e, 0x5f, 0xff, 0x83, 0xec, 0x7c } }
|
||||
|
||||
class nsIViewManager : public nsISupports
|
||||
{
|
||||
|
@ -137,14 +137,15 @@ public:
|
|||
NS_IMETHOD UpdateView(nsIView *aView, PRUint32 aUpdateFlags) = 0;
|
||||
|
||||
/**
|
||||
* Called to inform the view manager that some portion of a view
|
||||
* is dirty and needs to be redrawn. The rect passed in
|
||||
* should be in the view's coordinate space.
|
||||
* Called to inform the view manager that some portion of a view is dirty and
|
||||
* needs to be redrawn. The rect passed in should be in the view's coordinate
|
||||
* space. Does not check for paint suppression.
|
||||
* @param aView view to paint. should be root view
|
||||
* @param rect rect to mark as damaged
|
||||
* @param aUpdateFlags see bottom of nsIViewManager.h for description
|
||||
*/
|
||||
NS_IMETHOD UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags) = 0;
|
||||
NS_IMETHOD UpdateViewNoSuppression(nsIView *aView, const nsRect &aRect,
|
||||
PRUint32 aUpdateFlags) = 0;
|
||||
|
||||
/**
|
||||
* Called to inform the view manager that it should redraw all views.
|
||||
|
|
|
@ -48,7 +48,7 @@ class nsGUIEvent;
|
|||
|
||||
#define NS_IVIEWOBSERVER_IID \
|
||||
{ 0xc5dfb460, 0x50fb, 0x483e, \
|
||||
{ 0xb4, 0x22, 0x19, 0xb7, 0x20, 0x4f, 0xe2, 0xdc } }
|
||||
{ 0xb4, 0x22, 0x19, 0xb7, 0x20, 0x4f, 0xe2, 0xdc } } //xxx
|
||||
|
||||
class nsIViewObserver : public nsISupports
|
||||
{
|
||||
|
@ -113,6 +113,13 @@ public:
|
|||
*/
|
||||
NS_IMETHOD_(PRBool) IsVisible() = 0;
|
||||
|
||||
/**
|
||||
* Returns true if the view observer wants to drop all invalidation right now
|
||||
* because painting is suppressed. It will invalidate everything when it
|
||||
* unsuppresses.
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) ShouldIgnoreInvalidation() = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that we're about to start painting. This
|
||||
* gives the observer a chance to make some last-minute invalidates
|
||||
|
|
|
@ -665,7 +665,35 @@ nsViewManager::UpdateWidgetArea(nsView *aWidgetView, nsIWidget* aWidget,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags)
|
||||
static PRBool
|
||||
ShouldIgnoreInvalidation(nsViewManager* aVM)
|
||||
{
|
||||
while (aVM) {
|
||||
nsIViewObserver* vo = aVM->GetViewObserver();
|
||||
if (vo && vo->ShouldIgnoreInvalidation()) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
nsView* view = aVM->GetRootView()->GetParent();
|
||||
aVM = view ? view->GetViewManager() : nsnull;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsresult nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect,
|
||||
PRUint32 aUpdateFlags)
|
||||
{
|
||||
// If painting is suppressed in the presshell or an ancestor drop all
|
||||
// invalidates, it will invalidate everything when it unsuppresses.
|
||||
if (ShouldIgnoreInvalidation(this)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return UpdateViewNoSuppression(aView, aRect, aUpdateFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::UpdateViewNoSuppression(nsIView *aView,
|
||||
const nsRect &aRect,
|
||||
PRUint32 aUpdateFlags)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aView, "null view");
|
||||
|
||||
|
|
|
@ -116,7 +116,8 @@ public:
|
|||
NS_IMETHOD Composite(void);
|
||||
|
||||
NS_IMETHOD UpdateView(nsIView *aView, PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD UpdateViewNoSuppression(nsIView *aView, const nsRect &aRect,
|
||||
PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD UpdateAllViews(PRUint32 aUpdateFlags);
|
||||
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent *aEvent,
|
||||
|
@ -249,6 +250,8 @@ private:
|
|||
RootViewManager()->mPainting = aPainting;
|
||||
}
|
||||
|
||||
nsresult UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags);
|
||||
|
||||
public: // NOT in nsIViewManager, so private to the view module
|
||||
nsView* GetRootView() const { return mRootView; }
|
||||
nsViewManager* RootViewManager() const { return mRootViewManager; }
|
||||
|
|
Загрузка…
Ссылка в новой задаче