mozglue/misc/decimal/zero-serialization.patch
author Ting-Yu Lin <tlin@mozilla.com>
Thu, 29 Oct 2020 22:43:53 +0000
changeset 555163 9a7e5873fac52c3fea4e8d9843e0aaf8e9158eb7
parent 476169 efa9757078d03a4cd36e5ead44703e6184d64add
permissions -rw-r--r--
Bug 1672462 - Compute flex item's content size suggestion in inline axis via nsIFrame::ComputeSize. r=emilio Flex item's content size suggestion is the min-content size in the main axis. Quoting from the CSS Sizing spec, section "5.1. Intrinsic Sizes", The min-content size of a box in each axis is the size it would have if it was a float given an auto size in that axis (and no minimum or maximum size in that axis) and if its containing block was zero-sized in that axis. (In other words, the minimum size it has when sized as “shrink-to-fit”.) However, all the frame types' GetMinISize() doesn't consider aspect ratio (either the intrinsic aspect ratio on images or svg, or the preferred aspect ratio set by the aspect-ratio property). That is, we currently don't allow `aspect ratio * definite block-size` as part of the equation in `inline-size:min-content` (bug 1646100 or bug 1670151). Luckily, nsIFrame::ComputeSize() already takes care of this [2]. We just need to add a flag to let ComputeSize() behave as if the flex item had an auto inline size. The code should be similar to FloatMarginISize() in BlockReflowInput.cpp except we are calculate the flex item's content-box size. [1] https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes [2] https://searchfox.org/mozilla-central/rev/dbced93f1c57942501c23d4633d01ce59d9087a1/layout/generic/nsContainerFrame.cpp#2732,2735-2736 Differential Revision: https://phabricator.services.mozilla.com/D94802

diff --git a/mozglue/misc/decimal/Decimal.cpp b/mozglue/misc/decimal/Decimal.cpp
--- a/mozglue/misc/decimal/Decimal.cpp
+++ b/mozglue/misc/decimal/Decimal.cpp
@@ -277,17 +277,17 @@ bool Decimal::EncodedData::operator==(co
 }
 
 Decimal::Decimal(int32_t i32)
     : m_data(i32 < 0 ? Negative : Positive, 0, i32 < 0 ? static_cast<uint64_t>(-static_cast<int64_t>(i32)) : static_cast<uint64_t>(i32))
 {
 }
 
 Decimal::Decimal(Sign sign, int exponent, uint64_t coefficient)
-    : m_data(sign, exponent, coefficient)
+    : m_data(sign, coefficient ? exponent : 0, coefficient)
 {
 }
 
 Decimal::Decimal(const EncodedData& data)
     : m_data(data)
 {
 }