Bug 1533040 - Remove invalid NS_WARNING_ASSERTION. r=dholbert
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 06 Mar 2019 17:13:14 +0000
changeset 520536 d3a4d053ea82a628f822d15bc20162236a25f69d
parent 520535 b0eb4c7230e4ea766b6997c95c1a84592cfc4d3a
child 520537 783538d74b6ab0dbffd89ac71eda0d8952394037
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1533040
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1533040 - Remove invalid NS_WARNING_ASSERTION. r=dholbert We can totally get there with a negative percentage basis, see comment 0 for an example. We could keep the warning like: NS_WARNING_ASSERTION(clamping_mode == StyleAllowedNumericType::All || basis >= 0, "nscoord overflow?"); Which will catch cases where the style system would refuse to parse a negative <length-percentage>, but we got a negative percent basis, which would be weird. But that's a bit misleading since right now at least we rely on the caller to do the appropriate clamping. I also think that NS_WARNING_ASSERTION is not very useful, since we're not very likely to catch stuff with it. But anyhow, your call. Differential Revision: https://phabricator.services.mozilla.com/D22328
layout/style/nsStyleCoord.h
--- a/layout/style/nsStyleCoord.h
+++ b/layout/style/nsStyleCoord.h
@@ -136,22 +136,20 @@ nscoord LengthPercentage::Resolve(T aPer
                 "Should return app units");
   static_assert(
       std::is_same<decltype(aPercentageRounder(1.0f)), nscoord>::value,
       "Should return app units");
   if (ConvertsToLength()) {
     return ToLength();
   }
   nscoord basis = aPercentageGetter();
-  NS_WARNING_ASSERTION(basis >= 0, "nscoord overflow?");
   return length.ToAppUnits() + aPercentageRounder(basis * Percentage());
 }
 
 nscoord LengthPercentage::Resolve(nscoord aPercentageBasis) const {
-  NS_WARNING_ASSERTION(aPercentageBasis >= 0, "nscoord overflow?");
   return Resolve([=] { return aPercentageBasis; }, NSToCoordFloorClamped);
 }
 
 template <typename T>
 nscoord LengthPercentage::Resolve(T aPercentageGetter) const {
   static_assert(std::is_same<decltype(aPercentageGetter()), nscoord>::value,
                 "Should return app units");
   return Resolve(aPercentageGetter, NSToCoordFloorClamped);