diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index 1356b3e4957..1664e17e702 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -1021,14 +1021,15 @@ NS_IMETHODIMP nsView::GetClippedRect(nsRect& aClippedRect, PRBool& aIsClipped, P aIsClipped = PR_FALSE; GetBounds(aClippedRect); - nsView* parentView = GetParent(); + const nsView* parentView = GetParent(); PRBool lastViewIsFloating = GetFloating(); + PRBool parentIsFloating; // Walk all of the way up the views to see if any // ancestor sets the NS_VIEW_PUBLIC_FLAG_CLIPCHILDREN. // don't consider non-floating ancestors of a floating view. - while (parentView && (!lastViewIsFloating || parentView->GetFloating())) { - if ((parentView->GetViewFlags() & NS_VIEW_FLAG_CLIPCHILDREN) != 0) { + while (parentView && (!lastViewIsFloating || (parentIsFloating = parentView->GetFloating()))) { + if (parentView->GetClipChildren()) { aIsClipped = PR_TRUE; // Adjust for clip specified by ancestor nscoord clipLeft; @@ -1051,7 +1052,7 @@ NS_IMETHODIMP nsView::GetClippedRect(nsRect& aClippedRect, PRBool& aIsClipped, P parentView->ConvertFromParentCoords(&ancestorX, &ancestorY); - lastViewIsFloating = parentView->GetFloating(); + lastViewIsFloating = parentIsFloating; parentView = parentView->GetParent(); } diff --git a/view/src/nsView.h b/view/src/nsView.h index c9f25db1b7d..ea0b7d09e91 100644 --- a/view/src/nsView.h +++ b/view/src/nsView.h @@ -300,6 +300,7 @@ public: // NOT in nsIView, so only available in view module nsViewVisibility GetVisibility() const { return mVis; } void* GetClientData() const { return mClientData; } PRBool GetFloating() const { return (mVFlags & NS_VIEW_FLAG_FLOATING) != 0; } + PRBool GetClipChildren() const { return (mVFlags & NS_VIEW_FLAG_CLIPCHILDREN) != 0; } PRInt32 GetChildCount() const { return mNumKids; } nsView* GetChild(PRInt32 aIndex) const; @@ -314,8 +315,8 @@ public: // NOT in nsIView, so only available in view module PRUint32 GetViewFlags() const { return mVFlags; } void SetViewFlags(PRUint32 aFlags) { mVFlags = aFlags; } - void ConvertToParentCoords(nscoord* aX, nscoord* aY) { *aX += mPosX; *aY += mPosY; } - void ConvertFromParentCoords(nscoord* aX, nscoord* aY) { *aX -= mPosX; *aY -= mPosY; } + void ConvertToParentCoords(nscoord* aX, nscoord* aY) const { *aX += mPosX; *aY += mPosY; } + void ConvertFromParentCoords(nscoord* aX, nscoord* aY) const { *aX -= mPosX; *aY -= mPosY; } protected: virtual ~nsView();