# HG changeset patch # User Nicolas Silva # Date 1521111275 -3600 # Node ID fc150f21f7fac1be6f31ca8d950570751ddad6aa # Parent cb6d7115e2f957d667d7a06a80b4e494f8112330 Bug 1437032 - Rely on WebRender to pixel snap gradients instead of doing it when building the display list. r=mstange To correctly apply pixel snapping during display list construction we would need to snap each tile of a repeated gradient individually. It's preferrable to do this in WebRender rather than decompose gradients into many display items. diff --git a/layout/painting/nsCSSRenderingGradients.cpp b/layout/painting/nsCSSRenderingGradients.cpp --- a/layout/painting/nsCSSRenderingGradients.cpp +++ b/layout/painting/nsCSSRenderingGradients.cpp @@ -1056,50 +1056,46 @@ nsCSSGradientRenderer::BuildWebRenderDis // tile and extends to the end of clip bounds LayoutDevicePoint tileToClip = clipBounds.BottomRight() - firstTileBounds.TopLeft(); LayoutDeviceRect gradientBounds = LayoutDeviceRect(firstTileBounds.TopLeft(), LayoutDeviceSize(tileToClip.x, tileToClip.y)); // Calculate the tile spacing, which is the repeat size minus the tile size LayoutDeviceSize tileSpacing = tileRepeat - firstTileBounds.Size(); - // Make the rects relative to the parent stacking context - wr::LayoutRect wrClipBounds = aSc.ToRelativeLayoutRect(clipBounds); - wr::LayoutRect wrGradientBounds = aSc.ToRelativeLayoutRect(gradientBounds); - // srcTransform is used for scaling the gradient to match aSrc LayoutDeviceRect srcTransform = LayoutDeviceRect(mPresContext->CSSPixelsToAppUnits(aSrc.x), mPresContext->CSSPixelsToAppUnits(aSrc.y), aDest.width / ((float)mPresContext->CSSPixelsToAppUnits(aSrc.width)), aDest.height / ((float)mPresContext->CSSPixelsToAppUnits(aSrc.height))); lineStart.x = (lineStart.x - srcTransform.x) * srcTransform.width; lineStart.y = (lineStart.y - srcTransform.y) * srcTransform.height; if (mGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) { lineEnd.x = (lineEnd.x - srcTransform.x) * srcTransform.width; lineEnd.y = (lineEnd.y - srcTransform.y) * srcTransform.height; aBuilder.PushLinearGradient( - wrGradientBounds, - wrClipBounds, + mozilla::wr::ToLayoutRect(gradientBounds), + mozilla::wr::ToLayoutRect(clipBounds), aIsBackfaceVisible, mozilla::wr::ToLayoutPoint(lineStart), mozilla::wr::ToLayoutPoint(lineEnd), stops, extendMode, mozilla::wr::ToLayoutSize(firstTileBounds.Size()), mozilla::wr::ToLayoutSize(tileSpacing)); } else { gradientRadius.width *= srcTransform.width; gradientRadius.height *= srcTransform.height; aBuilder.PushRadialGradient( - wrGradientBounds, - wrClipBounds, + mozilla::wr::ToLayoutRect(gradientBounds), + mozilla::wr::ToLayoutRect(clipBounds), aIsBackfaceVisible, mozilla::wr::ToLayoutPoint(lineStart), mozilla::wr::ToLayoutSize(gradientRadius), stops, extendMode, mozilla::wr::ToLayoutSize(firstTileBounds.Size()), mozilla::wr::ToLayoutSize(tileSpacing)); } diff --git a/layout/reftests/border-image/reftest.list b/layout/reftests/border-image/reftest.list --- a/layout/reftests/border-image/reftest.list +++ b/layout/reftests/border-image/reftest.list @@ -43,17 +43,17 @@ fuzzy-if(asyncPan&&!layersGPUAccelerated # border images with gradients fuzzy-if(webrender,1-1,1804-1804) == border-image-linear-gradient.html border-image-linear-gradient-ref.html fuzzy(1,98) fuzzy-if(skiaContent,1,350) fuzzy-if(webrender,1-1,37537-37537) == border-image-linear-gradient-slice-1.html border-image-linear-gradient-slice-1-ref.html fuzzy(1,149) fuzzy-if(OSX,1,10595) fuzzy-if(webrender,1,25007) == border-image-linear-gradient-slice-2.html border-image-linear-gradient-slice-2-ref.html fuzzy(1,433) fuzzy-if(skiaContent,1,2500) fuzzy-if(webrender,1,85584) == border-image-linear-gradient-slice-fill-1.html border-image-linear-gradient-slice-fill-1-ref.html fuzzy(1,177) fuzzy-if(OSX,1,25771) fuzzy-if(skiaContent&&!Android,1,400) fuzzy-if(Android,1,6093) fuzzy-if(webrender,1,57412) == border-image-linear-gradient-slice-fill-2.html border-image-linear-gradient-slice-fill-2-ref.html fuzzy(1,48) fuzzy-if(OSX,5,1676) fuzzy-if(webrender,1,4479) == border-image-linear-gradient-width.html border-image-linear-gradient-width-ref.html -fuzzy(1,5000) fuzzy-if(OSX,1,15000) fuzzy-if(webrender,1,60355) == border-image-linear-gradient-slice-width.html border-image-linear-gradient-slice-width-ref.html +fuzzy(1,5000) fuzzy-if(OSX,1,15000) fuzzy-if(webrender,2,58670) == border-image-linear-gradient-slice-width.html border-image-linear-gradient-slice-width-ref.html fuzzy(1,3000) fuzzy-if(OSX,1,6000) fuzzy-if(webrender,1,26302) == border-image-linear-gradient-outset.html border-image-linear-gradient-outset-ref.html fuzzy(1,12) fuzzy-if(skiaContent,1,400) fuzzy-if(webrender,1-1,26872-26872) == border-image-linear-gradient-repeat-repeat-1.html border-image-linear-gradient-repeat-repeat-1-ref.html fuzzy(1,13) fuzzy-if(skiaContent,1,300) fuzzy-if(webrender,1-1,27131-27131) == border-image-linear-gradient-repeat-round-1.html border-image-linear-gradient-repeat-round-1-ref.html fuzzy-if(webrender,1-1,65098-65098) == border-image-linear-gradient-repeat-repeat-2.html border-image-linear-gradient-repeat-repeat-2-ref.html fuzzy(1,576) fuzzy-if(skiaContent,1,2000) fuzzy-if(webrender,1-1,64806-64806) == border-image-linear-gradient-repeat-round-2.html border-image-linear-gradient-repeat-round-2-ref.html fuzzy(1,8533) fuzzy-if(webrender,1,85925) == border-image-linear-gradient-repeat-repeat-3.html border-image-linear-gradient-repeat-repeat-3-ref.html fuzzy(1,7161) fuzzy-if(webrender,2,107112) == border-image-linear-gradient-repeat-round-3.html border-image-linear-gradient-repeat-round-3-ref.html diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1982,17 +1982,17 @@ fuzzy-if(webrender,0-2,0-2601) == 124217 random-if(!winWidget) == 1273154-1.html 1273154-1-ref.html # depends on Windows font random-if(!winWidget) == 1273154-2.html 1273154-2-ref.html # depends on Windows font == 1274368-1.html 1274368-1-ref.html != 1276161-1a.html 1276161-1-notref.html != 1276161-1b.html 1276161-1-notref.html != 1276161-1a.html 1276161-1b.html == 1275411-1.html 1275411-1-ref.html == 1288255.html 1288255-ref.html -fuzzy(8,1900) fails-if(webrender) == 1291528.html 1291528-ref.html +fuzzy(8,1900) == 1291528.html 1291528-ref.html # Buttons in 2 pages have different position and the rendering result can be # different, but they should use the same button style and the background color # should be same. |fuzzy()| here allows the difference in border, but not # background color. fuzzy(255,1000) skip-if(!cocoaWidget) == 1294102-1.html 1294102-1-ref.html random-if(Android) fuzzy-if(skiaContent,15,50) == 1295466-1.xhtml 1295466-1-ref.xhtml #bug 982547 fuzzy-if(Android,27,874) fuzzy-if(!Android,14,43) == 1313772.xhtml 1313772-ref.xhtml # Bug 1128229, Bug 1389319 fuzzy(2,320000) == 1315113-1.html 1315113-1-ref.html