Bug 1463396: Remove unused nsStyleUtil::AppendSerializedFontSrc. r?dholbert draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 22 May 2018 13:58:24 +0200
changeset 798083 b1f04486772b837a72558a2cfa812923b525f04a
parent 798082 5e0f36130c6d14339e57a59e928500ad745ec11d
push id110669
push userbmo:emilio@crisal.io
push dateTue, 22 May 2018 12:01:17 +0000
reviewersdholbert
bugs1463396
milestone62.0a1
Bug 1463396: Remove unused nsStyleUtil::AppendSerializedFontSrc. r?dholbert MozReview-Commit-ID: FG6SMUQAj89
layout/style/nsStyleUtil.cpp
layout/style/nsStyleUtil.h
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -600,71 +600,16 @@ nsStyleUtil::AppendUnicodeRange(const ns
     }
     buf.AppendLiteral(", ");
   }
   buf.Truncate(buf.Length() - 2); // remove the last comma-space
   CopyASCIItoUTF16(buf, aResult);
 }
 
 /* static */ void
-nsStyleUtil::AppendSerializedFontSrc(const nsCSSValue& aValue,
-                                     nsAString& aResult)
-{
-  // A src: descriptor is represented as an array value; each entry in
-  // the array can be eCSSUnit_URL, eCSSUnit_Local_Font, or
-  // eCSSUnit_Font_Format.  Blocks of eCSSUnit_Font_Format may appear
-  // only after one of the first two.  (css3-fonts only contemplates
-  // annotating URLs with formats, but we handle the general case.)
-
-  MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Array,
-             "improper value unit for src:");
-
-  const nsCSSValue::Array& sources = *aValue.GetArrayValue();
-  size_t i = 0;
-
-  while (i < sources.Count()) {
-    nsAutoString formats;
-
-    if (sources[i].GetUnit() == eCSSUnit_URL) {
-      aResult.AppendLiteral("url(");
-      nsDependentCSubstring url(sources[i].GetURLStructValue()->GetString());
-      nsStyleUtil::AppendEscapedCSSString(NS_ConvertUTF8toUTF16(url), aResult);
-      aResult.Append(')');
-    } else if (sources[i].GetUnit() == eCSSUnit_Local_Font) {
-      aResult.AppendLiteral("local(");
-      nsDependentString local(sources[i].GetStringBufferValue());
-      nsStyleUtil::AppendEscapedCSSString(local, aResult);
-      aResult.Append(')');
-    } else {
-      NS_NOTREACHED("entry in src: descriptor with improper unit");
-      i++;
-      continue;
-    }
-
-    i++;
-    formats.Truncate();
-    while (i < sources.Count() &&
-           sources[i].GetUnit() == eCSSUnit_Font_Format) {
-      formats.Append('"');
-      formats.Append(sources[i].GetStringBufferValue());
-      formats.AppendLiteral("\", ");
-      i++;
-    }
-    if (formats.Length() > 0) {
-      formats.Truncate(formats.Length() - 2); // remove the last comma
-      aResult.AppendLiteral(" format(");
-      aResult.Append(formats);
-      aResult.Append(')');
-    }
-    aResult.AppendLiteral(", ");
-  }
-  aResult.Truncate(aResult.Length() - 2); // remove the last comma-space
-}
-
-/* static */ void
 nsStyleUtil::AppendStepsTimingFunction(nsTimingFunction::Type aType,
                                        uint32_t aSteps,
                                        nsAString& aResult)
 {
   MOZ_ASSERT(aType == nsTimingFunction::Type::StepStart ||
              aType == nsTimingFunction::Type::StepEnd);
 
   aResult.AppendLiteral("steps(");
--- a/layout/style/nsStyleUtil.h
+++ b/layout/style/nsStyleUtil.h
@@ -111,19 +111,16 @@ public:
                                          nsAString& aResult);
   static void AppendCubicBezierTimingFunction(float aX1, float aY1,
                                               float aX2, float aY2,
                                               nsAString& aResult);
   static void AppendCubicBezierKeywordTimingFunction(
       nsTimingFunction::Type aType,
       nsAString& aResult);
 
-  static void AppendSerializedFontSrc(const nsCSSValue& aValue,
-                                      nsAString& aResult);
-
   // convert bitmask value to keyword name for a functional alternate
   static void GetFunctionalAlternatesName(int32_t aFeature,
                                           nsAString& aFeatureName);
 
   // Append functional font-variant-alternates values to string
   static void
   SerializeFunctionalAlternates(const nsTArray<gfxAlternateValue>& aAlternates,
                                 nsAString& aResult);