Skip to content

Commit

Permalink
Bug 1111753. Don't restrict the dirty rect stored for display items f…
Browse files Browse the repository at this point in the history
…or out-of-flow elements to their visual overflow areas. r=tn
  • Loading branch information
rocallahan committed Dec 22, 2014
1 parent 102abba commit 10471e9
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
4 changes: 4 additions & 0 deletions layout/base/nsDisplayList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3393,6 +3393,8 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
{
MOZ_COUNT_CTOR(nsDisplayWrapList);

mBaseVisibleRect = mVisibleRect;

mList.AppendToTop(aList);
UpdateBounds(aBuilder);

Expand Down Expand Up @@ -3441,6 +3443,8 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
{
MOZ_COUNT_CTOR(nsDisplayWrapList);

mBaseVisibleRect = mVisibleRect;

mList.AppendToTop(aItem);
UpdateBounds(aBuilder);

Expand Down
12 changes: 12 additions & 0 deletions layout/base/nsDisplayList.h
Original file line number Diff line number Diff line change
Expand Up @@ -2685,6 +2685,7 @@ class nsDisplayWrapList : public nsDisplayItem {
: nsDisplayItem(aBuilder, aFrame), mOverrideZIndex(0), mHasZIndexOverride(false)
{
MOZ_COUNT_CTOR(nsDisplayWrapList);
mBaseVisibleRect = mVisibleRect;
}
virtual ~nsDisplayWrapList();
/**
Expand All @@ -2693,6 +2694,14 @@ class nsDisplayWrapList : public nsDisplayItem {
virtual void UpdateBounds(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE
{
mBounds = mList.GetBounds(aBuilder);
// The display list may contain content that's visible outside the visible
// rect (i.e. the current dirty rect) passed in when the item was created.
// This happens when the dirty rect has been restricted to the visual
// overflow rect of a frame for some reason (e.g. when setting up dirty
// rects in nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay), but that
// frame contains placeholders for out-of-flows that aren't descendants of
// the frame.
mVisibleRect.UnionRect(mBaseVisibleRect, mList.GetVisibleRect());
}
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) MOZ_OVERRIDE;
Expand Down Expand Up @@ -2787,6 +2796,9 @@ class nsDisplayWrapList : public nsDisplayItem {
// this item's own frame.
nsTArray<nsIFrame*> mMergedFrames;
nsRect mBounds;
// Visible rect contributed by this display item itself.
// Our mVisibleRect may include the visible areas of children.
nsRect mBaseVisibleRect;
int32_t mOverrideZIndex;
bool mHasZIndexOverride;
};
Expand Down
38 changes: 38 additions & 0 deletions layout/reftests/bugs/1111753-1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<style>
#d2 {
opacity:0;
transition:all 0.2s;
position:absolute;
}
#d2.active {
opacity:1;
}
#image {
position:fixed;
width:100%;
height:100%;
background:blue;
left:0;
top:0;
}
</style>
</head>
<body>
<div id="d2" class="active">
<div id="image"></div>
<h2>ABCDEFG</h2>
</div>
<script>
function doTest() {
d2.addEventListener("transitionend", function() {
document.documentElement.removeAttribute("class");
});
d2.classList.toggle("active");
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</body>
</html>
1 change: 1 addition & 0 deletions layout/reftests/bugs/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -1853,3 +1853,4 @@ fuzzy-if(winWidget&&!layersGPUAccelerated,1,31) fuzzy-if(B2G,128,75) == 1081185-
== 1103258-1.html 1103258-1-ref.html # assertion crash test with layers culling test
== 1105137-1.html 1105137-1-ref.html
fuzzy-if(d2d,36,304) HTTP(..) == 1116480-1-fakeitalic-overflow.html 1116480-1-fakeitalic-overflow-ref.html
== 1111753-1.html about:blank

0 comments on commit 10471e9

Please sign in to comment.