Bug 695245. Misc view related code cleanup. Mostly dead code removal. r=roc

This commit is contained in:
Timothy Nikkel 2011-10-19 14:10:13 -05:00
parent 03bb734c28
commit 3d978c5cd5
8 changed files with 14 additions and 66 deletions

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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___

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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) {