From 3d978c5cd5132f06754c36f0f2a6619e8530f774 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Wed, 19 Oct 2011 14:10:13 -0500 Subject: [PATCH] Bug 695245. Misc view related code cleanup. Mostly dead code removal. r=roc --- layout/xul/base/src/nsMenuPopupFrame.cpp | 18 ++++++------- layout/xul/base/src/nsMenuPopupFrame.h | 2 +- view/public/nsIView.h | 32 ++---------------------- view/public/nsIViewManager.h | 3 --- view/src/nsView.cpp | 10 -------- view/src/nsView.h | 1 - view/src/nsViewManager.cpp | 8 +++--- view/src/nsViewManager.h | 6 +---- 8 files changed, 14 insertions(+), 66 deletions(-) diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index b65a07e5404..0bb7b73e93f 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -155,7 +155,7 @@ nsMenuPopupFrame::Init(nsIContent* aContent, mMenuCanOverlapOSBar = LookAndFeel::GetInt(LookAndFeel::eIntID_MenusCanOverlapOSBar) != 0; - rv = CreatePopupViewForFrame(); + rv = CreatePopupView(); NS_ENSURE_SUCCESS(rv, rv); // XXX Hack. The popup's view should float above all other views, @@ -1921,24 +1921,20 @@ nsMenuPopupFrame::SetConsumeRollupEvent(PRUint32 aConsumeMode) * as much as possible. Until we get rid of views finally... */ nsresult -nsMenuPopupFrame::CreatePopupViewForFrame() +nsMenuPopupFrame::CreatePopupView() { if (HasView()) { return NS_OK; } - nsViewVisibility visibility = nsViewVisibility_kShow; - PRInt32 zIndex = 0; - bool autoZIndex = false; - - nsIView* parentView; nsIViewManager* viewManager = PresContext()->GetPresShell()->GetViewManager(); NS_ASSERTION(nsnull != viewManager, "null view manager"); // Create a view - parentView = viewManager->GetRootView(); - visibility = nsViewVisibility_kHide; - zIndex = PR_INT32_MAX; + nsIView* parentView = viewManager->GetRootView(); + nsViewVisibility visibility = nsViewVisibility_kHide; + PRInt32 zIndex = PR_INT32_MAX; + bool autoZIndex = false; NS_ASSERTION(parentView, "no parent view"); @@ -1954,7 +1950,7 @@ nsMenuPopupFrame::CreatePopupViewForFrame() SetView(view); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, - ("nsMenuPopupFrame::CreatePopupViewForFrame: frame=%p view=%p", this, view)); + ("nsMenuPopupFrame::CreatePopupView: frame=%p view=%p", this, view)); if (!view) return NS_ERROR_OUT_OF_MEMORY; diff --git a/layout/xul/base/src/nsMenuPopupFrame.h b/layout/xul/base/src/nsMenuPopupFrame.h index fc564b9c094..ea8b35ef4b8 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.h +++ b/layout/xul/base/src/nsMenuPopupFrame.h @@ -409,7 +409,7 @@ protected: // Create a popup view for this frame. The view is added a child of the root // view, and is initially hidden. - nsresult CreatePopupViewForFrame(); + nsresult CreatePopupView(); nsString mIncrementalString; // for incremental typing navigation diff --git a/view/public/nsIView.h b/view/public/nsIView.h index 02dd1d67ac4..0c1fc9575f0 100644 --- a/view/public/nsIView.h +++ b/view/public/nsIView.h @@ -62,14 +62,8 @@ enum nsViewVisibility { }; #define NS_IVIEW_IID \ - { 0xe0a3b0ee, 0x8d0f, 0x4dcb, \ - { 0x89, 0x04, 0x81, 0x2d, 0xfd, 0x90, 0x00, 0x73 } } - -// Public view flags are defined in this file -#define NS_VIEW_FLAGS_PUBLIC 0x00FF -// Private view flags are private to the view module, -// and are defined in nsView.h -#define NS_VIEW_FLAGS_PRIVATE 0xFF00 + { 0x7caf32d2, 0xd82a, 0x4b9f, \ + { 0x84, 0xc1, 0xbd, 0x20, 0xeb, 0x5c, 0x78, 0x55 } } // Public view flags @@ -84,15 +78,6 @@ enum nsViewVisibility { // is z-index:auto also #define NS_VIEW_FLAG_TOPMOST 0x0010 -struct nsViewZIndex { - bool mIsAuto; - PRInt32 mZIndex; - bool mIsTopmost; - - nsViewZIndex(bool aIsAuto, PRInt32 aZIndex, bool aIsTopmost) - : mIsAuto(aIsAuto), mZIndex(aZIndex), mIsTopmost(aIsTopmost) {} -}; - //---------------------------------------------------------------------- /** @@ -234,19 +219,6 @@ public: */ nsViewVisibility GetVisibility() const { return mVis; } - /** - * Called to query the z-index of a view. - * The z-index is relative to all siblings of the view. - * @result mZIndex: explicit z-index value or 0 if none is set - * mIsAuto: true if the view is zindex:auto - * mIsTopMost: used when this view is zindex:auto - * true if the view is topmost when compared - * with another z-index:auto view - */ - nsViewZIndex GetZIndex() const { return nsViewZIndex((mVFlags & NS_VIEW_FLAG_AUTO_ZINDEX) != 0, - mZIndex, - (mVFlags & NS_VIEW_FLAG_TOPMOST) != 0); } - /** * Get whether the view "floats" above all other views, * which tells the compositor not to consider higher views in diff --git a/view/public/nsIViewManager.h b/view/public/nsIViewManager.h index 51084008ce2..4dea219f147 100644 --- a/view/public/nsIViewManager.h +++ b/view/public/nsIViewManager.h @@ -405,7 +405,4 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIViewManager, NS_IVIEWMANAGER_IID) // synchronously updates the window(s) right away before returning #define NS_VMREFRESH_IMMEDIATE 0x0002 -//animate scroll operation -#define NS_VMREFRESH_SMOOTHSCROLL 0x0008 - #endif // nsIViewManager_h___ diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index 48f812a69ad..18a6b780d9b 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -360,16 +360,6 @@ void nsIView::SetInvalidationDimensions(const nsRect* aRect) return Impl()->SetInvalidationDimensions(aRect); } -void nsView::SetPositionIgnoringChildWidgets(nscoord aX, nscoord aY) -{ - mDimBounds.x += aX - mPosX; - mDimBounds.y += aY - mPosY; - mPosX = aX; - mPosY = aY; - - ResetWidgetBounds(false, true, false); -} - void nsView::ResetWidgetBounds(bool aRecurse, bool aMoveOnly, bool aInvalidateChangedSize) { if (mWindow) { diff --git a/view/src/nsView.h b/view/src/nsView.h index afbb255322d..b76579fa1aa 100644 --- a/view/src/nsView.h +++ b/view/src/nsView.h @@ -182,7 +182,6 @@ public: bool IsTopMost() { return((mVFlags & NS_VIEW_FLAG_TOPMOST) != 0); } void ResetWidgetBounds(bool aRecurse, bool aMoveOnly, bool aInvalidateChangedSize); - void SetPositionIgnoringChildWidgets(nscoord aX, nscoord aY); void AssertNoWindow(); void NotifyEffectiveVisibilityChanged(bool aEffectivelyVisible); diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index 65318b961a5..3105310243d 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -353,8 +353,7 @@ nsIView* nsIViewManager::GetDisplayRootFor(nsIView* aView) rendering. */ void nsViewManager::Refresh(nsView *aView, nsIWidget *aWidget, - const nsIntRegion& aRegion, - PRUint32 aUpdateFlags) + const nsIntRegion& aRegion) { NS_ASSERTION(aView == nsView::GetViewFor(aWidget), "view widget mismatch"); NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager"); @@ -397,7 +396,7 @@ void nsViewManager::Refresh(nsView *aView, nsIWidget *aWidget, // Unset this flag first, since if aUpdateFlags includes NS_VMREFRESH_IMMEDIATE // we'll reenter this code from the UpdateAllViews call. RootViewManager()->mRecursiveRefreshPending = false; - UpdateAllViews(aUpdateFlags); + UpdateAllViews(0); } } @@ -885,8 +884,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, } if (view && aEvent->message == NS_PAINT) { - Refresh(view, event->widget, - event->region, NS_VMREFRESH_DOUBLE_BUFFER); + Refresh(view, event->widget, event->region); } } } else if (aEvent->message == NS_PAINT) { diff --git a/view/src/nsViewManager.h b/view/src/nsViewManager.h index 0c86d7e37a4..541ca8acdea 100644 --- a/view/src/nsViewManager.h +++ b/view/src/nsViewManager.h @@ -174,8 +174,7 @@ private: void TriggerRefresh(PRUint32 aUpdateFlags); // aView is the view for aWidget and aRegion is relative to aWidget. - void Refresh(nsView *aView, nsIWidget *aWidget, - const nsIntRegion& aRegion, PRUint32 aUpdateFlags); + void Refresh(nsView *aView, nsIWidget *aWidget, const nsIntRegion& aRegion); // aRootView is the view for aWidget, aRegion is relative to aRootView, and // aIntRegion is relative to aWidget. void RenderViews(nsView *aRootView, nsIWidget *aWidget, @@ -297,9 +296,6 @@ private: void PostInvalidateEvent(); }; -//when the refresh happens, should it be double buffered? -#define NS_VMREFRESH_DOUBLE_BUFFER 0x0001 - class nsInvalidateEvent : public nsRunnable { public: nsInvalidateEvent(class nsViewManager *vm) : mViewManager(vm) {