зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1505222 - Pass TransformStyle::Preserve3d to WebRender more often for perspective display items. r=mattwoodrow
See the comment. Differential Revision: https://phabricator.services.mozilla.com/D16768
This commit is contained in:
Родитель
f534fe0743
Коммит
a0eb07ee30
|
@ -8483,12 +8483,25 @@ bool nsDisplayPerspective::CreateWebRenderCommands(
|
|||
nsIFrame* perspectiveFrame =
|
||||
mFrame->GetContainingBlock(nsIFrame::SKIP_SCROLLED_FRAME);
|
||||
|
||||
// Passing true here is always correct, since perspective always combines
|
||||
// transforms with the descendants. However that'd make WR do a lot of work
|
||||
// that it doesn't really need to do if there aren't other transforms forming
|
||||
// part of the 3D context.
|
||||
//
|
||||
// WR knows how to treat perspective in that case, so the only thing we need
|
||||
// to do is to ensure we pass true when we're involved in a 3d context in any
|
||||
// other way via the transform-style property on either the transformed frame
|
||||
// or the perspective frame in order to not confuse WR's preserve-3d code in
|
||||
// very awful ways.
|
||||
bool preserve3D =
|
||||
mFrame->Extend3DContext() || perspectiveFrame->Extend3DContext();
|
||||
|
||||
nsTArray<mozilla::wr::FilterOp> filters;
|
||||
StackingContextHelper sc(
|
||||
aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder, filters,
|
||||
LayoutDeviceRect(), nullptr, nullptr, nullptr, &perspectiveMatrix,
|
||||
wr::ReferenceFrameKind::Perspective, gfx::CompositionOp::OP_OVER,
|
||||
!BackfaceIsHidden(), perspectiveFrame->Extend3DContext());
|
||||
!BackfaceIsHidden(), preserve3D);
|
||||
|
||||
return mList.CreateWebRenderCommands(aBuilder, aResources, sc, aManager,
|
||||
aDisplayListBuilder);
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test Reference</title>
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://mozilla.org" title="Mozilla">
|
||||
<style>
|
||||
html, body { margin: 0 }
|
||||
#box {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<div id="box"></div>
|
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<title>CSS Test: nested preserve-3d and perspective without transformed items</title>
|
||||
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
|
||||
<link rel="author" href="https://mozilla.org" title="Mozilla">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#perspective">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#transform-style-property">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1505222">
|
||||
<link rel="match" href="preserve3d-nested-perspective-ref.html">
|
||||
<style>
|
||||
html, body { margin: 0 }
|
||||
#box {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<!-- Since we don't specify any transform, this should render just a 100x100px red box -->
|
||||
<div style="perspective: 1200px">
|
||||
<div style="transform-style: preserve-3d">
|
||||
<div style="transform-style: flat">
|
||||
<div id="box" style="transform-style: preserve-3d"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Загрузка…
Ссылка в новой задаче