diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 7db54d6150f..1dea0123653 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -519,6 +519,22 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, vm->SetViewContentTransparency(aView, viewHasTransparentContent); } + // Make sure z-index is correct + PRInt32 zIndex = 0; + PRBool autoZIndex = PR_FALSE; + const nsStylePosition* position; + + aFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position); + if (position->mZIndex.GetUnit() == eStyleUnit_Integer) { + zIndex = position->mZIndex.GetIntValue(); + + } else if (position->mZIndex.GetUnit() == eStyleUnit_Auto) { + autoZIndex = PR_TRUE; + } + + vm->SetViewZIndex(aView, zIndex); + vm->SetViewAutoZIndex(aView, autoZIndex); + // Clip applies to block-level and replaced elements with overflow // set to other than 'visible' if (display->IsBlockLevel()) { diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp index ab4863a8c39..bb94bb9ed74 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp @@ -300,6 +300,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, // If we don't yet have a view, see if we need a view if (nsnull == view) { PRInt32 zIndex = 0; + PRBool autoZIndex = PR_FALSE; PRBool fixedBackgroundAttachment = PR_FALSE; // Get nsStyleColor and nsStyleDisplay @@ -336,6 +337,9 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, // Get the z-index to use if (position->mZIndex.GetUnit() == eStyleUnit_Integer) { zIndex = position->mZIndex.GetIntValue(); + + } else if (position->mZIndex.GetUnit() == eStyleUnit_Auto) { + autoZIndex = PR_TRUE; } } else if (position->IsAbsolutelyPositioned()) { @@ -347,6 +351,9 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, // Get the z-index to use if (position->mZIndex.GetUnit() == eStyleUnit_Integer) { zIndex = position->mZIndex.GetIntValue(); + + } else if (position->mZIndex.GetUnit() == eStyleUnit_Auto) { + autoZIndex = PR_TRUE; } } } @@ -407,6 +414,10 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, scrollingView->SetScrolledView(view); } else { viewManager->InsertChild(parentView, view, zIndex); + + if (autoZIndex) { + viewManager->SetViewAutoZIndex(view, PR_TRUE); + } } // See if the view should be hidden diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 7db54d6150f..1dea0123653 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -519,6 +519,22 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, vm->SetViewContentTransparency(aView, viewHasTransparentContent); } + // Make sure z-index is correct + PRInt32 zIndex = 0; + PRBool autoZIndex = PR_FALSE; + const nsStylePosition* position; + + aFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position); + if (position->mZIndex.GetUnit() == eStyleUnit_Integer) { + zIndex = position->mZIndex.GetIntValue(); + + } else if (position->mZIndex.GetUnit() == eStyleUnit_Auto) { + autoZIndex = PR_TRUE; + } + + vm->SetViewZIndex(aView, zIndex); + vm->SetViewAutoZIndex(aView, autoZIndex); + // Clip applies to block-level and replaced elements with overflow // set to other than 'visible' if (display->IsBlockLevel()) { diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp index ab4863a8c39..bb94bb9ed74 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -300,6 +300,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, // If we don't yet have a view, see if we need a view if (nsnull == view) { PRInt32 zIndex = 0; + PRBool autoZIndex = PR_FALSE; PRBool fixedBackgroundAttachment = PR_FALSE; // Get nsStyleColor and nsStyleDisplay @@ -336,6 +337,9 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, // Get the z-index to use if (position->mZIndex.GetUnit() == eStyleUnit_Integer) { zIndex = position->mZIndex.GetIntValue(); + + } else if (position->mZIndex.GetUnit() == eStyleUnit_Auto) { + autoZIndex = PR_TRUE; } } else if (position->IsAbsolutelyPositioned()) { @@ -347,6 +351,9 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, // Get the z-index to use if (position->mZIndex.GetUnit() == eStyleUnit_Integer) { zIndex = position->mZIndex.GetIntValue(); + + } else if (position->mZIndex.GetUnit() == eStyleUnit_Auto) { + autoZIndex = PR_TRUE; } } } @@ -407,6 +414,10 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext, scrollingView->SetScrolledView(view); } else { viewManager->InsertChild(parentView, view, zIndex); + + if (autoZIndex) { + viewManager->SetViewAutoZIndex(view, PR_TRUE); + } } // See if the view should be hidden