backing out change to see if pageload times go back to normal (Don't place position:absolute, fixed, relative elements above non positioned elements) b=137853

This commit is contained in:
kmcclusk%netscape.com 2002-07-02 04:38:35 +00:00
Родитель 11170c4175
Коммит e89c78b98a
12 изменённых файлов: 42 добавлений и 109 удалений

Просмотреть файл

@ -650,14 +650,9 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
// Make sure z-index is correct
PRInt32 zIndex = 0;
PRInt32 oldZIndex;
PRBool oldAutoZIndex;
PRBool oldTopMost;
PRBool autoZIndex = PR_FALSE;
const nsStylePosition* position;
aView->GetZIndex(oldZIndex, oldAutoZIndex, oldTopMost);
aFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position);
if (position->mZIndex.GetUnit() == eStyleUnit_Integer) {
zIndex = position->mZIndex.GetIntValue();
@ -666,7 +661,7 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
autoZIndex = PR_TRUE;
}
vm->SetViewZIndex(aView, autoZIndex, zIndex, oldTopMost);
vm->SetViewZIndex(aView, autoZIndex, zIndex);
// There are two types of clipping:
// - 'clip' which only applies to absolutely positioned elements, and is

Просмотреть файл

@ -449,7 +449,6 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
nsIFrame* aContentParentFrame,
PRBool aForce)
{
PRBool isTopMostView = PR_FALSE;
nsIView* view;
aFrame->GetView(aPresContext, &view);
// If we don't yet have a view, see if we need a view
@ -490,20 +489,14 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p relatively positioned",
aFrame));
aForce = PR_TRUE;
isTopMostView = PR_TRUE;
} else if (display->IsAbsolutelyPositioned()) {
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p absolutely positioned",
aFrame));
aForce = PR_TRUE;
isTopMostView = PR_TRUE;
}
}
if (NS_STYLE_POSITION_FIXED == display->mPosition) {
isTopMostView = PR_TRUE;
}
// See if the frame is a scrolled frame
if (!aForce) {
nsIAtom* pseudoTag;
@ -592,7 +585,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
autoZIndex = PR_TRUE;
}
viewManager->SetViewZIndex(view, autoZIndex, zIndex, isTopMostView);
viewManager->SetViewZIndex(view, autoZIndex, zIndex);
// XXX Drop it at the end of the document order until we can do better
viewManager->InsertChild(parentView, view, nsnull, PR_TRUE);

Просмотреть файл

@ -650,14 +650,9 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
// Make sure z-index is correct
PRInt32 zIndex = 0;
PRInt32 oldZIndex;
PRBool oldAutoZIndex;
PRBool oldTopMost;
PRBool autoZIndex = PR_FALSE;
const nsStylePosition* position;
aView->GetZIndex(oldZIndex, oldAutoZIndex, oldTopMost);
aFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position);
if (position->mZIndex.GetUnit() == eStyleUnit_Integer) {
zIndex = position->mZIndex.GetIntValue();
@ -666,7 +661,7 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
autoZIndex = PR_TRUE;
}
vm->SetViewZIndex(aView, autoZIndex, zIndex, oldTopMost);
vm->SetViewZIndex(aView, autoZIndex, zIndex);
// There are two types of clipping:
// - 'clip' which only applies to absolutely positioned elements, and is

Просмотреть файл

@ -449,7 +449,6 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
nsIFrame* aContentParentFrame,
PRBool aForce)
{
PRBool isTopMostView = PR_FALSE;
nsIView* view;
aFrame->GetView(aPresContext, &view);
// If we don't yet have a view, see if we need a view
@ -490,20 +489,14 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p relatively positioned",
aFrame));
aForce = PR_TRUE;
isTopMostView = PR_TRUE;
} else if (display->IsAbsolutelyPositioned()) {
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p absolutely positioned",
aFrame));
aForce = PR_TRUE;
isTopMostView = PR_TRUE;
}
}
if (NS_STYLE_POSITION_FIXED == display->mPosition) {
isTopMostView = PR_TRUE;
}
// See if the frame is a scrolled frame
if (!aForce) {
nsIAtom* pseudoTag;
@ -592,7 +585,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
autoZIndex = PR_TRUE;
}
viewManager->SetViewZIndex(view, autoZIndex, zIndex, isTopMostView);
viewManager->SetViewZIndex(view, autoZIndex, zIndex);
// XXX Drop it at the end of the document order until we can do better
viewManager->InsertChild(parentView, view, nsnull, PR_TRUE);

Просмотреть файл

@ -144,14 +144,9 @@ public:
/**
* Called to query the z-index of a view.
* The z-index is relative to all siblings of the view.
* @param aAuto PR_TRUE if the view is zindex:auto
* @param aZIndex explicit z-index value.
* @param aTopMost used when this view is zindex:auto
* PR_TRUE if the view is topmost when compared
* with another z-index:auto view
*
* @result current z depth
*/
NS_IMETHOD GetZIndex(PRBool &aAuto, PRInt32 &aZIndex, PRBool &aTopMost) const = 0;
NS_IMETHOD GetZIndex(PRBool &aAuto, PRInt32 &aZIndex) const = 0;
/**
* Get whether the view "floats" above all other views,

Просмотреть файл

@ -288,13 +288,9 @@ public:
* which means that the z-indicies of the view's children are
* relative to the view's siblings.
* @param aView view to change z depth of
* @param aZindex explicit z depth
* @param aTopMost used when this view is z-index:auto to compare against
* other z-index:auto views.
* PR_TRUE if the view should be topmost when compared with
* other z-index:auto views.
* @param zindex new z depth
*/
NS_IMETHOD SetViewZIndex(nsIView *aView, PRBool aAutoZIndex, PRInt32 aZindex, PRBool aTopMost = PR_FALSE) = 0;
NS_IMETHOD SetViewZIndex(nsIView *aView, PRBool aAutoZIndex, PRInt32 aZindex) = 0;
/**
* Set whether the view "floats" above all other views,

Просмотреть файл

@ -950,17 +950,17 @@ NS_IMETHODIMP nsScrollingView::SetWidget(nsIWidget *aWidget)
return NS_OK;
}
NS_IMETHODIMP nsScrollingView::SetZIndex(PRBool aAuto, PRInt32 aZIndex, PRBool aTopMost)
NS_IMETHODIMP nsScrollingView::SetZIndex(PRBool aAuto, PRInt32 aZIndex)
{
nsView::SetZIndex(aAuto, aZIndex, aTopMost);
nsView::SetZIndex(aAuto, aZIndex);
// inform all views that the z-index has changed.
// XXX why are we doing this? they're all a child of this view, so they
// shouldn't need to be re-z-indexed.
if (mClipView) mViewManager->SetViewZIndex(mClipView, aAuto, aZIndex, aTopMost);
if (mCornerView) mViewManager->SetViewZIndex(mCornerView, aAuto, aZIndex, aTopMost);
if (mVScrollBarView) mViewManager->SetViewZIndex(mVScrollBarView, aAuto, aZIndex, aTopMost);
if (mHScrollBarView) mViewManager->SetViewZIndex(mHScrollBarView, aAuto, aZIndex, aTopMost);
if (mClipView) mViewManager->SetViewZIndex(mClipView, aAuto, aZIndex);
if (mCornerView) mViewManager->SetViewZIndex(mCornerView, aAuto, aZIndex);
if (mVScrollBarView) mViewManager->SetViewZIndex(mVScrollBarView, aAuto, aZIndex);
if (mHScrollBarView) mViewManager->SetViewZIndex(mHScrollBarView, aAuto, aZIndex);
return NS_OK;
}

Просмотреть файл

@ -68,7 +68,7 @@ public:
NS_IMETHOD SetVisibility(nsViewVisibility visibility);
NS_IMETHOD SetWidget(nsIWidget *aWidget);
NS_IMETHOD SetZIndex(PRBool aAuto, PRInt32 aZIndex, PRBool aTopMost);
NS_IMETHOD SetZIndex(PRBool aAuto, PRInt32 aZIndex);
//nsIScrollableView interface
NS_IMETHOD CreateScrollControls(nsNativeWidget aNative = nsnull);

Просмотреть файл

@ -607,11 +607,10 @@ NS_IMETHODIMP nsView::GetVisibility(nsViewVisibility &aVisibility) const
return NS_OK;
}
NS_IMETHODIMP nsView::GetZIndex(PRBool &aAuto, PRInt32 &aZIndex, PRBool &aTopMost) const
NS_IMETHODIMP nsView::GetZIndex(PRBool &aAuto, PRInt32 &aZIndex) const
{
aAuto = (mVFlags & NS_VIEW_FLAG_AUTO_ZINDEX) != 0;
aZIndex = mZIndex;
aTopMost = (mVFlags & NS_VIEW_FLAG_TOPMOST) != 0;
return NS_OK;
}
@ -826,11 +825,10 @@ NS_IMETHODIMP nsView::CreateWidget(const nsIID &aWindowIID,
return NS_OK;
}
void nsView::SetZIndex(PRBool aAuto, PRInt32 aZIndex, PRBool aTopMost)
void nsView::SetZIndex(PRBool aAuto, PRInt32 aZIndex)
{
mVFlags = (mVFlags & ~NS_VIEW_FLAG_AUTO_ZINDEX) | (aAuto ? NS_VIEW_FLAG_AUTO_ZINDEX : 0);
mZIndex = aZIndex;
SetTopMost(aTopMost);
if (nsnull != mWindow) {
mWindow->SetZIndex(aZIndex);

Просмотреть файл

@ -84,10 +84,6 @@ public:
// set if our widget moved.
#define NS_VIEW_FLAG_WIDGET_MOVED 0x0100
#define NS_VIEW_FLAG_CLIPCHILDREN 0x0200
// if set it indicates that this view should be
// displayed above z-index:auto views if this view
// is z-index:auto also
#define NS_VIEW_FLAG_TOPMOST 0x0400
//indicates that the view should not be bitblt'd when moved
//or scrolled and instead must be repainted
#define NS_VIEW_FLAG_DONT_BITBLT 0x0010
@ -114,7 +110,7 @@ public:
NS_IMETHOD GetPosition(nscoord *x, nscoord *y) const;
NS_IMETHOD GetBounds(nsRect &aBounds) const;
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const;
NS_IMETHOD GetZIndex(PRBool &aAuto, PRInt32 &aZIndex, PRBool &aTopMost) const;
NS_IMETHOD GetZIndex(PRBool &aAuto, PRInt32 &aZIndex) const;
PRInt32 GetZIndex() const { return mZIndex; }
PRBool GetZIndexIsAuto() const { return (mVFlags & NS_VIEW_FLAG_AUTO_ZINDEX) != 0; }
NS_IMETHOD GetFloating(PRBool &aFloatingView) const;
@ -222,7 +218,7 @@ public:
* relative to the view's siblings.
* @param zindex new z depth
*/
void SetZIndex(PRBool aAuto, PRInt32 aZIndex, PRBool aTopMost);
void SetZIndex(PRBool aAuto, PRInt32 aZIndex);
/**
* Set/Get whether the view "floats" above all other views,
@ -319,9 +315,6 @@ public: // NOT in nsIView, so only available in view module
PRUint32 GetViewFlags() const { return mVFlags; }
void SetViewFlags(PRUint32 aFlags) { mVFlags = aFlags; }
void SetTopMost(PRBool aTopMost) { aTopMost ? mVFlags |= NS_VIEW_FLAG_TOPMOST : mVFlags &= ~NS_VIEW_FLAG_TOPMOST; }
PRBool IsTopMost() { return((mVFlags & NS_VIEW_FLAG_TOPMOST) != 0); }
void ConvertToParentCoords(nscoord* aX, nscoord* aY) const { *aX += mPosX; *aY += mPosY; }
void ConvertFromParentCoords(nscoord* aX, nscoord* aY) const { *aX -= mPosX; *aY -= mPosY; }

Просмотреть файл

@ -252,26 +252,6 @@ nsInvalidateEvent::nsInvalidateEvent(nsViewManager* aViewManager)
//-------------- End Invalidate Event Definition ---------------------------
// Compare two Z-index values taking into account topmost and
// auto flags. the topmost flag is only used when both views are
// zindex:auto.
//
// returns 0 if equal
// > 0 if first z-index is greater than the second
// < 0 if first z-index is less than the second
static PRInt32 CompareZIndex(PRInt32 aZIndex1, PRBool aTopMost1, PRBool aIsAuto1,
PRInt32 aZIndex2, PRBool aTopMost2, PRBool aIsAuto2)
{
NS_ASSERTION(!aIsAuto1 || aZIndex1 == 0,"auto is set and the z-index is not 0");
NS_ASSERTION(!aIsAuto2 || aZIndex2 == 0,"auto is set and the z-index is not 0");
if (aZIndex1 != aZIndex2) {
return aZIndex1 - aZIndex2;
} else {
return aTopMost1 - aTopMost2;
}
}
void
nsViewManager::PostInvalidateEvent()
@ -546,7 +526,7 @@ NS_IMETHODIMP nsViewManager::SetRootView(nsIView *aView, nsIWidget* aWidget)
parent->InsertChild(mRootView, nsnull);
}
mRootView->SetZIndex(PR_FALSE, 0, PR_FALSE);
mRootView->SetZIndex(PR_FALSE, 0);
mRootView->GetWidget(mRootWindow);
if (nsnull != mRootWindow) {
@ -2225,8 +2205,7 @@ NS_IMETHODIMP nsViewManager::InsertChild(nsIView *aParent, nsIView *aChild, nsIV
{
PRInt32 idx = kid->GetZIndex();
if (CompareZIndex(zIndex, child->IsTopMost(), child->GetZIndexIsAuto(),
idx, kid->IsTopMost(), kid->GetZIndexIsAuto()) >= 0)
if (zIndex >= idx)
break;
prev = kid;
@ -2269,7 +2248,7 @@ NS_IMETHODIMP nsViewManager::InsertZPlaceholder(nsIView *aParent, nsIView *aChil
// mark the placeholder as "shown" so that it will be included in a built display list
placeholder->Init(this, bounds, parent, nsViewVisibility_kShow);
placeholder->SetReparentedView(child);
placeholder->SetZIndex(child->GetZIndexIsAuto(), child->GetZIndex(), child->IsTopMost());
placeholder->SetZIndex(child->GetZIndexIsAuto(), child->GetZIndex());
child->SetZParent(placeholder);
return InsertChild(parent, placeholder, aSibling, aAfter);
@ -2294,10 +2273,8 @@ NS_IMETHODIMP nsViewManager::InsertChild(nsIView *aParent, nsIView *aChild, PRIn
{
PRInt32 idx = kid->GetZIndex();
if (CompareZIndex(aZIndex, child->IsTopMost(), child->GetZIndexIsAuto(),
idx, kid->IsTopMost(), kid->GetZIndexIsAuto()) >= 0) {
if (aZIndex >= idx)
break;
}
//get the next sibling view
@ -2307,7 +2284,7 @@ NS_IMETHODIMP nsViewManager::InsertChild(nsIView *aParent, nsIView *aChild, PRIn
//in case this hasn't been set yet... maybe we should not do this? MMP
child->SetZIndex(child->GetZIndexIsAuto(), aZIndex, child->IsTopMost());
child->SetZIndex(child->GetZIndexIsAuto(), aZIndex);
parent->InsertChild(child, prev);
UpdateTransCnt(nsnull, child);
@ -2727,7 +2704,7 @@ PRBool nsViewManager::IsViewInserted(nsView *aView)
}
}
NS_IMETHODIMP nsViewManager::SetViewZIndex(nsIView *aView, PRBool aAutoZIndex, PRInt32 aZIndex, PRBool aTopMost)
NS_IMETHODIMP nsViewManager::SetViewZIndex(nsIView *aView, PRBool aAutoZIndex, PRInt32 aZIndex)
{
nsView* view = NS_STATIC_CAST(nsView*, aView);
nsresult rv = NS_OK;
@ -2740,19 +2717,16 @@ NS_IMETHODIMP nsViewManager::SetViewZIndex(nsIView *aView, PRBool aAutoZIndex, P
return rv;
}
PRBool oldTopMost = view->IsTopMost();
PRBool oldIsAuto = view->GetZIndexIsAuto();
if (aAutoZIndex) {
aZIndex = 0;
}
PRInt32 oldidx = view->GetZIndex();
view->SetZIndex(aAutoZIndex, aZIndex, aTopMost);
view->SetZIndex(aAutoZIndex, aZIndex);
if (IsViewInserted(view)) {
if (CompareZIndex(oldidx, oldTopMost, oldIsAuto,
aZIndex, aTopMost, aAutoZIndex) != 0) {
if (oldidx != aZIndex) {
nsView *parent = view->GetParent();
if (nsnull != parent) {
//we don't just call the view manager's RemoveChild()
@ -2774,7 +2748,7 @@ NS_IMETHODIMP nsViewManager::SetViewZIndex(nsIView *aView, PRBool aAutoZIndex, P
nsZPlaceholderView* zParentView = view->GetZParent();
if (nsnull != zParentView) {
SetViewZIndex(zParentView, aAutoZIndex, aZIndex, aTopMost);
SetViewZIndex(zParentView, aAutoZIndex, aZIndex);
}
}

Просмотреть файл

@ -180,7 +180,8 @@ public:
NS_IMETHOD SetViewVisibility(nsIView *aView, nsViewVisibility aVisible);
NS_IMETHOD SetViewZIndex(nsIView *aView, PRBool aAuto, PRInt32 aZIndex, PRBool aTopMost=PR_FALSE);
NS_IMETHOD SetViewZIndex(nsIView *aView, PRBool aAuto, PRInt32 aZIndex);
NS_IMETHOD SetViewContentTransparency(nsIView *aView, PRBool aTransparent);
NS_IMETHOD SetViewOpacity(nsIView *aView, float aOpacity);