Bug 1276107 - Ensure sorting display items by z-order doesn't cause event-regions items to end up below items they are supposed to cover. r=mattwoodrow

MozReview-Commit-ID: BxnshG9TgRb

--HG--
extra : rebase_source : 5817e50d64a1211e224c9b6dbd3e3efdcd5e48f0
extra : source : 4c1ca58448e3513691f92c1f9f0a92329ccc17c5
extra : histedit_source : d3ddaa7425ac1e2a1b019c957525653aeee8a4da
This commit is contained in:
Botond Ballo 2016-05-30 20:01:04 -04:00
Родитель d085f720c0
Коммит 5a82b92113
3 изменённых файлов: 23 добавлений и 0 удалений

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

@ -3695,6 +3695,18 @@ nsDisplayLayerEventRegions::IsEmpty() const
return false;
}
int32_t
nsDisplayLayerEventRegions::ZIndex() const
{
return mOverrideZIndex ? *mOverrideZIndex : nsDisplayItem::ZIndex();
}
void
nsDisplayLayerEventRegions::SetOverrideZIndex(int32_t aZIndex)
{
mOverrideZIndex = Some(aZIndex);
}
void
nsDisplayLayerEventRegions::WriteDebugInfo(std::stringstream& aStream)
{

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

@ -16,6 +16,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/EnumSet.h"
#include "mozilla/Maybe.h"
#include "nsCOMPtr.h"
#include "nsContainerFrame.h"
#include "nsPoint.h"
@ -3141,6 +3142,10 @@ public:
void AddInactiveScrollPort(const nsRect& aRect);
bool IsEmpty() const;
int32_t ZIndex() const override;
void SetOverrideZIndex(int32_t aZIndex);
const nsRegion& HitRegion() { return mHitRegion; }
const nsRegion& MaybeHitRegion() { return mMaybeHitRegion; }
const nsRegion& DispatchToContentHitRegion() { return mDispatchToContentHitRegion; }
@ -3169,6 +3174,11 @@ private:
// These are points where panning is vertical, as determined by the touch-action
// property. Always contained in the union of mHitRegion and mMaybeHitRegion.
nsRegion mVerticalPanRegion;
// If these event regions are for an inactive scroll frame, the z-index of
// this display item is overridden to be the largest z-index of the content
// in the scroll frame. This ensures that the event regions item remains on
// top of the content after sorting items by z-index.
mozilla::Maybe<int32_t> mOverrideZIndex;
};
/**

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

@ -3463,6 +3463,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
MaxZIndexInListOfItemsContainedInFrame(positionedDescendants, mOuter);
if (zindex >= 0) {
destinationList = positionedDescendants;
inactiveRegionItem->SetOverrideZIndex(zindex);
} else {
destinationList = scrolledContent.Outlines();
}