Skip to content

Commit

Permalink
Bug 1650438 - Don't expand the dirty rect for fixed items during a pa…
Browse files Browse the repository at this point in the history
…rtial update. r=mstange,botond

When doing a display list build, there's some code that expands the dirty
and visible rects for out-of-flow items to include the entire visual viewport
or displayport, because out-of-flow items are specially positioned in the
compositor and may become visible without the main thread knowing about it.

However, this happens even during partial updates using retained display lists,
which I believe is undesirable because the preceding non-partial update should
already have painted all the right things. The partial update should be
restricted to the part of the OOF item that actually need repainting, and the
merging of the partial update into the full display list should produce a final
display list that covers everything.

Differential Revision: https://phabricator.services.mozilla.com/D82216
  • Loading branch information
staktrace committed Jul 16, 2020
1 parent e01dd52 commit f951766
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion gfx/layers/apz/test/mochitest/test_group_zoom.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@
["apz.max_tap_time", 10000],
];

// For helper_fixed_pos_displayport the mechanism we use to record the
// fixed-pos displayport only takes effect when not in a partial display list
// update. So for this test we just disable retained display lists entirely.
var no_rdl_prefs = [
...prefs,
["layout.display-list.retain", false],
];

var subtests = [
{"file": "helper_basic_zoom.html", "prefs": prefs},
{"file": "helper_basic_onetouchpinch.html", "prefs": onetouchpinch_prefs},
Expand All @@ -54,7 +62,7 @@
{"file": "helper_visual_smooth_scroll.html", "prefs": prefs},
{"file": "helper_scroll_into_view_bug1516056.html", "prefs": prefs},
{"file": "helper_scroll_into_view_bug1562757.html", "prefs": prefs},
{"file": "helper_fixed_pos_displayport.html", "prefs": prefs},
{"file": "helper_fixed_pos_displayport.html", "prefs": no_rdl_prefs},
// If you're adding more tests, add them to test_group_zoom-2.html
];

Expand Down
4 changes: 3 additions & 1 deletion layout/painting/nsDisplayList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,11 @@ nsRect nsDisplayListBuilder::OutOfFlowDisplayData::ComputeVisibleRectForFrame(
nsRect visible = aVisibleRect;
nsRect dirtyRectRelativeToDirtyFrame = aDirtyRect;

bool inPartialUpdate =
aBuilder->IsRetainingDisplayList() && aBuilder->IsPartialUpdate();
if (StaticPrefs::apz_allow_zooming() &&
nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
aBuilder->IsPaintingToWindow()) {
aBuilder->IsPaintingToWindow() && !inPartialUpdate) {
dirtyRectRelativeToDirtyFrame =
nsRect(nsPoint(0, 0), aFrame->GetParent()->GetSize());

Expand Down

0 comments on commit f951766

Please sign in to comment.