Bug 1386848 - stylo: Get proper length value from calc nsCSSValue. r=xidorn, a=lizzard
authorNazım Can Altınova <canaltinova@gmail.com>
Fri, 04 Aug 2017 17:36:18 -0700
changeset 423468 8fde0d035af05fe7603cd28ff6d9af6da3bcf951
parent 423467 de3698e225ce40eb85dfd2b4b75027932b1dcc61
child 423469 dfdabd1604744ac836b74b495414e9bab6f1f736
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn, lizzard
bugs1386848, 1384656
milestone56.0
Bug 1386848 - stylo: Get proper length value from calc nsCSSValue. r=xidorn, a=lizzard We were getting the proper app units value for transform matrix offset before Bug 1384656. But after that bug we started using GetCalcValue() method and it wasn't converting length to app units and this was cousing to miscalculate translate functions in transform property. MozReview-Commit-ID: HHlrSg00252
layout/style/nsCSSValue.cpp
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -868,34 +868,34 @@ nsCSSValue::GetCalcValue() const
   MOZ_ASSERT(array->Count() == 1,
              "There should be a 1-length array");
 
   const nsCSSValue& rootValue = array->Item(0);
 
   nsStyleCoord::CalcValue result;
 
   if (rootValue.GetUnit() == eCSSUnit_Pixel) {
-    result.mLength = rootValue.GetFloatValue();
+    result.mLength = rootValue.GetPixelLength();
     result.mPercent = 0.0f;
     result.mHasPercent = false;
   } else {
     MOZ_ASSERT(rootValue.GetUnit() == eCSSUnit_Calc_Plus,
                "Calc unit should be eCSSUnit_Calc_Plus");
 
     const nsCSSValue::Array *calcPlusArray = rootValue.GetArrayValue();
     MOZ_ASSERT(calcPlusArray->Count() == 2,
                "eCSSUnit_Calc_Plus should have a 2-length array");
 
     const nsCSSValue& length = calcPlusArray->Item(0);
     const nsCSSValue& percent = calcPlusArray->Item(1);
     MOZ_ASSERT(length.GetUnit() == eCSSUnit_Pixel,
                "The first value should be eCSSUnit_Pixel");
     MOZ_ASSERT(percent.GetUnit() == eCSSUnit_Percent,
                "The first value should be eCSSUnit_Percent");
-    result.mLength = length.GetFloatValue();
+    result.mLength = length.GetPixelLength();
     result.mPercent = percent.GetPercentValue();
     result.mHasPercent = true;
   }
 
   return result;
 }
 
 void nsCSSValue::StartImageLoad(nsIDocument* aDocument) const