Bug 1411050 Part 1: Change nsDisplayListBuilder to mark hitests either for visibility or for pointer events. r=mattwoodrow

MozReview-Commit-ID: AbYcm2gwEES

--HG--
extra : rebase_source : 589ca29f84df183df86572a3f24476d6a9b7a4ad
This commit is contained in:
Brad Werth 2017-10-24 15:03:56 -07:00
Родитель 7367fac15c
Коммит aefd6655a8
4 изменённых файлов: 16 добавлений и 12 удалений

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

@ -3314,7 +3314,7 @@ nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect,
builder.SetDescendIntoSubdocuments(false);
}
builder.SetHitTestShouldStopAtFirstOpaque(aFlags & ONLY_VISIBLE);
builder.SetHitTestIsForVisibility(aFlags & ONLY_VISIBLE);
builder.EnterPresShell(aFrame);

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

@ -113,7 +113,7 @@ nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsDisplayListCollection set(aBuilder);
// Do not allow the child subtree to receive events.
if (!isForEventDelivery || aBuilder->HitTestShouldStopAtFirstOpaque()) {
if (!isForEventDelivery || aBuilder->HitTestIsForVisibility()) {
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
if (ShouldClipPaintingToBorderBox()) {

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

@ -958,7 +958,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
mForceLayerForScrollParent(false),
mAsyncPanZoomEnabled(nsLayoutUtils::AsyncPanZoomEnabled(aReferenceFrame)),
mBuildingInvisibleItems(false),
mHitTestShouldStopAtFirstOpaque(false),
mHitTestIsForVisibility(false),
mIsBuilding(false),
mInInvalidSubtree(false)
{
@ -2762,13 +2762,17 @@ void nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
for (uint32_t j = 0; j < outFrames.Length(); j++) {
nsIFrame *f = outFrames.ElementAt(j);
// Handle the XUL 'mousethrough' feature and 'pointer-events'.
if (!GetMouseThrough(f) && IsFrameReceivingPointerEvents(f)) {
// Filter out some frames depending on the type of hittest
// we are doing. For visibility tests, pass through all frames.
// For pointer tests, only pass through frames that are styled
// to receive pointer events.
if (aBuilder->HitTestIsForVisibility() ||
(!GetMouseThrough(f) && IsFrameReceivingPointerEvents(f))) {
writeFrames->AppendElement(f);
}
}
if (aBuilder->HitTestShouldStopAtFirstOpaque() &&
if (aBuilder->HitTestIsForVisibility() &&
item->GetOpaqueRegion(aBuilder, &snap).Contains(aRect)) {
// We're exiting early, so pop the remaining items off the buffer.
aState->mItemBuffer.SetLength(itemBufferStart);
@ -6045,7 +6049,7 @@ nsDisplayWrapList::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
if (mListPtr->IsOpaque()) {
// Everything within GetBounds that's visible is opaque.
result = GetBounds(aBuilder, aSnap);
} else if (aBuilder->HitTestShouldStopAtFirstOpaque()) {
} else if (aBuilder->HitTestIsForVisibility()) {
// If we care about an accurate opaque region, iterate the display list
// and build up a region of opaque bounds.
nsDisplayItem* item = mList.GetBottom();

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

@ -1613,11 +1613,11 @@ public:
*/
AnimatedGeometryRoot* AnimatedGeometryRootForASR(const ActiveScrolledRoot* aASR);
bool HitTestShouldStopAtFirstOpaque() const {
return mHitTestShouldStopAtFirstOpaque;
bool HitTestIsForVisibility() const {
return mHitTestIsForVisibility;
}
void SetHitTestShouldStopAtFirstOpaque(bool aHitTestShouldStopAtFirstOpaque) {
mHitTestShouldStopAtFirstOpaque = aHitTestShouldStopAtFirstOpaque;
void SetHitTestIsForVisibility(bool aHitTestIsForVisibility) {
mHitTestIsForVisibility = aHitTestIsForVisibility;
}
private:
@ -1803,7 +1803,7 @@ private:
bool mForceLayerForScrollParent;
bool mAsyncPanZoomEnabled;
bool mBuildingInvisibleItems;
bool mHitTestShouldStopAtFirstOpaque;
bool mHitTestIsForVisibility;
bool mIsBuilding;
bool mInInvalidSubtree;
};