Bug 1292447: part 10 - Get a11y StyleInfo::TextIndent value resolved correctly. r=surkov,TYLin
authorAstley Chen <aschen@mozilla.com>
Mon, 03 Oct 2016 18:14:21 +0800
changeset 316194 7b9b82c81d197dc4ab241612768cf54c074090d1
parent 316193 42225a3fea65a507e03ad94fcd32edaf7ef1fb57
child 316195 d2a5900092879882ee19867f2f3325e3a4fc4e11
push id30765
push userphilringnalda@gmail.com
push dateTue, 04 Oct 2016 03:06:46 +0000
treeherdermozilla-central@adb484f84dec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov, TYLin
bugs1292447
milestone52.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 1292447: part 10 - Get a11y StyleInfo::TextIndent value resolved correctly. r=surkov,TYLin MozReview-Commit-ID: Gz0ae9x1WtB
accessible/base/StyleInfo.cpp
--- a/accessible/base/StyleInfo.cpp
+++ b/accessible/base/StyleInfo.cpp
@@ -48,47 +48,41 @@ StyleInfo::TextIndent(nsAString& aValue)
 
   const nsStyleCoord& styleCoord =
     mStyleContext->StyleText()->mTextIndent;
 
   nscoord coordVal = 0;
   switch (styleCoord.GetUnit()) {
     case eStyleUnit_Coord:
       coordVal = styleCoord.GetCoordValue();
+      aValue.AppendFloat(nsPresContext::AppUnitsToFloatCSSPixels(coordVal));
+      aValue.AppendLiteral("px");
       break;
 
     case eStyleUnit_Percent:
-    {
-      nsIFrame* frame = mElement->GetPrimaryFrame();
-      MOZ_ASSERT(frame, "frame must be a valid pointer.");
-      nsIFrame* containerFrame = frame->GetContainingBlock();
-      nscoord percentageBase = containerFrame->GetContentRect().width;
-      coordVal = NSCoordSaturatingMultiply(percentageBase,
-                                           styleCoord.GetPercentValue());
+      aValue.AppendFloat(styleCoord.GetPercentValue() * 100);
+      aValue.AppendLiteral("%");
       break;
-    }
 
     case eStyleUnit_Null:
     case eStyleUnit_Normal:
     case eStyleUnit_Auto:
     case eStyleUnit_None:
     case eStyleUnit_Factor:
     case eStyleUnit_Degree:
     case eStyleUnit_Grad:
     case eStyleUnit_Radian:
     case eStyleUnit_Turn:
     case eStyleUnit_FlexFraction:
     case eStyleUnit_Integer:
     case eStyleUnit_Enumerated:
     case eStyleUnit_Calc:
+      aValue.AppendLiteral("0px");
       break;
   }
-
-  aValue.AppendFloat(nsPresContext::AppUnitsToFloatCSSPixels(coordVal));
-  aValue.AppendLiteral("px");
 }
 
 void
 StyleInfo::Margin(css::Side aSide, nsAString& aValue)
 {
   MOZ_ASSERT(mElement->GetPrimaryFrame(), " mElement->GetPrimaryFrame() needs to be valid pointer");
   aValue.Truncate();