Backed out 2 changesets (bug 1359240) for gfxSVGGlyphs.cpp bustages CLOSED TREE
authorBogdan Tara <btara@mozilla.com>
Mon, 20 May 2019 15:21:39 +0300
changeset 474512 103e78a861c4962b699b6bd483bd53cd23172d0d
parent 474511 02eea6ec83db036098d8c629f400d2c5992193b3
child 474513 386971c411a752a8f943161875037c9b53d275fd
push id36041
push userccoroiu@mozilla.com
push dateMon, 20 May 2019 21:55:28 +0000
treeherdermozilla-central@29bdbbe89264 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1359240
milestone68.0a1
backs out02eea6ec83db036098d8c629f400d2c5992193b3
a31ec848a1efb140079cdfd2304b2f793f7e3e36
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
Backed out 2 changesets (bug 1359240) for gfxSVGGlyphs.cpp bustages CLOSED TREE Backed out changeset 02eea6ec83db (bug 1359240) Backed out changeset a31ec848a1ef (bug 1359240)
gfx/thebes/gfxSVGGlyphs.cpp
layout/reftests/text-svgglyphs/reftest.list
layout/reftests/text-svgglyphs/resources/svg-gz.ttf
layout/reftests/text-svgglyphs/svg-glyph-compressed-ref.html
layout/reftests/text-svgglyphs/svg-glyph-compressed.html
--- a/gfx/thebes/gfxSVGGlyphs.cpp
+++ b/gfx/thebes/gfxSVGGlyphs.cpp
@@ -27,17 +27,16 @@
 #include "nsStringStream.h"
 #include "nsStreamUtils.h"
 #include "nsIPrincipal.h"
 #include "nsSVGUtils.h"
 #include "nsContentUtils.h"
 #include "gfxFont.h"
 #include "gfxContext.h"
 #include "harfbuzz/hb.h"
-#include "zlib.h"
 
 #define SVG_CONTENT_TYPE NS_LITERAL_CSTRING("image/svg+xml")
 #define UTF8_CHARSET NS_LITERAL_CSTRING("utf-8")
 
 using namespace mozilla;
 using mozilla::dom::Document;
 using mozilla::dom::Element;
 
@@ -253,54 +252,17 @@ size_t gfxSVGGlyphs::SizeOfIncludingThis
 Element* gfxSVGGlyphsDocument::GetGlyphElement(uint32_t aGlyphId) {
   return mGlyphIdMap.Get(aGlyphId);
 }
 
 gfxSVGGlyphsDocument::gfxSVGGlyphsDocument(const uint8_t* aBuffer,
                                            uint32_t aBufLen,
                                            gfxSVGGlyphs* aSVGGlyphs)
     : mOwner(aSVGGlyphs) {
-  if (aBufLen >= 14 && aBuffer[0] == 31 && aBuffer[1] == 139) {
-    // It's a gzip-compressed document; decompress it before parsing.
-    // The original length (modulo 2^32) is found in the last 4 bytes
-    // of the data, stored in little-endian format. We read it as
-    // individual bytes to avoid possible alignment issues.
-    // (Note that if the original length was >2^32, then origLen here
-    // will be incorrect; but then the inflate() call will not return
-    // Z_STREAM_END and we'll bail out safely.)
-    size_t origLen = (size_t(aBuffer[aBufLen - 1]) << 24) +
-                     (size_t(aBuffer[aBufLen - 2]) << 16) +
-                     (size_t(aBuffer[aBufLen - 3]) << 8) +
-                     size_t(aBuffer[aBufLen - 4]);
-    AutoTArray<uint8_t, 4096> outBuf;
-    if (outBuf.SetLength(origLen, mozilla::fallible)) {
-      z_stream s = {0};
-      s.next_in = const_cast<Byte*>(aBuffer);
-      s.avail_in = aBufLen;
-      s.next_out = outBuf.Elements();
-      s.avail_out = outBuf.Length();
-      // The magic number 16 here is the zlib flag to expect gzip format,
-      // see http://www.zlib.net/manual.html#Advanced
-      if (Z_OK == inflateInit2(&s, 16 + MAX_WBITS)) {
-        int result = inflate(&s, Z_FINISH);
-        if (Z_STREAM_END == result) {
-          MOZ_ASSERT(s.next_out - outBuf.Elements() == origLen);
-          ParseDocument(outBuf.Elements(), outBuf.Length());
-        } else {
-          NS_WARNING("Failed to decompress SVG glyphs document");
-        }
-        inflateEnd(&s);
-      }
-    } else {
-      NS_WARNING("Failed to allocate memory for SVG glyphs document");
-    }
-  } else {
-    ParseDocument(aBuffer, aBufLen);
-  }
-
+  ParseDocument(aBuffer, aBufLen);
   if (!mDocument) {
     NS_WARNING("Could not parse SVG glyphs document");
     return;
   }
 
   Element* root = mDocument->GetRootElement();
   if (!root) {
     NS_WARNING("Could not parse SVG glyphs document");
--- a/layout/reftests/text-svgglyphs/reftest.list
+++ b/layout/reftests/text-svgglyphs/reftest.list
@@ -16,9 +16,8 @@ pref(gfx.font_rendering.opentype_svg.ena
 pref(gfx.font_rendering.opentype_svg.enabled,true)    fuzzy-if(gtkWidget,0-1,0-2268) fuzzy-if(winWidget,0-1,0-3074) fuzzy-if(Android,0-5,0-4715) fuzzy-if(skiaContent,0-8,0-13000) == svg-glyph-objectopacity2.svg svg-glyph-objectopacity2-ref.svg
 pref(gfx.font_rendering.opentype_svg.enabled,true)    fuzzy-if(skiaContent,0-2,0-200) == svg-glyph-paintnone.svg svg-glyph-paintnone-ref.svg
 pref(gfx.font_rendering.opentype_svg.enabled,true)    fuzzy-if(skiaContent,0-2,0-200) == svg-glyph-cachedopacity.svg svg-glyph-cachedopacity-ref.svg
 pref(gfx.font_rendering.opentype_svg.enabled,true)    fuzzy-if(cocoaWidget,0-255,0-100) == svg-glyph-objectvalue.svg svg-glyph-objectvalue-ref.svg
 pref(gfx.font_rendering.opentype_svg.enabled,true)    fuzzy-if(skiaContent,0-15,0-152) == svg-glyph-mask.svg svg-glyph-mask-ref.svg
 pref(gfx.font_rendering.opentype_svg.enabled,true)    == svg-glyph-paint-server.svg svg-glyph-paint-server-ref.svg
 pref(gfx.font_rendering.opentype_svg.enabled,true)    == svg-glyph-transform.svg svg-glyph-transform-ref.svg
 pref(gfx.font_rendering.opentype_svg.enabled,true)    == svg-glyph-extents.html svg-glyph-extents-ref.html
-pref(gfx.font_rendering.opentype_svg.enabled,true)    == svg-glyph-compressed.html svg-glyph-compressed-ref.html
deleted file mode 100644
index 3a9660224ad20b70633e64a4adfc6425a3da7b95..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/layout/reftests/text-svgglyphs/svg-glyph-compressed-ref.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<title>Test for compressed SVG glyphs</title>
-<style>
-  @font-face {
-    font-family: test;
-    src: url(resources/svg.woff); /* uses uncompressed SVG documents */
-  }
-  html { width: 400px; height: 400px; background-color: white; }
-  body { margin: 0; }
-  div { font: 200px test; color: fuchsia; line-height: 1; stroke: none; }
-</style>
-<div>abcdefg</div>
-<div>LMNOPQR</div>
deleted file mode 100644
--- a/layout/reftests/text-svgglyphs/svg-glyph-compressed.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<title>Test for compressed SVG glyphs</title>
-<style>
-  @font-face {
-    font-family: test;
-    src: url(resources/svg-gz.ttf); /* copy of svg.woff using gzip-compressed SVG documents */
-  }
-  html { width: 400px; height: 400px; background-color: white; }
-  body { margin: 0; }
-  div { font: 200px test; color: fuchsia; line-height: 1; stroke: none; }
-</style>
-<div>abcdefg</div>
-<div>LMNOPQR</div>