stylo: Use saturating ops for clip computation

MozReview-Commit-ID: DYQRM4CJbAg
This commit is contained in:
Manish Goregaokar 2017-07-25 13:38:42 -07:00 committed by Manish Goregaokar
parent 3c77caec37
commit 7cdcfa0f8e

View file

@ -3723,14 +3723,14 @@ fn static_assert() {
} }
if let Some(bottom) = rect.bottom { if let Some(bottom) = rect.bottom {
self.gecko.mClip.height = bottom.0 - self.gecko.mClip.y; self.gecko.mClip.height = (bottom - Au(self.gecko.mClip.y)).0;
} else { } else {
self.gecko.mClip.height = 1 << 30; // NS_MAXSIZE self.gecko.mClip.height = 1 << 30; // NS_MAXSIZE
self.gecko.mClipFlags |= NS_STYLE_CLIP_BOTTOM_AUTO as u8; self.gecko.mClipFlags |= NS_STYLE_CLIP_BOTTOM_AUTO as u8;
} }
if let Some(right) = rect.right { if let Some(right) = rect.right {
self.gecko.mClip.width = right.0 - self.gecko.mClip.x; self.gecko.mClip.width = (right - Au(self.gecko.mClip.x)).0;
} else { } else {
self.gecko.mClip.width = 1 << 30; // NS_MAXSIZE self.gecko.mClip.width = 1 << 30; // NS_MAXSIZE
self.gecko.mClipFlags |= NS_STYLE_CLIP_RIGHT_AUTO as u8; self.gecko.mClipFlags |= NS_STYLE_CLIP_RIGHT_AUTO as u8;