forked from mirrors/gecko-dev
		
	Bug 538909. Correctly calculate index of top-left tile. r=dbaron
This commit is contained in:
		
							parent
							
								
									40c40a3d2c
								
							
						
					
					
						commit
						c20b3a582f
					
				
					 3 changed files with 46 additions and 5 deletions
				
			
		|  | @ -1782,6 +1782,14 @@ InterpolateColor(const gfxRGBA& aC1, const gfxRGBA& aC2, double aFrac) | |||
|                  aC2.a*aFrac + aC1.a*other); | ||||
| } | ||||
| 
 | ||||
| static nscoord | ||||
| FindTileStart(nscoord aDirtyCoord, nscoord aTilePos, nscoord aTileDim) | ||||
| { | ||||
|   NS_ASSERTION(aTileDim > 0, "Non-positive tile dimension"); | ||||
|   double multiples = NS_floor(double(aDirtyCoord - aTilePos)/aTileDim); | ||||
|   return NSToCoordRound(multiples*aTileDim + aTilePos); | ||||
| } | ||||
| 
 | ||||
| void | ||||
| nsCSSRendering::PaintGradient(nsPresContext* aPresContext, | ||||
|                               nsIRenderingContext& aRenderingContext, | ||||
|  | @ -2027,12 +2035,9 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext, | |||
|   gfxRect areaToFill = RectToGfxRect(aFillArea, appUnitsPerPixel); | ||||
|   gfxMatrix ctm = ctx->CurrentMatrix(); | ||||
| 
 | ||||
|   // Compute which tile is the top-left tile to be drawn.
 | ||||
|   PRInt32 firstTileX = (dirty.x - aOneCellArea.x)/aOneCellArea.width; | ||||
|   PRInt32 firstTileY = (dirty.y - aOneCellArea.y)/aOneCellArea.height; | ||||
|   // xStart/yStart are the top-left corner of the top-left tile.
 | ||||
|   nscoord xStart = firstTileX*aOneCellArea.width + aOneCellArea.x; | ||||
|   nscoord yStart = firstTileY*aOneCellArea.height + aOneCellArea.y; | ||||
|   nscoord xStart = FindTileStart(dirty.x, aOneCellArea.x, aOneCellArea.width); | ||||
|   nscoord yStart = FindTileStart(dirty.y, aOneCellArea.y, aOneCellArea.height); | ||||
|   nscoord xEnd = dirty.XMost(); | ||||
|   nscoord yEnd = dirty.YMost(); | ||||
|   // x and y are the top-left corner of the tile to draw
 | ||||
|  |  | |||
							
								
								
									
										19
									
								
								layout/reftests/bugs/538909-1-ref.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								layout/reftests/bugs/538909-1-ref.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | |||
| <!DOCTYPE HTML> | ||||
| <html> | ||||
| <head> | ||||
| <style> | ||||
| div { | ||||
|   width: 260px; | ||||
|   height: 260px; | ||||
|   -moz-background-size: 100px; | ||||
|   background-size: 100px; | ||||
|   background-position: -20px -20px; | ||||
|   background-image: -moz-linear-gradient(left top, yellow, blue); | ||||
|   background-image: linear-gradient(left top, yellow, blue); | ||||
| } | ||||
| </style> | ||||
| </head> | ||||
| <body> | ||||
| <div></div> | ||||
| </body> | ||||
| </html> | ||||
							
								
								
									
										17
									
								
								layout/reftests/bugs/538909-1.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								layout/reftests/bugs/538909-1.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| <!DOCTYPE HTML> | ||||
| <html> | ||||
| <head> | ||||
| <style> | ||||
| div { | ||||
|   border: 80px solid transparent; | ||||
|   width: 100px; | ||||
|   height: 100px; | ||||
|   background-image: -moz-linear-gradient(left top, yellow, blue); | ||||
|   background-image: linear-gradient(left top, yellow, blue); | ||||
| } | ||||
| </style> | ||||
| </head> | ||||
| <body> | ||||
| <div></div> | ||||
| </body> | ||||
| </html> | ||||
		Loading…
	
		Reference in a new issue
	
	 Robert O'Callahan
						Robert O'Callahan