Fix crash with certain right-aligned text (#10271)
# Objective Fixes #9395 Alternative to #9415 (See discussion here) ## Solution Do clamping like [`fit-content`](https://www.w3.org/TR/css-sizing-3/#column-sizing). ## Notes I am not sure if this is a valid approach. It doesn't seem to cause any obvious issues with our existing examples.
This commit is contained in:
		
							parent
							
								
									e5b3cc45ba
								
							
						
					
					
						commit
						befbf52a18
					
				| @ -53,7 +53,13 @@ impl Measure for TextMeasure { | |||||||
|         _available_height: AvailableSpace, |         _available_height: AvailableSpace, | ||||||
|     ) -> Vec2 { |     ) -> Vec2 { | ||||||
|         let x = width.unwrap_or_else(|| match available_width { |         let x = width.unwrap_or_else(|| match available_width { | ||||||
|             AvailableSpace::Definite(x) => x.clamp(self.info.min.x, self.info.max.x), |             AvailableSpace::Definite(x) => { | ||||||
|  |                 // It is possible for the "min content width" to be larger than
 | ||||||
|  |                 // the "max content width" when soft-wrapping right-aligned text
 | ||||||
|  |                 // and possibly other situations.
 | ||||||
|  | 
 | ||||||
|  |                 x.max(self.info.min.x).min(self.info.max.x) | ||||||
|  |             } | ||||||
|             AvailableSpace::MinContent => self.info.min.x, |             AvailableSpace::MinContent => self.info.min.x, | ||||||
|             AvailableSpace::MaxContent => self.info.max.x, |             AvailableSpace::MaxContent => self.info.max.x, | ||||||
|         }); |         }); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Rob Parrett
						Rob Parrett