Bug 1468124 - Don't calculate overflow area if there is any frames in preserve-3d context. r=mattwoodrow

MozReview-Commit-ID: 2Ts3MzdouB7

--HG--
extra : rebase_source : f4cbff214d410012dae862670a82361e9a322f23
This commit is contained in:
Hiroyuki Ikezoe 2018-06-19 14:49:47 +09:00
parent c3828af488
commit ca097c91ca
3 changed files with 47 additions and 27 deletions

View File

@ -670,29 +670,14 @@ GetFirstDisplayItemWithChildren(nsIFrame* aFrame)
return nullptr;
}
static nsIFrame*
HandlePreserve3D(nsIFrame* aFrame, nsRect& aOverflow)
static bool
IsInPreserve3DContext(const nsIFrame* aFrame)
{
// Preserve-3d frames don't have valid overflow areas, and they might
// have singular transforms (despite still being visible when combined
// with their ancestors). If we're at one, jump up to the root of the
// preserve-3d context and use the whole overflow area.
nsIFrame* last = aFrame;
while (aFrame->Extend3DContext() ||
aFrame->Combines3DTransformWithAncestors()) {
last = aFrame;
aFrame = aFrame->GetParent();
}
if (last != aFrame) {
aOverflow = last->GetVisualOverflowRectRelativeToParent();
CRR_LOG("HandlePreserve3D() Updated overflow rect to: %d %d %d %d\n",
aOverflow.x, aOverflow.y, aOverflow.width, aOverflow.height);
}
return aFrame;
return aFrame->Extend3DContext() ||
aFrame->Combines3DTransformWithAncestors();
}
static void
static bool
ProcessFrameInternal(nsIFrame* aFrame, nsDisplayListBuilder& aBuilder,
AnimatedGeometryRoot** aAGR, nsRect& aOverflow,
nsIFrame* aStopAtFrame, nsTArray<nsIFrame*>& aOutFramesWithProps,
@ -705,8 +690,6 @@ ProcessFrameInternal(nsIFrame* aFrame, nsDisplayListBuilder& aBuilder,
currentFrame, !aStopAtStackingContext,
aOverflow.x, aOverflow.y, aOverflow.width, aOverflow.height);
currentFrame = HandlePreserve3D(currentFrame, aOverflow);
// If the current frame is an OOF frame, DisplayListBuildingData needs to be
// set on all the ancestor stacking contexts of the placeholder frame, up
// to the containing block of the OOF frame. This is done to ensure that the
@ -739,8 +722,11 @@ ProcessFrameInternal(nsIFrame* aFrame, nsDisplayListBuilder& aBuilder,
nsLayoutUtils::FindNearestCommonAncestorFrame(currentFrame->GetParent(),
placeholder->GetParent());
ProcessFrameInternal(placeholder, aBuilder, &dummyAGR, placeholderOverflow,
ancestor, aOutFramesWithProps, false);
if (!ProcessFrameInternal(placeholder, aBuilder, &dummyAGR,
placeholderOverflow, ancestor,
aOutFramesWithProps, false)) {
return false;
}
}
// Convert 'aOverflow' into the coordinate space of the nearest stacking context
@ -749,6 +735,10 @@ ProcessFrameInternal(nsIFrame* aFrame, nsDisplayListBuilder& aBuilder,
nullptr, nullptr,
/* aStopAtStackingContextAndDisplayPortAndOOFFrame = */ true,
&currentFrame);
if (IsInPreserve3DContext(currentFrame)) {
return false;
}
MOZ_ASSERT(currentFrame);
if (nsLayoutUtils::FrameHasDisplayPort(currentFrame)) {
@ -856,6 +846,7 @@ ProcessFrameInternal(nsIFrame* aFrame, nsDisplayListBuilder& aBuilder,
break;
}
}
return true;
}
bool
@ -896,8 +887,10 @@ RetainedDisplayListBuilder::ProcessFrame(nsIFrame* aFrame, nsDisplayListBuilder&
overflow.UnionRect(overflow, aBuilder.GetCaretRect());
}
ProcessFrameInternal(aFrame, aBuilder, &agr, overflow, aStopAtFrame,
aOutFramesWithProps, aStopAtStackingContext);
if (!ProcessFrameInternal(aFrame, aBuilder, &agr, overflow, aStopAtFrame,
aOutFramesWithProps, aStopAtStackingContext)) {
return false;
}
if (!overflow.IsEmpty()) {
aOutDirty->UnionRect(*aOutDirty, overflow);

View File

@ -0,0 +1,27 @@
<html class="reftest-wait">
<style>
:not(feFuncB) {
position: fixed;
}
a:last-child {
-webkit-transform-style: preserve-3d;
}
* {
-webkit-backface-visibility: hidden;
</style>
<script>
window.requestIdleCallback(function() {
document.documentElement.getBoundingClientRect();
});
function go() {
var c = document.createElement("a")
c.text = "-";
try { c.replaceChild(b, c.childNodes[0]); } catch(e) { }
try { document.body.appendChild(c); } catch(e) { }
document.documentElement.className = "";
}
</script>
<body onload=go()>
<d id="b">|
<audio controls="">
</html>

View File

@ -12,4 +12,4 @@ skip-if(webrender) load 1430589-1.html # bug 1421825 for webrender
load 1454105-1.html
load 1455944-1.html
load 1465305-1.html
load 1468124-1.html