Bug 1360414 - Position webrender gradient bounds using FindFirstTile r=jrmuizel
authorRyan Hunt <rhunt@eqrion.net>
Sun, 23 Apr 2017 17:55:55 -0400
changeset 357013 9bfbae06d8e2054eb563b5e7b346e29a851a9d8e
parent 357012 cc544f128a15cedd43d12c838be2775bf27b7d7e
child 357014 de635d62079bfc358c85a692d729bf1e33da15ca
push id31780
push userkwierso@gmail.com
push dateMon, 08 May 2017 20:34:47 +0000
treeherdermozilla-central@bab7046ee2d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1360414
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1360414 - Position webrender gradient bounds using FindFirstTile r=jrmuizel The origin of a tiled gradient needs to be positioned less than the origin of its clip bounds, otherwise it won't fill all of its clip bounds. There is an existing function used by the current code path that can be used to do this. MozReview-Commit-ID: 13EtwmZYT4P
layout/painting/nsCSSRenderingGradients.cpp
--- a/layout/painting/nsCSSRenderingGradients.cpp
+++ b/layout/painting/nsCSSRenderingGradients.cpp
@@ -1042,19 +1042,22 @@ nsCSSGradientRenderer::BuildWebRenderDis
   nsTArray<WrGradientStop> stops;
   LayoutDevicePoint lineStart;
   LayoutDevicePoint lineEnd;
   LayoutDeviceSize gradientRadius;
   BuildWebRenderParameters(aOpacity, extendMode, stops, lineStart, lineEnd, gradientRadius);
 
   nscoord appUnitsPerDevPixel = mPresContext->AppUnitsPerDevPixel();
 
+  nsPoint firstTile = nsPoint(FindTileStart(aFillArea.x, aDest.x, aRepeatSize.width),
+                              FindTileStart(aFillArea.y, aDest.y, aRepeatSize.height));
+
   // Translate the parameters into device coordinates
   LayoutDeviceRect clipBounds = LayoutDevicePixel::FromAppUnits(aFillArea, appUnitsPerDevPixel);
-  LayoutDeviceRect firstTileBounds = LayoutDevicePixel::FromAppUnits(aDest, appUnitsPerDevPixel);
+  LayoutDeviceRect firstTileBounds = LayoutDevicePixel::FromAppUnits(nsRect(firstTile, aDest.Size()), appUnitsPerDevPixel);
   LayoutDeviceSize tileRepeat = LayoutDevicePixel::FromAppUnits(aRepeatSize, appUnitsPerDevPixel);
 
   // Calculate the bounds of the gradient display item, which starts at the first
   // 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));