Bug 1332688 - Pass transform to webrender stacking context. r=jrmuizel

This commit is contained in:
Ethan Lin 2017-02-17 14:57:43 +08:00
parent 0af4be91b6
commit 1897c36bb6
13 changed files with 95 additions and 35 deletions

View File

@ -21,7 +21,7 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) f
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) fuzzy-if(skiaContent&&haveTestPlugin,1,32400) fails-if(webrender) == plugin-background-5-step.html plugin-background-ref.html
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) fuzzy-if(skiaContent&&haveTestPlugin,1,32400) fails-if(webrender) == plugin-background-10-step.html plugin-background-ref.html
random-if(!haveTestPlugin) == plugin-transform-1.html plugin-transform-1-ref.html
fails-if(!haveTestPlugin) fails-if(webrender) == plugin-transform-2.html plugin-transform-2-ref.html
fails-if(!haveTestPlugin) == plugin-transform-2.html plugin-transform-2-ref.html
skip-if(!haveTestPlugin) == shrink-1.html shrink-1-ref.html
skip-if(!haveTestPlugin) == update-1.html update-1-ref.html
skip-if(!haveTestPlugin) == windowless-layers.html windowless-layers-ref.html

View File

@ -21,17 +21,27 @@ WebRenderBorderLayer::RenderLayer()
{
WrScrollFrameStackingContextGenerator scrollFrames(this);
Rect rect = RelativeToVisible(mRect.ToUnknownRect());
LayerIntRect bounds = GetVisibleRegion().GetBounds();
Rect rect(0, 0, bounds.width, bounds.height);
Rect clip;
Matrix4x4 transform = GetTransform();
if (GetClipRect().isSome()) {
clip = RelativeToTransformedVisible(IntRectToRect(GetClipRect().ref().ToUnknownRect()));
clip = RelativeToVisible(transform.Inverse().TransformBounds(IntRectToRect(GetClipRect().ref().ToUnknownRect())));
} else {
clip = rect;
}
Rect relBounds = TransformedVisibleBoundsRelativeToParent();
Rect relBounds = VisibleBoundsRelativeToParent();
if (!transform.IsIdentity()) {
// WR will only apply the 'translate' of the transform, so we need to do the scale/rotation manually.
gfx::Matrix4x4 boundTransform = transform;
boundTransform._41 = 0.0f;
boundTransform._42 = 0.0f;
boundTransform._43 = 0.0f;
relBounds.MoveTo(boundTransform.TransformPoint(relBounds.TopLeft()));
}
Rect overflow(0, 0, relBounds.width, relBounds.height);
Matrix4x4 transform;// = GetTransform();
if (gfxPrefs::LayersDump()) {
printf_stderr("BorderLayer %p using bounds=%s, overflow=%s, transform=%s, rect=%s, clip=%s\n",

View File

@ -55,22 +55,31 @@ WebRenderCanvasLayer::RenderLayer()
MOZ_ASSERT(mExternalImageId);
gfx::Matrix4x4 transform;// = GetTransform();
gfx::Matrix4x4 transform = GetTransform();
const bool needsYFlip = (mOriginPos == gl::OriginPos::BottomLeft);
if (needsYFlip) {
transform.PreTranslate(0, mBounds.height, 0).PreScale(1, -1, 1);
}
gfx::Rect rect(0, 0, mBounds.width, mBounds.height);
rect = RelativeToTransformedVisible(GetTransform().TransformBounds(rect));
rect = RelativeToVisible(rect);
gfx::Rect clip;
if (GetClipRect().isSome()) {
clip = RelativeToTransformedVisible(IntRectToRect(GetClipRect().ref().ToUnknownRect()));
clip = RelativeToVisible(transform.Inverse().TransformBounds(IntRectToRect(GetClipRect().ref().ToUnknownRect())));
} else {
clip = rect;
}
gfx::Rect relBounds = TransformedVisibleBoundsRelativeToParent();
gfx::Rect relBounds = VisibleBoundsRelativeToParent();
if (!transform.IsIdentity()) {
// WR will only apply the 'translate' of the transform, so we need to do the scale/rotation manually.
gfx::Matrix4x4 boundTransform = transform;
boundTransform._41 = 0.0f;
boundTransform._42 = 0.0f;
boundTransform._43 = 0.0f;
relBounds.MoveTo(boundTransform.TransformPoint(relBounds.TopLeft()));
}
gfx::Rect overflow(0, 0, relBounds.width, relBounds.height);
Maybe<WrImageMask> mask = buildMaskLayer();
wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter);

View File

@ -20,18 +20,27 @@ WebRenderColorLayer::RenderLayer()
{
WrScrollFrameStackingContextGenerator scrollFrames(this);
gfx::Matrix4x4 transform = GetTransform();
LayerIntRegion visibleRegion = GetVisibleRegion();
LayerIntRect bounds = visibleRegion.GetBounds();
Rect rect = RelativeToVisible(IntRectToRect(bounds.ToUnknownRect()));
Rect rect(0, 0, bounds.width, bounds.height);
Rect clip;
if (GetClipRect().isSome()) {
clip = RelativeToTransformedVisible(IntRectToRect(GetClipRect().ref().ToUnknownRect()));
clip = RelativeToVisible(transform.Inverse().TransformBounds(IntRectToRect(GetClipRect().ref().ToUnknownRect())));
} else {
clip = rect;
}
gfx::Matrix4x4 transform;// = GetTransform();
gfx::Rect relBounds = TransformedVisibleBoundsRelativeToParent();
gfx::Rect relBounds = VisibleBoundsRelativeToParent();
if (!transform.IsIdentity()) {
// WR will only apply the 'translate' of the transform, so we need to do the scale/rotation manually.
gfx::Matrix4x4 boundTransform = transform;
boundTransform._41 = 0.0f;
boundTransform._42 = 0.0f;
boundTransform._43 = 0.0f;
relBounds.MoveTo(boundTransform.TransformPoint(relBounds.TopLeft()));
}
gfx::Rect overflow(0, 0, relBounds.width, relBounds.height);
WrMixBlendMode mixBlendMode = wr::ToWrMixBlendMode(GetMixBlendMode());

View File

@ -19,10 +19,18 @@ WebRenderContainerLayer::RenderLayer()
WrScrollFrameStackingContextGenerator scrollFrames(this);
nsTArray<LayerPolygon> children = SortChildrenBy3DZOrder(SortMode::WITHOUT_GEOMETRY);
gfx::Matrix4x4 transform = GetTransform();
gfx::Rect relBounds = VisibleBoundsRelativeToParent();
if (!transform.IsIdentity()) {
// WR will only apply the 'translate' of the transform, so we need to do the scale/rotation manually.
gfx::Matrix4x4 boundTransform = transform;
boundTransform._41 = 0.0f;
boundTransform._42 = 0.0f;
boundTransform._43 = 0.0f;
relBounds.MoveTo(boundTransform.TransformPoint(relBounds.TopLeft()));
}
gfx::Rect relBounds = TransformedVisibleBoundsRelativeToParent();
gfx::Rect overflow(0, 0, relBounds.width, relBounds.height);
gfx::Matrix4x4 transform;// = GetTransform();
WrMixBlendMode mixBlendMode = wr::ToWrMixBlendMode(GetMixBlendMode());
Maybe<WrImageMask> mask = buildMaskLayer();

View File

@ -127,18 +127,26 @@ WebRenderImageLayer::RenderLayer()
WrScrollFrameStackingContextGenerator scrollFrames(this);
Matrix4x4 transform = GetTransform();
Rect rect(0, 0, size.width, size.height);
Rect clip;
if (GetClipRect().isSome()) {
clip = RelativeToTransformedVisible(IntRectToRect(GetClipRect().ref().ToUnknownRect()));
clip = RelativeToVisible(transform.Inverse().TransformBounds(IntRectToRect(GetClipRect().ref().ToUnknownRect())));
} else {
clip = rect;
}
Rect relBounds = TransformedVisibleBoundsRelativeToParent();
Rect relBounds = VisibleBoundsRelativeToParent();
if (!transform.IsIdentity()) {
// WR will only apply the 'translate' of the transform, so we need to do the scale/rotation manually.
gfx::Matrix4x4 boundTransform = transform;
boundTransform._41 = 0.0f;
boundTransform._42 = 0.0f;
boundTransform._43 = 0.0f;
relBounds.MoveTo(boundTransform.TransformPoint(relBounds.TopLeft()));
}
Rect overflow(0, 0, relBounds.width, relBounds.height);
Matrix4x4 transform;// = GetTransform();
Maybe<WrImageMask> mask = buildMaskLayer();
wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter);
WrMixBlendMode mixBlendMode = wr::ToWrMixBlendMode(GetMixBlendMode());

View File

@ -86,6 +86,12 @@ WebRenderLayer::RelativeToParent(Rect aRect)
return aRect;
}
Rect
WebRenderLayer::VisibleBoundsRelativeToParent()
{
return RelativeToParent(IntRectToRect(GetLayer()->GetVisibleRegion().GetBounds().ToUnknownRect()));
}
Rect
WebRenderLayer::TransformedVisibleBoundsRelativeToParent()
{

View File

@ -44,6 +44,7 @@ public:
gfx::Rect RelativeToTransformedVisible(gfx::Rect aRect);
gfx::Rect ParentStackingContextBounds(size_t aScrollMetadataIndex);
gfx::Rect RelativeToParent(gfx::Rect aRect);
gfx::Rect VisibleBoundsRelativeToParent();
gfx::Rect TransformedVisibleBoundsRelativeToParent();
protected:
Maybe<WrImageMask> buildMaskLayer();

View File

@ -126,22 +126,31 @@ WebRenderPaintedLayer::RenderLayer()
}
WrScrollFrameStackingContextGenerator scrollFrames(this);
Matrix4x4 transform = GetTransform();
// Since we are creating a stacking context below using the visible region of
// this layer, we need to make sure the image display item has coordinates
// relative to the visible region.
Rect rect = RelativeToVisible(IntRectToRect(bounds.ToUnknownRect()));
Rect rect(0, 0, size.width, size.height);
Rect clip;
if (GetClipRect().isSome()) {
clip = RelativeToTransformedVisible(IntRectToRect(GetClipRect().ref().ToUnknownRect()));
clip = RelativeToVisible(transform.Inverse().TransformBounds(IntRectToRect(GetClipRect().ref().ToUnknownRect())));
} else {
clip = rect;
}
Maybe<WrImageMask> mask = buildMaskLayer();
Rect relBounds = TransformedVisibleBoundsRelativeToParent();
Rect relBounds = VisibleBoundsRelativeToParent();
if (!transform.IsIdentity()) {
// WR will only apply the 'translate' of the transform, so we need to do the scale/rotation manually.
gfx::Matrix4x4 boundTransform = transform;
boundTransform._41 = 0.0f;
boundTransform._42 = 0.0f;
boundTransform._43 = 0.0f;
relBounds.MoveTo(boundTransform.TransformPoint(relBounds.TopLeft()));
}
Rect overflow(0, 0, relBounds.width, relBounds.height);
Matrix4x4 transform;// = GetTransform();
WrMixBlendMode mixBlendMode = wr::ToWrMixBlendMode(GetMixBlendMode());
if (gfxPrefs::LayersDump()) {

View File

@ -151,9 +151,9 @@ HTTP == background-referrer.html background-referrer-ref.html
== attachment-scroll-positioning-1.html attachment-scroll-positioning-1-ref.html
== attachment-local-positioning-1.html attachment-local-positioning-1-ref.html
fails-if(webrender) == attachment-local-positioning-2.html attachment-local-positioning-2-ref.html
fails-if(webrender) == attachment-local-positioning-3.html attachment-local-positioning-3-ref.html
fails-if(webrender) == attachment-local-positioning-4.html attachment-local-positioning-4-ref.html
== attachment-local-positioning-2.html attachment-local-positioning-2-ref.html
== attachment-local-positioning-3.html attachment-local-positioning-3-ref.html
== attachment-local-positioning-4.html attachment-local-positioning-4-ref.html
== attachment-local-positioning-5.html attachment-local-positioning-5-ref.html
== attachment-local-clipping-color-1.html attachment-local-clipping-color-1-ref.html

View File

@ -1619,7 +1619,7 @@ fuzzy-if(Android,8,20) == 602200-3.html 602200-3-ref.html
== 605138-1.html 605138-1-ref.html
== 605157-1.xhtml 605157-1-ref.xhtml
== 607267-1.html 607267-1-ref.html
fails-if(webrender) == 608636-1.html 608636-1-ref.html
== 608636-1.html 608636-1-ref.html
== 608756-1a.html 608756-1-ref.html
== 608756-1b.html 608756-1-ref.html
== 608756-2.html 608756-2-ref.html
@ -1636,7 +1636,7 @@ needs-focus == 613433-3.html 613433-3-ref.html
== 614272-1.svg 614272-1-ref.svg
HTTP(..) == 615121-1.html 615121-1-ref.html
HTTP(..) != 615121-2.html 615121-2-notref.html
fails-if(webrender) == 617242-1.html 617242-1-ref.html
== 617242-1.html 617242-1-ref.html
!= 618071.html 618071-notref.html
== 619117-1.html 619117-1-ref.html
HTTP(..) == 619511-1.html 619511-1-ref.html
@ -1657,9 +1657,9 @@ skip-if(Android) random-if(winWidget||OSX==1010) skip-if(webrender) == 632781-ve
fuzzy-if(d2d&&/^Windows\x20NT\x206\.2/.test(http.oscpu),1,559) fuzzy-if(!isDebugBuild&&gtkWidget&&/^Linux\x20i686/.test(http.oscpu),102,140) == 633344-1.html 633344-1-ref.html # bug 1103623, Linux32 from GCC update
fuzzy-if(skiaContent,1,500) fails-if(webrender) == 634232-1.html 634232-1-ref.html
fuzzy-if(skiaContent,3,120000) fails-if(webrender) == 635302-1.html 635302-1-ref.html
fuzzy(1,68) fuzzy-if(gtkWidget,1,70) fails-if(Android) fuzzy-if(skiaContent&&!Android,1,300) == 635373-1.html 635373-1-ref.html
random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,20,118) fuzzy-if(skiaContent&&!Android,2,550) == 635373-2.html 635373-2-ref.html
random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,20,116) fuzzy-if(skiaContent&&!Android,2,650) == 635373-3.html 635373-3-ref.html
fuzzy(1,68) fuzzy-if(gtkWidget,1,70) fails-if(Android) fuzzy-if(skiaContent&&!Android,1,300) fails-if(webrender) == 635373-1.html 635373-1-ref.html
random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,20,118) fuzzy-if(skiaContent&&!Android,2,550) fails-if(webrender) == 635373-2.html 635373-2-ref.html
random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,20,116) fuzzy-if(skiaContent&&!Android,2,650) fails-if(webrender) == 635373-3.html 635373-3-ref.html
HTTP(..) == 635639-1.html 635639-1-ref.html
HTTP(..) == 635639-2.html 635639-2-ref.html
random == 637597-1.html 637597-1-ref.html # bug 637597 was never really fixed!

View File

@ -56,7 +56,7 @@ fuzzy(1,6800) == clipped-opacity-containing-unclipped-mixblendmode.html clipped-
pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-color-svg-as-data-uri.html background-blending-image-color-ref.html
# Test 10
pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-color-gif.html background-blending-image-color-gif-ref.html
pref(layout.css.background-blend-mode.enabled,true) == background-blending-image-color-transform3d.html background-blending-image-color-ref.html
pref(layout.css.background-blend-mode.enabled,true) fails-if(webrender) == background-blending-image-color-transform3d.html background-blending-image-color-ref.html
# Test plan 5.3.2 Background layers do not blend with content outside the background (or behind the element) - tests 2 and 3
pref(layout.css.background-blend-mode.enabled,true) == background-blending-isolation-parent-child-color.html background-blending-isolation-parent-child-ref.html

View File

@ -55,7 +55,7 @@ fails-if(webrender) == sorting-3a.html green-rect.html
# Different, but equivalent (for the given transform) transform origins
== rotatex-transformorigin-1a.html rotatex-transformorigin-1-ref.html
fuzzy-if((gtkWidget&&layersOMTC)||(winWidget&&!layersGPUAccelerated),1,86) == overflow-hidden-1a.html overflow-hidden-1-ref.html
== transform-style-flat-1a.html transform-style-flat-1-ref.html
fails-if(webrender) == transform-style-flat-1a.html transform-style-flat-1-ref.html
== willchange-containing-block.html?willchange willchange-containing-block.html?ref
!= willchange-containing-block.html?willchange willchange-containing-block.html?noblock
fuzzy-if(winWidget&&!layersGPUAccelerated,1,606) == scroll-perspective-1.html scroll-perspective-1-ref.html
@ -80,8 +80,8 @@ fuzzy(1,10000) == opacity-preserve3d-4.html opacity-preserve3d-4-ref.html
== opacity-preserve3d-5.html opacity-preserve3d-5-ref.html
fails-if(webrender) == snap-perspective-1.html snap-perspective-1-ref.html
fails-if(webrender) == mask-layer-1.html mask-layer-ref.html
fails-if(webrender) == mask-layer-2.html mask-layer-ref.html
fails-if(webrender) == mask-layer-3.html mask-layer-ref.html
skip-if(webrender) == mask-layer-2.html mask-layer-ref.html
skip-if(webrender) == mask-layer-3.html mask-layer-ref.html
fails-if(winWidget&&layersGPUAccelerated) fails-if(webrender) == split-intersect1.html split-intersect1-ref.html # Bug 1323791: implement DirectX compositor polygon support
fuzzy(255,150) fails-if(winWidget&&layersGPUAccelerated) fails-if(webrender) == split-intersect2.html split-intersect2-ref.html # Bug 1323791
fuzzy(255,100) fails-if(winWidget&&layersGPUAccelerated) fails-if(webrender) == split-non-ortho1.html split-non-ortho1-ref.html # Bug 1323791