mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1230774 - Use correct Z order to sort perspective items. r=roc
--HG-- extra : rebase_source : 77c3a0ecf14caf7db5451080a6759c572d675f7e
This commit is contained in:
parent
4c375f7a87
commit
8af69f328b
@ -2130,13 +2130,12 @@ nsDisplayItem::MaxActiveLayers()
|
||||
return sMaxLayers;
|
||||
}
|
||||
|
||||
int32_t
|
||||
nsDisplayItem::ZIndex() const
|
||||
static int32_t ZIndexForFrame(nsIFrame* aFrame)
|
||||
{
|
||||
if (!mFrame->IsAbsPosContaininingBlock() && !mFrame->IsFlexOrGridItem())
|
||||
if (!aFrame->IsAbsPosContaininingBlock() && !aFrame->IsFlexOrGridItem())
|
||||
return 0;
|
||||
|
||||
const nsStylePosition* position = mFrame->StylePosition();
|
||||
const nsStylePosition* position = aFrame->StylePosition();
|
||||
if (position->mZIndex.GetUnit() == eStyleUnit_Integer)
|
||||
return position->mZIndex.GetIntValue();
|
||||
|
||||
@ -2144,6 +2143,12 @@ nsDisplayItem::ZIndex() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t
|
||||
nsDisplayItem::ZIndex() const
|
||||
{
|
||||
return ZIndexForFrame(mFrame);
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayItem::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
nsRegion* aVisibleRegion)
|
||||
@ -6313,6 +6318,12 @@ nsDisplayPerspective::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
int32_t
|
||||
nsDisplayPerspective::ZIndex() const
|
||||
{
|
||||
return ZIndexForFrame(mTransformFrame);
|
||||
}
|
||||
|
||||
nsDisplayItemGeometry*
|
||||
nsCharClipDisplayItem::AllocateGeometry(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
|
@ -4287,6 +4287,8 @@ public:
|
||||
|
||||
nsIFrame* TransformFrame() { return mTransformFrame; }
|
||||
|
||||
virtual int32_t ZIndex() const override;
|
||||
|
||||
virtual void
|
||||
DoUpdateBoundsPreserves3D(nsDisplayListBuilder* aBuilder) override {
|
||||
static_cast<nsDisplayTransform*>(mList.GetChildren()->GetTop())->DoUpdateBoundsPreserves3D(aBuilder);
|
||||
|
34
layout/reftests/transform-3d/perspective-zindex.html
Normal file
34
layout/reftests/transform-3d/perspective-zindex.html
Normal file
@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>z-index should work correctly for elements with perspective</title>
|
||||
|
||||
<style>
|
||||
|
||||
#perspective {
|
||||
perspective: 300px;
|
||||
perspective-origin: top left;
|
||||
}
|
||||
|
||||
#front {
|
||||
z-index: 2;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: #00FF00;
|
||||
transform: translateX(0px);
|
||||
}
|
||||
|
||||
#back {
|
||||
z-index: 1;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: #FF0000;
|
||||
transform: translateY(-100px);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="perspective">
|
||||
<div id="front"></div>
|
||||
<div id="back"></div>
|
||||
</div>
|
@ -44,6 +44,7 @@ random-if(Android&&AndroidVersion==17) == perspective-origin-1b.html perspective
|
||||
fuzzy(3,99) random-if(Android&&!browserIsRemote) == perspective-origin-2a.html perspective-origin-2-ref.html # subpixel AA, bug 732568
|
||||
fuzzy-if(winWidget&&!layersGPUAccelerated,1,61) == perspective-origin-3a.html perspective-origin-3-ref.html
|
||||
== perspective-origin-4a.html perspective-origin-4-ref.html
|
||||
== perspective-zindex.html green-rect.html
|
||||
!= sorting-1a.html sorting-1-ref.html
|
||||
# Parallel planes, different z depth
|
||||
== sorting-2a.html sorting-2-ref.html
|
||||
|
Loading…
Reference in New Issue
Block a user