From e517d21de85697532dbb0b6da7484f723ff73559 Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Thu, 8 Jun 2017 18:21:40 +0800 Subject: [PATCH] Set zero to mImageRegion.{height,width} if {bottom,right} is auto. Let's follow how Gecko does for this part (in nsRuleNode::ComputeListData). We set mImageRegion.height or mImageRegion.width to zero if bottom or right is None (i.e. auto). --- components/style/properties/gecko.mako.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 18f2e3fa27e..7585b0e9c3d 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -3327,8 +3327,14 @@ fn static_assert() { Either::First(rect) => { self.gecko.mImageRegion.x = rect.left.unwrap_or(Au(0)).0; self.gecko.mImageRegion.y = rect.top.unwrap_or(Au(0)).0; - self.gecko.mImageRegion.height = rect.bottom.unwrap_or(Au(0)).0 - self.gecko.mImageRegion.y; - self.gecko.mImageRegion.width = rect.right.unwrap_or(Au(0)).0 - self.gecko.mImageRegion.x; + self.gecko.mImageRegion.height = match rect.bottom { + Some(value) => value.0 - self.gecko.mImageRegion.y, + None => 0, + }; + self.gecko.mImageRegion.width = match rect.right { + Some(value) => value.0 - self.gecko.mImageRegion.x, + None => 0, + }; } } }