Browse Source

mozilla rel-257 sync with Catchup 2.53 part 2

Ian Neal 4 years ago
parent
commit
086a27d5cf
68 changed files with 0 additions and 293950 deletions
  1. 0 69
      rel-257/mozilla-esr60/patches/1233768-61a1.patch
  2. 0 95
      rel-257/mozilla-esr60/patches/1340588-61a1.patch
  3. 0 49
      rel-257/mozilla-esr60/patches/1362858-1partial-56a1.patch
  4. 0 209
      rel-257/mozilla-esr60/patches/1372458-63a1.patch
  5. 0 188
      rel-257/mozilla-esr60/patches/1401776-62a1.patch
  6. 0 179
      rel-257/mozilla-esr60/patches/1418629-68a1.patch
  7. 0 65
      rel-257/mozilla-esr60/patches/1437661-67a1.patch
  8. 0 47
      rel-257/mozilla-esr60/patches/1445671-61a1.patch
  9. 0 104
      rel-257/mozilla-esr60/patches/1446809-1-61a1.patch
  10. 0 128
      rel-257/mozilla-esr60/patches/1446809-2-61a1.patch
  11. 0 64
      rel-257/mozilla-esr60/patches/1446809-3-61a1.patch
  12. 0 97
      rel-257/mozilla-esr60/patches/1446809-4-61a1.patch
  13. 0 44
      rel-257/mozilla-esr60/patches/1446809-5-61a1.patch
  14. 0 255
      rel-257/mozilla-esr60/patches/1446809-6-61a1.patch
  15. 0 33
      rel-257/mozilla-esr60/patches/1446809-7-61a1.patch
  16. 0 140
      rel-257/mozilla-esr60/patches/1446809-8-61a1.patch
  17. 0 119
      rel-257/mozilla-esr60/patches/1446809-9-61a1.patch
  18. 0 519
      rel-257/mozilla-esr60/patches/1447873-61a1.patch
  19. 0 64
      rel-257/mozilla-esr60/patches/1454978-61a1.patch
  20. 0 190
      rel-257/mozilla-esr60/patches/1455408-1-61a1.patch
  21. 0 53
      rel-257/mozilla-esr60/patches/1455408-2-61a1.patch
  22. 0 229
      rel-257/mozilla-esr60/patches/1455408-3-61a1.patch
  23. 0 66
      rel-257/mozilla-esr60/patches/1458462-61a1.patch
  24. 0 181
      rel-257/mozilla-esr60/patches/1461775-62a1.patch
  25. 0 242350
      rel-257/mozilla-esr60/patches/1464834-1-62a1.patch
  26. 0 42
      rel-257/mozilla-esr60/patches/1464834-2-62a1.patch
  27. 0 52
      rel-257/mozilla-esr60/patches/1469790-63a1.patch
  28. 0 33
      rel-257/mozilla-esr60/patches/1472672-63a1.patch
  29. 0 67
      rel-257/mozilla-esr60/patches/1473732-63a1.patch
  30. 0 74
      rel-257/mozilla-esr60/patches/1476000-63a1.patch
  31. 0 76
      rel-257/mozilla-esr60/patches/1477678-63a1.patch
  32. 0 99
      rel-257/mozilla-esr60/patches/1477799-63a1.patch
  33. 0 45
      rel-257/mozilla-esr60/patches/1478815-7partial-63a1.patch
  34. 0 2511
      rel-257/mozilla-esr60/patches/1488401-64a1.patch
  35. 0 9187
      rel-257/mozilla-esr60/patches/1491467-64a1.patch
  36. 0 250
      rel-257/mozilla-esr60/patches/1496823-1-64a1.patch
  37. 0 473
      rel-257/mozilla-esr60/patches/1496823-2-64a1.patch
  38. 0 176
      rel-257/mozilla-esr60/patches/1496823-3-64a1.patch
  39. 0 44
      rel-257/mozilla-esr60/patches/1496823-4-64a1.patch
  40. 0 77
      rel-257/mozilla-esr60/patches/1496823-5-64a1.patch
  41. 0 85
      rel-257/mozilla-esr60/patches/1496823-6-64a1.patch
  42. 0 120
      rel-257/mozilla-esr60/patches/1496823-7-64a1.patch
  43. 0 36
      rel-257/mozilla-esr60/patches/1496823-8-64a1.patch
  44. 0 3352
      rel-257/mozilla-esr60/patches/1500637-65a1.patch
  45. 0 544
      rel-257/mozilla-esr60/patches/1502747-65a1.patch
  46. 0 172
      rel-257/mozilla-esr60/patches/1506027-1-65a1.patch
  47. 0 43
      rel-257/mozilla-esr60/patches/1509867-65a1.patch
  48. 0 43
      rel-257/mozilla-esr60/patches/1510276-67a1.patch
  49. 0 5558
      rel-257/mozilla-esr60/patches/1513236-68a1.patch
  50. 0 53
      rel-257/mozilla-esr60/patches/1516325-68a1.patch
  51. 0 42
      rel-257/mozilla-esr60/patches/1516605-66a1.patch
  52. 0 41
      rel-257/mozilla-esr60/patches/1516642-67a1.patch
  53. 0 48
      rel-257/mozilla-esr60/patches/1518762-66a1.patch
  54. 0 33
      rel-257/mozilla-esr60/patches/1519209-66a1.patch
  55. 0 73
      rel-257/mozilla-esr60/patches/1520909-65a1.patch
  56. 0 136
      rel-257/mozilla-esr60/patches/1523665-67a1.patch
  57. 0 44
      rel-257/mozilla-esr60/patches/1529902-67a1.patch
  58. 0 61
      rel-257/mozilla-esr60/patches/1541282-68a1.patch
  59. 0 92
      rel-257/mozilla-esr60/patches/1562176-70a1.patch
  60. 0 383
      rel-257/mozilla-esr60/patches/1565919-70a1.patch
  61. 0 30
      rel-257/mozilla-esr60/patches/1566465-70a1.patch
  62. 0 33
      rel-257/mozilla-esr60/patches/1574573-70a1.patch
  63. 0 85
      rel-257/mozilla-esr60/patches/1576463-71a1.patch
  64. 0 153
      rel-257/mozilla-esr60/patches/1578075-71a1.patch
  65. 0 31
      rel-257/mozilla-esr60/patches/1578303_enable_loginmanagercontextmenu-71a1.patch
  66. 0 23820
      rel-257/mozilla-esr60/patches/1602261-retsulcksat.patch
  67. 0 29
      rel-257/mozilla-esr60/patches/1602262-safebrowsing-pref.patch
  68. 0 67
      rel-257/mozilla-esr60/patches/series

+ 0 - 69
rel-257/mozilla-esr60/patches/1233768-61a1.patch

@@ -1,69 +0,0 @@
-# HG changeset patch
-# User David Major <dmajor@mozilla.com>
-# Date 1521824759 14400
-# Node ID 9f0acb32263cb463975a1820307edc7149a2dd0c
-# Parent  4db836a8d12bfea94b1280fc8d4198ee79eb5727
-Bug 1233768: Disable regparm under clang-cl in libffi. r=froydnj
-
-diff --git a/js/src/ctypes/libffi-patches/02-clang-cl.patch b/js/src/ctypes/libffi-patches/02-clang-cl.patch
---- a/js/src/ctypes/libffi-patches/02-clang-cl.patch
-+++ b/js/src/ctypes/libffi-patches/02-clang-cl.patch
-@@ -26,24 +26,30 @@ index 7aee5b4..9cba257 100644
- +
-  When building with MSVC under a MingW environment, you may need to
-  remove the line in configure that sets 'fix_srcfile_path' to a 'cygpath'
-  command.  ('cygpath' is not present in MingW, and is not required when
- diff --git a/include/ffi.h.in b/include/ffi.h.in
- index 70c6179..ebed0aa 100644
- --- a/include/ffi.h.in
- +++ b/include/ffi.h.in
--@@ -68,7 +68,7 @@ extern "C" {
-+@@ -68,7 +68,13 @@
-  
-  #ifndef LIBFFI_ASM
-  
- -#ifdef _MSC_VER
- +#if defined(_MSC_VER) && !defined(__clang__)
-  #define __attribute__(X)
-  #endif
-++
-++/* Disable regparm under clang-cl because the assembly thunks were
-++   written for MSVC and pass all parameters on the stack. */
-++#if defined(_MSC_VER) && defined(__clang__)
-++#define regparm(X)
-++#endif
-  
- diff --git a/msvcc.sh b/msvcc.sh
- index 9208076..4a65b0b 100755
- --- a/msvcc.sh
- +++ b/msvcc.sh
- @@ -63,11 +63,15 @@ do
-        shift 1
-      ;;
-diff --git a/js/src/ctypes/libffi/include/ffi.h.in b/js/src/ctypes/libffi/include/ffi.h.in
---- a/js/src/ctypes/libffi/include/ffi.h.in
-+++ b/js/src/ctypes/libffi/include/ffi.h.in
-@@ -67,16 +67,22 @@ extern "C" {
- #include <ffitarget.h>
- 
- #ifndef LIBFFI_ASM
- 
- #if defined(_MSC_VER) && !defined(__clang__)
- #define __attribute__(X)
- #endif
- 
-+/* Disable regparm under clang-cl because the assembly thunks were
-+   written for MSVC and pass all parameters on the stack. */
-+#if defined(_MSC_VER) && defined(__clang__)
-+#define regparm(X)
-+#endif
-+
- #include <stddef.h>
- #include <limits.h>
- 
- /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
-    But we can find it either under the correct ANSI name, or under GNU
-    C's internal name.  */
- 
- #define FFI_64_BIT_MAX 9223372036854775807
-

+ 0 - 95
rel-257/mozilla-esr60/patches/1340588-61a1.patch

@@ -1,95 +0,0 @@
-# HG changeset patch
-# User Nathan Froyd <froydnj@mozilla.com>
-# Date 1520949960 18000
-# Node ID 30dc6c484d42504bb586b7b02cf6561dbd50136e
-# Parent  cf81252a02b56669955158f4e4ab3bc7bfdc59b4
-Bug 1340588 - enable clang-cl to generate depfiles directly, rather than using a wrapper; r=build-peer
-
-We use a wrapper script when compiling with MSVC to parse the
-/showIncludes output and thereby generate a Makefile dependency
-fragment.  This fragment enables us to do correct and faster incremental
-builds.  But the cost of invoking the wrapper script can be significant;
-it's an extra process or two to launch for every single compilation.
-
-Instead, let's have clang-cl generate the dependencies directly, which
-should be somewhat faster.
-
-diff --git a/config/config.mk b/config/config.mk
---- a/config/config.mk
-+++ b/config/config.mk
-@@ -115,18 +115,21 @@ else
-   win_srcdir := $(srcdir)
-   BUILD_TOOLS = $(MOZILLA_DIR)/build/unix
- endif
- 
- CONFIG_TOOLS	= $(MOZ_BUILD_ROOT)/config
- AUTOCONF_TOOLS	= $(MOZILLA_DIR)/build/autoconf
- 
- ifdef _MSC_VER
-+# clang-cl is smart enough to generate dependencies directly.
-+ifndef CLANG_CL
- CC_WRAPPER ?= $(call py_action,cl)
- CXX_WRAPPER ?= $(call py_action,cl)
-+endif # CLANG_CL
- endif # _MSC_VER
- 
- CC := $(CC_WRAPPER) $(CC)
- CXX := $(CXX_WRAPPER) $(CXX)
- MKDIR ?= mkdir
- SLEEP ?= sleep
- TOUCH ?= touch
- 
-diff --git a/js/src/old-configure.in b/js/src/old-configure.in
---- a/js/src/old-configure.in
-+++ b/js/src/old-configure.in
-@@ -1606,16 +1606,23 @@ dnl =
- dnl = Build depencency options
- dnl =
- dnl ========================================================
- MOZ_ARG_HEADER(Build dependencies)
- 
- if test "$GNU_CC" -a "$GNU_CXX"; then
-   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
- else
-+  # clang-cl doesn't accept the normal -MD -MP -MF options that clang does, but
-+  # the underlying cc1 binary understands how to generate dependency files.
-+  # These options are based on analyzing what the normal clang driver sends to
-+  # cc1 when given the "correct" dependency options.
-+  if test -n "$CLANG_CL"; then
-+   _DEPEND_CFLAGS='-Xclang -MP -Xclang -MG -Xclang -dependency-file -Xclang $(MDDEPDIR)/$(@F).pp -Xclang -MT -Xclang $@'
-+  fi
-   dnl Don't override this for MSVC
-   if test -z "$_WIN32_MSVC"; then
-     _USE_CPP_INCLUDE_FLAG=
-     _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
-     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
-   else
-     echo '#include <stdio.h>' > dummy-hello.c
-     changequote(,)
-diff --git a/old-configure.in b/old-configure.in
---- a/old-configure.in
-+++ b/old-configure.in
-@@ -3697,16 +3697,23 @@ dnl = Build depencency options
- dnl =
- dnl ========================================================
- MOZ_ARG_HEADER(Build dependencies)
- 
- if test "$COMPILE_ENVIRONMENT"; then
- if test "$GNU_CC" -a "$GNU_CXX"; then
-   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
- else
-+  # clang-cl doesn't accept the normal -MD -MP -MF options that clang does, but
-+  # the underlying cc1 binary understands how to generate dependency files.
-+  # These options are based on analyzing what the normal clang driver sends to
-+  # cc1 when given the "correct" dependency options.
-+  if test -n "$CLANG_CL"; then
-+   _DEPEND_CFLAGS='-Xclang -MP -Xclang -MG -Xclang -dependency-file -Xclang $(MDDEPDIR)/$(@F).pp -Xclang -MT -Xclang $@'
-+  fi
-   dnl Don't override this for MSVC
-   if test -z "$_WIN32_MSVC"; then
-     _USE_CPP_INCLUDE_FLAG=
-     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
-     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
-   else
-     echo '#include <stdio.h>' > dummy-hello.c
-     changequote(,)

+ 0 - 49
rel-257/mozilla-esr60/patches/1362858-1partial-56a1.patch

@@ -1,49 +0,0 @@
-# HG changeset patch
-# User Evelyn Hung <jj.evelyn@gmail.com>
-# Date 1497258988 -28800
-# Node ID eaf99ba3813aa82632262ba4fc0438a7e2574af6
-# Parent  2cba736ec8d443921b3bb16ceb36dbd1b3efe8ac
-Bug 1362858 - Part 1: make word boundary check more consistent.r=Ehsan
-
-We use ClassifyCharacter for detecting all possibilities of word
-boudaries when building mRealWords but not when building soft text.
-This inconsistency leads us repeatedly checking the same set of words
-in some cases.
-
-diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
---- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
-+++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
-@@ -580,21 +580,30 @@ static inline bool IsBRElement(nsINode* 
-  */
- static bool TextNodeContainsDOMWordSeparator(nsINode* aNode,
-                                              int32_t aBeforeOffset,
-                                              int32_t* aSeparatorOffset) {
-   // aNode is actually an nsIContent, since it's eTEXT
-   nsIContent* content = static_cast<nsIContent*>(aNode);
-   const nsTextFragment* textFragment = content->GetText();
-   NS_ASSERTION(textFragment, "Where is our text?");
--  for (int32_t i = std::min(aBeforeOffset, int32_t(textFragment->GetLength())) - 1; i >= 0; --i) {
--    if (IsDOMWordSeparator(textFragment->CharAt(i))) {
-+  nsString text;
-+  int32_t end = std::min(aBeforeOffset, int32_t(textFragment->GetLength()));
-+  bool ok = textFragment->AppendTo(text, 0, end, mozilla::fallible);
-+  if(!ok)
-+    return false;
-+
-+  WordSplitState state(nullptr, text, 0, end);
-+  for (int32_t i = end - 1; i >= 0; --i) {
-+    if (IsDOMWordSeparator(textFragment->CharAt(i)) ||
-+        state.ClassifyCharacter(i, true) == CHAR_CLASS_SEPARATOR) {
-       // Be greedy, find as many separators as we can
-       for (int32_t j = i - 1; j >= 0; --j) {
--        if (IsDOMWordSeparator(textFragment->CharAt(j))) {
-+        if (IsDOMWordSeparator(textFragment->CharAt(j)) ||
-+            state.ClassifyCharacter(j, true) == CHAR_CLASS_SEPARATOR) {
-           i = j;
-         } else {
-           break;
-         }
-       }
-       *aSeparatorOffset = i;
-       return true;
-     }

+ 0 - 209
rel-257/mozilla-esr60/patches/1372458-63a1.patch

@@ -1,209 +0,0 @@
-# HG changeset patch
-# User Matt Woodrow <mwoodrow@mozilla.com>
-# Date 1531538749 -43200
-# Node ID d48e40cba0b40df512ba0bf0a35f5f0fea9d0b9c
-# Parent  32a9e6442c87cd05bd3dffe0343a64f2eb230846
-Bug 1372458 - Fold opacity into filter drawing rather than using a temporary surface. r=bas,mstange
-
-MozReview-Commit-ID: GOBTUhN7fcC
-
-diff --git a/gfx/2d/DrawTargetD2D1.cpp b/gfx/2d/DrawTargetD2D1.cpp
---- a/gfx/2d/DrawTargetD2D1.cpp
-+++ b/gfx/2d/DrawTargetD2D1.cpp
-@@ -230,18 +230,34 @@ void DrawTargetD2D1::DrawFilter(FilterNo
- 
-   PrepareForDrawing(aOptions.mCompositionOp, ColorPattern(Color()));
- 
-   mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode));
- 
-   FilterNodeD2D1 *node = static_cast<FilterNodeD2D1 *>(aNode);
-   node->WillDraw(this);
- 
--  mDC->DrawImage(node->OutputEffect(), D2DPoint(aDestPoint),
--                 D2DRect(aSourceRect));
-+  if (aOptions.mAlpha == 1.0f) {
-+    mDC->DrawImage(node->OutputEffect(), D2DPoint(aDestPoint),
-+                   D2DRect(aSourceRect));
-+    RefPtr<ID2D1Image> image;
-+    node->OutputEffect()->GetOutput(getter_AddRefs(image));
-+
-+    Matrix mat = Matrix::Translation(aDestPoint);
-+
-+    RefPtr<ID2D1ImageBrush> imageBrush;
-+    mDC->CreateImageBrush(image,
-+                          D2D1::ImageBrushProperties(D2DRect(aSourceRect)),
-+                          D2D1::BrushProperties(aOptions.mAlpha, D2DMatrix(mat)),
-+                          getter_AddRefs(imageBrush));
-+    mDC->FillRectangle(D2D1::RectF(aDestPoint.x, aDestPoint.y,
-+                                   aDestPoint.x + aSourceRect.width,
-+                                   aDestPoint.y + aSourceRect.height),
-+                       imageBrush);
-+  }
- 
-   FinalizeDrawing(aOptions.mCompositionOp, ColorPattern(Color()));
- }
- 
- void DrawTargetD2D1::DrawSurfaceWithShadow(SourceSurface *aSurface,
-                                            const Point &aDest,
-                                            const Color &aColor,
-                                            const Point &aOffset, Float aSigma,
-diff --git a/layout/svg/nsFilterInstance.cpp b/layout/svg/nsFilterInstance.cpp
---- a/layout/svg/nsFilterInstance.cpp
-+++ b/layout/svg/nsFilterInstance.cpp
-@@ -53,17 +53,17 @@ static UniquePtr<UserSpaceMetrics> UserS
-     return MakeUnique<SVGElementMetrics>(element);
-   }
-   return MakeUnique<NonSVGFrameUserSpaceMetrics>(aFrame);
- }
- 
- void nsFilterInstance::PaintFilteredFrame(
-     nsIFrame* aFilteredFrame, gfxContext* aCtx,
-     nsSVGFilterPaintCallback* aPaintCallback, const nsRegion* aDirtyArea,
--    imgDrawingParams& aImgParams) {
-+    imgDrawingParams& aImgParams, float aOpacity) {
-   auto& filterChain = aFilteredFrame->StyleEffects()->mFilters;
-   UniquePtr<UserSpaceMetrics> metrics =
-       UserSpaceMetricsForFrame(aFilteredFrame);
- 
-   gfxContextMatrixAutoSaveRestore autoSR(aCtx);
-   gfxSize scaleFactors = aCtx->CurrentMatrixDouble().ScaleFactors(true);
-   if (scaleFactors.IsEmpty()) {
-     return;
-@@ -84,17 +84,17 @@ void nsFilterInstance::PaintFilteredFram
- 
-   // Hardcode InputIsTainted to true because we don't want JS to be able to
-   // read the rendered contents of aFilteredFrame.
-   nsFilterInstance instance(aFilteredFrame, aFilteredFrame->GetContent(),
-                             *metrics, filterChain, /* InputIsTainted */ true,
-                             aPaintCallback, scaleMatrixInDevUnits, aDirtyArea,
-                             nullptr, nullptr, nullptr);
-   if (instance.IsInitialized()) {
--    instance.Render(aCtx, aImgParams);
-+    instance.Render(aCtx, aImgParams, aOpacity);
-   }
- }
- 
- nsRegion nsFilterInstance::GetPostFilterDirtyArea(
-     nsIFrame* aFilteredFrame, const nsRegion& aPreFilterDirtyRegion) {
-   if (aPreFilterDirtyRegion.IsEmpty()) {
-     return nsRegion();
-   }
-@@ -456,17 +456,18 @@ void nsFilterInstance::BuildSourceImage(
- 
-   mPaintCallback->Paint(*ctx, mTargetFrame, mPaintTransform, &dirty,
-                         aImgParams);
- 
-   mSourceGraphic.mSourceSurface = offscreenDT->Snapshot();
-   mSourceGraphic.mSurfaceRect = neededRect;
- }
- 
--void nsFilterInstance::Render(gfxContext* aCtx, imgDrawingParams& aImgParams) {
-+void nsFilterInstance::Render(gfxContext* aCtx, imgDrawingParams& aImgParams,
-+                              float aOpacity) {
-   MOZ_ASSERT(mTargetFrame, "Need a frame for rendering");
- 
-   if (mPrimitiveDescriptions.IsEmpty()) {
-     // An filter without any primitive. Treat it as success and paint nothing.
-     return;
-   }
- 
-   nsIntRect filterRect =
-@@ -484,17 +485,17 @@ void nsFilterInstance::Render(gfxContext
-   BuildSourceImage(aCtx->GetDrawTarget(), aImgParams);
-   BuildSourcePaints(aImgParams);
- 
-   FilterSupport::RenderFilterDescription(
-       aCtx->GetDrawTarget(), mFilterDescription, IntRectToRect(filterRect),
-       mSourceGraphic.mSourceSurface, mSourceGraphic.mSurfaceRect,
-       mFillPaint.mSourceSurface, mFillPaint.mSurfaceRect,
-       mStrokePaint.mSourceSurface, mStrokePaint.mSurfaceRect, mInputImages,
--      Point(0, 0));
-+      Point(0, 0), DrawOptions(aOpacity));
- }
- 
- nsRegion nsFilterInstance::ComputePostFilterDirtyRegion() {
-   if (mPreFilterDirtyRegion.IsEmpty() || mPrimitiveDescriptions.IsEmpty()) {
-     return nsRegion();
-   }
- 
-   nsIntRegion resultChangeRegion = FilterSupport::ComputeResultChangeRegion(
-diff --git a/layout/svg/nsFilterInstance.h b/layout/svg/nsFilterInstance.h
---- a/layout/svg/nsFilterInstance.h
-+++ b/layout/svg/nsFilterInstance.h
-@@ -81,17 +81,18 @@ class nsFilterInstance {
-    * Paint the given filtered frame.
-    * @param aDirtyArea The area than needs to be painted, in aFilteredFrame's
-    *   frame space (i.e. relative to its origin, the top-left corner of its
-    *   border box).
-    */
-   static void PaintFilteredFrame(nsIFrame* aFilteredFrame, gfxContext* aCtx,
-                                  nsSVGFilterPaintCallback* aPaintCallback,
-                                  const nsRegion* aDirtyArea,
--                                 imgDrawingParams& aImgParams);
-+                                 imgDrawingParams& aImgParams,
-+                                 float aOpacity = 1.0f);
- 
-   /**
-    * Returns the post-filter area that could be dirtied when the given
-    * pre-filter area of aFilteredFrame changes.
-    * @param aPreFilterDirtyRegion The pre-filter area of aFilteredFrame that has
-    *   changed, relative to aFilteredFrame, in app units.
-    */
-   static nsRegion GetPostFilterDirtyArea(nsIFrame* aFilteredFrame,
-@@ -160,17 +161,18 @@ class nsFilterInstance {
-   bool IsInitialized() const { return mInitialized; }
- 
-   /**
-    * Draws the filter output into aDrawTarget. The area that
-    * needs to be painted must have been specified before calling this method
-    * by passing it as the aPostFilterDirtyRegion argument to the
-    * nsFilterInstance constructor.
-    */
--  void Render(gfxContext* aCtx, imgDrawingParams& aImgParams);
-+  void Render(gfxContext* aCtx, imgDrawingParams& aImgParams,
-+              float aOpacity = 1.0f);
- 
-   const FilterDescription& ExtractDescriptionAndAdditionalImages(
-       nsTArray<RefPtr<SourceSurface>>& aOutAdditionalImages) {
-     mInputImages.SwapElements(aOutAdditionalImages);
-     return mFilterDescription;
-   }
- 
-   /**
-diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp
---- a/layout/svg/nsSVGIntegrationUtils.cpp
-+++ b/layout/svg/nsSVGIntegrationUtils.cpp
-@@ -1024,32 +1024,23 @@ void nsSVGIntegrationUtils::PaintFilter(
-     return;
-   }
- 
-   gfxContext& context = aParams.ctx;
- 
-   gfxContextAutoSaveRestore autoSR(&context);
-   EffectOffsets offsets = MoveContextOriginToUserSpace(firstFrame, aParams);
- 
--  if (opacity != 1.0f) {
--    context.PushGroupForBlendBack(gfxContentType::COLOR_ALPHA, opacity, nullptr,
--                                  Matrix());
--  }
--
-   /* Paint the child and apply filters */
-   RegularFramePaintCallback callback(aParams.builder, aParams.layerManager,
-                                      offsets.offsetToUserSpaceInDevPx);
-   nsRegion dirtyRegion = aParams.dirtyRect - offsets.offsetToBoundingBox;
- 
-   nsFilterInstance::PaintFilteredFrame(frame, &context, &callback, &dirtyRegion,
--                                       aParams.imgParams);
--
--  if (opacity != 1.0f) {
--    context.PopGroupAndBlend();
--  }
-+                                       aParams.imgParams, opacity);
- }
- 
- class PaintFrameCallback : public gfxDrawingCallback {
-  public:
-   PaintFrameCallback(nsIFrame* aFrame, const nsSize aPaintServerSize,
-                      const IntSize aRenderSize, uint32_t aFlags)
-       : mFrame(aFrame),
-         mPaintServerSize(aPaintServerSize),

+ 0 - 188
rel-257/mozilla-esr60/patches/1401776-62a1.patch

@@ -1,188 +0,0 @@
-# HG changeset patch
-# User Jed Davis <jld@mozilla.com>
-# Date 1525995392 21600
-# Node ID fcfbfc7d96d90fb5bbc3f03284a460a70e7674ac
-# Parent  7ea7dd821347952a96808a3b98e45aa08a420ccd
-Bug 1401776 - Raise fd limit to 4096 on Unix. r=glandium,mcmanus
-
-This is to accommodate non-networking fd usage (IPC transports, various
-databases, .xpi files, etc.), so it's separate from Necko's existing
-manipulation of the fd limit, which is tied into Necko's internal limits
-on how many sockets it will try to poll at once.
-
-Note that resource limits are inherited by child processes, so this needs
-to be done only in the parent.
-
-This patch also removes similar code used on Solaris and Mac OS X.  The
-Mac case (bug 1036682) refers to fd use by graphics textures, which
-shouldn't be consuming fds anymore (even transiently) as of bug 1161166.
-
-MozReview-Commit-ID: 2uodrkW5sUn
-
-diff --git a/gfx/thebes/gfxPlatformMac.cpp b/gfx/thebes/gfxPlatformMac.cpp
---- a/gfx/thebes/gfxPlatformMac.cpp
-+++ b/gfx/thebes/gfxPlatformMac.cpp
-@@ -73,29 +73,16 @@ gfxPlatformMac::gfxPlatformMac() {
-   DisableFontActivation();
-   mFontAntiAliasingThreshold = ReadAntiAliasingThreshold();
- 
-   uint32_t canvasMask = BackendTypeBit(BackendType::SKIA);
-   uint32_t contentMask = BackendTypeBit(BackendType::SKIA);
-   InitBackendPrefs(canvasMask, BackendType::SKIA, contentMask,
-                    BackendType::SKIA);
- 
--  // XXX: Bug 1036682 - we run out of fds on Mac when using tiled layers because
--  // with 256x256 tiles we can easily hit the soft limit of 800 when using
--  // double buffered tiles in e10s, so let's bump the soft limit to the hard
--  // limit for the OS up to a new cap of OPEN_MAX.
--  struct rlimit limits;
--  if (getrlimit(RLIMIT_NOFILE, &limits) == 0) {
--    limits.rlim_cur = std::min(rlim_t(OPEN_MAX), limits.rlim_max);
--    if (setrlimit(RLIMIT_NOFILE, &limits) != 0) {
--      NS_WARNING(
--          "Unable to bump RLIMIT_NOFILE to the maximum number on this OS");
--    }
--  }
--
-   MacIOSurfaceLib::LoadLibrary();
- }
- 
- gfxPlatformMac::~gfxPlatformMac() { gfxCoreTextShaper::Shutdown(); }
- 
- bool gfxPlatformMac::UsesTiling() const {
-   // The non-tiling ContentClient requires CrossProcessSemaphore which
-   // isn't implemented for OSX.
-diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
---- a/toolkit/xre/nsAppRunner.cpp
-+++ b/toolkit/xre/nsAppRunner.cpp
-@@ -148,19 +148,22 @@
- #include "mozilla/Omnijar.h"
- #include "mozilla/StartupTimeline.h"
- #include "mozilla/LateWriteChecks.h"
- 
- #include <stdlib.h>
- #include <locale.h>
- 
- #ifdef XP_UNIX
-+#include <errno.h>
-+#include <pwd.h>
-+#include <string.h>
-+#include <sys/resource.h>
- #include <sys/stat.h>
- #include <unistd.h>
--#include <pwd.h>
- #endif
- 
- #ifdef XP_WIN
- #include <process.h>
- #include <shlobj.h>
- #include "mozilla/WinDllServices.h"
- #include "nsThreadUtils.h"
- #include <comdef.h>
-@@ -3050,16 +3053,43 @@ static bool CheckForUserMismatch() {
-     }
-   }
-   return false;
- }
- #else  // !XP_UNIX || ANDROID
- static bool CheckForUserMismatch() { return false; }
- #endif
- 
-+static void IncreaseDescriptorLimits() {
-+#ifdef XP_UNIX
-+  // Increase the fd limit to accomodate IPC resources like shared memory.
-+  static const rlim_t kFDs = 4096;
-+  struct rlimit rlim;
-+
-+  if (getrlimit(RLIMIT_NOFILE, &rlim) != 0) {
-+    Output(false, "getrlimit: %s\n", strerror(errno));
-+    return;
-+  }
-+  // Don't decrease the limit if it's already high enough, but don't
-+  // try to go over the hard limit.  (RLIM_INFINITY isn't required to
-+  // be the numerically largest rlim_t, so don't assume that.)
-+  if (rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur < kFDs &&
-+      rlim.rlim_cur < rlim.rlim_max) {
-+    if (rlim.rlim_max != RLIM_INFINITY && rlim.rlim_max < kFDs) {
-+      rlim.rlim_cur = rlim.rlim_max;
-+    } else {
-+      rlim.rlim_cur = kFDs;
-+    }
-+    if (setrlimit(RLIMIT_NOFILE, &rlim) != 0) {
-+      Output(false, "setrlimit: %s\n", strerror(errno));
-+    }
-+  }
-+#endif
-+}
-+
- /*
-  * XRE_mainInit - Initial setup and command line parameter processing.
-  * Main() will exit early if either return value != 0 or if aExitFlag is
-  * true.
-  */
- int XREMain::XRE_mainInit(bool* aExitFlag) {
-   if (!aExitFlag) return 1;
-   *aExitFlag = false;
-@@ -3117,16 +3147,18 @@ int XREMain::XRE_mainInit(bool* aExitFla
- 
-   nsresult rv;
-   ArgResult ar;
- 
- #ifdef DEBUG
-   if (PR_GetEnv("XRE_MAIN_BREAK")) NS_BREAK();
- #endif
- 
-+  IncreaseDescriptorLimits();
-+
- #ifdef USE_GLX_TEST
-   // bug 639842 - it's very important to fire this process BEFORE we set up
-   // error handling. indeed, this process is expected to be crashy, and we
-   // don't want the user to see its crashes. That's the whole reason for
-   // doing this in a separate process.
-   //
-   // This call will cause a fork and the fork will terminate itself separately
-   // from the usual shutdown sequence
-diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp
---- a/toolkit/xre/nsSigHandlers.cpp
-+++ b/toolkit/xre/nsSigHandlers.cpp
-@@ -275,40 +275,16 @@ void InstallSignalHandlers(const char *a
-     m *= (1024 * 1024);
-     struct rlimit r;
-     r.rlim_cur = m;
-     r.rlim_max = m;
-     setrlimit(RLIMIT_AS, &r);
-   }
- #endif
- 
--#if defined(SOLARIS)
--#define NOFILES 512
--
--  // Boost Solaris file descriptors
--  {
--    struct rlimit rl;
--
--    if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
--
--      if (rl.rlim_cur < NOFILES) {
--        rl.rlim_cur = NOFILES;
--
--        if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
--          perror("setrlimit(RLIMIT_NOFILE)");
--          fprintf(stderr, "Cannot exceed hard limit for open files");
--        }
--#if defined(DEBUG)
--        if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
--          printf("File descriptors set to %d\n", rl.rlim_cur);
--#endif  // DEBUG
--      }
--  }
--#endif  // SOLARIS
--
- #if defined(MOZ_WIDGET_GTK) && \
-     (GLIB_MAJOR_VERSION > 2 || \
-      (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
-   const char *assertString = PR_GetEnv("XPCOM_DEBUG_BREAK");
-   if (assertString &&
-       (!strcmp(assertString, "suspend") || !strcmp(assertString, "stack") ||
-        !strcmp(assertString, "abort") || !strcmp(assertString, "trap") ||
-        !strcmp(assertString, "break"))) {

+ 0 - 179
rel-257/mozilla-esr60/patches/1418629-68a1.patch

@@ -1,179 +0,0 @@
-# HG changeset patch
-# User Makoto Kato <m_kato@ga2.so-net.ne.jp>
-# Date 1557308165 0
-# Node ID 5822c9d23ff717f637b5cd9c2c24a8e2d223fcb8
-# Parent  c68cb2a8cdd17d72bd37a0e1499f26f78ca00700
-Bug 1418629 - Single quotation mark shouldn't always separator. r=Ehsan
-
-This seems to be regression by bug 1362858.
-
-Actually, single quotation mark is always separator for spellchecker after
-landing bug 1462858. When user tries to input "doesn't",  "'" becomes separator
-for spellchecker. Then "doesn" will be misspell word.
-
-So we shouldn't mark single quotation mark as separator if user is inputting
-word.
-
-Differential Revision: https://phabricator.services.mozilla.com/D29153
-
-diff --git a/editor/spellchecker/tests/mochitest.ini b/editor/spellchecker/tests/mochitest.ini
---- a/editor/spellchecker/tests/mochitest.ini
-+++ b/editor/spellchecker/tests/mochitest.ini
-@@ -7,20 +7,22 @@ support-files =
-   bug1204147_subframe.html
-   bug1204147_subframe2.html
-   en-GB/en_GB.dic
-   en-GB/en_GB.aff
-   en-AU/en_AU.dic
-   en-AU/en_AU.aff
-   de-DE/de_DE.dic
-   de-DE/de_DE.aff
-+  !/editor/libeditor/tests/spellcheck.js
- 
- [test_async_UpdateCurrentDictionary.html]
- [test_bug678842.html]
- [test_bug697981.html]
- [test_bug717433.html]
- [test_bug1200533.html]
- [test_bug1204147.html]
- [test_bug1205983.html]
- [test_bug1209414.html]
- [test_bug1219928.html]
- skip-if = e10s
- [test_bug1365383.html]
-+[test_bug1418629.html]
-diff --git a/editor/spellchecker/tests/test_bug1418629.html b/editor/spellchecker/tests/test_bug1418629.html
-new file mode 100644
---- /dev/null
-+++ b/editor/spellchecker/tests/test_bug1418629.html
-@@ -0,0 +1,96 @@
-+<!DOCTYPE html>
-+<html>
-+<head>
-+  <title>Mozilla bug 1418629</title>
-+  <link rel=stylesheet href="/tests/SimpleTest/test.css">
-+  <script src="/tests/SimpleTest/EventUtils.js"></script>
-+  <script src="/tests/SimpleTest/SimpleTest.js"></script>
-+  <script src="/tests/SimpleTest/AddTask.js"></script>
-+  <script src="/tests/editor/libeditor/tests/spellcheck.js"></script>
-+</head>
-+<body>
-+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1418629">Mozilla Bug 1418629</a>
-+<p id="display"></p>
-+<div id="content" style="display: none;">
-+
-+</div>
-+
-+<input id="input1" autofocus spellcheck="true">
-+
-+<script>
-+const {onSpellCheck} = SpecialPowers.Cu.import("resource://testing-common/AsyncSpellCheckTestHelper.jsm", {});
-+
-+SimpleTest.waitForExplicitFinish();
-+
-+add_task(async function() {
-+  await new Promise((resolve) => {
-+    SimpleTest.waitForFocus(() => {
-+      SimpleTest.executeSoon(resolve);
-+    }, window);
-+  });
-+
-+  let misspeltWords = [];
-+  let input = document.getElementById("input1");
-+
-+  input.focus();
-+  input.value = "";
-+  synthesizeKey("d");
-+  synthesizeKey("o");
-+  synthesizeKey("e");
-+  synthesizeKey("s");
-+
-+  await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  // isSpellingCheckOk is defined in spellcheck.js
-+  // eslint-disable-next-line no-undef
-+  ok(isSpellingCheckOk(SpecialPowers.wrap(input).editor, misspeltWords),
-+     "no misspelt words");
-+
-+  synthesizeKey("n");
-+  synthesizeKey("\'");
-+  is(input.value, "doesn\'", "");
-+
-+  await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  // isSpellingCheckOk is defined in spellcheck.js
-+  // eslint-disable-next-line no-undef
-+  ok(isSpellingCheckOk(SpecialPowers.wrap(input).editor, misspeltWords),
-+     "don't run spellchecker during inputting word");
-+
-+  synthesizeKey(" ");
-+  is(input.value, "doesn\' ", "");
-+
-+  await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  misspeltWords.push("doesn\'");
-+  // isSpellingCheckOk is defined in spellcheck.js
-+  // eslint-disable-next-line no-undef
-+  ok(isSpellingCheckOk(SpecialPowers.wrap(input).editor, misspeltWords),
-+     "should run spellchecker");
-+});
-+
-+async function test_with_twice_characters(ch) {
-+  let misspeltWords = [];
-+  let input = document.getElementById("input1");
-+
-+  input.focus();
-+  input.value = "";
-+  synthesizeKey("d");
-+  synthesizeKey("o");
-+  synthesizeKey("e");
-+  synthesizeKey("s");
-+  synthesizeKey("n");
-+  synthesizeKey(ch);
-+  synthesizeKey(ch);
-+  is(input.value, "doesn" + ch + ch, "");
-+
-+  await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  misspeltWords.push("doesn");
-+  // isSpellingCheckOk is defined in spellcheck.js
-+  // eslint-disable-next-line no-undef
-+  ok(isSpellingCheckOk(SpecialPowers.wrap(input).editor, misspeltWords),
-+     "should run spellchecker");
-+}
-+
-+add_task(test_with_twice_characters.bind(null, "\'"));
-+add_task(test_with_twice_characters.bind(null, String.fromCharCode(0x2019)));
-+</script>
-+</body>
-+</html>
-diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
---- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
-+++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
-@@ -385,18 +385,29 @@ CharClass WordSplitState::ClassifyCharac
-     if (aIndex == 0) return CHAR_CLASS_SEPARATOR;
-     if (ClassifyCharacter(aIndex - 1, false) != CHAR_CLASS_WORD)
-       return CHAR_CLASS_SEPARATOR;
-     // If the previous charatcer is a word-char, make sure that it's not a
-     // special dot character.
-     if (mDOMWordText[aIndex - 1] == '.') return CHAR_CLASS_SEPARATOR;
- 
-     // now we know left char is a word-char, check the right-hand character
--    if (aIndex == int32_t(mDOMWordText.Length()) - 1)
-+    if (aIndex == int32_t(mDOMWordText.Length() - 1)) {
-+      if (mDOMWordText[aIndex] == '\'' || mDOMWordText[aIndex] == 0x2019) {
-+        nsUGenCategory prevCategory =
-+            mozilla::unicode::GetGenCategory(mDOMWordText[aIndex - 1]);
-+        if (prevCategory == nsUGenCategory::kLetter ||
-+            prevCategory == nsUGenCategory::kNumber) {
-+          // If single quotation mark is last, we don't return separator yet.
-+          return CHAR_CLASS_WORD;
-+        }
-+      }
-       return CHAR_CLASS_SEPARATOR;
-+    }
-+
-     if (ClassifyCharacter(aIndex + 1, false) != CHAR_CLASS_WORD)
-       return CHAR_CLASS_SEPARATOR;
-     // If the next charatcer is a word-char, make sure that it's not a
-     // special dot character.
-     if (mDOMWordText[aIndex + 1] == '.') return CHAR_CLASS_SEPARATOR;
- 
-     // char on either side is a word, this counts as a word
-     return CHAR_CLASS_WORD;

+ 0 - 65
rel-257/mozilla-esr60/patches/1437661-67a1.patch

@@ -1,65 +0,0 @@
-# HG changeset patch
-# User Valentin Gosu <valentin.gosu@gmail.com>
-# Date 1551979415 0
-# Node ID a451c5f914c4c1fa9e20baaa569a3c54fe04d7b5
-# Parent  868c8eb48eeb9dccf062c4430c91cfd3d7cf6916
-Bug 1437661 - Use fallible AppendUTF16toUTF8 to avoid OOM crash r=JuniorHsu
-
-Differential Revision: https://phabricator.services.mozilla.com/D22412
-
-diff --git a/netwerk/base/nsNetUtil.cpp b/netwerk/base/nsNetUtil.cpp
---- a/netwerk/base/nsNetUtil.cpp
-+++ b/netwerk/base/nsNetUtil.cpp
-@@ -1616,33 +1616,39 @@ nsresult NS_NewURI(
-         *ioService /* = nullptr */)  // pass in nsIIOService to optimize callers
- {
-   nsAutoCString charset;
-   encoding->Name(charset);
-   return NS_NewURI(result, spec, charset.get(), baseURI, ioService);
- }
- 
- nsresult NS_NewURI(
--    nsIURI **result, const nsAString &spec, const char *charset /* = nullptr */,
-+    nsIURI **result, const nsAString &aSpec,
-+    const char *charset /* = nullptr */, nsIURI *baseURI /* = nullptr */,
-+    nsIIOService
-+        *ioService /* = nullptr */)  // pass in nsIIOService to optimize callers
-+{
-+  nsAutoCString spec;
-+  if (!AppendUTF16toUTF8(aSpec, spec, mozilla::fallible)) {
-+    return NS_ERROR_OUT_OF_MEMORY;
-+  }
-+  return NS_NewURI(result, spec, charset, baseURI, ioService);
-+}
-+
-+nsresult NS_NewURI(
-+    nsIURI **result, const nsAString &aSpec, NotNull<const Encoding *> encoding,
-     nsIURI *baseURI /* = nullptr */,
-     nsIIOService
-         *ioService /* = nullptr */)  // pass in nsIIOService to optimize callers
- {
--  return NS_NewURI(result, NS_ConvertUTF16toUTF8(spec), charset, baseURI,
--                   ioService);
--}
--
--nsresult NS_NewURI(
--    nsIURI **result, const nsAString &spec, NotNull<const Encoding *> encoding,
--    nsIURI *baseURI /* = nullptr */,
--    nsIIOService
--        *ioService /* = nullptr */)  // pass in nsIIOService to optimize callers
--{
--  return NS_NewURI(result, NS_ConvertUTF16toUTF8(spec), encoding, baseURI,
--                   ioService);
-+  nsAutoCString spec;
-+  if (!AppendUTF16toUTF8(aSpec, spec, mozilla::fallible)) {
-+    return NS_ERROR_OUT_OF_MEMORY;
-+  }
-+  return NS_NewURI(result, spec, encoding, baseURI, ioService);
- }
- 
- nsresult NS_NewURI(
-     nsIURI **result, const char *spec, nsIURI *baseURI /* = nullptr */,
-     nsIIOService
-         *ioService /* = nullptr */)  // pass in nsIIOService to optimize callers
- {
-   return NS_NewURI(result, nsDependentCString(spec), nullptr, baseURI,

+ 0 - 47
rel-257/mozilla-esr60/patches/1445671-61a1.patch

@@ -1,47 +0,0 @@
-# HG changeset patch
-# User Dão Gottwald <dao@mozilla.com>
-# Date 1524567548 -7200
-# Node ID 7b8e832071f1c1b64d05dd597d692f4d4eb0866e
-# Parent  b5a845e976b6cf54fbfc88abdfb45d8da3cf628e
-Bug 1445671 - Stop using -moz-font-smoothing-background-color for the selected tab when using a lightweight theme. r=mstange
-
-MozReview-Commit-ID: 32ZrF86Xeon
-
-diff --git a/browser/themes/osx/browser.css b/browser/themes/osx/browser.css
---- a/browser/themes/osx/browser.css
-+++ b/browser/themes/osx/browser.css
-@@ -754,17 +754,17 @@ html|input.urlbar-input {
- :root:-moz-any([inFullscreen], [tabsintitlebar]) #TabsToolbar:not(:-moz-lwtheme) {
-   -moz-appearance: -moz-mac-vibrant-titlebar-dark;
-   -moz-font-smoothing-background-color: -moz-mac-vibrant-titlebar-dark;
-   background-color: #232323;
-   color: hsl(240, 9%, 98%);
-   text-shadow: none;
- }
- 
--.tabbrowser-tab[visuallyselected=true] {
-+.tabbrowser-tab[visuallyselected=true]:not(:-moz-lwtheme) {
-   -moz-font-smoothing-background-color: var(--toolbar-bgcolor);
- }
- 
- #tabbrowser-tabs {
-   -moz-box-align: stretch;
- }
- 
- /**
-diff --git a/browser/themes/osx/compacttheme.css b/browser/themes/osx/compacttheme.css
---- a/browser/themes/osx/compacttheme.css
-+++ b/browser/themes/osx/compacttheme.css
-@@ -8,8 +8,12 @@
- #main-window[tabsintitlebar] #titlebar-content {
-   background: var(--chrome-background-color);
- }
- 
- #TabsToolbar:-moz-lwtheme-darktext {
-   -moz-appearance: -moz-mac-vibrant-titlebar-light;
-   -moz-font-smoothing-background-color: -moz-mac-vibrant-titlebar-light;
- }
-+
-+.tabbrowser-tab[visuallyselected=true] {
-+  -moz-font-smoothing-background-color: var(--toolbar-bgcolor);
-+}

+ 0 - 104
rel-257/mozilla-esr60/patches/1446809-1-61a1.patch

@@ -1,104 +0,0 @@
-# HG changeset patch
-# User Sylvestre Ledru <sledru@mozilla.com>
-# Date 1521397625 -3600
-# Node ID 3dedc3e974318acc9b72fc89d8ce77217c467f21
-# Parent  24a247584c0648db30cb725558d491fd12aef4cc
-Bug 1446809 - Remove some b2g leftover in desktop/ r=florian
-
-MozReview-Commit-ID: FPwAZmpoiUV
-
-diff --git a/browser/components/BrowserComponents.manifest b/browser/components/BrowserComponents.manifest
---- a/browser/components/BrowserComponents.manifest
-+++ b/browser/components/BrowserComponents.manifest
-@@ -24,21 +24,19 @@ category command-line-handler x-default 
- category command-line-validator b-browser @mozilla.org/browser/clh;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
- 
- # nsBrowserGlue.js
- 
- # This component must restrict its registration for the app-startup category
- # to the specific list of apps that use it so it doesn't get loaded in xpcshell.
- # Thus we restrict it to these apps:
- #
--#   b2g:            {3c2e2abc-06d4-11e1-ac3b-374f68613e61}
- #   browser:        {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
- #   mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
- #   mobile/xul:     {a23983c0-fd0e-11dc-95ff-0800200c9a66}
--#   graphene:       {d1bfe7d9-c01e-4237-998b-7b5f960a4314}
- 
- component {eab9012e-5f74-4cbc-b2b5-a590235513cc} nsBrowserGlue.js
- contract @mozilla.org/browser/browserglue;1 {eab9012e-5f74-4cbc-b2b5-a590235513cc}
--category app-startup nsBrowserGlue service,@mozilla.org/browser/browserglue;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={d1bfe7d9-c01e-4237-998b-7b5f960a4314}
-+category app-startup nsBrowserGlue service,@mozilla.org/browser/browserglue;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
- component {d8903bf6-68d5-4e97-bcd1-e4d3012f721a} nsBrowserGlue.js
- #ifndef MOZ_MULET
- contract @mozilla.org/content-permission/prompt;1 {d8903bf6-68d5-4e97-bcd1-e4d3012f721a}
- #endif
-diff --git a/browser/components/feeds/BrowserFeeds.manifest b/browser/components/feeds/BrowserFeeds.manifest
---- a/browser/components/feeds/BrowserFeeds.manifest
-+++ b/browser/components/feeds/BrowserFeeds.manifest
-@@ -1,21 +1,19 @@
- # This component must restrict its registration for the app-startup category
- # to the specific list of apps that use it so it doesn't get loaded in xpcshell.
- # Thus we restrict it to these apps:
- #
--#   b2g:            {3c2e2abc-06d4-11e1-ac3b-374f68613e61}
- #   browser:        {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
- #   mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
- #   mobile/xul:     {a23983c0-fd0e-11dc-95ff-0800200c9a66}
--#   graphene:       {d1bfe7d9-c01e-4237-998b-7b5f960a4314}
- 
- component {229fa115-9412-4d32-baf3-2fc407f76fb1} FeedConverter.js
- contract @mozilla.org/streamconv;1?from=application/vnd.mozilla.maybe.feed&to=*/* {229fa115-9412-4d32-baf3-2fc407f76fb1}
- contract @mozilla.org/streamconv;1?from=application/vnd.mozilla.maybe.video.feed&to=*/* {229fa115-9412-4d32-baf3-2fc407f76fb1}
- contract @mozilla.org/streamconv;1?from=application/vnd.mozilla.maybe.audio.feed&to=*/* {229fa115-9412-4d32-baf3-2fc407f76fb1}
- component {2376201c-bbc6-472f-9b62-7548040a61c6} FeedConverter.js
- contract @mozilla.org/browser/feeds/result-service;1 {2376201c-bbc6-472f-9b62-7548040a61c6}
- component {49bb6593-3aff-4eb3-a068-2712c28bd58e} FeedWriter.js
- contract @mozilla.org/browser/feeds/result-writer;1 {49bb6593-3aff-4eb3-a068-2712c28bd58e}
- component {792a7e82-06a0-437c-af63-b2d12e808acc} WebContentConverter.js
- contract @mozilla.org/embeddor.implemented/web-content-handler-registrar;1 {792a7e82-06a0-437c-af63-b2d12e808acc}
--category app-startup WebContentConverter service,@mozilla.org/embeddor.implemented/web-content-handler-registrar;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={d1bfe7d9-c01e-4237-998b-7b5f960a4314}
-+category app-startup WebContentConverter service,@mozilla.org/embeddor.implemented/web-content-handler-registrar;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
-diff --git a/browser/components/sessionstore/nsSessionStore.manifest b/browser/components/sessionstore/nsSessionStore.manifest
---- a/browser/components/sessionstore/nsSessionStore.manifest
-+++ b/browser/components/sessionstore/nsSessionStore.manifest
-@@ -1,15 +1,13 @@
- # This component must restrict its registration for the app-startup category
- # to the specific list of apps that use it so it doesn't get loaded in xpcshell.
- # Thus we restrict it to these apps:
- #
--#   b2g:            {3c2e2abc-06d4-11e1-ac3b-374f68613e61}
- #   browser:        {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
- #   mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
- #   mobile/xul:     {a23983c0-fd0e-11dc-95ff-0800200c9a66}
--#   graphene:       {d1bfe7d9-c01e-4237-998b-7b5f960a4314}
- 
- component {5280606b-2510-4fe0-97ef-9b5a22eafe6b} nsSessionStore.js
- contract @mozilla.org/browser/sessionstore;1 {5280606b-2510-4fe0-97ef-9b5a22eafe6b}
- component {ec7a6c20-e081-11da-8ad9-0800200c9a66} nsSessionStartup.js
- contract @mozilla.org/browser/sessionstartup;1 {ec7a6c20-e081-11da-8ad9-0800200c9a66}
--category app-startup nsSessionStartup service,@mozilla.org/browser/sessionstartup;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={d1bfe7d9-c01e-4237-998b-7b5f960a4314}
-+category app-startup nsSessionStartup service,@mozilla.org/browser/sessionstartup;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
-diff --git a/browser/experiments/docs/manifest.rst b/browser/experiments/docs/manifest.rst
---- a/browser/experiments/docs/manifest.rst
-+++ b/browser/experiments/docs/manifest.rst
-@@ -96,17 +96,17 @@ maxActiveSeconds
-    initial activation.
- 
-    This value only involves wall time, not browser activity or session time.
- 
- appName
-    Array of application names this experiment should run on.
- 
-    An application name comes from ``nsIXULAppInfo.name``. It is a value
--   like ``Firefox``, ``Fennec``, or `B2G`.
-+   like ``Firefox`` or ``Fennec``.
- 
-    The client should compare its application name against the members of
-    this array. If a match is found, the experiment is applicable.
- 
- minVersion
-    (optional) String version number of the minimum application version this
-    experiment should run on.
- 
-

+ 0 - 128
rel-257/mozilla-esr60/patches/1446809-2-61a1.patch

@@ -1,128 +0,0 @@
-# HG changeset patch
-# User Sylvestre Ledru <sledru@mozilla.com>
-# Date 1521539183 -3600
-# Node ID b909b93e90f9bdde2cefe9c09f55b0c8b68722ef
-# Parent  3dedc3e974318acc9b72fc89d8ce77217c467f21
-Bug 1446809 - Remove some b2g leftover in the build r=glandium
-
-MozReview-Commit-ID: EAXd3JmiL2Z
-
-diff --git a/build/docs/mozinfo.rst b/build/docs/mozinfo.rst
---- a/build/docs/mozinfo.rst
-+++ b/build/docs/mozinfo.rst
-@@ -58,17 +58,17 @@ bits
-    this key defined.
- 
-    Optional.
- 
- buildapp
-    The path to the XUL application being built.
- 
-    For desktop Firefox, this is ``browser``. For Fennec, it's
--   ``mobile/android``. For B2G, it's ``b2g``.
-+   ``mobile/android``.
- 
- crashreporter
-    Whether the crash reporter is enabled for this build.
- 
-    Values are ``true`` and ``false``.
- 
-    Always defined.
- 
-@@ -109,17 +109,17 @@ nightly_build
-    Whether this is a nightly build.
- 
-    Values are ``true`` and ``false``.
- 
-    Always defined.
- 
- os
-    The operating system the build is produced for. Values for tier-1
--   supported platforms are ``linux``, ``win``, ``mac``, ``b2g``, and
-+   supported platforms are ``linux``, ``win``, ``mac``, and
-    ``android``. For other platforms, the value is the lowercase version
-    of the ``OS_TARGET`` variable from ``config.status``.
- 
-    Always defined.
- 
- processor
-    Information about the processor architecture this build targets.
- 
-diff --git a/build/unix/mozconfig.linux b/build/unix/mozconfig.linux
---- a/build/unix/mozconfig.linux
-+++ b/build/unix/mozconfig.linux
-@@ -2,26 +2,17 @@ if [ "x$IS_NIGHTLY" = "xyes" ]; then
-   # Some nightlies (eg: Mulet) don't want these set.
-   MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
- fi
- 
- . "$topsrcdir/build/mozconfig.common"
- 
- TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
- 
--# some b2g desktop builds still happen on i686 machines, and the tooltool
--# toolchain is x86_64 only.
--# We also deal with valgrind builds here, they don't use tooltool manifests at
--# all yet.
--if [ -z "$no_tooltool" ]
--then
--  CC="$TOOLTOOL_DIR/gcc/bin/gcc"
--  CXX="$TOOLTOOL_DIR/gcc/bin/g++"
-+# We deal with valgrind builds here
-+CC="$TOOLTOOL_DIR/gcc/bin/gcc"
-+CXX="$TOOLTOOL_DIR/gcc/bin/g++"
- 
--  # We want to make sure we use binutils and other binaries in the tooltool
--  # package.
--  mk_add_options "export PATH=$TOOLTOOL_DIR/gcc/bin:$PATH"
--else
--  CC="/tools/gcc-4.7.3-0moz1/bin/gcc"
--  CXX="/tools/gcc-4.7.3-0moz1/bin/g++"
--fi
-+# We want to make sure we use binutils and other binaries in the tooltool
-+# package.
-+mk_add_options "export PATH=$TOOLTOOL_DIR/gcc/bin:$PATH"
- 
- . "$topsrcdir/build/unix/mozconfig.stdcxx"
-diff --git a/toolkit/nss.configure b/toolkit/nss.configure
---- a/toolkit/nss.configure
-+++ b/toolkit/nss.configure
-@@ -4,13 +4,13 @@
- # License, v. 2.0. If a copy of the MPL was not distributed with this
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
- 
- 
- # DBM support in NSS
- # ==============================================================
- @depends(build_project, '--help')
- def dbm_default(build_project, _):
--    return build_project not in ('mobile/android', 'b2g', 'b2g/graphene')
-+    return build_project != 'mobile/android'
- 
- option('--enable-dbm', default=dbm_default, help='Enable building DBM')
- 
- set_config('NSS_DISABLE_DBM', depends('--enable-dbm')(lambda x: not x))
-diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild
---- a/toolkit/toolkit.mozbuild
-+++ b/toolkit/toolkit.mozbuild
-@@ -36,18 +36,17 @@ if CONFIG['ENABLE_TESTS']:
- DIRS += [
-     '/toolkit/library/rust',
- ]
- 
- if CONFIG['MOZ_SANDBOX']:
-     DIRS += ['/security/sandbox']
- 
- DIRS += [
--    # Depends on NSS and NSPR, and must be built after sandbox or else B2G emulator
--    # builds fail.
-+    # Depends on NSS and NSPR
-     '/security/certverifier',
-     # Depends on certverifier
-     '/security/apps',
- ]
- 
- # the signing related bits of libmar depend on nss
- if CONFIG['MOZ_UPDATER']:
-     DIRS += ['/modules/libmar']
-

+ 0 - 64
rel-257/mozilla-esr60/patches/1446809-3-61a1.patch

@@ -1,64 +0,0 @@
-# HG changeset patch
-# User Sylvestre Ledru <sledru@mozilla.com>
-# Date 1521577226 -3600
-# Node ID db5c66fc744811eb8984b8b98e8d990145374755
-# Parent  b909b93e90f9bdde2cefe9c09f55b0c8b68722ef
-Bug 1446809 - Remove some b2g leftover in the testing/mozbase r=jgraham
-
-MozReview-Commit-ID: 6PGuSXVjMB9
-
-diff --git a/testing/mozbase/moztest/tests/test.py b/testing/mozbase/moztest/tests/test.py
---- a/testing/mozbase/moztest/tests/test.py
-+++ b/testing/mozbase/moztest/tests/test.py
-@@ -36,25 +36,24 @@ class Result(unittest.TestCase):
- 
- 
- class Collection(unittest.TestCase):
- 
-     def setUp(self):
-         c1 = TestContext('host1')
-         c2 = TestContext('host2')
-         c3 = TestContext('host2')
--        c3.os = 'B2G'
-         c4 = TestContext('host1')
- 
-         t1 = TestResult('t1', context=c1)
-         t2 = TestResult('t2', context=c2)
-         t3 = TestResult('t3', context=c3)
-         t4 = TestResult('t4', context=c4)
- 
-         self.collection = TestResultCollection('tests')
-         self.collection.extend([t1, t2, t3, t4])
- 
-     def test_unique_contexts(self):
--        self.assertEqual(len(self.collection.contexts), 3)
-+        self.assertEqual(len(self.collection.contexts), 2)
- 
- 
- if __name__ == '__main__':
-     mozunit.main()
-diff --git a/testing/mozbase/mozversion/tests/manifest.ini b/testing/mozbase/mozversion/tests/manifest.ini
---- a/testing/mozbase/mozversion/tests/manifest.ini
-+++ b/testing/mozbase/mozversion/tests/manifest.ini
-@@ -1,6 +1,5 @@
- [DEFAULT]
- subsuite = mozbase, os == "linux"
- [test_binary.py]
- [test_sources.py]
--[test_b2g.py]
- [test_apk.py]
-diff --git a/testing/mozbase/packages.txt b/testing/mozbase/packages.txt
---- a/testing/mozbase/packages.txt
-+++ b/testing/mozbase/packages.txt
-@@ -1,10 +1,9 @@
- manifestparser.pth:testing/mozbase/manifestparser
--mozb2g.pth:testing/mozbase/mozb2g
- mozcrash.pth:testing/mozbase/mozcrash
- mozdebug.pth:testing/mozbase/mozdebug
- mozdevice.pth:testing/mozbase/mozdevice
- mozfile.pth:testing/mozbase/mozfile
- mozhttpd.pth:testing/mozbase/mozhttpd
- mozinfo.pth:testing/mozbase/mozinfo
- mozinstall.pth:testing/mozbase/mozinstall
- mozleak.pth:testing/mozbase/mozleak
-

+ 0 - 97
rel-257/mozilla-esr60/patches/1446809-4-61a1.patch

@@ -1,97 +0,0 @@
-# HG changeset patch
-# User Sylvestre Ledru <sledru@mozilla.com>
-# Date 1521397805 -3600
-# Node ID 2c827ac938dcbdd7224bb9bc0b2345eb82393d36
-# Parent  6419a201e2d9410ce725bbea4b739fa5816a8102
-Bug 1446809 - Remove some b2g leftover in widget/NativeKeyToDOMKeyName.h r=froydnj
-
-MozReview-Commit-ID: 7nRuHThygp1
-
-diff --git a/widget/NativeKeyToDOMKeyName.h b/widget/NativeKeyToDOMKeyName.h
---- a/widget/NativeKeyToDOMKeyName.h
-+++ b/widget/NativeKeyToDOMKeyName.h
-@@ -20,22 +20,18 @@
- #define KEY_MAP_WIN_JPN(aCPPKeyName, aNativeKey)
- #define KEY_MAP_WIN_KOR(aCPPKeyName, aNativeKey)
- #define KEY_MAP_WIN_OTH(aCPPKeyName, aNativeKey)
- #define KEY_MAP_WIN_CMD(aCPPKeyName, aAppCommand)
- // Mac OS X
- #define KEY_MAP_COCOA(aCPPKeyName, aNativeKey)
- // GTK
- #define KEY_MAP_GTK(aCPPKeyName, aNativeKey)
--// Android and B2G
-+// Only for Android
- #define KEY_MAP_ANDROID(aCPPKeyName, aNativeKey)
--// Only for Android
--#define KEY_MAP_ANDROID_EXCEPT_B2G(aCPPKeyName, aNativeKey)
--// Only for B2G
--#define KEY_MAP_B2G(aCPPKeyName, aNativeKey)
- 
- #if defined(XP_WIN)
- #if defined(NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX)
- // KEY_MAP_WIN() defines the mapping not depending on keyboard layout.
- #undef KEY_MAP_WIN
- #define KEY_MAP_WIN(aCPPKeyName, aNativeKey) \
-   NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX(aNativeKey, KEY_NAME_INDEX_##aCPPKeyName)
- #elif defined(NS_JAPANESE_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX)
-@@ -74,19 +70,16 @@
- #elif defined(MOZ_WIDGET_GTK)
- #undef KEY_MAP_GTK
- #define KEY_MAP_GTK(aCPPKeyName, aNativeKey) \
-   NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX(aNativeKey, KEY_NAME_INDEX_##aCPPKeyName)
- #elif defined(ANDROID)
- #undef KEY_MAP_ANDROID
- #define KEY_MAP_ANDROID(aCPPKeyName, aNativeKey) \
-   NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX(aNativeKey, KEY_NAME_INDEX_##aCPPKeyName)
--#undef KEY_MAP_ANDROID_EXCEPT_B2G
--#define KEY_MAP_ANDROID_EXCEPT_B2G(aCPPKeyName, aNativeKey) \
--  NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX(aNativeKey, KEY_NAME_INDEX_##aCPPKeyName)
- #endif
- 
- /******************************************************************************
-  * Modifier Keys
-  ******************************************************************************/
- // Alt
- KEY_MAP_WIN(Alt, VK_MENU)
- KEY_MAP_WIN(Alt, VK_LMENU)
-@@ -1047,27 +1040,26 @@ KEY_MAP_ANDROID(AppSwitch, AKEYCODE_APP_
- 
- // Call
- KEY_MAP_ANDROID(Call, AKEYCODE_CALL)
- 
- // Camera
- KEY_MAP_ANDROID(Camera, AKEYCODE_CAMERA)
- 
- // CameraFocus
--KEY_MAP_ANDROID_EXCEPT_B2G(CameraFocus, AKEYCODE_FOCUS)
-+KEY_MAP_ANDROID(CameraFocus, AKEYCODE_FOCUS)
- 
- // EndCall
- KEY_MAP_ANDROID(EndCall, AKEYCODE_ENDCALL)
- 
- // GoBack
- KEY_MAP_ANDROID(GoBack, AKEYCODE_BACK)
- 
- // GoHome
--KEY_MAP_ANDROID_EXCEPT_B2G(GoHome, AKEYCODE_HOME)
--KEY_MAP_B2G(HomeScreen, AKEYCODE_HOME)
-+KEY_MAP_ANDROID(GoHome,     AKEYCODE_HOME)
- 
- // HeadsetHook
- KEY_MAP_ANDROID(HeadsetHook, AKEYCODE_HEADSETHOOK)
- 
- // Notification
- KEY_MAP_ANDROID(Notification, AKEYCODE_NOTIFICATION)
- 
- // MannerMode
-@@ -1280,10 +1272,8 @@ KEY_MAP_ANDROID(SoftRight, AKEYCODE_SOFT
- #undef KEY_MAP_WIN
- #undef KEY_MAP_WIN_JPN
- #undef KEY_MAP_WIN_KOR
- #undef KEY_MAP_WIN_OTH
- #undef KEY_MAP_WIN_CMD
- #undef KEY_MAP_COCOA
- #undef KEY_MAP_GTK
- #undef KEY_MAP_ANDROID
--#undef KEY_MAP_ANDROID_EXCEPT_B2G
--#undef KEY_MAP_B2G

+ 0 - 44
rel-257/mozilla-esr60/patches/1446809-5-61a1.patch

@@ -1,44 +0,0 @@
-# HG changeset patch
-# User Sylvestre Ledru <sledru@mozilla.com>
-# Date 1521397856 -3600
-# Node ID b2647d006cf4fe5d7147ef1eda48c93d54a7af5a
-# Parent  2c827ac938dcbdd7224bb9bc0b2345eb82393d36
-Bug 1446809 - Remove some b2g leftover in the devtools doc r=jdescottes
-
-MozReview-Commit-ID: L6CYiizDSwF
-
-diff --git a/devtools/docs/backend/actor-registration.md b/devtools/docs/backend/actor-registration.md
---- a/devtools/docs/backend/actor-registration.md
-+++ b/devtools/docs/backend/actor-registration.md
-@@ -1,17 +1,17 @@
- # How to register an actor
- 
- ## Tab actors vs. global actors
- 
- Tab actors are the most common types of actors. That's the type of actors you will most probably be adding.
- 
--Tab actors target a document, this could be a tab in Firefox, an app on B2G or a remote document in Firefox for Android/Safari/Chrome for Android (via Valence).
-+Tab actors target a document, this could be a tab in Firefox or a remote document in Firefox for Android/Safari/Chrome for Android (via Valence).
- 
--Global actors however are for the rest, for things not related to any particular document but instead for things global to the whole Firefox/B2G/Chrome/Safari intance the toolbox is connected to (e.g. the preference actor).
-+Global actors however are for the rest, for things not related to any particular document but instead for things global to the whole Firefox/Chrome/Safari intance the toolbox is connected to (e.g. the preference actor).
- 
- ## The DebuggerServer.registerModule function
- 
- To register a tab actor:
- 
- ```
- DebuggerServer.registerModule("devtools/server/actors/webconsole", {
-   prefix: "console",
-@@ -33,9 +33,9 @@ DebuggerServer.registerModule("devtools/
- If you are adding a new built-in devtools actor, you should be registering it using `DebuggerServer.registerModule` in `_addBrowserActors` or `addTabActors` in `/devtools/server/main.js`.
- 
- If you are adding a new actor from an add-on, you should call `DebuggerServer.registerModule` directly from your add-on code.
- 
- ## A note about lazy registration
- 
- The `DebuggerServer` loads and creates all of the actors lazily to keep the initial memory usage down (which is extremely important on lower end devices).
- 
--It becomes especially important when debugging apps on b2g or pages with e10s when there are more than one process, because that's when we need to spawn a `DebuggerServer` per process (it may not be immediately obvious that the server in the main process is mostly only here for piping messages to the actors in the child process).
-+It becomes especially important when debugging pages with e10s when there are more than one process, because that's when we need to spawn a `DebuggerServer` per process (it may not be immediately obvious that the server in the main process is mostly only here for piping messages to the actors in the child process).
-

+ 0 - 255
rel-257/mozilla-esr60/patches/1446809-6-61a1.patch

@@ -1,255 +0,0 @@
-# HG changeset patch
-# User Sylvestre Ledru <sledru@mozilla.com>
-# Date 1521397922 -3600
-# Node ID 4ab35ba9af3d26556b17a54f0e451b30dfd5a88a
-# Parent  b2647d006cf4fe5d7147ef1eda48c93d54a7af5a
-Bug 1446809 - Remove some b2g leftover in some webgl tests r=jgilbert
-
-MozReview-Commit-ID: Etx3KYygQgl
-
-diff --git a/dom/canvas/test/webgl-conf/generated-mochitest.ini b/dom/canvas/test/webgl-conf/generated-mochitest.ini
---- a/dom/canvas/test/webgl-conf/generated-mochitest.ini
-+++ b/dom/canvas/test/webgl-conf/generated-mochitest.ini
-@@ -1,15 +1,15 @@
- # This is a GENERATED FILE. Do not edit it directly.
- # Regenerated it by using `python generate-wrappers-and-manifest.py`.
- # Mark failing (fail-if) and crashing (skip-if) tests in mochitest-errata.ini.
- 
- [DEFAULT]
- subsuite = webgl
--skip-if = os == 'b2g' || ((os == 'linux') && (buildapp == 'mulet'))
-+skip-if = (os == 'linux') && (buildapp == 'mulet')
- 
- support-files = always-fail.html
-                 checkout/00_test_list.txt
-                 checkout/CONFORMANCE_RULES.txt
-                 checkout/README.md
-                 checkout/closure-library/AUTHORS
-                 checkout/closure-library/CONTRIBUTING
-                 checkout/closure-library/LICENSE
-@@ -7532,17 +7532,17 @@ skip-if = (os == 'mac')
- skip-if = (os == 'android')
- [generated/test_conformance__canvas__texture-bindings-unaffected-on-resize.html]
- [generated/test_conformance__canvas__to-data-url-test.html]
- [generated/test_conformance__canvas__viewport-unchanged-upon-resize.html]
- skip-if = (os == 'mac')
- [generated/test_conformance__context__constants-and-properties.html]
- [generated/test_conformance__context__context-attribute-preserve-drawing-buffer.html]
- [generated/test_conformance__context__context-attributes-alpha-depth-stencil-antialias.html]
--skip-if = (os == 'b2g') || (os == 'linux') || (os == 'android')
-+skip-if = (os == 'linux') || (os == 'android')
- fail-if = (os == 'mac' && os_version == '10.6')
- [generated/test_conformance__context__context-creation-and-destruction.html]
- [generated/test_conformance__context__context-creation.html]
- skip-if = (os == 'android')
- [generated/test_conformance__context__context-eviction-with-garbage-collection.html]
- skip-if = (os == 'android')
- [generated/test_conformance__context__context-hidden-alpha.html]
- [generated/test_conformance__context__context-lost-restored.html]
-@@ -7926,22 +7926,20 @@ fail-if = (os == 'android')
- [generated/test_conformance__glsl__misc__struct-specifiers-in-uniforms.html]
- [generated/test_conformance__glsl__misc__struct-unary-operators.html]
- [generated/test_conformance__glsl__misc__ternary-operator-on-arrays.html]
- [generated/test_conformance__glsl__misc__ternary-operators-in-global-initializers.html]
- [generated/test_conformance__glsl__misc__ternary-operators-in-initializers.html]
- [generated/test_conformance__glsl__misc__uniform-location-length-limits.html]
- [generated/test_conformance__glsl__reserved___webgl_field.vert.html]
- [generated/test_conformance__glsl__reserved___webgl_function.vert.html]
--fail-if = (os == 'b2g')
- [generated/test_conformance__glsl__reserved___webgl_struct.vert.html]
- [generated/test_conformance__glsl__reserved___webgl_variable.vert.html]
- [generated/test_conformance__glsl__reserved__webgl_field.vert.html]
- [generated/test_conformance__glsl__reserved__webgl_function.vert.html]
--fail-if = (os == 'b2g')
- [generated/test_conformance__glsl__reserved__webgl_struct.vert.html]
- [generated/test_conformance__glsl__reserved__webgl_variable.vert.html]
- [generated/test_conformance__glsl__samplers__glsl-function-texture2d-bias.html]
- [generated/test_conformance__glsl__samplers__glsl-function-texture2dlod.html]
- [generated/test_conformance__glsl__samplers__glsl-function-texture2dproj.html]
- skip-if = (os == 'android')
- [generated/test_conformance__glsl__samplers__glsl-function-texture2dprojlod.html]
- skip-if = (os == 'android')
-@@ -7963,31 +7961,30 @@ skip-if = (os == 'linux')
- [generated/test_conformance__limits__gl-min-uniforms.html]
- [generated/test_conformance__misc__bad-arguments-test.html]
- skip-if = (os == 'mac') || (os == 'win') || (os == 'linux') || (os == 'android')
- [generated/test_conformance__misc__boolean-argument-conversion.html]
- skip-if = (os == 'android')
- [generated/test_conformance__misc__delayed-drawing.html]
- skip-if = (os == 'android' && android_version == '10')
- [generated/test_conformance__misc__error-reporting.html]
--fail-if = (os == 'b2g')
- [generated/test_conformance__misc__expando-loss.html]
- [generated/test_conformance__misc__functions-returning-strings.html]
- [generated/test_conformance__misc__instanceof-test.html]
- [generated/test_conformance__misc__invalid-passed-params.html]
- skip-if = (os == 'android') || (os == 'linux')
- [generated/test_conformance__misc__is-object.html]
- [generated/test_conformance__misc__null-object-behaviour.html]
- [generated/test_conformance__misc__object-deletion-behaviour.html]
- skip-if = (os == 'android' && debug)
- fail-if = (os == 'android')
- [generated/test_conformance__misc__shader-precision-format.html]
- skip-if = (os == 'android')
- [generated/test_conformance__misc__type-conversion-test.html]
--skip-if = (os == 'android') || (os == 'b2g') || (os == 'linux')
-+skip-if = (os == 'android') || (os == 'linux')
- fail-if = (os == 'linux')
- [generated/test_conformance__misc__uninitialized-test.html]
- skip-if = (os == 'android')
- [generated/test_conformance__misc__webgl-specific.html]
- [generated/test_conformance__more__conformance__constants.html]
- [generated/test_conformance__more__conformance__getContext.html]
- [generated/test_conformance__more__conformance__methods.html]
- [generated/test_conformance__more__conformance__quickCheckAPI-A.html]
-@@ -8203,17 +8200,16 @@ fail-if = (os == 'mac' && os_version == 
- [generated/test_conformance__ogles__GL__swizzlers__swizzlers_105_to_112.html]
- [generated/test_conformance__ogles__GL__swizzlers__swizzlers_113_to_120.html]
- [generated/test_conformance__ogles__GL__tan__tan_001_to_006.html]
- [generated/test_conformance__ogles__GL__vec3__vec3_001_to_008.html]
- [generated/test_conformance__ogles__GL__vec__vec_001_to_008.html]
- [generated/test_conformance__ogles__GL__vec__vec_009_to_016.html]
- [generated/test_conformance__ogles__GL__vec__vec_017_to_018.html]
- [generated/test_conformance__programs__get-active-test.html]
--fail-if = (os == 'b2g')
- [generated/test_conformance__programs__gl-bind-attrib-location-long-names-test.html]
- [generated/test_conformance__programs__gl-bind-attrib-location-test.html]
- [generated/test_conformance__programs__gl-get-active-attribute.html]
- [generated/test_conformance__programs__gl-get-active-uniform.html]
- [generated/test_conformance__programs__gl-getshadersource.html]
- [generated/test_conformance__programs__gl-shader-test.html]
- [generated/test_conformance__programs__invalid-UTF-16.html]
- [generated/test_conformance__programs__program-infolog.html]
-diff --git a/dom/canvas/test/webgl-conf/mochitest-errata.ini b/dom/canvas/test/webgl-conf/mochitest-errata.ini
---- a/dom/canvas/test/webgl-conf/mochitest-errata.ini
-+++ b/dom/canvas/test/webgl-conf/mochitest-errata.ini
-@@ -18,19 +18,18 @@
- #   https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832%28v=vs.85%29.aspx
- #   * Windows 7: 6.1
- #   * Windows 8: 6.2
- #   * Windows 8.1: 6.3
- #   * Windows 10: 10.0
- 
- [DEFAULT]
- subsuite = webgl
--# Skip B2G for now, until we get a handle on the longer tail of emulator bugs.
- # Bug 1136181 disabled on Mulet for intermittent failures
--skip-if = os == 'b2g' || ((os == 'linux') && (buildapp == 'mulet'))
-+skip-if = (os == 'linux') && (buildapp == 'mulet')
- 
- [generated/test_..__always-fail.html]
- fail-if = 1
- 
- ####################
- # Tests requesting non-local network connections.
- 
- [generated/test_conformance__more__functions__readPixelsBadArgs.html]
-@@ -71,18 +70,18 @@ skip-if = (os == 'android') || (os == 'l
- # Timeout on D3D11
- skip-if = (os == 'win')
- 
- ########################################################################
- # Complicated
- 
- [generated/test_conformance__context__context-attributes-alpha-depth-stencil-antialias.html]
- fail-if = (os == 'mac' && os_version == '10.6')
--# Asserts on 'B2G ICS Emulator Debug' and linux debug. Crashes on Android.
--skip-if = (os == 'b2g') || (os == 'linux') || (os == 'android')
-+# Asserts on linux debug. Crashes on Android.
-+skip-if = (os == 'linux') || (os == 'android')
- 
- [generated/test_conformance__extensions__webgl-draw-buffers.html]
- # Crashes
- skip-if = (os == 'linux')
- 
- [generated/test_conformance__glsl__constructors__glsl-construct-bvec3.html]
- # Crashes from libglsl.so
- # application crashed [@ jemalloc_crash] on Android
-@@ -107,18 +106,18 @@ skip-if = ((os == 'linux') && asan)
- [generated/test_conformance__glsl__bugs__sampler-array-using-loop-index.html]
- # Testfail on Linux after removing SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX.
- # Only happen on tryserver
- fail-if = (os == 'linux')
- 
- [generated/test_conformance__misc__type-conversion-test.html]
- fail-if = (os == 'linux')
- # Resets device on Android 2.3.
--# Crashes on B2G ICS Emulator, desktop Linux, and Mulet Linux x64.
--skip-if = (os == 'android') || (os == 'b2g') || (os == 'linux')
-+# Crashes on desktop Linux, and Mulet Linux x64.
-+skip-if = (os == 'android') || (os == 'linux')
- 
- [generated/test_conformance__misc__object-deletion-behaviour.html]
- fail-if = (os == 'android')
- # void mozilla::gl::GLContext::fDetachShader(GLuint, GLuint): Generated unexpected GL_INVALID_VALUE error. (0x0501)
- skip-if = (os == 'android' && debug)
- 
- [generated/test_conformance__extensions__oes-vertex-array-object.html]
- fail-if = (os == 'mac') || (os == 'linux') || (os == 'win')
-@@ -333,36 +332,34 @@ fail-if = (os == 'mac') || (os == 'win')
- [generated/test_2_conformance__textures__video__tex-2d-rgba-rgba-unsigned_byte.html]
- fail-if = (os == 'mac') || (os == 'win')
- [generated/test_2_conformance__textures__video__tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html]
- fail-if = (os == 'mac') || (os == 'win')
- [generated/test_2_conformance__textures__video__tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html]
- fail-if = (os == 'mac') || (os == 'win')
- ########################################################################
- # "tst-linux{32,64}-spot-NNN" Slaves:
--#   Android 2.3, B2G Emu, Linux, and Mulet.
-+#   Android 2.3, Linux, and Mulet.
- # Android: os == 'android'. (Not enough info to separate out 2.3)
--# B2G Emu: os == 'b2g'.
- # Linux: os == 'linux'.
--# Mulet: os == 'b2g' && buildapp == 'mulet'.
-+# Mulet: buildapp == 'mulet'.
- [generated/test_conformance__glsl__bugs__temp-expressions-should-not-crash.html]
- # Coincidentally enough, crashes on Linux and Android 4.0.
- skip-if = (os == 'android') || (os == 'linux')
- [generated/test_conformance__misc__invalid-passed-params.html]
- # Causes consistent *blues*: "DMError: Remote Device Error: unable to
- # connect to 127.0.0.1 after 5 attempts" on 'Android 2.3 Opt'.
- skip-if = (os == 'android') || (os == 'linux')
- [generated/test_conformance__ogles__GL__functions__functions_001_to_008.html]
- fail-if = (os == 'android')
- [generated/test_conformance__ogles__GL__sin__sin_001_to_006.html]
- fail-if = (os == 'android')
- [generated/test_conformance__reading__read-pixels-test.html]
- # Causes consistent *blues*: "DMError: Remote Device Error: unable to
- # connect to 127.0.0.1 after 5 attempts" on 'Android 2.3 Opt'.
--# Crashes near on B2G ICS Emulator.
- skip-if = (os == 'android') || (os == 'linux')
- [generated/test_conformance__textures__misc__texture-upload-size.html]
- # application crashed [@ mozilla::WebGLTexture::TexSubImage]
- skip-if = (os == 'win') || (os == 'android')
- 
- ########################################################################
- ########################################################################
- # Android
-@@ -578,26 +575,20 @@ skip-if = (os == 'android')
- # Crashes
- skip-if = (os == 'android')
- [generated/test_conformance__renderbuffers__framebuffer-object-attachment.html]
- # Crashes
- skip-if = (os == 'android')
- 
- ########################################################################
- ########################################################################
--# B2G
- [generated/test_conformance__glsl__reserved___webgl_function.vert.html]
--fail-if = (os == 'b2g')
- [generated/test_conformance__glsl__reserved__webgl_function.vert.html]
--fail-if = (os == 'b2g')
- [generated/test_conformance__misc__error-reporting.html]
--fail-if = (os == 'b2g')
- [generated/test_conformance__programs__get-active-test.html]
--fail-if = (os == 'b2g')
--
- 
- ########################################################################
- ########################################################################
- # Linux
- [generated/test_conformance__glsl__constructors__glsl-construct-vec-mat-corner-cases.html]
- # mozalloc_abort in libglsl.so
- skip-if = (os == 'linux')
- [generated/test_conformance__glsl__constructors__glsl-construct-vec3.html]
-

+ 0 - 33
rel-257/mozilla-esr60/patches/1446809-7-61a1.patch

@@ -1,33 +0,0 @@
-# HG changeset patch
-# User Sylvestre Ledru <sledru@mozilla.com>
-# Date 1521397984 -3600
-# Node ID c37d8315a391f97e8ee4d30d1ca9735e51ddf61a
-# Parent  4ab35ba9af3d26556b17a54f0e451b30dfd5a88a
-Bug 1446809 - Remove some b2g leftover in a service worker test r=florian
-
-MozReview-Commit-ID: EOLOB3Fe35X
-
-diff --git a/dom/cache/test/mochitest/serviceworker_driver.js b/dom/cache/test/mochitest/serviceworker_driver.js
---- a/dom/cache/test/mochitest/serviceworker_driver.js
-+++ b/dom/cache/test/mochitest/serviceworker_driver.js
-@@ -1,19 +1,12 @@
- // Any copyright is dedicated to the Public Domain.
- // http://creativecommons.org/publicdomain/zero/1.0/
- 
- function serviceWorkerTestExec(testFile) {
--  var isB2G = !navigator.userAgent.includes("Android") &&
--              /Mobile|Tablet/.test(navigator.userAgent);
--  if (isB2G) {
--    // TODO B2G doesn't support running service workers for now due to bug 1137683.
--    dump("Skipping running the test in SW until bug 1137683 gets fixed.\n");
--    return Promise.resolve();
--  }
-   return new Promise(function(resolve, reject) {
-     function setupSW(registration) {
-       var worker = registration.waiting ||
-                    registration.active;
- 
-       window.addEventListener("message",function onMessage(event) {
-         if (event.data.context != "ServiceWorker") {
-           return;
-

+ 0 - 140
rel-257/mozilla-esr60/patches/1446809-8-61a1.patch

@@ -1,140 +0,0 @@
-# HG changeset patch
-# User Sylvestre Ledru <sledru@mozilla.com>
-# Date 1521452597 -3600
-# Node ID 613729ea03d7cd8be60299086a2e4dd1f4431962
-# Parent  29f30bc08ca7b6f27e074e1b6134f5deb2dce227
-Bug 1446809 - Ride along: also remove some mobile/xul/ legacy declaration r=florian
-
-MozReview-Commit-ID: 102syxweBN3
-
-diff --git a/accessible/jsat/Utils.jsm b/accessible/jsat/Utils.jsm
---- a/accessible/jsat/Utils.jsm
-+++ b/accessible/jsat/Utils.jsm
-@@ -24,18 +24,17 @@ ChromeUtils.defineModuleGetter(this, "Pl
- 
- var EXPORTED_SYMBOLS = ["Utils", "Logger", "PivotContext", "PrefCache"]; // jshint ignore:line
- 
- var Utils = { // jshint ignore:line
-   _buildAppMap: {
-     "{3c2e2abc-06d4-11e1-ac3b-374f68613e61}": "b2g",
-     "{d1bfe7d9-c01e-4237-998b-7b5f960a4314}": "graphene",
-     "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": "browser",
--    "{aa3c5121-dab2-40e2-81ca-7ea25febc110}": "mobile/android",
--    "{a23983c0-fd0e-11dc-95ff-0800200c9a66}": "mobile/xul"
-+    "{aa3c5121-dab2-40e2-81ca-7ea25febc110}": "mobile/android"
-   },
- 
-   init: function Utils_init(aWindow) {
-     if (this._win) {
-       // XXX: only supports attaching to one window now.
-       throw new Error("Only one top-level window could used with AccessFu");
-     }
-     this._win = Cu.getWeakReference(aWindow);
-diff --git a/browser/components/BrowserComponents.manifest b/browser/components/BrowserComponents.manifest
---- a/browser/components/BrowserComponents.manifest
-+++ b/browser/components/BrowserComponents.manifest
-@@ -26,17 +26,16 @@ category command-line-validator b-browse
- # nsBrowserGlue.js
- 
- # This component must restrict its registration for the app-startup category
- # to the specific list of apps that use it so it doesn't get loaded in xpcshell.
- # Thus we restrict it to these apps:
- #
- #   browser:        {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
- #   mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
--#   mobile/xul:     {a23983c0-fd0e-11dc-95ff-0800200c9a66}
- 
- component {eab9012e-5f74-4cbc-b2b5-a590235513cc} nsBrowserGlue.js
- contract @mozilla.org/browser/browserglue;1 {eab9012e-5f74-4cbc-b2b5-a590235513cc}
--category app-startup nsBrowserGlue service,@mozilla.org/browser/browserglue;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
-+category app-startup nsBrowserGlue service,@mozilla.org/browser/browserglue;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110}
- component {d8903bf6-68d5-4e97-bcd1-e4d3012f721a} nsBrowserGlue.js
- #ifndef MOZ_MULET
- contract @mozilla.org/content-permission/prompt;1 {d8903bf6-68d5-4e97-bcd1-e4d3012f721a}
- #endif
-diff --git a/browser/components/feeds/BrowserFeeds.manifest b/browser/components/feeds/BrowserFeeds.manifest
---- a/browser/components/feeds/BrowserFeeds.manifest
-+++ b/browser/components/feeds/BrowserFeeds.manifest
-@@ -1,19 +1,18 @@
- # This component must restrict its registration for the app-startup category
- # to the specific list of apps that use it so it doesn't get loaded in xpcshell.
- # Thus we restrict it to these apps:
- #
- #   browser:        {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
- #   mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
--#   mobile/xul:     {a23983c0-fd0e-11dc-95ff-0800200c9a66}
- 
- component {229fa115-9412-4d32-baf3-2fc407f76fb1} FeedConverter.js
- contract @mozilla.org/streamconv;1?from=application/vnd.mozilla.maybe.feed&to=*/* {229fa115-9412-4d32-baf3-2fc407f76fb1}
- contract @mozilla.org/streamconv;1?from=application/vnd.mozilla.maybe.video.feed&to=*/* {229fa115-9412-4d32-baf3-2fc407f76fb1}
- contract @mozilla.org/streamconv;1?from=application/vnd.mozilla.maybe.audio.feed&to=*/* {229fa115-9412-4d32-baf3-2fc407f76fb1}
- component {2376201c-bbc6-472f-9b62-7548040a61c6} FeedConverter.js
- contract @mozilla.org/browser/feeds/result-service;1 {2376201c-bbc6-472f-9b62-7548040a61c6}
- component {49bb6593-3aff-4eb3-a068-2712c28bd58e} FeedWriter.js
- contract @mozilla.org/browser/feeds/result-writer;1 {49bb6593-3aff-4eb3-a068-2712c28bd58e}
- component {792a7e82-06a0-437c-af63-b2d12e808acc} WebContentConverter.js
- contract @mozilla.org/embeddor.implemented/web-content-handler-registrar;1 {792a7e82-06a0-437c-af63-b2d12e808acc}
--category app-startup WebContentConverter service,@mozilla.org/embeddor.implemented/web-content-handler-registrar;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
-+category app-startup WebContentConverter service,@mozilla.org/embeddor.implemented/web-content-handler-registrar;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110}
-diff --git a/browser/components/sessionstore/nsSessionStore.manifest b/browser/components/sessionstore/nsSessionStore.manifest
---- a/browser/components/sessionstore/nsSessionStore.manifest
-+++ b/browser/components/sessionstore/nsSessionStore.manifest
-@@ -1,13 +1,12 @@
- # This component must restrict its registration for the app-startup category
- # to the specific list of apps that use it so it doesn't get loaded in xpcshell.
- # Thus we restrict it to these apps:
- #
- #   browser:        {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
- #   mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
--#   mobile/xul:     {a23983c0-fd0e-11dc-95ff-0800200c9a66}
- 
- component {5280606b-2510-4fe0-97ef-9b5a22eafe6b} nsSessionStore.js
- contract @mozilla.org/browser/sessionstore;1 {5280606b-2510-4fe0-97ef-9b5a22eafe6b}
- component {ec7a6c20-e081-11da-8ad9-0800200c9a66} nsSessionStartup.js
- contract @mozilla.org/browser/sessionstartup;1 {ec7a6c20-e081-11da-8ad9-0800200c9a66}
--category app-startup nsSessionStartup service,@mozilla.org/browser/sessionstartup;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
-+category app-startup nsSessionStartup service,@mozilla.org/browser/sessionstartup;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110}
-diff --git a/devtools/shared/system.js b/devtools/shared/system.js
---- a/devtools/shared/system.js
-+++ b/devtools/shared/system.js
-@@ -35,18 +35,17 @@ loader.lazyGetter(this, "endianness", ()
- });
- 
- const APP_MAP = {
-   "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": "firefox",
-   "{3550f703-e582-4d05-9a08-453d09bdfdc6}": "thunderbird",
-   "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}": "seamonkey",
-   "{718e30fb-e89b-41dd-9da7-e25a45638b28}": "sunbird",
-   "{3c2e2abc-06d4-11e1-ac3b-374f68613e61}": "b2g",
--  "{aa3c5121-dab2-40e2-81ca-7ea25febc110}": "mobile/android",
--  "{a23983c0-fd0e-11dc-95ff-0800200c9a66}": "mobile/xul"
-+  "{aa3c5121-dab2-40e2-81ca-7ea25febc110}": "mobile/android"
- };
- 
- var CACHED_INFO = null;
- 
- async function getSystemInfo() {
-   if (CACHED_INFO) {
-     return CACHED_INFO;
-   }
-diff --git a/mobile/android/modules/FormAssistant.jsm b/mobile/android/modules/FormAssistant.jsm
---- a/mobile/android/modules/FormAssistant.jsm
-+++ b/mobile/android/modules/FormAssistant.jsm
-@@ -230,17 +230,16 @@ var FormAssistant = {
-     };
- 
-     this._formAutoCompleteService.autoCompleteSearchAsync(aElement.name || aElement.id,
-                                                           aSearchString, aElement, null,
-                                                           null, resultsAvailable);
-   },
- 
-   /**
--   * (Copied from mobile/xul/chrome/content/forms.js)
-    * This function is similar to getListSuggestions from
-    * components/satchel/src/nsInputListAutoComplete.js but sadly this one is
-    * used by the autocomplete.xml binding which is not in used in fennec
-    */
-   _getListSuggestions: function(aElement) {
-     if (!(aElement instanceof Ci.nsIDOMHTMLInputElement) || !aElement.list) {
-       return [];
-     }

+ 0 - 119
rel-257/mozilla-esr60/patches/1446809-9-61a1.patch

@@ -1,119 +0,0 @@
-# HG changeset patch
-# User Sylvestre Ledru <sledru@mozilla.com>
-# Date 1521452729 -3600
-# Node ID 2ad7c7ea01be13997598d954528af7c12f70dd39
-# Parent  83b1bb8ef93475ebdd22eb8a75a49d9539a8a964
-Bug 1446809 - Remove some b2g leftover in devtools/shared/system.js r=jdescottes
-
-MozReview-Commit-ID: 1YlBPwjyWO2
-
-diff --git a/devtools/shared/system.js b/devtools/shared/system.js
---- a/devtools/shared/system.js
-+++ b/devtools/shared/system.js
-@@ -34,17 +34,16 @@ loader.lazyGetter(this, "endianness", ()
-   return "BE";
- });
- 
- const APP_MAP = {
-   "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": "firefox",
-   "{3550f703-e582-4d05-9a08-453d09bdfdc6}": "thunderbird",
-   "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}": "seamonkey",
-   "{718e30fb-e89b-41dd-9da7-e25a45638b28}": "sunbird",
--  "{3c2e2abc-06d4-11e1-ac3b-374f68613e61}": "b2g",
-   "{aa3c5121-dab2-40e2-81ca-7ea25febc110}": "mobile/android"
- };
- 
- var CACHED_INFO = null;
- 
- async function getSystemInfo() {
-   if (CACHED_INFO) {
-     return CACHED_INFO;
-@@ -62,32 +61,18 @@ async function getSystemInfo() {
-     os,
-     brandName;
-   let appid = appInfo.ID;
-   let apptype = APP_MAP[appid];
-   let geckoVersion = appInfo.platformVersion;
-   let hardware = "unknown";
-   let version = "unknown";
- 
--  // B2G specific
--  if (apptype === "b2g") {
--    os = "B2G";
--    // `getSetting` does not work in child processes on b2g.
--    // TODO bug 1205797, make this work in child processes.
--    try {
--      hardware = await exports.getSetting("deviceinfo.hardware");
--      version = await exports.getSetting("deviceinfo.os");
--    } catch (e) {
--      // Ignore.
--    }
--  } else {
--    // Not B2G
--    os = appInfo.OS;
--    version = appInfo.version;
--  }
-+  os = appInfo.OS;
-+  version = appInfo.version;
- 
-   let bundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
-   if (bundle) {
-     brandName = bundle.GetStringFromName("brandFullName");
-   } else {
-     brandName = null;
-   }
- 
-@@ -119,17 +104,16 @@ async function getSystemInfo() {
-     vendor: appInfo.vendor,
- 
-     // Name of the application, like "Firefox", "Thunderbird".
-     name: appInfo.name,
- 
-     // The application's version, for example "0.8.0+" or "3.7a1pre".
-     // Typically, the version of Firefox, for example.
-     // It is different than the version of Gecko or the XULRunner platform.
--    // On B2G, this is the Gaia version.
-     version,
- 
-     // The application's build ID/date, for example "2004051604".
-     appbuildid: appInfo.appBuildID,
- 
-     // The build ID/date of Gecko and the XULRunner platform.
-     platformbuildid: appInfo.platformBuildID,
-     geckobuildid: appInfo.platformBuildID,
-@@ -150,17 +134,16 @@ async function getSystemInfo() {
-     // Returns the endianness of the architecture: either "LE" or "BE"
-     endianness: endianness,
- 
-     // Returns the hostname of the machine
-     hostname: hostname,
- 
-     // Name of the OS type. Typically the same as `uname -s`. Possible values:
-     // https://developer.mozilla.org/en/OS_TARGET
--    // Also may be "B2G".
-     os,
-     platform: os,
- 
-     // hardware and version info from `deviceinfo.hardware`
-     // and `deviceinfo.os`.
-     hardware,
- 
-     // Type of process architecture running:
-@@ -298,17 +281,16 @@ function getOSCPU() {
- }
- 
- function getSetting(name) {
-   let deferred = defer();
- 
-   if ("@mozilla.org/settingsService;1" in Cc) {
-     let settingsService;
- 
--    // settingsService fails in b2g child processes
-     // TODO bug 1205797, make this work in child processes.
-     try {
-       settingsService = Cc["@mozilla.org/settingsService;1"]
-                           .getService(Ci.nsISettingsService);
-     } catch (e) {
-       return promise.reject(e);
-     }
- 

+ 0 - 519
rel-257/mozilla-esr60/patches/1447873-61a1.patch

@@ -1,519 +0,0 @@
-# HG changeset patch
-# User Makoto Kato <m_kato@ga2.so-net.ne.jp>
-# Date 1521683202 -32400
-# Node ID 6e032627821402c26a1cacf6043ba48c260b409c
-# Parent  3805db0d953fcac7cddebddb84992ef219fae425
-Bug 1447873 - Remove Time API backend in hal. r=gsvelto
-
-Time API is already removed, so hal backend is unnecessary now.
-
-MozReview-Commit-ID: 8R2VRYIX9Vs
-
-diff --git a/hal/Hal.cpp b/hal/Hal.cpp
---- a/hal/Hal.cpp
-+++ b/hal/Hal.cpp
-@@ -334,88 +334,16 @@ void GetCurrentBatteryInformation(Batter
- }
- 
- void NotifyBatteryChange(const BatteryInformation& aInfo) {
-   AssertMainThread();
-   BatteryObservers().CacheInformation(aInfo);
-   BatteryObservers().BroadcastCachedInformation();
- }
- 
--class SystemClockChangeObserversManager : public ObserversManager<int64_t> {
-- protected:
--  void EnableNotifications() override {
--    PROXY_IF_SANDBOXED(EnableSystemClockChangeNotifications());
--  }
--
--  void DisableNotifications() override {
--    PROXY_IF_SANDBOXED(DisableSystemClockChangeNotifications());
--  }
--};
--
--static SystemClockChangeObserversManager& SystemClockChangeObservers() {
--  static SystemClockChangeObserversManager sSystemClockChangeObservers;
--  AssertMainThread();
--  return sSystemClockChangeObservers;
--}
--
--void RegisterSystemClockChangeObserver(SystemClockChangeObserver* aObserver) {
--  AssertMainThread();
--  SystemClockChangeObservers().AddObserver(aObserver);
--}
--
--void UnregisterSystemClockChangeObserver(SystemClockChangeObserver* aObserver) {
--  AssertMainThread();
--  SystemClockChangeObservers().RemoveObserver(aObserver);
--}
--
--void NotifySystemClockChange(const int64_t& aClockDeltaMS) {
--  SystemClockChangeObservers().BroadcastInformation(aClockDeltaMS);
--}
--
--class SystemTimezoneChangeObserversManager
--    : public ObserversManager<SystemTimezoneChangeInformation> {
-- protected:
--  void EnableNotifications() override {
--    PROXY_IF_SANDBOXED(EnableSystemTimezoneChangeNotifications());
--  }
--
--  void DisableNotifications() override {
--    PROXY_IF_SANDBOXED(DisableSystemTimezoneChangeNotifications());
--  }
--};
--
--static SystemTimezoneChangeObserversManager& SystemTimezoneChangeObservers() {
--  static SystemTimezoneChangeObserversManager sSystemTimezoneChangeObservers;
--  return sSystemTimezoneChangeObservers;
--}
--
--void RegisterSystemTimezoneChangeObserver(
--    SystemTimezoneChangeObserver* aObserver) {
--  AssertMainThread();
--  SystemTimezoneChangeObservers().AddObserver(aObserver);
--}
--
--void UnregisterSystemTimezoneChangeObserver(
--    SystemTimezoneChangeObserver* aObserver) {
--  AssertMainThread();
--  SystemTimezoneChangeObservers().RemoveObserver(aObserver);
--}
--
--void NotifySystemTimezoneChange(
--    const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo) {
--  nsJSUtils::ResetTimeZone();
--  SystemTimezoneChangeObservers().BroadcastInformation(
--      aSystemTimezoneChangeInfo);
--}
--
--void AdjustSystemClock(int64_t aDeltaMilliseconds) {
--  AssertMainThread();
--  PROXY_IF_SANDBOXED(AdjustSystemClock(aDeltaMilliseconds));
--}
--
- void EnableSensorNotifications(SensorType aSensor) {
-   AssertMainThread();
-   PROXY_IF_SANDBOXED(EnableSensorNotifications(aSensor));
- }
- 
- void DisableSensorNotifications(SensorType aSensor) {
-   AssertMainThread();
-   PROXY_IF_SANDBOXED(DisableSensorNotifications(aSensor));
-diff --git a/hal/Hal.h b/hal/Hal.h
---- a/hal/Hal.h
-+++ b/hal/Hal.h
-@@ -37,19 +37,16 @@ class nsPIDOMWindowInner;
- #endif
- 
- namespace mozilla {
- 
- namespace hal {
- 
- class WindowIdentifier;
- 
--typedef Observer<int64_t> SystemClockChangeObserver;
--typedef Observer<SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
--
- }  // namespace hal
- 
- namespace MOZ_HAL_NAMESPACE {
- 
- /**
-  * Turn the default vibrator device on/off per the pattern specified
-  * by |pattern|.  Each element in the pattern is the number of
-  * milliseconds to turn the vibrator on or off.  The first element in
-@@ -163,63 +160,16 @@ void GetCurrentNetworkInformation(hal::N
- 
- /**
-  * Notify of a change in the network state.
-  * @param aNetworkInfo The new network information.
-  */
- void NotifyNetworkChange(const hal::NetworkInformation& aNetworkInfo);
- 
- /**
-- * Adjusting system clock.
-- * @param aDeltaMilliseconds The difference compared with current system clock.
-- */
--void AdjustSystemClock(int64_t aDeltaMilliseconds);
--
--/**
-- * Register observer for system clock changed notification.
-- * @param aObserver The observer that should be added.
-- */
--void RegisterSystemClockChangeObserver(
--    hal::SystemClockChangeObserver* aObserver);
--
--/**
-- * Unregister the observer for system clock changed.
-- * @param aObserver The observer that should be removed.
-- */
--void UnregisterSystemClockChangeObserver(
--    hal::SystemClockChangeObserver* aObserver);
--
--/**
-- * Notify of a change in the system clock.
-- * @param aClockDeltaMS
-- */
--void NotifySystemClockChange(const int64_t& aClockDeltaMS);
--
--/**
-- * Register observer for system timezone changed notification.
-- * @param aObserver The observer that should be added.
-- */
--void RegisterSystemTimezoneChangeObserver(
--    hal::SystemTimezoneChangeObserver* aObserver);
--
--/**
-- * Unregister the observer for system timezone changed.
-- * @param aObserver The observer that should be removed.
-- */
--void UnregisterSystemTimezoneChangeObserver(
--    hal::SystemTimezoneChangeObserver* aObserver);
--
--/**
-- * Notify of a change in the system timezone.
-- * @param aSystemTimezoneChangeInfo
-- */
--void NotifySystemTimezoneChange(
--    const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo);
--
--/**
-  * Enable wake lock notifications from the backend.
-  *
-  * This method is only used by WakeLockObserversManager.
-  */
- void EnableWakeLockNotifications();
- 
- /**
-  * Disable wake lock notifications from the backend.
-diff --git a/hal/HalInternal.h b/hal/HalInternal.h
---- a/hal/HalInternal.h
-+++ b/hal/HalInternal.h
-@@ -50,36 +50,16 @@ void DisableNetworkNotifications();
- void EnableScreenConfigurationNotifications();
- 
- /**
-  * Disables screen orientation notifications from the backend.
-  */
- void DisableScreenConfigurationNotifications();
- 
- /**
-- * Enable system clock change notifications from the backend.
-- */
--void EnableSystemClockChangeNotifications();
--
--/**
-- * Disable system clock change notifications from the backend.
-- */
--void DisableSystemClockChangeNotifications();
--
--/**
-- * Enable system timezone change notifications from the backend.
-- */
--void EnableSystemTimezoneChangeNotifications();
--
--/**
-- * Disable system timezone change notifications from the backend.
-- */
--void DisableSystemTimezoneChangeNotifications();
--
--/**
-  * Has the child-side HAL IPC object been destroyed?  If so, you shouldn't send
-  * messages to hal_sandbox.
-  */
- bool HalChildDestroyed();
- }  // namespace MOZ_HAL_NAMESPACE
- }  // namespace mozilla
- 
- #endif  // mozilla_HalInternal_h
-diff --git a/hal/fallback/FallbackTime.cpp b/hal/fallback/FallbackTime.cpp
-deleted file mode 100644
---- a/hal/fallback/FallbackTime.cpp
-+++ /dev/null
-@@ -1,24 +0,0 @@
--/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-- * vim: sw=2 ts=8 et :
-- */
--/* This Source Code Form is subject to the terms of the Mozilla Public
-- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
-- * You can obtain one at http://mozilla.org/MPL/2.0/. */
--
--#include "Hal.h"
--
--namespace mozilla {
--namespace hal_impl {
--
--void AdjustSystemClock(int64_t aDeltaMilliseconds) {}
--
--void EnableSystemClockChangeNotifications() {}
--
--void DisableSystemClockChangeNotifications() {}
--
--void EnableSystemTimezoneChangeNotifications() {}
--
--void DisableSystemTimezoneChangeNotifications() {}
--
--}  // namespace hal_impl
--}  // namespace mozilla
-diff --git a/hal/moz.build b/hal/moz.build
---- a/hal/moz.build
-+++ b/hal/moz.build
-@@ -95,17 +95,16 @@ else:
-         'fallback/FallbackVibration.cpp',
-     ]
- 
- # Fallbacks for backends no longer implemented.
- UNIFIED_SOURCES += [
-     'fallback/FallbackDiskSpaceWatcher.cpp',
-     'fallback/FallbackProcessPriority.cpp',
-     'fallback/FallbackThreadPriority.cpp',
--    'fallback/FallbackTime.cpp',
- ]
- 
- # Fallbacks for backends implemented on Android only.
- if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
-     UNIFIED_SOURCES += [
-         'fallback/FallbackNetwork.cpp',
-     ]
- 
-diff --git a/hal/sandbox/PHal.ipdl b/hal/sandbox/PHal.ipdl
---- a/hal/sandbox/PHal.ipdl
-+++ b/hal/sandbox/PHal.ipdl
-@@ -49,58 +49,43 @@ struct WakeLockInformation {
- struct ScreenConfiguration {
-   nsIntRect rect;
-   ScreenOrientationInternal orientation;
-   uint16_t angle;
-   uint32_t colorDepth;
-   uint32_t pixelDepth;
- };
- 
--struct SystemTimezoneChangeInformation {
--  // These timezone offsets are relative to UTC in minutes and
--  // have already taken daylight saving time (DST) into account.
--  int32_t oldTimezoneOffsetMinutes;
--  int32_t newTimezoneOffsetMinutes;
--};
--
- } // namespace hal
- 
- namespace hal_sandbox {
- 
- nested(upto inside_cpow) sync protocol PHal {
-     manager PContent;
- 
- child:
-     async NotifyBatteryChange(BatteryInformation aBatteryInfo);
-     async NotifyNetworkChange(NetworkInformation aNetworkInfo);
-     async NotifyWakeLockChange(WakeLockInformation aWakeLockInfo);
-     async NotifyScreenConfigurationChange(ScreenConfiguration aScreenOrientation);
--    async NotifySystemClockChange(int64_t aClockDeltaMS); 
--    async NotifySystemTimezoneChange(SystemTimezoneChangeInformation aSystemTimezoneChangeInfo); 
- 
- parent:
-     async Vibrate(uint32_t[] pattern, uint64_t[] id, PBrowser browser);
-     async CancelVibrate(uint64_t[] id, PBrowser browser);
- 
-     async EnableBatteryNotifications();
-     async DisableBatteryNotifications();
-     sync GetCurrentBatteryInformation()
-       returns (BatteryInformation aBatteryInfo);
- 
-     async EnableNetworkNotifications();
-     async DisableNetworkNotifications();
-     sync GetCurrentNetworkInformation()
-       returns (NetworkInformation aNetworkInfo);
- 
--    async AdjustSystemClock(int64_t aDeltaMilliseconds);
--    async EnableSystemClockChangeNotifications();
--    async DisableSystemClockChangeNotifications();
--    async EnableSystemTimezoneChangeNotifications();
--    async DisableSystemTimezoneChangeNotifications();
--
-     async ModifyWakeLock(nsString aTopic,
-                          WakeLockControl aLockAdjust,
-                          WakeLockControl aHiddenAdjust,
-                          uint64_t aProcessID);
-     async EnableWakeLockNotifications();
-     async DisableWakeLockNotifications();
-     sync GetWakeLockInfo(nsString aTopic)
-       returns (WakeLockInformation aWakeLockInfo);
-diff --git a/hal/sandbox/SandboxHal.cpp b/hal/sandbox/SandboxHal.cpp
---- a/hal/sandbox/SandboxHal.cpp
-+++ b/hal/sandbox/SandboxHal.cpp
-@@ -91,36 +91,16 @@ void GetCurrentScreenConfiguration(Scree
- bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation) {
-   bool allowed;
-   Hal()->SendLockScreenOrientation(aOrientation, &allowed);
-   return allowed;
- }
- 
- void UnlockScreenOrientation() { Hal()->SendUnlockScreenOrientation(); }
- 
--void AdjustSystemClock(int64_t aDeltaMilliseconds) {
--  Hal()->SendAdjustSystemClock(aDeltaMilliseconds);
--}
--
--void EnableSystemClockChangeNotifications() {
--  Hal()->SendEnableSystemClockChangeNotifications();
--}
--
--void DisableSystemClockChangeNotifications() {
--  Hal()->SendDisableSystemClockChangeNotifications();
--}
--
--void EnableSystemTimezoneChangeNotifications() {
--  Hal()->SendEnableSystemTimezoneChangeNotifications();
--}
--
--void DisableSystemTimezoneChangeNotifications() {
--  Hal()->SendDisableSystemTimezoneChangeNotifications();
--}
--
- void EnableSensorNotifications(SensorType aSensor) {
-   Hal()->SendEnableSensorNotifications(aSensor);
- }
- 
- void DisableSensorNotifications(SensorType aSensor) {
-   Hal()->SendDisableSensorNotifications(aSensor);
- }
- 
-@@ -182,32 +162,28 @@ void StopDiskSpaceWatcher() {
-   MOZ_CRASH("StopDiskSpaceWatcher() can't be called from sandboxed contexts.");
- }
- 
- class HalParent : public PHalParent,
-                   public BatteryObserver,
-                   public NetworkObserver,
-                   public ISensorObserver,
-                   public WakeLockObserver,
--                  public ScreenConfigurationObserver,
--                  public SystemClockChangeObserver,
--                  public SystemTimezoneChangeObserver {
-+                  public ScreenConfigurationObserver {
-  public:
-   virtual void ActorDestroy(ActorDestroyReason aWhy) override {
-     // NB: you *must* unconditionally unregister your observer here,
-     // if it *may* be registered below.
-     hal::UnregisterBatteryObserver(this);
-     hal::UnregisterNetworkObserver(this);
-     hal::UnregisterScreenConfigurationObserver(this);
-     for (auto sensor : MakeEnumeratedRange(NUM_SENSOR_TYPE)) {
-       hal::UnregisterSensorObserver(sensor, this);
-     }
-     hal::UnregisterWakeLockObserver(this);
--    hal::UnregisterSystemClockChangeObserver(this);
--    hal::UnregisterSystemTimezoneChangeObserver(this);
-   }
- 
-   virtual mozilla::ipc::IPCResult RecvVibrate(
-       InfallibleTArray<unsigned int>&& pattern, InfallibleTArray<uint64_t>&& id,
-       PBrowserParent* browserParent) override {
-     // We give all content vibration permission.
-     //    TabParent *tabParent = TabParent::GetFrom(browserParent);
-     /* xxxkhuey wtf
-@@ -303,46 +279,16 @@ class HalParent : public PHalParent,
-     hal::UnlockScreenOrientation();
-     return IPC_OK();
-   }
- 
-   void Notify(const ScreenConfiguration& aScreenConfiguration) override {
-     Unused << SendNotifyScreenConfigurationChange(aScreenConfiguration);
-   }
- 
--  virtual mozilla::ipc::IPCResult RecvAdjustSystemClock(
--      const int64_t& aDeltaMilliseconds) override {
--    hal::AdjustSystemClock(aDeltaMilliseconds);
--    return IPC_OK();
--  }
--
--  virtual mozilla::ipc::IPCResult RecvEnableSystemClockChangeNotifications()
--      override {
--    hal::RegisterSystemClockChangeObserver(this);
--    return IPC_OK();
--  }
--
--  virtual mozilla::ipc::IPCResult RecvDisableSystemClockChangeNotifications()
--      override {
--    hal::UnregisterSystemClockChangeObserver(this);
--    return IPC_OK();
--  }
--
--  virtual mozilla::ipc::IPCResult RecvEnableSystemTimezoneChangeNotifications()
--      override {
--    hal::RegisterSystemTimezoneChangeObserver(this);
--    return IPC_OK();
--  }
--
--  virtual mozilla::ipc::IPCResult RecvDisableSystemTimezoneChangeNotifications()
--      override {
--    hal::UnregisterSystemTimezoneChangeObserver(this);
--    return IPC_OK();
--  }
--
-   virtual mozilla::ipc::IPCResult RecvEnableSensorNotifications(
-       const SensorType& aSensor) override {
-     // We currently allow any content to register device-sensor
-     // listeners.
-     hal::RegisterSensorObserver(aSensor, this);
-     return IPC_OK();
-   }
- 
-@@ -382,25 +328,16 @@ class HalParent : public PHalParent,
-       const nsString& aTopic, WakeLockInformation* aWakeLockInfo) override {
-     hal::GetWakeLockInfo(aTopic, aWakeLockInfo);
-     return IPC_OK();
-   }
- 
-   void Notify(const WakeLockInformation& aWakeLockInfo) override {
-     Unused << SendNotifyWakeLockChange(aWakeLockInfo);
-   }
--
--  void Notify(const int64_t& aClockDeltaMS) override {
--    Unused << SendNotifySystemClockChange(aClockDeltaMS);
--  }
--
--  void Notify(const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo)
--      override {
--    Unused << SendNotifySystemTimezoneChange(aSystemTimezoneChangeInfo);
--  }
- };
- 
- class HalChild : public PHalChild {
-  public:
-   virtual void ActorDestroy(ActorDestroyReason aWhy) override {
-     sHalChildDestroyed = true;
-   }
- 
-@@ -425,29 +362,16 @@ class HalChild : public PHalChild {
-     return IPC_OK();
-   }
- 
-   virtual mozilla::ipc::IPCResult RecvNotifyScreenConfigurationChange(
-       const ScreenConfiguration& aScreenConfiguration) override {
-     hal::NotifyScreenConfigurationChange(aScreenConfiguration);
-     return IPC_OK();
-   }
--
--  virtual mozilla::ipc::IPCResult RecvNotifySystemClockChange(
--      const int64_t& aClockDeltaMS) override {
--    hal::NotifySystemClockChange(aClockDeltaMS);
--    return IPC_OK();
--  }
--
--  virtual mozilla::ipc::IPCResult RecvNotifySystemTimezoneChange(
--      const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo)
--      override {
--    hal::NotifySystemTimezoneChange(aSystemTimezoneChangeInfo);
--    return IPC_OK();
--  }
- };
- 
- mozilla::ipc::IPCResult HalChild::RecvNotifySensorChange(
-     const hal::SensorData& aSensorData) {
-   hal::NotifySensorChange(aSensorData);
- 
-   return IPC_OK();
- }

+ 0 - 64
rel-257/mozilla-esr60/patches/1454978-61a1.patch

@@ -1,64 +0,0 @@
-# HG changeset patch
-# User Ryan Hunt <rhunt@eqrion.net>
-# Date 1524691622 18000
-# Node ID 2ba500ed529be48c75e68b896ae1739f801fed80
-# Parent  f8d5609ca22338b752cbcbe12f8387a905024330
-Bug 1454978 - Make OMTP feature detection not depend on tiling. r=bas
-
-There's a circular dependency between `UsesTiling` and `InitOMTPConfig` because
-we try to disable OMTP if we will be using tiling and edge padding is enabled.
-Now that edge padding is disabled everywhere except android it should be safe
-to assume that if edge padding is enabled then we'll be using tiling as well
-and should disable OMTP.
-
-This commit also removes a check on `UsesTiling` from CalculateWorkerCount
-as it is redundant.
-
-MozReview-Commit-ID: 1ruWPwXfLwO
-
-diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
---- a/gfx/layers/PaintThread.cpp
-+++ b/gfx/layers/PaintThread.cpp
-@@ -96,20 +96,16 @@ PlatformThreadId PaintThread::sThreadId;
- 
- PaintThread::PaintThread() {}
- 
- void PaintThread::Release() {}
- 
- void PaintThread::AddRef() {}
- 
- /* static */ int32_t PaintThread::CalculatePaintWorkerCount() {
--  if (!gfxPlatform::GetPlatform()->UsesTiling()) {
--    return 0;
--  }
--
-   int32_t cpuCores = 1;
-   nsCOMPtr<nsIPropertyBag2> systemInfo =
-       do_GetService(NS_SYSTEMINFO_CONTRACTID);
-   if (systemInfo) {
-     nsresult rv = systemInfo->GetPropertyAsInt32(NS_LITERAL_STRING("cpucores"),
-                                                  &cpuCores);
-     if (NS_FAILED(rv)) {
-       cpuCores = 1;
-diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
---- a/gfx/thebes/gfxPlatform.cpp
-+++ b/gfx/thebes/gfxPlatform.cpp
-@@ -2422,17 +2422,17 @@ void gfxPlatform::InitOMTPConfig() {
-     omtp.ForceDisable(FeatureStatus::Broken,
-                       "OMTP is not supported when using cairo",
-                       NS_LITERAL_CSTRING("FEATURE_FAILURE_COMP_PREF"));
-   }
- 
-   if (InSafeMode()) {
-     omtp.ForceDisable(FeatureStatus::Blocked, "OMTP blocked by safe-mode",
-                       NS_LITERAL_CSTRING("FEATURE_FAILURE_COMP_SAFEMODE"));
--  } else if (gfxPlatform::UsesTiling() && gfxPrefs::TileEdgePaddingEnabled()) {
-+  } else if (gfxPrefs::TileEdgePaddingEnabled()) {
-     omtp.ForceDisable(FeatureStatus::Blocked,
-                       "OMTP does not yet support tiling with edge padding",
-                       NS_LITERAL_CSTRING("FEATURE_FAILURE_OMTP_TILING"));
-   }
- 
-   if (omtp.IsEnabled()) {
-     gfxVars::SetUseOMTP(true);
-     reporter.SetSuccessful(paintWorkerCount);

+ 0 - 190
rel-257/mozilla-esr60/patches/1455408-1-61a1.patch

@@ -1,190 +0,0 @@
-# HG changeset patch
-# User Ryan Hunt <rhunt@eqrion.net>
-# Date 1524166569 18000
-# Node ID 070ece578a860d1b471b21e0208b883fef7f5677
-# Parent  6b76f54228a320d3458de667d6c251db111e3684
-Bug 1455408 - Remove dead code in ImageBridge that was used for changing thread priority. r=kats
-
-MozReview-Commit-ID: 8sYuUXI8fz4
-
-diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp
---- a/gfx/layers/ipc/ImageBridgeChild.cpp
-+++ b/gfx/layers/ipc/ImageBridgeChild.cpp
-@@ -448,18 +448,16 @@ void ImageBridgeChild::EndTransaction() 
-   }
- 
-   if (!SendUpdate(cset, mTxn->mDestroyedActors, GetFwdTransactionId())) {
-     NS_WARNING("could not send async texture transaction");
-     return;
-   }
- }
- 
--void ImageBridgeChild::SendImageBridgeThreadId() {}
--
- bool ImageBridgeChild::InitForContent(Endpoint<PImageBridgeChild>&& aEndpoint,
-                                       uint32_t aNamespace) {
-   MOZ_ASSERT(NS_IsMainThread());
- 
-   gfxPlatform::GetPlatform();
- 
-   if (!sImageBridgeChildThread) {
-     sImageBridgeChildThread = new Thread("ImageBridgeChild");
-@@ -501,29 +499,27 @@ void ImageBridgeChild::Bind(Endpoint<PIm
-   if (!aEndpoint.Bind(this)) {
-     return;
-   }
- 
-   // This reference is dropped in DeallocPImageBridgeChild.
-   this->AddRef();
- 
-   mCanSend = true;
--  SendImageBridgeThreadId();
- }
- 
- void ImageBridgeChild::BindSameProcess(RefPtr<ImageBridgeParent> aParent) {
-   MessageLoop* parentMsgLoop = aParent->GetMessageLoop();
-   ipc::MessageChannel* parentChannel = aParent->GetIPCChannel();
-   Open(parentChannel, parentMsgLoop, mozilla::ipc::ChildSide);
- 
-   // This reference is dropped in DeallocPImageBridgeChild.
-   this->AddRef();
- 
-   mCanSend = true;
--  SendImageBridgeThreadId();
- }
- 
- /* static */ void ImageBridgeChild::ShutDown() {
-   MOZ_ASSERT(NS_IsMainThread());
- 
-   ShutdownSingleton();
- 
-   delete sImageBridgeChildThread;
-diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp
---- a/gfx/layers/ipc/ImageBridgeParent.cpp
-+++ b/gfx/layers/ipc/ImageBridgeParent.cpp
-@@ -57,17 +57,16 @@ CompositorThreadHolder* GetCompositorThr
-     sImageBridgesLock = new Monitor("ImageBridges");
-     mozilla::ClearOnShutdown(&sImageBridgesLock);
-   }
- }
- 
- ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop,
-                                      ProcessId aChildProcessId)
-     : mMessageLoop(aLoop),
--      mSetChildThreadPriority(false),
-       mClosed(false),
-       mCompositorThreadHolder(CompositorThreadHolder::GetSingleton()) {
-   MOZ_ASSERT(NS_IsMainThread());
-   SetOtherProcessId(aChildProcessId);
- }
- 
- ImageBridgeParent::~ImageBridgeParent() {}
- 
-@@ -147,26 +146,16 @@ void ImageBridgeParent::ActorDestroy(Act
-   // It is very important that this method gets called at shutdown (be it a
-   // clean or an abnormal shutdown), because DeferredDestroy is what clears
-   // mSelfRef. If mSelfRef is not null and ActorDestroy is not called, the
-   // ImageBridgeParent is leaked which causes the CompositorThreadHolder to be
-   // leaked and CompsoitorParent's shutdown ends up spinning the event loop
-   // forever, waiting for the compositor thread to terminate.
- }
- 
--mozilla::ipc::IPCResult ImageBridgeParent::RecvImageBridgeThreadId(
--    const PlatformThreadId& aThreadId) {
--  MOZ_ASSERT(!mSetChildThreadPriority);
--  if (mSetChildThreadPriority) {
--    return IPC_FAIL_NO_REASON(this);
--  }
--  mSetChildThreadPriority = true;
--  return IPC_OK();
--}
--
- class MOZ_STACK_CLASS AutoImageBridgeParentAsyncMessageSender {
-  public:
-   explicit AutoImageBridgeParentAsyncMessageSender(
-       ImageBridgeParent* aImageBridge,
-       InfallibleTArray<OpDestroy>* aToDestroy = nullptr)
-       : mImageBridge(aImageBridge), mToDestroy(aToDestroy) {
-     mImageBridge->SetAboutToSendAsyncMessages();
-   }
-diff --git a/gfx/layers/ipc/ImageBridgeParent.h b/gfx/layers/ipc/ImageBridgeParent.h
---- a/gfx/layers/ipc/ImageBridgeParent.h
-+++ b/gfx/layers/ipc/ImageBridgeParent.h
-@@ -69,18 +69,16 @@ class ImageBridgeParent final : public P
-       const InfallibleTArray<AsyncParentMessageData>& aMessage) override;
- 
-   virtual void NotifyNotUsed(PTextureParent* aTexture,
-                              uint64_t aTransactionId) override;
- 
-   virtual base::ProcessId GetChildProcessId() override { return OtherPid(); }
- 
-   // PImageBridge
--  virtual mozilla::ipc::IPCResult RecvImageBridgeThreadId(
--      const PlatformThreadId& aThreadId) override;
-   virtual mozilla::ipc::IPCResult RecvInitReadLocks(
-       ReadLockArray&& aReadLocks) override;
-   virtual mozilla::ipc::IPCResult RecvUpdate(
-       EditArray&& aEdits, OpDestroyArray&& aToDestroy,
-       const uint64_t& aFwdTransactionId) override;
- 
-   virtual PTextureParent* AllocPTextureParent(
-       const SurfaceDescriptor& aSharedData, const ReadLockDescriptor& aReadLock,
-@@ -135,17 +133,16 @@ class ImageBridgeParent final : public P
-   static void ShutdownInternal();
- 
-   void DeferredDestroy();
-   MessageLoop* mMessageLoop;
-   // This keeps us alive until ActorDestroy(), at which point we do a
-   // deferred destruction of ourselves.
-   RefPtr<ImageBridgeParent> mSelfRef;
- 
--  bool mSetChildThreadPriority;
-   bool mClosed;
- 
-   /**
-    * Map of all living ImageBridgeParent instances
-    */
-   typedef std::map<base::ProcessId, ImageBridgeParent*> ImageBridgeMap;
-   static ImageBridgeMap sImageBridges;
- 
-diff --git a/gfx/layers/ipc/PImageBridge.ipdl b/gfx/layers/ipc/PImageBridge.ipdl
---- a/gfx/layers/ipc/PImageBridge.ipdl
-+++ b/gfx/layers/ipc/PImageBridge.ipdl
-@@ -13,18 +13,16 @@ include "mozilla/GfxMessageUtils.h";
- include "mozilla/layers/LayersMessageUtils.h";
- include "mozilla/layers/WebRenderMessageUtils.h";
- 
- using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
- using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
- using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
- using mozilla::wr::MaybeExternalImageId from "mozilla/webrender/WebRenderTypes.h";
- 
--using PlatformThreadId from "base/platform_thread.h";
--
- namespace mozilla {
- namespace layers {
- 
- /**
-  * The PImageBridge protocol is used to allow isolated threads or processes to push
-  * frames directly to the compositor thread/process without relying on the main thread
-  * which might be too busy dealing with content script.
-  */
-@@ -34,18 +32,16 @@ sync protocol PImageBridge
-   manages PMediaSystemResourceManager;
- 
- child:
-   async ParentAsyncMessages(AsyncParentMessageData[] aMessages);
- 
-   async DidComposite(ImageCompositeNotification[] aNotifications);
- 
- parent:
--  async ImageBridgeThreadId(PlatformThreadId aTreahdId);
--
-   // Creates a set of mappings between TextureReadLocks and an associated
-   // ReadLockHandle that can be used in Update, and persist until the
-   // next Update call.
-   async InitReadLocks(ReadLockInit[] locks);
- 
-   async Update(CompositableOperation[] ops, OpDestroy[] toDestroy, uint64_t fwdTransactionId);
- 
-   // First step of the destruction sequence. This puts ImageBridge

+ 0 - 53
rel-257/mozilla-esr60/patches/1455408-2-61a1.patch

@@ -1,53 +0,0 @@
-# HG changeset patch
-# User Ryan Hunt <rhunt@eqrion.net>
-# Date 1524167303 18000
-# Node ID c1e5abfc4b6a52d25aed3381b4beb64f8ea66c67
-# Parent  4312fc858a2ad291630941911a78fd8ce4275233
-Bug 1455408 - Remove dead code from CompositorBridgeParent that was used for changing thread priority. r=kats
-
-MozReview-Commit-ID: CXELmNfZoaN
-
-diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp
---- a/gfx/layers/ipc/CompositorBridgeParent.cpp
-+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
-@@ -243,20 +243,16 @@ void CompositorBridgeParent::Shutdown() 
-   sCompositorMap = nullptr;
- }
- 
- void CompositorBridgeParent::FinishShutdown() {
-   // TODO: this should be empty by now...
-   sIndirectLayerTrees.clear();
- }
- 
--static void SetThreadPriority() {
--  hal::SetCurrentThreadPriority(hal::THREAD_PRIORITY_COMPOSITOR);
--}
--
- #ifdef COMPOSITOR_PERFORMANCE_WARNING
- static int32_t CalculateCompositionFrameRate() {
-   // Used when layout.frame_rate is -1. Needs to be kept in sync with
-   // DEFAULT_FRAME_RATE in nsRefreshDriver.cpp.
-   // TODO: This should actually return the vsync rate.
-   const int32_t defaultFrameRate = 60;
-   int32_t compositionFrameRatePref = gfxPrefs::LayersCompositionFrameRate();
-   if (compositionFrameRatePref < 0) {
-@@ -338,19 +334,16 @@ void CompositorBridgeParent::Initialize(
-   mCompositorBridgeID = 0;
-   // FIXME: This holds on the the fact that right now the only thing that
-   // can destroy this instance is initialized on the compositor thread after
-   // this task has been processed.
-   MOZ_ASSERT(CompositorLoop());
-   CompositorLoop()->PostTask(NewRunnableFunction(
-       "AddCompositorRunnable", &AddCompositor, this, &mCompositorBridgeID));
- 
--  CompositorLoop()->PostTask(
--      NewRunnableFunction("SetThreadPriorityRunnable", SetThreadPriority));
--
-   {  // scope lock
-     MonitorAutoLock lock(*sIndirectLayerTreesLock);
-     sIndirectLayerTrees[mRootLayerTreeID].mParent = this;
-   }
- 
-   LayerScope::SetPixelScale(mScale.scale);
- 
-   if (!mOptions.UseWebRender()) {

+ 0 - 229
rel-257/mozilla-esr60/patches/1455408-3-61a1.patch

@@ -1,229 +0,0 @@
-# HG changeset patch
-# User Ryan Hunt <rhunt@eqrion.net>
-# Date 1524167282 18000
-# Node ID 43fb3472db5f3c1e811697993316cfd4e434cfdb
-# Parent  2511fcd35299373476185e2db2ebfd704bc60b0b
-Bug 1455408 - Remove thread priority suppport from HAL as it isn't used any longer. r=gsvelto
-
-MozReview-Commit-ID: KJ2byDuYWr9
-
-diff --git a/hal/Hal.cpp b/hal/Hal.cpp
---- a/hal/Hal.cpp
-+++ b/hal/Hal.cpp
-@@ -511,25 +511,16 @@ bool SetProcessPrioritySupported() {
- }
- 
- void SetProcessPriority(int aPid, ProcessPriority aPriority) {
-   // n.b. The sandboxed implementation crashes; SetProcessPriority works only
-   // from the main process.
-   PROXY_IF_SANDBOXED(SetProcessPriority(aPid, aPriority));
- }
- 
--void SetCurrentThreadPriority(hal::ThreadPriority aThreadPriority) {
--  PROXY_IF_SANDBOXED(SetCurrentThreadPriority(aThreadPriority));
--}
--
--void SetThreadPriority(PlatformThreadId aThreadId,
--                       hal::ThreadPriority aThreadPriority) {
--  PROXY_IF_SANDBOXED(SetThreadPriority(aThreadId, aThreadPriority));
--}
--
- // From HalTypes.h.
- const char* ProcessPriorityToString(ProcessPriority aPriority) {
-   switch (aPriority) {
-     case PROCESS_PRIORITY_MASTER:
-       return "MASTER";
-     case PROCESS_PRIORITY_PREALLOC:
-       return "PREALLOC";
-     case PROCESS_PRIORITY_FOREGROUND_HIGH:
-@@ -545,26 +536,16 @@ const char* ProcessPriorityToString(Proc
-     case PROCESS_PRIORITY_UNKNOWN:
-       return "UNKNOWN";
-     default:
-       MOZ_ASSERT(false);
-       return "???";
-   }
- }
- 
--const char* ThreadPriorityToString(ThreadPriority aPriority) {
--  switch (aPriority) {
--    case THREAD_PRIORITY_COMPOSITOR:
--      return "COMPOSITOR";
--    default:
--      MOZ_ASSERT(false);
--      return "???";
--  }
--}
--
- void StartDiskSpaceWatcher() {
-   AssertMainProcess();
-   AssertMainThread();
-   PROXY_IF_SANDBOXED(StartDiskSpaceWatcher());
- }
- 
- void StopDiskSpaceWatcher() {
-   AssertMainProcess();
-diff --git a/hal/Hal.h b/hal/Hal.h
---- a/hal/Hal.h
-+++ b/hal/Hal.h
-@@ -274,31 +274,16 @@ bool SetProcessPrioritySupported();
-  *
-  * Exactly what this does will vary between platforms.  On *nix we might give
-  * background processes higher nice values.  On other platforms, we might
-  * ignore this call entirely.
-  */
- void SetProcessPriority(int aPid, hal::ProcessPriority aPriority);
- 
- /**
-- * Set the current thread's priority to appropriate platform-specific value for
-- * given functionality. Instead of providing arbitrary priority numbers you
-- * must specify a type of function like THREAD_PRIORITY_COMPOSITOR.
-- */
--void SetCurrentThreadPriority(hal::ThreadPriority aThreadPriority);
--
--/**
-- * Set a thread priority to appropriate platform-specific value for
-- * given functionality. Instead of providing arbitrary priority numbers you
-- * must specify a type of function like THREAD_PRIORITY_COMPOSITOR.
-- */
--void SetThreadPriority(PlatformThreadId aThreadId,
--                       hal::ThreadPriority aThreadPriority);
--
--/**
-  * Start monitoring disk space for low space situations.
-  *
-  * This API is currently only allowed to be used from the main process.
-  */
- void StartDiskSpaceWatcher();
- 
- /**
-  * Stop monitoring disk space for low space situations.
-diff --git a/hal/HalTypes.h b/hal/HalTypes.h
---- a/hal/HalTypes.h
-+++ b/hal/HalTypes.h
-@@ -35,43 +35,25 @@ enum ProcessPriority {
-   // CurrentProcessIsForeground().
-   PROCESS_PRIORITY_FOREGROUND,
-   PROCESS_PRIORITY_FOREGROUND_HIGH,
-   PROCESS_PRIORITY_MASTER,
-   NUM_PROCESS_PRIORITY
- };
- 
- /**
-- * Values that can be passed to hal::SetCurrentThreadPriority().  These should
-- * be functional in nature, such as COMPOSITOR, instead of levels, like
-- * LOW/HIGH. This allows us to tune our priority scheme for the system in one
-- * place such that it makes sense holistically for the overall operating system.
-- * On android we may want different priority schemes than on windows, etc.
-- */
--enum ThreadPriority { THREAD_PRIORITY_COMPOSITOR, NUM_THREAD_PRIORITY };
--
--/**
-  * Convert a ProcessPriority enum value to a string.  The strings returned by
-  * this function are statically allocated; do not attempt to free one!
-  *
-  * If you pass an unknown process priority, we fatally assert in debug
-  * builds and otherwise return "???".
-  */
- const char* ProcessPriorityToString(ProcessPriority aPriority);
- 
- /**
-- * Convert a ThreadPriority enum value to a string.  The strings returned by
-- * this function are statically allocated; do not attempt to free one!
-- *
-- * If you pass an unknown process priority, we assert in debug builds
-- * and otherwise return "???".
-- */
--const char* ThreadPriorityToString(ThreadPriority aPriority);
--
--/**
-  * Used by ModifyWakeLock
-  */
- enum WakeLockControl {
-   WAKE_LOCK_REMOVE_ONE = -1,
-   WAKE_LOCK_NO_CHANGE = 0,
-   WAKE_LOCK_ADD_ONE = 1,
-   NUM_WAKE_LOCK
- };
-diff --git a/hal/fallback/FallbackThreadPriority.cpp b/hal/fallback/FallbackThreadPriority.cpp
-deleted file mode 100644
---- a/hal/fallback/FallbackThreadPriority.cpp
-+++ /dev/null
-@@ -1,24 +0,0 @@
--/* This Source Code Form is subject to the terms of the Mozilla Public
-- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
-- * You can obtain one at http://mozilla.org/MPL/2.0/. */
--
--#include "Hal.h"
--#include "HalLog.h"
--
--using namespace mozilla::hal;
--
--namespace mozilla {
--namespace hal_impl {
--
--void SetCurrentThreadPriority(ThreadPriority aPriority) {
--  HAL_LOG("FallbackThreadPriority - SetCurrentThreadPriority(%s)\n",
--          ThreadPriorityToString(aPriority));
--}
--
--void SetThreadPriority(PlatformThreadId aThreadId, ThreadPriority aPriority) {
--  HAL_LOG("FallbackThreadPriority - SetThreadPriority(%d, %s)\n", aThreadId,
--          ThreadPriorityToString(aPriority));
--}
--
--}  // namespace hal_impl
--}  // namespace mozilla
-diff --git a/hal/moz.build b/hal/moz.build
---- a/hal/moz.build
-+++ b/hal/moz.build
-@@ -94,17 +94,16 @@ else:
-         'fallback/FallbackSensor.cpp',
-         'fallback/FallbackVibration.cpp',
-     ]
- 
- # Fallbacks for backends no longer implemented.
- UNIFIED_SOURCES += [
-     'fallback/FallbackDiskSpaceWatcher.cpp',
-     'fallback/FallbackProcessPriority.cpp',
--    'fallback/FallbackThreadPriority.cpp',
- ]
- 
- # Fallbacks for backends implemented on Android only.
- if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
-     UNIFIED_SOURCES += [
-         'fallback/FallbackNetwork.cpp',
-     ]
- 
-diff --git a/hal/sandbox/SandboxHal.cpp b/hal/sandbox/SandboxHal.cpp
---- a/hal/sandbox/SandboxHal.cpp
-+++ b/hal/sandbox/SandboxHal.cpp
-@@ -137,28 +137,16 @@ bool SetAlarm(int32_t aSeconds, int32_t 
- void SetProcessPriority(int aPid, ProcessPriority aPriority) {
-   MOZ_CRASH("Only the main process may set processes' priorities.");
- }
- 
- bool SetProcessPrioritySupported() {
-   MOZ_CRASH("Only the main process may call SetProcessPrioritySupported().");
- }
- 
--void SetCurrentThreadPriority(ThreadPriority aThreadPriority) {
--  MOZ_CRASH(
--      "Setting current thread priority cannot be called from sandboxed "
--      "contexts.");
--}
--
--void SetThreadPriority(PlatformThreadId aThreadId,
--                       ThreadPriority aThreadPriority) {
--  MOZ_CRASH(
--      "Setting thread priority cannot be called from sandboxed contexts.");
--}
--
- void StartDiskSpaceWatcher() {
-   MOZ_CRASH("StartDiskSpaceWatcher() can't be called from sandboxed contexts.");
- }
- 
- void StopDiskSpaceWatcher() {
-   MOZ_CRASH("StopDiskSpaceWatcher() can't be called from sandboxed contexts.");
- }
- 

+ 0 - 66
rel-257/mozilla-esr60/patches/1458462-61a1.patch

@@ -1,66 +0,0 @@
-# HG changeset patch
-# User Ryan Hunt <rhunt@eqrion.net>
-# Date 1525270873 18000
-# Node ID 895146c6b6bcb5a1fa447cdcb54f1925a5ce862a
-# Parent  7de9dceae9b748f450886d26dafd6f56d4ab5492
-Bug 1458462 - Create paint workers if it's possible we could switch to tiling in the future. r=nical
-
-On windows it's possible for us to fallback from D2D to Skia rendering at any time due to a device reset.
-If this happens with `enable-tiles-if-skia-pomtp` enabled we could begin to use tiling. This can cause a
-crash if we never created the worker threads because at initialization time we weren't using tiling.
-
-Another way to fix this would be to dynamically create the worker threads in UpdateRenderMode if we
-have switched to skia. That's a larger change and more might be required, so I'd rather just fix the
-crash for now.
-
-This commit also fixes a pref that should be `Once` instead of `Live`.
-
-MozReview-Commit-ID: JQidXPjI7ER
-
-diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
---- a/gfx/layers/PaintThread.cpp
-+++ b/gfx/layers/PaintThread.cpp
-@@ -137,17 +137,20 @@ bool PaintThread::Init() {
- 
-   RefPtr<nsIThread> thread;
-   nsresult rv = NS_NewNamedThread("PaintThread", getter_AddRefs(thread));
-   if (NS_FAILED(rv)) {
-     return false;
-   }
-   sThread = thread;
- 
--  if (gfxPlatform::GetPlatform()->UsesTiling()) {
-+  // Only create paint workers for tiling if we are using tiling or could
-+  // expect to dynamically switch to tiling in the future
-+  if (gfxPlatform::GetPlatform()->UsesTiling() ||
-+      gfxPrefs::LayersTilesEnabledIfSkiaPOMTP()) {
-     int32_t paintWorkerCount = PaintThread::CalculatePaintWorkerCount();
-     mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
-                                           paintWorkerCount);
-   }
- 
-   nsCOMPtr<nsIRunnable> paintInitTask = NewRunnableMethod(
-       "PaintThread::InitOnPaintThread", this, &PaintThread::InitOnPaintThread);
-   SyncRunnable::DispatchToThread(sThread, paintInitTask);
-diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h
---- a/gfx/thebes/gfxPrefs.h
-+++ b/gfx/thebes/gfxPrefs.h
-@@ -621,17 +621,17 @@ class gfxPrefs final {
-   DECL_GFX_PREF(Once, "layers.mlgpu.enable-cpu-occlusion",     AdvancedLayersEnableCPUOcclusion, bool, true);
-   DECL_GFX_PREF(Once, "layers.mlgpu.enable-depth-buffer",      AdvancedLayersEnableDepthBuffer, bool, false);
-   DECL_GFX_PREF(Live, "layers.mlgpu.enable-invalidation",      AdvancedLayersUseInvalidation, bool, true);
-   DECL_GFX_PREF(Once, "layers.mlgpu.enable-on-windows7",       AdvancedLayersEnableOnWindows7, bool, false);
-   DECL_GFX_PREF(Once, "layers.mlgpu.enable-container-resizing", AdvancedLayersEnableContainerResizing, bool, true);
-   DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.force-disabled", LayersOffMainThreadCompositionForceDisabled, bool, false);
-   DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);
-   DECL_GFX_PREF(Live, "layers.omtp.dump-capture",              LayersOMTPDumpCapture, bool, false);
--  DECL_GFX_PREF(Live, "layers.omtp.paint-workers",             LayersOMTPPaintWorkers, int32_t, 1);
-+  DECL_GFX_PREF(Once, "layers.omtp.paint-workers",             LayersOMTPPaintWorkers, int32_t, 1);
-   DECL_GFX_PREF(Live, "layers.omtp.release-capture-on-main-thread", LayersOMTPReleaseCaptureOnMainThread, bool, false);
-   DECL_GFX_PREF(Live, "layers.orientation.sync.timeout",       OrientationSyncMillis, uint32_t, (uint32_t)0);
-   DECL_GFX_PREF(Once, "layers.prefer-opengl",                  LayersPreferOpenGL, bool, false);
-   DECL_GFX_PREF(Live, "layers.progressive-paint",              ProgressivePaint, bool, false);
-   DECL_GFX_PREF(Live, "layers.shared-buffer-provider.enabled", PersistentBufferProviderSharedEnabled, bool, false);
-   DECL_GFX_PREF(Live, "layers.single-tile.enabled",            LayersSingleTileEnabled, bool, true);
-   DECL_GFX_PREF(Live, "layers.force-synchronous-resize",       LayersForceSynchronousResize, bool, true);
- 

+ 0 - 181
rel-257/mozilla-esr60/patches/1461775-62a1.patch

@@ -1,181 +0,0 @@
-# HG changeset patch
-# User Ryan Hunt <rhunt@eqrion.net>
-# Date 1526409371 18000
-# Node ID 0d06bc54d475bbe804fbb2366c46da501bba99da
-# Parent  06959a24c8d5d9ca57bc88411c29b1d2fef89659
-Bug 1461775 - Create paint worker threads in response to a device reset instead of preemptively. r=bas
-
-diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
---- a/gfx/layers/PaintThread.cpp
-+++ b/gfx/layers/PaintThread.cpp
-@@ -139,34 +139,38 @@ bool PaintThread::Init() {
-   nsresult rv = NS_NewNamedThread("PaintThread", getter_AddRefs(thread));
-   if (NS_FAILED(rv)) {
-     return false;
-   }
-   sThread = thread;
- 
-   // Only create paint workers for tiling if we are using tiling or could
-   // expect to dynamically switch to tiling in the future
--  if (gfxPlatform::GetPlatform()->UsesTiling() ||
--      gfxPrefs::LayersTilesEnabledIfSkiaPOMTP()) {
--    int32_t paintWorkerCount = PaintThread::CalculatePaintWorkerCount();
--    mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
--                                          paintWorkerCount);
-+  if (gfxPlatform::GetPlatform()->UsesTiling()) {
-+    InitPaintWorkers();
-   }
- 
-   nsCOMPtr<nsIRunnable> paintInitTask = NewRunnableMethod(
-       "PaintThread::InitOnPaintThread", this, &PaintThread::InitOnPaintThread);
-   SyncRunnable::DispatchToThread(sThread, paintInitTask);
-   return true;
- }
- 
- void PaintThread::InitOnPaintThread() {
-   MOZ_ASSERT(!NS_IsMainThread());
-   sThreadId = PlatformThread::CurrentId();
- }
- 
-+void PaintThread::InitPaintWorkers() {
-+  MOZ_ASSERT(NS_IsMainThread());
-+  int32_t count = PaintThread::CalculatePaintWorkerCount();
-+  mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
-+                                        count);
-+}
-+
- void DestroyPaintThread(UniquePtr<PaintThread>&& pt) {
-   MOZ_ASSERT(PaintThread::IsOnPaintThread());
-   pt->ShutdownOnPaintThread();
- }
- 
- /* static */ void PaintThread::Shutdown() {
-   MOZ_ASSERT(NS_IsMainThread());
- 
-@@ -191,16 +195,26 @@ void PaintThread::ShutdownOnPaintThread(
- /* static */ bool PaintThread::IsOnPaintThread() {
-   return sThreadId == PlatformThread::CurrentId();
- }
- 
- bool PaintThread::IsOnPaintWorkerThread() {
-   return mPaintWorkers && mPaintWorkers->IsOnCurrentThread();
- }
- 
-+void PaintThread::UpdateRenderMode() {
-+  if (!!mPaintWorkers != gfxPlatform::GetPlatform()->UsesTiling()) {
-+    if (mPaintWorkers) {
-+      mPaintWorkers = nullptr;
-+    } else {
-+      InitPaintWorkers();
-+    }
-+  }
-+}
-+
- void PaintThread::PrepareBuffer(CapturedBufferState* aState) {
-   MOZ_ASSERT(NS_IsMainThread());
-   MOZ_ASSERT(aState);
- 
-   // If painting asynchronously, we need to acquire the compositor bridge which
-   // owns the underlying MessageChannel. Otherwise we leave it null and use
-   // synchronous dispatch.
-   RefPtr<CompositorBridgeChild> cbc(CompositorBridgeChild::Get());
-@@ -304,16 +318,17 @@ void PaintThread::AsyncPaintContents(
-     // AsyncEndLayer
-     DispatchEndLayerTransaction(aBridge);
-   }
- }
- 
- void PaintThread::PaintTiledContents(CapturedTiledPaintState* aState) {
-   MOZ_ASSERT(NS_IsMainThread());
-   MOZ_ASSERT(aState);
-+  MOZ_ASSERT(mPaintWorkers);
- 
-   if (gfxPrefs::LayersOMTPDumpCapture() && aState->mCapture) {
-     aState->mCapture->Dump();
-   }
- 
-   RefPtr<CompositorBridgeChild> cbc(CompositorBridgeChild::Get());
-   RefPtr<CapturedTiledPaintState> state(aState);
- 
-diff --git a/gfx/layers/PaintThread.h b/gfx/layers/PaintThread.h
---- a/gfx/layers/PaintThread.h
-+++ b/gfx/layers/PaintThread.h
-@@ -245,16 +245,18 @@ class PaintThread final {
-   static void Start();
-   static void Shutdown();
-   static PaintThread* Get();
- 
-   // Helper for asserts.
-   static bool IsOnPaintThread();
-   bool IsOnPaintWorkerThread();
- 
-+  void UpdateRenderMode();
-+
-   void PrepareBuffer(CapturedBufferState* aState);
- 
-   void PaintContents(CapturedPaintState* aState,
-                      PrepDrawTargetForPaintingCallback aCallback);
- 
-   void PaintTiledContents(CapturedTiledPaintState* aState);
- 
-   // Must be called on the main thread. Signifies that the current
-@@ -283,16 +285,17 @@ class PaintThread final {
-   static int32_t CalculatePaintWorkerCount();
- 
-  private:
-   PaintThread();
- 
-   bool Init();
-   void ShutdownOnPaintThread();
-   void InitOnPaintThread();
-+  void InitPaintWorkers();
- 
-   void AsyncPrepareBuffer(CompositorBridgeChild* aBridge,
-                           CapturedBufferState* aState);
-   void AsyncPaintContents(CompositorBridgeChild* aBridge,
-                           CapturedPaintState* aState,
-                           PrepDrawTargetForPaintingCallback aCallback);
-   void AsyncPaintTiledContents(CompositorBridgeChild* aBridge,
-                                CapturedTiledPaintState* aState);
-diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp
---- a/gfx/thebes/gfxWindowsPlatform.cpp
-+++ b/gfx/thebes/gfxWindowsPlatform.cpp
-@@ -36,16 +36,17 @@
- #include "nsIGfxInfo.h"
- 
- #include "gfxCrashReporterUtils.h"
- 
- #include "gfxGDIFontList.h"
- #include "gfxGDIFont.h"
- 
- #include "mozilla/layers/CompositorThread.h"
-+#include "mozilla/layers/PaintThread.h"
- #include "mozilla/layers/ReadbackManagerD3D11.h"
- 
- #include "gfxDWriteFontList.h"
- #include "gfxDWriteFonts.h"
- #include "gfxDWriteCommon.h"
- #include <dwrite.h>
- 
- #include "gfxTextRun.h"
-@@ -440,16 +441,20 @@ bool gfxWindowsPlatform::IsDirect2DBacke
-   return GetDefaultContentBackend() == BackendType::DIRECT2D1_1;
- }
- 
- void gfxWindowsPlatform::UpdateRenderMode() {
-   bool didReset = HandleDeviceReset();
- 
-   UpdateBackendPrefs();
- 
-+  if (PaintThread::Get()) {
-+    PaintThread::Get()->UpdateRenderMode();
-+  }
-+
-   if (didReset) {
-     mScreenReferenceDrawTarget = CreateOffscreenContentDrawTarget(
-         IntSize(1, 1), SurfaceFormat::B8G8R8A8);
-     if (!mScreenReferenceDrawTarget) {
-       gfxCriticalNote
-           << "Failed to update reference draw target after device reset"
-           << ", D3D11 device:" << hexa(Factory::GetDirect3D11Device().get())
-           << ", D3D11 status:"

File diff suppressed because it is too large
+ 0 - 242350
rel-257/mozilla-esr60/patches/1464834-1-62a1.patch


+ 0 - 42
rel-257/mozilla-esr60/patches/1464834-2-62a1.patch

@@ -1,42 +0,0 @@
-# HG changeset patch
-# User Emilio Cobos Álvarez <emilio@crisal.io>
-# Date 1527584851 -7200
-# Node ID b6a31a23c372aace32a291aba2f5c5445347f722
-# Parent  ad877938d7527cfff12168661d0a81a1c1077fd3
-Bug 1464834: Bring back servo/moz.build to fix the linting failure. r=me
-
-MozReview-Commit-ID: 1yKvs0NI3X3
-
-
-diff --git a/servo/moz.build b/servo/moz.build
-new file mode 100644
---- /dev/null
-+++ b/servo/moz.build
-@@ -0,0 +1,26 @@
-+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-+# vim: set filetype=python:
-+# This Source Code Form is subject to the terms of the Mozilla Public
-+# License, v. 2.0. If a copy of the MPL was not distributed with this
-+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-+
-+with Files("**"):
-+    BUG_COMPONENT = ("Firefox", "General")
-+
-+with Files("components/style/**"):
-+    BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
-+
-+with Files("components/style_derive/**"):
-+    BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
-+
-+with Files("components/style_traits/**"):
-+    BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
-+
-+with Files("components/selectors/**"):
-+    BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
-+
-+with Files("ports/geckolib/**"):
-+    BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
-+
-+with Files("tests/unit/style/**"):
-+    BUG_COMPONENT = ("Core", "CSS Parsing and Computation")
-

+ 0 - 52
rel-257/mozilla-esr60/patches/1469790-63a1.patch

@@ -1,52 +0,0 @@
-# HG changeset patch
-# User Mike Hommey <mh+mozilla@glandium.org>
-# Date 1530054447 -32400
-# Node ID 9d09683ea3d8997c9f4405102f7a97e3236e58a4
-# Parent  e0497e118632e0e347a73cecf3d2c07a9b003d62
-Bug 1469790 - Build for NEON by default when targetting Android arm. r=nalexander
-
-The media/libpng/moz.build file overrides the C standard used via
--std=c89, per bug 1371266, which conflicts with the use of the
-arm_neon.h header: compilation fails on the inline keyword, which didn't
-exist in C89. We thus "bump" to the GNU89 standard, which is C89+GNU
-extensions, including inline.
-
-diff --git a/build/autoconf/arch.m4 b/build/autoconf/arch.m4
---- a/build/autoconf/arch.m4
-+++ b/build/autoconf/arch.m4
-@@ -26,17 +26,17 @@ MOZ_ARG_WITH_STRING(arch,
-     MOZ_ARCH=$withval)
- 
- if test -z "$MOZ_ARCH"; then
-     dnl Defaults
-     case "${CPU_ARCH}-${OS_TARGET}" in
-     arm-Android)
-         MOZ_THUMB=yes
-         MOZ_ARCH=armv7-a
--        MOZ_FPU=vfpv3-d16
-+        MOZ_FPU=neon
-         MOZ_FLOAT_ABI=softfp
-         MOZ_ALIGN=no
-         ;;
-     arm-Darwin)
-         MOZ_ARCH=toolchain-default
-         ;;
-     esac
- fi
-diff --git a/media/libpng/moz.build b/media/libpng/moz.build
---- a/media/libpng/moz.build
-+++ b/media/libpng/moz.build
-@@ -61,12 +61,9 @@ if CONFIG['MOZ_TREE_FREETYPE']:
- Library('mozpng')
- 
- FINAL_LIBRARY = 'gkmedias'
- 
- # We allow warnings for third-party code that can be updated from upstream.
- AllowCompilerWarnings()
- 
- if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
--    if CONFIG['OS_ARCH'] == 'WINNT':
--        CFLAGS += ['-std=gnu89']
--    else:
--        CFLAGS += ['-std=c89']
-+    CFLAGS += ['-std=gnu89']

+ 0 - 33
rel-257/mozilla-esr60/patches/1472672-63a1.patch

@@ -1,33 +0,0 @@
-# HG changeset patch
-# User Robert Bartlensky <rbartlensky@mozilla.com>
-# Date 1530709772 -3600
-# Node ID c463161da7b4a687f3e96d862246c0322dcd1c1f
-# Parent  df9218c6d2cbb3ff688aa5819e83d0c52ff8af71
-Bug 1472672 - Add null check for textAcc. r=davidb
-
-MozReview-Commit-ID: AL7R1fdlcvN
-
-diff --git a/accessible/atk/nsMaiInterfaceText.cpp b/accessible/atk/nsMaiInterfaceText.cpp
---- a/accessible/atk/nsMaiInterfaceText.cpp
-+++ b/accessible/atk/nsMaiInterfaceText.cpp
-@@ -388,18 +388,18 @@ static void getRangeExtentsCB(AtkText* a
-   aRect->width = rect.width;
-   aRect->height = rect.height;
- }
- 
- static gint getCharacterCountCB(AtkText* aText) {
-   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
-   if (accWrap) {
-     HyperTextAccessible* textAcc = accWrap->AsHyperText();
--    return textAcc->IsDefunct() ? 0
--                                : static_cast<gint>(textAcc->CharacterCount());
-+    return !textAcc || textAcc->IsDefunct() ?
-+        0 : static_cast<gint>(textAcc->CharacterCount());
-   }
- 
-   if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
-     return proxy->CharacterCount();
-   }
- 
-   return 0;
- }

+ 0 - 67
rel-257/mozilla-esr60/patches/1473732-63a1.patch

@@ -1,67 +0,0 @@
-# HG changeset patch
-# User Jan Beich <jbeich@FreeBSD.org>
-# Date 1530398519 0
-# Node ID 393f7e716c4f7ecbb3ead2d1ccbc796a0d8726a0
-# Parent  e247721043bffbb7b6402c75ca6abf15331d361c
-Bug 1473732 - Base default number of OMTP workers on the number of logical CPU cores. r=rhunt
-
-system-info is a stub on Tier3 platforms while physical vs. logical
-difference only matters for hyper-threading. As hyper-threading
-is usually available on CPUs with more than 2 physical cores this
-change has no impact there as the default is clamped to [1, 4].
-However, on Intel i3-* CPUs with 2 physical and 4 logical cores this
-bumps the default from 1 to 3.
-
-MozReview-Commit-ID: 1Yh8rJL2JcN
-
-diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
---- a/gfx/layers/PaintThread.cpp
-+++ b/gfx/layers/PaintThread.cpp
-@@ -16,17 +16,17 @@
- #include "mozilla/layers/ShadowLayers.h"
- #include "mozilla/layers/SyncObject.h"
- #include "mozilla/gfx/2D.h"
- #include "mozilla/Preferences.h"
- #include "mozilla/SharedThreadPool.h"
- #include "mozilla/SyncRunnable.h"
- #include "nsIPropertyBag2.h"
- #include "nsServiceManagerUtils.h"
--#include "nsSystemInfo.h"
-+#include "prsystem.h"
- 
- // Uncomment the following line to dispatch sync runnables when
- // painting so that rasterization happens synchronously from
- // the perspective of the main thread
- // #define OMTP_FORCE_SYNC
- 
- namespace mozilla {
- namespace layers {
-@@ -96,27 +96,17 @@ PlatformThreadId PaintThread::sThreadId;
- 
- PaintThread::PaintThread() {}
- 
- void PaintThread::Release() {}
- 
- void PaintThread::AddRef() {}
- 
- /* static */ int32_t PaintThread::CalculatePaintWorkerCount() {
--  int32_t cpuCores = 1;
--  nsCOMPtr<nsIPropertyBag2> systemInfo =
--      do_GetService(NS_SYSTEMINFO_CONTRACTID);
--  if (systemInfo) {
--    nsresult rv = systemInfo->GetPropertyAsInt32(NS_LITERAL_STRING("cpucores"),
--                                                 &cpuCores);
--    if (NS_FAILED(rv)) {
--      cpuCores = 1;
--    }
--  }
--
-+  int32_t cpuCores = PR_GetNumberOfProcessors();
-   int32_t workerCount = gfxPrefs::LayersOMTPPaintWorkers();
- 
-   // If not manually specified, default to (cpuCores * 3) / 4, and clamp
-   // between 1 and 4. If a user wants more, they can manually specify it
-   if (workerCount < 1) {
-     workerCount = std::min(std::max((cpuCores * 3) / 4, 1), 4);
-   }
- 

+ 0 - 74
rel-257/mozilla-esr60/patches/1476000-63a1.patch

@@ -1,74 +0,0 @@
-# HG changeset patch
-# User Masatoshi Kimura <VYV03354@nifty.ne.jp>
-# Date 1531757284 -32400
-# Node ID 896f75ea76345497797778f66b7ad9386052229a
-# Parent  a2ae515ee43f5561ab77875d21738a8c8d53999e
-Bug 1476000 - Support warnings format from clang-cl. r=dmajor
-
-diff --git a/python/mozbuild/mozbuild/compilation/warnings.py b/python/mozbuild/mozbuild/compilation/warnings.py
---- a/python/mozbuild/mozbuild/compilation/warnings.py
-+++ b/python/mozbuild/mozbuild/compilation/warnings.py
-@@ -28,16 +28,25 @@ RE_CLANG_WARNING = re.compile(r"""
-     :
-     (?P<column>\d+)
-     :
-     \swarning:\s
-     (?P<message>.+)
-     \[(?P<flag>[^\]]+)
-     """, re.X)
- 
-+# This captures Clang-cl warning format.
-+RE_CLANG_CL_WARNING = re.compile(r"""
-+    (?P<file>.*)
-+    \((?P<line>\d+),(?P<column>\d+)\)
-+    \s?:\s+warning:\s
-+    (?P<message>.*)
-+    \[(?P<flag>[^\]]+)
-+    """, re.X)
-+
- # This captures Visual Studio's warning format.
- RE_MSVC_WARNING = re.compile(r"""
-     (?P<file>.*)
-     \((?P<line>\d+)\)
-     \s?:\swarning\s
-     (?P<flag>[^:]+)
-     :\s
-     (?P<message>.*)
-@@ -324,26 +333,36 @@ class WarningsCollector(object):
- 
-             return
- 
-         warning = CompilerWarning()
-         filename = None
- 
-         # TODO make more efficient so we run minimal regexp matches.
-         match_clang = RE_CLANG_WARNING.match(filtered)
-+        match_clang_cl = RE_CLANG_CL_WARNING.match(filtered)
-         match_msvc = RE_MSVC_WARNING.match(filtered)
-         if match_clang:
-             d = match_clang.groupdict()
- 
-             filename = d['file']
-             warning['line'] = int(d['line'])
-             warning['column'] = int(d['column'])
-             warning['flag'] = d['flag']
-             warning['message'] = d['message'].rstrip()
- 
-+        elif match_clang_cl:
-+            d = match_clang_cl.groupdict()
-+
-+            filename = d['file']
-+            warning['line'] = int(d['line'])
-+            warning['column'] = int(d['column'])
-+            warning['flag'] = d['flag']
-+            warning['message'] = d['message'].rstrip()
-+
-         elif match_msvc:
-             d = match_msvc.groupdict()
- 
-             filename = d['file']
-             warning['line'] = int(d['line'])
-             warning['flag'] = d['flag']
-             warning['message'] = d['message'].rstrip()
-         else:
-

+ 0 - 76
rel-257/mozilla-esr60/patches/1477678-63a1.patch

@@ -1,76 +0,0 @@
-# HG changeset patch
-# User Emilio Cobos Álvarez <emilio@crisal.io>
-# Date 1532351184 0
-# Node ID cee6f792620d5953257bf8f866472ee296e83d94
-# Parent  f9ad9e72ad513dfaf7d35581e80c6303dd8afdc1
-Bug 1477678 - Remove useless Compositor::SetDispAcquireFence. r=kats
-
-Differential Revision: https://phabricator.services.mozilla.com/D2295
-
-diff --git a/gfx/layers/Compositor.cpp b/gfx/layers/Compositor.cpp
---- a/gfx/layers/Compositor.cpp
-+++ b/gfx/layers/Compositor.cpp
-@@ -519,18 +519,16 @@ gfx::IntRect Compositor::ComputeBackdrop
-   return ComputeBackdropCopyRect(boundingBox, aClipRect, aTransform,
-                                  aOutTransform, aOutLayerQuad);
- }
- 
- void Compositor::SetInvalid() { mParent = nullptr; }
- 
- bool Compositor::IsValid() const { return !!mParent; }
- 
--void Compositor::SetDispAcquireFence(Layer* aLayer) {}
--
- void Compositor::UnlockAfterComposition(TextureHost* aTexture) {
-   TextureSourceProvider::UnlockAfterComposition(aTexture);
- 
-   // If this is being called after we shutdown the compositor, we must finish
-   // read unlocking now to prevent a cycle.
-   if (IsDestroyed()) {
-     ReadUnlockTextures();
-   }
-diff --git a/gfx/layers/Compositor.h b/gfx/layers/Compositor.h
---- a/gfx/layers/Compositor.h
-+++ b/gfx/layers/Compositor.h
-@@ -392,18 +392,16 @@ class Compositor : public TextureSourceP
-    * Flush the current frame to the screen and tidy up.
-    *
-    * Derived class overriding this should call Compositor::EndFrame.
-    */
-   virtual void EndFrame();
- 
-   virtual void CancelFrame(bool aNeedFlush = true) { ReadUnlockTextures(); }
- 
--  virtual void SetDispAcquireFence(Layer* aLayer);
--
-   /**
-    * Whether textures created by this compositor can receive partial updates.
-    */
-   virtual bool SupportsPartialTextureUpdate() = 0;
- 
-   void SetDiagnosticTypes(DiagnosticTypes aDiagnostics) {
-     mDiagnosticTypes = aDiagnostics;
-   }
-diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp
---- a/gfx/layers/composite/LayerManagerComposite.cpp
-+++ b/gfx/layers/composite/LayerManagerComposite.cpp
-@@ -948,19 +948,16 @@ void LayerManagerComposite::Render(const
- 
-   // Debugging
-   RenderDebugOverlay(actualBounds);
- 
-   {
-     AUTO_PROFILER_LABEL("LayerManagerComposite::Render:EndFrame", GRAPHICS);
- 
-     mCompositor->EndFrame();
--
--    // Call after EndFrame()
--    mCompositor->SetDispAcquireFence(mRoot);
-   }
- 
-   mCompositor->GetWidget()->PostRender(&widgetContext);
- 
-   RecordFrame();
- }
- 
- #if defined(MOZ_WIDGET_ANDROID)

+ 0 - 99
rel-257/mozilla-esr60/patches/1477799-63a1.patch

@@ -1,99 +0,0 @@
-# HG changeset patch
-# User Ryan Hunt <rhunt@eqrion.net>
-# Date 1532022094 18000
-# Node ID b9c6c62b406313bbae21a6c967e106ab58ad63a8
-# Parent  f1a4cbbd6917f9259ed61198153ff6b2cc1466f9
-Bug 1477799 - Use the paint thread instead of workers when we only have one worker. r=jrmuizel
-
-MozReview-Commit-ID: 3mR4KrS924N
-
-diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
---- a/gfx/layers/PaintThread.cpp
-+++ b/gfx/layers/PaintThread.cpp
-@@ -157,18 +157,20 @@ bool PaintThread::Init() {
- void PaintThread::InitOnPaintThread() {
-   MOZ_ASSERT(!NS_IsMainThread());
-   sThreadId = PlatformThread::CurrentId();
- }
- 
- void PaintThread::InitPaintWorkers() {
-   MOZ_ASSERT(NS_IsMainThread());
-   int32_t count = PaintThread::CalculatePaintWorkerCount();
--  mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
--                                        count);
-+  if (count != 1) {
-+    mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
-+                                          count);
-+  }
- }
- 
- void DestroyPaintThread(UniquePtr<PaintThread>&& pt) {
-   MOZ_ASSERT(PaintThread::IsOnPaintThread());
-   pt->ShutdownOnPaintThread();
- }
- 
- /* static */ void PaintThread::Shutdown() {
-@@ -192,17 +194,18 @@ void PaintThread::ShutdownOnPaintThread(
-   return PaintThread::sSingleton.get();
- }
- 
- /* static */ bool PaintThread::IsOnPaintThread() {
-   return sThreadId == PlatformThread::CurrentId();
- }
- 
- bool PaintThread::IsOnPaintWorkerThread() {
--  return mPaintWorkers && mPaintWorkers->IsOnCurrentThread();
-+  return (mPaintWorkers && mPaintWorkers->IsOnCurrentThread()) ||
-+    (sThreadId == PlatformThread::CurrentId());
- }
- 
- void PaintThread::UpdateRenderMode() {
-   if (!!mPaintWorkers != gfxPlatform::GetPlatform()->UsesTiling()) {
-     if (mPaintWorkers) {
-       mPaintWorkers = nullptr;
-     } else {
-       InitPaintWorkers();
-@@ -318,37 +321,40 @@ void PaintThread::AsyncPaintContents(
-     // AsyncEndLayer
-     DispatchEndLayerTransaction(aBridge);
-   }
- }
- 
- void PaintThread::PaintTiledContents(CapturedTiledPaintState* aState) {
-   MOZ_ASSERT(NS_IsMainThread());
-   MOZ_ASSERT(aState);
--  MOZ_ASSERT(mPaintWorkers);
- 
-   if (gfxPrefs::LayersOMTPDumpCapture() && aState->mCapture) {
-     aState->mCapture->Dump();
-   }
- 
-   RefPtr<CompositorBridgeChild> cbc(CompositorBridgeChild::Get());
-   RefPtr<CapturedTiledPaintState> state(aState);
- 
-   cbc->NotifyBeginAsyncPaint(state);
- 
-   RefPtr<PaintThread> self = this;
-   RefPtr<Runnable> task = NS_NewRunnableFunction(
-       "PaintThread::PaintTiledContents", [self, cbc, state]() -> void {
-         self->AsyncPaintTiledContents(cbc, state);
-       });
- 
-+  nsIEventTarget* paintThread = mPaintWorkers ?
-+    static_cast<nsIEventTarget*>(mPaintWorkers.get()) :
-+    static_cast<nsIEventTarget*>(sThread.get());
-+
- #ifndef OMTP_FORCE_SYNC
--  mPaintWorkers->Dispatch(task.forget());
-+  paintThread->Dispatch(task.forget());
- #else
--  SyncRunnable::DispatchToThread(mPaintWorkers, task);
-+  SyncRunnable::DispatchToThread(paintThread, task);
- #endif
- }
- 
- void PaintThread::AsyncPaintTiledContents(CompositorBridgeChild* aBridge,
-                                           CapturedTiledPaintState* aState) {
-   MOZ_ASSERT(IsOnPaintWorkerThread());
-   MOZ_ASSERT(aState);
- 

+ 0 - 45
rel-257/mozilla-esr60/patches/1478815-7partial-63a1.patch

@@ -1,45 +0,0 @@
-# HG changeset patch
-# User Ryan Hunt <rhunt@eqrion.net>
-# Date 1533145832 18000
-# Node ID f07a1e9cbab30755c76e3c1334b7d78aee1fb4e3
-# Parent  15579bf8eab673b19266166a3c9479ff8dbe1fd3
-Bug 1478815 part 7 - Add a buffer unrotate operation to DrawTarget. r=bas
-
-This commit adds a buffer unrotate operation to DrawTarget. It's
-initially implemented with LockBits in DrawTarget. DrawTargetDual
-overrides the implementation to pass on the operation to it's
-DrawTargets.
-
-No override is given for DrawTargetCapture as we intentionally
-avoid this code path when async painting as it can fail.
-
-This is needed so that RotatedBuffer can expose a single DrawTarget,
-which can be a DrawTarget (for normal alpha), DrawTargetDual (for
-component alpha), or DrawTargetCapture (when async painting).
-
-MozReview-Commit-ID: csjjZ733hl
-
-diff --git a/gfx/layers/LayerScope.cpp b/gfx/layers/LayerScope.cpp
---- a/gfx/layers/LayerScope.cpp
-+++ b/gfx/layers/LayerScope.cpp
-@@ -46,16 +46,20 @@
- #include "nsIEventTarget.h"
- #include "nsProxyRelease.h"
- #include <list>
- 
- // Undo the damage done by mozzconf.h
- #undef compress
- #include "mozilla/Compression.h"
- 
-+// Undo the damage done by X11
-+#ifdef Status
-+#  undef Status
-+#endif
- // Protocol buffer (generated automatically)
- #include "protobuf/LayerScopePacket.pb.h"
- 
- namespace mozilla {
- namespace layers {
- 
- using namespace mozilla::Compression;
- using namespace mozilla::gfx;

+ 0 - 2511
rel-257/mozilla-esr60/patches/1488401-64a1.patch

@@ -1,2511 +0,0 @@
-# HG changeset patch
-# User Gabriele Svelto <gsvelto@mozilla.com>
-# Date 1536820851 0
-# Node ID 3206c9b8db975f6b30bc4ee1a70402ccfdc68e36
-# Parent  b00696162de9955a420e60f1aea7040587a4da96
-Bug 1488401 - Remove the remnants of the DiskSpaceWatcher r=asuth,janv,smaug
-
-Differential Revision: https://phabricator.services.mozilla.com/D4933
-
-diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp
---- a/dom/indexedDB/ActorsParent.cpp
-+++ b/dom/indexedDB/ActorsParent.cpp
-@@ -4110,28 +4110,16 @@ nsresult CreateStorageConnection(nsIFile
-   MOZ_ASSERT(aFMDirectory);
-   MOZ_ASSERT(aConnection);
- 
-   AUTO_PROFILER_LABEL("CreateStorageConnection", STORAGE);
- 
-   nsresult rv;
-   bool exists;
- 
--  if (IndexedDatabaseManager::InLowDiskSpaceMode()) {
--    rv = aDBFile->Exists(&exists);
--    if (NS_WARN_IF(NS_FAILED(rv))) {
--      return rv;
--    }
--
--    if (!exists) {
--      NS_WARNING("Refusing to create database because disk space is low!");
--      return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR;
--    }
--  }
--
-   nsCOMPtr<nsIFileURL> dbFileUrl;
-   rv = GetDatabaseFileURL(aDBFile, aPersistenceType, aGroup, aOrigin,
-                           aTelemetryId, getter_AddRefs(dbFileUrl));
-   if (NS_WARN_IF(NS_FAILED(rv))) {
-     return rv;
-   }
- 
-   nsCOMPtr<mozIStorageService> ss =
-@@ -17014,33 +17002,16 @@ nsresult DatabaseMaintenance::DetermineM
-   // Don't do anything if the schema version is less than 18; before that
-   // version no databases had |auto_vacuum == INCREMENTAL| set and we didn't
-   // track the values needed for the heuristics below.
-   if (schemaVersion < MakeSchemaVersion(18, 0)) {
-     *aMaintenanceAction = MaintenanceAction::Nothing;
-     return NS_OK;
-   }
- 
--  bool lowDiskSpace = IndexedDatabaseManager::InLowDiskSpaceMode();
--
--  if (QuotaManager::IsRunningXPCShellTests()) {
--    // If we're running XPCShell then we want to test both the low disk space
--    // and normal disk space code paths so pick semi-randomly based on the
--    // current time.
--    lowDiskSpace = ((PR_Now() / PR_USEC_PER_MSEC) % 2) == 0;
--  }
--
--  // If we're low on disk space then the best we can hope for is that an
--  // incremental vacuum might free some space. That is a journaled operation so
--  // it may not be possible even then.
--  if (lowDiskSpace) {
--    *aMaintenanceAction = MaintenanceAction::IncrementalVacuum;
--    return NS_OK;
--  }
--
-   // This method shouldn't make any permanent changes to the database, so make
-   // sure everything gets rolled back when we leave.
-   mozStorageTransaction transaction(aConnection,
-                                     /* aCommitOnComplete */ false);
- 
-   // Check to see when we last vacuumed this database.
-   nsCOMPtr<mozIStorageStatement> stmt;
-   rv = aConnection->CreateStatement(
-@@ -21756,21 +21727,16 @@ nsresult CreateFileOp::CreateMutableFile
- }
- 
- nsresult CreateFileOp::DoDatabaseWork() {
-   AssertIsOnIOThread();
-   MOZ_ASSERT(mState == State::DatabaseWork);
- 
-   AUTO_PROFILER_LABEL("CreateFileOp::DoDatabaseWork", STORAGE);
- 
--  if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) {
--    NS_WARNING("Refusing to create file because disk space is low!");
--    return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR;
--  }
--
-   if (NS_WARN_IF(QuotaManager::IsShuttingDown()) || !OperationMayProceed()) {
-     IDB_REPORT_INTERNAL_ERR();
-     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
-   }
- 
-   FileManager* fileManager = mDatabase->GetFileManager();
- 
-   mFileInfo = fileManager->GetNewFileInfo();
-@@ -21889,20 +21855,16 @@ void VersionChangeTransactionOp::Cleanup
- }
- 
- nsresult CreateObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection) {
-   MOZ_ASSERT(aConnection);
-   aConnection->AssertIsOnConnectionThread();
- 
-   AUTO_PROFILER_LABEL("CreateObjectStoreOp::DoDatabaseWork", STORAGE);
- 
--  if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) {
--    return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR;
--  }
--
- #ifdef DEBUG
-   {
-     // Make sure that we're not creating an object store with the same name as
-     // another that already exists. This should be impossible because we should
-     // have thrown an error long before now...
-     DatabaseConnection::CachedStatement stmt;
-     MOZ_ALWAYS_SUCCEEDS(aConnection->GetCachedStatement(
-         NS_LITERAL_CSTRING("SELECT name "
-@@ -22198,20 +22160,16 @@ nsresult DeleteObjectStoreOp::DoDatabase
- }
- 
- nsresult RenameObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection) {
-   MOZ_ASSERT(aConnection);
-   aConnection->AssertIsOnConnectionThread();
- 
-   AUTO_PROFILER_LABEL("RenameObjectStoreOp::DoDatabaseWork", STORAGE);
- 
--  if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) {
--    return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR;
--  }
--
- #ifdef DEBUG
-   {
-     // Make sure that we're not renaming an object store with the same name as
-     // another that already exists. This should be impossible because we should
-     // have thrown an error long before now...
-     DatabaseConnection::CachedStatement stmt;
-     MOZ_ALWAYS_SUCCEEDS(
-         aConnection->GetCachedStatement(NS_LITERAL_CSTRING("SELECT name "
-@@ -22284,17 +22242,16 @@ CreateIndexOp::CreateIndexOp(VersionChan
-   MOZ_ASSERT(mFileManager);
-   MOZ_ASSERT(!mDatabaseId.IsEmpty());
- }
- 
- nsresult CreateIndexOp::InsertDataFromObjectStore(
-     DatabaseConnection* aConnection) {
-   MOZ_ASSERT(aConnection);
-   aConnection->AssertIsOnConnectionThread();
--  MOZ_ASSERT(!IndexedDatabaseManager::InLowDiskSpaceMode());
-   MOZ_ASSERT(mMaybeUniqueIndexTable);
- 
-   AUTO_PROFILER_LABEL("CreateIndexOp::InsertDataFromObjectStore", STORAGE);
- 
-   nsCOMPtr<mozIStorageConnection> storageConnection =
-       aConnection->GetStorageConnection();
-   MOZ_ASSERT(storageConnection);
- 
-@@ -22319,17 +22276,16 @@ nsresult CreateIndexOp::InsertDataFromOb
- 
-   return NS_OK;
- }
- 
- nsresult CreateIndexOp::InsertDataFromObjectStoreInternal(
-     DatabaseConnection* aConnection) {
-   MOZ_ASSERT(aConnection);
-   aConnection->AssertIsOnConnectionThread();
--  MOZ_ASSERT(!IndexedDatabaseManager::InLowDiskSpaceMode());
-   MOZ_ASSERT(mMaybeUniqueIndexTable);
- 
-   DebugOnly<void*> storageConnection = aConnection->GetStorageConnection();
-   MOZ_ASSERT(storageConnection);
- 
-   DatabaseConnection::CachedStatement stmt;
-   nsresult rv = aConnection->GetCachedStatement(
-       NS_LITERAL_CSTRING("UPDATE object_data "
-@@ -22369,20 +22325,16 @@ bool CreateIndexOp::Init(TransactionBase
- }
- 
- nsresult CreateIndexOp::DoDatabaseWork(DatabaseConnection* aConnection) {
-   MOZ_ASSERT(aConnection);
-   aConnection->AssertIsOnConnectionThread();
- 
-   AUTO_PROFILER_LABEL("CreateIndexOp::DoDatabaseWork", STORAGE);
- 
--  if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) {
--    return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR;
--  }
--
- #ifdef DEBUG
-   {
-     // Make sure that we're not creating an index with the same name and object
-     // store as another that already exists. This should be impossible because
-     // we should have thrown an error long before now...
-     DatabaseConnection::CachedStatement stmt;
-     MOZ_ALWAYS_SUCCEEDS(aConnection->GetCachedStatement(
-         NS_LITERAL_CSTRING("SELECT name "
-@@ -23107,20 +23059,16 @@ nsresult DeleteIndexOp::DoDatabaseWork(D
- }
- 
- nsresult RenameIndexOp::DoDatabaseWork(DatabaseConnection* aConnection) {
-   MOZ_ASSERT(aConnection);
-   aConnection->AssertIsOnConnectionThread();
- 
-   AUTO_PROFILER_LABEL("RenameIndexOp::DoDatabaseWork", STORAGE);
- 
--  if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) {
--    return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR;
--  }
--
- #ifdef DEBUG
-   {
-     // Make sure that we're not renaming an index with the same name as another
-     // that already exists. This should be impossible because we should have
-     // thrown an error long before now...
-     DatabaseConnection::CachedStatement stmt;
-     MOZ_ALWAYS_SUCCEEDS(aConnection->GetCachedStatement(
-         NS_LITERAL_CSTRING("SELECT name "
-@@ -23570,20 +23518,16 @@ bool ObjectStoreAddOrPutRequestOp::Init(
- nsresult ObjectStoreAddOrPutRequestOp::DoDatabaseWork(
-     DatabaseConnection* aConnection) {
-   MOZ_ASSERT(aConnection);
-   aConnection->AssertIsOnConnectionThread();
-   MOZ_ASSERT(aConnection->GetStorageConnection());
- 
-   AUTO_PROFILER_LABEL("ObjectStoreAddOrPutRequestOp::DoDatabaseWork", STORAGE);
- 
--  if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) {
--    return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR;
--  }
--
-   DatabaseConnection::AutoSavepoint autoSave;
-   nsresult rv = autoSave.Start(Transaction());
-   if (NS_WARN_IF(NS_FAILED(rv))) {
-     return rv;
-   }
- 
-   bool objectStoreHasIndexes;
-   rv =
-diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp
---- a/dom/indexedDB/IndexedDatabaseManager.cpp
-+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
-@@ -3,21 +3,19 @@
- /* This Source Code Form is subject to the terms of the Mozilla Public
-  * License, v. 2.0. If a copy of the MPL was not distributed with this
-  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- 
- #include "IndexedDatabaseManager.h"
- 
- #include "chrome/common/ipc_channel.h"  // for IPC::Channel::kMaximumMessageSize
- #include "nsIConsoleService.h"
--#include "nsIDiskSpaceWatcher.h"
- #include "nsIDOMWindow.h"
- #include "nsIEventTarget.h"
- #include "nsIFile.h"
--#include "nsIObserverService.h"
- #include "nsIScriptError.h"
- #include "nsIScriptGlobalObject.h"
- 
- #include "jsapi.h"
- #include "mozilla/ClearOnShutdown.h"
- #include "mozilla/CondVar.h"
- #include "mozilla/ContentEvents.h"
- #include "mozilla/EventDispatcher.h"
-@@ -58,21 +56,16 @@
- #include "mozilla/dom/IDBObjectStoreBinding.h"
- #include "mozilla/dom/IDBOpenDBRequestBinding.h"
- #include "mozilla/dom/IDBRequestBinding.h"
- #include "mozilla/dom/IDBTransactionBinding.h"
- #include "mozilla/dom/IDBVersionChangeEventBinding.h"
- 
- #define IDB_STR "indexedDB"
- 
--// The two possible values for the data argument when receiving the disk space
--// observer notification.
--#define LOW_DISK_SPACE_DATA_FULL "full"
--#define LOW_DISK_SPACE_DATA_FREE "free"
--
- namespace mozilla {
- namespace dom {
- namespace indexedDB {
- 
- using namespace mozilla::dom::quota;
- using namespace mozilla::ipc;
- 
- class FileManagerInfo {
-@@ -281,47 +274,28 @@ bool IndexedDatabaseManager::sIsMainProc
- bool IndexedDatabaseManager::sFullSynchronousMode = false;
- 
- mozilla::LazyLogModule IndexedDatabaseManager::sLoggingModule("IndexedDB");
- 
- Atomic<IndexedDatabaseManager::LoggingMode>
-     IndexedDatabaseManager::sLoggingMode(
-         IndexedDatabaseManager::Logging_Disabled);
- 
--mozilla::Atomic<bool> IndexedDatabaseManager::sLowDiskSpaceMode(false);
--
- // static
- IndexedDatabaseManager* IndexedDatabaseManager::GetOrCreate() {
-   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
- 
-   if (IsClosed()) {
-     NS_ERROR("Calling GetOrCreate() after shutdown!");
-     return nullptr;
-   }
- 
-   if (!gDBManager) {
-     sIsMainProcess = XRE_IsParentProcess();
- 
--    if (sIsMainProcess &&
--        Preferences::GetBool("disk_space_watcher.enabled", false)) {
--      // See if we're starting up in low disk space conditions.
--      nsCOMPtr<nsIDiskSpaceWatcher> watcher =
--          do_GetService(DISKSPACEWATCHER_CONTRACTID);
--      if (watcher) {
--        bool isDiskFull;
--        if (NS_SUCCEEDED(watcher->GetIsDiskFull(&isDiskFull))) {
--          sLowDiskSpaceMode = isDiskFull;
--        } else {
--          NS_WARNING("GetIsDiskFull failed!");
--        }
--      } else {
--        NS_WARNING("No disk space watcher component available!");
--      }
--    }
--
-     RefPtr<IndexedDatabaseManager> instance(new IndexedDatabaseManager());
- 
-     nsresult rv = instance->Init();
-     NS_ENSURE_SUCCESS(rv, nullptr);
- 
-     if (gInitialized.exchange(true)) {
-       NS_ERROR("Initialized more than once?!");
-     }
-@@ -341,23 +315,16 @@ IndexedDatabaseManager* IndexedDatabaseM
- }
- 
- nsresult IndexedDatabaseManager::Init() {
-   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
- 
-   // During Init() we can't yet call IsMainProcess(), just check sIsMainProcess
-   // directly.
-   if (sIsMainProcess) {
--    nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
--    NS_ENSURE_STATE(obs);
--
--    nsresult rv =
--        obs->AddObserver(this, DISKSPACEWATCHER_OBSERVER_TOPIC, false);
--    NS_ENSURE_SUCCESS(rv, rv);
--
-     mDeleteTimer = NS_NewTimer();
-     NS_ENSURE_STATE(mDeleteTimer);
- 
-     if (QuotaManager* quotaManager = QuotaManager::Get()) {
-       NoteLiveQuotaManager(quotaManager);
-     }
-   }
- 
-@@ -632,24 +599,16 @@ bool IndexedDatabaseManager::IsMainProce
-   NS_ASSERTION(gDBManager,
-                "IsMainProcess() called before indexedDB has been initialized!");
-   NS_ASSERTION((XRE_IsParentProcess()) == sIsMainProcess,
-                "XRE_GetProcessType changed its tune!");
-   return sIsMainProcess;
- }
- 
- // static
--bool IndexedDatabaseManager::InLowDiskSpaceMode() {
--  NS_ASSERTION(gDBManager,
--               "InLowDiskSpaceMode() called before indexedDB has been "
--               "initialized!");
--  return sLowDiskSpaceMode;
--}
--
--// static
- IndexedDatabaseManager::LoggingMode IndexedDatabaseManager::GetLoggingMode() {
-   MOZ_ASSERT(gDBManager,
-              "GetLoggingMode called before IndexedDatabaseManager has been "
-              "initialized!");
- 
-   return sLoggingMode;
- }
- 
-@@ -991,44 +950,17 @@ const nsCString& IndexedDatabaseManager:
-   IndexedDatabaseManager* idbManager = Get();
-   MOZ_ASSERT(idbManager, "IDBManager is not ready!");
- 
-   return idbManager->mLocale;
- }
- 
- NS_IMPL_ADDREF(IndexedDatabaseManager)
- NS_IMPL_RELEASE_WITH_DESTROY(IndexedDatabaseManager, Destroy())
--NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsIObserver, nsITimerCallback,
--                        nsINamed)
--
--NS_IMETHODIMP
--IndexedDatabaseManager::Observe(nsISupports* aSubject, const char* aTopic,
--                                const char16_t* aData) {
--  NS_ASSERTION(IsMainProcess(), "Wrong process!");
--  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
--
--  if (!strcmp(aTopic, DISKSPACEWATCHER_OBSERVER_TOPIC)) {
--    NS_ASSERTION(aData, "No data?!");
--
--    const nsDependentString data(aData);
--
--    if (data.EqualsLiteral(LOW_DISK_SPACE_DATA_FULL)) {
--      sLowDiskSpaceMode = true;
--    } else if (data.EqualsLiteral(LOW_DISK_SPACE_DATA_FREE)) {
--      sLowDiskSpaceMode = false;
--    } else {
--      NS_NOTREACHED("Unknown data value!");
--    }
--
--    return NS_OK;
--  }
--
--  NS_NOTREACHED("Unknown topic!");
--  return NS_ERROR_UNEXPECTED;
--}
-+NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsITimerCallback, nsINamed)
- 
- NS_IMETHODIMP
- IndexedDatabaseManager::Notify(nsITimer* aTimer) {
-   MOZ_ASSERT(IsMainProcess());
-   MOZ_ASSERT(NS_IsMainThread());
-   MOZ_ASSERT(mBackgroundThread);
- 
-   for (auto iter = mPendingDeleteInfos.ConstIter(); !iter.Done(); iter.Next()) {
-diff --git a/dom/indexedDB/IndexedDatabaseManager.h b/dom/indexedDB/IndexedDatabaseManager.h
---- a/dom/indexedDB/IndexedDatabaseManager.h
-+++ b/dom/indexedDB/IndexedDatabaseManager.h
-@@ -2,18 +2,16 @@
- /* vim: set ts=8 sts=2 et sw=2 tw=80: */
- /* This Source Code Form is subject to the terms of the Mozilla Public
-  * License, v. 2.0. If a copy of the MPL was not distributed with this
-  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- 
- #ifndef mozilla_dom_indexeddatabasemanager_h__
- #define mozilla_dom_indexeddatabasemanager_h__
- 
--#include "nsIObserver.h"
--
- #include "js/TypeDecls.h"
- #include "mozilla/Atomics.h"
- #include "mozilla/dom/quota/PersistenceType.h"
- #include "mozilla/Mutex.h"
- #include "nsClassHashtable.h"
- #include "nsCOMPtr.h"
- #include "nsHashKeys.h"
- #include "nsINamed.h"
-@@ -38,35 +36,33 @@ class QuotaManager;
- namespace indexedDB {
- 
- class BackgroundUtilsChild;
- class FileManager;
- class FileManagerInfo;
- 
- }  // namespace indexedDB
- 
--class IndexedDatabaseManager final : public nsIObserver,
--                                     public nsITimerCallback,
-+class IndexedDatabaseManager final : public nsITimerCallback,
-                                      public nsINamed {
-   typedef mozilla::dom::quota::PersistenceType PersistenceType;
-   typedef mozilla::dom::quota::QuotaManager QuotaManager;
-   typedef mozilla::dom::indexedDB::FileManager FileManager;
-   typedef mozilla::dom::indexedDB::FileManagerInfo FileManagerInfo;
- 
-  public:
-   enum LoggingMode {
-     Logging_Disabled = 0,
-     Logging_Concise,
-     Logging_Detailed,
-     Logging_ConciseProfilerMarks,
-     Logging_DetailedProfilerMarks
-   };
- 
-   NS_DECL_ISUPPORTS
--  NS_DECL_NSIOBSERVER
-   NS_DECL_NSITIMERCALLBACK
-   NS_DECL_NSINAMED
- 
-   // Returns a non-owning reference.
-   static IndexedDatabaseManager* GetOrCreate();
- 
-   // Returns a non-owning reference.
-   static IndexedDatabaseManager* Get();
-@@ -77,25 +73,16 @@ class IndexedDatabaseManager final : pub
- #ifdef DEBUG
-       ;
- #else
-   {
-     return sIsMainProcess;
-   }
- #endif
- 
--  static bool InLowDiskSpaceMode()
--#ifdef DEBUG
--      ;
--#else
--  {
--    return !!sLowDiskSpaceMode;
--  }
--#endif
--
-   static bool InTestingMode();
- 
-   static bool FullSynchronous();
- 
-   static LoggingMode GetLoggingMode()
- #ifdef DEBUG
-       ;
- #else
-@@ -204,15 +191,14 @@ class IndexedDatabaseManager final : pub
-   nsCString mLocale;
- 
-   indexedDB::BackgroundUtilsChild* mBackgroundActor;
- 
-   static bool sIsMainProcess;
-   static bool sFullSynchronousMode;
-   static LazyLogModule sLoggingModule;
-   static Atomic<LoggingMode> sLoggingMode;
--  static mozilla::Atomic<bool> sLowDiskSpaceMode;
- };
- 
- }  // namespace dom
- }  // namespace mozilla
- 
- #endif  // mozilla_dom_indexeddatabasemanager_h__
-diff --git a/dom/indexedDB/test/helpers.js b/dom/indexedDB/test/helpers.js
---- a/dom/indexedDB/test/helpers.js
-+++ b/dom/indexedDB/test/helpers.js
-@@ -207,20 +207,16 @@ if (!window.runTest) {
-   {
-     SimpleTest.waitForExplicitFinish();
-     testHarnessGenerator.next();
-   };
- }
- 
- function finishTest()
- {
--  SpecialPowers.notifyObserversInParentProcess(null,
--                                               "disk-space-watcher",
--                                               "free");
--
-   SimpleTest.executeSoon(function() {
-     clearAllDatabases(function() { SimpleTest.finish(); });
-   });
- }
- 
- function browserRunTest()
- {
-   testGenerator.next();
-diff --git a/dom/indexedDB/test/mochitest.ini b/dom/indexedDB/test/mochitest.ini
---- a/dom/indexedDB/test/mochitest.ini
-+++ b/dom/indexedDB/test/mochitest.ini
-@@ -57,17 +57,16 @@ support-files =
-   unit/test_invalid_cursor.js
-   unit/test_invalid_version.js
-   unit/test_invalidate.js
-   unit/test_key_requirements.js
-   unit/test_keys.js
-   unit/test_locale_aware_indexes.js
-   unit/test_locale_aware_index_getAll.js
-   unit/test_locale_aware_index_getAllObjects.js
--  unit/test_lowDiskSpace.js
-   unit/test_maximal_serialized_object_size.js
-   unit/test_multientry.js
-   unit/test_names_sorted.js
-   unit/test_objectCursors.js
-   unit/test_objectStore_getAllKeys.js
-   unit/test_objectStore_inline_autoincrement_key_added_on_put.js
-   unit/test_objectStore_openKeyCursor.js
-   unit/test_objectStore_remove_values.js
-@@ -204,18 +203,16 @@ skip-if = e10s && os == 'win' && os_vers
- [test_invalid_cursor.html]
- [test_invalid_version.html]
- [test_invalidate.html]
- # disabled for the moment
- skip-if = true
- [test_key_requirements.html]
- [test_keys.html]
- [test_leaving_page.html]
--[test_lowDiskSpace.html]
--skip-if = toolkit == 'android' && debug # Bug 1328321
- [test_maximal_serialized_object_size.html]
- [test_message_manager_ipc.html]
- # This test is only supposed to run in the main process.
- skip-if = e10s
- [test_multientry.html]
- [test_names_sorted.html]
- [test_objectCursors.html]
- [test_objectStore_getAllKeys.html]
-diff --git a/dom/indexedDB/test/test_lowDiskSpace.html b/dom/indexedDB/test/test_lowDiskSpace.html
-deleted file mode 100644
---- a/dom/indexedDB/test/test_lowDiskSpace.html
-+++ /dev/null
-@@ -1,19 +0,0 @@
--<!--
--  Any copyright is dedicated to the Public Domain.
--  http://creativecommons.org/publicdomain/zero/1.0/
---->
--<html>
--<head>
--  <title>Indexed Database Low Disk Space Test</title>
--
--  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
--  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
--
--  <script type="text/javascript" src="unit/test_lowDiskSpace.js"></script>
--  <script type="text/javascript" src="helpers.js"></script>
--
--</head>
--
--<body onload="runTest();"></body>
--
--</html>
-diff --git a/dom/indexedDB/test/unit/test_lowDiskSpace.js b/dom/indexedDB/test/unit/test_lowDiskSpace.js
-deleted file mode 100644
---- a/dom/indexedDB/test/unit/test_lowDiskSpace.js
-+++ /dev/null
-@@ -1,753 +0,0 @@
--/**
-- * Any copyright is dedicated to the Public Domain.
-- * http://creativecommons.org/publicdomain/zero/1.0/
-- */
--"use strict";
--
--var disableWorkerTest = "This test uses SpecialPowers";
--
--var self = this;
--
--var testGenerator = testSteps();
--
--function* testSteps()
--{
--  const dbName = self.window ? window.location.pathname : "test_lowDiskSpace";
--  const dbVersion = 1;
--
--  const objectStoreName = "foo";
--  const objectStoreOptions = { keyPath: "foo" };
--
--  const indexName = "bar";
--  const indexOptions = { unique: true };
--
--  const dbData = [
--    { foo: 0, bar: 0 },
--    { foo: 1, bar: 10 },
--    { foo: 2, bar: 20 },
--    { foo: 3, bar: 30 },
--    { foo: 4, bar: 40 },
--    { foo: 5, bar: 50 },
--    { foo: 6, bar: 60 },
--    { foo: 7, bar: 70 },
--    { foo: 8, bar: 80 },
--    { foo: 9, bar: 90 }
--  ];
--
--  let lowDiskMode = false;
--  function setLowDiskMode(val) {
--    let data = val ? "full" : "free";
--
--    if (val == lowDiskMode) {
--      info("Low disk mode is: " + data);
--    }
--    else {
--      info("Changing low disk mode to: " + data);
--      SpecialPowers.notifyObserversInParentProcess(null, "disk-space-watcher",
--                                                   data);
--      lowDiskMode = val;
--    }
--  }
--
--  { // Make sure opening works from the beginning.
--    info("Test 1");
--
--    setLowDiskMode(false);
--
--    let request = indexedDB.open(dbName, dbVersion);
--    request.onerror = errorHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    let event = yield undefined;
--
--    is(event.type, "success", "Opened database without setting low disk mode");
--
--    let db = event.target.result;
--    db.close();
--  }
--
--  { // Make sure delete works in low disk mode.
--    info("Test 2");
--
--    setLowDiskMode(true);
--
--    let request = indexedDB.deleteDatabase(dbName);
--    request.onerror = errorHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    let event = yield undefined;
--
--    is(event.type, "success", "Deleted database after setting low disk mode");
--  }
--
--  { // Make sure creating a db in low disk mode fails.
--    info("Test 3");
--
--    setLowDiskMode(true);
--
--    let request = indexedDB.open(dbName, dbVersion);
--    request.onerror = expectedErrorHandler("QuotaExceededError");
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = unexpectedSuccessHandler;
--    let event = yield undefined;
--
--    is(event.type, "error", "Didn't create new database in low disk mode");
--  }
--
--  { // Make sure opening an already-existing db in low disk mode succeeds.
--    info("Test 4");
--
--    setLowDiskMode(false);
--
--    let request = indexedDB.open(dbName, dbVersion);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = grabEventAndContinueHandler;
--    request.onsuccess = unexpectedSuccessHandler;
--    let event = yield undefined;
--
--    is(event.type, "upgradeneeded", "Upgrading database");
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "success", "Created database");
--    ok(event.target.result === db, "Got the same database");
--
--    db.close();
--
--    setLowDiskMode(true);
--
--    request = indexedDB.open(dbName);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "success", "Opened existing database in low disk mode");
--
--    db = event.target.result;
--    db.close();
--  }
--
--  { // Make sure upgrading an already-existing db in low disk mode succeeds.
--    info("Test 5");
--
--    setLowDiskMode(true);
--
--    let request = indexedDB.open(dbName, dbVersion + 1);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = grabEventAndContinueHandler;
--    request.onsuccess = unexpectedSuccessHandler;
--
--    let event = yield undefined;
--
--    is(event.type, "upgradeneeded", "Upgrading database");
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "success", "Created database");
--    ok(event.target.result === db, "Got the same database");
--
--    db.close();
--  }
--
--  { // Make sure creating objectStores in low disk mode fails.
--    info("Test 6");
--
--    setLowDiskMode(true);
--
--    let request = indexedDB.open(dbName, dbVersion + 2);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = grabEventAndContinueHandler;
--    request.onsuccess = unexpectedSuccessHandler;
--
--    let event = yield undefined;
--
--    is(event.type, "upgradeneeded", "Upgrading database");
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    let txn = event.target.transaction;
--    txn.onerror = expectedErrorHandler("AbortError");
--    txn.onabort = grabEventAndContinueHandler;
--
--    db.createObjectStore(objectStoreName, objectStoreOptions);
--
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    event = yield undefined;
--
--    is(event.type, "abort", "Got correct event type");
--    is(event.target.error.name, "QuotaExceededError", "Got correct error type");
--
--    request.onerror = expectedErrorHandler("AbortError");
--    event = yield undefined;
--  }
--
--  { // Make sure creating indexes in low disk mode fails.
--    info("Test 7");
--
--    setLowDiskMode(false);
--
--    let request = indexedDB.open(dbName, dbVersion + 2);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = grabEventAndContinueHandler;
--    request.onsuccess = unexpectedSuccessHandler;
--
--    let event = yield undefined;
--
--    is(event.type, "upgradeneeded", "Upgrading database");
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    let objectStore = db.createObjectStore(objectStoreName, objectStoreOptions);
--
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "success", "Upgraded database");
--    ok(event.target.result === db, "Got the same database");
--
--    db.close();
--
--    setLowDiskMode(true);
--
--    request = indexedDB.open(dbName, dbVersion + 3);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = grabEventAndContinueHandler;
--    request.onsuccess = unexpectedSuccessHandler;
--    event = yield undefined;
--
--    is(event.type, "upgradeneeded", "Upgrading database");
--
--    db = event.target.result;
--    db.onerror = errorHandler;
--    let txn = event.target.transaction;
--    txn.onerror = expectedErrorHandler("AbortError");
--    txn.onabort = grabEventAndContinueHandler;
--
--    objectStore = event.target.transaction.objectStore(objectStoreName);
--    objectStore.createIndex(indexName, indexName, indexOptions);
--
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    event = yield undefined;
--
--    is(event.type, "abort", "Got correct event type");
--    is(event.target.error.name, "QuotaExceededError", "Got correct error type");
--
--    request.onerror = expectedErrorHandler("AbortError");
--    event = yield undefined;
--  }
--
--  { // Make sure deleting indexes in low disk mode succeeds.
--    info("Test 8");
--
--    setLowDiskMode(false);
--
--    let request = indexedDB.open(dbName, dbVersion + 3);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = grabEventAndContinueHandler;
--    request.onsuccess = unexpectedSuccessHandler;
--
--    let event = yield undefined;
--
--    is(event.type, "upgradeneeded", "Upgrading database");
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    let objectStore = event.target.transaction.objectStore(objectStoreName);
--    objectStore.createIndex(indexName, indexName, indexOptions);
--
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "success", "Upgraded database");
--    ok(event.target.result === db, "Got the same database");
--
--    db.close();
--
--    setLowDiskMode(true);
--
--    request = indexedDB.open(dbName, dbVersion + 4);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = grabEventAndContinueHandler;
--    request.onsuccess = unexpectedSuccessHandler;
--    event = yield undefined;
--
--    is(event.type, "upgradeneeded", "Upgrading database");
--
--    db = event.target.result;
--    db.onerror = errorHandler;
--
--    objectStore = event.target.transaction.objectStore(objectStoreName);
--    objectStore.deleteIndex(indexName);
--
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "success", "Upgraded database");
--    ok(event.target.result === db, "Got the same database");
--
--    db.close();
--  }
--
--  { // Make sure deleting objectStores in low disk mode succeeds.
--    info("Test 9");
--
--    setLowDiskMode(true);
--
--    let request = indexedDB.open(dbName, dbVersion + 5);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = grabEventAndContinueHandler;
--    request.onsuccess = unexpectedSuccessHandler;
--
--    let event = yield undefined;
--
--    is(event.type, "upgradeneeded", "Upgrading database");
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    db.deleteObjectStore(objectStoreName);
--
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "success", "Upgraded database");
--    ok(event.target.result === db, "Got the same database");
--
--    db.close();
--
--    // Reset everything.
--    indexedDB.deleteDatabase(dbName);
--  }
--
--
--  { // Add data that the rest of the tests will use.
--    info("Adding test data");
--
--    setLowDiskMode(false);
--
--    let request = indexedDB.open(dbName, dbVersion);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = grabEventAndContinueHandler;
--    request.onsuccess = unexpectedSuccessHandler;
--    let event = yield undefined;
--
--    is(event.type, "upgradeneeded", "Upgrading database");
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    let objectStore = db.createObjectStore(objectStoreName, objectStoreOptions);
--    objectStore.createIndex(indexName, indexName, indexOptions);
--
--    for (let data of dbData) {
--      objectStore.add(data);
--    }
--
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "success", "Upgraded database");
--    ok(event.target.result === db, "Got the same database");
--
--    db.close();
--  }
--
--  { // Make sure read operations in readonly transactions succeed in low disk
--    // mode.
--    info("Test 10");
--
--    setLowDiskMode(true);
--
--    let request = indexedDB.open(dbName, dbVersion);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    let event = yield undefined;
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    let transaction = db.transaction(objectStoreName);
--    let objectStore = transaction.objectStore(objectStoreName);
--    let index = objectStore.index(indexName);
--
--    let data = dbData[0];
--
--    let requestCounter = new RequestCounter();
--
--    objectStore.get(data.foo).onsuccess = requestCounter.handler();
--    objectStore.mozGetAll().onsuccess = requestCounter.handler();
--    objectStore.count().onsuccess = requestCounter.handler();
--    index.get(data.bar).onsuccess = requestCounter.handler();
--    index.mozGetAll().onsuccess = requestCounter.handler();
--    index.getKey(data.bar).onsuccess = requestCounter.handler();
--    index.mozGetAllKeys().onsuccess = requestCounter.handler();
--    index.count().onsuccess = requestCounter.handler();
--
--    let objectStoreDataCount = 0;
--
--    request = objectStore.openCursor();
--    request.onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        objectStoreDataCount++;
--        objectStoreDataCount % 2 ? cursor.continue() : cursor.advance(1);
--      }
--      else {
--        is(objectStoreDataCount, dbData.length, "Saw all data");
--        requestCounter.decr();
--      }
--    };
--    requestCounter.incr();
--
--    let indexDataCount = 0;
--
--    request = index.openCursor();
--    request.onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        indexDataCount++;
--        indexDataCount % 2 ? cursor.continue() : cursor.advance(1);
--      }
--      else {
--        is(indexDataCount, dbData.length, "Saw all data");
--        requestCounter.decr();
--      }
--    };
--    requestCounter.incr();
--
--    let indexKeyDataCount = 0;
--
--    request = index.openCursor();
--    request.onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        indexKeyDataCount++;
--        indexKeyDataCount % 2 ? cursor.continue() : cursor.advance(1);
--      }
--      else {
--        is(indexKeyDataCount, dbData.length, "Saw all data");
--        requestCounter.decr();
--      }
--    };
--    requestCounter.incr();
--
--    // Wait for all requests.
--    yield undefined;
--
--    transaction.oncomplete = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "complete", "Transaction succeeded");
--
--    db.close();
--  }
--
--  { // Make sure read operations in readwrite transactions succeed in low disk
--    // mode.
--    info("Test 11");
--
--    setLowDiskMode(true);
--
--    let request = indexedDB.open(dbName, dbVersion);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    let event = yield undefined;
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    let transaction = db.transaction(objectStoreName, "readwrite");
--    let objectStore = transaction.objectStore(objectStoreName);
--    let index = objectStore.index(indexName);
--
--    let data = dbData[0];
--
--    let requestCounter = new RequestCounter();
--
--    objectStore.get(data.foo).onsuccess = requestCounter.handler();
--    objectStore.mozGetAll().onsuccess = requestCounter.handler();
--    objectStore.count().onsuccess = requestCounter.handler();
--    index.get(data.bar).onsuccess = requestCounter.handler();
--    index.mozGetAll().onsuccess = requestCounter.handler();
--    index.getKey(data.bar).onsuccess = requestCounter.handler();
--    index.mozGetAllKeys().onsuccess = requestCounter.handler();
--    index.count().onsuccess = requestCounter.handler();
--
--    let objectStoreDataCount = 0;
--
--    request = objectStore.openCursor();
--    request.onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        objectStoreDataCount++;
--        objectStoreDataCount % 2 ? cursor.continue() : cursor.advance(1);
--      }
--      else {
--        is(objectStoreDataCount, dbData.length, "Saw all data");
--        requestCounter.decr();
--      }
--    };
--    requestCounter.incr();
--
--    let indexDataCount = 0;
--
--    request = index.openCursor();
--    request.onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        indexDataCount++;
--        indexDataCount % 2 ? cursor.continue() : cursor.advance(1);
--      }
--      else {
--        is(indexDataCount, dbData.length, "Saw all data");
--        requestCounter.decr();
--      }
--    };
--    requestCounter.incr();
--
--    let indexKeyDataCount = 0;
--
--    request = index.openCursor();
--    request.onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        indexKeyDataCount++;
--        indexKeyDataCount % 2 ? cursor.continue() : cursor.advance(1);
--      }
--      else {
--        is(indexKeyDataCount, dbData.length, "Saw all data");
--        requestCounter.decr();
--      }
--    };
--    requestCounter.incr();
--
--    // Wait for all requests.
--    yield undefined;
--
--    transaction.oncomplete = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "complete", "Transaction succeeded");
--
--    db.close();
--  }
--
--  { // Make sure write operations in readwrite transactions fail in low disk
--    // mode.
--    info("Test 12");
--
--    setLowDiskMode(true);
--
--    let request = indexedDB.open(dbName, dbVersion);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    let event = yield undefined;
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    let transaction = db.transaction(objectStoreName, "readwrite");
--    let objectStore = transaction.objectStore(objectStoreName);
--    let index = objectStore.index(indexName);
--
--    let data = dbData[0];
--    let newData = { foo: 999, bar: 999 };
--
--    let requestCounter = new RequestCounter();
--
--    objectStore.add(newData).onerror = requestCounter.errorHandler();
--    objectStore.put(newData).onerror = requestCounter.errorHandler();
--
--    objectStore.get(data.foo).onsuccess = requestCounter.handler();
--    objectStore.mozGetAll().onsuccess = requestCounter.handler();
--    objectStore.count().onsuccess = requestCounter.handler();
--    index.get(data.bar).onsuccess = requestCounter.handler();
--    index.mozGetAll().onsuccess = requestCounter.handler();
--    index.getKey(data.bar).onsuccess = requestCounter.handler();
--    index.mozGetAllKeys().onsuccess = requestCounter.handler();
--    index.count().onsuccess = requestCounter.handler();
--
--    let objectStoreDataCount = 0;
--
--    request = objectStore.openCursor();
--    request.onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        objectStoreDataCount++;
--        cursor.update(cursor.value).onerror = requestCounter.errorHandler();
--        objectStoreDataCount % 2 ? cursor.continue() : cursor.advance(1);
--      }
--      else {
--        is(objectStoreDataCount, dbData.length, "Saw all data");
--        requestCounter.decr();
--      }
--    };
--    requestCounter.incr();
--
--    let indexDataCount = 0;
--
--    request = index.openCursor();
--    request.onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        indexDataCount++;
--        cursor.update(cursor.value).onerror = requestCounter.errorHandler();
--        indexDataCount % 2 ? cursor.continue() : cursor.advance(1);
--      }
--      else {
--        is(indexDataCount, dbData.length, "Saw all data");
--        requestCounter.decr();
--      }
--    };
--    requestCounter.incr();
--
--    let indexKeyDataCount = 0;
--
--    request = index.openCursor();
--    request.onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        indexKeyDataCount++;
--        cursor.update(cursor.value).onerror = requestCounter.errorHandler();
--        indexKeyDataCount % 2 ? cursor.continue() : cursor.advance(1);
--      }
--      else {
--        is(indexKeyDataCount, dbData.length, "Saw all data");
--        requestCounter.decr();
--      }
--    };
--    requestCounter.incr();
--
--    // Wait for all requests.
--    yield undefined;
--
--    transaction.oncomplete = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "complete", "Transaction succeeded");
--
--    db.close();
--  }
--
--  { // Make sure deleting operations in readwrite transactions succeed in low
--    // disk mode.
--    info("Test 13");
--
--    setLowDiskMode(true);
--
--    let request = indexedDB.open(dbName, dbVersion);
--    request.onerror = errorHandler;
--    request.onupgradeneeded = unexpectedSuccessHandler;
--    request.onsuccess = grabEventAndContinueHandler;
--    let event = yield undefined;
--
--    let db = event.target.result;
--    db.onerror = errorHandler;
--
--    let transaction = db.transaction(objectStoreName, "readwrite");
--    let objectStore = transaction.objectStore(objectStoreName);
--    let index = objectStore.index(indexName);
--
--    let dataIndex = 0;
--    let data = dbData[dataIndex++];
--
--    let requestCounter = new RequestCounter();
--
--    objectStore.delete(data.foo).onsuccess = requestCounter.handler();
--
--    objectStore.openCursor().onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        cursor.delete().onsuccess = requestCounter.handler();
--      }
--      requestCounter.decr();
--    };
--    requestCounter.incr();
--
--    index.openCursor(null, "prev").onsuccess = function(event) {
--      let cursor = event.target.result;
--      if (cursor) {
--        cursor.delete().onsuccess = requestCounter.handler();
--      }
--      requestCounter.decr();
--    };
--    requestCounter.incr();
--
--    yield undefined;
--
--    objectStore.count().onsuccess = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.target.result, dbData.length - 3, "Actually deleted something");
--
--    objectStore.clear();
--    objectStore.count().onsuccess = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.target.result, 0, "Actually cleared");
--
--    transaction.oncomplete = grabEventAndContinueHandler;
--    event = yield undefined;
--
--    is(event.type, "complete", "Transaction succeeded");
--
--    db.close();
--  }
--
--  finishTest();
--}
--
--function RequestCounter(expectedType) {
--  this._counter = 0;
--}
--RequestCounter.prototype = {
--  incr() {
--    this._counter++;
--  },
--
--  decr() {
--    if (!--this._counter) {
--      continueToNextStepSync();
--    }
--  },
--
--  handler(type, preventDefault) {
--    this.incr();
--    return event => {
--      is(event.type, type || "success", "Correct type");
--      this.decr();
--    };
--  },
--
--  errorHandler(eventType, errorName) {
--    this.incr();
--    return event => {
--      is(event.type, eventType || "error", "Correct type");
--      is(event.target.error.name, errorName || "QuotaExceededError",
--          "Correct error name");
--      event.preventDefault();
--      event.stopPropagation();
--      this.decr();
--    };
--  }
--};
-diff --git a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
---- a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
-+++ b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
-@@ -56,19 +56,16 @@ if (!this.runTest) {
-   };
- }
- 
- function finishTest()
- {
-   if (SpecialPowers.isMainProcess()) {
-     resetExperimental();
-     resetTesting();
--
--    SpecialPowers.notifyObserversInParentProcess(null, "disk-space-watcher",
--                                                 "free");
-   }
- 
-   SpecialPowers.removeFiles();
- 
-   executeSoon(function() {
-     do_test_finished();
-   });
- }
-diff --git a/dom/indexedDB/test/unit/xpcshell-parent-process.ini b/dom/indexedDB/test/unit/xpcshell-parent-process.ini
---- a/dom/indexedDB/test/unit/xpcshell-parent-process.ini
-+++ b/dom/indexedDB/test/unit/xpcshell-parent-process.ini
-@@ -43,17 +43,16 @@ skip-if = release_or_beta
- [test_file_copy_failure.js]
- [test_idbSubdirUpgrade.js]
- [test_globalObjects_ipc.js]
- skip-if = toolkit == 'android'
- [test_idle_maintenance.js]
- [test_invalidate.js]
- # disabled for the moment.
- skip-if = true
--[test_lowDiskSpace.js]
- [test_maximal_serialized_object_size.js]
- [test_metadata2Restore.js]
- [test_metadataRestore.js]
- [test_mutableFileUpgrade.js]
- [test_oldDirectories.js]
- [test_quotaExceeded_recovery.js]
- [test_readwriteflush_disabled.js]
- [test_schema18upgrade.js]
-diff --git a/dom/storage/LocalStorageCache.cpp b/dom/storage/LocalStorageCache.cpp
---- a/dom/storage/LocalStorageCache.cpp
-+++ b/dom/storage/LocalStorageCache.cpp
-@@ -212,22 +212,16 @@ bool LocalStorageCache::ProcessUsageDelt
-                                           int64_t aDelta,
-                                           const MutationSource aSource) {
-   return ProcessUsageDelta(GetDataSetIndex(aStorage), aDelta, aSource);
- }
- 
- bool LocalStorageCache::ProcessUsageDelta(uint32_t aGetDataSetIndex,
-                                           const int64_t aDelta,
-                                           const MutationSource aSource) {
--  // Check if we are in a low disk space situation
--  if (aSource == ContentMutation && aDelta > 0 && mManager &&
--      mManager->IsLowDiskSpace()) {
--    return false;
--  }
--
-   // Check limit per this origin
-   Data& data = mData[aGetDataSetIndex];
-   uint64_t newOriginUsage = data.mOriginQuotaUsage + aDelta;
-   if (aSource == ContentMutation && aDelta > 0 &&
-       newOriginUsage > LocalStorageManager::GetQuota()) {
-     return false;
-   }
- 
-diff --git a/dom/storage/LocalStorageManager.cpp b/dom/storage/LocalStorageManager.cpp
---- a/dom/storage/LocalStorageManager.cpp
-+++ b/dom/storage/LocalStorageManager.cpp
-@@ -49,17 +49,17 @@ uint32_t LocalStorageManager::GetQuota()
-     preferencesInitialized = true;
-   }
- 
-   return gQuotaLimit * 1024;  // pref is in kBs
- }
- 
- NS_IMPL_ISUPPORTS(LocalStorageManager, nsIDOMStorageManager)
- 
--LocalStorageManager::LocalStorageManager() : mCaches(8), mLowDiskSpace(false) {
-+LocalStorageManager::LocalStorageManager() : mCaches(8) {
-   StorageObserver* observer = StorageObserver::Self();
-   NS_ASSERTION(
-       observer,
-       "No StorageObserver, cannot observe private data delete notifications!");
- 
-   if (observer) {
-     observer->AddSink(this);
-   }
-@@ -410,26 +410,16 @@ nsresult LocalStorageManager::Observe(co
- 
-   if (!strcmp(aTopic, "profile-change")) {
-     // For case caches are still referenced - clear them completely
-     ClearCaches(LocalStorageCache::kUnloadComplete, pattern, EmptyCString());
-     mCaches.Clear();
-     return NS_OK;
-   }
- 
--  if (!strcmp(aTopic, "low-disk-space")) {
--    mLowDiskSpace = true;
--    return NS_OK;
--  }
--
--  if (!strcmp(aTopic, "no-low-disk-space")) {
--    mLowDiskSpace = false;
--    return NS_OK;
--  }
--
- #ifdef DOM_STORAGE_TESTS
-   if (!strcmp(aTopic, "test-reload")) {
-     // This immediately completely reloads all caches from the database.
-     ClearCaches(LocalStorageCache::kTestReload, pattern, EmptyCString());
-     return NS_OK;
-   }
- 
-   if (!strcmp(aTopic, "test-flushed")) {
-diff --git a/dom/storage/LocalStorageManager.h b/dom/storage/LocalStorageManager.h
---- a/dom/storage/LocalStorageManager.h
-+++ b/dom/storage/LocalStorageManager.h
-@@ -98,22 +98,16 @@ class LocalStorageManager final : public
-                               nsIPrincipal* aPrincipal,
-                               const nsAString& aDocumentURI, bool aPrivate,
-                               nsIDOMStorage** aRetval);
- 
-   // Suffix->origin->cache map
-   typedef nsTHashtable<LocalStorageCacheHashKey> CacheOriginHashtable;
-   nsClassHashtable<nsCStringHashKey, CacheOriginHashtable> mCaches;
- 
--  // If mLowDiskSpace is true it indicates a low device storage situation and
--  // so no localStorage writes are allowed. sessionStorage writes are still
--  // allowed.
--  bool mLowDiskSpace;
--  bool IsLowDiskSpace() const { return mLowDiskSpace; };
--
-   void ClearCaches(uint32_t aUnloadFlags,
-                    const OriginAttributesPattern& aPattern,
-                    const nsACString& aKeyPrefix);
- 
-   // Global getter of localStorage manager service
-   static LocalStorageManager* Self() { return sSelf; }
- 
-   // Like Self, but creates an instance if we're not yet initialized.
-diff --git a/dom/storage/StorageIPC.cpp b/dom/storage/StorageIPC.cpp
---- a/dom/storage/StorageIPC.cpp
-+++ b/dom/storage/StorageIPC.cpp
-@@ -10,17 +10,16 @@
- 
- #include "mozilla/dom/ContentChild.h"
- #include "mozilla/dom/ContentParent.h"
- #include "mozilla/ipc/BackgroundChild.h"
- #include "mozilla/ipc/BackgroundParent.h"
- #include "mozilla/ipc/PBackgroundChild.h"
- #include "mozilla/ipc/PBackgroundParent.h"
- #include "mozilla/Unused.h"
--#include "nsIDiskSpaceWatcher.h"
- #include "nsThreadUtils.h"
- 
- namespace mozilla {
- namespace dom {
- 
- namespace {
- 
- typedef nsClassHashtable<nsCStringHashKey, nsTArray<LocalStorageCacheParent*>>
-@@ -519,67 +518,16 @@ void StorageDBParent::AddIPDLReference()
- void StorageDBParent::ReleaseIPDLReference() {
-   MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference");
-   mIPCOpen = false;
-   Release();
- }
- 
- namespace {
- 
--class CheckLowDiskSpaceRunnable : public Runnable {
--  nsCOMPtr<nsIEventTarget> mOwningEventTarget;
--  RefPtr<StorageDBParent> mParent;
--  bool mLowDiskSpace;
--
-- public:
--  explicit CheckLowDiskSpaceRunnable(StorageDBParent* aParent)
--      : Runnable("dom::CheckLowDiskSpaceRunnable"),
--        mOwningEventTarget(GetCurrentThreadEventTarget()),
--        mParent(aParent),
--        mLowDiskSpace(false) {
--    AssertIsOnBackgroundThread();
--    MOZ_ASSERT(aParent);
--  }
--
-- private:
--  NS_IMETHOD Run() override {
--    if (IsOnBackgroundThread()) {
--      MOZ_ASSERT(mParent);
--
--      if (!mParent->IPCOpen()) {
--        return NS_OK;
--      }
--
--      if (mLowDiskSpace) {
--        mozilla::Unused << mParent->SendObserve(
--            nsDependentCString("low-disk-space"), EmptyString(),
--            EmptyCString());
--      }
--
--      mParent = nullptr;
--
--      return NS_OK;
--    }
--
--    MOZ_ASSERT(NS_IsMainThread());
--
--    nsCOMPtr<nsIDiskSpaceWatcher> diskSpaceWatcher =
--        do_GetService("@mozilla.org/toolkit/disk-space-watcher;1");
--    if (!diskSpaceWatcher) {
--      return NS_OK;
--    }
--
--    diskSpaceWatcher->GetIsDiskFull(&mLowDiskSpace);
--
--    MOZ_ALWAYS_SUCCEEDS(mOwningEventTarget->Dispatch(this, NS_DISPATCH_NORMAL));
--
--    return NS_OK;
--  }
--};
--
- }  // namespace
- 
- StorageDBParent::StorageDBParent(const nsString& aProfilePath)
-     : mProfilePath(aProfilePath), mIPCOpen(false) {
-   AssertIsOnBackgroundThread();
- 
-   // We are always open by IPC only
-   AddIPDLReference();
-@@ -606,24 +554,16 @@ void StorageDBParent::Init() {
-   }
- 
-   StorageDBThread* storageThread = StorageDBThread::Get();
-   if (storageThread) {
-     InfallibleTArray<nsCString> scopes;
-     storageThread->GetOriginsHavingData(&scopes);
-     mozilla::Unused << SendOriginsHavingData(scopes);
-   }
--
--  // We need to check if the device is in a low disk space situation, so
--  // we can forbid in that case any write in localStorage.
--
--  RefPtr<CheckLowDiskSpaceRunnable> runnable =
--      new CheckLowDiskSpaceRunnable(this);
--
--  MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
- }
- 
- StorageDBParent::CacheParentBridge* StorageDBParent::NewCache(
-     const nsACString& aOriginSuffix, const nsACString& aOriginNoSuffix) {
-   return new CacheParentBridge(this, aOriginSuffix, aOriginNoSuffix);
- }
- 
- void StorageDBParent::ActorDestroy(ActorDestroyReason aWhy) {
-diff --git a/dom/storage/StorageObserver.cpp b/dom/storage/StorageObserver.cpp
---- a/dom/storage/StorageObserver.cpp
-+++ b/dom/storage/StorageObserver.cpp
-@@ -65,19 +65,16 @@ nsresult StorageObserver::Init() {
-   obs->AddObserver(sSelf, "extension:purge-localStorage", true);
- 
-   // Shutdown
-   obs->AddObserver(sSelf, "profile-after-change", true);
-   if (XRE_IsParentProcess()) {
-     obs->AddObserver(sSelf, "profile-before-change", true);
-   }
- 
--  // Observe low device storage notifications.
--  obs->AddObserver(sSelf, "disk-space-watcher", true);
--
-   // Testing
- #ifdef DOM_STORAGE_TESTS
-   Preferences::RegisterCallbackAndCall(TestingPrefChanged, kTestingPref);
- #endif
- 
-   return NS_OK;
- }
- 
-@@ -386,26 +383,16 @@ StorageObserver::Observe(nsISupports* aS
-       MOZ_ALWAYS_TRUE(SpinEventLoopUntil([&]() { return done; }));
- 
-       mBackgroundThread = nullptr;
-     }
- 
-     return NS_OK;
-   }
- 
--  if (!strcmp(aTopic, "disk-space-watcher")) {
--    if (NS_LITERAL_STRING("full").Equals(aData)) {
--      Notify("low-disk-space");
--    } else if (NS_LITERAL_STRING("free").Equals(aData)) {
--      Notify("no-low-disk-space");
--    }
--
--    return NS_OK;
--  }
--
- #ifdef DOM_STORAGE_TESTS
-   if (!strcmp(aTopic, "domstorage-test-flush-force")) {
-     StorageDBChild* storageChild = StorageDBChild::GetOrCreate();
-     if (NS_WARN_IF(!storageChild)) {
-       return NS_ERROR_FAILURE;
-     }
- 
-     storageChild->SendAsyncFlush();
-diff --git a/dom/tests/mochitest/ajax/offline/mochitest.ini b/dom/tests/mochitest/ajax/offline/mochitest.ini
---- a/dom/tests/mochitest/ajax/offline/mochitest.ini
-+++ b/dom/tests/mochitest/ajax/offline/mochitest.ini
-@@ -75,18 +75,16 @@ support-files =
- [test_bug744719.html]
- [test_bug765203.html]
- [test_bypass.html]
- [test_cancelOfflineCache.html]
- [test_changingManifest.html]
- [test_fallback.html]
- [test_foreign.html]
- [test_identicalManifest.html]
--[test_lowDeviceStorage.html]
--[test_lowDeviceStorageDuringUpdate.html]
- [test_missingFile.html]
- [test_missingManifest.html]
- [test_noManifest.html]
- [test_obsolete.html]
- [test_offlineIFrame.html]
- [test_offlineMode.html]
- skip-if = true # disabled due to bug 656943
- [test_overlap.html]
-diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html
-deleted file mode 100644
---- a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html
-+++ /dev/null
-@@ -1,91 +0,0 @@
--<html xmlns="http://www.w3.org/1999/xhtml">
--<head>
--<title>Low device storage</title>
--
--<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
--<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
--<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
--
--<script type="text/javascript">
--
--/**
-- * This test checks that an offline cache update scheduled *after* a low device
-- * storage situation appears is canceled. It basically does:
-- *
-- * 1. Notifies to the offline cache update service about a fake
-- *    low device storage situation.
-- * 2. Schedules an update and observes for its notifications.
-- * 3. We are supposed to receive an error event notifying about the cancelation
-- *    of the update because of the low storage situation.
-- * 4. Notifies to the offline cache update service that we've recovered from
-- *    the low storage situation.
-- */
--
--var updateService = SpecialPowers.Cc['@mozilla.org/offlinecacheupdate-service;1']
--                                 .getService(Ci.nsIOfflineCacheUpdateService);
--
--var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
--                       .getService(SpecialPowers.Ci.nsIObserverService);
--
--var errorReceived = false;
--
--var systemPrincipal = SpecialPowers.Services.scriptSecurityManager.getSystemPrincipal();
--
--function finish() {
--  obs.notifyObservers(updateService, "disk-space-watcher", "free");
--
--  OfflineTest.teardownAndFinish();
--}
--
--if (OfflineTest.setup()) {
--  obs.notifyObservers(updateService, "disk-space-watcher", "full");
--
--  var updateObserver = SpecialPowers.wrapCallbackObject({
--    updateStateChanged: function (aUpdate, aState) {
--      switch(aState) {
--        case Ci.nsIOfflineCacheUpdateObserver.STATE_ERROR:
--          errorReceived = true;
--          OfflineTest.ok(true, "Expected error. Update canceled");
--        break;
--        case Ci.nsIOfflineCacheUpdateObserver.STATE_FINISHED:
--          aUpdate.removeObserver(this);
--          OfflineTest.ok(errorReceived,
--                         "Finished after receiving the expected error");
--          finish();
--        break;
--        case Ci.nsIOfflineCacheUpdateObserver.STATE_NOUPDATE:
--          aUpdate.removeObserver(this);
--          OfflineTest.ok(false, "No update");
--          finish();
--          break;
--        case Ci.nsIOfflineCacheUpdateObserver.STATE_DOWNLOADING:
--        case Ci.nsIOfflineCacheUpdateObserver.STATE_ITEMSTARTED:
--        case Ci.nsIOfflineCacheUpdateObserver.STATE_ITEMPROGRESS:
--          aUpdate.removeObserver(this);
--          OfflineTest.ok(false, "The update was supposed to be canceled");
--          finish();
--          break;
--      }
--    },
--    applicationCacheAvailable: function() {}
--  });
--
--  var manifest = "https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
--  var ioService = Cc["@mozilla.org/network/io-service;1"]
--                  .getService(Ci.nsIIOService);
--  var manifestURI = ioService.newURI(manifest);
--  var documentURI = ioService.newURI(document.documentURI);
--  var update = updateService.scheduleUpdate(manifestURI, documentURI, systemPrincipal, window);
--  update.addObserver(updateObserver, false);
--}
--
--SimpleTest.waitForExplicitFinish();
--
--</script>
--
--</head>
--
--<body>
--
--</body>
--</html>
-diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html
-deleted file mode 100644
---- a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html
-+++ /dev/null
-@@ -1,58 +0,0 @@
--<html xmlns="http://www.w3.org/1999/xhtml" manifest="https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
--<head>
--<title>Low device storage during update</title>
--
--<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
--<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
--<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
--
--<script type="text/javascript">
--
--/**
-- * This test checks that an offline cache update is canceled when a low device
-- * storage condition is detected during the update.
-- */
--
--var updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
--                    .getService(Ci.nsIOfflineCacheUpdateService);
--
--var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
--                       .getService(SpecialPowers.Ci.nsIObserverService);
--
--function finish() {
--  obs.notifyObservers(updateService, "disk-space-watcher", "free");
--
--  OfflineTest.teardownAndFinish();
--}
--
--function onError() {
--  OfflineTest.ok(true, "Expected error: Update canceled");
--  finish();
--}
--
--function onUnexpectedEvent() {
--  OfflineTest.ok(false, "The update was supposed to be canceled");
--  finish();
--}
--
--function onChecking() {
--  obs.notifyObservers(updateService, "disk-space-watcher", "full");
--}
--
--if (OfflineTest.setup()) {
--  applicationCache.onerror = OfflineTest.priv(onError);
--  applicationCache.onprogress = OfflineTest.priv(onUnexpectedEvent);
--  applicationCache.oncached = OfflineTest.priv(onUnexpectedEvent);
--  applicationCache.onchecking = OfflineTest.priv(onChecking);
--}
--
--SimpleTest.waitForExplicitFinish();
--
--</script>
--
--</head>
--
--<body>
--
--</body>
--</html>
-diff --git a/dom/tests/mochitest/localstorage/mochitest.ini b/dom/tests/mochitest/localstorage/mochitest.ini
---- a/dom/tests/mochitest/localstorage/mochitest.ini
-+++ b/dom/tests/mochitest/localstorage/mochitest.ini
-@@ -43,12 +43,11 @@ skip-if = toolkit == 'android' #TIMED_OU
- [test_localStorageQuota.html]
- skip-if = toolkit == 'android' #TIMED_OUT
- [test_localStorageQuotaSessionOnly.html]
- skip-if = toolkit == 'android' #TIMED_OUT
- [test_localStorageQuotaSessionOnly2.html]
- skip-if = true # bug 1347690
- [test_localStorageReplace.html]
- skip-if = toolkit == 'android'
--[test_lowDeviceStorage.html]
- [test_storageConstructor.html]
- [test_localStorageSessionPrefOverride.html]
- [test_firstPartyOnlyPermission.html]
-diff --git a/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html b/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html
-deleted file mode 100644
---- a/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html
-+++ /dev/null
-@@ -1,75 +0,0 @@
--<html xmlns="http://www.w3.org/1999/xhtml">
--<head>
--<title>Test localStorage usage while in a low device storage situation</title>
--
--<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
--<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
--
--<script type="text/javascript">
--
--/*
--This test does the following:
--- Stores an item in localStorage.
--- Checks the stored value.
--- Emulates a low device storage situation.
--- Gets the stored item again.
--- Removes the stored item.
--- Fails storing a new value.
--- Emulates recovering from a low device storage situation.
--- Stores a new value.
--- Checks the stored value.
--*/
--
--function lowDeviceStorage(lowStorage) {
--  var data = lowStorage ? "full" : "free";
--  SpecialPowers.Services.obs.notifyObservers(null, "disk-space-watcher", data);
--}
--
--function startTest() {
--  // Add a test item.
--  localStorage.setItem("item", "value");
--  is(localStorage.getItem("item"), "value", "getItem()");
--
--  // Emulates a low device storage situation.
--  lowDeviceStorage(true);
--
--  // Checks that we can still access to the stored item.
--  is(localStorage.getItem("item"), "value",
--     "getItem() during a device storage situation");
--
--  // Removes the stored item.
--  localStorage.removeItem("item");
--  is(localStorage.getItem("item"), null,
--     "getItem() after removing the item");
--
--  // Fails storing a new item.
--  try {
--    localStorage.setItem("newItem", "value");
--    ok(false, "Storing a new item is expected to fail");
--  } catch(e) {
--    ok(true, "Got an expected exception " + e);
--  } finally {
--    is(localStorage.getItem("newItem"), null,
--       "setItem while device storage is low");
--  }
--
--  // Emulates recovering from a low device storage situation.
--  lowDeviceStorage(false);
--
--  // Add a test item after recovering from the low device storage situation.
--  localStorage.setItem("newItem", "value");
--  is(localStorage.getItem("newItem"), "value",
--     "getItem() with available storage");
--
--  SimpleTest.finish();
--}
--
--SimpleTest.waitForExplicitFinish();
--
--</script>
--
--</head>
--
--<body onload="startTest();">
--</body>
--</html>
-diff --git a/hal/Hal.cpp b/hal/Hal.cpp
---- a/hal/Hal.cpp
-+++ b/hal/Hal.cpp
-@@ -65,20 +65,16 @@ mozilla::LogModule* GetHalLog() {
- }
- 
- namespace {
- 
- void AssertMainThread() { MOZ_ASSERT(NS_IsMainThread()); }
- 
- bool InSandbox() { return GeckoProcessType_Content == XRE_GetProcessType(); }
- 
--void AssertMainProcess() {
--  MOZ_ASSERT(GeckoProcessType_Default == XRE_GetProcessType());
--}
--
- bool WindowIsActive(nsPIDOMWindowInner* aWindow) {
-   nsIDocument* document = aWindow->GetDoc();
-   NS_ENSURE_TRUE(document, false);
- 
-   return !document->Hidden();
- }
- 
- StaticAutoPtr<WindowIdentifier::IDArrayType> gLastIDToVibrate;
-@@ -536,22 +532,10 @@ const char* ProcessPriorityToString(Proc
-     case PROCESS_PRIORITY_UNKNOWN:
-       return "UNKNOWN";
-     default:
-       MOZ_ASSERT(false);
-       return "???";
-   }
- }
- 
--void StartDiskSpaceWatcher() {
--  AssertMainProcess();
--  AssertMainThread();
--  PROXY_IF_SANDBOXED(StartDiskSpaceWatcher());
--}
--
--void StopDiskSpaceWatcher() {
--  AssertMainProcess();
--  AssertMainThread();
--  PROXY_IF_SANDBOXED(StopDiskSpaceWatcher());
--}
--
- }  // namespace hal
- }  // namespace mozilla
-diff --git a/hal/Hal.h b/hal/Hal.h
---- a/hal/Hal.h
-+++ b/hal/Hal.h
-@@ -273,30 +273,16 @@ bool SetProcessPrioritySupported();
-  * Set the priority of the given process.
-  *
-  * Exactly what this does will vary between platforms.  On *nix we might give
-  * background processes higher nice values.  On other platforms, we might
-  * ignore this call entirely.
-  */
- void SetProcessPriority(int aPid, hal::ProcessPriority aPriority);
- 
--/**
-- * Start monitoring disk space for low space situations.
-- *
-- * This API is currently only allowed to be used from the main process.
-- */
--void StartDiskSpaceWatcher();
--
--/**
-- * Stop monitoring disk space for low space situations.
-- *
-- * This API is currently only allowed to be used from the main process.
-- */
--void StopDiskSpaceWatcher();
--
- }  // namespace MOZ_HAL_NAMESPACE
- }  // namespace mozilla
- 
- #ifdef MOZ_DEFINED_HAL_NAMESPACE
- #undef MOZ_DEFINED_HAL_NAMESPACE
- #undef MOZ_HAL_NAMESPACE
- #endif
- 
-diff --git a/hal/fallback/FallbackDiskSpaceWatcher.cpp b/hal/fallback/FallbackDiskSpaceWatcher.cpp
-deleted file mode 100644
---- a/hal/fallback/FallbackDiskSpaceWatcher.cpp
-+++ /dev/null
-@@ -1,13 +0,0 @@
--/* This Source Code Form is subject to the terms of the Mozilla Public
-- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
-- * You can obtain one at http://mozilla.org/MPL/2.0/. */
--
--namespace mozilla {
--namespace hal_impl {
--
--void StartDiskSpaceWatcher() {}
--
--void StopDiskSpaceWatcher() {}
--
--}  // namespace hal_impl
--}  // namespace mozilla
-diff --git a/hal/moz.build b/hal/moz.build
---- a/hal/moz.build
-+++ b/hal/moz.build
-@@ -92,17 +92,16 @@ else:
-         'fallback/FallbackBattery.cpp',
-         'fallback/FallbackScreenConfiguration.cpp',
-         'fallback/FallbackSensor.cpp',
-         'fallback/FallbackVibration.cpp',
-     ]
- 
- # Fallbacks for backends no longer implemented.
- UNIFIED_SOURCES += [
--    'fallback/FallbackDiskSpaceWatcher.cpp',
-     'fallback/FallbackProcessPriority.cpp',
- ]
- 
- # Fallbacks for backends implemented on Android only.
- if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
-     UNIFIED_SOURCES += [
-         'fallback/FallbackNetwork.cpp',
-     ]
-diff --git a/hal/sandbox/SandboxHal.cpp b/hal/sandbox/SandboxHal.cpp
---- a/hal/sandbox/SandboxHal.cpp
-+++ b/hal/sandbox/SandboxHal.cpp
-@@ -137,24 +137,16 @@ bool SetAlarm(int32_t aSeconds, int32_t 
- void SetProcessPriority(int aPid, ProcessPriority aPriority) {
-   MOZ_CRASH("Only the main process may set processes' priorities.");
- }
- 
- bool SetProcessPrioritySupported() {
-   MOZ_CRASH("Only the main process may call SetProcessPrioritySupported().");
- }
- 
--void StartDiskSpaceWatcher() {
--  MOZ_CRASH("StartDiskSpaceWatcher() can't be called from sandboxed contexts.");
--}
--
--void StopDiskSpaceWatcher() {
--  MOZ_CRASH("StopDiskSpaceWatcher() can't be called from sandboxed contexts.");
--}
--
- class HalParent : public PHalParent,
-                   public BatteryObserver,
-                   public NetworkObserver,
-                   public ISensorObserver,
-                   public WakeLockObserver,
-                   public ScreenConfigurationObserver {
-  public:
-   virtual void ActorDestroy(ActorDestroyReason aWhy) override {
-diff --git a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp b/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp
-deleted file mode 100644
---- a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp
-+++ /dev/null
-@@ -1,144 +0,0 @@
--/* This Source Code Form is subject to the terms of the Mozilla Public
-- * License, v. 2.0. If a copy of the MPL was not distributed with this
-- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
--
--#include "DiskSpaceWatcher.h"
--#include "nsIObserverService.h"
--#include "nsXULAppAPI.h"
--#include "mozilla/Hal.h"
--#include "mozilla/ModuleUtils.h"
--#include "mozilla/Preferences.h"
--#include "mozilla/ClearOnShutdown.h"
--#include "mozilla/Services.h"
--
--#define NS_DISKSPACEWATCHER_CID                      \
--  {                                                  \
--    0xab218518, 0xf197, 0x4fb4, {                    \
--      0x8b, 0x0f, 0x8b, 0xb3, 0x4d, 0xf2, 0x4b, 0xf4 \
--    }                                                \
--  }
--
--using namespace mozilla;
--
--StaticRefPtr<DiskSpaceWatcher> gDiskSpaceWatcher;
--
--NS_IMPL_ISUPPORTS(DiskSpaceWatcher, nsIDiskSpaceWatcher, nsIObserver)
--
--uint64_t DiskSpaceWatcher::sFreeSpace = 0;
--bool DiskSpaceWatcher::sIsDiskFull = false;
--
--DiskSpaceWatcher::DiskSpaceWatcher() {
--  MOZ_ASSERT(NS_IsMainThread());
--  MOZ_ASSERT(!gDiskSpaceWatcher);
--}
--
--DiskSpaceWatcher::~DiskSpaceWatcher() { MOZ_ASSERT(!gDiskSpaceWatcher); }
--
--already_AddRefed<DiskSpaceWatcher> DiskSpaceWatcher::FactoryCreate() {
--  if (!XRE_IsParentProcess()) {
--    return nullptr;
--  }
--
--  MOZ_ASSERT(NS_IsMainThread());
--
--  if (!Preferences::GetBool("disk_space_watcher.enabled", false)) {
--    return nullptr;
--  }
--
--  if (!gDiskSpaceWatcher) {
--    gDiskSpaceWatcher = new DiskSpaceWatcher();
--    ClearOnShutdown(&gDiskSpaceWatcher);
--  }
--
--  RefPtr<DiskSpaceWatcher> service = gDiskSpaceWatcher.get();
--  return service.forget();
--}
--
--NS_IMETHODIMP
--DiskSpaceWatcher::Observe(nsISupports* aSubject, const char* aTopic,
--                          const char16_t* aData) {
--  MOZ_ASSERT(NS_IsMainThread());
--
--  if (!strcmp(aTopic, "profile-after-change")) {
--    nsCOMPtr<nsIObserverService> observerService =
--        mozilla::services::GetObserverService();
--    observerService->AddObserver(this, "profile-before-change", false);
--    mozilla::hal::StartDiskSpaceWatcher();
--    return NS_OK;
--  }
--
--  if (!strcmp(aTopic, "profile-before-change")) {
--    nsCOMPtr<nsIObserverService> observerService =
--        mozilla::services::GetObserverService();
--    observerService->RemoveObserver(this, "profile-before-change");
--    mozilla::hal::StopDiskSpaceWatcher();
--    return NS_OK;
--  }
--
--  MOZ_ASSERT(false, "DiskSpaceWatcher got unexpected topic!");
--  return NS_ERROR_UNEXPECTED;
--}
--
--NS_IMETHODIMP DiskSpaceWatcher::GetIsDiskFull(bool* aIsDiskFull) {
--  *aIsDiskFull = sIsDiskFull;
--  return NS_OK;
--}
--
--// GetFreeSpace is a macro on windows, and that messes up with the c++
--// compiler.
--#ifdef XP_WIN
--#undef GetFreeSpace
--#endif
--NS_IMETHODIMP DiskSpaceWatcher::GetFreeSpace(uint64_t* aFreeSpace) {
--  *aFreeSpace = sFreeSpace;
--  return NS_OK;
--}
--
--// static
--void DiskSpaceWatcher::UpdateState(bool aIsDiskFull, uint64_t aFreeSpace) {
--  MOZ_ASSERT(NS_IsMainThread());
--  if (!gDiskSpaceWatcher) {
--    return;
--  }
--
--  nsCOMPtr<nsIObserverService> observerService =
--      mozilla::services::GetObserverService();
--
--  sIsDiskFull = aIsDiskFull;
--  sFreeSpace = aFreeSpace;
--
--  if (!observerService) {
--    return;
--  }
--
--  const char16_t stateFull[] = {'f', 'u', 'l', 'l', 0};
--  const char16_t stateFree[] = {'f', 'r', 'e', 'e', 0};
--
--  nsCOMPtr<nsISupports> subject;
--  CallQueryInterface(gDiskSpaceWatcher.get(), getter_AddRefs(subject));
--  MOZ_ASSERT(subject);
--  observerService->NotifyObservers(subject, DISKSPACEWATCHER_OBSERVER_TOPIC,
--                                   sIsDiskFull ? stateFull : stateFree);
--}
--
--NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(DiskSpaceWatcher,
--                                         DiskSpaceWatcher::FactoryCreate)
--
--NS_DEFINE_NAMED_CID(NS_DISKSPACEWATCHER_CID);
--
--static const mozilla::Module::CIDEntry kDiskSpaceWatcherCIDs[] = {
--    {&kNS_DISKSPACEWATCHER_CID, false, nullptr, DiskSpaceWatcherConstructor},
--    {nullptr}};
--
--static const mozilla::Module::ContractIDEntry kDiskSpaceWatcherContracts[] = {
--    {"@mozilla.org/toolkit/disk-space-watcher;1", &kNS_DISKSPACEWATCHER_CID},
--    {nullptr}};
--
--static const mozilla::Module::CategoryEntry kDiskSpaceWatcherCategories[] = {
--    {nullptr}};
--
--static const mozilla::Module kDiskSpaceWatcherModule = {
--    mozilla::Module::kVersion, kDiskSpaceWatcherCIDs,
--    kDiskSpaceWatcherContracts, kDiskSpaceWatcherCategories};
--
--NSMODULE_DEFN(DiskSpaceWatcherModule) = &kDiskSpaceWatcherModule;
-diff --git a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.h b/toolkit/components/diskspacewatcher/DiskSpaceWatcher.h
-deleted file mode 100644
---- a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.h
-+++ /dev/null
-@@ -1,29 +0,0 @@
--/* This Source Code Form is subject to the terms of the Mozilla Public
-- * License, v. 2.0. If a copy of the MPL was not distributed with this
-- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
--
--#ifndef __DISKSPACEWATCHER_H__
--
--#include "nsIDiskSpaceWatcher.h"
--#include "nsIObserver.h"
--#include "nsCOMPtr.h"
--
--class DiskSpaceWatcher final : public nsIDiskSpaceWatcher, public nsIObserver {
-- public:
--  NS_DECL_ISUPPORTS
--  NS_DECL_NSIDISKSPACEWATCHER
--  NS_DECL_NSIOBSERVER
--
--  static already_AddRefed<DiskSpaceWatcher> FactoryCreate();
--
--  static void UpdateState(bool aIsDiskFull, uint64_t aFreeSpace);
--
-- private:
--  DiskSpaceWatcher();
--  ~DiskSpaceWatcher();
--
--  static uint64_t sFreeSpace;
--  static bool sIsDiskFull;
--};
--
--#endif  // __DISKSPACEWATCHER_H__
-diff --git a/toolkit/components/diskspacewatcher/moz.build b/toolkit/components/diskspacewatcher/moz.build
-deleted file mode 100644
---- a/toolkit/components/diskspacewatcher/moz.build
-+++ /dev/null
-@@ -1,26 +0,0 @@
--# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
--# vim: set filetype=python:
--# This Source Code Form is subject to the terms of the Mozilla Public
--# License, v. 2.0. If a copy of the MPL was not distributed with this
--# file, You can obtain one at http://mozilla.org/MPL/2.0/.
--
--with Files('**'):
--    BUG_COMPONENT = ('Toolkit', 'General')
--
--XPIDL_SOURCES += [
--    'nsIDiskSpaceWatcher.idl',
--]
--
--EXPORTS += [
--    'DiskSpaceWatcher.h'
--]
--
--XPIDL_MODULE = 'diskspacewatcher'
--
--SOURCES = [
--    'DiskSpaceWatcher.cpp',
--]
--
--include('/ipc/chromium/chromium-config.mozbuild')
--
--FINAL_LIBRARY = 'xul'
-diff --git a/toolkit/components/diskspacewatcher/nsIDiskSpaceWatcher.idl b/toolkit/components/diskspacewatcher/nsIDiskSpaceWatcher.idl
-deleted file mode 100644
---- a/toolkit/components/diskspacewatcher/nsIDiskSpaceWatcher.idl
-+++ /dev/null
-@@ -1,25 +0,0 @@
--/* This Source Code Form is subject to the terms of the Mozilla Public
-- * License, v. 2.0. If a copy of the MPL was not distributed with this
-- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
--
--#include "nsISupports.idl"
--
--%{ C++
--#ifdef XP_WIN
--#undef GetFreeSpace
--#endif
--%}
--
--[scriptable, uuid(3aceba74-2ed5-4e99-8fe4-06e90e2b8ef0)]
--interface nsIDiskSpaceWatcher : nsISupports
--{
--  readonly attribute bool isDiskFull; // True if we are low on disk space.
--  readonly attribute unsigned long long freeSpace; // The free space currently available.
--};
--
--%{ C++
--#define DISKSPACEWATCHER_CONTRACTID "@mozilla.org/toolkit/disk-space-watcher;1"
--
--// The data for this notification will be either 'free' or 'full'.
--#define DISKSPACEWATCHER_OBSERVER_TOPIC "disk-space-watcher"
--%}
-diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build
---- a/toolkit/components/moz.build
-+++ b/toolkit/components/moz.build
-@@ -22,17 +22,16 @@ DIRS += [
-     'backgroundhangmonitor',
-     'browser',
-     'cloudstorage',
-     'commandlines',
-     'contentprefs',
-     'contextualidentity',
-     'crashes',
-     'crashmonitor',
--    'diskspacewatcher',
-     'downloads',
-     'enterprisepolicies',
-     'extensions',
-     'filewatcher',
-     'finalizationwitness',
-     'find',
-     'jsoncpp/src/lib_json',
-     'lz4',
-diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.h b/uriloader/prefetch/nsOfflineCacheUpdate.h
---- a/uriloader/prefetch/nsOfflineCacheUpdate.h
-+++ b/uriloader/prefetch/nsOfflineCacheUpdate.h
-@@ -353,12 +353,11 @@ class nsOfflineCacheUpdateService final 
- 
-   nsresult ProcessNextUpdate();
- 
-   nsTArray<RefPtr<nsOfflineCacheUpdate> > mUpdates;
-   static nsTHashtable<nsCStringHashKey> *mAllowedDomains;
- 
-   bool mDisabled;
-   bool mUpdateRunning;
--  bool mLowFreeSpace;
- };
- 
- #endif
-diff --git a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
---- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
-+++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
-@@ -34,17 +34,16 @@
- #include "nsStreamUtils.h"
- #include "nsThreadUtils.h"
- #include "nsProxyRelease.h"
- #include "mozilla/Logging.h"
- #include "nsIAsyncVerifyRedirectCallback.h"
- #include "mozilla/Preferences.h"
- #include "mozilla/Attributes.h"
- #include "mozilla/Unused.h"
--#include "nsIDiskSpaceWatcher.h"
- #include "nsIDocShell.h"
- #include "nsIDocShellTreeItem.h"
- #include "nsIDocShellTreeOwner.h"
- #include "mozilla/dom/ContentChild.h"
- #include "mozilla/dom/PermissionMessageUtils.h"
- #include "nsContentUtils.h"
- #include "mozilla/Unused.h"
- 
-@@ -229,17 +228,17 @@ nsOfflineCachePendingUpdate::OnSecurityC
- NS_IMPL_ISUPPORTS(nsOfflineCacheUpdateService, nsIOfflineCacheUpdateService,
-                   nsIObserver, nsISupportsWeakReference)
- 
- //-----------------------------------------------------------------------------
- // nsOfflineCacheUpdateService <public>
- //-----------------------------------------------------------------------------
- 
- nsOfflineCacheUpdateService::nsOfflineCacheUpdateService()
--    : mDisabled(false), mUpdateRunning(false), mLowFreeSpace(false) {
-+    : mDisabled(false), mUpdateRunning(false) {
-   MOZ_ASSERT(NS_IsMainThread());
-   Preferences::AddBoolVarCache(&sAllowOfflineCache,
-                                "browser.cache.offline.enable", true);
-   Preferences::AddBoolVarCache(&sAllowInsecureOfflineCache,
-                                "browser.cache.offline.insecure.enable", true);
- }
- 
- nsOfflineCacheUpdateService::~nsOfflineCacheUpdateService() {
-@@ -255,29 +254,16 @@ nsresult nsOfflineCacheUpdateService::In
-   nsCOMPtr<nsIObserverService> observerService =
-       mozilla::services::GetObserverService();
-   if (!observerService) return NS_ERROR_FAILURE;
- 
-   nsresult rv =
-       observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
-   NS_ENSURE_SUCCESS(rv, rv);
- 
--  // Get the current status of the disk in terms of free space and observe
--  // low device storage notifications.
--  nsCOMPtr<nsIDiskSpaceWatcher> diskSpaceWatcherService =
--      do_GetService("@mozilla.org/toolkit/disk-space-watcher;1");
--  if (diskSpaceWatcherService) {
--    diskSpaceWatcherService->GetIsDiskFull(&mLowFreeSpace);
--  } else {
--    NS_WARNING("Could not get disk status from nsIDiskSpaceWatcher");
--  }
--
--  rv = observerService->AddObserver(this, "disk-space-watcher", false);
--  NS_ENSURE_SUCCESS(rv, rv);
--
-   gOfflineCacheUpdateService = this;
- 
-   return NS_OK;
- }
- 
- /* static */
- already_AddRefed<nsOfflineCacheUpdateService>
- nsOfflineCacheUpdateService::GetInstance() {
-@@ -370,21 +356,17 @@ nsresult nsOfflineCacheUpdateService::Pr
-        mUpdates.Length()));
- 
-   if (mDisabled) return NS_ERROR_ABORT;
- 
-   if (mUpdateRunning) return NS_OK;
- 
-   if (mUpdates.Length() > 0) {
-     mUpdateRunning = true;
--    // Canceling the update before Begin() call will make the update
--    // asynchronously finish with an error.
--    if (mLowFreeSpace) {
--      mUpdates[0]->Cancel();
--    }
-+
-     return mUpdates[0]->Begin();
-   }
- 
-   return NS_OK;
- }
- 
- //-----------------------------------------------------------------------------
- // nsOfflineCacheUpdateService::nsIOfflineCacheUpdateService
-@@ -528,27 +510,16 @@ NS_IMETHODIMP nsOfflineCacheUpdateServic
- NS_IMETHODIMP
- nsOfflineCacheUpdateService::Observe(nsISupports *aSubject, const char *aTopic,
-                                      const char16_t *aData) {
-   if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
-     if (mUpdates.Length() > 0) mUpdates[0]->Cancel();
-     mDisabled = true;
-   }
- 
--  if (!strcmp(aTopic, "disk-space-watcher")) {
--    if (NS_LITERAL_STRING("full").Equals(aData)) {
--      mLowFreeSpace = true;
--      for (uint32_t i = 0; i < mUpdates.Length(); i++) {
--        mUpdates[i]->Cancel();
--      }
--    } else if (NS_LITERAL_STRING("free").Equals(aData)) {
--      mLowFreeSpace = false;
--    }
--  }
--
-   return NS_OK;
- }
- 
- //-----------------------------------------------------------------------------
- // nsOfflineCacheUpdateService::nsIOfflineCacheUpdateService
- //-----------------------------------------------------------------------------
- 
- static nsresult OfflineAppPermForPrincipal(nsIPrincipal *aPrincipal,

+ 0 - 9187
rel-257/mozilla-esr60/patches/1491467-64a1.patch

@@ -1,9187 +0,0 @@
-# HG changeset patch
-# User Ryan VanderMeulen <ryanvm@gmail.com>
-# Date 1537295591 0
-# Node ID 4e5643db5a23372cc1095c5ef60eca76b958c493
-# Parent  85b4ccdc6ef24d4e0c1041af69112aea953845f0
-Bug 1491467 - Update libpng to 1.6.35. r=aosmond
-
-Differential Revision: https://phabricator.services.mozilla.com/D5913
-
-diff --git a/media/libpng/CHANGES b/media/libpng/CHANGES
---- a/media/libpng/CHANGES
-+++ b/media/libpng/CHANGES
-@@ -1,9 +1,8 @@
--#if 0
- CHANGES - changes for libpng
- 
- version 0.1 [March 29, 1995]
-   initial work-in-progress release
- 
- version 0.2 [April 1, 1995]
-   added reader into png.h
-   fixed small problems in stub file
-@@ -1449,17 +1448,17 @@ Version 1.2.6beta4 [July 28, 2004]
-   Turn on PNG_NO_ZALLOC_ZERO by default in version 1.2.x
-   Revised "clobber list" in pnggccrd.c so it will compile under gcc-3.4.
-   Revised Borland portion of png_malloc() to return NULL or issue
-     png_error() according to setting of PNG_FLAG_MALLOC_NULL_MEM_OK.
-   Added PNG_NO_SEQUENTIAL_READ_SUPPORTED macro to conditionally remove
-     sequential read support.
-   Added some "#if PNG_WRITE_SUPPORTED" blocks.
-   Added #ifdef to remove some redundancy in png_malloc_default().
--  Use png_malloc instead of png_zalloc to allocate the pallete.
-+  Use png_malloc instead of png_zalloc to allocate the palette.
- 
- Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
-   Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
-   Fixed NULL dereference vulnerability (CVE-2004-0598) in png_handle_iCCP().
-   Fixed integer overflow vulnerability (CVE-2004-0599) in png_read_png().
-   Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
-     duplicate chunk types to go undetected.
-   Fixed some timestamps in the -config version
-@@ -3254,17 +3253,17 @@ Version 1.5.1 [February 3, 2011]
- 
- Version 1.5.2beta01 [February 13, 2011]
-   More -Wshadow fixes for older gcc compilers.  Older gcc versions apparently
-     check formal parameters names in function declarations (as well as
-     definitions) to see if they match a name in the global namespace.
-   Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
-     old VisualC++ preprocessor.
-   Turned on interlace handling in png_read_png().
--  Fixed gcc pendantic warnings.
-+  Fixed gcc pedantic warnings.
-   Handle longjmp in Cygwin.
-   Fixed png_get_current_row_number() in the interlaced case.
-   Cleaned up ALPHA flags and transformations.
-   Implemented expansion to 16 bits.
- 
- Version 1.5.2beta02 [February 19, 2011]
-   Fixed mistake in the descriptions of user read_transform and write_transform
-     function prototypes in the manual.  The row_info struct is png_row_infop.
-@@ -3354,17 +3353,17 @@ Version 1.5.3beta05 [May 6, 2011]
-   Removed png_snprintf and added formatted warning messages.  This change adds
-     internal APIs to allow png_warning messages to have parameters without
-     requiring the host OS to implement snprintf.  As a side effect the
-     dependency of the tIME-supporting RFC1132 code on stdio is removed and
-     PNG_NO_WARNINGS does actually work now.
-   Pass "" instead of '\0' to png_default_error() in png_err().  This mistake
-     was introduced in libpng-1.2.20beta01.  This fixes CVE-2011-2691.
-   Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
--    optimization configureable.
-+    optimization configurable.
-   IDAT compression failed if preceded by a compressed text chunk (bug
-     introduced in libpng-1.5.3beta01-02).  This was because the attempt to
-     reset the zlib stream in png_write_IDAT happened after the first IDAT
-     chunk had been deflated - much too late.  In this change internal
-     functions were added to claim/release the z_stream and, hopefully, make
-     the code more robust.  Also deflateEnd checking is added - previously
-     libpng would ignore an error at the end of the stream.
- 
-@@ -3638,17 +3637,17 @@ Version 1.5.6beta05 [October 12, 2011]
-     each row.
-   Optimized png_combine_row() when rows are aligned. This gains a small
-     percentage for 16-bit and 32-bit pixels in the typical case where the
-     output row buffers are appropriately aligned. The optimization was not
-     previously possible because the png_struct buffer was always misaligned.
-   Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
- 
- Version 1.5.6beta06 [October 17, 2011]
--  Removed two redundant tests for unitialized row.
-+  Removed two redundant tests for uninitialized row.
-   Fixed a relatively harmless memory overwrite in compressed text writing
-     with a 1 byte zlib buffer.
-   Add ability to call png_read_update_info multiple times to pngvalid.c.
-   Fixes for multiple calls to png_read_update_info. These fixes attend to
-     most of the errors revealed in pngvalid, however doing the gamma work
-     twice results in inaccuracies that can't be easily fixed.  There is now
-     a warning in the code if this is going to happen.
-   Turned on multiple png_read_update_info in pngvalid transform tests.
-@@ -3684,17 +3683,17 @@ Version 1.5.7beta01 [November 4, 2011]
-   Added support for ARM processor, when decoding all PNG up-filtered rows
-     and any other-filtered rows with 3 or 4 bytes per pixel (Mans Rullgard).
-   Fixed bug in pngvalid on early allocation failure; fixed type cast in
-     pngmem.c; pngvalid would attempt to call png_error() if the allocation
-     of a png_struct or png_info failed. This would probably have led to a
-     crash.  The pngmem.c implementation of png_malloc() included a cast
-     to png_size_t which would fail on large allocations on 16-bit systems.
-   Fix for the preprocessor of the Intel C compiler. The preprocessor
--    splits adjacent @ signs with a space; this changes the concatentation
-+    splits adjacent @ signs with a space; this changes the concatenation
-     token from @-@-@ to PNG_JOIN; that should work with all compiler
-     preprocessors.
-   Paeth filter speed improvements from work by Siarhei Siamashka. This
-     changes the 'Paeth' reconstruction function to improve the GCC code
-     generation on x86. The changes are only part of the suggested ones;
-     just the changes that definitely improve speed and remain simple.
-     The changes also slightly increase the clarity of the code.
- 
-@@ -3730,17 +3729,17 @@ Version 1.5.7beta03 [November 17, 2011]
-     at once - if this is tried typically the results is double gamma
-     correction. Since the simplified APIs can need rgb to gray combined with
-     a compose operation it is necessary to do one of these outside the main
-     libpng transform code. This check-in also contains fixes to various bugs
-     in the simplified APIs themselves and to some bugs in compose and rgb to
-     gray (on palette) itself.
-   Fixes for C++ compilation using g++ When libpng source is compiled
-     using g++. The compiler imposes C++ rules on the C source; thus it
--    is desireable to make the source work with either C or C++ rules
-+    is desirable to make the source work with either C or C++ rules
-     without throwing away useful error information.  This change adds
-     png_voidcast to allow C semantic (void*) cases or the corresponding
-     C++ static_cast operation, as appropriate.
-   Added --noexecstack to assembler file compilation. GCC does not set
-     this on assembler compilation, even though it does on C compilation.
-     This creates security issues if assembler code is enabled; the
-     work-around is to set it by default in the flags for $(CCAS)
-   Work around compilers that don't support declaration of const data. Some
-@@ -4056,17 +4055,17 @@ Version 1.6.0beta17 [March 10, 2012]
-   Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition. 
-   Reject all iCCP chunks after the first, even if the first one is invalid.
-   Deflate/inflate was reworked to move common zlib calls into single
-     functions [rw]util.c.  A new shared keyword check routine was also added
-     and the 'zbuf' is no longer allocated on progressive read.  It is now
-     possible to call png_inflate() incrementally.  A warning is no longer
-     issued if the language tag or translated keyword in the iTXt chunk
-     has zero length.
--  If benign errors are disabled use maximum window on ancilliary inflate.
-+  If benign errors are disabled use maximum window on ancillary inflate.
-     This works round a bug introduced in 1.5.4 where compressed ancillary
-     chunks could end up with a too-small windowBits value in the deflate
-     header.
- 
- Version 1.6.0beta18 [March 16, 2012]
-   Issue a png_benign_error() instead of png_warning() about bad palette index.
-   In pngtest, treat benign errors as errors if "-strict" is present.
-   Fixed an off-by-one error in the palette index checking function.
-@@ -4171,17 +4170,17 @@ Version 1.6.0beta27 [August 11, 2012]
-   Removed references to png_zalloc() and png_zfree() from the manual.
-   Fixed configurations where floating point is completely disabled.  Because
-     of the changes to support symbol prefixing PNG_INTERNAL_FUNCTION declares
-     floating point APIs during libpng builds even if they are completely
-     disabled. This requires the png floating point types (png_double*) to be
-     declared even though the functions are never actually defined.  This
-     change provides a dummy definition so that the declarations work, yet any
-     implementation will fail to compile because of an incomplete type.
--  Re-eliminated the use of strcpy() in pngtest.c.  An unncessary use of
-+  Re-eliminated the use of strcpy() in pngtest.c.  An unnecessary use of
-     strcpy() was accidentally re-introduced in libpng16; this change replaces
-     it with strncpy().
-   Eliminated use of png_sizeof(); use sizeof() instead.
-   Use a consistent style for (sizeof type) and (sizeof (array))
-   Cleanup of png_set_filler().  This function does very different things on
-     read and write.  In libpng 1.6 the two cases can be distinguished and
-     considerable code cleanup, and extra error checking, is possible.  This
-     makes calls on the write side that have no effect be ignored with a
-@@ -4304,17 +4303,17 @@ Version 1.6.0beta31 [November 1, 2012]
-     of -DPNG_NO_READ_GAMMA is changed to simply disable any interface that
-     depends on it; this obliges people who set it to consider whether they
-     really want it off if they happen to use any of the interfaces in
-     question (typically most users who disable it won't).
-   Fixed GUIDs in projects/vstudio. Some were duplicated or missing,
-     resulting in VS2010 having to update the files.
-   Removed non-working ICC profile support code that was mostly added to
-     libpng-1.6.0beta29 and beta30. There was too much code for too little
--    gain; implementing full ICC color correction may be desireable but is left
-+    gain; implementing full ICC color correction may be desirable but is left
-     up to applications.
- 
- Version 1.6.0beta32 [November 25, 2012]
-   Fixed an intermittent SEGV in pngstest due to an uninitialized array element.
-   Added the ability for contrib/libtests/makepng.c to make a PNG with just one
-     color. This is useful for debugging pngstest color inaccuracy reports.
-   Fixed error checking in the simplified write API (Olaf van der Spek)
-   Made png_user_version_check() ok to use with libpng version 1.10.x and later.
-@@ -4587,17 +4586,17 @@ Version 1.6.3beta07 [June 8, 2013]
-     using a compiler that compiles for multiple architectures at one time.
-   Removed PNG_FILTER_OPTIMIZATIONS and PNG_ARM_NEON_SUPPORTED from
-     pnglibconf.h, allowing more of the decisions to be made internally
-     (pngpriv.h) during the compile.  Without this, symbol prefixing is broken
-     under certain circumstances on ARM platforms.  Now only the API parts of
-     the optimizations ('check' vs 'api') are exposed in the public header files
-     except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
-     decision about whether or not to use the optimizations.
--  Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
-+  Protect symbol prefixing against CC/CPPFLAGS/CFLAGS usage.
-     Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
-     on __ARM_NEON__ from configure time to compile time.  This breaks symbol
-     prefixing because the definition of the special png_init_filter_functions
-     call was hidden at configure time if the relevant compiler arguments are
-     passed in CFLAGS as opposed to CC.  This change attempts to avoid all
-     the confusion that would result by declaring the init function even when
-     it is not used, so that it will always get prefixed.
- 
-@@ -5630,17 +5629,17 @@ Version 1.6.24beta02 [June 23, 2016]
-   Put the SKIP definition in the correct place. It needs to come after the
-     png.h include (see all the other .c files in contrib/libtests) because it
-     depends on PNG_LIBPNG_VER.
-   Removed the three compile warning options from the individual project
-     files into the zlib.props globals.  It increases the warning level from 4
-     to All and adds a list of the warnings that need to be turned off.  This is
-     semi-documentary; the intent is to tell libpng users which warnings have
-     been examined and judged non-fixable at present.  The warning about
--    structure padding is fixable, but it would be a signficant change (moving
-+    structure padding is fixable, but it would be a significant change (moving
-     structure members around).
- 
- Version 1.6.24beta03 [July 4, 2016]
-   Optimized absolute value calculation in filter selection, similar to
-     code in the PAETH decoder in pngrutil.c. Build with PNG_USE_ABS to
-     use this.
-   Added pngcp to the build together with a pngcp.dfa configuration test.
-   Added high resolution timing to pngcp.
-@@ -5776,17 +5775,17 @@ Version 1.6.27 [December 29, 2016]
-   Fixed a potential null pointer dereference in png_set_text_2() (bug report
-     and patch by Patrick Keshishian, CVE-2016-10087).
- 
- Version 1.6.28rc01 [January 3, 2017]
-   Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna).
-   Added option to Cmake build allowing a custom location of zlib to be
-     specified in a scenario where libpng is being built as a subproject
-     alongside zlib by another project (Sam Serrels).
--  Changed png_ptr->options from a png_byte to png_uint_32, to accomodate
-+  Changed png_ptr->options from a png_byte to png_uint_32, to accommodate
-     up to 16 options.
- 
- Version 1.6.28rc02 [January 4, 2017]
-   Added "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna).
-   Moved SSE2 optimization code into the main libpng source directory.
-     Configure libpng with "configure --enable-intel-sse" or compile
-     libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
- 
-@@ -5927,17 +5926,17 @@ Version 1.6.32beta03 [August 2, 2017]
-   Stop memory leak when returning from png_handle_eXIf() with an error
-     (Bug report from the OSS-fuzz project).
- 
- Version 1.6.32beta04 [August 2, 2017]
-   Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf().
-   Update libpng.3 and libpng-manual.txt about eXIf functions.
- 
- Version 1.6.32beta05 [August 2, 2017]
--  Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability.
-+  Restored png_get_eXIf() and png_set_eXIf() to maintain API compatibility.
- 
- Version 1.6.32beta06 [August 2, 2017]
-   Removed png_get_eXIf_1() and png_set_eXIf_1().
- 
- Version 1.6.32beta07 [August 3, 2017]
-   Check length of all chunks except IDAT against user limit to fix an
-     OSS-fuzz issue (Fixes CVE-2017-12652).
- 
-@@ -6033,19 +6032,40 @@ Version 1.6.33rc02 [September 23, 2017]
-     API (Samuel Williams).
- 
- Version 1.6.33 [September 28, 2017]
-   Revert contrib/oss-fuzz/libpng_read_fuzzer.cc to libpng-1.6.32 state.
-   Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc
-   Add end_info structure and png_read_end() to the libpng fuzzer.
- 
- Version 1.6.34 [September 29, 2017]
--  Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
--    test failures.
-+  Removed contrib/pngsuite/i*.png; some of them caused test failures.
-+
-+Version 1.6.35beta01 [March 6, 2018]
-+  Restored 21 of the contrib/pngsuite/i*.png, which do not cause test
-+    failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png.
-+  Added calls to png_set_*() transforms commonly used by browsers to
-+    the fuzzer.
-+  Removed some unnecessary brackets in pngrtran.c
-+  Fixed miscellaneous typos (Patch by github user "luzpaz").
-+  Change "ASM C" to "C ASM" in CMakeLists.txt
-+  Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin)
-+  Added hardware optimization directories to zip and 7z distributions.
-+  Fixed incorrect bitmask for options.
-+  Fixed many spelling typos.
-+
-+Version 1.6.35beta02 [March 28, 2018]
-+  Make png_get_iCCP consistent with man page (allow compression-type argument
-+  to be NULL, bug report by Lenard Szolnoki).
-+
-+Version 1.6.35 [July 15, 2018]
-+  Replaced the remaining uses of png_size_t with size_t (Cosmin)
-+  Fixed the calculation of row_factor in png_check_chunk_length
-+    (reported by Thuan Pham in SourceForge issue #278)
-+  Added missing parentheses to a macro definition
-+    (suggested by "irwir" in GitHub issue #216)
- 
- Send comments/corrections/commendations to png-mng-implement at lists.sf.net
- (subscription required; visit
- https://lists.sourceforge.net/lists/listinfo/png-mng-implement
--to subscribe)
--or to glennrp at users.sourceforge.net
-+to subscribe).
- 
- Glenn R-P
--#endif
-diff --git a/media/libpng/LICENSE b/media/libpng/LICENSE
---- a/media/libpng/LICENSE
-+++ b/media/libpng/LICENSE
-@@ -15,18 +15,18 @@ obtain one at http://mozilla.org/MPL/2.0
- This modified version of libpng code adds animated PNG support and is
- released under the libpng license described below. The modifications are
- Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2017 Max Stepin,
- and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives
- surrounding them in the modified libpng source files.
- 
- This code is released under the libpng license.
- 
--libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
--Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
-+libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
-+Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
- derived from libpng-1.0.6, and are distributed according to the same
- disclaimer and license as libpng-1.0.6 with the following individuals
- added to the list of Contributing Authors:
- 
-    Simon-Pierre Cadieux
-    Eric S. Raymond
-    Mans Rullgard
-    Cosmin Truta
-@@ -135,9 +135,9 @@ The Copyright owner believes that the Ex
- Number (ECCN) for libpng is EAR99, which means not subject to export
- controls or International Traffic in Arms Regulations (ITAR) because
- it is open source, publicly available software, that does not contain
- any encryption software.  See the EAR, paragraphs 734.3(b)(3) and
- 734.7(b).
- 
- Glenn Randers-Pehrson
- glennrp at users.sourceforge.net
--September 29, 2017
-+July 15, 2018
-diff --git a/media/libpng/MOZCHANGES b/media/libpng/MOZCHANGES
---- a/media/libpng/MOZCHANGES
-+++ b/media/libpng/MOZCHANGES
-@@ -1,11 +1,13 @@
- 
- Changes made to pristine libpng source by mozilla.org developers.
- 
-+2018/09/14  -- Synced with libpng-1.6.35 (bug #1491467).
-+
- 2017/08/30  -- Synced with libpng-1.6.34 (bug #1402057).
- 
- 2017/03/18  -- Synced with libpng-1.6.31 (bug #1377118).
- 
- 2017/03/18  -- Synced with libpng-1.6.29 (bug #1348356).
- 
- 2017/01/06  -- Synced with libpng-1.6.28 (bug #1328354).
- 
-diff --git a/media/libpng/README b/media/libpng/README
---- a/media/libpng/README
-+++ b/media/libpng/README
-@@ -1,9 +1,9 @@
--README for libpng version 1.6.34 - September 29, 2017 (shared library 16.0)
-+README for libpng version 1.6.35 - July 15, 2018 (shared library 16.0)
- See the note about version numbers near the top of png.h
- 
- See INSTALL for instructions on how to install libpng.
- 
- Libpng comes in several distribution formats.  Get libpng-*.tar.gz or
- libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
- or lpng*.7z or lpng*.zip if you want DOS-style line endings.
- 
-@@ -113,17 +113,17 @@ fix.  Please mention "libpng" somewhere 
- 
- This release was created and will be supported by myself (of course
- based in a large way on Guy's and Andreas' earlier work), and the PNG
- development group.
- 
- Send comments/corrections/commendations to png-mng-implement at
- lists.sourceforge.net (subscription required; visit
- https://lists.sourceforge.net/lists/listinfo/png-mng-implement
--to subscribe) or to glennrp at users.sourceforge.net
-+to subscribe).
- 
- You can't reach Guy, the original libpng author, at the addresses
- given in previous versions of this document.  He and Andreas will
- read mail addressed to the png-implement list, however.
- 
- Please do not send general questions about PNG.  Send them to
- png-mng-misc at lists.sf.net (subscription required; visit
- https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
-diff --git a/media/libpng/apng.patch b/media/libpng/apng.patch
---- a/media/libpng/apng.patch
-+++ b/media/libpng/apng.patch
-@@ -1,135 +1,244 @@
--Index: LICENSE
--===================================================================
----- LICENSE
--+++ LICENSE
--@@ -8,6 +8,12 @@
-+diff --git a/LICENSE b/LICENSE
-+--- a/LICENSE
-++++ b/LICENSE
-+@@ -7,8 +7,14 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENS
-+ 
-  If you modify libpng you may insert additional notices immediately following
-  this sentence.
-  
- +This modified version of libpng code adds animated PNG support and is
- +released under the libpng license described below. The modifications are
- +Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2017 Max Stepin,
- +and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives
- +surrounding them in the modified libpng source files.
- +
-  This code is released under the libpng license.
-  
-- libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
--Index: pngread.c
--===================================================================
----- pngread.c
--+++ pngread.c
--@@ -161,6 +161,9 @@
-+ libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
-+ Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
-+diff --git a/png.c b/png.c
-+--- a/png.c
-++++ b/png.c
-+@@ -815,19 +815,23 @@ png_get_copyright(png_const_structrp png
-+    return PNG_STRING_COPYRIGHT
-+ #else
-+ #  ifdef __STDC__
-+    return PNG_STRING_NEWLINE \
-+-      "libpng version 1.6.35 - July 15, 2018" PNG_STRING_NEWLINE \
-++      "libpng version 1.6.35+apng - July 15, 2018" PNG_STRING_NEWLINE \
-+       "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
-+       PNG_STRING_NEWLINE \
-+       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
-+       "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
-+-      PNG_STRING_NEWLINE;
-++      PNG_STRING_NEWLINE \
-++      "Portions Copyright (c) 2006-2007 Andrew Smith" PNG_STRING_NEWLINE \
-++      "Portions Copyright (c) 2008-2018 Max Stepin" PNG_STRING_NEWLINE ;
-+ #  else
-+-   return "libpng version 1.6.35 - July 15, 2018\
-++   return "libpng version 1.6.35+apng - July 15, 2018\
-+       Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson\
-+       Copyright (c) 1996-1997 Andreas Dilger\
-+-      Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
-++      Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\
-++      Portions Copyright (c) 2006-2007 Andrew Smith\
-++      Portions Copyright (c) 2008-2018 Max Stepin";
-+ #  endif
-+ #endif
-+ }
-  
--       else if (chunk_name == png_IDAT)
--       {
--+#ifdef PNG_READ_APNG_SUPPORTED
--+         png_have_info(png_ptr, info_ptr);
--+#endif
--          png_ptr->idat_size = length;
--          break;
--       }
--@@ -255,6 +258,17 @@
--          png_handle_iTXt(png_ptr, info_ptr, length);
-+diff --git a/png.h b/png.h
-+--- a/png.h
-++++ b/png.h
-+@@ -22,8 +22,14 @@
-+  *
-+  * If you modify libpng you may insert additional notices immediately following
-+  * this sentence.
-+  *
-++ * This modified version of libpng code adds animated PNG support and is
-++ * released under the libpng license described below. The modifications are
-++ * Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2017 Max Stepin,
-++ * and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives
-++ * surrounding them in the modified libpng source files.
-++ *
-+  * This code is released under the libpng license.
-+  *
-+  * libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
-+  * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
-+@@ -308,10 +314,11 @@
-+  * skip to the end of this file and read the section entitled 'simplified API'.
-+  */
-+ 
-+ /* Version information for png.h - this should match the version in png.c */
-+-#define PNG_LIBPNG_VER_STRING "1.6.35"
-+-#define PNG_HEADER_VERSION_STRING " libpng version 1.6.35 - July 15, 2018\n"
-++#define PNG_LIBPNG_VER_STRING "1.6.35+apng"
-++#define PNG_HEADER_VERSION_STRING \
-++     " libpng version 1.6.35+apng - July 15, 2018\n"
-+ 
-+ #define PNG_LIBPNG_VER_SONUM   16
-+ #define PNG_LIBPNG_VER_DLLNUM  16
-+ 
-+@@ -360,8 +367,12 @@
-+  */
-+ #   include "pnglibconf.h"
-  #endif
-  
--+#ifdef PNG_READ_APNG_SUPPORTED
--+      else if (chunk_name == png_acTL)
--+         png_handle_acTL(png_ptr, info_ptr, length);
--+
--+      else if (chunk_name == png_fcTL)
--+         png_handle_fcTL(png_ptr, info_ptr, length);
-++#define PNG_APNG_SUPPORTED
-++#define PNG_READ_APNG_SUPPORTED
-++#define PNG_WRITE_APNG_SUPPORTED
- +
--+      else if (chunk_name == png_fdAT)
--+         png_handle_fdAT(png_ptr, info_ptr, length);
--+#endif
--+
--       else
--          png_handle_unknown(png_ptr, info_ptr, length,
--              PNG_HANDLE_CHUNK_AS_DEFAULT);
--@@ -262,6 +276,72 @@
-- }
-- #endif /* SEQUENTIAL_READ */
-+ #ifndef PNG_VERSION_INFO_ONLY
-+ /* Machine specific configuration. */
-+ #  include "pngconf.h"
-+ #endif
-+@@ -455,8 +466,19 @@ extern "C" {
-+  * constants.
-+  * See pngconf.h for base types that vary by machine/system
-+  */
-  
--+#ifdef PNG_READ_APNG_SUPPORTED
--+void PNGAPI
--+png_read_frame_head(png_structp png_ptr, png_infop info_ptr)
--+{
--+    png_byte have_chunk_after_DAT; /* after IDAT or after fdAT */
--+
--+    png_debug(0, "Reading frame head");
-++#ifdef PNG_APNG_SUPPORTED
-++/* dispose_op flags from inside fcTL */
-++#define PNG_DISPOSE_OP_NONE        0x00
-++#define PNG_DISPOSE_OP_BACKGROUND  0x01
-++#define PNG_DISPOSE_OP_PREVIOUS    0x02
- +
--+    if ((png_ptr->mode & PNG_HAVE_acTL) == 0)
--+        png_error(png_ptr, "attempt to png_read_frame_head() but "
--+                           "no acTL present");
--+
--+    /* do nothing for the main IDAT */
--+    if (png_ptr->num_frames_read == 0)
--+        return;
--+
--+    png_read_reset(png_ptr);
--+    png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
--+    png_ptr->mode &= ~PNG_HAVE_fcTL;
-++/* blend_op flags from inside fcTL */
-++#define PNG_BLEND_OP_SOURCE        0x00
-++#define PNG_BLEND_OP_OVER          0x01
-++#endif /* APNG */
- +
--+    have_chunk_after_DAT = 0;
--+    for (;;)
--+    {
--+        png_uint_32 length = png_read_chunk_header(png_ptr);
-+ /* This triggers a compiler error in png.c, if png.c and png.h
-+  * do not agree upon the version number.
-+  */
-+ typedef char* png_libpng_version_1_6_35;
-+@@ -776,8 +798,12 @@ typedef png_unknown_chunk * * png_unknow
-+ #define PNG_INFO_sPLT 0x2000U  /* ESR, 1.0.6 */
-+ #define PNG_INFO_sCAL 0x4000U  /* ESR, 1.0.6 */
-+ #define PNG_INFO_IDAT 0x8000U  /* ESR, 1.0.6 */
-+ #define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
-++#ifdef PNG_APNG_SUPPORTED
-++#define PNG_INFO_acTL 0x20000U
-++#define PNG_INFO_fcTL 0x40000U
-++#endif
-+ 
-+ /* This is used for the transformation routines, as some of them
-+  * change these values for the row.  It also should enable using
-+  * the routines for other purposes.
-+@@ -813,8 +839,12 @@ typedef PNG_CALLBACK(void, *png_write_st
-+ 
-+ #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-+ typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
-+ typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
-++#ifdef PNG_APNG_SUPPORTED
-++typedef PNG_CALLBACK(void, *png_progressive_frame_ptr, (png_structp,
-++    png_uint_32));
-++#endif
-+ 
-+ /* The following callback receives png_uint_32 row_number, int pass for the
-+  * png_bytep data of the row.  When transforming an interlaced image the
-+  * row number is the row number within the sub-image of the interlace pass, so
-+@@ -3257,17 +3287,90 @@ PNG_EXPORT(244, int, png_set_option, (pn
-+ /*******************************************************************************
-+  *  END OF HARDWARE AND SOFTWARE OPTIONS
-+  ******************************************************************************/
-+ 
-++#ifdef PNG_APNG_SUPPORTED
-++PNG_EXPORT(248, png_uint_32, png_get_acTL, (png_structp png_ptr,
-++   png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
- +
--+        if (png_ptr->chunk_name == png_IDAT)
--+        {
--+            /* discard trailing IDATs for the first frame */
--+            if (have_chunk_after_DAT != 0 || png_ptr->num_frames_read > 1)
--+                png_error(png_ptr, "png_read_frame_head(): out of place IDAT");
--+            png_crc_finish(png_ptr, length);
--+        }
-++PNG_EXPORT(249, png_uint_32, png_set_acTL, (png_structp png_ptr,
-++   png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
- +
--+        else if (png_ptr->chunk_name == png_fcTL)
--+        {
--+            png_handle_fcTL(png_ptr, info_ptr, length);
--+            have_chunk_after_DAT = 1;
--+        }
-++PNG_EXPORT(250, png_uint_32, png_get_num_frames, (png_structp png_ptr,
-++   png_infop info_ptr));
- +
--+        else if (png_ptr->chunk_name == png_fdAT)
--+        {
--+            png_ensure_sequence_number(png_ptr, length);
-++PNG_EXPORT(251, png_uint_32, png_get_num_plays, (png_structp png_ptr,
-++   png_infop info_ptr));
- +
--+            /* discard trailing fdATs for frames other than the first */
--+            if (have_chunk_after_DAT == 0 && png_ptr->num_frames_read > 1)
--+                png_crc_finish(png_ptr, length - 4);
--+            else if (png_ptr->mode & PNG_HAVE_fcTL)
--+            {
--+                png_ptr->idat_size = length - 4;
--+                png_ptr->mode |= PNG_HAVE_IDAT;
-++PNG_EXPORT(252, png_uint_32, png_get_next_frame_fcTL,
-++   (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width,
-++   png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset,
-++   png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op,
-++   png_byte *blend_op));
-++
-++PNG_EXPORT(253, png_uint_32, png_set_next_frame_fcTL,
-++   (png_structp png_ptr, png_infop info_ptr, png_uint_32 width,
-++   png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset,
-++   png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
-++   png_byte blend_op));
- +
--+                break;
--+            }
--+            else
--+                png_error(png_ptr, "png_read_frame_head(): out of place fdAT");
--+        }
--+        else
--+        {
--+            png_warning(png_ptr, "Skipped (ignored) a chunk "
--+                                 "between APNG chunks");
--+            png_crc_finish(png_ptr, length);
--+        }
--+    }
--+}
-++PNG_EXPORT(254, png_uint_32, png_get_next_frame_width,
-++   (png_structp png_ptr, png_infop info_ptr));
-++PNG_EXPORT(255, png_uint_32, png_get_next_frame_height,
-++   (png_structp png_ptr, png_infop info_ptr));
-++PNG_EXPORT(256, png_uint_32, png_get_next_frame_x_offset,
-++   (png_structp png_ptr, png_infop info_ptr));
-++PNG_EXPORT(257, png_uint_32, png_get_next_frame_y_offset,
-++   (png_structp png_ptr, png_infop info_ptr));
-++PNG_EXPORT(258, png_uint_16, png_get_next_frame_delay_num,
-++   (png_structp png_ptr, png_infop info_ptr));
-++PNG_EXPORT(259, png_uint_16, png_get_next_frame_delay_den,
-++   (png_structp png_ptr, png_infop info_ptr));
-++PNG_EXPORT(260, png_byte, png_get_next_frame_dispose_op,
-++   (png_structp png_ptr, png_infop info_ptr));
-++PNG_EXPORT(261, png_byte, png_get_next_frame_blend_op,
-++   (png_structp png_ptr, png_infop info_ptr));
-++PNG_EXPORT(262, png_byte, png_get_first_frame_is_hidden,
-++   (png_structp png_ptr, png_infop info_ptr));
-++PNG_EXPORT(263, png_uint_32, png_set_first_frame_is_hidden,
-++   (png_structp png_ptr, png_infop info_ptr, png_byte is_hidden));
-++
-++#ifdef PNG_READ_APNG_SUPPORTED
-++PNG_EXPORT(264, void, png_read_frame_head, (png_structp png_ptr,
-++   png_infop info_ptr));
-++#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-++PNG_EXPORT(265, void, png_set_progressive_frame_fn, (png_structp png_ptr,
-++   png_progressive_frame_ptr frame_info_fn,
-++   png_progressive_frame_ptr frame_end_fn));
-++#endif /* PROGRESSIVE_READ */
- +#endif /* READ_APNG */
- +
-- /* Optional call to update the users info_ptr structure */
-- void PNGAPI
-- png_read_update_info(png_structrp png_ptr, png_inforp info_ptr)
--Index: pngget.c
--===================================================================
----- pngget.c
--+++ pngget.c
--@@ -1245,4 +1245,166 @@
-++#ifdef PNG_WRITE_APNG_SUPPORTED
-++PNG_EXPORT(266, void, png_write_frame_head, (png_structp png_ptr,
-++   png_infop info_ptr, png_bytepp row_pointers,
-++   png_uint_32 width, png_uint_32 height,
-++   png_uint_32 x_offset, png_uint_32 y_offset,
-++   png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
-++   png_byte blend_op));
-++
-++PNG_EXPORT(267, void, png_write_frame_tail, (png_structp png_ptr,
-++   png_infop info_ptr));
-++#endif /* WRITE_APNG */
-++#endif /* APNG */
-++
-+ /* Maintainer: Put new public prototypes here ^, in libpng.3, in project
-+  * defs, and in scripts/symbols.def.
-+  */
-+ 
-+ /* The last ordinal number (this is the *last* one already used; the next
-+  * one to use is one more than this.)
-+  */
-+ #ifdef PNG_EXPORT_LAST_ORDINAL
-++#ifdef PNG_APNG_SUPPORTED
-++  PNG_EXPORT_LAST_ORDINAL(269);
-++#else
-+   PNG_EXPORT_LAST_ORDINAL(249);
-++#endif /* APNG */
-+ #endif
-+ 
-+ #ifdef __cplusplus
-+ }
-+diff --git a/pngget.c b/pngget.c
-+--- a/pngget.c
-++++ b/pngget.c
-+@@ -1245,5 +1245,167 @@ png_get_palette_max(png_const_structp pn
-+ }
-  #  endif
-  #endif
-  
- +#ifdef PNG_APNG_SUPPORTED
- +png_uint_32 PNGAPI
- +png_get_acTL(png_structp png_ptr, png_infop info_ptr,
- +             png_uint_32 *num_frames, png_uint_32 *num_plays)
- +{
-@@ -286,301 +395,21 @@ Index: pngget.c
- +       return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN);
- +
- +    PNG_UNUSED(info_ptr)
- +
- +    return 0;
- +}
- +#endif /* APNG */
-  #endif /* READ || WRITE */
--Index: png.c
--===================================================================
----- png.c
--+++ png.c
--@@ -816,17 +816,21 @@
-- #else
-- #  ifdef __STDC__
--    return PNG_STRING_NEWLINE \
---      "libpng version 1.6.34 - September 29, 2017" PNG_STRING_NEWLINE \
--+      "libpng version 1.6.34+apng - September 29, 2017" PNG_STRING_NEWLINE \
--       "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
--       PNG_STRING_NEWLINE \
--       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
--       "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
---      PNG_STRING_NEWLINE;
--+      PNG_STRING_NEWLINE \
--+      "Portions Copyright (c) 2006-2007 Andrew Smith" PNG_STRING_NEWLINE \
--+      "Portions Copyright (c) 2008-2017 Max Stepin" PNG_STRING_NEWLINE ;
-- #  else
---   return "libpng version 1.6.34 - September 29, 2017\
--+   return "libpng version 1.6.34+apng - September 29, 2017\
--       Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
--       Copyright (c) 1996-1997 Andreas Dilger\
---      Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
--+      Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\
--+      Portions Copyright (c) 2006-2007 Andrew Smith\
--+      Portions Copyright (c) 2008-2017 Max Stepin";
-- #  endif
-- #endif
-- }
--Index: png.h
--===================================================================
----- png.h
--+++ png.h
--@@ -23,6 +23,12 @@
--  * If you modify libpng you may insert additional notices immediately following
--  * this sentence.
--  *
--+ * This modified version of libpng code adds animated PNG support and is
--+ * released under the libpng license described below. The modifications are
--+ * Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2017 Max Stepin,
--+ * and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives
--+ * surrounding them in the modified libpng source files.
--+ *
--  * This code is released under the libpng license.
--  *
--  * libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
--@@ -309,8 +315,9 @@
--  */
-- 
-- /* Version information for png.h - this should match the version in png.c */
---#define PNG_LIBPNG_VER_STRING "1.6.34"
---#define PNG_HEADER_VERSION_STRING " libpng version 1.6.34 - September 29, 2017\n"
--+#define PNG_LIBPNG_VER_STRING "1.6.34+apng"
--+#define PNG_HEADER_VERSION_STRING \
--+     " libpng version 1.6.34+apng - September 29, 2017\n"
-- 
-- #define PNG_LIBPNG_VER_SONUM   16
-- #define PNG_LIBPNG_VER_DLLNUM  16
--@@ -361,6 +368,10 @@
-- #   include "pnglibconf.h"
-- #endif
-- 
--+#define PNG_APNG_SUPPORTED
--+#define PNG_READ_APNG_SUPPORTED
--+#define PNG_WRITE_APNG_SUPPORTED
--+
-- #ifndef PNG_VERSION_INFO_ONLY
-- /* Machine specific configuration. */
-- #  include "pngconf.h"
--@@ -456,6 +467,17 @@
--  * See pngconf.h for base types that vary by machine/system
--  */
-- 
--+#ifdef PNG_APNG_SUPPORTED
--+/* dispose_op flags from inside fcTL */
--+#define PNG_DISPOSE_OP_NONE        0x00
--+#define PNG_DISPOSE_OP_BACKGROUND  0x01
--+#define PNG_DISPOSE_OP_PREVIOUS    0x02
--+
--+/* blend_op flags from inside fcTL */
--+#define PNG_BLEND_OP_SOURCE        0x00
--+#define PNG_BLEND_OP_OVER          0x01
--+#endif /* APNG */
--+
-- /* This triggers a compiler error in png.c, if png.c and png.h
--  * do not agree upon the version number.
--  */
--@@ -777,6 +799,10 @@
-- #define PNG_INFO_sCAL 0x4000U  /* ESR, 1.0.6 */
-- #define PNG_INFO_IDAT 0x8000U  /* ESR, 1.0.6 */
-- #define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
--+#ifdef PNG_APNG_SUPPORTED
--+#define PNG_INFO_acTL 0x20000U
--+#define PNG_INFO_fcTL 0x40000U
--+#endif
-- 
-- /* This is used for the transformation routines, as some of them
--  * change these values for the row.  It also should enable using
--@@ -814,6 +840,10 @@
-- #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-- typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
-- typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
--+#ifdef PNG_APNG_SUPPORTED
--+typedef PNG_CALLBACK(void, *png_progressive_frame_ptr, (png_structp,
--+    png_uint_32));
--+#endif
-- 
-- /* The following callback receives png_uint_32 row_number, int pass for the
--  * png_bytep data of the row.  When transforming an interlaced image the
--@@ -3258,6 +3288,75 @@
--  *  END OF HARDWARE AND SOFTWARE OPTIONS
--  ******************************************************************************/
-- 
--+#ifdef PNG_APNG_SUPPORTED
--+PNG_EXPORT(248, png_uint_32, png_get_acTL, (png_structp png_ptr,
--+   png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
--+
--+PNG_EXPORT(249, png_uint_32, png_set_acTL, (png_structp png_ptr,
--+   png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
--+
--+PNG_EXPORT(250, png_uint_32, png_get_num_frames, (png_structp png_ptr,
--+   png_infop info_ptr));
--+
--+PNG_EXPORT(251, png_uint_32, png_get_num_plays, (png_structp png_ptr,
--+   png_infop info_ptr));
--+
--+PNG_EXPORT(252, png_uint_32, png_get_next_frame_fcTL,
--+   (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width,
--+   png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset,
--+   png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op,
--+   png_byte *blend_op));
--+
--+PNG_EXPORT(253, png_uint_32, png_set_next_frame_fcTL,
--+   (png_structp png_ptr, png_infop info_ptr, png_uint_32 width,
--+   png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset,
--+   png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
--+   png_byte blend_op));
--+
--+PNG_EXPORT(254, png_uint_32, png_get_next_frame_width,
--+   (png_structp png_ptr, png_infop info_ptr));
--+PNG_EXPORT(255, png_uint_32, png_get_next_frame_height,
--+   (png_structp png_ptr, png_infop info_ptr));
--+PNG_EXPORT(256, png_uint_32, png_get_next_frame_x_offset,
--+   (png_structp png_ptr, png_infop info_ptr));
--+PNG_EXPORT(257, png_uint_32, png_get_next_frame_y_offset,
--+   (png_structp png_ptr, png_infop info_ptr));
--+PNG_EXPORT(258, png_uint_16, png_get_next_frame_delay_num,
--+   (png_structp png_ptr, png_infop info_ptr));
--+PNG_EXPORT(259, png_uint_16, png_get_next_frame_delay_den,
--+   (png_structp png_ptr, png_infop info_ptr));
--+PNG_EXPORT(260, png_byte, png_get_next_frame_dispose_op,
--+   (png_structp png_ptr, png_infop info_ptr));
--+PNG_EXPORT(261, png_byte, png_get_next_frame_blend_op,
--+   (png_structp png_ptr, png_infop info_ptr));
--+PNG_EXPORT(262, png_byte, png_get_first_frame_is_hidden,
--+   (png_structp png_ptr, png_infop info_ptr));
--+PNG_EXPORT(263, png_uint_32, png_set_first_frame_is_hidden,
--+   (png_structp png_ptr, png_infop info_ptr, png_byte is_hidden));
--+
--+#ifdef PNG_READ_APNG_SUPPORTED
--+PNG_EXPORT(264, void, png_read_frame_head, (png_structp png_ptr,
--+   png_infop info_ptr));
--+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
--+PNG_EXPORT(265, void, png_set_progressive_frame_fn, (png_structp png_ptr,
--+   png_progressive_frame_ptr frame_info_fn,
--+   png_progressive_frame_ptr frame_end_fn));
--+#endif /* PROGRESSIVE_READ */
--+#endif /* READ_APNG */
--+
--+#ifdef PNG_WRITE_APNG_SUPPORTED
--+PNG_EXPORT(266, void, png_write_frame_head, (png_structp png_ptr,
--+   png_infop info_ptr, png_bytepp row_pointers,
--+   png_uint_32 width, png_uint_32 height,
--+   png_uint_32 x_offset, png_uint_32 y_offset,
--+   png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
--+   png_byte blend_op));
--+
--+PNG_EXPORT(267, void, png_write_frame_tail, (png_structp png_ptr,
--+   png_infop info_ptr));
--+#endif /* WRITE_APNG */
--+#endif /* APNG */
--+
-- /* Maintainer: Put new public prototypes here ^, in libpng.3, in project
--  * defs, and in scripts/symbols.def.
--  */
--@@ -3266,7 +3365,11 @@
--  * one to use is one more than this.)
--  */
-- #ifdef PNG_EXPORT_LAST_ORDINAL
--+#ifdef PNG_APNG_SUPPORTED
--+  PNG_EXPORT_LAST_ORDINAL(269);
--+#else
--   PNG_EXPORT_LAST_ORDINAL(249);
--+#endif /* APNG */
-- #endif
-- 
-- #ifdef __cplusplus
--Index: pngpriv.h
--===================================================================
----- pngpriv.h
--+++ pngpriv.h
--@@ -628,6 +628,10 @@
-- #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
--                    /*             0x4000U (unused) */
-- #define PNG_IS_READ_STRUCT        0x8000U /* Else is a write struct */
--+#ifdef PNG_APNG_SUPPORTED
--+#define PNG_HAVE_acTL            0x10000U
--+#define PNG_HAVE_fcTL            0x20000U
--+#endif
-- 
-- /* Flags for the transformations the PNG library does on the image data */
-- #define PNG_BGR                 0x0001U
--@@ -864,6 +868,16 @@
-- #define png_tRNS PNG_U32(116,  82,  78,  83)
-- #define png_zTXt PNG_U32(122,  84,  88, 116)
-- 
--+#ifdef PNG_APNG_SUPPORTED
--+#define png_acTL PNG_U32( 97,  99,  84,  76)
--+#define png_fcTL PNG_U32(102,  99,  84,  76)
--+#define png_fdAT PNG_U32(102, 100,  65,  84)
--+
--+/* For png_struct.apng_flags: */
--+#define PNG_FIRST_FRAME_HIDDEN       0x0001U
--+#define PNG_APNG_APP                 0x0002U
--+#endif
--+
-- /* The following will work on (signed char*) strings, whereas the get_uint_32
--  * macro will fail on top-bit-set values because of the sign extension.
--  */
--@@ -1615,6 +1629,49 @@
-- 
-- #endif /* PROGRESSIVE_READ */
-- 
--+#ifdef PNG_APNG_SUPPORTED
--+PNG_INTERNAL_FUNCTION(void,png_ensure_fcTL_is_valid,(png_structp png_ptr,
--+   png_uint_32 width, png_uint_32 height,
--+   png_uint_32 x_offset, png_uint_32 y_offset,
--+   png_uint_16 delay_num, png_uint_16 delay_den,
--+   png_byte dispose_op, png_byte blend_op),PNG_EMPTY);
--+
--+#ifdef PNG_READ_APNG_SUPPORTED
--+PNG_INTERNAL_FUNCTION(void,png_handle_acTL,(png_structp png_ptr,
--+   png_infop info_ptr, png_uint_32 length),PNG_EMPTY);
--+PNG_INTERNAL_FUNCTION(void,png_handle_fcTL,(png_structp png_ptr,
--+   png_infop info_ptr, png_uint_32 length),PNG_EMPTY);
--+PNG_INTERNAL_FUNCTION(void,png_handle_fdAT,(png_structp png_ptr,
--+   png_infop info_ptr, png_uint_32 length),PNG_EMPTY);
--+PNG_INTERNAL_FUNCTION(void,png_have_info,(png_structp png_ptr,
--+   png_infop info_ptr),PNG_EMPTY);
--+PNG_INTERNAL_FUNCTION(void,png_ensure_sequence_number,(png_structp png_ptr,
--+   png_uint_32 length),PNG_EMPTY);
--+PNG_INTERNAL_FUNCTION(void,png_read_reset,(png_structp png_ptr),PNG_EMPTY);
--+PNG_INTERNAL_FUNCTION(void,png_read_reinit,(png_structp png_ptr,
--+   png_infop info_ptr),PNG_EMPTY);
--+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
--+PNG_INTERNAL_FUNCTION(void,png_progressive_read_reset,(png_structp png_ptr),
--+   PNG_EMPTY);
--+#endif /* PROGRESSIVE_READ */
--+#endif /* READ_APNG */
--+
--+#ifdef PNG_WRITE_APNG_SUPPORTED
--+PNG_INTERNAL_FUNCTION(void,png_write_acTL,(png_structp png_ptr,
--+   png_uint_32 num_frames, png_uint_32 num_plays),PNG_EMPTY);
--+PNG_INTERNAL_FUNCTION(void,png_write_fcTL,(png_structp png_ptr,
--+   png_uint_32 width, png_uint_32 height,
--+   png_uint_32 x_offset, png_uint_32 y_offset,
--+   png_uint_16 delay_num, png_uint_16 delay_den,
--+   png_byte dispose_op, png_byte blend_op),PNG_EMPTY);
--+PNG_INTERNAL_FUNCTION(void,png_write_fdAT,(png_structp png_ptr,
--+   png_const_bytep data, png_size_t length),PNG_EMPTY);
--+PNG_INTERNAL_FUNCTION(void,png_write_reset,(png_structp png_ptr),PNG_EMPTY);
--+PNG_INTERNAL_FUNCTION(void,png_write_reinit,(png_structp png_ptr,
--+   png_infop info_ptr, png_uint_32 width, png_uint_32 height),PNG_EMPTY);
--+#endif /* WRITE_APNG */
--+#endif /* APNG */
--+
-- /* Added at libpng version 1.6.0 */
-- #ifdef PNG_GAMMA_SUPPORTED
-- PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr,
--Index: pnginfo.h
--===================================================================
----- pnginfo.h
--+++ pnginfo.h
--@@ -263,5 +263,18 @@
-+diff --git a/pnginfo.h b/pnginfo.h
-+--- a/pnginfo.h
-++++ b/pnginfo.h
-+@@ -262,6 +262,19 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
-+    /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
-     png_bytepp row_pointers;        /* the image bits */
-  #endif
-  
- +#ifdef PNG_APNG_SUPPORTED
- +   png_uint_32 num_frames; /* including default image */
- +   png_uint_32 num_plays;
- +   png_uint_32 next_frame_width;
- +   png_uint_32 next_frame_height;
-@@ -589,123 +418,21 @@ Index: pnginfo.h
- +   png_uint_16 next_frame_delay_num;
- +   png_uint_16 next_frame_delay_den;
- +   png_byte next_frame_dispose_op;
- +   png_byte next_frame_blend_op;
- +#endif
- +
-  };
-  #endif /* PNGINFO_H */
--Index: pngstruct.h
--===================================================================
----- pngstruct.h
--+++ pngstruct.h
--@@ -403,6 +403,27 @@
--    png_byte filter_type;
-- #endif
-- 
--+#ifdef PNG_APNG_SUPPORTED
--+   png_uint_32 apng_flags;
--+   png_uint_32 next_seq_num;         /* next fcTL/fdAT chunk sequence number */
--+   png_uint_32 first_frame_width;
--+   png_uint_32 first_frame_height;
--+
--+#ifdef PNG_READ_APNG_SUPPORTED
--+   png_uint_32 num_frames_read;      /* incremented after all image data of */
--+                                     /* a frame is read */
--+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
--+   png_progressive_frame_ptr frame_info_fn; /* frame info read callback */
--+   png_progressive_frame_ptr frame_end_fn;  /* frame data read callback */
--+#endif
--+#endif
--+
--+#ifdef PNG_WRITE_APNG_SUPPORTED
--+   png_uint_32 num_frames_to_write;
--+   png_uint_32 num_frames_written;
--+#endif
--+#endif /* APNG */
--+
-- /* New members added in libpng-1.2.0 */
-- 
-- /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
--Index: pngwrite.c
--===================================================================
----- pngwrite.c
--+++ pngwrite.c
--@@ -128,6 +128,10 @@
--        * the application continues writing the PNG.  So check the 'invalid'
--        * flag here too.
--        */
--+#ifdef PNG_WRITE_APNG_SUPPORTED
--+   if ((info_ptr->valid & PNG_INFO_acTL) != 0)
--+      png_write_acTL(png_ptr, info_ptr->num_frames, info_ptr->num_plays);
--+#endif
-- #ifdef PNG_GAMMA_SUPPORTED
-- #  ifdef PNG_WRITE_gAMA_SUPPORTED
--       if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
--@@ -365,6 +369,11 @@
--    if ((png_ptr->mode & PNG_HAVE_IDAT) == 0)
--       png_error(png_ptr, "No IDATs written into file");
-- 
--+#ifdef PNG_WRITE_APNG_SUPPORTED
--+   if (png_ptr->num_frames_written != png_ptr->num_frames_to_write)
--+      png_error(png_ptr, "Not enough frames written");
--+#endif
--+
-- #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
--    if (png_ptr->num_palette_max > png_ptr->num_palette)
--       png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
--@@ -2393,4 +2402,42 @@
-- }
-- #endif /* SIMPLIFIED_WRITE_STDIO */
-- #endif /* SIMPLIFIED_WRITE */
--+
--+#ifdef PNG_WRITE_APNG_SUPPORTED
--+void PNGAPI
--+png_write_frame_head(png_structp png_ptr, png_infop info_ptr,
--+    png_bytepp row_pointers, png_uint_32 width, png_uint_32 height,
--+    png_uint_32 x_offset, png_uint_32 y_offset,
--+    png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
--+    png_byte blend_op)
--+{
--+    png_debug(1, "in png_write_frame_head");
--+
--+    /* there is a chance this has been set after png_write_info was called,
--+    * so it would be set but not written. is there a way to be sure? */
--+    if ((info_ptr->valid & PNG_INFO_acTL) == 0)
--+        png_error(png_ptr, "png_write_frame_head(): acTL not set");
--+
--+    png_write_reset(png_ptr);
--+
--+    png_write_reinit(png_ptr, info_ptr, width, height);
--+
--+    if ((png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) == 0 ||
--+        png_ptr->num_frames_written != 0)
--+        png_write_fcTL(png_ptr, width, height, x_offset, y_offset,
--+                       delay_num, delay_den, dispose_op, blend_op);
--+
--+    PNG_UNUSED(row_pointers)
--+}
--+
--+void PNGAPI
--+png_write_frame_tail(png_structp png_ptr, png_infop info_ptr)
--+{
--+    png_debug(1, "in png_write_frame_tail");
--+
--+    png_ptr->num_frames_written++;
--+
--+    PNG_UNUSED(info_ptr)
--+}
--+#endif /* WRITE_APNG */
-- #endif /* WRITE */
--Index: pngpread.c
--===================================================================
----- pngpread.c
--+++ pngpread.c
--@@ -195,6 +195,89 @@
-+diff --git a/pngpread.c b/pngpread.c
-+--- a/pngpread.c
-++++ b/pngpread.c
-+@@ -194,8 +194,91 @@ png_push_read_chunk(png_structrp png_ptr
-+    }
-  
-     chunk_name = png_ptr->chunk_name;
-  
- +#ifdef PNG_READ_APNG_SUPPORTED
- +   if (png_ptr->num_frames_read > 0 &&
- +       png_ptr->num_frames_read < info_ptr->num_frames)
- +   {
- +      if (chunk_name == png_IDAT)
-@@ -785,27 +512,31 @@ Index: pngpread.c
- +
- +      return;
- +   }
- +#endif /* READ_APNG */
- +
-     if (chunk_name == png_IDAT)
-     {
-        if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
--@@ -261,6 +344,9 @@
-+          png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
-+@@ -260,8 +343,11 @@ png_push_read_chunk(png_structrp png_ptr
-+    }
-  
-     else if (chunk_name == png_IDAT)
-     {
- +#ifdef PNG_READ_APNG_SUPPORTED
- +      png_have_info(png_ptr, info_ptr);
- +#endif
-        png_ptr->idat_size = png_ptr->push_length;
-        png_ptr->process_mode = PNG_READ_IDAT_MODE;
-        png_push_have_info(png_ptr, info_ptr);
--@@ -407,6 +493,20 @@
-+       png_ptr->zstream.avail_out =
-+@@ -406,8 +492,22 @@ png_push_read_chunk(png_structrp png_ptr
-+       png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
-     }
-  #endif
-  
- +#ifdef PNG_READ_APNG_SUPPORTED
- +   else if (chunk_name == png_acTL)
- +   {
- +      PNG_PUSH_SAVE_BUFFER_IF_FULL
- +      png_handle_acTL(png_ptr, info_ptr, png_ptr->push_length);
-@@ -816,29 +547,31 @@ Index: pngpread.c
- +      PNG_PUSH_SAVE_BUFFER_IF_FULL
- +      png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
- +   }
- +
- +#endif /* READ_APNG */
-     else
-     {
-        PNG_PUSH_SAVE_BUFFER_IF_FULL
--@@ -539,7 +639,11 @@
-+       png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length,
-+@@ -538,27 +638,74 @@ png_push_read_IDAT(png_structrp png_ptr)
-+       png_byte chunk_length[4];
-        png_byte chunk_tag[4];
-  
-        /* TODO: this code can be commoned up with the same code in push_read */
- +#ifdef PNG_READ_APNG_SUPPORTED
- +      PNG_PUSH_SAVE_BUFFER_IF_LT(12)
- +#else
-        PNG_PUSH_SAVE_BUFFER_IF_LT(8)
- +#endif
-        png_push_fill_buffer(png_ptr, chunk_length, 4);
-        png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
-        png_reset_crc(png_ptr);
--@@ -547,17 +651,60 @@
-+       png_crc_read(png_ptr, chunk_tag, 4);
-        png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
-        png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
-  
- +#ifdef PNG_READ_APNG_SUPPORTED
- +      if (png_ptr->chunk_name != png_fdAT && png_ptr->num_frames_read > 0)
- +      {
- +          if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) != 0)
- +          {
-@@ -889,34 +622,38 @@ Index: pngpread.c
- +      {
- +         png_ensure_sequence_number(png_ptr, 4);
- +         png_ptr->idat_size -= 4;
- +      }
- +#endif
-     }
-  
-     if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
--@@ -631,6 +778,16 @@
-+    {
-+@@ -630,8 +777,18 @@ png_process_IDAT_data(png_structrp png_p
-+    /* The caller checks for a non-zero buffer length. */
-     if (!(buffer_length > 0) || buffer == NULL)
-        png_error(png_ptr, "No IDAT data (internal error)");
-  
- +#ifdef PNG_READ_APNG_SUPPORTED
- +   /* If the app is not APNG-aware, decode only the first frame */
- +   if ((png_ptr->apng_flags & PNG_APNG_APP) == 0 &&
- +      png_ptr->num_frames_read > 0)
- +   {
- +      png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
- +      return;
- +   }
- +#endif
- +
-     /* This routine must process all the data it has been given
-      * before returning, calling the row callback as required to
-      * handle the uncompressed results.
--@@ -1085,6 +1242,18 @@
-+     */
-+@@ -1084,8 +1241,20 @@ png_set_progressive_read_fn(png_structrp
-+ 
-     png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
-  }
-  
- +#ifdef PNG_READ_APNG_SUPPORTED
- +void PNGAPI
- +png_set_progressive_frame_fn(png_structp png_ptr,
- +   png_progressive_frame_ptr frame_info_fn,
- +   png_progressive_frame_ptr frame_end_fn)
-@@ -925,196 +662,231 @@ Index: pngpread.c
- +   png_ptr->frame_end_fn = frame_end_fn;
- +   png_ptr->apng_flags |= PNG_APNG_APP;
- +}
- +#endif
- +
-  png_voidp PNGAPI
-  png_get_progressive_ptr(png_const_structrp png_ptr)
-  {
--Index: pngset.c
--===================================================================
----- pngset.c
--+++ pngset.c
--@@ -288,6 +288,11 @@
--    info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
-- 
--    info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
--+
-+    if (png_ptr == NULL)
-+diff --git a/pngpriv.h b/pngpriv.h
-+--- a/pngpriv.h
-++++ b/pngpriv.h
-+@@ -633,8 +633,12 @@
-+ #define PNG_HAVE_PNG_SIGNATURE    0x1000U
-+ #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
-+                    /*             0x4000U (unused) */
-+ #define PNG_IS_READ_STRUCT        0x8000U /* Else is a write struct */
- +#ifdef PNG_APNG_SUPPORTED
--+   /* for non-animated png. this may be overwritten from an acTL chunk later */
--+   info_ptr->num_frames = 1;
-++#define PNG_HAVE_acTL            0x10000U
-++#define PNG_HAVE_fcTL            0x20000U
- +#endif
-- }
-+ 
-+ /* Flags for the transformations the PNG library does on the image data */
-+ #define PNG_BGR                 0x0001U
-+ #define PNG_INTERLACE           0x0002U
-+@@ -869,8 +873,18 @@
-+ #define png_tIME PNG_U32(116,  73,  77,  69)
-+ #define png_tRNS PNG_U32(116,  82,  78,  83)
-+ #define png_zTXt PNG_U32(122,  84,  88, 116)
-  
-- #ifdef PNG_oFFs_SUPPORTED
--@@ -1158,6 +1163,146 @@
-- }
-- #endif /* sPLT */
-++#ifdef PNG_APNG_SUPPORTED
-++#define png_acTL PNG_U32( 97,  99,  84,  76)
-++#define png_fcTL PNG_U32(102,  99,  84,  76)
-++#define png_fdAT PNG_U32(102, 100,  65,  84)
-++
-++/* For png_struct.apng_flags: */
-++#define PNG_FIRST_FRAME_HIDDEN       0x0001U
-++#define PNG_APNG_APP                 0x0002U
-++#endif
-++
-+ /* The following will work on (signed char*) strings, whereas the get_uint_32
-+  * macro will fail on top-bit-set values because of the sign extension.
-+  */
-+ #define PNG_CHUNK_FROM_STRING(s)\
-+@@ -1620,8 +1634,51 @@ PNG_INTERNAL_FUNCTION(void,png_push_read
-+ #  endif
-+ 
-+ #endif /* PROGRESSIVE_READ */
-  
- +#ifdef PNG_APNG_SUPPORTED
--+png_uint_32 PNGAPI
--+png_set_acTL(png_structp png_ptr, png_infop info_ptr,
--+    png_uint_32 num_frames, png_uint_32 num_plays)
--+{
--+    png_debug1(1, "in %s storage function", "acTL");
-++PNG_INTERNAL_FUNCTION(void,png_ensure_fcTL_is_valid,(png_structp png_ptr,
-++   png_uint_32 width, png_uint_32 height,
-++   png_uint_32 x_offset, png_uint_32 y_offset,
-++   png_uint_16 delay_num, png_uint_16 delay_den,
-++   png_byte dispose_op, png_byte blend_op),PNG_EMPTY);
-++
-++#ifdef PNG_READ_APNG_SUPPORTED
-++PNG_INTERNAL_FUNCTION(void,png_handle_acTL,(png_structp png_ptr,
-++   png_infop info_ptr, png_uint_32 length),PNG_EMPTY);
-++PNG_INTERNAL_FUNCTION(void,png_handle_fcTL,(png_structp png_ptr,
-++   png_infop info_ptr, png_uint_32 length),PNG_EMPTY);
-++PNG_INTERNAL_FUNCTION(void,png_handle_fdAT,(png_structp png_ptr,
-++   png_infop info_ptr, png_uint_32 length),PNG_EMPTY);
-++PNG_INTERNAL_FUNCTION(void,png_have_info,(png_structp png_ptr,
-++   png_infop info_ptr),PNG_EMPTY);
-++PNG_INTERNAL_FUNCTION(void,png_ensure_sequence_number,(png_structp png_ptr,
-++   png_uint_32 length),PNG_EMPTY);
-++PNG_INTERNAL_FUNCTION(void,png_read_reset,(png_structp png_ptr),PNG_EMPTY);
-++PNG_INTERNAL_FUNCTION(void,png_read_reinit,(png_structp png_ptr,
-++   png_infop info_ptr),PNG_EMPTY);
-++#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-++PNG_INTERNAL_FUNCTION(void,png_progressive_read_reset,(png_structp png_ptr),
-++   PNG_EMPTY);
-++#endif /* PROGRESSIVE_READ */
-++#endif /* READ_APNG */
- +
--+    if (png_ptr == NULL || info_ptr == NULL)
--+    {
--+        png_warning(png_ptr,
--+                    "Call to png_set_acTL() with NULL png_ptr "
--+                    "or info_ptr ignored");
--+        return (0);
--+    }
--+    if (num_frames == 0)
--+    {
--+        png_warning(png_ptr,
--+                    "Ignoring attempt to set acTL with num_frames zero");
--+        return (0);
--+    }
--+    if (num_frames > PNG_UINT_31_MAX)
--+    {
--+        png_warning(png_ptr,
--+                    "Ignoring attempt to set acTL with num_frames > 2^31-1");
--+        return (0);
--+    }
--+    if (num_plays > PNG_UINT_31_MAX)
--+    {
--+        png_warning(png_ptr,
--+                    "Ignoring attempt to set acTL with num_plays > 2^31-1");
--+        return (0);
--+    }
-++#ifdef PNG_WRITE_APNG_SUPPORTED
-++PNG_INTERNAL_FUNCTION(void,png_write_acTL,(png_structp png_ptr,
-++   png_uint_32 num_frames, png_uint_32 num_plays),PNG_EMPTY);
-++PNG_INTERNAL_FUNCTION(void,png_write_fcTL,(png_structp png_ptr,
-++   png_uint_32 width, png_uint_32 height,
-++   png_uint_32 x_offset, png_uint_32 y_offset,
-++   png_uint_16 delay_num, png_uint_16 delay_den,
-++   png_byte dispose_op, png_byte blend_op),PNG_EMPTY);
-++PNG_INTERNAL_FUNCTION(void,png_write_fdAT,(png_structp png_ptr,
-++   png_const_bytep data, png_size_t length),PNG_EMPTY);
-++PNG_INTERNAL_FUNCTION(void,png_write_reset,(png_structp png_ptr),PNG_EMPTY);
-++PNG_INTERNAL_FUNCTION(void,png_write_reinit,(png_structp png_ptr,
-++   png_infop info_ptr, png_uint_32 width, png_uint_32 height),PNG_EMPTY);
-++#endif /* WRITE_APNG */
-++#endif /* APNG */
- +
--+    info_ptr->num_frames = num_frames;
--+    info_ptr->num_plays = num_plays;
-+ /* Added at libpng version 1.6.0 */
-+ #ifdef PNG_GAMMA_SUPPORTED
-+ PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr,
-+     png_colorspacerp colorspace, png_fixed_point gAMA), PNG_EMPTY);
-+diff --git a/pngread.c b/pngread.c
-+--- a/pngread.c
-++++ b/pngread.c
-+@@ -160,8 +160,11 @@ png_read_info(png_structrp png_ptr, png_
-+          png_handle_PLTE(png_ptr, info_ptr, length);
-+ 
-+       else if (chunk_name == png_IDAT)
-+       {
-++#ifdef PNG_READ_APNG_SUPPORTED
-++         png_have_info(png_ptr, info_ptr);
-++#endif
-+          png_ptr->idat_size = length;
-+          break;
-+       }
-+ 
-+@@ -254,15 +257,92 @@ png_read_info(png_structrp png_ptr, png_
-+       else if (chunk_name == png_iTXt)
-+          png_handle_iTXt(png_ptr, info_ptr, length);
-+ #endif
-+ 
-++#ifdef PNG_READ_APNG_SUPPORTED
-++      else if (chunk_name == png_acTL)
-++         png_handle_acTL(png_ptr, info_ptr, length);
-++
-++      else if (chunk_name == png_fcTL)
-++         png_handle_fcTL(png_ptr, info_ptr, length);
- +
--+    info_ptr->valid |= PNG_INFO_acTL;
-++      else if (chunk_name == png_fdAT)
-++         png_handle_fdAT(png_ptr, info_ptr, length);
-++#endif
- +
--+    return (1);
--+}
-+       else
-+          png_handle_unknown(png_ptr, info_ptr, length,
-+              PNG_HANDLE_CHUNK_AS_DEFAULT);
-+    }
-+ }
-+ #endif /* SEQUENTIAL_READ */
-+ 
-++#ifdef PNG_READ_APNG_SUPPORTED
-++void PNGAPI
-++png_read_frame_head(png_structp png_ptr, png_infop info_ptr)
-++{
-++    png_byte have_chunk_after_DAT; /* after IDAT or after fdAT */
- +
--+/* delay_num and delay_den can hold any 16-bit values including zero */
--+png_uint_32 PNGAPI
--+png_set_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
--+    png_uint_32 width, png_uint_32 height,
--+    png_uint_32 x_offset, png_uint_32 y_offset,
--+    png_uint_16 delay_num, png_uint_16 delay_den,
--+    png_byte dispose_op, png_byte blend_op)
--+{
--+    png_debug1(1, "in %s storage function", "fcTL");
-++    png_debug(0, "Reading frame head");
-++
-++    if ((png_ptr->mode & PNG_HAVE_acTL) == 0)
-++        png_error(png_ptr, "attempt to png_read_frame_head() but "
-++                           "no acTL present");
- +
--+    if (png_ptr == NULL || info_ptr == NULL)
-++    /* do nothing for the main IDAT */
-++    if (png_ptr->num_frames_read == 0)
-++        return;
-++
-++    png_read_reset(png_ptr);
-++    png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
-++    png_ptr->mode &= ~PNG_HAVE_fcTL;
-++
-++    have_chunk_after_DAT = 0;
-++    for (;;)
- +    {
--+        png_warning(png_ptr,
--+                    "Call to png_set_fcTL() with NULL png_ptr or info_ptr "
--+                    "ignored");
--+        return (0);
--+    }
-++        png_uint_32 length = png_read_chunk_header(png_ptr);
- +
--+    png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
--+                             delay_num, delay_den, dispose_op, blend_op);
-++        if (png_ptr->chunk_name == png_IDAT)
-++        {
-++            /* discard trailing IDATs for the first frame */
-++            if (have_chunk_after_DAT != 0 || png_ptr->num_frames_read > 1)
-++                png_error(png_ptr, "png_read_frame_head(): out of place IDAT");
-++            png_crc_finish(png_ptr, length);
-++        }
-++
-++        else if (png_ptr->chunk_name == png_fcTL)
-++        {
-++            png_handle_fcTL(png_ptr, info_ptr, length);
-++            have_chunk_after_DAT = 1;
-++        }
- +
--+    if (blend_op == PNG_BLEND_OP_OVER)
--+    {
--+        if ((png_ptr->color_type & PNG_COLOR_MASK_ALPHA) == 0 &&
--+            png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) == 0)
-++        else if (png_ptr->chunk_name == png_fdAT)
- +        {
--+          png_warning(png_ptr, "PNG_BLEND_OP_OVER is meaningless "
--+                               "and wasteful for opaque images, ignored");
--+          blend_op = PNG_BLEND_OP_SOURCE;
-++            png_ensure_sequence_number(png_ptr, length);
-++
-++            /* discard trailing fdATs for frames other than the first */
-++            if (have_chunk_after_DAT == 0 && png_ptr->num_frames_read > 1)
-++                png_crc_finish(png_ptr, length - 4);
-++            else if (png_ptr->mode & PNG_HAVE_fcTL)
-++            {
-++                png_ptr->idat_size = length - 4;
-++                png_ptr->mode |= PNG_HAVE_IDAT;
-++
-++                break;
-++            }
-++            else
-++                png_error(png_ptr, "png_read_frame_head(): out of place fdAT");
-++        }
-++        else
-++        {
-++            png_warning(png_ptr, "Skipped (ignored) a chunk "
-++                                 "between APNG chunks");
-++            png_crc_finish(png_ptr, length);
- +        }
- +    }
--+
--+    info_ptr->next_frame_width = width;
--+    info_ptr->next_frame_height = height;
--+    info_ptr->next_frame_x_offset = x_offset;
--+    info_ptr->next_frame_y_offset = y_offset;
--+    info_ptr->next_frame_delay_num = delay_num;
--+    info_ptr->next_frame_delay_den = delay_den;
--+    info_ptr->next_frame_dispose_op = dispose_op;
--+    info_ptr->next_frame_blend_op = blend_op;
--+
--+    info_ptr->valid |= PNG_INFO_fcTL;
--+
--+    return (1);
- +}
--+
--+void /* PRIVATE */
--+png_ensure_fcTL_is_valid(png_structp png_ptr,
--+    png_uint_32 width, png_uint_32 height,
--+    png_uint_32 x_offset, png_uint_32 y_offset,
--+    png_uint_16 delay_num, png_uint_16 delay_den,
--+    png_byte dispose_op, png_byte blend_op)
--+{
--+    if (width == 0 || width > PNG_UINT_31_MAX)
--+        png_error(png_ptr, "invalid width in fcTL (0 or > 2^31-1)");
--+    if (height == 0 || height > PNG_UINT_31_MAX)
--+        png_error(png_ptr, "invalid height in fcTL (0 or > 2^31-1)");
--+    if (x_offset > PNG_UINT_31_MAX)
--+        png_error(png_ptr, "invalid x_offset in fcTL (> 2^31-1)");
--+    if (y_offset > PNG_UINT_31_MAX)
--+        png_error(png_ptr, "invalid y_offset in fcTL (> 2^31-1)");
--+    if (width + x_offset > png_ptr->first_frame_width ||
--+        height + y_offset > png_ptr->first_frame_height)
--+        png_error(png_ptr, "dimensions of a frame are greater than "
--+                           "the ones in IHDR");
-++#endif /* READ_APNG */
- +
--+    if (dispose_op != PNG_DISPOSE_OP_NONE &&
--+        dispose_op != PNG_DISPOSE_OP_BACKGROUND &&
--+        dispose_op != PNG_DISPOSE_OP_PREVIOUS)
--+        png_error(png_ptr, "invalid dispose_op in fcTL");
--+
--+    if (blend_op != PNG_BLEND_OP_SOURCE &&
--+        blend_op != PNG_BLEND_OP_OVER)
--+        png_error(png_ptr, "invalid blend_op in fcTL");
--+
--+    PNG_UNUSED(delay_num)
--+    PNG_UNUSED(delay_den)
--+}
--+
--+png_uint_32 PNGAPI
--+png_set_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr,
--+                              png_byte is_hidden)
--+{
--+    png_debug(1, "in png_first_frame_is_hidden()");
--+
--+    if (png_ptr == NULL)
--+        return 0;
--+
--+    if (is_hidden != 0)
--+        png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
--+    else
--+        png_ptr->apng_flags &= ~PNG_FIRST_FRAME_HIDDEN;
--+
--+    PNG_UNUSED(info_ptr)
--+
--+    return 1;
--+}
--+#endif /* APNG */
--+
-- #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
-- static png_byte
-- check_location(png_const_structrp png_ptr, int location)
--Index: pngrutil.c
--===================================================================
----- pngrutil.c
--+++ pngrutil.c
--@@ -865,6 +865,11 @@
-+ /* Optional call to update the users info_ptr structure */
-+ void PNGAPI
-+ png_read_update_info(png_structrp png_ptr, png_inforp info_ptr)
-+ {
-+diff --git a/pngrutil.c b/pngrutil.c
-+--- a/pngrutil.c
-++++ b/pngrutil.c
-+@@ -864,8 +864,13 @@ png_handle_IHDR(png_structrp png_ptr, pn
-+    compression_type = buf[10];
-     filter_type = buf[11];
-     interlace_type = buf[12];
-  
- +#ifdef PNG_READ_APNG_SUPPORTED
- +   png_ptr->first_frame_width = width;
- +   png_ptr->first_frame_height = height;
- +#endif
- +
-     /* Set internal variables */
-     png_ptr->width = width;
-     png_ptr->height = height;
--@@ -2840,6 +2845,180 @@
-+    png_ptr->bit_depth = (png_byte)bit_depth;
-+@@ -2857,8 +2862,182 @@ png_handle_iTXt(png_structrp png_ptr, pn
-+       png_chunk_benign_error(png_ptr, errmsg);
-  }
-  #endif
-  
- +#ifdef PNG_READ_APNG_SUPPORTED
- +void /* PRIVATE */
- +png_handle_acTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
- +{
- +    png_byte data[8];
-@@ -1285,29 +1057,33 @@ Index: pngrutil.c
- +
- +    png_ptr->next_seq_num++;
- +}
- +#endif /* READ_APNG */
- +
-  #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
-  /* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */
-  static int
--@@ -3145,7 +3324,11 @@
-+ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
-+@@ -3162,9 +3341,13 @@ png_check_chunk_length(png_const_structr
-+ # elif PNG_USER_CHUNK_MALLOC_MAX > 0
-     if (PNG_USER_CHUNK_MALLOC_MAX < limit)
-        limit = PNG_USER_CHUNK_MALLOC_MAX;
-  # endif
- +#ifdef PNG_READ_APNG_SUPPORTED
- +   if (png_ptr->chunk_name == png_IDAT || png_ptr->chunk_name == png_fdAT)
- +#else
-     if (png_ptr->chunk_name == png_IDAT)
- +#endif
-     {
-        png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
-        size_t row_factor =
--@@ -4146,6 +4329,38 @@
-+          (size_t)png_ptr->width
-+@@ -4166,8 +4349,40 @@ png_read_IDAT_data(png_structrp png_ptr,
-+       {
-           uInt avail_in;
-           png_bytep buffer;
-  
- +#ifdef PNG_READ_APNG_SUPPORTED
- +         png_uint_32 bytes_to_skip = 0;
- +
- +         while (png_ptr->idat_size == 0 || bytes_to_skip != 0)
- +         {
-@@ -1336,35 +1112,41 @@ Index: pngrutil.c
- +
- +               png_ptr->idat_size -= 4;
- +            }
- +         }
- +#else
-           while (png_ptr->idat_size == 0)
-           {
-              png_crc_finish(png_ptr, 0);
--@@ -4157,6 +4372,7 @@
-+ 
-+@@ -4177,8 +4392,9 @@ png_read_IDAT_data(png_structrp png_ptr,
-+              */
-              if (png_ptr->chunk_name != png_IDAT)
-                 png_error(png_ptr, "Not enough image data");
-           }
- +#endif /* READ_APNG */
-  
-           avail_in = png_ptr->IDAT_read_size;
-  
--@@ -4220,6 +4436,9 @@
-+          if (avail_in > png_ptr->idat_size)
-+@@ -4240,8 +4456,11 @@ png_read_IDAT_data(png_structrp png_ptr,
-+          png_ptr->zstream.next_out = NULL;
-  
-           png_ptr->mode |= PNG_AFTER_IDAT;
-           png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
- +#ifdef PNG_READ_APNG_SUPPORTED
- +         png_ptr->num_frames_read++;
- +#endif
-  
-           if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
-              png_chunk_benign_error(png_ptr, "Extra compressed data");
--@@ -4658,4 +4877,80 @@
-+          break;
-+@@ -4678,5 +4897,81 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED
-+       png_error(png_ptr, png_ptr->zstream.msg);
-  
-     png_ptr->flags |= PNG_FLAG_ROW_INIT;
-  }
- +
- +#ifdef PNG_READ_APNG_SUPPORTED
- +/* This function is to be called after the main IDAT set has been read and
- + * before a new IDAT is read. It resets some parts of png_ptr
- + * to make them usable by the read functions again */
-@@ -1435,33 +1217,308 @@ Index: pngrutil.c
- +    png_ptr->zstream.next_in = 0;
- +    png_ptr->zstream.next_out = png_ptr->row_buf;
- +    png_ptr->zstream.avail_out = (uInt)PNG_ROWBYTES(png_ptr->pixel_depth,
- +        png_ptr->iwidth) + 1;
- +}
- +#endif /* PROGRESSIVE_READ */
- +#endif /* READ_APNG */
-  #endif /* READ */
--Index: pngwutil.c
--===================================================================
----- pngwutil.c
--+++ pngwutil.c
--@@ -822,6 +822,11 @@
-+diff --git a/pngset.c b/pngset.c
-+--- a/pngset.c
-++++ b/pngset.c
-+@@ -287,8 +287,13 @@ png_set_IHDR(png_const_structrp png_ptr,
-+ 
-+    info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
-+ 
-+    info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
-++
-++#ifdef PNG_APNG_SUPPORTED
-++   /* for non-animated png. this may be overwritten from an acTL chunk later */
-++   info_ptr->num_frames = 1;
-++#endif
-+ }
-+ 
-+ #ifdef PNG_oFFs_SUPPORTED
-+ void PNGAPI
-+@@ -1157,8 +1162,148 @@ png_set_sPLT(png_const_structrp png_ptr,
-+       png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
-+ }
-+ #endif /* sPLT */
-+ 
-++#ifdef PNG_APNG_SUPPORTED
-++png_uint_32 PNGAPI
-++png_set_acTL(png_structp png_ptr, png_infop info_ptr,
-++    png_uint_32 num_frames, png_uint_32 num_plays)
-++{
-++    png_debug1(1, "in %s storage function", "acTL");
-++
-++    if (png_ptr == NULL || info_ptr == NULL)
-++    {
-++        png_warning(png_ptr,
-++                    "Call to png_set_acTL() with NULL png_ptr "
-++                    "or info_ptr ignored");
-++        return (0);
-++    }
-++    if (num_frames == 0)
-++    {
-++        png_warning(png_ptr,
-++                    "Ignoring attempt to set acTL with num_frames zero");
-++        return (0);
-++    }
-++    if (num_frames > PNG_UINT_31_MAX)
-++    {
-++        png_warning(png_ptr,
-++                    "Ignoring attempt to set acTL with num_frames > 2^31-1");
-++        return (0);
-++    }
-++    if (num_plays > PNG_UINT_31_MAX)
-++    {
-++        png_warning(png_ptr,
-++                    "Ignoring attempt to set acTL with num_plays > 2^31-1");
-++        return (0);
-++    }
-++
-++    info_ptr->num_frames = num_frames;
-++    info_ptr->num_plays = num_plays;
-++
-++    info_ptr->valid |= PNG_INFO_acTL;
-++
-++    return (1);
-++}
-++
-++/* delay_num and delay_den can hold any 16-bit values including zero */
-++png_uint_32 PNGAPI
-++png_set_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
-++    png_uint_32 width, png_uint_32 height,
-++    png_uint_32 x_offset, png_uint_32 y_offset,
-++    png_uint_16 delay_num, png_uint_16 delay_den,
-++    png_byte dispose_op, png_byte blend_op)
-++{
-++    png_debug1(1, "in %s storage function", "fcTL");
-++
-++    if (png_ptr == NULL || info_ptr == NULL)
-++    {
-++        png_warning(png_ptr,
-++                    "Call to png_set_fcTL() with NULL png_ptr or info_ptr "
-++                    "ignored");
-++        return (0);
-++    }
-++
-++    png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
-++                             delay_num, delay_den, dispose_op, blend_op);
-++
-++    if (blend_op == PNG_BLEND_OP_OVER)
-++    {
-++        if ((png_ptr->color_type & PNG_COLOR_MASK_ALPHA) == 0 &&
-++            png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) == 0)
-++        {
-++          png_warning(png_ptr, "PNG_BLEND_OP_OVER is meaningless "
-++                               "and wasteful for opaque images, ignored");
-++          blend_op = PNG_BLEND_OP_SOURCE;
-++        }
-++    }
-++
-++    info_ptr->next_frame_width = width;
-++    info_ptr->next_frame_height = height;
-++    info_ptr->next_frame_x_offset = x_offset;
-++    info_ptr->next_frame_y_offset = y_offset;
-++    info_ptr->next_frame_delay_num = delay_num;
-++    info_ptr->next_frame_delay_den = delay_den;
-++    info_ptr->next_frame_dispose_op = dispose_op;
-++    info_ptr->next_frame_blend_op = blend_op;
-++
-++    info_ptr->valid |= PNG_INFO_fcTL;
-++
-++    return (1);
-++}
-++
-++void /* PRIVATE */
-++png_ensure_fcTL_is_valid(png_structp png_ptr,
-++    png_uint_32 width, png_uint_32 height,
-++    png_uint_32 x_offset, png_uint_32 y_offset,
-++    png_uint_16 delay_num, png_uint_16 delay_den,
-++    png_byte dispose_op, png_byte blend_op)
-++{
-++    if (width == 0 || width > PNG_UINT_31_MAX)
-++        png_error(png_ptr, "invalid width in fcTL (0 or > 2^31-1)");
-++    if (height == 0 || height > PNG_UINT_31_MAX)
-++        png_error(png_ptr, "invalid height in fcTL (0 or > 2^31-1)");
-++    if (x_offset > PNG_UINT_31_MAX)
-++        png_error(png_ptr, "invalid x_offset in fcTL (> 2^31-1)");
-++    if (y_offset > PNG_UINT_31_MAX)
-++        png_error(png_ptr, "invalid y_offset in fcTL (> 2^31-1)");
-++    if (width + x_offset > png_ptr->first_frame_width ||
-++        height + y_offset > png_ptr->first_frame_height)
-++        png_error(png_ptr, "dimensions of a frame are greater than "
-++                           "the ones in IHDR");
-++
-++    if (dispose_op != PNG_DISPOSE_OP_NONE &&
-++        dispose_op != PNG_DISPOSE_OP_BACKGROUND &&
-++        dispose_op != PNG_DISPOSE_OP_PREVIOUS)
-++        png_error(png_ptr, "invalid dispose_op in fcTL");
-++
-++    if (blend_op != PNG_BLEND_OP_SOURCE &&
-++        blend_op != PNG_BLEND_OP_OVER)
-++        png_error(png_ptr, "invalid blend_op in fcTL");
-++
-++    PNG_UNUSED(delay_num)
-++    PNG_UNUSED(delay_den)
-++}
-++
-++png_uint_32 PNGAPI
-++png_set_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr,
-++                              png_byte is_hidden)
-++{
-++    png_debug(1, "in png_first_frame_is_hidden()");
-++
-++    if (png_ptr == NULL)
-++        return 0;
-++
-++    if (is_hidden != 0)
-++        png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
-++    else
-++        png_ptr->apng_flags &= ~PNG_FIRST_FRAME_HIDDEN;
-++
-++    PNG_UNUSED(info_ptr)
-++
-++    return 1;
-++}
-++#endif /* APNG */
-++
-+ #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
-+ static png_byte
-+ check_location(png_const_structrp png_ptr, int location)
-+ {
-+diff --git a/pngstruct.h b/pngstruct.h
-+--- a/pngstruct.h
-++++ b/pngstruct.h
-+@@ -402,8 +402,29 @@ struct png_struct_def
-+ #ifdef PNG_MNG_FEATURES_SUPPORTED
-+    png_byte filter_type;
-+ #endif
-+ 
-++#ifdef PNG_APNG_SUPPORTED
-++   png_uint_32 apng_flags;
-++   png_uint_32 next_seq_num;         /* next fcTL/fdAT chunk sequence number */
-++   png_uint_32 first_frame_width;
-++   png_uint_32 first_frame_height;
-++
-++#ifdef PNG_READ_APNG_SUPPORTED
-++   png_uint_32 num_frames_read;      /* incremented after all image data of */
-++                                     /* a frame is read */
-++#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-++   png_progressive_frame_ptr frame_info_fn; /* frame info read callback */
-++   png_progressive_frame_ptr frame_end_fn;  /* frame data read callback */
-++#endif
-++#endif
-++
-++#ifdef PNG_WRITE_APNG_SUPPORTED
-++   png_uint_32 num_frames_to_write;
-++   png_uint_32 num_frames_written;
-++#endif
-++#endif /* APNG */
-++
-+ /* New members added in libpng-1.2.0 */
-+ 
-+ /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
-+ #ifdef PNG_USER_MEM_SUPPORTED
-+diff --git a/pngwrite.c b/pngwrite.c
-+--- a/pngwrite.c
-++++ b/pngwrite.c
-+@@ -127,8 +127,12 @@ png_write_info_before_PLTE(png_structrp 
-+        * an error and calls png_error while the color space is being set, yet
-+        * the application continues writing the PNG.  So check the 'invalid'
-+        * flag here too.
-+        */
-++#ifdef PNG_WRITE_APNG_SUPPORTED
-++   if ((info_ptr->valid & PNG_INFO_acTL) != 0)
-++      png_write_acTL(png_ptr, info_ptr->num_frames, info_ptr->num_plays);
-++#endif
-+ #ifdef PNG_GAMMA_SUPPORTED
-+ #  ifdef PNG_WRITE_gAMA_SUPPORTED
-+       if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
-+           (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_gAMA) != 0 &&
-+@@ -364,8 +368,13 @@ png_write_end(png_structrp png_ptr, png_
-+ 
-+    if ((png_ptr->mode & PNG_HAVE_IDAT) == 0)
-+       png_error(png_ptr, "No IDATs written into file");
-+ 
-++#ifdef PNG_WRITE_APNG_SUPPORTED
-++   if (png_ptr->num_frames_written != png_ptr->num_frames_to_write)
-++      png_error(png_ptr, "Not enough frames written");
-++#endif
-++
-+ #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
-+    if (png_ptr->num_palette_max > png_ptr->num_palette)
-+       png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
-+ #endif
-+@@ -2391,5 +2400,43 @@ png_image_write_to_file(png_imagep image
-+       return 0;
-+ }
-+ #endif /* SIMPLIFIED_WRITE_STDIO */
-+ #endif /* SIMPLIFIED_WRITE */
-++
-++#ifdef PNG_WRITE_APNG_SUPPORTED
-++void PNGAPI
-++png_write_frame_head(png_structp png_ptr, png_infop info_ptr,
-++    png_bytepp row_pointers, png_uint_32 width, png_uint_32 height,
-++    png_uint_32 x_offset, png_uint_32 y_offset,
-++    png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
-++    png_byte blend_op)
-++{
-++    png_debug(1, "in png_write_frame_head");
-++
-++    /* there is a chance this has been set after png_write_info was called,
-++    * so it would be set but not written. is there a way to be sure? */
-++    if ((info_ptr->valid & PNG_INFO_acTL) == 0)
-++        png_error(png_ptr, "png_write_frame_head(): acTL not set");
-++
-++    png_write_reset(png_ptr);
-++
-++    png_write_reinit(png_ptr, info_ptr, width, height);
-++
-++    if ((png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) == 0 ||
-++        png_ptr->num_frames_written != 0)
-++        png_write_fcTL(png_ptr, width, height, x_offset, y_offset,
-++                       delay_num, delay_den, dispose_op, blend_op);
-++
-++    PNG_UNUSED(row_pointers)
-++}
-++
-++void PNGAPI
-++png_write_frame_tail(png_structp png_ptr, png_infop info_ptr)
-++{
-++    png_debug(1, "in png_write_frame_tail");
-++
-++    png_ptr->num_frames_written++;
-++
-++    PNG_UNUSED(info_ptr)
-++}
-++#endif /* WRITE_APNG */
-+ #endif /* WRITE */
-+diff --git a/pngwutil.c b/pngwutil.c
-+--- a/pngwutil.c
-++++ b/pngwutil.c
-+@@ -820,8 +820,13 @@ png_write_IHDR(png_structrp png_ptr, png
-+ 
-     /* Write the chunk */
--    png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
-+    png_write_complete_chunk(png_ptr, png_IHDR, buf, 13);
-  
- +#ifdef PNG_WRITE_APNG_SUPPORTED
- +   png_ptr->first_frame_width = width;
- +   png_ptr->first_frame_height = height;
- +#endif
- +
-     if ((png_ptr->do_filter) == PNG_NO_FILTERS)
-     {
-        if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
--@@ -1004,7 +1009,17 @@
-+           png_ptr->bit_depth < 8)
-+@@ -1002,9 +1007,19 @@ png_compress_IDAT(png_structrp png_ptr, 
-+                optimize_cmf(data, png_image_size(png_ptr));
-  #endif
-  
-           if (size > 0)
- +#ifdef PNG_WRITE_APNG_SUPPORTED
- +         {
- +            if (png_ptr->num_frames_written == 0)
- +#endif
-              png_write_complete_chunk(png_ptr, png_IDAT, data, size);
-@@ -1469,17 +1526,19 @@ Index: pngwutil.c
- +            else
- +               png_write_fdAT(png_ptr, data, size);
- +         }
- +#endif /* WRITE_APNG */
- +
-           png_ptr->mode |= PNG_HAVE_IDAT;
-  
-           png_ptr->zstream.next_out = data;
--@@ -1051,7 +1066,17 @@
-+          png_ptr->zstream.avail_out = size;
-+@@ -1049,9 +1064,19 @@ png_compress_IDAT(png_structrp png_ptr, 
-+             optimize_cmf(data, png_image_size(png_ptr));
-  #endif
-  
-           if (size > 0)
- +#ifdef PNG_WRITE_APNG_SUPPORTED
- +         {
- +            if (png_ptr->num_frames_written == 0)
- +#endif
-              png_write_complete_chunk(png_ptr, png_IDAT, data, size);
-@@ -1487,17 +1546,19 @@ Index: pngwutil.c
- +            else
- +               png_write_fdAT(png_ptr, data, size);
- +         }
- +#endif /* WRITE_APNG */
- +
-           png_ptr->zstream.avail_out = 0;
-           png_ptr->zstream.next_out = NULL;
-           png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
--@@ -1887,6 +1912,82 @@
-+ 
-+@@ -1884,8 +1909,84 @@ png_write_tIME(png_structrp png_ptr, png
-+    png_write_complete_chunk(png_ptr, png_tIME, buf, 7);
-  }
-  #endif
-  
- +#ifdef PNG_WRITE_APNG_SUPPORTED
- +void /* PRIVATE */
- +png_write_acTL(png_structp png_ptr,
- +    png_uint_32 num_frames, png_uint_32 num_plays)
- +{
-@@ -1570,17 +1631,19 @@ Index: pngwutil.c
- +
- +    png_ptr->next_seq_num++;
- +}
- +#endif /* WRITE_APNG */
- +
-  /* Initializes the row writing capability of libpng */
-  void /* PRIVATE */
-  png_write_start_row(png_structrp png_ptr)
--@@ -2781,4 +2882,39 @@
-+ {
-+@@ -2777,5 +2878,40 @@ png_write_filtered_row(png_structrp png_
-+       png_write_flush(png_ptr);
-     }
-  #endif /* WRITE_FLUSH */
-  }
- +
- +#ifdef PNG_WRITE_APNG_SUPPORTED
- +void /* PRIVATE */
- +png_write_reset(png_structp png_ptr)
- +{
-@@ -1610,36 +1673,8 @@ Index: pngwutil.c
- +
- +    png_ptr->width = width;
- +    png_ptr->height = height;
- +    png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
- +    png_ptr->usr_width = png_ptr->width;
- +}
- +#endif /* WRITE_APNG */
-  #endif /* WRITE */
--Index: scripts/symbols.def
--===================================================================
----- scripts/symbols.def
--+++ scripts/symbols.def
--@@ -254,3 +254,23 @@
--  png_set_eXIf @247
--  png_get_eXIf_1 @248
--  png_set_eXIf_1 @249
--+ png_get_acTL @250
--+ png_set_acTL @251
--+ png_get_num_frames @252
--+ png_get_num_plays @253
--+ png_get_next_frame_fcTL @254
--+ png_set_next_frame_fcTL @255
--+ png_get_next_frame_width @256
--+ png_get_next_frame_height @257
--+ png_get_next_frame_x_offset @258
--+ png_get_next_frame_y_offset @259
--+ png_get_next_frame_delay_num @260
--+ png_get_next_frame_delay_den @261
--+ png_get_next_frame_dispose_op @262
--+ png_get_next_frame_blend_op @263
--+ png_get_first_frame_is_hidden @264
--+ png_set_first_frame_is_hidden @265
--+ png_read_frame_head @266
--+ png_set_progressive_frame_fn @267
--+ png_write_frame_head @268
--+ png_write_frame_tail @269
-diff --git a/media/libpng/arm.patch b/media/libpng/arm.patch
---- a/media/libpng/arm.patch
-+++ b/media/libpng/arm.patch
-@@ -1,48 +1,32 @@
--diff --git ../../../libpng-1.6.16/arm/arm_init.c arm/arm_init.c
----- ../../../libpng-1.6.16/arm/arm_init.c	2014-12-21 22:08:08.000000000 -0500
--+++ arm/arm_init.c	2014-12-22 17:33:57.556305506 -0500
--@@ -29,17 +29,17 @@
--  * You may set the macro PNG_ARM_NEON_FILE to the file name of file containing
--  * a fragment of C source code which defines the png_have_neon function.  There
--  * are a number of implementations in contrib/arm-neon, but the only one that
--  * has partial support is contrib/arm-neon/linux.c - a generic Linux
-+diff --git a/arm/arm_init.c b/arm/arm_init.c
-+--- a/arm/arm_init.c
-++++ b/arm/arm_init.c
-+@@ -33,9 +33,9 @@
-   * implementation which reads /proc/cpufino.
-   */
-  #ifndef PNG_ARM_NEON_FILE
-  #  ifdef __linux__
- -#     define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
- +#     define PNG_ARM_NEON_FILE "linux.c"
-  #  endif
-  #endif
-  
-  #ifdef PNG_ARM_NEON_FILE
-- 
-- #include <signal.h> /* for sig_atomic_t */
-- static int png_have_neon(png_structp png_ptr);
-- #include PNG_ARM_NEON_FILE
--diff --git ../../../libpng-1.6.16/arm/filter_neon.S arm/filter_neon.S
----- ../../../libpng-1.6.16/arm/filter_neon.S	2014-12-21 22:08:08.000000000 -0500
--+++ arm/filter_neon.S	2014-12-22 17:43:31.588323649 -0500
--@@ -5,16 +5,22 @@
--  * Written by Mans Rullgard, 2011.
--  * Last changed in libpng 1.6.16 [December 22, 2014]
--  *
--  * This code is released under the libpng license.
-+diff --git a/arm/filter_neon.S b/arm/filter_neon.S
-+--- a/arm/filter_neon.S
-++++ b/arm/filter_neon.S
-+@@ -9,8 +9,14 @@
-   * For conditions of distribution and use, see the disclaimer
-   * and license in png.h
-   */
-  
- +/* These are required because Mozilla's moz.build system doesn't pass
- + * -DDefined macros to the assembler.
- + */
- +#define PNG_READ_SUPPORTED
- +#define MOZ_PNG_HAVE_ARM_NEON
- +
-  /* This is required to get the symbol renames, which are #defines, and the
-   * definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
-   */
-  #define PNG_VERSION_INFO_ONLY
-- #include "../pngpriv.h"
-- 
-- #if defined(__linux__) && defined(__ELF__)
-- .section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
-diff --git a/media/libpng/intel/filter_sse2_intrinsics.c b/media/libpng/intel/filter_sse2_intrinsics.c
---- a/media/libpng/intel/filter_sse2_intrinsics.c
-+++ b/media/libpng/intel/filter_sse2_intrinsics.c
-@@ -66,17 +66,17 @@ static void store3(void* p, __m128i v) {
- 
- void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
-    png_const_bytep prev)
- {
-    /* The Sub filter predicts each pixel as the previous pixel, a.
-     * There is no pixel to the left of the first pixel.  It's encoded directly.
-     * That works with our main loop if we just say that left pixel was zero.
-     */
--   png_size_t rb;
-+   size_t rb;
- 
-    __m128i a, d = _mm_setzero_si128();
- 
-    png_debug(1, "in png_read_filter_row_sub3_sse2");
- 
-    rb = row_info->rowbytes;
-    while (rb >= 4) {
-       a = d; d = load4(row);
-@@ -99,17 +99,17 @@ void png_read_filter_row_sub3_sse2(png_r
- 
- void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row,
-    png_const_bytep prev)
- {
-    /* The Sub filter predicts each pixel as the previous pixel, a.
-     * There is no pixel to the left of the first pixel.  It's encoded directly.
-     * That works with our main loop if we just say that left pixel was zero.
-     */
--   png_size_t rb;
-+   size_t rb;
- 
-    __m128i a, d = _mm_setzero_si128();
- 
-    png_debug(1, "in png_read_filter_row_sub4_sse2");
- 
-    rb = row_info->rowbytes+4;
-    while (rb > 4) {
-       a = d; d = load4(row);
-@@ -126,17 +126,17 @@ void png_read_filter_row_avg3_sse2(png_r
-    png_const_bytep prev)
- {
-    /* The Avg filter predicts each pixel as the (truncated) average of a and b.
-     * There's no pixel to the left of the first pixel.  Luckily, it's
-     * predicted to be half of the pixel above it.  So again, this works
-     * perfectly with our loop if we make sure a starts at zero.
-     */
- 
--   png_size_t rb;
-+   size_t rb;
- 
-    const __m128i zero = _mm_setzero_si128();
- 
-    __m128i    b;
-    __m128i a, d = zero;
- 
-    png_debug(1, "in png_read_filter_row_avg3_sse2");
-    rb = row_info->rowbytes;
-@@ -180,17 +180,17 @@ void png_read_filter_row_avg3_sse2(png_r
- void png_read_filter_row_avg4_sse2(png_row_infop row_info, png_bytep row,
-    png_const_bytep prev)
- {
-    /* The Avg filter predicts each pixel as the (truncated) average of a and b.
-     * There's no pixel to the left of the first pixel.  Luckily, it's
-     * predicted to be half of the pixel above it.  So again, this works
-     * perfectly with our loop if we make sure a starts at zero.
-     */
--   png_size_t rb;
-+   size_t rb;
-    const __m128i zero = _mm_setzero_si128();
-    __m128i    b;
-    __m128i a, d = zero;
- 
-    png_debug(1, "in png_read_filter_row_avg4_sse2");
- 
-    rb = row_info->rowbytes+4;
-    while (rb > 4) {
-@@ -252,17 +252,17 @@ void png_read_filter_row_paeth3_sse2(png
-     * p=a+b-c.
-     *
-     * The first pixel has no left context, and so uses an Up filter, p = b.
-     * This works naturally with our main loop's p = a+b-c if we force a and c
-     * to zero.
-     * Here we zero b and d, which become c and a respectively at the start of
-     * the loop.
-     */
--   png_size_t rb;
-+   size_t rb;
-    const __m128i zero = _mm_setzero_si128();
-    __m128i c, b = zero,
-            a, d = zero;
- 
-    png_debug(1, "in png_read_filter_row_paeth3_sse2");
- 
-    rb = row_info->rowbytes;
-    while (rb >= 4) {
-@@ -351,17 +351,17 @@ void png_read_filter_row_paeth4_sse2(png
-     * p=a+b-c.
-     *
-     * The first pixel has no left context, and so uses an Up filter, p = b.
-     * This works naturally with our main loop's p = a+b-c if we force a and c
-     * to zero.
-     * Here we zero b and d, which become c and a respectively at the start of
-     * the loop.
-     */
--   png_size_t rb;
-+   size_t rb;
-    const __m128i zero = _mm_setzero_si128();
-    __m128i pa,pb,pc,smallest,nearest;
-    __m128i c, b = zero,
-            a, d = zero;
- 
-    png_debug(1, "in png_read_filter_row_paeth4_sse2");
- 
-    rb = row_info->rowbytes+4;
-diff --git a/media/libpng/libpng-manual.txt b/media/libpng/libpng-manual.txt
---- a/media/libpng/libpng-manual.txt
-+++ b/media/libpng/libpng-manual.txt
-@@ -1,22 +1,21 @@
- libpng-manual.txt - A description on how to use and modify libpng
- 
-- libpng version 1.6.34 - September 29, 2017
-+ libpng version 1.6.35 - July 15, 2018
-  Updated and distributed by Glenn Randers-Pehrson
-- <glennrp at users.sourceforge.net>
-- Copyright (c) 1998-2017 Glenn Randers-Pehrson
-+ Copyright (c) 1998-2018 Glenn Randers-Pehrson
- 
-  This document is released under the libpng license.
-  For conditions of distribution and use, see the disclaimer
-  and license in png.h
- 
-  Based on:
- 
-- libpng versions 0.97, January 1998, through 1.6.34 - September 29, 2017
-+ libpng versions 0.97, January 1998, through 1.6.35 - July 15, 2018
-  Updated and distributed by Glenn Randers-Pehrson
-  Copyright (c) 1998-2017 Glenn Randers-Pehrson
- 
-  libpng 1.0 beta 6 - version 0.96 - May 28, 1997
-  Updated and distributed by Andreas Dilger
-  Copyright (c) 1996, 1997 Andreas Dilger
- 
-  libpng 1.0 beta 2 - version 0.88 - January 26, 1996
-@@ -343,28 +342,28 @@ then only check the bytes (if any) that 
- 
- (*): If you are not using the standard I/O functions, you will need
- to replace them with custom functions.  See the discussion under
- Customizing libpng.
- 
-     FILE *fp = fopen(file_name, "rb");
-     if (!fp)
-     {
--       return (ERROR);
-+       return ERROR;
-     }
- 
-     if (fread(header, 1, number, fp) != number)
-     {
--       return (ERROR);
-+       return ERROR;
-     }
- 
-     is_png = !png_sig_cmp(header, 0, number);
-     if (!is_png)
-     {
--       return (NOT_PNG);
-+       return NOT_PNG;
-     }
- 
- Next, png_struct and png_info need to be allocated and initialized.  In
- order to ensure that the size of these structures is correct even with a
- dynamically linked libpng, there are functions to initialize and
- allocate the structures.  We also pass the library version, optional
- pointers to error handling functions, and a pointer to a data struct for
- use by the error functions, if necessary (the pointer and functions can
-@@ -373,25 +372,25 @@ on Changes to Libpng below regarding the
- The structure allocation functions quietly return NULL if they fail to
- create the structure, so your application should check for that.
- 
-     png_structp png_ptr = png_create_read_struct
-         (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
-         user_error_fn, user_warning_fn);
- 
-     if (!png_ptr)
--       return (ERROR);
-+       return ERROR;
- 
-     png_infop info_ptr = png_create_info_struct(png_ptr);
- 
-     if (!info_ptr)
-     {
-        png_destroy_read_struct(&png_ptr,
-            (png_infopp)NULL, (png_infopp)NULL);
--       return (ERROR);
-+       return ERROR;
-     }
- 
- If you want to use your own memory allocation routines,
- use a libpng that was built with PNG_USER_MEM_SUPPORTED defined, and use
- png_create_read_struct_2() instead of png_create_read_struct():
- 
-     png_structp png_ptr = png_create_read_struct_2
-         (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
-@@ -416,17 +415,17 @@ on the libpng error handling.  If an err
- back to your setjmp, you will want to call png_destroy_read_struct() to
- free any memory.
- 
-     if (setjmp(png_jmpbuf(png_ptr)))
-     {
-        png_destroy_read_struct(&png_ptr, &info_ptr,
-            &end_info);
-        fclose(fp);
--       return (ERROR);
-+       return ERROR;
-     }
- 
- Pass (png_infopp)NULL instead of &end_info if you didn't create
- an end_info structure.
- 
- If you would rather avoid the complexity of setjmp/longjmp issues,
- you can compile libpng with PNG_NO_SETJMP, in which case
- errors will result in a call to PNG_ABORT() which defaults to abort().
-@@ -498,28 +497,28 @@ input stream. You must supply the functi
-          png_unknown_chunkp chunk);
-     {
-        /* The unknown chunk structure contains your
-           chunk data, along with similar data for any other
-           unknown chunks: */
- 
-            png_byte name[5];
-            png_byte *data;
--           png_size_t size;
-+           size_t size;
- 
-        /* Note that libpng has already taken care of
-           the CRC handling */
- 
-        /* put your code here.  Search for your chunk in the
-           unknown chunk structure, process it, and return one
-           of the following: */
- 
--       return (-n); /* chunk had an error */
--       return (0); /* did not recognize */
--       return (n); /* success */
-+       return -n; /* chunk had an error */
-+       return 0; /* did not recognize */
-+       return n; /* success */
-     }
- 
- (You can give your function another name that you like instead of
- "read_chunk_callback")
- 
- To inform libpng about your function, use
- 
-     png_set_read_user_chunk_fn(png_ptr, user_chunk_ptr,
-@@ -998,17 +997,17 @@ Choices for the alpha_mode are
- PNG_ALPHA_PNG is the default libpng handling of the alpha channel. It is not
- pre-multiplied into the color components. In addition the call states
- that the output is for a sRGB system and causes all PNG files without gAMA
- chunks to be assumed to be encoded using sRGB.
- 
-     png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
- 
- In this case the output is assumed to be something like an sRGB conformant
--display preceeded by a power-law lookup table of power 1.45.  This is how
-+display preceded by a power-law lookup table of power 1.45.  This is how
- early Mac systems behaved.
- 
-     png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR);
- 
- This is the classic Jim Blinn approach and will work in academic
- environments where everything is done by the book.  It has the shortcoming
- of assuming that input PNG data with no gamma information is linear - this
- is unlikely to be correct unless the PNG files were generated locally.
-@@ -1050,17 +1049,17 @@ This option will also reduce the halos, 
- halos round the opaque parts of the image where the background is light.
- In the OPTIMIZED mode the halos will be light halos where the background
- is dark.  Take your pick - the halos are unavoidable unless you can get
- your hardware/software fixed!  (The OPTIMIZED approach is slightly
- faster.)
- 
- When the default gamma of PNG files doesn't match the output gamma.
- If you have PNG files with no gamma information png_set_alpha_mode allows
--you to provide a default gamma, but it also sets the ouput gamma to the
-+you to provide a default gamma, but it also sets the output gamma to the
- matching value.  If you know your PNG files have a gamma that doesn't
- match the output you can take advantage of the fact that
- png_set_alpha_mode always sets the output gamma but only sets the PNG
- default if it is not already set:
- 
-     png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
-     png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
- 
-@@ -2404,17 +2403,17 @@ struct if you want to keep the comments 
- separate.
- 
-     png_infop end_info = png_create_info_struct(png_ptr);
- 
-     if (!end_info)
-     {
-        png_destroy_read_struct(&png_ptr, &info_ptr,
-            (png_infopp)NULL);
--       return (ERROR);
-+       return ERROR;
-     }
- 
-    png_read_end(png_ptr, end_info);
- 
- If you are not interested, you should still call png_read_end()
- but you can pass NULL, avoiding the need to create an end_info structure.
- If you do this, libpng will not process any chunks after IDAT other than
- skipping over them and perhaps (depending on whether you have called
-@@ -2544,32 +2543,32 @@ png_infop info_ptr;
-  int
-  initialize_png_reader()
-  {
-     png_ptr = png_create_read_struct
-         (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
-          user_error_fn, user_warning_fn);
- 
-     if (!png_ptr)
--        return (ERROR);
-+        return ERROR;
- 
-     info_ptr = png_create_info_struct(png_ptr);
- 
-     if (!info_ptr)
-     {
-        png_destroy_read_struct(&png_ptr,
-           (png_infopp)NULL, (png_infopp)NULL);
--       return (ERROR);
-+       return ERROR;
-     }
- 
-     if (setjmp(png_jmpbuf(png_ptr)))
-     {
-        png_destroy_read_struct(&png_ptr, &info_ptr,
-           (png_infopp)NULL);
--       return (ERROR);
-+       return ERROR;
-     }
- 
-     /* This one's new.  You can provide functions
-        to be called when the header info is valid,
-        when each row is completed, and when the image
-        is finished.  If you aren't using all functions,
-        you can specify NULL parameters.  Even when all
-        three functions are NULL, you need to call
-@@ -2593,17 +2592,17 @@ png_infop info_ptr;
-    of data */
-  int
-  process_data(png_bytep buffer, png_uint_32 length)
-  {
-     if (setjmp(png_jmpbuf(png_ptr)))
-     {
-        png_destroy_read_struct(&png_ptr, &info_ptr,
-            (png_infopp)NULL);
--       return (ERROR);
-+       return ERROR;
-     }
- 
-     /* This one's new also.  Simply give it a chunk
-        of data from the file stream (in order, of
-        course).  On machines with segmented memory
-        models machines, don't give it any more than
-        64K.  The library seems to run fine with sizes
-        of 4K. Although you can give it much less if
-@@ -2737,39 +2736,39 @@ Setup
- You will want to do the I/O initialization before you get into libpng,
- so if it doesn't work, you don't have anything to undo. If you are not
- using the standard I/O functions, you will need to replace them with
- custom writing functions.  See the discussion under Customizing libpng.
- 
-     FILE *fp = fopen(file_name, "wb");
- 
-     if (!fp)
--       return (ERROR);
-+       return ERROR;
- 
- Next, png_struct and png_info need to be allocated and initialized.
- As these can be both relatively large, you may not want to store these
- on the stack, unless you have stack space to spare.  Of course, you
- will want to check if they return NULL.  If you are also reading,
- you won't want to name your read structure and your write structure
- both "png_ptr"; you can call them anything you like, such as
- "read_ptr" and "write_ptr".  Look at pngtest.c, for example.
- 
-     png_structp png_ptr = png_create_write_struct
-        (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
-         user_error_fn, user_warning_fn);
- 
-     if (!png_ptr)
--       return (ERROR);
-+       return ERROR;
- 
-     png_infop info_ptr = png_create_info_struct(png_ptr);
-     if (!info_ptr)
-     {
-        png_destroy_write_struct(&png_ptr,
-            (png_infopp)NULL);
--       return (ERROR);
-+       return ERROR;
-     }
- 
- If you want to use your own memory allocation routines,
- define PNG_USER_MEM_SUPPORTED and use
- png_create_write_struct_2() instead of png_create_write_struct():
- 
-     png_structp png_ptr = png_create_write_struct_2
-        (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
-@@ -2786,17 +2785,17 @@ call a png_*() function.  See your docum
- for your compiler for more information on setjmp/longjmp.  See
- the discussion on libpng error handling in the Customizing Libpng
- section below for more information on the libpng error handling.
- 
-     if (setjmp(png_jmpbuf(png_ptr)))
-     {
-     png_destroy_write_struct(&png_ptr, &info_ptr);
-        fclose(fp);
--       return (ERROR);
-+       return ERROR;
-     }
-     ...
-     return;
- 
- If you would rather avoid the complexity of setjmp/longjmp issues,
- you can compile libpng with PNG_NO_SETJMP, in which case
- errors will result in a call to PNG_ABORT() which defaults to abort().
- 
-@@ -3774,17 +3773,17 @@ V. Simplified API
- 
- The simplified API, which became available in libpng-1.6.0, hides the details
- of both libpng and the PNG file format itself.
- It allows PNG files to be read into a very limited number of
- in-memory bitmap formats or to be written from the same formats.  If these
- formats do not accommodate your needs then you can, and should, use the more
- sophisticated APIs above - these support a wide variety of in-memory formats
- and a wide variety of sophisticated transformations to those formats as well
--as a wide variety of APIs to manipulate ancilliary information.
-+as a wide variety of APIs to manipulate ancillary information.
- 
- To read a PNG file using the simplified API:
- 
-   1) Declare a 'png_image' structure (see below) on the stack, set the
-      version field to PNG_IMAGE_VERSION and the 'opaque' pointer to NULL
-      (this is REQUIRED, your program may crash if you don't do it.)
- 
-   2) Call the appropriate png_image_begin_read... function.
-@@ -4097,17 +4096,17 @@ READ APIs
-      is filled in from the PNG header in the file.
- 
-    int png_image_begin_read_from_stdio (png_imagep image,
-      FILE* file)
- 
-       The PNG header is read from the stdio FILE object.
- 
-    int png_image_begin_read_from_memory(png_imagep image,
--      png_const_voidp memory, png_size_t size)
-+      png_const_voidp memory, size_t size)
- 
-       The PNG header is read from the given memory buffer.
- 
-    int png_image_finish_read(png_imagep image,
-       png_colorp background, void *buffer,
-       png_int_32 row_stride, void *colormap));
- 
-       Finish reading the image into the supplied buffer and
-@@ -4250,20 +4249,20 @@ png_get_io_ptr().  For example:
-         png_flush_ptr output_flush_fn);
- 
-     voidp read_io_ptr = png_get_io_ptr(read_ptr);
-     voidp write_io_ptr = png_get_io_ptr(write_ptr);
- 
- The replacement I/O functions must have prototypes as follows:
- 
-     void user_read_data(png_structp png_ptr,
--        png_bytep data, png_size_t length);
-+        png_bytep data, size_t length);
- 
-     void user_write_data(png_structp png_ptr,
--        png_bytep data, png_size_t length);
-+        png_bytep data, size_t length);
- 
-     void user_flush_data(png_structp png_ptr);
- 
- The user_read_data() function is responsible for detecting and
- handling end-of-data errors.
- 
- Supplying NULL for the read, write, or flush functions sets them back
- to using the default C stream functions, which expect the io_ptr to
-@@ -4779,17 +4778,17 @@ This also applies to the prototype for t
- The png_calloc() function was added and is used in place of
- of "png_malloc(); memset();" except in the case in png_read_png()
- where the array consists of pointers; in this case a "for" loop is used
- after the png_malloc() to set the pointers to NULL, to give robust.
- behavior in case the application runs out of memory part-way through
- the process.
- 
- We changed the prototypes of png_get_compression_buffer_size() and
--png_set_compression_buffer_size() to work with png_size_t instead of
-+png_set_compression_buffer_size() to work with size_t instead of
- png_uint_32.
- 
- Support for numbered error messages was removed by default, since we
- never got around to actually numbering the error messages. The function
- png_set_strip_error_numbers() was removed from the library by default.
- 
- The png_zalloc() and png_zfree() functions are no longer exported.
- The png_zalloc() function no longer zeroes out the memory that it
-@@ -5250,30 +5249,29 @@ at
-     https://github.com/glennrp/libpng or
-     https://git.code.sf.net/p/libpng/code.git
- 
- or you can browse it with a web browser at
- 
-     https://github.com/glennrp/libpng or
-     https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
- 
--Patches can be sent to glennrp at users.sourceforge.net or to
--png-mng-implement at lists.sourceforge.net or you can upload them to
--the libpng bug tracker at
-+Patches can be sent to png-mng-implement at lists.sourceforge.net or
-+you can upload them to the libpng bug tracker at
- 
-     https://libpng.sourceforge.io/
- 
- or as a "pull request" to
- 
-     https://github.com/glennrp/libpng/pulls
- 
- We also accept patches built from the tar or zip distributions, and
--simple verbal discriptions of bug fixes, reported either to the
-+simple verbal descriptions of bug fixes, reported either to the
- SourceForge bug tracker, to the png-mng-implement at lists.sf.net
--mailing list, as github issues, or directly to glennrp.
-+mailing list, as github issues.
- 
- XV. Coding style
- 
- Our coding style is similar to the "Allman" style
- (See https://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
- braces on separate lines:
- 
-     if (condition)
-@@ -5284,17 +5282,17 @@ braces on separate lines:
-     else if (another condition)
-     {
-        another action;
-     }
- 
- The braces can be omitted from simple one-line actions:
- 
-     if (condition)
--       return (0);
-+       return 0;
- 
- We use 3-space indentation, except for continued statements which
- are usually indented the same as the first line of the statement
- plus four more spaces.
- 
- For macro definitions we use 2-space indentation, always leaving the "#"
- in the first column.
- 
-@@ -5409,17 +5407,17 @@ Lines do not exceed 80 characters.
- Other rules can be inferred by inspecting the libpng source.
- 
- XVI. Y2K Compliance in libpng
- 
- Since the PNG Development group is an ad-hoc body, we can't make
- an official declaration.
- 
- This is your unofficial assurance that libpng from version 0.71 and
--upward through 1.6.34 are Y2K compliant.  It is my belief that earlier
-+upward through 1.6.35 are Y2K compliant.  It is my belief that earlier
- versions were also Y2K compliant.
- 
- Libpng only has two year fields.  One is a 2-byte unsigned integer
- that will hold years up to 65535.  The other, which is deprecated,
- holds the date in text format, and will hold years up to 9999.
- 
- The integer is
-     "png_uint_16 year" in png_time_struct.
-diff --git a/media/libpng/png.c b/media/libpng/png.c
---- a/media/libpng/png.c
-+++ b/media/libpng/png.c
-@@ -1,25 +1,25 @@
- 
- /* png.c - location for general purpose libpng functions
-  *
-- * Last changed in libpng 1.6.33 [September 28, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- #include "pngpriv.h"
- 
- /* Generate a compiler error if there is an old png.h in the search path. */
--typedef png_libpng_version_1_6_34 Your_png_h_is_not_version_1_6_34;
-+typedef png_libpng_version_1_6_35 Your_png_h_is_not_version_1_6_35;
- 
- #ifdef __GNUC__
- /* The version tests may need to be added to, but the problem warning has
-  * consistently been fixed in GCC versions which obtain wide-spread release.
-  * The problem is that many versions of GCC rearrange comparison expressions in
-  * the optimizer in such a way that the results of the comparison will change
-  * if signed integer overflow occurs.  Such comparisons are not permitted in
-  * ANSI C90, however GCC isn't clever enough to work out that that do not occur
-@@ -66,17 +66,17 @@ png_set_sig_bytes(png_structrp png_ptr, 
-  * checking less than the full 8-byte signature so that those apps that
-  * already read the first few bytes of a file to determine the file type
-  * can simply check the remaining bytes for extra assurance.  Returns
-  * an integer less than, equal to, or greater than zero if sig is found,
-  * respectively, to be less than, to match, or be greater than the correct
-  * PNG signature (this is the same behavior as strcmp, memcmp, etc).
-  */
- int PNGAPI
--png_sig_cmp(png_const_bytep sig, png_size_t start, png_size_t num_to_check)
-+png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check)
- {
-    png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
- 
-    if (num_to_check > 8)
-       num_to_check = 8;
- 
-    else if (num_to_check < 1)
-       return (-1);
-@@ -131,17 +131,17 @@ png_reset_crc(png_structrp png_ptr)
- }
- 
- /* Calculate the CRC over a section of data.  We can only pass as
-  * much data to this routine as the largest single buffer size.  We
-  * also check that this data will actually be used before going to the
-  * trouble of calculating it.
-  */
- void /* PRIVATE */
--png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
-+png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, size_t length)
- {
-    int need_crc = 1;
- 
-    if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0)
-    {
-       if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
-           (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
-          need_crc = 0;
-@@ -416,17 +416,17 @@ png_destroy_info_struct(png_const_struct
-  * instead.  Use deprecated in 1.6.0, internal use removed (used internally it
-  * is just a memset).
-  *
-  * NOTE: it is almost inconceivable that this API is used because it bypasses
-  * the user-memory mechanism and the user error handling/warning mechanisms in
-  * those cases where it does anything other than a memset.
-  */
- PNG_FUNCTION(void,PNGAPI
--png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
-+png_info_init_3,(png_infopp ptr_ptr, size_t png_info_struct_size),
-     PNG_DEPRECATED)
- {
-    png_inforp info_ptr = *ptr_ptr;
- 
-    png_debug(1, "in png_info_init_3");
- 
-    if (info_ptr == NULL)
-       return;
-@@ -811,31 +811,31 @@ png_const_charp PNGAPI
- png_get_copyright(png_const_structrp png_ptr)
- {
-    PNG_UNUSED(png_ptr)  /* Silence compiler warning about unused png_ptr */
- #ifdef PNG_STRING_COPYRIGHT
-    return PNG_STRING_COPYRIGHT
- #else
- #  ifdef __STDC__
-    return PNG_STRING_NEWLINE \
--      "libpng version 1.6.34+apng - September 29, 2017" PNG_STRING_NEWLINE \
--      "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
-+      "libpng version 1.6.35+apng - July 15, 2018" PNG_STRING_NEWLINE \
-+      "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
-       PNG_STRING_NEWLINE \
-       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
-       "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
-       PNG_STRING_NEWLINE \
-       "Portions Copyright (c) 2006-2007 Andrew Smith" PNG_STRING_NEWLINE \
--      "Portions Copyright (c) 2008-2017 Max Stepin" PNG_STRING_NEWLINE ;
-+      "Portions Copyright (c) 2008-2018 Max Stepin" PNG_STRING_NEWLINE ;
- #  else
--   return "libpng version 1.6.34+apng - September 29, 2017\
--      Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
-+   return "libpng version 1.6.35+apng - July 15, 2018\
-+      Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson\
-       Copyright (c) 1996-1997 Andreas Dilger\
-       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\
-       Portions Copyright (c) 2006-2007 Andrew Smith\
--      Portions Copyright (c) 2008-2017 Max Stepin";
-+      Portions Copyright (c) 2008-2018 Max Stepin";
- #  endif
- #endif
- }
- 
- /* The following return the library version as a short string in the
-  * format 1.0.0 through 99.99.99zz.  To get the version of *.h files
-  * used with your application, print out PNG_LIBPNG_VER_STRING, which
-  * is defined in png.h.
-@@ -941,17 +941,17 @@ png_handle_as_unknown(png_const_structrp
-    if (png_ptr == NULL || chunk_name == NULL || png_ptr->num_chunk_list == 0)
-       return PNG_HANDLE_CHUNK_AS_DEFAULT;
- 
-    p_end = png_ptr->chunk_list;
-    p = p_end + png_ptr->num_chunk_list*5; /* beyond end */
- 
-    /* The code is the fifth byte after each four byte string.  Historically this
-     * code was always searched from the end of the list, this is no longer
--    * necessary because the 'set' routine handles duplicate entries correcty.
-+    * necessary because the 'set' routine handles duplicate entries correctly.
-     */
-    do /* num_chunk_list > 0, so at least one */
-    {
-       p -= 5;
- 
-       if (memcmp(chunk_name, p, 4) == 0)
-          return p[4];
-    }
-@@ -2066,17 +2066,17 @@ png_icc_check_header(png_const_structrp 
-    /* At this point the tag table can't be checked because it hasn't necessarily
-     * been loaded; however, various header fields can be checked.  These checks
-     * are for values permitted by the PNG spec in an ICC profile; the PNG spec
-     * restricts the profiles that can be passed in an iCCP chunk (they must be
-     * appropriate to processing PNG data!)
-     */
- 
-    /* Data checks (could be skipped).  These checks must be independent of the
--    * version number; however, the version number doesn't accomodate changes in
-+    * version number; however, the version number doesn't accommodate changes in
-     * the header fields (just the known tags and the interpretation of the
-     * data.)
-     */
-    temp = png_get_uint_32(profile+36); /* signature 'ascp' */
-    if (temp != 0x61637370)
-       return png_icc_profile_error(png_ptr, colorspace, name, temp,
-           "invalid signature");
- 
-@@ -2706,29 +2706,29 @@ png_check_IHDR(png_const_structrp png_pt
- #endif
- 
-    if (error == 1)
-       png_error(png_ptr, "Invalid IHDR data");
- }
- 
- #if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
- /* ASCII to fp functions */
--/* Check an ASCII formated floating point value, see the more detailed
-+/* Check an ASCII formatted floating point value, see the more detailed
-  * comments in pngpriv.h
-  */
- /* The following is used internally to preserve the sticky flags */
- #define png_fp_add(state, flags) ((state) |= (flags))
- #define png_fp_set(state, value) ((state) = (value) | ((state) & PNG_FP_STICKY))
- 
- int /* PRIVATE */
--png_check_fp_number(png_const_charp string, png_size_t size, int *statep,
-+png_check_fp_number(png_const_charp string, size_t size, int *statep,
-     png_size_tp whereami)
- {
-    int state = *statep;
--   png_size_t i = *whereami;
-+   size_t i = *whereami;
- 
-    while (i < size)
-    {
-       int type;
-       /* First find the type of the next character */
-       switch (string[i])
-       {
-       case 43:  type = PNG_FP_SAW_SIGN;                   break;
-@@ -2841,20 +2841,20 @@ PNG_FP_End:
-    *whereami = i;
- 
-    return (state & PNG_FP_SAW_DIGIT) != 0;
- }
- 
- 
- /* The same but for a complete string. */
- int
--png_check_fp_string(png_const_charp string, png_size_t size)
-+png_check_fp_string(png_const_charp string, size_t size)
- {
-    int        state=0;
--   png_size_t char_index=0;
-+   size_t char_index=0;
- 
-    if (png_check_fp_number(string, size, &state, &char_index) != 0 &&
-       (char_index == size || string[char_index] == 0))
-       return state /* must be non-zero - see above */;
- 
-    return 0; /* i.e. fail */
- }
- #endif /* pCAL || sCAL */
-@@ -2905,17 +2905,17 @@ png_pow10(int power)
- #pragma GCC diagnostic push
- /* The problem arises below with exp_b10, which can never overflow because it
-  * comes, originally, from frexp and is therefore limited to a range which is
-  * typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)).
-  */
- #pragma GCC diagnostic warning "-Wstrict-overflow=2"
- #endif /* GCC_STRICT_OVERFLOW */
- void /* PRIVATE */
--png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
-+png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
-     double fp, unsigned int precision)
- {
-    /* We use standard functions from math.h, but not printf because
-     * that would require stdio.  The caller must supply a buffer of
-     * sufficient size or we will png_error.  The tests on size and
-     * the space in ascii[] consumed are indicated below.
-     */
-    if (precision < 1)
-@@ -3236,17 +3236,17 @@ png_ascii_from_fp(png_const_structrp png
- 
- #  endif /* FLOATING_POINT */
- 
- #  ifdef PNG_FIXED_POINT_SUPPORTED
- /* Function to format a fixed point value in ASCII.
-  */
- void /* PRIVATE */
- png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
--    png_size_t size, png_fixed_point fp)
-+    size_t size, png_fixed_point fp)
- {
-    /* Require space for 10 decimal digits, a decimal point, a minus sign and a
-     * trailing \0, 13 characters:
-     */
-    if (size > 12)
-    {
-       png_uint_32 num;
- 
-@@ -4343,17 +4343,17 @@ png_set_option(png_structrp png_ptr, int
- {
-    if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT &&
-       (option & 1) == 0)
-    {
-       png_uint_32 mask = 3U << option;
-       png_uint_32 setting = (2U + (onoff != 0)) << option;
-       png_uint_32 current = png_ptr->options;
- 
--      png_ptr->options = (png_uint_32)(((current & ~mask) | setting) & 0xff);
-+      png_ptr->options = (png_uint_32)((current & ~mask) | setting);
- 
-       return (int)(current & mask) >> option;
-    }
- 
-    return PNG_OPTION_INVALID;
- }
- #endif
- 
-diff --git a/media/libpng/png.h b/media/libpng/png.h
---- a/media/libpng/png.h
-+++ b/media/libpng/png.h
-@@ -1,23 +1,23 @@
- 
- /* png.h - header file for PNG reference library
-  *
-- * libpng version 1.6.34, September 29, 2017
-+ * libpng version 1.6.35, July 15, 2018
-  *
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license (See LICENSE, below)
-  *
-  * Authors and maintainers:
-  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
-  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
-- *   libpng versions 0.97, January 1998, through 1.6.34, September 29, 2017:
-+ *   libpng versions 0.97, January 1998, through 1.6.35, July 15, 2018:
-  *     Glenn Randers-Pehrson.
-  *   See also "Contributing Authors", below.
-  */
- 
- /*
-  * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
-  *
-  * If you modify libpng you may insert additional notices immediately following
-@@ -26,18 +26,18 @@
-  * This modified version of libpng code adds animated PNG support and is
-  * released under the libpng license described below. The modifications are
-  * Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2017 Max Stepin,
-  * and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives
-  * surrounding them in the modified libpng source files.
-  *
-  * This code is released under the libpng license.
-  *
-- * libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
-- * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
-+ * libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
-+ * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
-  * derived from libpng-1.0.6, and are distributed according to the same
-  * disclaimer and license as libpng-1.0.6 with the following individuals
-  * added to the list of Contributing Authors:
-  *
-  *    Simon-Pierre Cadieux
-  *    Eric S. Raymond
-  *    Mans Rullgard
-  *    Cosmin Truta
-@@ -214,17 +214,17 @@
-  *    1.0.7                    1    10007  (still compatible)
-  *    ...
-  *    1.0.19                  10    10019  10.so.0.19[.0]
-  *    ...
-  *    1.2.59                  13    10257  12.so.0.59[.0]
-  *    ...
-  *    1.5.30                  15    10527  15.so.15.30[.0]
-  *    ...
-- *    1.6.34                  16    10633  16.so.16.34[.0]
-+ *    1.6.35                  16    10635  16.so.16.35[.0]
-  *
-  *    Henceforth the source version will match the shared-library major
-  *    and minor numbers; the shared-library major version number will be
-  *    used for changes in backward compatibility, as it is intended.  The
-  *    PNG_LIBPNG_VER macro, which is not used within libpng but is available
-  *    for applications, is an unsigned integer of the form xyyzz corresponding
-  *    to the source version x.y.z (leading zeros in y and z).  Beta versions
-  *    were given the previous public release number plus a letter, until
-@@ -242,23 +242,23 @@
-  * is available as a W3C Recommendation and as an ISO Specification,
-  * <https://www.w3.org/TR/2003/REC-PNG-20031110/
-  */
- 
- /*
-  * Y2K compliance in libpng:
-  * =========================
-  *
-- *    September 29, 2017
-+ *    July 15, 2018
-  *
-  *    Since the PNG Development group is an ad-hoc body, we can't make
-  *    an official declaration.
-  *
-  *    This is your unofficial assurance that libpng from version 0.71 and
-- *    upward through 1.6.34 are Y2K compliant.  It is my belief that
-+ *    upward through 1.6.35 are Y2K compliant.  It is my belief that
-  *    earlier versions were also Y2K compliant.
-  *
-  *    Libpng only has two year fields.  One is a 2-byte unsigned integer
-  *    that will hold years up to 65535.  The other, which is deprecated,
-  *    holds the date in text format, and will hold years up to 9999.
-  *
-  *    The integer is
-  *        "png_uint_16 year" in png_time_struct.
-@@ -310,58 +310,58 @@
-  * file has been stripped from your copy of libpng, you can find it at
-  * <http://www.libpng.org/pub/png/libpng-manual.txt>
-  *
-  * If you just need to read a PNG file and don't want to read the documentation
-  * skip to the end of this file and read the section entitled 'simplified API'.
-  */
- 
- /* Version information for png.h - this should match the version in png.c */
--#define PNG_LIBPNG_VER_STRING "1.6.34+apng"
-+#define PNG_LIBPNG_VER_STRING "1.6.35+apng"
- #define PNG_HEADER_VERSION_STRING \
--     " libpng version 1.6.34+apng - September 29, 2017\n"
-+     " libpng version 1.6.35+apng - July 15, 2018\n"
- 
- #define PNG_LIBPNG_VER_SONUM   16
- #define PNG_LIBPNG_VER_DLLNUM  16
- 
- /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
- #define PNG_LIBPNG_VER_MAJOR   1
- #define PNG_LIBPNG_VER_MINOR   6
--#define PNG_LIBPNG_VER_RELEASE 34
-+#define PNG_LIBPNG_VER_RELEASE 35
- 
- /* This should match the numeric part of the final component of
-  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
-  */
- 
--#define PNG_LIBPNG_VER_BUILD  0
-+#define PNG_LIBPNG_VER_BUILD  02
- 
- /* Release Status */
- #define PNG_LIBPNG_BUILD_ALPHA    1
- #define PNG_LIBPNG_BUILD_BETA     2
- #define PNG_LIBPNG_BUILD_RC       3
- #define PNG_LIBPNG_BUILD_STABLE   4
- #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
- 
- /* Release-Specific Flags */
- #define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with
-                                        PNG_LIBPNG_BUILD_STABLE only */
- #define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with
-                                        PNG_LIBPNG_BUILD_SPECIAL */
- #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
-                                        PNG_LIBPNG_BUILD_PRIVATE */
- 
--#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
-+#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
- 
- /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
-  * We must not include leading zeros.
-  * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
-  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
-  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
-  */
--#define PNG_LIBPNG_VER 10634 /* 1.6.34 */
-+#define PNG_LIBPNG_VER 10635 /* 1.6.35 */
- 
- /* Library configuration: these options cannot be changed after
-  * the library has been built.
-  */
- #ifndef PNGLCONF_H
- /* If pnglibconf.h is missing, you can
-  * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
-  */
-@@ -476,17 +476,17 @@ extern "C" {
- /* blend_op flags from inside fcTL */
- #define PNG_BLEND_OP_SOURCE        0x00
- #define PNG_BLEND_OP_OVER          0x01
- #endif /* APNG */
- 
- /* This triggers a compiler error in png.c, if png.c and png.h
-  * do not agree upon the version number.
-  */
--typedef char* png_libpng_version_1_6_34;
-+typedef char* png_libpng_version_1_6_35;
- 
- /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
-  *
-  * png_struct is the cache of information used while reading or writing a single
-  * PNG file.  One of these is always required, although the simplified API
-  * (below) hides the creation and destruction of it.
-  */
- typedef struct png_struct_def png_struct;
-@@ -617,18 +617,18 @@ typedef struct png_text_struct
-    int  compression;       /* compression value:
-                              -1: tEXt, none
-                               0: zTXt, deflate
-                               1: iTXt, none
-                               2: iTXt, deflate  */
-    png_charp key;          /* keyword, 1-79 character description of "text" */
-    png_charp text;         /* comment, may be an empty string (ie "")
-                               or a NULL pointer */
--   png_size_t text_length; /* length of the text string */
--   png_size_t itxt_length; /* length of the itxt string */
-+   size_t text_length;     /* length of the text string */
-+   size_t itxt_length;     /* length of the itxt string */
-    png_charp lang;         /* language code, 0-79 characters
-                               or a NULL pointer */
-    png_charp lang_key;     /* keyword translated UTF-8 string, 0 or more
-                               chars or a NULL pointer */
- } png_text;
- typedef png_text * png_textp;
- typedef const png_text * png_const_textp;
- typedef png_text * * png_textpp;
-@@ -671,17 +671,17 @@ typedef png_time * * png_timepp;
-  * know about their semantics.
-  *
-  * The data in the structure is set by libpng on read and used on write.
-  */
- typedef struct png_unknown_chunk_t
- {
-    png_byte name[5]; /* Textual chunk name with '\0' terminator */
-    png_byte *data;   /* Data, should not be modified on read! */
--   png_size_t size;
-+   size_t size;
- 
-    /* On write 'location' must be set using the flag values listed below.
-     * Notice that on read it is set by libpng however the values stored have
-     * more bits set than are listed below.  Always treat the value as a
-     * bitmask.  On write set only one bit - setting multiple bits may cause the
-     * chunk to be written in multiple places.
-     */
-    png_byte location; /* mode of operation at read time */
-@@ -696,17 +696,17 @@ typedef png_unknown_chunk * * png_unknow
- /* Flag values for the unknown chunk location byte. */
- #define PNG_HAVE_IHDR  0x01
- #define PNG_HAVE_PLTE  0x02
- #define PNG_AFTER_IDAT 0x08
- 
- /* Maximum positive integer used in PNG is (2^31)-1 */
- #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
- #define PNG_UINT_32_MAX ((png_uint_32)(-1))
--#define PNG_SIZE_MAX ((png_size_t)(-1))
-+#define PNG_SIZE_MAX ((size_t)(-1))
- 
- /* These are constants for fixed point values encoded in the
-  * PNG specification manner (x100000)
-  */
- #define PNG_FP_1    100000
- #define PNG_FP_HALF  50000
- #define PNG_FP_MAX  ((png_fixed_point)0x7fffffffL)
- #define PNG_FP_MIN  (-PNG_FP_MAX)
-@@ -806,17 +806,17 @@ typedef png_unknown_chunk * * png_unknow
- 
- /* This is used for the transformation routines, as some of them
-  * change these values for the row.  It also should enable using
-  * the routines for other purposes.
-  */
- typedef struct png_row_info_struct
- {
-    png_uint_32 width;    /* width of row */
--   png_size_t rowbytes;  /* number of bytes in row */
-+   size_t rowbytes;      /* number of bytes in row */
-    png_byte color_type;  /* color type of row */
-    png_byte bit_depth;   /* bit depth of row */
-    png_byte channels;    /* number of channels (1, 2, 3, or 4) */
-    png_byte pixel_depth; /* bits per pixel (depth * channels) */
- } png_row_info;
- 
- typedef png_row_info * png_row_infop;
- typedef png_row_info * * png_row_infopp;
-@@ -825,17 +825,17 @@ typedef png_row_info * * png_row_infopp;
-  * that allow the user to override the default I/O functions with his or her
-  * own.  The png_error_ptr type should match that of user-supplied warning
-  * and error functions, while the png_rw_ptr type should match that of the
-  * user read/write data functions.  Note that the 'write' function must not
-  * modify the buffer it is passed. The 'read' function, on the other hand, is
-  * expected to return the read data in the buffer.
-  */
- typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp));
--typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t));
-+typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, size_t));
- typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp));
- typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32,
-     int));
- typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32,
-     int));
- 
- #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
- typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
-@@ -966,18 +966,18 @@ PNG_EXPORT(1, png_uint_32, png_access_ve
-  */
- PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes));
- 
- /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
-  * PNG file.  Returns zero if the supplied bytes match the 8-byte PNG
-  * signature, and non-zero otherwise.  Having num_to_check == 0 or
-  * start > 7 will always fail (ie return non-zero).
-  */
--PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, png_size_t start,
--    png_size_t num_to_check));
-+PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start,
-+    size_t num_to_check));
- 
- /* Simple signature checking function.  This is the same as calling
-  * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
-  */
- #define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n))
- 
- /* Allocate and initialize png_ptr struct for reading, and any other memory. */
- PNG_EXPORTA(4, png_structp, png_create_read_struct,
-@@ -986,21 +986,21 @@ PNG_EXPORTA(4, png_structp, png_create_r
-     PNG_ALLOCATED);
- 
- /* Allocate and initialize png_ptr struct for writing, and any other memory */
- PNG_EXPORTA(5, png_structp, png_create_write_struct,
-     (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
-     png_error_ptr warn_fn),
-     PNG_ALLOCATED);
- 
--PNG_EXPORT(6, png_size_t, png_get_compression_buffer_size,
-+PNG_EXPORT(6, size_t, png_get_compression_buffer_size,
-     (png_const_structrp png_ptr));
- 
- PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr,
--    png_size_t size));
-+    size_t size));
- 
- /* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp
-  * match up.
-  */
- #ifdef PNG_SETJMP_SUPPORTED
- /* This function returns the jmp_buf built in to *png_ptr.  It must be
-  * supplied with an appropriate 'longjmp' function to use on that jmp_buf
-  * unless the default error function is overridden in which case NULL is
-@@ -1043,39 +1043,39 @@ PNG_EXPORTA(12, png_structp, png_create_
-     PNG_ALLOCATED);
- #endif
- 
- /* Write the PNG file signature. */
- PNG_EXPORT(13, void, png_write_sig, (png_structrp png_ptr));
- 
- /* Write a PNG chunk - size, type, (optional) data, CRC. */
- PNG_EXPORT(14, void, png_write_chunk, (png_structrp png_ptr, png_const_bytep
--    chunk_name, png_const_bytep data, png_size_t length));
-+    chunk_name, png_const_bytep data, size_t length));
- 
- /* Write the start of a PNG chunk - length and chunk name. */
- PNG_EXPORT(15, void, png_write_chunk_start, (png_structrp png_ptr,
-     png_const_bytep chunk_name, png_uint_32 length));
- 
- /* Write the data of a PNG chunk started with png_write_chunk_start(). */
- PNG_EXPORT(16, void, png_write_chunk_data, (png_structrp png_ptr,
--    png_const_bytep data, png_size_t length));
-+    png_const_bytep data, size_t length));
- 
- /* Finish a chunk started with png_write_chunk_start() (includes CRC). */
- PNG_EXPORT(17, void, png_write_chunk_end, (png_structrp png_ptr));
- 
- /* Allocate and initialize the info structure */
- PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_const_structrp png_ptr),
-     PNG_ALLOCATED);
- 
- /* DEPRECATED: this function allowed init structures to be created using the
-  * default allocation method (typically malloc).  Use is deprecated in 1.6.0 and
-  * the API will be removed in the future.
-  */
- PNG_EXPORTA(19, void, png_info_init_3, (png_infopp info_ptr,
--    png_size_t png_info_struct_size), PNG_DEPRECATED);
-+    size_t png_info_struct_size), PNG_DEPRECATED);
- 
- /* Writes all the PNG information before the image. */
- PNG_EXPORT(20, void, png_write_info_before_PLTE,
-     (png_structrp png_ptr, png_const_inforp info_ptr));
- PNG_EXPORT(21, void, png_write_info,
-     (png_structrp png_ptr, png_const_inforp info_ptr));
- 
- #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
-@@ -1162,17 +1162,17 @@ PNG_EXPORT(35, void, png_build_grayscale
-  * datastream. The color samples in a PNG datastream are never premultiplied
-  * with the alpha samples.
-  *
-  * The default is to return data according to the PNG specification: the alpha
-  * channel is a linear measure of the contribution of the pixel to the
-  * corresponding composited pixel, and the color channels are unassociated
-  * (not premultiplied).  The gamma encoded color channels must be scaled
-  * according to the contribution and to do this it is necessary to undo
-- * the encoding, scale the color values, perform the composition and reencode
-+ * the encoding, scale the color values, perform the composition and re-encode
-  * the values.  This is the 'PNG' mode.
-  *
-  * The alternative is to 'associate' the alpha with the color information by
-  * storing color channel values that have been scaled by the alpha.
-  * image.  These are the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' modes
-  * (the latter being the two common names for associated alpha color channels).
-  *
-  * For the 'OPTIMIZED' mode, a pixel is treated as opaque only if the alpha
-@@ -1218,17 +1218,17 @@ PNG_FIXED_EXPORT(228, void, png_set_alph
-  * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
-  *    This is the default libpng handling of the alpha channel - it is not
-  *    pre-multiplied into the color components.  In addition the call states
-  *    that the output is for a sRGB system and causes all PNG files without gAMA
-  *    chunks to be assumed to be encoded using sRGB.
-  *
-  * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
-  *    In this case the output is assumed to be something like an sRGB conformant
-- *    display preceeded by a power-law lookup table of power 1.45.  This is how
-+ *    display preceded by a power-law lookup table of power 1.45.  This is how
-  *    early Mac systems behaved.
-  *
-  * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR);
-  *    This is the classic Jim Blinn approach and will work in academic
-  *    environments where everything is done by the book.  It has the shortcoming
-  *    of assuming that input PNG data with no gamma information is linear - this
-  *    is unlikely to be correct unless the PNG files where generated locally.
-  *    Most of the time the output precision will be so low as to show
-@@ -1265,17 +1265,17 @@ PNG_FIXED_EXPORT(228, void, png_set_alph
-  *    halos round the opaque parts of the image where the background is light.
-  *    In the OPTIMIZED mode the halos will be light halos where the background
-  *    is dark.  Take your pick - the halos are unavoidable unless you can get
-  *    your hardware/software fixed!  (The OPTIMIZED approach is slightly
-  *    faster.)
-  *
-  * When the default gamma of PNG files doesn't match the output gamma.
-  *    If you have PNG files with no gamma information png_set_alpha_mode allows
-- *    you to provide a default gamma, but it also sets the ouput gamma to the
-+ *    you to provide a default gamma, but it also sets the output gamma to the
-  *    matching value.  If you know your PNG files have a gamma that doesn't
-  *    match the output you can take advantage of the fact that
-  *    png_set_alpha_mode always sets the output gamma but only sets the PNG
-  *    default if it is not already set:
-  *
-  * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
-  * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
-  *    The first call sets both the default and the output gamma values, the
-@@ -1716,17 +1716,17 @@ PNG_EXPORT(218, png_byte, png_get_curren
-  *
-  * The integer return from the callback function is interpreted thus:
-  *
-  * negative: An error occurred; png_chunk_error will be called.
-  *     zero: The chunk was not handled, the chunk will be saved. A critical
-  *           chunk will cause an error at this point unless it is to be saved.
-  * positive: The chunk was handled, libpng will ignore/discard it.
-  *
-- * See "INTERACTION WTIH USER CHUNK CALLBACKS" below for important notes about
-+ * See "INTERACTION WITH USER CHUNK CALLBACKS" below for important notes about
-  * how this behavior will change in libpng 1.7
-  */
- PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structrp png_ptr,
-     png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
- #endif
- 
- #ifdef PNG_USER_CHUNKS_SUPPORTED
- PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structrp png_ptr));
-@@ -1741,26 +1741,26 @@ PNG_EXPORT(90, void, png_set_progressive
-     png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn));
- 
- /* Returns the user pointer associated with the push read functions */
- PNG_EXPORT(91, png_voidp, png_get_progressive_ptr,
-     (png_const_structrp png_ptr));
- 
- /* Function to be called when data becomes available */
- PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr,
--    png_inforp info_ptr, png_bytep buffer, png_size_t buffer_size));
-+    png_inforp info_ptr, png_bytep buffer, size_t buffer_size));
- 
- /* A function which may be called *only* within png_process_data to stop the
-  * processing of any more data.  The function returns the number of bytes
-  * remaining, excluding any that libpng has cached internally.  A subsequent
-  * call to png_process_data must supply these bytes again.  If the argument
-  * 'save' is set to true the routine will first save all the pending data and
-  * will always return 0.
-  */
--PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save));
-+PNG_EXPORT(219, size_t, png_process_data_pause, (png_structrp, int save));
- 
- /* A function which may be called *only* outside (after) a call to
-  * png_process_data.  It returns the number of bytes of data to skip in the
-  * input.  Normally it will return 0, but if it returns a non-zero value the
-  * application must skip than number of bytes of input data and pass the
-  * following data to the next call to png_process_data.
-  */
- PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
-@@ -1895,17 +1895,17 @@ PNG_EXPORT(109, void, png_set_benign_err
-  * to avoid problems with future changes in the size and internal layout of
-  * png_info_struct.
-  */
- /* Returns "flag" if chunk data is valid in info_ptr. */
- PNG_EXPORT(110, png_uint_32, png_get_valid, (png_const_structrp png_ptr,
-     png_const_inforp info_ptr, png_uint_32 flag));
- 
- /* Returns number of bytes needed to hold a transformed row. */
--PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structrp png_ptr,
-+PNG_EXPORT(111, size_t, png_get_rowbytes, (png_const_structrp png_ptr,
-     png_const_inforp info_ptr));
- 
- #ifdef PNG_INFO_IMAGE_SUPPORTED
- /* Returns row_pointers, which is an array of pointers to scanlines that was
-  * returned from png_read_png().
-  */
- PNG_EXPORT(112, png_bytepp, png_get_rows, (png_const_structrp png_ptr,
-     png_const_inforp info_ptr));
-@@ -2264,17 +2264,17 @@ PNG_EXPORT(171, void, png_set_sCAL_s, (p
-  *    PNG_HANDLE_CHUNK_ALWAYS:
-  *       Keep the chunk data.
-  *
-  * If the chunk data is saved it can be retrieved using png_get_unknown_chunks,
-  * below.  Notice that specifying "AS_DEFAULT" as a global default is equivalent
-  * to specifying "NEVER", however when "AS_DEFAULT" is used for specific chunks
-  * it simply resets the behavior to the libpng default.
-  *
-- * INTERACTION WTIH USER CHUNK CALLBACKS:
-+ * INTERACTION WITH USER CHUNK CALLBACKS:
-  * The per-chunk handling is always used when there is a png_user_chunk_ptr
-  * callback and the callback returns 0; the chunk is then always stored *unless*
-  * it is critical and the per-chunk setting is other than ALWAYS.  Notice that
-  * the global default is *not* used in this case.  (In effect the per-chunk
-  * value is incremented to at least IF_SAFE.)
-  *
-  * IMPORTANT NOTE: this behavior will change in libpng 1.7 - the global and
-  * per-chunk defaults will be honored.  If you want to preserve the current
-@@ -2683,17 +2683,17 @@ PNG_EXPORT(243, int, png_get_palette_max
-  *******************************************************************************
-  *
-  * Please read the documentation in libpng-manual.txt (TODO: write said
-  * documentation) if you don't understand what follows.
-  *
-  * The simplified API hides the details of both libpng and the PNG file format
-  * itself.  It allows PNG files to be read into a very limited number of
-  * in-memory bitmap formats or to be written from the same formats.  If these
-- * formats do not accomodate your needs then you can, and should, use the more
-+ * formats do not accommodate your needs then you can, and should, use the more
-  * sophisticated APIs above - these support a wide variety of in-memory formats
-  * and a wide variety of sophisticated transformations to those formats as well
-  * as a wide variety of APIs to manipulate ancillary information.
-  *
-  * To read a PNG file using the simplified API:
-  *
-  * 1) Declare a 'png_image' structure (see below) on the stack, set the
-  *    version field to PNG_IMAGE_VERSION and the 'opaque' pointer to NULL
-@@ -3045,17 +3045,17 @@ PNG_EXPORT(234, int, png_image_begin_rea
-     */
- 
- PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
-    FILE* file));
-    /* The PNG header is read from the stdio FILE object. */
- #endif /* STDIO */
- 
- PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
--   png_const_voidp memory, png_size_t size));
-+   png_const_voidp memory, size_t size));
-    /* The PNG header is read from the given memory buffer. */
- 
- PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image,
-    png_const_colorp background, void *buffer, png_int_32 row_stride,
-    void *colormap));
-    /* Finish reading the image into the supplied buffer and clean up the
-     * png_image structure.
-     *
-@@ -3158,17 +3158,17 @@ PNG_EXPORT(245, int, png_image_write_to_
-     * If 'memory' is not NULL it must point to memory[*memory_bytes] of
-     * writeable memory.
-     *
-     * If the function returns success memory[*memory_bytes] (if 'memory' is not
-     * NULL) contains the written PNG data.  *memory_bytes will always be less
-     * than or equal to the original value.
-     *
-     * If the function returns false and *memory_bytes was not changed an error
--    * occured during write.  If *memory_bytes was changed, or is not 0 if
-+    * occurred during write.  If *memory_bytes was changed, or is not 0 if
-     * 'memory' was NULL, the write would have succeeded but for the memory
-     * buffer being too small.  *memory_bytes contains the required number of
-     * bytes and will be bigger that the original value.
-     */
- 
- #define png_image_write_get_memory_size(image, size, convert_to_8_bit, buffer,\
-    row_stride, colormap)\
-    png_image_write_to_memory(&(image), 0, &(size), convert_to_8_bit, buffer,\
-@@ -3242,17 +3242,17 @@ PNG_EXPORT(245, int, png_image_write_to_
-  * Section 6: IMPLEMENTATION OPTIONS
-  *******************************************************************************
-  *
-  * Support for arbitrary implementation-specific optimizations.  The API allows
-  * particular options to be turned on or off.  'Option' is the number of the
-  * option and 'onoff' is 0 (off) or non-0 (on).  The value returned is given
-  * by the PNG_OPTION_ defines below.
-  *
-- * HARDWARE: normally hardware capabilites, such as the Intel SSE instructions,
-+ * HARDWARE: normally hardware capabilities, such as the Intel SSE instructions,
-  *           are detected at run time, however sometimes it may be impossible
-  *           to do this in user mode, in which case it is necessary to discover
-  *           the capabilities in an OS specific way.  Such capabilities are
-  *           listed here when libpng has support for them and must be turned
-  *           ON by the application if present.
-  *
-  * SOFTWARE: sometimes software optimizations actually result in performance
-  *           decrease on some architectures or systems, or with some sets of
-diff --git a/media/libpng/pngconf.h b/media/libpng/pngconf.h
---- a/media/libpng/pngconf.h
-+++ b/media/libpng/pngconf.h
-@@ -1,14 +1,14 @@
- 
- /* pngconf.h - machine configurable file for libpng
-  *
-- * libpng version 1.6.34, September 29, 2017
-+ * libpng version 1.6.35, July 15, 2018
-  *
-- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
-+ * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * Any machine specific code is near the front of this file, so if you
-@@ -122,17 +122,17 @@
-  *                the 'C' calling convention (from PNGCAPI) for
-  *                callbacks (PNGCBAPI).  This is no longer required
-  *                in any known environment - if it has to be used
-  *                please post an explanation of the problem to the
-  *                libpng mailing list.
-  *
-  * These cases only differ if the operating system does not use the C
-  * calling convention, at present this just means the above cases
-- * (x86 DOS/Windows sytems) and, even then, this does not apply to
-+ * (x86 DOS/Windows systems) and, even then, this does not apply to
-  * Cygwin running on those systems.
-  *
-  * Note that the value must be defined in pnglibconf.h so that what
-  * the application uses to call the library matches the conventions
-  * set when building the library.
-  */
- 
- /* Symbol export
-@@ -510,18 +510,20 @@
- #if UINT_MAX > 4294967294U
-    typedef unsigned int png_uint_32;
- #elif ULONG_MAX > 4294967294U
-    typedef unsigned long int png_uint_32;
- #else
- #  error "libpng requires an unsigned 32-bit (or more) type"
- #endif
- 
--/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
-- * requires an ISOC90 compiler and relies on consistent behavior of sizeof.
-+/* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t.
-+ * From 1.6.0 onwards, an ISO C90 compiler, as well as a standard-compliant
-+ * behavior of sizeof and ptrdiff_t are required.
-+ * The legacy typedefs are provided here for backwards compatibility.
-  */
- typedef size_t png_size_t;
- typedef ptrdiff_t png_ptrdiff_t;
- 
- /* libpng needs to know the maximum value of 'size_t' and this controls the
-  * definition of png_alloc_size_t, below.  This maximum value of size_t limits
-  * but does not control the maximum allocations the library makes - there is
-  * direct application control of this through png_set_user_limits().
-@@ -532,33 +534,32 @@ typedef ptrdiff_t png_ptrdiff_t;
-     * 'far' support; see above.)
-     */
- #  if (defined(__TURBOC__) && !defined(__FLAT__)) ||\
-    (defined(_MSC_VER) && defined(MAXSEG_64K))
- #     define PNG_SMALL_SIZE_T
- #  endif
- #endif
- 
--/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no
-- * smaller than png_uint_32.  Casts from png_size_t or png_uint_32 to
-- * png_alloc_size_t are not necessary; in fact, it is recommended not to use
-- * them at all so that the compiler can complain when something turns out to be
-- * problematic.
-+/* png_alloc_size_t is guaranteed to be no smaller than size_t, and no smaller
-+ * than png_uint_32.  Casts from size_t or png_uint_32 to png_alloc_size_t are
-+ * not necessary; in fact, it is recommended not to use them at all, so that
-+ * the compiler can complain when something turns out to be problematic.
-  *
-- * Casts in the other direction (from png_alloc_size_t to png_size_t or
-+ * Casts in the other direction (from png_alloc_size_t to size_t or
-  * png_uint_32) should be explicitly applied; however, we do not expect to
-  * encounter practical situations that require such conversions.
-  *
-  * PNG_SMALL_SIZE_T must be defined if the maximum value of size_t is less than
-  * 4294967295 - i.e. less than the maximum value of png_uint_32.
-  */
- #ifdef PNG_SMALL_SIZE_T
-    typedef png_uint_32 png_alloc_size_t;
- #else
--   typedef png_size_t png_alloc_size_t;
-+   typedef size_t png_alloc_size_t;
- #endif
- 
- /* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
-  * implementations of Intel CPU specific support of user-mode segmented address
-  * spaces, where 16-bit pointers address more than 65536 bytes of memory using
-  * separate 'segment' registers.  The implementation requires two different
-  * types of pointer (only one of which includes the segment value.)
-  *
-@@ -584,18 +585,18 @@ typedef const png_int_32      * png_cons
- typedef png_uint_16           * png_uint_16p;
- typedef const png_uint_16     * png_const_uint_16p;
- typedef png_int_16            * png_int_16p;
- typedef const png_int_16      * png_const_int_16p;
- typedef char                  * png_charp;
- typedef const char            * png_const_charp;
- typedef png_fixed_point       * png_fixed_point_p;
- typedef const png_fixed_point * png_const_fixed_point_p;
--typedef png_size_t            * png_size_tp;
--typedef const png_size_t      * png_const_size_tp;
-+typedef size_t                * png_size_tp;
-+typedef const size_t          * png_const_size_tp;
- 
- #ifdef PNG_STDIO_SUPPORTED
- typedef FILE            * png_FILE_p;
- #endif
- 
- #ifdef PNG_FLOATING_POINT_SUPPORTED
- typedef double       * png_doublep;
- typedef const double * png_const_doublep;
-diff --git a/media/libpng/pngget.c b/media/libpng/pngget.c
---- a/media/libpng/pngget.c
-+++ b/media/libpng/pngget.c
-@@ -1,13 +1,13 @@
- 
- /* pngget.c - retrieval of values from info struct
-  *
-- * Last changed in libpng 1.6.32 [August 24, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  */
-@@ -21,17 +21,17 @@ png_get_valid(png_const_structrp png_ptr
-     png_uint_32 flag)
- {
-    if (png_ptr != NULL && info_ptr != NULL)
-       return(info_ptr->valid & flag);
- 
-    return(0);
- }
- 
--png_size_t PNGAPI
-+size_t PNGAPI
- png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
- {
-    if (png_ptr != NULL && info_ptr != NULL)
-       return(info_ptr->rowbytes);
- 
-    return(0);
- }
- 
-@@ -362,17 +362,17 @@ png_get_y_pixels_per_inch(png_const_stru
- {
-    return ppi_from_ppm(png_get_y_pixels_per_meter(png_ptr, info_ptr));
- }
- 
- #ifdef PNG_FIXED_POINT_SUPPORTED
- static png_fixed_point
- png_fixed_inches_from_microns(png_const_structrp png_ptr, png_int_32 microns)
- {
--   /* Convert from metres * 1,000,000 to inches * 100,000, meters to
-+   /* Convert from meters * 1,000,000 to inches * 100,000, meters to
-     * inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
-     * Notice that this can overflow - a warning is output and 0 is
-     * returned.
-     */
-    return png_muldiv_warn(png_ptr, microns, 500, 127);
- }
- 
- png_fixed_point PNGAPI
-@@ -736,30 +736,31 @@ png_uint_32 PNGAPI
- png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
-     png_charpp name, int *compression_type,
-     png_bytepp profile, png_uint_32 *proflen)
- {
-    png_debug1(1, "in %s retrieval function", "iCCP");
- 
-    if (png_ptr != NULL && info_ptr != NULL &&
-        (info_ptr->valid & PNG_INFO_iCCP) != 0 &&
--       name != NULL && compression_type != NULL && profile != NULL &&
--           proflen != NULL)
-+       name != NULL && profile != NULL && proflen != NULL)
-    {
-       *name = info_ptr->iccp_name;
-       *profile = info_ptr->iccp_profile;
-       *proflen = png_get_uint_32(info_ptr->iccp_profile);
-       /* This is somewhat irrelevant since the profile data returned has
-        * actually been uncompressed.
-        */
--      *compression_type = PNG_COMPRESSION_TYPE_BASE;
-+      if (compression_type != NULL)
-+         *compression_type = PNG_COMPRESSION_TYPE_BASE;
-       return (PNG_INFO_iCCP);
-    }
- 
-    return (0);
-+
- }
- #endif
- 
- #ifdef PNG_sPLT_SUPPORTED
- int PNGAPI
- png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
-     png_sPLT_tpp spalettes)
- {
-@@ -1159,17 +1160,17 @@ png_get_rgb_to_gray_status (png_const_st
- #ifdef PNG_USER_CHUNKS_SUPPORTED
- png_voidp PNGAPI
- png_get_user_chunk_ptr(png_const_structrp png_ptr)
- {
-    return (png_ptr ? png_ptr->user_chunk_ptr : NULL);
- }
- #endif
- 
--png_size_t PNGAPI
-+size_t PNGAPI
- png_get_compression_buffer_size(png_const_structrp png_ptr)
- {
-    if (png_ptr == NULL)
-       return 0;
- 
- #ifdef PNG_WRITE_SUPPORTED
-    if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
- #endif
-diff --git a/media/libpng/pnginfo.h b/media/libpng/pnginfo.h
---- a/media/libpng/pnginfo.h
-+++ b/media/libpng/pnginfo.h
-@@ -1,13 +1,13 @@
- 
- /* pnginfo.h - header file for PNG reference library
-  *
-- * Last changed in libpng 1.6.1 [March 28, 2013]
-- * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
-@@ -50,20 +50,20 @@
-  * functions do not make their own copies.
-  */
- #ifndef PNGINFO_H
- #define PNGINFO_H
- 
- struct png_info_def
- {
-    /* The following are necessary for every PNG file */
--   png_uint_32 width;  /* width of image in pixels (from IHDR) */
--   png_uint_32 height; /* height of image in pixels (from IHDR) */
--   png_uint_32 valid;  /* valid chunk data (see PNG_INFO_ below) */
--   png_size_t rowbytes; /* bytes needed to hold an untransformed row */
-+   png_uint_32 width;       /* width of image in pixels (from IHDR) */
-+   png_uint_32 height;      /* height of image in pixels (from IHDR) */
-+   png_uint_32 valid;       /* valid chunk data (see PNG_INFO_ below) */
-+   size_t rowbytes;         /* bytes needed to hold an untransformed row */
-    png_colorp palette;      /* array of color values (valid & PNG_INFO_PLTE) */
-    png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
-    png_uint_16 num_trans;   /* number of transparent palette color (tRNS) */
-    png_byte bit_depth;      /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
-    png_byte color_type;     /* see PNG_COLOR_TYPE_ below (from IHDR) */
-    /* The following three should have been named *_method not *_type */
-    png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
-    png_byte filter_type;    /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
-@@ -242,17 +242,17 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
-    png_sPLT_tp splt_palettes;
-    int         splt_palettes_num; /* Match type returned by png_get API */
- #endif
- 
- #ifdef PNG_sCAL_SUPPORTED
-    /* The sCAL chunk describes the actual physical dimensions of the
-     * subject matter of the graphic.  The chunk contains a unit specification
-     * a byte value, and two ASCII strings representing floating-point
--    * values.  The values are width and height corresponsing to one pixel
-+    * values.  The values are width and height corresponding to one pixel
-     * in the image.  Data values are valid if (valid & PNG_INFO_sCAL) is
-     * non-zero.
-     */
-    png_byte scal_unit;         /* unit of physical scale */
-    png_charp scal_s_width;     /* string containing height */
-    png_charp scal_s_height;    /* string containing width */
- #endif
- 
-diff --git a/media/libpng/pngpread.c b/media/libpng/pngpread.c
---- a/media/libpng/pngpread.c
-+++ b/media/libpng/pngpread.c
-@@ -1,13 +1,13 @@
- 
- /* pngpread.c - read a png file in push mode
-  *
-- * Last changed in libpng 1.6.32 [August 24, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
-@@ -29,43 +29,43 @@
- if (png_ptr->push_length + 4 > png_ptr->buffer_size) \
-    { png_push_save_buffer(png_ptr); return; }
- #define PNG_PUSH_SAVE_BUFFER_IF_LT(N) \
- if (png_ptr->buffer_size < N) \
-    { png_push_save_buffer(png_ptr); return; }
- 
- void PNGAPI
- png_process_data(png_structrp png_ptr, png_inforp info_ptr,
--    png_bytep buffer, png_size_t buffer_size)
-+    png_bytep buffer, size_t buffer_size)
- {
-    if (png_ptr == NULL || info_ptr == NULL)
-       return;
- 
-    png_push_restore_buffer(png_ptr, buffer, buffer_size);
- 
-    while (png_ptr->buffer_size)
-    {
-       png_process_some_data(png_ptr, info_ptr);
-    }
- }
- 
--png_size_t PNGAPI
-+size_t PNGAPI
- png_process_data_pause(png_structrp png_ptr, int save)
- {
-    if (png_ptr != NULL)
-    {
-       /* It's easiest for the caller if we do the save; then the caller doesn't
-        * have to supply the same data again:
-        */
-       if (save != 0)
-          png_push_save_buffer(png_ptr);
-       else
-       {
-          /* This includes any pending saved bytes: */
--         png_size_t remaining = png_ptr->buffer_size;
-+         size_t remaining = png_ptr->buffer_size;
-          png_ptr->buffer_size = 0;
- 
-          /* So subtract the saved buffer size, unless all the data
-           * is actually 'saved', in which case we just return 0
-           */
-          if (png_ptr->save_buffer_size < remaining)
-             return remaining - png_ptr->save_buffer_size;
-       }
-@@ -128,18 +128,18 @@ png_process_some_data(png_structrp png_p
-  * the correct PNG signature.  It is possible that this routine is called
-  * with bytes already read from the signature, either because they have been
-  * checked by the calling application, or because of multiple calls to this
-  * routine.
-  */
- void /* PRIVATE */
- png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
- {
--   png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
--       num_to_check = 8 - num_checked;
-+   size_t num_checked = png_ptr->sig_bytes; /* SAFE, does not exceed 8 */
-+   size_t num_to_check = 8 - num_checked;
- 
-    if (png_ptr->buffer_size < num_to_check)
-    {
-       num_to_check = png_ptr->buffer_size;
-    }
- 
-    png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]),
-        num_to_check);
-@@ -513,44 +513,44 @@ png_push_read_chunk(png_structrp png_ptr
-       png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length,
-           PNG_HANDLE_CHUNK_AS_DEFAULT);
-    }
- 
-    png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
- }
- 
- void PNGCBAPI
--png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
-+png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, size_t length)
- {
-    png_bytep ptr;
- 
-    if (png_ptr == NULL)
-       return;
- 
-    ptr = buffer;
-    if (png_ptr->save_buffer_size != 0)
-    {
--      png_size_t save_size;
-+      size_t save_size;
- 
-       if (length < png_ptr->save_buffer_size)
-          save_size = length;
- 
-       else
-          save_size = png_ptr->save_buffer_size;
- 
-       memcpy(ptr, png_ptr->save_buffer_ptr, save_size);
-       length -= save_size;
-       ptr += save_size;
-       png_ptr->buffer_size -= save_size;
-       png_ptr->save_buffer_size -= save_size;
-       png_ptr->save_buffer_ptr += save_size;
-    }
-    if (length != 0 && png_ptr->current_buffer_size != 0)
-    {
--      png_size_t save_size;
-+      size_t save_size;
- 
-       if (length < png_ptr->current_buffer_size)
-          save_size = length;
- 
-       else
-          save_size = png_ptr->current_buffer_size;
- 
-       memcpy(ptr, png_ptr->current_buffer_ptr, save_size);
-@@ -562,44 +562,44 @@ png_push_fill_buffer(png_structp png_ptr
- 
- void /* PRIVATE */
- png_push_save_buffer(png_structrp png_ptr)
- {
-    if (png_ptr->save_buffer_size != 0)
-    {
-       if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
-       {
--         png_size_t i, istop;
-+         size_t i, istop;
-          png_bytep sp;
-          png_bytep dp;
- 
-          istop = png_ptr->save_buffer_size;
-          for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
-              i < istop; i++, sp++, dp++)
-          {
-             *dp = *sp;
-          }
-       }
-    }
-    if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
-        png_ptr->save_buffer_max)
-    {
--      png_size_t new_max;
-+      size_t new_max;
-       png_bytep old_buffer;
- 
-       if (png_ptr->save_buffer_size > PNG_SIZE_MAX -
-           (png_ptr->current_buffer_size + 256))
-       {
-          png_error(png_ptr, "Potential overflow of save_buffer");
-       }
- 
-       new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
-       old_buffer = png_ptr->save_buffer;
-       png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr,
--          (png_size_t)new_max);
-+          (size_t)new_max);
- 
-       if (png_ptr->save_buffer == NULL)
-       {
-          png_free(png_ptr, old_buffer);
-          png_error(png_ptr, "Insufficient memory for save_buffer");
-       }
- 
-       if (old_buffer)
-@@ -617,17 +617,17 @@ png_push_save_buffer(png_structrp png_pt
-       png_ptr->current_buffer_size = 0;
-    }
-    png_ptr->save_buffer_ptr = png_ptr->save_buffer;
-    png_ptr->buffer_size = 0;
- }
- 
- void /* PRIVATE */
- png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer,
--    png_size_t buffer_length)
-+    size_t buffer_length)
- {
-    png_ptr->current_buffer = buffer;
-    png_ptr->current_buffer_size = buffer_length;
-    png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size;
-    png_ptr->current_buffer_ptr = png_ptr->current_buffer;
- }
- 
- void /* PRIVATE */
-@@ -704,53 +704,53 @@ png_push_read_IDAT(png_structrp png_ptr)
-          png_ensure_sequence_number(png_ptr, 4);
-          png_ptr->idat_size -= 4;
-       }
- #endif
-    }
- 
-    if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
-    {
--      png_size_t save_size = png_ptr->save_buffer_size;
-+      size_t save_size = png_ptr->save_buffer_size;
-       png_uint_32 idat_size = png_ptr->idat_size;
- 
-       /* We want the smaller of 'idat_size' and 'current_buffer_size', but they
-        * are of different types and we don't know which variable has the fewest
-        * bits.  Carefully select the smaller and cast it to the type of the
-        * larger - this cannot overflow.  Do not cast in the following test - it
-        * will break on either 16-bit or 64-bit platforms.
-        */
-       if (idat_size < save_size)
--         save_size = (png_size_t)idat_size;
-+         save_size = (size_t)idat_size;
- 
-       else
-          idat_size = (png_uint_32)save_size;
- 
-       png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
- 
-       png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size);
- 
-       png_ptr->idat_size -= idat_size;
-       png_ptr->buffer_size -= save_size;
-       png_ptr->save_buffer_size -= save_size;
-       png_ptr->save_buffer_ptr += save_size;
-    }
- 
-    if (png_ptr->idat_size != 0 && png_ptr->current_buffer_size != 0)
-    {
--      png_size_t save_size = png_ptr->current_buffer_size;
-+      size_t save_size = png_ptr->current_buffer_size;
-       png_uint_32 idat_size = png_ptr->idat_size;
- 
-       /* We want the smaller of 'idat_size' and 'current_buffer_size', but they
-        * are of different types and we don't know which variable has the fewest
-        * bits.  Carefully select the smaller and cast it to the type of the
-        * larger - this cannot overflow.
-        */
-       if (idat_size < save_size)
--         save_size = (png_size_t)idat_size;
-+         save_size = (size_t)idat_size;
- 
-       else
-          idat_size = (png_uint_32)save_size;
- 
-       png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
- 
-       png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size);
- 
-@@ -767,17 +767,17 @@ png_push_read_IDAT(png_structrp png_ptr)
-       png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
-       png_ptr->mode |= PNG_AFTER_IDAT;
-       png_ptr->zowner = 0;
-    }
- }
- 
- void /* PRIVATE */
- png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
--    png_size_t buffer_length)
-+    size_t buffer_length)
- {
-    /* The caller checks for a non-zero buffer length. */
-    if (!(buffer_length > 0) || buffer == NULL)
-       png_error(png_ptr, "No IDAT data (internal error)");
- 
- #ifdef PNG_READ_APNG_SUPPORTED
-    /* If the app is not APNG-aware, decode only the first frame */
-    if ((png_ptr->apng_flags & PNG_APNG_APP) == 0 &&
-diff --git a/media/libpng/pngpriv.h b/media/libpng/pngpriv.h
---- a/media/libpng/pngpriv.h
-+++ b/media/libpng/pngpriv.h
-@@ -1,13 +1,13 @@
- 
- /* pngpriv.h - private declarations for use inside libpng
-  *
-- * Last changed in libpng 1.6.32 [August 24, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
-@@ -205,17 +205,21 @@
-       /* Only check for SSE if the build configuration has been modified to
-        * enable SSE optimizations.  This means that these optimizations will
-        * be off by default.  See contrib/intel for more details.
-        */
- #     if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
-        defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
-        (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
- #         define PNG_INTEL_SSE_OPT 1
-+#      else
-+#         define PNG_INTEL_SSE_OPT 0
- #      endif
-+#   else
-+#      define PNG_INTEL_SSE_OPT 0
- #   endif
- #endif
- 
- #if PNG_INTEL_SSE_OPT > 0
- #   ifndef PNG_INTEL_SSE_IMPLEMENTATION
- #      if defined(__SSE4_1__) || defined(__AVX__)
-           /* We are not actually using AVX, but checking for AVX is the best
-              way we can detect SSE4.1 and SSSE3 on MSVC.
-@@ -229,16 +233,18 @@
- #      else
- #         define PNG_INTEL_SSE_IMPLEMENTATION 0
- #      endif
- #   endif
- 
- #   if PNG_INTEL_SSE_IMPLEMENTATION > 0
- #      define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
- #   endif
-+#else
-+#   define PNG_INTEL_SSE_IMPLEMENTATION 0
- #endif
- 
- #if PNG_MIPS_MSA_OPT > 0
- #  define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
- #  ifndef PNG_MIPS_MSA_IMPLEMENTATION
- #     if defined(__mips_msa)
- #        if defined(__clang__)
- #        elif defined(__GNUC__)
-@@ -727,18 +733,18 @@
-  * only gives off-by-one errors and only for 0.5% (1 in 200) of the values.
-  */
- #define PNG_DIV65535(v24) (((v24) + 32895) >> 16)
- #define PNG_DIV257(v16) PNG_DIV65535((png_uint_32)(v16) * 255)
- 
- /* Added to libpng-1.2.6 JB */
- #define PNG_ROWBYTES(pixel_bits, width) \
-     ((pixel_bits) >= 8 ? \
--    ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
--    (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
-+    ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
-+    (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
- 
- /* This returns the number of trailing bits in the last byte of a row, 0 if the
-  * last byte is completely full of pixels.  It is, in principle, (pixel_bits x
-  * width) % 8, but that would overflow for large 'width'.  The second macro is
-  * the same except that it returns the number of unused bits in the last byte;
-  * (8-TRAILBITS), but 0 when TRAILBITS is 0.
-  *
-  * NOTE: these macros are intended to be self-evidently correct and never
-@@ -926,17 +932,17 @@
-       "-I (include path) error: see the notes in pngpriv.h"
-    /* This means that when pnglibconf.h was built the copy of zlib.h that it
-     * used is not the same as the one being used here.  Because the build of
-     * libpng makes decisions to use inflateInit2 and inflateReset2 based on the
-     * zlib version number and because this affects handling of certain broken
-     * PNG files the -I directives must match.
-     *
-     * The most likely explanation is that you passed a -I in CFLAGS. This will
--    * not work; all the preprocessor directories and in particular all the -I
-+    * not work; all the preprocessor directives and in particular all the -I
-     * directives must be in CPPFLAGS.
-     */
- #endif
- 
- /* This is used for 16-bit gamma tables -- only the top level pointers are
-  * const; this could be changed:
-  */
- typedef const png_uint_16p * png_const_uint_16pp;
-@@ -1055,51 +1061,51 @@ PNG_INTERNAL_FUNCTION(voidpf,png_zalloc,
- PNG_INTERNAL_FUNCTION(void,png_zfree,(voidpf png_ptr, voidpf ptr),PNG_EMPTY);
- 
- /* Next four functions are used internally as callbacks.  PNGCBAPI is required
-  * but not PNG_EXPORT.  PNGAPI added at libpng version 1.2.3, changed to
-  * PNGCBAPI at 1.5.0
-  */
- 
- PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_read_data,(png_structp png_ptr,
--    png_bytep data, png_size_t length),PNG_EMPTY);
-+    png_bytep data, size_t length),PNG_EMPTY);
- 
- #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
- PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_push_fill_buffer,(png_structp png_ptr,
--    png_bytep buffer, png_size_t length),PNG_EMPTY);
-+    png_bytep buffer, size_t length),PNG_EMPTY);
- #endif
- 
- PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_write_data,(png_structp png_ptr,
--    png_bytep data, png_size_t length),PNG_EMPTY);
-+    png_bytep data, size_t length),PNG_EMPTY);
- 
- #ifdef PNG_WRITE_FLUSH_SUPPORTED
- #  ifdef PNG_STDIO_SUPPORTED
- PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_flush,(png_structp png_ptr),
-    PNG_EMPTY);
- #  endif
- #endif
- 
- /* Reset the CRC variable */
- PNG_INTERNAL_FUNCTION(void,png_reset_crc,(png_structrp png_ptr),PNG_EMPTY);
- 
- /* Write the "data" buffer to whatever output you are using */
- PNG_INTERNAL_FUNCTION(void,png_write_data,(png_structrp png_ptr,
--    png_const_bytep data, png_size_t length),PNG_EMPTY);
-+    png_const_bytep data, size_t length),PNG_EMPTY);
- 
- /* Read and check the PNG file signature */
- PNG_INTERNAL_FUNCTION(void,png_read_sig,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
- 
- /* Read the chunk header (length + type name) */
- PNG_INTERNAL_FUNCTION(png_uint_32,png_read_chunk_header,(png_structrp png_ptr),
-    PNG_EMPTY);
- 
- /* Read data from whatever input you are using into the "data" buffer */
- PNG_INTERNAL_FUNCTION(void,png_read_data,(png_structrp png_ptr, png_bytep data,
--    png_size_t length),PNG_EMPTY);
-+    size_t length),PNG_EMPTY);
- 
- /* Read bytes into buf, and update png_ptr->crc */
- PNG_INTERNAL_FUNCTION(void,png_crc_read,(png_structrp png_ptr, png_bytep buf,
-     png_uint_32 length),PNG_EMPTY);
- 
- /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
- PNG_INTERNAL_FUNCTION(int,png_crc_finish,(png_structrp png_ptr,
-    png_uint_32 skip),PNG_EMPTY);
-@@ -1107,17 +1113,17 @@ PNG_INTERNAL_FUNCTION(int,png_crc_finish
- /* Read the CRC from the file and compare it to the libpng calculated CRC */
- PNG_INTERNAL_FUNCTION(int,png_crc_error,(png_structrp png_ptr),PNG_EMPTY);
- 
- /* Calculate the CRC over a section of data.  Note that we are only
-  * passing a maximum of 64K on systems that have this as a memory limit,
-  * since this is the maximum buffer size we can specify.
-  */
- PNG_INTERNAL_FUNCTION(void,png_calculate_crc,(png_structrp png_ptr,
--   png_const_bytep ptr, png_size_t length),PNG_EMPTY);
-+   png_const_bytep ptr, size_t length),PNG_EMPTY);
- 
- #ifdef PNG_WRITE_FLUSH_SUPPORTED
- PNG_INTERNAL_FUNCTION(void,png_flush,(png_structrp png_ptr),PNG_EMPTY);
- #endif
- 
- /* Write various chunks */
- 
- /* Write the IHDR chunk, and update the png_struct with the necessary
-@@ -1190,17 +1196,17 @@ PNG_INTERNAL_FUNCTION(void,png_write_bKG
- #ifdef PNG_WRITE_hIST_SUPPORTED
- PNG_INTERNAL_FUNCTION(void,png_write_hIST,(png_structrp png_ptr,
-     png_const_uint_16p hist, int num_hist),PNG_EMPTY);
- #endif
- 
- /* Chunks that have keywords */
- #ifdef PNG_WRITE_tEXt_SUPPORTED
- PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr,
--   png_const_charp key, png_const_charp text, png_size_t text_len),PNG_EMPTY);
-+   png_const_charp key, png_const_charp text, size_t text_len),PNG_EMPTY);
- #endif
- 
- #ifdef PNG_WRITE_zTXt_SUPPORTED
- PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp
-     key, png_const_charp text, int compression),PNG_EMPTY);
- #endif
- 
- #ifdef PNG_WRITE_iTXt_SUPPORTED
-@@ -1583,20 +1589,20 @@ PNG_INTERNAL_FUNCTION(void,png_init_read
- PNG_INTERNAL_FUNCTION(void,png_push_read_chunk,(png_structrp png_ptr,
-     png_inforp info_ptr),PNG_EMPTY);
- PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr,
-     png_inforp info_ptr),PNG_EMPTY);
- PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
- PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr),
-     PNG_EMPTY);
- PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr,
--    png_bytep buffer, png_size_t buffer_length),PNG_EMPTY);
-+    png_bytep buffer, size_t buffer_length),PNG_EMPTY);
- PNG_INTERNAL_FUNCTION(void,png_push_read_IDAT,(png_structrp png_ptr),PNG_EMPTY);
- PNG_INTERNAL_FUNCTION(void,png_process_IDAT_data,(png_structrp png_ptr,
--    png_bytep buffer, png_size_t buffer_length),PNG_EMPTY);
-+    png_bytep buffer, size_t buffer_length),PNG_EMPTY);
- PNG_INTERNAL_FUNCTION(void,png_push_process_row,(png_structrp png_ptr),
-     PNG_EMPTY);
- PNG_INTERNAL_FUNCTION(void,png_push_handle_unknown,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
- PNG_INTERNAL_FUNCTION(void,png_push_have_info,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
- PNG_INTERNAL_FUNCTION(void,png_push_have_end,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
-@@ -1899,23 +1905,23 @@ PNG_INTERNAL_FUNCTION(void,png_chunk_rep
-  * width or height, derived from the precision (number of significant
-  * digits - a build time settable option) and assumptions about the
-  * maximum ridiculous exponent.
-  */
- #define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/)
- 
- #ifdef PNG_FLOATING_POINT_SUPPORTED
- PNG_INTERNAL_FUNCTION(void,png_ascii_from_fp,(png_const_structrp png_ptr,
--   png_charp ascii, png_size_t size, double fp, unsigned int precision),
-+   png_charp ascii, size_t size, double fp, unsigned int precision),
-    PNG_EMPTY);
- #endif /* FLOATING_POINT */
- 
- #ifdef PNG_FIXED_POINT_SUPPORTED
- PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
--   png_charp ascii, png_size_t size, png_fixed_point fp),PNG_EMPTY);
-+   png_charp ascii, size_t size, png_fixed_point fp),PNG_EMPTY);
- #endif /* FIXED_POINT */
- #endif /* sCAL */
- 
- #if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
- /* An internal API to validate the format of a floating point number.
-  * The result is the index of the next character.  If the number is
-  * not valid it will be the index of a character in the supposed number.
-  *
-@@ -1998,26 +2004,26 @@ PNG_INTERNAL_FUNCTION(void,png_ascii_fro
-  * a 'maybe' state even though a preceding integer.fraction is valid.
-  * The PNG_FP_WAS_VALID flag indicates that a preceding substring was
-  * a valid number.  It's possible to recover from this by calling
-  * the parser again (from the start, with state 0) but with a string
-  * that omits the last character (i.e. set the size to the index of
-  * the problem character.)  This has not been tested within libpng.
-  */
- PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
--   png_size_t size, int *statep, png_size_tp whereami),PNG_EMPTY);
-+   size_t size, int *statep, png_size_tp whereami),PNG_EMPTY);
- 
- /* This is the same but it checks a complete string and returns true
-  * only if it just contains a floating point number.  As of 1.5.4 this
-  * function also returns the state at the end of parsing the number if
-  * it was valid (otherwise it returns 0.)  This can be used for testing
-  * for negative or zero values using the sticky flag.
-  */
- PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
--   png_size_t size),PNG_EMPTY);
-+   size_t size),PNG_EMPTY);
- #endif /* pCAL || sCAL */
- 
- #if defined(PNG_GAMMA_SUPPORTED) ||\
-     defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
- /* Added at libpng version 1.5.0 */
- /* This is a utility to provide a*times/div (rounded) and indicate
-  * if there is an overflow.  The result is a boolean - false (0)
-  * for overflow, true (1) if no overflow, in which case *res
-@@ -2082,17 +2088,17 @@ PNG_INTERNAL_FUNCTION(void,png_build_gam
- /* The internal structure that png_image::opaque points to. */
- typedef struct png_control
- {
-    png_structp png_ptr;
-    png_infop   info_ptr;
-    png_voidp   error_buf;           /* Always a jmp_buf at present. */
- 
-    png_const_bytep memory;          /* Memory buffer. */
--   png_size_t      size;            /* Size of the memory buffer. */
-+   size_t          size;            /* Size of the memory buffer. */
- 
-    unsigned int for_write       :1; /* Otherwise it is a read structure */
-    unsigned int owned_file      :1; /* We own the file in io_ptr */
- } png_control;
- 
- /* Return the pointer to the jmp_buf from a png_control: necessary because C
-  * does not reveal the type of the elements of jmp_buf.
-  */
-diff --git a/media/libpng/pngread.c b/media/libpng/pngread.c
---- a/media/libpng/pngread.c
-+++ b/media/libpng/pngread.c
-@@ -1,13 +1,13 @@
- 
- /* pngread.c - read a PNG file
-  *
-- * Last changed in libpng 1.6.33 [September 28, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file contains routines that an application calls directly to
-@@ -1607,28 +1607,28 @@ png_image_begin_read_from_file(png_image
-       return png_image_error(image,
-           "png_image_begin_read_from_file: incorrect PNG_IMAGE_VERSION");
- 
-    return 0;
- }
- #endif /* STDIO */
- 
- static void PNGCBAPI
--png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
-+png_image_memory_read(png_structp png_ptr, png_bytep out, size_t need)
- {
-    if (png_ptr != NULL)
-    {
-       png_imagep image = png_voidcast(png_imagep, png_ptr->io_ptr);
-       if (image != NULL)
-       {
-          png_controlp cp = image->opaque;
-          if (cp != NULL)
-          {
-             png_const_bytep memory = cp->memory;
--            png_size_t size = cp->size;
-+            size_t size = cp->size;
- 
-             if (memory != NULL && size >= need)
-             {
-                memcpy(out, memory, need);
-                cp->memory = memory + need;
-                cp->size = size - need;
-                return;
-             }
-@@ -1637,17 +1637,17 @@ png_image_memory_read(png_structp png_pt
-          }
-       }
- 
-       png_error(png_ptr, "invalid memory read");
-    }
- }
- 
- int PNGAPI png_image_begin_read_from_memory(png_imagep image,
--    png_const_voidp memory, png_size_t size)
-+    png_const_voidp memory, size_t size)
- {
-    if (image != NULL && image->version == PNG_IMAGE_VERSION)
-    {
-       if (memory != NULL && size > 0)
-       {
-          if (png_image_read_init(image) != 0)
-          {
-             /* Now set the IO functions to read from the memory buffer and
-@@ -4225,17 +4225,17 @@ png_image_finish_read(png_imagep image, 
-              *    (PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)*height*(row_stride))
-              *
-              * And the component size is always 1 or 2, so make sure that the
-              * number of *bytes* that the application is saying are available
-              * does actually fit into a 32-bit number.
-              *
-              * NOTE: this will be changed in 1.7 because PNG_IMAGE_BUFFER_SIZE
-              * will be changed to use png_alloc_size_t; bigger images can be
--             * accomodated on 64-bit systems.
-+             * accommodated on 64-bit systems.
-              */
-             if (image->height <=
-                 0xffffffffU/PNG_IMAGE_PIXEL_COMPONENT_SIZE(image->format)/check)
-             {
-                if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
-                   (image->colormap_entries > 0 && colormap != NULL))
-                {
-                   int result;
-diff --git a/media/libpng/pngrio.c b/media/libpng/pngrio.c
---- a/media/libpng/pngrio.c
-+++ b/media/libpng/pngrio.c
-@@ -1,13 +1,13 @@
- 
- /* pngrio.c - functions for data input
-  *
-- * Last changed in libpng 1.6.24 [August 4, 2016]
-- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file provides a location for all input.  Users who need
-@@ -24,17 +24,17 @@
- 
- /* Read the data from whatever input you are using.  The default routine
-  * reads from a file pointer.  Note that this routine sometimes gets called
-  * with very small lengths, so you should implement some kind of simple
-  * buffering if you are using unbuffered reads.  This should never be asked
-  * to read more than 64K on a 16-bit machine.
-  */
- void /* PRIVATE */
--png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
-+png_read_data(png_structrp png_ptr, png_bytep data, size_t length)
- {
-    png_debug1(4, "reading %d bytes", (int)length);
- 
-    if (png_ptr->read_data_fn != NULL)
-       (*(png_ptr->read_data_fn))(png_ptr, data, length);
- 
-    else
-       png_error(png_ptr, "Call to NULL read function");
-@@ -42,24 +42,24 @@ png_read_data(png_structrp png_ptr, png_
- 
- #ifdef PNG_STDIO_SUPPORTED
- /* This is the function that does the actual reading of data.  If you are
-  * not reading from a standard C stream, you should create a replacement
-  * read_data function and use it at run time with png_set_read_fn(), rather
-  * than changing the library.
-  */
- void PNGCBAPI
--png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
-+png_default_read_data(png_structp png_ptr, png_bytep data, size_t length)
- {
--   png_size_t check;
-+   size_t check;
- 
-    if (png_ptr == NULL)
-       return;
- 
--   /* fread() returns 0 on error, so it is OK to store this in a png_size_t
-+   /* fread() returns 0 on error, so it is OK to store this in a size_t
-     * instead of an int, which is what fread() actually returns.
-     */
-    check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
- 
-    if (check != length)
-       png_error(png_ptr, "Read Error");
- }
- #endif
-diff --git a/media/libpng/pngrtran.c b/media/libpng/pngrtran.c
---- a/media/libpng/pngrtran.c
-+++ b/media/libpng/pngrtran.c
-@@ -1,13 +1,13 @@
- 
- /* pngrtran.c - transforms the data in a row for PNG readers
-  *
-- * Last changed in libpng 1.6.33 [September 28, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file contains functions optionally called by an application
-@@ -287,17 +287,17 @@ png_set_alpha_mode_fixed(png_structrp pn
-    output_gamma = translate_gamma_flags(png_ptr, output_gamma, 1/*screen*/);
- 
-    /* Validate the value to ensure it is in a reasonable range. The value
-     * is expected to be 1 or greater, but this range test allows for some
-     * viewing correction values.  The intent is to weed out users of this API
-     * who use the inverse of the gamma value accidentally!  Since some of these
-     * values are reasonable this may have to be changed:
-     *
--    * 1.6.x: changed from 0.07..3 to 0.01..100 (to accomodate the optimal 16-bit
-+    * 1.6.x: changed from 0.07..3 to 0.01..100 (to accommodate the optimal 16-bit
-     * gamma of 36, and its reciprocal.)
-     */
-    if (output_gamma < 1000 || output_gamma > 10000000)
-       png_error(png_ptr, "output gamma out of expected range");
- 
-    /* The default file gamma is the inverse of the output gamma; the output
-     * gamma may be changed below so get the file value first:
-     */
-@@ -742,17 +742,17 @@ png_set_quantize(png_structrp png_ptr, p
-    {
-       int i;
-       png_bytep distance;
-       int total_bits = PNG_QUANTIZE_RED_BITS + PNG_QUANTIZE_GREEN_BITS +
-           PNG_QUANTIZE_BLUE_BITS;
-       int num_red = (1 << PNG_QUANTIZE_RED_BITS);
-       int num_green = (1 << PNG_QUANTIZE_GREEN_BITS);
-       int num_blue = (1 << PNG_QUANTIZE_BLUE_BITS);
--      png_size_t num_entries = ((png_size_t)1 << total_bits);
-+      size_t num_entries = ((size_t)1 << total_bits);
- 
-       png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
-           (png_alloc_size_t)(num_entries * (sizeof (png_byte))));
- 
-       distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries *
-           (sizeof (png_byte))));
- 
-       memset(distance, 0xff, num_entries * (sizeof (png_byte)));
-@@ -1312,17 +1312,17 @@ png_init_read_transformations(png_struct
-             /* Assume the output matches the input; a long time default behavior
-              * of libpng, although the standard has nothing to say about this.
-              */
-             png_ptr->screen_gamma = png_reciprocal(png_ptr->colorspace.gamma);
-       }
- 
-       else if (png_ptr->screen_gamma != 0)
-          /* The converse - assume the file matches the screen, note that this
--          * perhaps undesireable default can (from 1.5.4) be changed by calling
-+          * perhaps undesirable default can (from 1.5.4) be changed by calling
-           * png_set_alpha_mode (even if the alpha handling mode isn't required
-           * or isn't changed from the default.)
-           */
-          png_ptr->colorspace.gamma = png_reciprocal(png_ptr->screen_gamma);
- 
-       else /* neither are set */
-          /* Just in case the following prevents any processing - file and screen
-           * are both assumed to be linear and there is no way to introduce a
-@@ -1880,17 +1880,17 @@ png_init_read_transformations(png_struct
-        (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
-    {
-       int i;
-       int istop = png_ptr->num_palette;
-       int shift = 8 - png_ptr->sig_bit.red;
- 
-       png_ptr->transformations &= ~PNG_SHIFT;
- 
--      /* significant bits can be in the range 1 to 7 for a meaninful result, if
-+      /* significant bits can be in the range 1 to 7 for a meaningful result, if
-        * the number of significant bits is 0 then no shift is done (this is an
-        * error condition which is silently ignored.)
-        */
-       if (shift > 0 && shift < 8)
-          for (i=0; i<istop; ++i)
-          {
-             int component = png_ptr->palette[i].red;
- 
-@@ -2146,18 +2146,18 @@ png_do_unpack(png_row_infop row_info, pn
-    {
-       png_uint_32 i;
-       png_uint_32 row_width=row_info->width;
- 
-       switch (row_info->bit_depth)
-       {
-          case 1:
-          {
--            png_bytep sp = row + (png_size_t)((row_width - 1) >> 3);
--            png_bytep dp = row + (png_size_t)row_width - 1;
-+            png_bytep sp = row + (size_t)((row_width - 1) >> 3);
-+            png_bytep dp = row + (size_t)row_width - 1;
-             png_uint_32 shift = 7U - ((row_width + 7U) & 0x07);
-             for (i = 0; i < row_width; i++)
-             {
-                *dp = (png_byte)((*sp >> shift) & 0x01);
- 
-                if (shift == 7)
-                {
-                   shift = 0;
-@@ -2170,18 +2170,18 @@ png_do_unpack(png_row_infop row_info, pn
-                dp--;
-             }
-             break;
-          }
- 
-          case 2:
-          {
- 
--            png_bytep sp = row + (png_size_t)((row_width - 1) >> 2);
--            png_bytep dp = row + (png_size_t)row_width - 1;
-+            png_bytep sp = row + (size_t)((row_width - 1) >> 2);
-+            png_bytep dp = row + (size_t)row_width - 1;
-             png_uint_32 shift = ((3U - ((row_width + 3U) & 0x03)) << 1);
-             for (i = 0; i < row_width; i++)
-             {
-                *dp = (png_byte)((*sp >> shift) & 0x03);
- 
-                if (shift == 6)
-                {
-                   shift = 0;
-@@ -2193,18 +2193,18 @@ png_do_unpack(png_row_infop row_info, pn
- 
-                dp--;
-             }
-             break;
-          }
- 
-          case 4:
-          {
--            png_bytep sp = row + (png_size_t)((row_width - 1) >> 1);
--            png_bytep dp = row + (png_size_t)row_width - 1;
-+            png_bytep sp = row + (size_t)((row_width - 1) >> 1);
-+            png_bytep dp = row + (size_t)row_width - 1;
-             png_uint_32 shift = ((1U - ((row_width + 1U) & 0x01)) << 2);
-             for (i = 0; i < row_width; i++)
-             {
-                *dp = (png_byte)((*sp >> shift) & 0x0f);
- 
-                if (shift == 4)
-                {
-                   shift = 0;
-@@ -2458,105 +2458,104 @@ png_do_chop(png_row_infop row_info, png_
-    }
- }
- #endif
- 
- #ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
- static void
- png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
- {
-+   png_uint_32 row_width = row_info->width;
-+
-    png_debug(1, "in png_do_read_swap_alpha");
- 
-+   if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
-    {
--      png_uint_32 row_width = row_info->width;
--      if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
-+      /* This converts from RGBA to ARGB */
-+      if (row_info->bit_depth == 8)
-       {
--         /* This converts from RGBA to ARGB */
--         if (row_info->bit_depth == 8)
-+         png_bytep sp = row + row_info->rowbytes;
-+         png_bytep dp = sp;
-+         png_byte save;
-+         png_uint_32 i;
-+
-+         for (i = 0; i < row_width; i++)
-          {
--            png_bytep sp = row + row_info->rowbytes;
--            png_bytep dp = sp;
--            png_byte save;
--            png_uint_32 i;
--
--            for (i = 0; i < row_width; i++)
--            {
--               save = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = save;
--            }
-+            save = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = save;
-          }
-+      }
- 
- #ifdef PNG_READ_16BIT_SUPPORTED
--         /* This converts from RRGGBBAA to AARRGGBB */
--         else
-+      /* This converts from RRGGBBAA to AARRGGBB */
-+      else
-+      {
-+         png_bytep sp = row + row_info->rowbytes;
-+         png_bytep dp = sp;
-+         png_byte save[2];
-+         png_uint_32 i;
-+
-+         for (i = 0; i < row_width; i++)
-          {
--            png_bytep sp = row + row_info->rowbytes;
--            png_bytep dp = sp;
--            png_byte save[2];
--            png_uint_32 i;
--
--            for (i = 0; i < row_width; i++)
--            {
--               save[0] = *(--sp);
--               save[1] = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = save[0];
--               *(--dp) = save[1];
--            }
-+            save[0] = *(--sp);
-+            save[1] = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = save[0];
-+            *(--dp) = save[1];
-          }
-+      }
- #endif
--      }
--
--      else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-+   }
-+
-+   else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-+   {
-+      /* This converts from GA to AG */
-+      if (row_info->bit_depth == 8)
-       {
--         /* This converts from GA to AG */
--         if (row_info->bit_depth == 8)
-+         png_bytep sp = row + row_info->rowbytes;
-+         png_bytep dp = sp;
-+         png_byte save;
-+         png_uint_32 i;
-+
-+         for (i = 0; i < row_width; i++)
-          {
--            png_bytep sp = row + row_info->rowbytes;
--            png_bytep dp = sp;
--            png_byte save;
--            png_uint_32 i;
--
--            for (i = 0; i < row_width; i++)
--            {
--               save = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = save;
--            }
-+            save = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = save;
-          }
-+      }
- 
- #ifdef PNG_READ_16BIT_SUPPORTED
--         /* This converts from GGAA to AAGG */
--         else
-+      /* This converts from GGAA to AAGG */
-+      else
-+      {
-+         png_bytep sp = row + row_info->rowbytes;
-+         png_bytep dp = sp;
-+         png_byte save[2];
-+         png_uint_32 i;
-+
-+         for (i = 0; i < row_width; i++)
-          {
--            png_bytep sp = row + row_info->rowbytes;
--            png_bytep dp = sp;
--            png_byte save[2];
--            png_uint_32 i;
--
--            for (i = 0; i < row_width; i++)
--            {
--               save[0] = *(--sp);
--               save[1] = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = *(--sp);
--               *(--dp) = save[0];
--               *(--dp) = save[1];
--            }
-+            save[0] = *(--sp);
-+            save[1] = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = *(--sp);
-+            *(--dp) = save[0];
-+            *(--dp) = save[1];
-          }
-+      }
- #endif
--      }
-    }
- }
- #endif
- 
- #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
- static void
- png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
- {
-@@ -2676,34 +2675,34 @@ png_do_read_filler(png_row_infop row_inf
-    if (
-        row_info->color_type == PNG_COLOR_TYPE_GRAY)
-    {
-       if (row_info->bit_depth == 8)
-       {
-          if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
-          {
-             /* This changes the data from G to GX */
--            png_bytep sp = row + (png_size_t)row_width;
--            png_bytep dp =  sp + (png_size_t)row_width;
-+            png_bytep sp = row + (size_t)row_width;
-+            png_bytep dp =  sp + (size_t)row_width;
-             for (i = 1; i < row_width; i++)
-             {
-                *(--dp) = lo_filler;
-                *(--dp) = *(--sp);
-             }
-             *(--dp) = lo_filler;
-             row_info->channels = 2;
-             row_info->pixel_depth = 16;
-             row_info->rowbytes = row_width * 2;
-          }
- 
-          else
-          {
-             /* This changes the data from G to XG */
--            png_bytep sp = row + (png_size_t)row_width;
--            png_bytep dp = sp  + (png_size_t)row_width;
-+            png_bytep sp = row + (size_t)row_width;
-+            png_bytep dp = sp  + (size_t)row_width;
-             for (i = 0; i < row_width; i++)
-             {
-                *(--dp) = *(--sp);
-                *(--dp) = lo_filler;
-             }
-             row_info->channels = 2;
-             row_info->pixel_depth = 16;
-             row_info->rowbytes = row_width * 2;
-@@ -2711,18 +2710,18 @@ png_do_read_filler(png_row_infop row_inf
-       }
- 
- #ifdef PNG_READ_16BIT_SUPPORTED
-       else if (row_info->bit_depth == 16)
-       {
-          if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
-          {
-             /* This changes the data from GG to GGXX */
--            png_bytep sp = row + (png_size_t)row_width * 2;
--            png_bytep dp = sp  + (png_size_t)row_width * 2;
-+            png_bytep sp = row + (size_t)row_width * 2;
-+            png_bytep dp = sp  + (size_t)row_width * 2;
-             for (i = 1; i < row_width; i++)
-             {
-                *(--dp) = lo_filler;
-                *(--dp) = hi_filler;
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-             }
-             *(--dp) = lo_filler;
-@@ -2730,18 +2729,18 @@ png_do_read_filler(png_row_infop row_inf
-             row_info->channels = 2;
-             row_info->pixel_depth = 32;
-             row_info->rowbytes = row_width * 4;
-          }
- 
-          else
-          {
-             /* This changes the data from GG to XXGG */
--            png_bytep sp = row + (png_size_t)row_width * 2;
--            png_bytep dp = sp  + (png_size_t)row_width * 2;
-+            png_bytep sp = row + (size_t)row_width * 2;
-+            png_bytep dp = sp  + (size_t)row_width * 2;
-             for (i = 0; i < row_width; i++)
-             {
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-                *(--dp) = lo_filler;
-                *(--dp) = hi_filler;
-             }
-             row_info->channels = 2;
-@@ -2753,36 +2752,36 @@ png_do_read_filler(png_row_infop row_inf
-    } /* COLOR_TYPE == GRAY */
-    else if (row_info->color_type == PNG_COLOR_TYPE_RGB)
-    {
-       if (row_info->bit_depth == 8)
-       {
-          if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
-          {
-             /* This changes the data from RGB to RGBX */
--            png_bytep sp = row + (png_size_t)row_width * 3;
--            png_bytep dp = sp  + (png_size_t)row_width;
-+            png_bytep sp = row + (size_t)row_width * 3;
-+            png_bytep dp = sp  + (size_t)row_width;
-             for (i = 1; i < row_width; i++)
-             {
-                *(--dp) = lo_filler;
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-             }
-             *(--dp) = lo_filler;
-             row_info->channels = 4;
-             row_info->pixel_depth = 32;
-             row_info->rowbytes = row_width * 4;
-          }
- 
-          else
-          {
-             /* This changes the data from RGB to XRGB */
--            png_bytep sp = row + (png_size_t)row_width * 3;
--            png_bytep dp = sp + (png_size_t)row_width;
-+            png_bytep sp = row + (size_t)row_width * 3;
-+            png_bytep dp = sp + (size_t)row_width;
-             for (i = 0; i < row_width; i++)
-             {
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-                *(--dp) = lo_filler;
-             }
-             row_info->channels = 4;
-@@ -2792,18 +2791,18 @@ png_do_read_filler(png_row_infop row_inf
-       }
- 
- #ifdef PNG_READ_16BIT_SUPPORTED
-       else if (row_info->bit_depth == 16)
-       {
-          if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
-          {
-             /* This changes the data from RRGGBB to RRGGBBXX */
--            png_bytep sp = row + (png_size_t)row_width * 6;
--            png_bytep dp = sp  + (png_size_t)row_width * 2;
-+            png_bytep sp = row + (size_t)row_width * 6;
-+            png_bytep dp = sp  + (size_t)row_width * 2;
-             for (i = 1; i < row_width; i++)
-             {
-                *(--dp) = lo_filler;
-                *(--dp) = hi_filler;
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-@@ -2815,18 +2814,18 @@ png_do_read_filler(png_row_infop row_inf
-             row_info->channels = 4;
-             row_info->pixel_depth = 64;
-             row_info->rowbytes = row_width * 8;
-          }
- 
-          else
-          {
-             /* This changes the data from RRGGBB to XXRRGGBB */
--            png_bytep sp = row + (png_size_t)row_width * 6;
--            png_bytep dp = sp  + (png_size_t)row_width * 2;
-+            png_bytep sp = row + (size_t)row_width * 6;
-+            png_bytep dp = sp  + (size_t)row_width * 2;
-             for (i = 0; i < row_width; i++)
-             {
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-                *(--dp) = *(--sp);
-@@ -2857,31 +2856,31 @@ png_do_gray_to_rgb(png_row_infop row_inf
-    if (row_info->bit_depth >= 8 &&
-        (row_info->color_type & PNG_COLOR_MASK_COLOR) == 0)
-    {
-       if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
-       {
-          if (row_info->bit_depth == 8)
-          {
-             /* This changes G to RGB */
--            png_bytep sp = row + (png_size_t)row_width - 1;
--            png_bytep dp = sp  + (png_size_t)row_width * 2;
-+            png_bytep sp = row + (size_t)row_width - 1;
-+            png_bytep dp = sp  + (size_t)row_width * 2;
-             for (i = 0; i < row_width; i++)
-             {
-                *(dp--) = *sp;
-                *(dp--) = *sp;
-                *(dp--) = *(sp--);
-             }
-          }
- 
-          else
-          {
-             /* This changes GG to RRGGBB */
--            png_bytep sp = row + (png_size_t)row_width * 2 - 1;
--            png_bytep dp = sp  + (png_size_t)row_width * 4;
-+            png_bytep sp = row + (size_t)row_width * 2 - 1;
-+            png_bytep dp = sp  + (size_t)row_width * 4;
-             for (i = 0; i < row_width; i++)
-             {
-                *(dp--) = *sp;
-                *(dp--) = *(sp - 1);
-                *(dp--) = *sp;
-                *(dp--) = *(sp - 1);
-                *(dp--) = *(sp--);
-                *(dp--) = *(sp--);
-@@ -2889,32 +2888,32 @@ png_do_gray_to_rgb(png_row_infop row_inf
-          }
-       }
- 
-       else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-       {
-          if (row_info->bit_depth == 8)
-          {
-             /* This changes GA to RGBA */
--            png_bytep sp = row + (png_size_t)row_width * 2 - 1;
--            png_bytep dp = sp  + (png_size_t)row_width * 2;
-+            png_bytep sp = row + (size_t)row_width * 2 - 1;
-+            png_bytep dp = sp  + (size_t)row_width * 2;
-             for (i = 0; i < row_width; i++)
-             {
-                *(dp--) = *(sp--);
-                *(dp--) = *sp;
-                *(dp--) = *sp;
-                *(dp--) = *(sp--);
-             }
-          }
- 
-          else
-          {
-             /* This changes GGAA to RRGGBBAA */
--            png_bytep sp = row + (png_size_t)row_width * 4 - 1;
--            png_bytep dp = sp  + (png_size_t)row_width * 4;
-+            png_bytep sp = row + (size_t)row_width * 4 - 1;
-+            png_bytep dp = sp  + (size_t)row_width * 4;
-             for (i = 0; i < row_width; i++)
-             {
-                *(dp--) = *(sp--);
-                *(dp--) = *(sp--);
-                *(dp--) = *sp;
-                *(dp--) = *(sp - 1);
-                *(dp--) = *sp;
-                *(dp--) = *(sp - 1);
-@@ -2975,17 +2974,17 @@ png_do_gray_to_rgb(png_row_infop row_inf
-  *  (including an sRGB chunk) then the chromaticities are used to calculate the
-  *  coefficients.  See the chunk handling in pngrutil.c for more information.
-  *
-  *  In all cases the calculation is to be done in a linear colorspace.  If no
-  *  gamma information is available to correct the encoding of the original RGB
-  *  values this results in an implicit assumption that the original PNG RGB
-  *  values were linear.
-  *
-- *  Other integer coefficents can be used via png_set_rgb_to_gray().  Because
-+ *  Other integer coefficients can be used via png_set_rgb_to_gray().  Because
-  *  the API takes just red and green coefficients the blue coefficient is
-  *  calculated to make the sum 32768.  This will result in different rounding
-  *  to that used above.
-  */
- static int
- png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
- 
- {
-@@ -3204,730 +3203,728 @@ png_do_compose(png_row_infop row_info, p
- 
-    png_bytep sp;
-    png_uint_32 i;
-    png_uint_32 row_width = row_info->width;
-    int shift;
- 
-    png_debug(1, "in png_do_compose");
- 
-+   switch (row_info->color_type)
-    {
--      switch (row_info->color_type)
-+      case PNG_COLOR_TYPE_GRAY:
-       {
--         case PNG_COLOR_TYPE_GRAY:
-+         switch (row_info->bit_depth)
-          {
--            switch (row_info->bit_depth)
-+            case 1:
-             {
--               case 1:
-+               sp = row;
-+               shift = 7;
-+               for (i = 0; i < row_width; i++)
-+               {
-+                  if ((png_uint_16)((*sp >> shift) & 0x01)
-+                     == png_ptr->trans_color.gray)
-+                  {
-+                     unsigned int tmp = *sp & (0x7f7f >> (7 - shift));
-+                     tmp |=
-+                         (unsigned int)(png_ptr->background.gray << shift);
-+                     *sp = (png_byte)(tmp & 0xff);
-+                  }
-+
-+                  if (shift == 0)
-+                  {
-+                     shift = 7;
-+                     sp++;
-+                  }
-+
-+                  else
-+                     shift--;
-+               }
-+               break;
-+            }
-+
-+            case 2:
-+            {
-+#ifdef PNG_READ_GAMMA_SUPPORTED
-+               if (gamma_table != NULL)
-                {
-                   sp = row;
--                  shift = 7;
-+                  shift = 6;
-                   for (i = 0; i < row_width; i++)
-                   {
--                     if ((png_uint_16)((*sp >> shift) & 0x01)
--                        == png_ptr->trans_color.gray)
-+                     if ((png_uint_16)((*sp >> shift) & 0x03)
-+                         == png_ptr->trans_color.gray)
-                      {
--                        unsigned int tmp = *sp & (0x7f7f >> (7 - shift));
-+                        unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
-                         tmp |=
--                            (unsigned int)(png_ptr->background.gray << shift);
-+                           (unsigned int)png_ptr->background.gray << shift;
-+                        *sp = (png_byte)(tmp & 0xff);
-+                     }
-+
-+                     else
-+                     {
-+                        unsigned int p = (*sp >> shift) & 0x03;
-+                        unsigned int g = (gamma_table [p | (p << 2) |
-+                            (p << 4) | (p << 6)] >> 6) & 0x03;
-+                        unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
-+                        tmp |= (unsigned int)(g << shift);
-                         *sp = (png_byte)(tmp & 0xff);
-                      }
- 
-                      if (shift == 0)
-                      {
--                        shift = 7;
-+                        shift = 6;
-                         sp++;
-                      }
- 
-                      else
--                        shift--;
--                  }
--                  break;
--               }
--
--               case 2:
--               {
--#ifdef PNG_READ_GAMMA_SUPPORTED
--                  if (gamma_table != NULL)
--                  {
--                     sp = row;
--                     shift = 6;
--                     for (i = 0; i < row_width; i++)
--                     {
--                        if ((png_uint_16)((*sp >> shift) & 0x03)
--                            == png_ptr->trans_color.gray)
--                        {
--                           unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
--                           tmp |=
--                              (unsigned int)png_ptr->background.gray << shift;
--                           *sp = (png_byte)(tmp & 0xff);
--                        }
--
--                        else
--                        {
--                           unsigned int p = (*sp >> shift) & 0x03;
--                           unsigned int g = (gamma_table [p | (p << 2) |
--                               (p << 4) | (p << 6)] >> 6) & 0x03;
--                           unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
--                           tmp |= (unsigned int)(g << shift);
--                           *sp = (png_byte)(tmp & 0xff);
--                        }
--
--                        if (shift == 0)
--                        {
--                           shift = 6;
--                           sp++;
--                        }
--
--                        else
--                           shift -= 2;
--                     }
--                  }
--
--                  else
--#endif
--                  {
--                     sp = row;
--                     shift = 6;
--                     for (i = 0; i < row_width; i++)
--                     {
--                        if ((png_uint_16)((*sp >> shift) & 0x03)
--                            == png_ptr->trans_color.gray)
--                        {
--                           unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
--                           tmp |=
--                               (unsigned int)png_ptr->background.gray << shift;
--                           *sp = (png_byte)(tmp & 0xff);
--                        }
--
--                        if (shift == 0)
--                        {
--                           shift = 6;
--                           sp++;
--                        }
--
--                        else
--                           shift -= 2;
--                     }
--                  }
--                  break;
--               }
--
--               case 4:
--               {
--#ifdef PNG_READ_GAMMA_SUPPORTED
--                  if (gamma_table != NULL)
--                  {
--                     sp = row;
--                     shift = 4;
--                     for (i = 0; i < row_width; i++)
--                     {
--                        if ((png_uint_16)((*sp >> shift) & 0x0f)
--                            == png_ptr->trans_color.gray)
--                        {
--                           unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
--                           tmp |=
--                              (unsigned int)(png_ptr->background.gray << shift);
--                           *sp = (png_byte)(tmp & 0xff);
--                        }
--
--                        else
--                        {
--                           unsigned int p = (*sp >> shift) & 0x0f;
--                           unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
--                              0x0f;
--                           unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
--                           tmp |= (unsigned int)(g << shift);
--                           *sp = (png_byte)(tmp & 0xff);
--                        }
--
--                        if (shift == 0)
--                        {
--                           shift = 4;
--                           sp++;
--                        }
--
--                        else
--                           shift -= 4;
--                     }
--                  }
--
--                  else
--#endif
--                  {
--                     sp = row;
--                     shift = 4;
--                     for (i = 0; i < row_width; i++)
--                     {
--                        if ((png_uint_16)((*sp >> shift) & 0x0f)
--                            == png_ptr->trans_color.gray)
--                        {
--                           unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
--                           tmp |=
--                              (unsigned int)(png_ptr->background.gray << shift);
--                           *sp = (png_byte)(tmp & 0xff);
--                        }
--
--                        if (shift == 0)
--                        {
--                           shift = 4;
--                           sp++;
--                        }
--
--                        else
--                           shift -= 4;
--                     }
--                  }
--                  break;
--               }
--
--               case 8:
--               {
--#ifdef PNG_READ_GAMMA_SUPPORTED
--                  if (gamma_table != NULL)
--                  {
--                     sp = row;
--                     for (i = 0; i < row_width; i++, sp++)
--                     {
--                        if (*sp == png_ptr->trans_color.gray)
--                           *sp = (png_byte)png_ptr->background.gray;
--
--                        else
--                           *sp = gamma_table[*sp];
--                     }
--                  }
--                  else
--#endif
--                  {
--                     sp = row;
--                     for (i = 0; i < row_width; i++, sp++)
--                     {
--                        if (*sp == png_ptr->trans_color.gray)
--                           *sp = (png_byte)png_ptr->background.gray;
--                     }
--                  }
--                  break;
--               }
--
--               case 16:
--               {
--#ifdef PNG_READ_GAMMA_SUPPORTED
--                  if (gamma_16 != NULL)
--                  {
--                     sp = row;
--                     for (i = 0; i < row_width; i++, sp += 2)
--                     {
--                        png_uint_16 v;
--
--                        v = (png_uint_16)(((*sp) << 8) + *(sp + 1));
--
--                        if (v == png_ptr->trans_color.gray)
--                        {
--                           /* Background is already in screen gamma */
--                           *sp = (png_byte)((png_ptr->background.gray >> 8)
--                                & 0xff);
--                           *(sp + 1) = (png_byte)(png_ptr->background.gray
--                                & 0xff);
--                        }
--
--                        else
--                        {
--                           v = gamma_16[*(sp + 1) >> gamma_shift][*sp];
--                           *sp = (png_byte)((v >> 8) & 0xff);
--                           *(sp + 1) = (png_byte)(v & 0xff);
--                        }
--                     }
--                  }
--                  else
--#endif
--                  {
--                     sp = row;
--                     for (i = 0; i < row_width; i++, sp += 2)
--                     {
--                        png_uint_16 v;
--
--                        v = (png_uint_16)(((*sp) << 8) + *(sp + 1));
--
--                        if (v == png_ptr->trans_color.gray)
--                        {
--                           *sp = (png_byte)((png_ptr->background.gray >> 8)
--                                & 0xff);
--                           *(sp + 1) = (png_byte)(png_ptr->background.gray
--                                & 0xff);
--                        }
--                     }
--                  }
--                  break;
--               }
--
--               default:
--                  break;
--            }
--            break;
--         }
--
--         case PNG_COLOR_TYPE_RGB:
--         {
--            if (row_info->bit_depth == 8)
--            {
--#ifdef PNG_READ_GAMMA_SUPPORTED
--               if (gamma_table != NULL)
--               {
--                  sp = row;
--                  for (i = 0; i < row_width; i++, sp += 3)
--                  {
--                     if (*sp == png_ptr->trans_color.red &&
--                         *(sp + 1) == png_ptr->trans_color.green &&
--                         *(sp + 2) == png_ptr->trans_color.blue)
--                     {
--                        *sp = (png_byte)png_ptr->background.red;
--                        *(sp + 1) = (png_byte)png_ptr->background.green;
--                        *(sp + 2) = (png_byte)png_ptr->background.blue;
--                     }
--
--                     else
--                     {
--                        *sp = gamma_table[*sp];
--                        *(sp + 1) = gamma_table[*(sp + 1)];
--                        *(sp + 2) = gamma_table[*(sp + 2)];
--                     }
--                  }
--               }
--               else
--#endif
--               {
--                  sp = row;
--                  for (i = 0; i < row_width; i++, sp += 3)
--                  {
--                     if (*sp == png_ptr->trans_color.red &&
--                         *(sp + 1) == png_ptr->trans_color.green &&
--                         *(sp + 2) == png_ptr->trans_color.blue)
--                     {
--                        *sp = (png_byte)png_ptr->background.red;
--                        *(sp + 1) = (png_byte)png_ptr->background.green;
--                        *(sp + 2) = (png_byte)png_ptr->background.blue;
--                     }
--                  }
--               }
--            }
--            else /* if (row_info->bit_depth == 16) */
--            {
--#ifdef PNG_READ_GAMMA_SUPPORTED
--               if (gamma_16 != NULL)
--               {
--                  sp = row;
--                  for (i = 0; i < row_width; i++, sp += 6)
--                  {
--                     png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1));
--
--                     png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8)
--                         + *(sp + 3));
--
--                     png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8)
--                         + *(sp + 5));
--
--                     if (r == png_ptr->trans_color.red &&
--                         g == png_ptr->trans_color.green &&
--                         b == png_ptr->trans_color.blue)
--                     {
--                        /* Background is already in screen gamma */
--                        *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
--                        *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
--                                & 0xff);
--                        *(sp + 3) = (png_byte)(png_ptr->background.green
--                                & 0xff);
--                        *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
--                                & 0xff);
--                        *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
--                     }
--
--                     else
--                     {
--                        png_uint_16 v = gamma_16[*(sp + 1) >> gamma_shift][*sp];
--                        *sp = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(v & 0xff);
--
--                        v = gamma_16[*(sp + 3) >> gamma_shift][*(sp + 2)];
--                        *(sp + 2) = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 3) = (png_byte)(v & 0xff);
--
--                        v = gamma_16[*(sp + 5) >> gamma_shift][*(sp + 4)];
--                        *(sp + 4) = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 5) = (png_byte)(v & 0xff);
--                     }
-+                        shift -= 2;
-                   }
-                }
- 
-                else
- #endif
-                {
-                   sp = row;
--                  for (i = 0; i < row_width; i++, sp += 6)
-+                  shift = 6;
-+                  for (i = 0; i < row_width; i++)
-                   {
--                     png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1));
--
--                     png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8)
--                         + *(sp + 3));
--
--                     png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8)
--                         + *(sp + 5));
--
--                     if (r == png_ptr->trans_color.red &&
--                         g == png_ptr->trans_color.green &&
--                         b == png_ptr->trans_color.blue)
-+                     if ((png_uint_16)((*sp >> shift) & 0x03)
-+                         == png_ptr->trans_color.gray)
-+                     {
-+                        unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
-+                        tmp |=
-+                            (unsigned int)png_ptr->background.gray << shift;
-+                        *sp = (png_byte)(tmp & 0xff);
-+                     }
-+
-+                     if (shift == 0)
-                      {
--                        *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
--                        *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
--                                & 0xff);
--                        *(sp + 3) = (png_byte)(png_ptr->background.green
--                                & 0xff);
--                        *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
--                                & 0xff);
--                        *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
-+                        shift = 6;
-+                        sp++;
-                      }
-+
-+                     else
-+                        shift -= 2;
-+                  }
-+               }
-+               break;
-+            }
-+
-+            case 4:
-+            {
-+#ifdef PNG_READ_GAMMA_SUPPORTED
-+               if (gamma_table != NULL)
-+               {
-+                  sp = row;
-+                  shift = 4;
-+                  for (i = 0; i < row_width; i++)
-+                  {
-+                     if ((png_uint_16)((*sp >> shift) & 0x0f)
-+                         == png_ptr->trans_color.gray)
-+                     {
-+                        unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
-+                        tmp |=
-+                           (unsigned int)(png_ptr->background.gray << shift);
-+                        *sp = (png_byte)(tmp & 0xff);
-+                     }
-+
-+                     else
-+                     {
-+                        unsigned int p = (*sp >> shift) & 0x0f;
-+                        unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
-+                           0x0f;
-+                        unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
-+                        tmp |= (unsigned int)(g << shift);
-+                        *sp = (png_byte)(tmp & 0xff);
-+                     }
-+
-+                     if (shift == 0)
-+                     {
-+                        shift = 4;
-+                        sp++;
-+                     }
-+
-+                     else
-+                        shift -= 4;
-                   }
-                }
-+
-+               else
-+#endif
-+               {
-+                  sp = row;
-+                  shift = 4;
-+                  for (i = 0; i < row_width; i++)
-+                  {
-+                     if ((png_uint_16)((*sp >> shift) & 0x0f)
-+                         == png_ptr->trans_color.gray)
-+                     {
-+                        unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
-+                        tmp |=
-+                           (unsigned int)(png_ptr->background.gray << shift);
-+                        *sp = (png_byte)(tmp & 0xff);
-+                     }
-+
-+                     if (shift == 0)
-+                     {
-+                        shift = 4;
-+                        sp++;
-+                     }
-+
-+                     else
-+                        shift -= 4;
-+                  }
-+               }
-+               break;
-             }
--            break;
--         }
--
--         case PNG_COLOR_TYPE_GRAY_ALPHA:
--         {
--            if (row_info->bit_depth == 8)
-+
-+            case 8:
-             {
- #ifdef PNG_READ_GAMMA_SUPPORTED
--               if (gamma_to_1 != NULL && gamma_from_1 != NULL &&
--                   gamma_table != NULL)
-+               if (gamma_table != NULL)
-+               {
-+                  sp = row;
-+                  for (i = 0; i < row_width; i++, sp++)
-+                  {
-+                     if (*sp == png_ptr->trans_color.gray)
-+                        *sp = (png_byte)png_ptr->background.gray;
-+
-+                     else
-+                        *sp = gamma_table[*sp];
-+                  }
-+               }
-+               else
-+#endif
-+               {
-+                  sp = row;
-+                  for (i = 0; i < row_width; i++, sp++)
-+                  {
-+                     if (*sp == png_ptr->trans_color.gray)
-+                        *sp = (png_byte)png_ptr->background.gray;
-+                  }
-+               }
-+               break;
-+            }
-+
-+            case 16:
-+            {
-+#ifdef PNG_READ_GAMMA_SUPPORTED
-+               if (gamma_16 != NULL)
-                {
-                   sp = row;
-                   for (i = 0; i < row_width; i++, sp += 2)
-                   {
--                     png_uint_16 a = *(sp + 1);
--
--                     if (a == 0xff)
--                        *sp = gamma_table[*sp];
--
--                     else if (a == 0)
-+                     png_uint_16 v;
-+
-+                     v = (png_uint_16)(((*sp) << 8) + *(sp + 1));
-+
-+                     if (v == png_ptr->trans_color.gray)
-                      {
-                         /* Background is already in screen gamma */
--                        *sp = (png_byte)png_ptr->background.gray;
-+                        *sp = (png_byte)((png_ptr->background.gray >> 8)
-+                             & 0xff);
-+                        *(sp + 1) = (png_byte)(png_ptr->background.gray
-+                             & 0xff);
-                      }
- 
-                      else
-                      {
--                        png_byte v, w;
--
--                        v = gamma_to_1[*sp];
--                        png_composite(w, v, a, png_ptr->background_1.gray);
--                        if (optimize == 0)
--                           w = gamma_from_1[w];
--                        *sp = w;
-+                        v = gamma_16[*(sp + 1) >> gamma_shift][*sp];
-+                        *sp = (png_byte)((v >> 8) & 0xff);
-+                        *(sp + 1) = (png_byte)(v & 0xff);
-                      }
-                   }
-                }
-                else
- #endif
-                {
-                   sp = row;
-                   for (i = 0; i < row_width; i++, sp += 2)
-                   {
--                     png_byte a = *(sp + 1);
--
--                     if (a == 0)
--                        *sp = (png_byte)png_ptr->background.gray;
--
--                     else if (a < 0xff)
--                        png_composite(*sp, *sp, a, png_ptr->background.gray);
--                  }
--               }
--            }
--            else /* if (png_ptr->bit_depth == 16) */
--            {
--#ifdef PNG_READ_GAMMA_SUPPORTED
--               if (gamma_16 != NULL && gamma_16_from_1 != NULL &&
--                   gamma_16_to_1 != NULL)
--               {
--                  sp = row;
--                  for (i = 0; i < row_width; i++, sp += 4)
--                  {
--                     png_uint_16 a = (png_uint_16)(((*(sp + 2)) << 8)
--                         + *(sp + 3));
--
--                     if (a == (png_uint_16)0xffff)
--                     {
--                        png_uint_16 v;
--
--                        v = gamma_16[*(sp + 1) >> gamma_shift][*sp];
--                        *sp = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(v & 0xff);
--                     }
--
--                     else if (a == 0)
--                     {
--                        /* Background is already in screen gamma */
--                        *sp = (png_byte)((png_ptr->background.gray >> 8)
--                                & 0xff);
--                        *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
--                     }
--
--                     else
--                     {
--                        png_uint_16 g, v, w;
--
--                        g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
--                        png_composite_16(v, g, a, png_ptr->background_1.gray);
--                        if (optimize != 0)
--                           w = v;
--                        else
--                           w = gamma_16_from_1[(v & 0xff) >>
--                               gamma_shift][v >> 8];
--                        *sp = (png_byte)((w >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(w & 0xff);
--                     }
--                  }
--               }
--               else
--#endif
--               {
--                  sp = row;
--                  for (i = 0; i < row_width; i++, sp += 4)
--                  {
--                     png_uint_16 a = (png_uint_16)(((*(sp + 2)) << 8)
--                         + *(sp + 3));
--
--                     if (a == 0)
-+                     png_uint_16 v;
-+
-+                     v = (png_uint_16)(((*sp) << 8) + *(sp + 1));
-+
-+                     if (v == png_ptr->trans_color.gray)
-                      {
-                         *sp = (png_byte)((png_ptr->background.gray >> 8)
--                                & 0xff);
--                        *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
--                     }
--
--                     else if (a < 0xffff)
--                     {
--                        png_uint_16 g, v;
--
--                        g = (png_uint_16)(((*sp) << 8) + *(sp + 1));
--                        png_composite_16(v, g, a, png_ptr->background.gray);
--                        *sp = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(v & 0xff);
--                     }
--                  }
--               }
--            }
--            break;
--         }
--
--         case PNG_COLOR_TYPE_RGB_ALPHA:
--         {
--            if (row_info->bit_depth == 8)
--            {
--#ifdef PNG_READ_GAMMA_SUPPORTED
--               if (gamma_to_1 != NULL && gamma_from_1 != NULL &&
--                   gamma_table != NULL)
--               {
--                  sp = row;
--                  for (i = 0; i < row_width; i++, sp += 4)
--                  {
--                     png_byte a = *(sp + 3);
--
--                     if (a == 0xff)
--                     {
--                        *sp = gamma_table[*sp];
--                        *(sp + 1) = gamma_table[*(sp + 1)];
--                        *(sp + 2) = gamma_table[*(sp + 2)];
--                     }
--
--                     else if (a == 0)
--                     {
--                        /* Background is already in screen gamma */
--                        *sp = (png_byte)png_ptr->background.red;
--                        *(sp + 1) = (png_byte)png_ptr->background.green;
--                        *(sp + 2) = (png_byte)png_ptr->background.blue;
--                     }
--
--                     else
--                     {
--                        png_byte v, w;
--
--                        v = gamma_to_1[*sp];
--                        png_composite(w, v, a, png_ptr->background_1.red);
--                        if (optimize == 0) w = gamma_from_1[w];
--                        *sp = w;
--
--                        v = gamma_to_1[*(sp + 1)];
--                        png_composite(w, v, a, png_ptr->background_1.green);
--                        if (optimize == 0) w = gamma_from_1[w];
--                        *(sp + 1) = w;
--
--                        v = gamma_to_1[*(sp + 2)];
--                        png_composite(w, v, a, png_ptr->background_1.blue);
--                        if (optimize == 0) w = gamma_from_1[w];
--                        *(sp + 2) = w;
-+                             & 0xff);
-+                        *(sp + 1) = (png_byte)(png_ptr->background.gray
-+                             & 0xff);
-                      }
-                   }
-                }
--               else
-+               break;
-+            }
-+
-+            default:
-+               break;
-+         }
-+         break;
-+      }
-+
-+      case PNG_COLOR_TYPE_RGB:
-+      {
-+         if (row_info->bit_depth == 8)
-+         {
-+#ifdef PNG_READ_GAMMA_SUPPORTED
-+            if (gamma_table != NULL)
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 3)
-+               {
-+                  if (*sp == png_ptr->trans_color.red &&
-+                      *(sp + 1) == png_ptr->trans_color.green &&
-+                      *(sp + 2) == png_ptr->trans_color.blue)
-+                  {
-+                     *sp = (png_byte)png_ptr->background.red;
-+                     *(sp + 1) = (png_byte)png_ptr->background.green;
-+                     *(sp + 2) = (png_byte)png_ptr->background.blue;
-+                  }
-+
-+                  else
-+                  {
-+                     *sp = gamma_table[*sp];
-+                     *(sp + 1) = gamma_table[*(sp + 1)];
-+                     *(sp + 2) = gamma_table[*(sp + 2)];
-+                  }
-+               }
-+            }
-+            else
- #endif
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 3)
-                {
--                  sp = row;
--                  for (i = 0; i < row_width; i++, sp += 4)
-+                  if (*sp == png_ptr->trans_color.red &&
-+                      *(sp + 1) == png_ptr->trans_color.green &&
-+                      *(sp + 2) == png_ptr->trans_color.blue)
-+                  {
-+                     *sp = (png_byte)png_ptr->background.red;
-+                     *(sp + 1) = (png_byte)png_ptr->background.green;
-+                     *(sp + 2) = (png_byte)png_ptr->background.blue;
-+                  }
-+               }
-+            }
-+         }
-+         else /* if (row_info->bit_depth == 16) */
-+         {
-+#ifdef PNG_READ_GAMMA_SUPPORTED
-+            if (gamma_16 != NULL)
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 6)
-+               {
-+                  png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1));
-+
-+                  png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8)
-+                      + *(sp + 3));
-+
-+                  png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8)
-+                      + *(sp + 5));
-+
-+                  if (r == png_ptr->trans_color.red &&
-+                      g == png_ptr->trans_color.green &&
-+                      b == png_ptr->trans_color.blue)
-+                  {
-+                     /* Background is already in screen gamma */
-+                     *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
-+                     *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
-+                             & 0xff);
-+                     *(sp + 3) = (png_byte)(png_ptr->background.green
-+                             & 0xff);
-+                     *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
-+                             & 0xff);
-+                     *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
-+                  }
-+
-+                  else
-                   {
--                     png_byte a = *(sp + 3);
--
--                     if (a == 0)
--                     {
--                        *sp = (png_byte)png_ptr->background.red;
--                        *(sp + 1) = (png_byte)png_ptr->background.green;
--                        *(sp + 2) = (png_byte)png_ptr->background.blue;
--                     }
--
--                     else if (a < 0xff)
--                     {
--                        png_composite(*sp, *sp, a, png_ptr->background.red);
--
--                        png_composite(*(sp + 1), *(sp + 1), a,
--                            png_ptr->background.green);
--
--                        png_composite(*(sp + 2), *(sp + 2), a,
--                            png_ptr->background.blue);
--                     }
-+                     png_uint_16 v = gamma_16[*(sp + 1) >> gamma_shift][*sp];
-+                     *sp = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(v & 0xff);
-+
-+                     v = gamma_16[*(sp + 3) >> gamma_shift][*(sp + 2)];
-+                     *(sp + 2) = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 3) = (png_byte)(v & 0xff);
-+
-+                     v = gamma_16[*(sp + 5) >> gamma_shift][*(sp + 4)];
-+                     *(sp + 4) = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 5) = (png_byte)(v & 0xff);
-+                  }
-+               }
-+            }
-+
-+            else
-+#endif
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 6)
-+               {
-+                  png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1));
-+
-+                  png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8)
-+                      + *(sp + 3));
-+
-+                  png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8)
-+                      + *(sp + 5));
-+
-+                  if (r == png_ptr->trans_color.red &&
-+                      g == png_ptr->trans_color.green &&
-+                      b == png_ptr->trans_color.blue)
-+                  {
-+                     *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
-+                     *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
-+                             & 0xff);
-+                     *(sp + 3) = (png_byte)(png_ptr->background.green
-+                             & 0xff);
-+                     *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
-+                             & 0xff);
-+                     *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
-+                  }
-+               }
-+            }
-+         }
-+         break;
-+      }
-+
-+      case PNG_COLOR_TYPE_GRAY_ALPHA:
-+      {
-+         if (row_info->bit_depth == 8)
-+         {
-+#ifdef PNG_READ_GAMMA_SUPPORTED
-+            if (gamma_to_1 != NULL && gamma_from_1 != NULL &&
-+                gamma_table != NULL)
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 2)
-+               {
-+                  png_uint_16 a = *(sp + 1);
-+
-+                  if (a == 0xff)
-+                     *sp = gamma_table[*sp];
-+
-+                  else if (a == 0)
-+                  {
-+                     /* Background is already in screen gamma */
-+                     *sp = (png_byte)png_ptr->background.gray;
-+                  }
-+
-+                  else
-+                  {
-+                     png_byte v, w;
-+
-+                     v = gamma_to_1[*sp];
-+                     png_composite(w, v, a, png_ptr->background_1.gray);
-+                     if (optimize == 0)
-+                        w = gamma_from_1[w];
-+                     *sp = w;
-+                  }
-+               }
-+            }
-+            else
-+#endif
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 2)
-+               {
-+                  png_byte a = *(sp + 1);
-+
-+                  if (a == 0)
-+                     *sp = (png_byte)png_ptr->background.gray;
-+
-+                  else if (a < 0xff)
-+                     png_composite(*sp, *sp, a, png_ptr->background.gray);
-+               }
-+            }
-+         }
-+         else /* if (png_ptr->bit_depth == 16) */
-+         {
-+#ifdef PNG_READ_GAMMA_SUPPORTED
-+            if (gamma_16 != NULL && gamma_16_from_1 != NULL &&
-+                gamma_16_to_1 != NULL)
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 4)
-+               {
-+                  png_uint_16 a = (png_uint_16)(((*(sp + 2)) << 8)
-+                      + *(sp + 3));
-+
-+                  if (a == (png_uint_16)0xffff)
-+                  {
-+                     png_uint_16 v;
-+
-+                     v = gamma_16[*(sp + 1) >> gamma_shift][*sp];
-+                     *sp = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(v & 0xff);
-+                  }
-+
-+                  else if (a == 0)
-+                  {
-+                     /* Background is already in screen gamma */
-+                     *sp = (png_byte)((png_ptr->background.gray >> 8)
-+                             & 0xff);
-+                     *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
-+                  }
-+
-+                  else
-+                  {
-+                     png_uint_16 g, v, w;
-+
-+                     g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
-+                     png_composite_16(v, g, a, png_ptr->background_1.gray);
-+                     if (optimize != 0)
-+                        w = v;
-+                     else
-+                        w = gamma_16_from_1[(v & 0xff) >>
-+                            gamma_shift][v >> 8];
-+                     *sp = (png_byte)((w >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(w & 0xff);
-                   }
-                }
-             }
--            else /* if (row_info->bit_depth == 16) */
-+            else
-+#endif
-             {
--#ifdef PNG_READ_GAMMA_SUPPORTED
--               if (gamma_16 != NULL && gamma_16_from_1 != NULL &&
--                   gamma_16_to_1 != NULL)
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 4)
-                {
--                  sp = row;
--                  for (i = 0; i < row_width; i++, sp += 8)
-+                  png_uint_16 a = (png_uint_16)(((*(sp + 2)) << 8)
-+                      + *(sp + 3));
-+
-+                  if (a == 0)
-                   {
--                     png_uint_16 a = (png_uint_16)(((png_uint_16)(*(sp + 6))
--                         << 8) + (png_uint_16)(*(sp + 7)));
--
--                     if (a == (png_uint_16)0xffff)
--                     {
--                        png_uint_16 v;
--
--                        v = gamma_16[*(sp + 1) >> gamma_shift][*sp];
--                        *sp = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(v & 0xff);
--
--                        v = gamma_16[*(sp + 3) >> gamma_shift][*(sp + 2)];
--                        *(sp + 2) = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 3) = (png_byte)(v & 0xff);
--
--                        v = gamma_16[*(sp + 5) >> gamma_shift][*(sp + 4)];
--                        *(sp + 4) = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 5) = (png_byte)(v & 0xff);
--                     }
--
--                     else if (a == 0)
--                     {
--                        /* Background is already in screen gamma */
--                        *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
--                        *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
--                                & 0xff);
--                        *(sp + 3) = (png_byte)(png_ptr->background.green
--                                & 0xff);
--                        *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
--                                & 0xff);
--                        *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
--                     }
--
--                     else
--                     {
--                        png_uint_16 v, w;
--
--                        v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
--                        png_composite_16(w, v, a, png_ptr->background_1.red);
--                        if (optimize == 0)
--                           w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
--                                8];
--                        *sp = (png_byte)((w >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(w & 0xff);
--
--                        v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
--                        png_composite_16(w, v, a, png_ptr->background_1.green);
--                        if (optimize == 0)
--                           w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
--                                8];
--
--                        *(sp + 2) = (png_byte)((w >> 8) & 0xff);
--                        *(sp + 3) = (png_byte)(w & 0xff);
--
--                        v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
--                        png_composite_16(w, v, a, png_ptr->background_1.blue);
--                        if (optimize == 0)
--                           w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
--                                8];
--
--                        *(sp + 4) = (png_byte)((w >> 8) & 0xff);
--                        *(sp + 5) = (png_byte)(w & 0xff);
--                     }
-+                     *sp = (png_byte)((png_ptr->background.gray >> 8)
-+                             & 0xff);
-+                     *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
-+                  }
-+
-+                  else if (a < 0xffff)
-+                  {
-+                     png_uint_16 g, v;
-+
-+                     g = (png_uint_16)(((*sp) << 8) + *(sp + 1));
-+                     png_composite_16(v, g, a, png_ptr->background.gray);
-+                     *sp = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(v & 0xff);
-                   }
-                }
--
--               else
--#endif
-+            }
-+         }
-+         break;
-+      }
-+
-+      case PNG_COLOR_TYPE_RGB_ALPHA:
-+      {
-+         if (row_info->bit_depth == 8)
-+         {
-+#ifdef PNG_READ_GAMMA_SUPPORTED
-+            if (gamma_to_1 != NULL && gamma_from_1 != NULL &&
-+                gamma_table != NULL)
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 4)
-                {
--                  sp = row;
--                  for (i = 0; i < row_width; i++, sp += 8)
-+                  png_byte a = *(sp + 3);
-+
-+                  if (a == 0xff)
-+                  {
-+                     *sp = gamma_table[*sp];
-+                     *(sp + 1) = gamma_table[*(sp + 1)];
-+                     *(sp + 2) = gamma_table[*(sp + 2)];
-+                  }
-+
-+                  else if (a == 0)
-+                  {
-+                     /* Background is already in screen gamma */
-+                     *sp = (png_byte)png_ptr->background.red;
-+                     *(sp + 1) = (png_byte)png_ptr->background.green;
-+                     *(sp + 2) = (png_byte)png_ptr->background.blue;
-+                  }
-+
-+                  else
-                   {
--                     png_uint_16 a = (png_uint_16)(((png_uint_16)(*(sp + 6))
--                         << 8) + (png_uint_16)(*(sp + 7)));
--
--                     if (a == 0)
--                     {
--                        *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
--                        *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
--                                & 0xff);
--                        *(sp + 3) = (png_byte)(png_ptr->background.green
--                                & 0xff);
--                        *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
--                                & 0xff);
--                        *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
--                     }
--
--                     else if (a < 0xffff)
--                     {
--                        png_uint_16 v;
--
--                        png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1));
--                        png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8)
--                            + *(sp + 3));
--                        png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8)
--                            + *(sp + 5));
--
--                        png_composite_16(v, r, a, png_ptr->background.red);
--                        *sp = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 1) = (png_byte)(v & 0xff);
--
--                        png_composite_16(v, g, a, png_ptr->background.green);
--                        *(sp + 2) = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 3) = (png_byte)(v & 0xff);
--
--                        png_composite_16(v, b, a, png_ptr->background.blue);
--                        *(sp + 4) = (png_byte)((v >> 8) & 0xff);
--                        *(sp + 5) = (png_byte)(v & 0xff);
--                     }
-+                     png_byte v, w;
-+
-+                     v = gamma_to_1[*sp];
-+                     png_composite(w, v, a, png_ptr->background_1.red);
-+                     if (optimize == 0) w = gamma_from_1[w];
-+                     *sp = w;
-+
-+                     v = gamma_to_1[*(sp + 1)];
-+                     png_composite(w, v, a, png_ptr->background_1.green);
-+                     if (optimize == 0) w = gamma_from_1[w];
-+                     *(sp + 1) = w;
-+
-+                     v = gamma_to_1[*(sp + 2)];
-+                     png_composite(w, v, a, png_ptr->background_1.blue);
-+                     if (optimize == 0) w = gamma_from_1[w];
-+                     *(sp + 2) = w;
-+                  }
-+               }
-+            }
-+            else
-+#endif
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 4)
-+               {
-+                  png_byte a = *(sp + 3);
-+
-+                  if (a == 0)
-+                  {
-+                     *sp = (png_byte)png_ptr->background.red;
-+                     *(sp + 1) = (png_byte)png_ptr->background.green;
-+                     *(sp + 2) = (png_byte)png_ptr->background.blue;
-+                  }
-+
-+                  else if (a < 0xff)
-+                  {
-+                     png_composite(*sp, *sp, a, png_ptr->background.red);
-+
-+                     png_composite(*(sp + 1), *(sp + 1), a,
-+                         png_ptr->background.green);
-+
-+                     png_composite(*(sp + 2), *(sp + 2), a,
-+                         png_ptr->background.blue);
-                   }
-                }
-             }
--            break;
-          }
--
--         default:
--            break;
-+         else /* if (row_info->bit_depth == 16) */
-+         {
-+#ifdef PNG_READ_GAMMA_SUPPORTED
-+            if (gamma_16 != NULL && gamma_16_from_1 != NULL &&
-+                gamma_16_to_1 != NULL)
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 8)
-+               {
-+                  png_uint_16 a = (png_uint_16)(((png_uint_16)(*(sp + 6))
-+                      << 8) + (png_uint_16)(*(sp + 7)));
-+
-+                  if (a == (png_uint_16)0xffff)
-+                  {
-+                     png_uint_16 v;
-+
-+                     v = gamma_16[*(sp + 1) >> gamma_shift][*sp];
-+                     *sp = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(v & 0xff);
-+
-+                     v = gamma_16[*(sp + 3) >> gamma_shift][*(sp + 2)];
-+                     *(sp + 2) = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 3) = (png_byte)(v & 0xff);
-+
-+                     v = gamma_16[*(sp + 5) >> gamma_shift][*(sp + 4)];
-+                     *(sp + 4) = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 5) = (png_byte)(v & 0xff);
-+                  }
-+
-+                  else if (a == 0)
-+                  {
-+                     /* Background is already in screen gamma */
-+                     *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
-+                     *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
-+                             & 0xff);
-+                     *(sp + 3) = (png_byte)(png_ptr->background.green
-+                             & 0xff);
-+                     *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
-+                             & 0xff);
-+                     *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
-+                  }
-+
-+                  else
-+                  {
-+                     png_uint_16 v, w;
-+
-+                     v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
-+                     png_composite_16(w, v, a, png_ptr->background_1.red);
-+                     if (optimize == 0)
-+                        w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
-+                             8];
-+                     *sp = (png_byte)((w >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(w & 0xff);
-+
-+                     v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
-+                     png_composite_16(w, v, a, png_ptr->background_1.green);
-+                     if (optimize == 0)
-+                        w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
-+                             8];
-+
-+                     *(sp + 2) = (png_byte)((w >> 8) & 0xff);
-+                     *(sp + 3) = (png_byte)(w & 0xff);
-+
-+                     v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
-+                     png_composite_16(w, v, a, png_ptr->background_1.blue);
-+                     if (optimize == 0)
-+                        w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
-+                             8];
-+
-+                     *(sp + 4) = (png_byte)((w >> 8) & 0xff);
-+                     *(sp + 5) = (png_byte)(w & 0xff);
-+                  }
-+               }
-+            }
-+
-+            else
-+#endif
-+            {
-+               sp = row;
-+               for (i = 0; i < row_width; i++, sp += 8)
-+               {
-+                  png_uint_16 a = (png_uint_16)(((png_uint_16)(*(sp + 6))
-+                      << 8) + (png_uint_16)(*(sp + 7)));
-+
-+                  if (a == 0)
-+                  {
-+                     *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
-+                     *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
-+                             & 0xff);
-+                     *(sp + 3) = (png_byte)(png_ptr->background.green
-+                             & 0xff);
-+                     *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
-+                             & 0xff);
-+                     *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
-+                  }
-+
-+                  else if (a < 0xffff)
-+                  {
-+                     png_uint_16 v;
-+
-+                     png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1));
-+                     png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8)
-+                         + *(sp + 3));
-+                     png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8)
-+                         + *(sp + 5));
-+
-+                     png_composite_16(v, r, a, png_ptr->background.red);
-+                     *sp = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 1) = (png_byte)(v & 0xff);
-+
-+                     png_composite_16(v, g, a, png_ptr->background.green);
-+                     *(sp + 2) = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 3) = (png_byte)(v & 0xff);
-+
-+                     png_composite_16(v, b, a, png_ptr->background.blue);
-+                     *(sp + 4) = (png_byte)((v >> 8) & 0xff);
-+                     *(sp + 5) = (png_byte)(v & 0xff);
-+                  }
-+               }
-+            }
-+         }
-+         break;
-       }
-+
-+      default:
-+         break;
-    }
- }
- #endif /* READ_BACKGROUND || READ_ALPHA_MODE */
- 
- #ifdef PNG_READ_GAMMA_SUPPORTED
- /* Gamma correct the image, avoiding the alpha channel.  Make sure
-  * you do this after you deal with the transparency issue on grayscale
-  * or RGB images. If your bit depth is 8, use gamma_table, if it
-@@ -4215,18 +4212,18 @@ png_do_expand_palette(png_row_infop row_
-    if (row_info->color_type == PNG_COLOR_TYPE_PALETTE)
-    {
-       if (row_info->bit_depth < 8)
-       {
-          switch (row_info->bit_depth)
-          {
-             case 1:
-             {
--               sp = row + (png_size_t)((row_width - 1) >> 3);
--               dp = row + (png_size_t)row_width - 1;
-+               sp = row + (size_t)((row_width - 1) >> 3);
-+               dp = row + (size_t)row_width - 1;
-                shift = 7 - (int)((row_width + 7) & 0x07);
-                for (i = 0; i < row_width; i++)
-                {
-                   if ((*sp >> shift) & 0x01)
-                      *dp = 1;
- 
-                   else
-                      *dp = 0;
-@@ -4242,18 +4239,18 @@ png_do_expand_palette(png_row_infop row_
- 
-                   dp--;
-                }
-                break;
-             }
- 
-             case 2:
-             {
--               sp = row + (png_size_t)((row_width - 1) >> 2);
--               dp = row + (png_size_t)row_width - 1;
-+               sp = row + (size_t)((row_width - 1) >> 2);
-+               dp = row + (size_t)row_width - 1;
-                shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
-                for (i = 0; i < row_width; i++)
-                {
-                   value = (*sp >> shift) & 0x03;
-                   *dp = (png_byte)value;
-                   if (shift == 6)
-                   {
-                      shift = 0;
-@@ -4265,18 +4262,18 @@ png_do_expand_palette(png_row_infop row_
- 
-                   dp--;
-                }
-                break;
-             }
- 
-             case 4:
-             {
--               sp = row + (png_size_t)((row_width - 1) >> 1);
--               dp = row + (png_size_t)row_width - 1;
-+               sp = row + (size_t)((row_width - 1) >> 1);
-+               dp = row + (size_t)row_width - 1;
-                shift = (int)((row_width & 0x01) << 2);
-                for (i = 0; i < row_width; i++)
-                {
-                   value = (*sp >> shift) & 0x0f;
-                   *dp = (png_byte)value;
-                   if (shift == 4)
-                   {
-                      shift = 0;
-@@ -4299,18 +4296,18 @@ png_do_expand_palette(png_row_infop row_
-          row_info->rowbytes = row_width;
-       }
- 
-       if (row_info->bit_depth == 8)
-       {
-          {
-             if (num_trans > 0)
-             {
--               sp = row + (png_size_t)row_width - 1;
--               dp = row + ((png_size_t)row_width << 2) - 1;
-+               sp = row + (size_t)row_width - 1;
-+               dp = row + ((size_t)row_width << 2) - 1;
- 
-                for (i = 0; i < row_width; i++)
-                {
-                   if ((int)(*sp) >= num_trans)
-                      *dp-- = 0xff;
- 
-                   else
-                      *dp-- = trans_alpha[*sp];
-@@ -4324,18 +4321,18 @@ png_do_expand_palette(png_row_infop row_
-                row_info->pixel_depth = 32;
-                row_info->rowbytes = row_width * 4;
-                row_info->color_type = 6;
-                row_info->channels = 4;
-             }
- 
-             else
-             {
--               sp = row + (png_size_t)row_width - 1;
--               dp = row + (png_size_t)(row_width * 3) - 1;
-+               sp = row + (size_t)row_width - 1;
-+               dp = row + (size_t)(row_width * 3) - 1;
- 
-                for (i = 0; i < row_width; i++)
-                {
-                   *dp-- = palette[*sp].blue;
-                   *dp-- = palette[*sp].green;
-                   *dp-- = palette[*sp].red;
-                   sp--;
-                }
-@@ -4360,229 +4357,227 @@ png_do_expand(png_row_infop row_info, pn
- {
-    int shift, value;
-    png_bytep sp, dp;
-    png_uint_32 i;
-    png_uint_32 row_width=row_info->width;
- 
-    png_debug(1, "in png_do_expand");
- 
-+   if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
-    {
--      if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
-+      unsigned int gray = trans_color != NULL ? trans_color->gray : 0;
-+
-+      if (row_info->bit_depth < 8)
-       {
--         unsigned int gray = trans_color != NULL ? trans_color->gray : 0;
--
--         if (row_info->bit_depth < 8)
-+         switch (row_info->bit_depth)
-          {
--            switch (row_info->bit_depth)
-+            case 1:
-             {
--               case 1:
--               {
--                  gray = (gray & 0x01) * 0xff;
--                  sp = row + (png_size_t)((row_width - 1) >> 3);
--                  dp = row + (png_size_t)row_width - 1;
--                  shift = 7 - (int)((row_width + 7) & 0x07);
--                  for (i = 0; i < row_width; i++)
--                  {
--                     if ((*sp >> shift) & 0x01)
--                        *dp = 0xff;
--
--                     else
--                        *dp = 0;
--
--                     if (shift == 7)
--                     {
--                        shift = 0;
--                        sp--;
--                     }
--
--                     else
--                        shift++;
--
--                     dp--;
--                  }
--                  break;
--               }
--
--               case 2:
--               {
--                  gray = (gray & 0x03) * 0x55;
--                  sp = row + (png_size_t)((row_width - 1) >> 2);
--                  dp = row + (png_size_t)row_width - 1;
--                  shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
--                  for (i = 0; i < row_width; i++)
--                  {
--                     value = (*sp >> shift) & 0x03;
--                     *dp = (png_byte)(value | (value << 2) | (value << 4) |
--                        (value << 6));
--                     if (shift == 6)
--                     {
--                        shift = 0;
--                        sp--;
--                     }
--
--                     else
--                        shift += 2;
--
--                     dp--;
--                  }
--                  break;
--               }
--
--               case 4:
--               {
--                  gray = (gray & 0x0f) * 0x11;
--                  sp = row + (png_size_t)((row_width - 1) >> 1);
--                  dp = row + (png_size_t)row_width - 1;
--                  shift = (int)((1 - ((row_width + 1) & 0x01)) << 2);
--                  for (i = 0; i < row_width; i++)
--                  {
--                     value = (*sp >> shift) & 0x0f;
--                     *dp = (png_byte)(value | (value << 4));
--                     if (shift == 4)
--                     {
--                        shift = 0;
--                        sp--;
--                     }
--
--                     else
--                        shift = 4;
--
--                     dp--;
--                  }
--                  break;
--               }
--
--               default:
--                  break;
--            }
--
--            row_info->bit_depth = 8;
--            row_info->pixel_depth = 8;
--            row_info->rowbytes = row_width;
--         }
--
--         if (trans_color != NULL)
--         {
--            if (row_info->bit_depth == 8)
--            {
--               gray = gray & 0xff;
--               sp = row + (png_size_t)row_width - 1;
--               dp = row + ((png_size_t)row_width << 1) - 1;
--
-+               gray = (gray & 0x01) * 0xff;
-+               sp = row + (size_t)((row_width - 1) >> 3);
-+               dp = row + (size_t)row_width - 1;
-+               shift = 7 - (int)((row_width + 7) & 0x07);
-                for (i = 0; i < row_width; i++)
-                {
--                  if ((*sp & 0xffU) == gray)
--                     *dp-- = 0;
-+                  if ((*sp >> shift) & 0x01)
-+                     *dp = 0xff;
- 
-                   else
--                     *dp-- = 0xff;
--
--                  *dp-- = *sp--;
--               }
--            }
--
--            else if (row_info->bit_depth == 16)
--            {
--               unsigned int gray_high = (gray >> 8) & 0xff;
--               unsigned int gray_low = gray & 0xff;
--               sp = row + row_info->rowbytes - 1;
--               dp = row + (row_info->rowbytes << 1) - 1;
--               for (i = 0; i < row_width; i++)
--               {
--                  if ((*(sp - 1) & 0xffU) == gray_high &&
--                      (*(sp) & 0xffU) == gray_low)
-+                     *dp = 0;
-+
-+                  if (shift == 7)
-                   {
--                     *dp-- = 0;
--                     *dp-- = 0;
-+                     shift = 0;
-+                     sp--;
-                   }
- 
-                   else
-+                     shift++;
-+
-+                  dp--;
-+               }
-+               break;
-+            }
-+
-+            case 2:
-+            {
-+               gray = (gray & 0x03) * 0x55;
-+               sp = row + (size_t)((row_width - 1) >> 2);
-+               dp = row + (size_t)row_width - 1;
-+               shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
-+               for (i = 0; i < row_width; i++)
-+               {
-+                  value = (*sp >> shift) & 0x03;
-+                  *dp = (png_byte)(value | (value << 2) | (value << 4) |
-+                     (value << 6));
-+                  if (shift == 6)
-                   {
--                     *dp-- = 0xff;
--                     *dp-- = 0xff;
-+                     shift = 0;
-+                     sp--;
-                   }
- 
--                  *dp-- = *sp--;
--                  *dp-- = *sp--;
-+                  else
-+                     shift += 2;
-+
-+                  dp--;
-                }
-+               break;
-             }
- 
--            row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
--            row_info->channels = 2;
--            row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1);
--            row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
--                row_width);
-+            case 4:
-+            {
-+               gray = (gray & 0x0f) * 0x11;
-+               sp = row + (size_t)((row_width - 1) >> 1);
-+               dp = row + (size_t)row_width - 1;
-+               shift = (int)((1 - ((row_width + 1) & 0x01)) << 2);
-+               for (i = 0; i < row_width; i++)
-+               {
-+                  value = (*sp >> shift) & 0x0f;
-+                  *dp = (png_byte)(value | (value << 4));
-+                  if (shift == 4)
-+                  {
-+                     shift = 0;
-+                     sp--;
-+                  }
-+
-+                  else
-+                     shift = 4;
-+
-+                  dp--;
-+               }
-+               break;
-+            }
-+
-+            default:
-+               break;
-          }
-+
-+         row_info->bit_depth = 8;
-+         row_info->pixel_depth = 8;
-+         row_info->rowbytes = row_width;
-       }
--      else if (row_info->color_type == PNG_COLOR_TYPE_RGB &&
--          trans_color != NULL)
-+
-+      if (trans_color != NULL)
-       {
-          if (row_info->bit_depth == 8)
-          {
--            png_byte red = (png_byte)(trans_color->red & 0xff);
--            png_byte green = (png_byte)(trans_color->green & 0xff);
--            png_byte blue = (png_byte)(trans_color->blue & 0xff);
--            sp = row + (png_size_t)row_info->rowbytes - 1;
--            dp = row + ((png_size_t)row_width << 2) - 1;
-+            gray = gray & 0xff;
-+            sp = row + (size_t)row_width - 1;
-+            dp = row + ((size_t)row_width << 1) - 1;
-+
-             for (i = 0; i < row_width; i++)
-             {
--               if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue)
-+               if ((*sp & 0xffU) == gray)
-                   *dp-- = 0;
- 
-                else
-                   *dp-- = 0xff;
- 
-                *dp-- = *sp--;
--               *dp-- = *sp--;
--               *dp-- = *sp--;
-             }
-          }
-+
-          else if (row_info->bit_depth == 16)
-          {
--            png_byte red_high = (png_byte)((trans_color->red >> 8) & 0xff);
--            png_byte green_high = (png_byte)((trans_color->green >> 8) & 0xff);
--            png_byte blue_high = (png_byte)((trans_color->blue >> 8) & 0xff);
--            png_byte red_low = (png_byte)(trans_color->red & 0xff);
--            png_byte green_low = (png_byte)(trans_color->green & 0xff);
--            png_byte blue_low = (png_byte)(trans_color->blue & 0xff);
-+            unsigned int gray_high = (gray >> 8) & 0xff;
-+            unsigned int gray_low = gray & 0xff;
-             sp = row + row_info->rowbytes - 1;
--            dp = row + ((png_size_t)row_width << 3) - 1;
-+            dp = row + (row_info->rowbytes << 1) - 1;
-             for (i = 0; i < row_width; i++)
-             {
--               if (*(sp - 5) == red_high &&
--                   *(sp - 4) == red_low &&
--                   *(sp - 3) == green_high &&
--                   *(sp - 2) == green_low &&
--                   *(sp - 1) == blue_high &&
--                   *(sp    ) == blue_low)
-+               if ((*(sp - 1) & 0xffU) == gray_high &&
-+                   (*(sp) & 0xffU) == gray_low)
-                {
-                   *dp-- = 0;
-                   *dp-- = 0;
-                }
- 
-                else
-                {
-                   *dp-- = 0xff;
-                   *dp-- = 0xff;
-                }
- 
-                *dp-- = *sp--;
-                *dp-- = *sp--;
--               *dp-- = *sp--;
--               *dp-- = *sp--;
--               *dp-- = *sp--;
--               *dp-- = *sp--;
-             }
-          }
--         row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
--         row_info->channels = 4;
--         row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2);
--         row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
-+
-+         row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
-+         row_info->channels = 2;
-+         row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1);
-+         row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
-+             row_width);
-+      }
-+   }
-+   else if (row_info->color_type == PNG_COLOR_TYPE_RGB &&
-+       trans_color != NULL)
-+   {
-+      if (row_info->bit_depth == 8)
-+      {
-+         png_byte red = (png_byte)(trans_color->red & 0xff);
-+         png_byte green = (png_byte)(trans_color->green & 0xff);
-+         png_byte blue = (png_byte)(trans_color->blue & 0xff);
-+         sp = row + (size_t)row_info->rowbytes - 1;
-+         dp = row + ((size_t)row_width << 2) - 1;
-+         for (i = 0; i < row_width; i++)
-+         {
-+            if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue)
-+               *dp-- = 0;
-+
-+            else
-+               *dp-- = 0xff;
-+
-+            *dp-- = *sp--;
-+            *dp-- = *sp--;
-+            *dp-- = *sp--;
-+         }
-       }
-+      else if (row_info->bit_depth == 16)
-+      {
-+         png_byte red_high = (png_byte)((trans_color->red >> 8) & 0xff);
-+         png_byte green_high = (png_byte)((trans_color->green >> 8) & 0xff);
-+         png_byte blue_high = (png_byte)((trans_color->blue >> 8) & 0xff);
-+         png_byte red_low = (png_byte)(trans_color->red & 0xff);
-+         png_byte green_low = (png_byte)(trans_color->green & 0xff);
-+         png_byte blue_low = (png_byte)(trans_color->blue & 0xff);
-+         sp = row + row_info->rowbytes - 1;
-+         dp = row + ((size_t)row_width << 3) - 1;
-+         for (i = 0; i < row_width; i++)
-+         {
-+            if (*(sp - 5) == red_high &&
-+                *(sp - 4) == red_low &&
-+                *(sp - 3) == green_high &&
-+                *(sp - 2) == green_low &&
-+                *(sp - 1) == blue_high &&
-+                *(sp    ) == blue_low)
-+            {
-+               *dp-- = 0;
-+               *dp-- = 0;
-+            }
-+
-+            else
-+            {
-+               *dp-- = 0xff;
-+               *dp-- = 0xff;
-+            }
-+
-+            *dp-- = *sp--;
-+            *dp-- = *sp--;
-+            *dp-- = *sp--;
-+            *dp-- = *sp--;
-+            *dp-- = *sp--;
-+            *dp-- = *sp--;
-+         }
-+      }
-+      row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
-+      row_info->channels = 4;
-+      row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2);
-+      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
-    }
- }
- #endif
- 
- #ifdef PNG_READ_EXPAND_16_SUPPORTED
- /* If the bit depth is 8 and the color type is not a palette type expand the
-  * whole row to 16 bits.  Has no effect otherwise.
-  */
-@@ -4755,18 +4750,17 @@ png_do_read_transformations(png_structrp
-       else
-       {
-          if (png_ptr->num_trans != 0 &&
-              (png_ptr->transformations & PNG_EXPAND_tRNS) != 0)
-             png_do_expand(row_info, png_ptr->row_buf + 1,
-                 &(png_ptr->trans_color));
- 
-          else
--            png_do_expand(row_info, png_ptr->row_buf + 1,
--                NULL);
-+            png_do_expand(row_info, png_ptr->row_buf + 1, NULL);
-       }
-    }
- #endif
- 
- #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
-    if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0 &&
-        (png_ptr->transformations & PNG_COMPOSE) == 0 &&
-        (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
-@@ -4980,17 +4974,17 @@ png_do_read_transformations(png_structrp
- #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
-    if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
-    {
-       if (png_ptr->read_user_transform_fn != NULL)
-          (*(png_ptr->read_user_transform_fn)) /* User read transform function */
-              (png_ptr,     /* png_ptr */
-              row_info,     /* row_info: */
-                 /*  png_uint_32 width;       width of row */
--                /*  png_size_t rowbytes;     number of bytes in row */
-+                /*  size_t rowbytes;         number of bytes in row */
-                 /*  png_byte color_type;     color type of pixels */
-                 /*  png_byte bit_depth;      bit depth of samples */
-                 /*  png_byte channels;       number of channels (1-4) */
-                 /*  png_byte pixel_depth;    bits per pixel (depth*channels) */
-              png_ptr->row_buf + 1);    /* start of pixel data for row */
- #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
-       if (png_ptr->user_transform_depth != 0)
-          row_info->bit_depth = png_ptr->user_transform_depth;
-diff --git a/media/libpng/pngrutil.c b/media/libpng/pngrutil.c
---- a/media/libpng/pngrutil.c
-+++ b/media/libpng/pngrutil.c
-@@ -1,13 +1,13 @@
- 
- /* pngrutil.c - utilities to read a PNG file
-  *
-- * Last changed in libpng 1.6.33 [September 28, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file contains routines that are only called from within
-@@ -97,17 +97,17 @@ png_get_int_32)(png_const_bytep buf)
-     */
-    return 0;
- }
- 
- /* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
- png_uint_16 (PNGAPI
- png_get_uint_16)(png_const_bytep buf)
- {
--   /* ANSI-C requires an int value to accomodate at least 16 bits so this
-+   /* ANSI-C requires an int value to accommodate at least 16 bits so this
-     * works and allows the compiler not to worry about possible narrowing
-     * on 32-bit systems.  (Pre-ANSI systems did not make integers smaller
-     * than 16 bits either.)
-     */
-    unsigned int val =
-        ((unsigned int)(*buf) << 8) +
-        ((unsigned int)(*(buf + 1)));
- 
-@@ -115,17 +115,17 @@ png_get_uint_16)(png_const_bytep buf)
- }
- 
- #endif /* READ_INT_FUNCTIONS */
- 
- /* Read and check the PNG file signature */
- void /* PRIVATE */
- png_read_sig(png_structrp png_ptr, png_inforp info_ptr)
- {
--   png_size_t num_checked, num_to_check;
-+   size_t num_checked, num_to_check;
- 
-    /* Exit if the user application does not expect a signature. */
-    if (png_ptr->sig_bytes >= 8)
-       return;
- 
-    num_checked = png_ptr->sig_bytes;
-    num_to_check = 8 - num_checked;
- 
-@@ -1648,17 +1648,17 @@ png_handle_sPLT(png_structrp png_ptr, pn
- {
-    png_bytep entry_start, buffer;
-    png_sPLT_t new_palette;
-    png_sPLT_entryp pp;
-    png_uint_32 data_length;
-    int entry_size, i;
-    png_uint_32 skip = 0;
-    png_uint_32 dl;
--   png_size_t max_dl;
-+   size_t max_dl;
- 
-    png_debug(1, "in png_handle_sPLT");
- 
- #ifdef PNG_USER_LIMITS_SUPPORTED
-    if (png_ptr->user_chunk_cache_max != 0)
-    {
-       if (png_ptr->user_chunk_cache_max == 1)
-       {
-@@ -1997,25 +1997,43 @@ png_handle_bKGD(png_structrp png_ptr, pn
-       else
-          background.red = background.green = background.blue = 0;
- 
-       background.gray = 0;
-    }
- 
-    else if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0) /* GRAY */
-    {
-+      if (png_ptr->bit_depth <= 8)
-+      {
-+         if (buf[0] != 0 || buf[1] >= (unsigned int)(1 << png_ptr->bit_depth))
-+         {
-+            png_chunk_benign_error(png_ptr, "invalid gray level");
-+            return;
-+         }
-+      }
-+
-       background.index = 0;
-       background.red =
-       background.green =
-       background.blue =
-       background.gray = png_get_uint_16(buf);
-    }
- 
-    else
-    {
-+      if (png_ptr->bit_depth <= 8)
-+      {
-+         if (buf[0] != 0 || buf[2] != 0 || buf[4] != 0)
-+         {
-+            png_chunk_benign_error(png_ptr, "invalid color");
-+            return;
-+         }
-+      }
-+
-       background.index = 0;
-       background.red = png_get_uint_16(buf);
-       background.green = png_get_uint_16(buf + 2);
-       background.blue = png_get_uint_16(buf + 4);
-       background.gray = 0;
-    }
- 
-    png_set_bKGD(png_ptr, info_ptr, &background);
-@@ -2359,17 +2377,17 @@ png_handle_pCAL(png_structrp png_ptr, pn
- #endif
- 
- #ifdef PNG_READ_sCAL_SUPPORTED
- /* Read the sCAL chunk */
- void /* PRIVATE */
- png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
- {
-    png_bytep buffer;
--   png_size_t i;
-+   size_t i;
-    int state;
- 
-    png_debug(1, "in png_handle_sCAL");
- 
-    if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-       png_chunk_error(png_ptr, "missing IHDR");
- 
-    else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
-@@ -2429,17 +2447,17 @@ png_handle_sCAL(png_structrp png_ptr, pn
-        i >= length || buffer[i++] != 0)
-       png_chunk_benign_error(png_ptr, "bad width format");
- 
-    else if (PNG_FP_IS_POSITIVE(state) == 0)
-       png_chunk_benign_error(png_ptr, "non-positive width");
- 
-    else
-    {
--      png_size_t heighti = i;
-+      size_t heighti = i;
- 
-       state = 0;
-       if (png_check_fp_number((png_const_charp)buffer, length,
-           &state, &i) == 0 || i != length)
-          png_chunk_benign_error(png_ptr, "bad height format");
- 
-       else if (PNG_FP_IS_POSITIVE(state) == 0)
-          png_chunk_benign_error(png_ptr, "non-positive height");
-@@ -3041,17 +3059,17 @@ png_cache_unknown_chunk(png_structrp png
-    if (PNG_USER_CHUNK_MALLOC_MAX < limit)
-       limit = PNG_USER_CHUNK_MALLOC_MAX;
- #  endif
- 
-    if (length <= limit)
-    {
-       PNG_CSTRING_FROM_CHUNK(png_ptr->unknown_chunk.name, png_ptr->chunk_name);
-       /* The following is safe because of the PNG_SIZE_MAX init above */
--      png_ptr->unknown_chunk.size = (png_size_t)length/*SAFE*/;
-+      png_ptr->unknown_chunk.size = (size_t)length/*SAFE*/;
-       /* 'mode' is a flag array, only the bottom four bits matter here */
-       png_ptr->unknown_chunk.location = (png_byte)png_ptr->mode/*SAFE*/;
- 
-       if (length == 0)
-          png_ptr->unknown_chunk.data = NULL;
- 
-       else
-       {
-@@ -3327,20 +3345,23 @@ png_check_chunk_length(png_const_structr
- #ifdef PNG_READ_APNG_SUPPORTED
-    if (png_ptr->chunk_name == png_IDAT || png_ptr->chunk_name == png_fdAT)
- #else
-    if (png_ptr->chunk_name == png_IDAT)
- #endif
-    {
-       png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
-       size_t row_factor =
--         (png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
--          + 1 + (png_ptr->interlaced? 6: 0));
-+         (size_t)png_ptr->width
-+         * (size_t)png_ptr->channels
-+         * (png_ptr->bit_depth > 8? 2: 1)
-+         + 1
-+         + (png_ptr->interlaced? 6: 0);
-       if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
--         idat_limit=PNG_UINT_31_MAX;
-+         idat_limit = PNG_UINT_31_MAX;
-       else
-          idat_limit = png_ptr->height * row_factor;
-       row_factor = row_factor > 32566? 32566 : row_factor;
-       idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */
-       idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX;
-       limit = limit < idat_limit? idat_limit : limit;
-    }
- 
-@@ -3857,18 +3878,18 @@ png_do_read_interlace(png_row_infop row_
-       png_uint_32 final_width;
- 
-       final_width = row_info->width * png_pass_inc[pass];
- 
-       switch (row_info->pixel_depth)
-       {
-          case 1:
-          {
--            png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3);
--            png_bytep dp = row + (png_size_t)((final_width - 1) >> 3);
-+            png_bytep sp = row + (size_t)((row_info->width - 1) >> 3);
-+            png_bytep dp = row + (size_t)((final_width - 1) >> 3);
-             unsigned int sshift, dshift;
-             unsigned int s_start, s_end;
-             int s_inc;
-             int jstop = (int)png_pass_inc[pass];
-             png_byte v;
-             png_uint_32 i;
-             int j;
- 
-@@ -3984,18 +4005,18 @@ png_do_read_interlace(png_row_infop row_
-                else
-                   sshift = (unsigned int)((int)sshift + s_inc);
-             }
-             break;
-          }
- 
-          case 4:
-          {
--            png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1);
--            png_bytep dp = row + (png_size_t)((final_width - 1) >> 1);
-+            png_bytep sp = row + (size_t)((row_info->width - 1) >> 1);
-+            png_bytep dp = row + (size_t)((final_width - 1) >> 1);
-             unsigned int sshift, dshift;
-             unsigned int s_start, s_end;
-             int s_inc;
-             png_uint_32 i;
-             int jstop = (int)png_pass_inc[pass];
- 
- #ifdef PNG_READ_PACKSWAP_SUPPORTED
-             if ((transformations & PNG_PACKSWAP) != 0)
-@@ -4047,22 +4068,22 @@ png_do_read_interlace(png_row_infop row_
-                else
-                   sshift = (unsigned int)((int)sshift + s_inc);
-             }
-             break;
-          }
- 
-          default:
-          {
--            png_size_t pixel_bytes = (row_info->pixel_depth >> 3);
--
--            png_bytep sp = row + (png_size_t)(row_info->width - 1)
-+            size_t pixel_bytes = (row_info->pixel_depth >> 3);
-+
-+            png_bytep sp = row + (size_t)(row_info->width - 1)
-                 * pixel_bytes;
- 
--            png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
-+            png_bytep dp = row + (size_t)(final_width - 1) * pixel_bytes;
- 
-             int jstop = (int)png_pass_inc[pass];
-             png_uint_32 i;
- 
-             for (i = 0; i < row_info->width; i++)
-             {
-                png_byte v[8]; /* SAFE; pixel_depth does not exceed 64 */
-                int j;
-@@ -4089,55 +4110,55 @@ png_do_read_interlace(png_row_infop row_
- #endif
- }
- #endif /* READ_INTERLACING */
- 
- static void
- png_read_filter_row_sub(png_row_infop row_info, png_bytep row,
-     png_const_bytep prev_row)
- {
--   png_size_t i;
--   png_size_t istop = row_info->rowbytes;
-+   size_t i;
-+   size_t istop = row_info->rowbytes;
-    unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
-    png_bytep rp = row + bpp;
- 
-    PNG_UNUSED(prev_row)
- 
-    for (i = bpp; i < istop; i++)
-    {
-       *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff);
-       rp++;
-    }
- }
- 
- static void
- png_read_filter_row_up(png_row_infop row_info, png_bytep row,
-     png_const_bytep prev_row)
- {
--   png_size_t i;
--   png_size_t istop = row_info->rowbytes;
-+   size_t i;
-+   size_t istop = row_info->rowbytes;
-    png_bytep rp = row;
-    png_const_bytep pp = prev_row;
- 
-    for (i = 0; i < istop; i++)
-    {
-       *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
-       rp++;
-    }
- }
- 
- static void
- png_read_filter_row_avg(png_row_infop row_info, png_bytep row,
-     png_const_bytep prev_row)
- {
--   png_size_t i;
-+   size_t i;
-    png_bytep rp = row;
-    png_const_bytep pp = prev_row;
-    unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
--   png_size_t istop = row_info->rowbytes - bpp;
-+   size_t istop = row_info->rowbytes - bpp;
- 
-    for (i = 0; i < bpp; i++)
-    {
-       *rp = (png_byte)(((int)(*rp) +
-          ((int)(*pp++) / 2 )) & 0xff);
- 
-       rp++;
-    }
-@@ -4599,17 +4620,17 @@ png_read_start_row(png_structrp png_ptr)
- 
-    /* Start of interlace block in the y direction */
-    static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
- 
-    /* Offset to next interlace block in the y direction */
-    static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
- 
-    unsigned int max_pixel_depth;
--   png_size_t row_bytes;
-+   size_t row_bytes;
- 
-    png_debug(1, "in png_read_start_row");
- 
- #ifdef PNG_READ_TRANSFORMS_SUPPORTED
-    png_init_read_transformations(png_ptr);
- #endif
-    if (png_ptr->interlaced != 0)
-    {
-diff --git a/media/libpng/pngset.c b/media/libpng/pngset.c
---- a/media/libpng/pngset.c
-+++ b/media/libpng/pngset.c
-@@ -1,13 +1,13 @@
- 
- /* pngset.c - storage of image information into info struct
-  *
-- * Last changed in libpng 1.6.32 [August 24, 2017]
-- * Copyright (c) 1998-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * The functions here are used during reads to store data from the file
-@@ -313,17 +313,17 @@ png_set_oFFs(png_const_structrp png_ptr,
- #endif
- 
- #ifdef PNG_pCAL_SUPPORTED
- void PNGAPI
- png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
-     png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type,
-     int nparams, png_const_charp units, png_charpp params)
- {
--   png_size_t length;
-+   size_t length;
-    int i;
- 
-    png_debug1(1, "in %s storage function", "pCAL");
- 
-    if (png_ptr == NULL || info_ptr == NULL || purpose == NULL || units == NULL
-        || (nparams > 0 && params == NULL))
-       return;
- 
-@@ -390,17 +390,17 @@ png_set_pCAL(png_const_structrp png_ptr,
-       png_warning(png_ptr, "Insufficient memory for pCAL units");
- 
-       return;
-    }
- 
-    memcpy(info_ptr->pcal_units, units, length);
- 
-    info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
--       (png_size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp)))));
-+       (size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp)))));
- 
-    if (info_ptr->pcal_params == NULL)
-    {
-       png_warning(png_ptr, "Insufficient memory for pCAL params");
- 
-       return;
-    }
- 
-@@ -430,17 +430,17 @@ png_set_pCAL(png_const_structrp png_ptr,
- }
- #endif
- 
- #ifdef PNG_sCAL_SUPPORTED
- void PNGAPI
- png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
-     int unit, png_const_charp swidth, png_const_charp sheight)
- {
--   png_size_t lengthw = 0, lengthh = 0;
-+   size_t lengthw = 0, lengthh = 0;
- 
-    png_debug1(1, "in %s storage function", "sCAL");
- 
-    if (png_ptr == NULL || info_ptr == NULL)
-       return;
- 
-    /* Double check the unit (should never get here with an invalid
-     * unit unless this is an API call.)
-@@ -691,17 +691,17 @@ png_set_sRGB_gAMA_and_cHRM(png_const_str
- #ifdef PNG_iCCP_SUPPORTED
- void PNGAPI
- png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
-     png_const_charp name, int compression_type,
-     png_const_bytep profile, png_uint_32 proflen)
- {
-    png_charp new_iccp_name;
-    png_bytep new_iccp_profile;
--   png_size_t length;
-+   size_t length;
- 
-    png_debug1(1, "in %s storage function", "iCCP");
- 
-    if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
-       return;
- 
-    if (compression_type != PNG_COMPRESSION_TYPE_BASE)
-       png_app_error(png_ptr, "Invalid iCCP compression method");
-@@ -1018,17 +1018,17 @@ png_set_tRNS(png_structrp png_ptr, png_i
- 
-        png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
- 
-        if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
-        {
-          /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
-           info_ptr->trans_alpha = png_voidcast(png_bytep,
-               png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
--          memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
-+          memcpy(info_ptr->trans_alpha, trans_alpha, (size_t)num_trans);
-        }
-        png_ptr->trans_alpha = info_ptr->trans_alpha;
-    }
- 
-    if (trans_color != NULL)
-    {
- #ifdef PNG_WARNINGS_SUPPORTED
-       if (info_ptr->bit_depth < 16)
-@@ -1098,17 +1098,17 @@ png_set_sPLT(png_const_structrp png_ptr,
-    png_free(png_ptr, info_ptr->splt_palettes);
-    info_ptr->splt_palettes = np;
-    info_ptr->free_me |= PNG_FREE_SPLT;
- 
-    np += info_ptr->splt_palettes_num;
- 
-    do
-    {
--      png_size_t length;
-+      size_t length;
- 
-       /* Skip invalid input entries */
-       if (entries->name == NULL || entries->entries == NULL)
-       {
-          /* png_handle_sPLT doesn't do this, so this is an app error */
-          png_app_error(png_ptr, "png_set_sPLT: invalid sPLT");
-          /* Just skip the invalid entry */
-          continue;
-@@ -1703,17 +1703,17 @@ png_set_rows(png_const_structrp png_ptr,
-    info_ptr->row_pointers = row_pointers;
- 
-    if (row_pointers != NULL)
-       info_ptr->valid |= PNG_INFO_IDAT;
- }
- #endif
- 
- void PNGAPI
--png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
-+png_set_compression_buffer_size(png_structrp png_ptr, size_t size)
- {
-    if (png_ptr == NULL)
-       return;
- 
-    if (size == 0 || size > PNG_UINT_31_MAX)
-       png_error(png_ptr, "invalid compression buffer size");
- 
- #  ifdef PNG_SEQUENTIAL_READ_SUPPORTED
-diff --git a/media/libpng/pngstruct.h b/media/libpng/pngstruct.h
---- a/media/libpng/pngstruct.h
-+++ b/media/libpng/pngstruct.h
-@@ -1,13 +1,13 @@
- 
- /* pngstruct.h - header file for PNG reference library
-  *
-- * Last changed in libpng 1.6.32 [August 24, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
-@@ -42,17 +42,17 @@
- #else
- #  define PNGZ_MSG_CAST(s) (s)
- #  define PNGZ_INPUT_CAST(b) (b)
- #endif
- 
- /* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
-  * can handle at once.  This type need be no larger than 16 bits (so maximum of
-  * 65535), this define allows us to discover how big it is, but limited by the
-- * maximuum for png_size_t.  The value can be overriden in a library build
-+ * maximum for size_t.  The value can be overridden in a library build
-  * (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
-  * lower value (e.g. 255 works).  A lower value may help memory usage (slightly)
-  * and may even improve performance on some systems (and degrade it on others.)
-  */
- #ifndef ZLIB_IO_MAX
- #  define ZLIB_IO_MAX ((uInt)-1)
- #endif
- 
-@@ -209,17 +209,17 @@ struct png_struct_def
-    int zlib_set_mem_level;
-    int zlib_set_strategy;
- #endif
- 
-    png_uint_32 width;         /* width of image in pixels */
-    png_uint_32 height;        /* height of image in pixels */
-    png_uint_32 num_rows;      /* number of rows in current pass */
-    png_uint_32 usr_width;     /* width of row at start of write */
--   png_size_t rowbytes;       /* size of row in bytes */
-+   size_t rowbytes;           /* size of row in bytes */
-    png_uint_32 iwidth;        /* width of current interlaced row in pixels */
-    png_uint_32 row_number;    /* current row in interlace pass */
-    png_uint_32 chunk_name;    /* PNG_CHUNK() id of current chunk */
-    png_bytep prev_row;        /* buffer to save previous (unfiltered) row.
-                                * While reading this is a pointer into
-                                * big_prev_row; while writing it is separately
-                                * allocated if needed.
-                                */
-@@ -227,17 +227,17 @@ struct png_struct_def
-                                * While reading, this is a pointer into
-                                * big_row_buf; while writing it is separately
-                                * allocated.
-                                */
- #ifdef PNG_WRITE_FILTER_SUPPORTED
-    png_bytep try_row;    /* buffer to save trial row when filtering */
-    png_bytep tst_row;    /* buffer to save best trial row when filtering */
- #endif
--   png_size_t info_rowbytes;  /* Added in 1.5.4: cache of updated row bytes */
-+   size_t info_rowbytes;      /* Added in 1.5.4: cache of updated row bytes */
- 
-    png_uint_32 idat_size;     /* current IDAT size for read */
-    png_uint_32 crc;           /* current chunk CRC value */
-    png_colorp palette;        /* palette from the input file */
-    png_uint_16 num_palette;   /* number of color entries in palette */
- 
- /* Added at libpng-1.5.10 */
- #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
-@@ -302,17 +302,17 @@ struct png_struct_def
- #endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
- #endif
- 
- #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
-    png_color_8 sig_bit;       /* significant bits in each available channel */
- #endif
- 
- #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
--   png_color_8 shift;         /* shift for significant bit tranformation */
-+   png_color_8 shift;         /* shift for significant bit transformation */
- #endif
- 
- #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
-  || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
-    png_bytep trans_alpha;           /* alpha values for paletted files */
-    png_color_16 trans_color;  /* transparent color for non-paletted files */
- #endif
- 
-@@ -323,20 +323,20 @@ struct png_struct_def
-    png_progressive_row_ptr row_fn;   /* called after a prog. row is decoded */
-    png_progressive_end_ptr end_fn;   /* called after image is complete */
-    png_bytep save_buffer_ptr;        /* current location in save_buffer */
-    png_bytep save_buffer;            /* buffer for previously read data */
-    png_bytep current_buffer_ptr;     /* current location in current_buffer */
-    png_bytep current_buffer;         /* buffer for recently used data */
-    png_uint_32 push_length;          /* size of current input chunk */
-    png_uint_32 skip_length;          /* bytes to skip in input data */
--   png_size_t save_buffer_size;      /* amount of data now in save_buffer */
--   png_size_t save_buffer_max;       /* total size of save_buffer */
--   png_size_t buffer_size;           /* total amount of available input data */
--   png_size_t current_buffer_size;   /* amount of data now in current_buffer */
-+   size_t save_buffer_size;          /* amount of data now in save_buffer */
-+   size_t save_buffer_max;           /* total size of save_buffer */
-+   size_t buffer_size;               /* total amount of available input data */
-+   size_t current_buffer_size;       /* amount of data now in current_buffer */
-    int process_mode;                 /* what push library is currently doing */
-    int cur_palette;                  /* current push library palette index */
- 
- #endif /* PROGRESSIVE_READ */
- 
- #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
- /* For the Borland special 64K segment handler */
-    png_bytepp offset_table_ptr;
-@@ -467,17 +467,17 @@ struct png_struct_def
- #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
-    /* Temporary storage for unknown chunk that the library doesn't recognize,
-     * used while reading the chunk.
-     */
-    png_unknown_chunk unknown_chunk;
- #endif
- 
- /* New member added in libpng-1.2.26 */
--  png_size_t old_big_row_buf_size;
-+   size_t old_big_row_buf_size;
- 
- #ifdef PNG_READ_SUPPORTED
- /* New member added in libpng-1.2.30 */
-   png_bytep        read_buffer;      /* buffer for reading chunk data */
-   png_alloc_size_t read_buffer_size; /* current size of the buffer */
- #endif
- #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
-   uInt             IDAT_read_size;   /* limit on read buffer size for IDAT */
-diff --git a/media/libpng/pngtrans.c b/media/libpng/pngtrans.c
---- a/media/libpng/pngtrans.c
-+++ b/media/libpng/pngtrans.c
-@@ -1,13 +1,13 @@
- 
- /* pngtrans.c - transforms the data in a row (used by both readers and writers)
-  *
-- * Last changed in libpng 1.6.33 [September 28, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
-@@ -264,47 +264,47 @@ png_do_invert(png_row_infop row_info, pn
-    png_debug(1, "in png_do_invert");
- 
-   /* This test removed from libpng version 1.0.13 and 1.2.0:
-    *   if (row_info->bit_depth == 1 &&
-    */
-    if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
-    {
-       png_bytep rp = row;
--      png_size_t i;
--      png_size_t istop = row_info->rowbytes;
-+      size_t i;
-+      size_t istop = row_info->rowbytes;
- 
-       for (i = 0; i < istop; i++)
-       {
-          *rp = (png_byte)(~(*rp));
-          rp++;
-       }
-    }
- 
-    else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
-       row_info->bit_depth == 8)
-    {
-       png_bytep rp = row;
--      png_size_t i;
--      png_size_t istop = row_info->rowbytes;
-+      size_t i;
-+      size_t istop = row_info->rowbytes;
- 
-       for (i = 0; i < istop; i += 2)
-       {
-          *rp = (png_byte)(~(*rp));
-          rp += 2;
-       }
-    }
- 
- #ifdef PNG_16BIT_SUPPORTED
-    else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
-       row_info->bit_depth == 16)
-    {
-       png_bytep rp = row;
--      png_size_t i;
--      png_size_t istop = row_info->rowbytes;
-+      size_t i;
-+      size_t istop = row_info->rowbytes;
- 
-       for (i = 0; i < istop; i += 4)
-       {
-          *rp = (png_byte)(~(*rp));
-          *(rp + 1) = (png_byte)(~(*(rp + 1)));
-          rp += 4;
-       }
-    }
-@@ -604,17 +604,17 @@ png_do_strip_channel(png_row_infop row_i
-       if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
-          row_info->color_type = PNG_COLOR_TYPE_RGB;
-    }
- 
-    else
-       return; /* The filler channel has gone already */
- 
-    /* Fix the rowbytes value. */
--   row_info->rowbytes = (png_size_t)(dp-row);
-+   row_info->rowbytes = (size_t)(dp-row);
- }
- #endif
- 
- #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
- /* Swaps red and blue bytes within a pixel */
- void /* PRIVATE */
- png_do_bgr(png_row_infop row_info, png_bytep row)
- {
-diff --git a/media/libpng/pngwio.c b/media/libpng/pngwio.c
---- a/media/libpng/pngwio.c
-+++ b/media/libpng/pngwio.c
-@@ -1,13 +1,13 @@
- 
- /* pngwio.c - functions for data output
-  *
-- * Last changed in libpng 1.6.24 [August 4, 2016]
-- * Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2014,2016,2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file provides a location for all output.  Users who need
-@@ -25,17 +25,17 @@
- /* Write the data to whatever output you are using.  The default routine
-  * writes to a file pointer.  Note that this routine sometimes gets called
-  * with very small lengths, so you should implement some kind of simple
-  * buffering if you are using unbuffered writes.  This should never be asked
-  * to write more than 64K on a 16-bit machine.
-  */
- 
- void /* PRIVATE */
--png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length)
-+png_write_data(png_structrp png_ptr, png_const_bytep data, size_t length)
- {
-    /* NOTE: write_data_fn must not change the buffer! */
-    if (png_ptr->write_data_fn != NULL )
-       (*(png_ptr->write_data_fn))(png_ptr, png_constcast(png_bytep,data),
-           length);
- 
-    else
-       png_error(png_ptr, "Call to NULL write function");
-@@ -43,19 +43,19 @@ png_write_data(png_structrp png_ptr, png
- 
- #ifdef PNG_STDIO_SUPPORTED
- /* This is the function that does the actual writing of data.  If you are
-  * not writing to a standard C stream, you should create a replacement
-  * write_data function and use it at run time with png_set_write_fn(), rather
-  * than changing the library.
-  */
- void PNGCBAPI
--png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
-+png_default_write_data(png_structp png_ptr, png_bytep data, size_t length)
- {
--   png_size_t check;
-+   size_t check;
- 
-    if (png_ptr == NULL)
-       return;
- 
-    check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
- 
-    if (check != length)
-       png_error(png_ptr, "Write Error");
-diff --git a/media/libpng/pngwrite.c b/media/libpng/pngwrite.c
---- a/media/libpng/pngwrite.c
-+++ b/media/libpng/pngwrite.c
-@@ -1,13 +1,13 @@
- 
- /* pngwrite.c - general routines to write a PNG file
-  *
-- * Last changed in libpng 1.6.32 [August 24, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
-@@ -1640,17 +1640,17 @@ png_write_image_16bit(png_voidp argument
- /* Given 16-bit input (1 to 4 channels) write 8-bit output.  If an alpha channel
-  * is present it must be removed from the components, the components are then
-  * written in sRGB encoding.  No components are added or removed.
-  *
-  * Calculate an alpha reciprocal to reverse pre-multiplication.  As above the
-  * calculation can be done to 15 bits of accuracy; however, the output needs to
-  * be scaled in the range 0..255*65535, so include that scaling here.
-  */
--#   define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+(alpha>>1))/alpha)
-+#   define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+((alpha)>>1))/(alpha))
- 
- static png_byte
- png_unpremultiply(png_uint_32 component, png_uint_32 alpha,
-     png_uint_32 reciprocal/*from the above macro*/)
- {
-    /* The following gives 1.0 for an alpha of 0, which is fine, otherwise if 0/0
-     * is represented as some other value there is more likely to be a
-     * discontinuity which will probably damage compression when moving from a
-@@ -2166,18 +2166,17 @@ png_image_write_main(png_voidp argument)
-    }
- 
-    png_write_end(png_ptr, info_ptr);
-    return 1;
- }
- 
- 
- static void (PNGCBAPI
--image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data,
--    png_size_t size)
-+image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data, size_t size)
- {
-    png_image_write_control *display = png_voidcast(png_image_write_control*,
-        png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/);
-    const png_alloc_size_t ob = display->output_bytes;
- 
-    /* Check for overflow; this should never happen: */
-    if (size <= ((png_alloc_size_t)-1) - ob)
-    {
-diff --git a/media/libpng/pngwtran.c b/media/libpng/pngwtran.c
---- a/media/libpng/pngwtran.c
-+++ b/media/libpng/pngwtran.c
-@@ -1,13 +1,13 @@
- 
- /* pngwtran.c - transforms the data in a row for PNG writers
-  *
-- * Last changed in libpng 1.6.26 [October 20, 2016]
-- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
-@@ -207,19 +207,19 @@ png_do_shift(png_row_infop row_info, png
-          shift_dec[channels] = bit_depth->alpha;
-          channels++;
-       }
- 
-       /* With low row depths, could only be grayscale, so one channel */
-       if (row_info->bit_depth < 8)
-       {
-          png_bytep bp = row;
--         png_size_t i;
-+         size_t i;
-          unsigned int mask;
--         png_size_t row_bytes = row_info->rowbytes;
-+         size_t row_bytes = row_info->rowbytes;
- 
-          if (bit_depth->gray == 1 && row_info->bit_depth == 2)
-             mask = 0x55;
- 
-          else if (row_info->bit_depth == 4 && bit_depth->gray == 3)
-             mask = 0x11;
- 
-          else
-@@ -509,17 +509,17 @@ png_do_write_transformations(png_structr
- #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
-    if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
-       if (png_ptr->write_user_transform_fn != NULL)
-          (*(png_ptr->write_user_transform_fn)) /* User write transform
-                                                  function */
-              (png_ptr,  /* png_ptr */
-              row_info,  /* row_info: */
-                 /*  png_uint_32 width;       width of row */
--                /*  png_size_t rowbytes;     number of bytes in row */
-+                /*  size_t rowbytes;         number of bytes in row */
-                 /*  png_byte color_type;     color type of pixels */
-                 /*  png_byte bit_depth;      bit depth of samples */
-                 /*  png_byte channels;       number of channels (1-4) */
-                 /*  png_byte pixel_depth;    bits per pixel (depth*channels) */
-              png_ptr->row_buf + 1);      /* start of pixel data for row */
- #endif
- 
- #ifdef PNG_WRITE_FILLER_SUPPORTED
-diff --git a/media/libpng/pngwutil.c b/media/libpng/pngwutil.c
---- a/media/libpng/pngwutil.c
-+++ b/media/libpng/pngwutil.c
-@@ -1,13 +1,13 @@
- 
- /* pngwutil.c - utilities to write a PNG file
-  *
-- * Last changed in libpng 1.6.32 [August 24, 2017]
-- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-+ * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
-@@ -54,17 +54,17 @@ png_write_sig(png_structrp png_ptr)
- 
- #ifdef PNG_IO_STATE_SUPPORTED
-    /* Inform the I/O callback that the signature is being written */
-    png_ptr->io_state = PNG_IO_WRITING | PNG_IO_SIGNATURE;
- #endif
- 
-    /* Write the rest of the 8 byte signature */
-    png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
--       (png_size_t)(8 - png_ptr->sig_bytes));
-+       (size_t)(8 - png_ptr->sig_bytes));
- 
-    if (png_ptr->sig_bytes < 3)
-       png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
- }
- 
- /* Write the start of a PNG chunk.  The type is the chunk type.
-  * The total_length is the sum of the lengths of all the data you will be
-  * passing in png_write_chunk_data().
-@@ -119,18 +119,17 @@ png_write_chunk_start(png_structrp png_p
- }
- 
- /* Write the data of a PNG chunk started with png_write_chunk_header().
-  * Note that multiple calls to this function are allowed, and that the
-  * sum of the lengths from these calls *must* add up to the total_length
-  * given to png_write_chunk_header().
-  */
- void PNGAPI
--png_write_chunk_data(png_structrp png_ptr, png_const_bytep data,
--    png_size_t length)
-+png_write_chunk_data(png_structrp png_ptr, png_const_bytep data, size_t length)
- {
-    /* Write the data, and run the CRC over it */
-    if (png_ptr == NULL)
-       return;
- 
-    if (data != NULL && length > 0)
-    {
-       png_write_data(png_ptr, data, length);
-@@ -155,48 +154,48 @@ png_write_chunk_end(png_structrp png_ptr
-     * PNG_IO_CHUNK_CRC requires a single I/O function call.
-     */
-    png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_CRC;
- #endif
- 
-    /* Write the crc in a single operation */
-    png_save_uint_32(buf, png_ptr->crc);
- 
--   png_write_data(png_ptr, buf, (png_size_t)4);
-+   png_write_data(png_ptr, buf, 4);
- }
- 
- /* Write a PNG chunk all at once.  The type is an array of ASCII characters
-  * representing the chunk name.  The array must be at least 4 bytes in
-  * length, and does not need to be null terminated.  To be safe, pass the
-  * pre-defined chunk names here, and if you need a new one, define it
-  * where the others are defined.  The length is the length of the data.
-  * All the data must be present.  If that is not possible, use the
-  * png_write_chunk_start(), png_write_chunk_data(), and png_write_chunk_end()
-  * functions instead.
-  */
- static void
- png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
--    png_const_bytep data, png_size_t length)
-+    png_const_bytep data, size_t length)
- {
-    if (png_ptr == NULL)
-       return;
- 
-    /* On 64-bit architectures 'length' may not fit in a png_uint_32. */
-    if (length > PNG_UINT_31_MAX)
-       png_error(png_ptr, "length exceeds PNG maximum");
- 
-    png_write_chunk_header(png_ptr, chunk_name, (png_uint_32)length);
-    png_write_chunk_data(png_ptr, data, length);
-    png_write_chunk_end(png_ptr);
- }
- 
- /* This is the API that calls the internal function above. */
- void PNGAPI
- png_write_chunk(png_structrp png_ptr, png_const_bytep chunk_string,
--    png_const_bytep data, png_size_t length)
-+    png_const_bytep data, size_t length)
- {
-    png_write_complete_chunk(png_ptr, PNG_CHUNK_FROM_STRING(chunk_string), data,
-        length);
- }
- 
- /* This is used below to find the size of an image to pass to png_deflate_claim,
-  * so it only needs to be accurate if the size is less than 16384 bytes (the
-  * point at which a lower LZ window size can be used.)
-@@ -815,17 +814,17 @@ png_write_IHDR(png_structrp png_ptr, png
-    png_save_uint_32(buf + 4, height);
-    buf[8] = (png_byte)bit_depth;
-    buf[9] = (png_byte)color_type;
-    buf[10] = (png_byte)compression_type;
-    buf[11] = (png_byte)filter_type;
-    buf[12] = (png_byte)interlace_type;
- 
-    /* Write the chunk */
--   png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
-+   png_write_complete_chunk(png_ptr, png_IHDR, buf, 13);
- 
- #ifdef PNG_WRITE_APNG_SUPPORTED
-    png_ptr->first_frame_width = width;
-    png_ptr->first_frame_height = height;
- #endif
- 
-    if ((png_ptr->do_filter) == PNG_NO_FILTERS)
-    {
-@@ -889,31 +888,31 @@ png_write_PLTE(png_structrp png_ptr, png
-    png_write_chunk_header(png_ptr, png_PLTE, (png_uint_32)(num_pal * 3));
- #ifdef PNG_POINTER_INDEXING_SUPPORTED
- 
-    for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++)
-    {
-       buf[0] = pal_ptr->red;
-       buf[1] = pal_ptr->green;
-       buf[2] = pal_ptr->blue;
--      png_write_chunk_data(png_ptr, buf, (png_size_t)3);
-+      png_write_chunk_data(png_ptr, buf, 3);
-    }
- 
- #else
-    /* This is a little slower but some buggy compilers need to do this
-     * instead
-     */
-    pal_ptr=palette;
- 
-    for (i = 0; i < num_pal; i++)
-    {
-       buf[0] = pal_ptr[i].red;
-       buf[1] = pal_ptr[i].green;
-       buf[2] = pal_ptr[i].blue;
--      png_write_chunk_data(png_ptr, buf, (png_size_t)3);
-+      png_write_chunk_data(png_ptr, buf, 3);
-    }
- 
- #endif
-    png_write_chunk_end(png_ptr);
-    png_ptr->mode |= PNG_HAVE_PLTE;
- }
- 
- /* This is similar to png_text_compress, above, except that it does not require
-@@ -1095,32 +1094,32 @@ png_compress_IDAT(png_structrp png_ptr, 
- }
- 
- /* Write an IEND chunk */
- void /* PRIVATE */
- png_write_IEND(png_structrp png_ptr)
- {
-    png_debug(1, "in png_write_IEND");
- 
--   png_write_complete_chunk(png_ptr, png_IEND, NULL, (png_size_t)0);
-+   png_write_complete_chunk(png_ptr, png_IEND, NULL, 0);
-    png_ptr->mode |= PNG_HAVE_IEND;
- }
- 
- #ifdef PNG_WRITE_gAMA_SUPPORTED
- /* Write a gAMA chunk */
- void /* PRIVATE */
- png_write_gAMA_fixed(png_structrp png_ptr, png_fixed_point file_gamma)
- {
-    png_byte buf[4];
- 
-    png_debug(1, "in png_write_gAMA");
- 
-    /* file_gamma is saved in 1/100,000ths */
-    png_save_uint_32(buf, (png_uint_32)file_gamma);
--   png_write_complete_chunk(png_ptr, png_gAMA, buf, (png_size_t)4);
-+   png_write_complete_chunk(png_ptr, png_gAMA, buf, 4);
- }
- #endif
- 
- #ifdef PNG_WRITE_sRGB_SUPPORTED
- /* Write a sRGB chunk */
- void /* PRIVATE */
- png_write_sRGB(png_structrp png_ptr, int srgb_intent)
- {
-@@ -1128,17 +1127,17 @@ png_write_sRGB(png_structrp png_ptr, int
- 
-    png_debug(1, "in png_write_sRGB");
- 
-    if (srgb_intent >= PNG_sRGB_INTENT_LAST)
-       png_warning(png_ptr,
-           "Invalid sRGB rendering intent specified");
- 
-    buf[0]=(png_byte)srgb_intent;
--   png_write_complete_chunk(png_ptr, png_sRGB, buf, (png_size_t)1);
-+   png_write_complete_chunk(png_ptr, png_sRGB, buf, 1);
- }
- #endif
- 
- #ifdef PNG_WRITE_iCCP_SUPPORTED
- /* Write an iCCP chunk */
- void /* PRIVATE */
- png_write_iCCP(png_structrp png_ptr, png_const_charp name,
-     png_const_bytep profile)
-@@ -1202,38 +1201,37 @@ png_write_iCCP(png_structrp png_ptr, png
- #ifdef PNG_WRITE_sPLT_SUPPORTED
- /* Write a sPLT chunk */
- void /* PRIVATE */
- png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
- {
-    png_uint_32 name_len;
-    png_byte new_name[80];
-    png_byte entrybuf[10];
--   png_size_t entry_size = (spalette->depth == 8 ? 6 : 10);
--   png_size_t palette_size = entry_size * (png_size_t)spalette->nentries;
-+   size_t entry_size = (spalette->depth == 8 ? 6 : 10);
-+   size_t palette_size = entry_size * (size_t)spalette->nentries;
-    png_sPLT_entryp ep;
- #ifndef PNG_POINTER_INDEXING_SUPPORTED
-    int i;
- #endif
- 
-    png_debug(1, "in png_write_sPLT");
- 
-    name_len = png_check_keyword(png_ptr, spalette->name, new_name);
- 
-    if (name_len == 0)
-       png_error(png_ptr, "sPLT: invalid keyword");
- 
-    /* Make sure we include the NULL after the name */
-    png_write_chunk_header(png_ptr, png_sPLT,
-        (png_uint_32)(name_len + 2 + palette_size));
- 
--   png_write_chunk_data(png_ptr, (png_bytep)new_name,
--       (png_size_t)(name_len + 1));
--
--   png_write_chunk_data(png_ptr, &spalette->depth, (png_size_t)1);
-+   png_write_chunk_data(png_ptr, (png_bytep)new_name, (size_t)(name_len + 1));
-+
-+   png_write_chunk_data(png_ptr, &spalette->depth, 1);
- 
-    /* Loop through each palette entry, writing appropriately */
- #ifdef PNG_POINTER_INDEXING_SUPPORTED
-    for (ep = spalette->entries; ep<spalette->entries + spalette->nentries; ep++)
-    {
-       if (spalette->depth == 8)
-       {
-          entrybuf[0] = (png_byte)ep->red;
-@@ -1285,17 +1283,17 @@ png_write_sPLT(png_structrp png_ptr, png
- #endif
- 
- #ifdef PNG_WRITE_sBIT_SUPPORTED
- /* Write the sBIT chunk */
- void /* PRIVATE */
- png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
- {
-    png_byte buf[4];
--   png_size_t size;
-+   size_t size;
- 
-    png_debug(1, "in png_write_sBIT");
- 
-    /* Make sure we don't depend upon the order of PNG_COLOR_8 */
-    if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
-    {
-       png_byte maxbits;
- 
-@@ -1385,32 +1383,32 @@ png_write_tRNS(png_structrp png_ptr, png
-       {
-          png_app_warning(png_ptr,
-              "Invalid number of transparent colors specified");
-          return;
-       }
- 
-       /* Write the chunk out as it is */
-       png_write_complete_chunk(png_ptr, png_tRNS, trans_alpha,
--          (png_size_t)num_trans);
-+          (size_t)num_trans);
-    }
- 
-    else if (color_type == PNG_COLOR_TYPE_GRAY)
-    {
-       /* One 16-bit value */
-       if (tran->gray >= (1 << png_ptr->bit_depth))
-       {
-          png_app_warning(png_ptr,
-              "Ignoring attempt to write tRNS chunk out-of-range for bit_depth");
- 
-          return;
-       }
- 
-       png_save_uint_16(buf, tran->gray);
--      png_write_complete_chunk(png_ptr, png_tRNS, buf, (png_size_t)2);
-+      png_write_complete_chunk(png_ptr, png_tRNS, buf, 2);
-    }
- 
-    else if (color_type == PNG_COLOR_TYPE_RGB)
-    {
-       /* Three 16-bit values */
-       png_save_uint_16(buf, tran->red);
-       png_save_uint_16(buf + 2, tran->green);
-       png_save_uint_16(buf + 4, tran->blue);
-@@ -1420,17 +1418,17 @@ png_write_tRNS(png_structrp png_ptr, png
-       if ((buf[0] | buf[2] | buf[4]) != 0)
- #endif
-       {
-          png_app_warning(png_ptr,
-              "Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8");
-          return;
-       }
- 
--      png_write_complete_chunk(png_ptr, png_tRNS, buf, (png_size_t)6);
-+      png_write_complete_chunk(png_ptr, png_tRNS, buf, 6);
-    }
- 
-    else
-    {
-       png_app_warning(png_ptr, "Can't write tRNS with an alpha channel");
-    }
- }
- #endif
-@@ -1453,17 +1451,17 @@ png_write_bKGD(png_structrp png_ptr, png
- #endif
-          back->index >= png_ptr->num_palette)
-       {
-          png_warning(png_ptr, "Invalid background palette index");
-          return;
-       }
- 
-       buf[0] = back->index;
--      png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)1);
-+      png_write_complete_chunk(png_ptr, png_bKGD, buf, 1);
-    }
- 
-    else if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
-    {
-       png_save_uint_16(buf, back->red);
-       png_save_uint_16(buf + 2, back->green);
-       png_save_uint_16(buf + 4, back->blue);
- #ifdef PNG_WRITE_16BIT_SUPPORTED
-@@ -1474,31 +1472,31 @@ png_write_bKGD(png_structrp png_ptr, png
-       {
-          png_warning(png_ptr,
-              "Ignoring attempt to write 16-bit bKGD chunk "
-              "when bit_depth is 8");
- 
-          return;
-       }
- 
--      png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)6);
-+      png_write_complete_chunk(png_ptr, png_bKGD, buf, 6);
-    }
- 
-    else
-    {
-       if (back->gray >= (1 << png_ptr->bit_depth))
-       {
-          png_warning(png_ptr,
-              "Ignoring attempt to write bKGD chunk out-of-range for bit_depth");
- 
-          return;
-       }
- 
-       png_save_uint_16(buf, back->gray);
--      png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)2);
-+      png_write_complete_chunk(png_ptr, png_bKGD, buf, 2);
-    }
- }
- #endif
- 
- #ifdef PNG_WRITE_eXIf_SUPPORTED
- /* Write the Exif data */
- void /* PRIVATE */
- png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif)
-@@ -1508,17 +1506,17 @@ png_write_eXIf(png_structrp png_ptr, png
- 
-    png_debug(1, "in png_write_eXIf");
- 
-    png_write_chunk_header(png_ptr, png_eXIf, (png_uint_32)(num_exif));
- 
-    for (i = 0; i < num_exif; i++)
-    {
-       buf[0] = exif[i];
--      png_write_chunk_data(png_ptr, buf, (png_size_t)1);
-+      png_write_chunk_data(png_ptr, buf, 1);
-    }
- 
-    png_write_chunk_end(png_ptr);
- }
- #endif
- 
- #ifdef PNG_WRITE_hIST_SUPPORTED
- /* Write the histogram */
-@@ -1539,28 +1537,28 @@ png_write_hIST(png_structrp png_ptr, png
-       return;
-    }
- 
-    png_write_chunk_header(png_ptr, png_hIST, (png_uint_32)(num_hist * 2));
- 
-    for (i = 0; i < num_hist; i++)
-    {
-       png_save_uint_16(buf, hist[i]);
--      png_write_chunk_data(png_ptr, buf, (png_size_t)2);
-+      png_write_chunk_data(png_ptr, buf, 2);
-    }
- 
-    png_write_chunk_end(png_ptr);
- }
- #endif
- 
- #ifdef PNG_WRITE_tEXt_SUPPORTED
- /* Write a tEXt chunk */
- void /* PRIVATE */
- png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
--    png_size_t text_len)
-+    size_t text_len)
- {
-    png_uint_32 key_len;
-    png_byte new_key[80];
- 
-    png_debug(1, "in png_write_tEXt");
- 
-    key_len = png_check_keyword(png_ptr, key, new_key);
- 
-@@ -1647,17 +1645,17 @@ png_write_zTXt(png_structrp png_ptr, png
- 
- #ifdef PNG_WRITE_iTXt_SUPPORTED
- /* Write an iTXt chunk */
- void /* PRIVATE */
- png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
-     png_const_charp lang, png_const_charp lang_key, png_const_charp text)
- {
-    png_uint_32 key_len, prefix_len;
--   png_size_t lang_len, lang_key_len;
-+   size_t lang_len, lang_key_len;
-    png_byte new_key[82];
-    compression_state comp;
- 
-    png_debug(1, "in png_write_iTXt");
- 
-    key_len = png_check_keyword(png_ptr, key, new_key);
- 
-    if (key_len == 0)
-@@ -1757,28 +1755,28 @@ png_write_oFFs(png_structrp png_ptr, png
- 
-    if (unit_type >= PNG_OFFSET_LAST)
-       png_warning(png_ptr, "Unrecognized unit type for oFFs chunk");
- 
-    png_save_int_32(buf, x_offset);
-    png_save_int_32(buf + 4, y_offset);
-    buf[8] = (png_byte)unit_type;
- 
--   png_write_complete_chunk(png_ptr, png_oFFs, buf, (png_size_t)9);
-+   png_write_complete_chunk(png_ptr, png_oFFs, buf, 9);
- }
- #endif
- #ifdef PNG_WRITE_pCAL_SUPPORTED
- /* Write the pCAL chunk (described in the PNG extensions document) */
- void /* PRIVATE */
- png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
-     png_int_32 X1, int type, int nparams, png_const_charp units,
-     png_charpp params)
- {
-    png_uint_32 purpose_len;
--   png_size_t units_len, total_len;
-+   size_t units_len, total_len;
-    png_size_tp params_len;
-    png_byte buf[10];
-    png_byte new_purpose[80];
-    int i;
- 
-    png_debug1(1, "in png_write_pCAL (%d parameters)", nparams);
- 
-    if (type >= PNG_EQUATION_LAST)
-@@ -1792,17 +1790,17 @@ png_write_pCAL(png_structrp png_ptr, png
-    ++purpose_len; /* terminator */
- 
-    png_debug1(3, "pCAL purpose length = %d", (int)purpose_len);
-    units_len = strlen(units) + (nparams == 0 ? 0 : 1);
-    png_debug1(3, "pCAL units length = %d", (int)units_len);
-    total_len = purpose_len + units_len + 10;
- 
-    params_len = (png_size_tp)png_malloc(png_ptr,
--       (png_alloc_size_t)((png_alloc_size_t)nparams * (sizeof (png_size_t))));
-+       (png_alloc_size_t)((png_alloc_size_t)nparams * (sizeof (size_t))));
- 
-    /* Find the length of each parameter, making sure we don't count the
-     * null terminator for the last parameter.
-     */
-    for (i = 0; i < nparams; i++)
-    {
-       params_len[i] = strlen(params[i]) + (i == nparams - 1 ? 0 : 1);
-       png_debug2(3, "pCAL parameter %d length = %lu", i,
-@@ -1812,18 +1810,18 @@ png_write_pCAL(png_structrp png_ptr, png
- 
-    png_debug1(3, "pCAL total length = %d", (int)total_len);
-    png_write_chunk_header(png_ptr, png_pCAL, (png_uint_32)total_len);
-    png_write_chunk_data(png_ptr, new_purpose, purpose_len);
-    png_save_int_32(buf, X0);
-    png_save_int_32(buf + 4, X1);
-    buf[8] = (png_byte)type;
-    buf[9] = (png_byte)nparams;
--   png_write_chunk_data(png_ptr, buf, (png_size_t)10);
--   png_write_chunk_data(png_ptr, (png_const_bytep)units, (png_size_t)units_len);
-+   png_write_chunk_data(png_ptr, buf, 10);
-+   png_write_chunk_data(png_ptr, (png_const_bytep)units, (size_t)units_len);
- 
-    for (i = 0; i < nparams; i++)
-    {
-       png_write_chunk_data(png_ptr, (png_const_bytep)params[i], params_len[i]);
-    }
- 
-    png_free(png_ptr, params_len);
-    png_write_chunk_end(png_ptr);
-@@ -1832,17 +1830,17 @@ png_write_pCAL(png_structrp png_ptr, png
- 
- #ifdef PNG_WRITE_sCAL_SUPPORTED
- /* Write the sCAL chunk */
- void /* PRIVATE */
- png_write_sCAL_s(png_structrp png_ptr, int unit, png_const_charp width,
-     png_const_charp height)
- {
-    png_byte buf[64];
--   png_size_t wlen, hlen, total_len;
-+   size_t wlen, hlen, total_len;
- 
-    png_debug(1, "in png_write_sCAL_s");
- 
-    wlen = strlen(width);
-    hlen = strlen(height);
-    total_len = wlen + hlen + 2;
- 
-    if (total_len > 64)
-@@ -1873,17 +1871,17 @@ png_write_pHYs(png_structrp png_ptr, png
- 
-    if (unit_type >= PNG_RESOLUTION_LAST)
-       png_warning(png_ptr, "Unrecognized unit type for pHYs chunk");
- 
-    png_save_uint_32(buf, x_pixels_per_unit);
-    png_save_uint_32(buf + 4, y_pixels_per_unit);
-    buf[8] = (png_byte)unit_type;
- 
--   png_write_complete_chunk(png_ptr, png_pHYs, buf, (png_size_t)9);
-+   png_write_complete_chunk(png_ptr, png_pHYs, buf, 9);
- }
- #endif
- 
- #ifdef PNG_WRITE_tIME_SUPPORTED
- /* Write the tIME chunk.  Use either png_convert_from_struct_tm()
-  * or png_convert_from_time_t(), or fill in the structure yourself.
-  */
- void /* PRIVATE */
-@@ -1903,17 +1901,17 @@ png_write_tIME(png_structrp png_ptr, png
- 
-    png_save_uint_16(buf, mod_time->year);
-    buf[2] = mod_time->month;
-    buf[3] = mod_time->day;
-    buf[4] = mod_time->hour;
-    buf[5] = mod_time->minute;
-    buf[6] = mod_time->second;
- 
--   png_write_complete_chunk(png_ptr, png_tIME, buf, (png_size_t)7);
-+   png_write_complete_chunk(png_ptr, png_tIME, buf, 7);
- }
- #endif
- 
- #ifdef PNG_WRITE_APNG_SUPPORTED
- void /* PRIVATE */
- png_write_acTL(png_structp png_ptr,
-     png_uint_32 num_frames, png_uint_32 num_plays)
- {
-@@ -2169,18 +2167,18 @@ png_write_finish_row(png_structrp png_pt
- 
-       }
- 
-       /* Reset the row above the image for the next pass */
-       if (png_ptr->pass < 7)
-       {
-          if (png_ptr->prev_row != NULL)
-             memset(png_ptr->prev_row, 0,
--                (png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels*
--                png_ptr->usr_bit_depth, png_ptr->width)) + 1);
-+                PNG_ROWBYTES(png_ptr->usr_channels *
-+                png_ptr->usr_bit_depth, png_ptr->width) + 1);
- 
-          return;
-       }
-    }
- #endif
- 
-    /* If we get here, we've just written the last row, so we need
-       to flush the compressor */
-@@ -2226,17 +2224,17 @@ png_do_write_interlace(png_row_infop row
- 
-             dp = row;
-             d = 0;
-             shift = 7;
- 
-             for (i = png_pass_start[pass]; i < row_width;
-                i += png_pass_inc[pass])
-             {
--               sp = row + (png_size_t)(i >> 3);
-+               sp = row + (size_t)(i >> 3);
-                value = (int)(*sp >> (7 - (int)(i & 0x07))) & 0x01;
-                d |= (value << shift);
- 
-                if (shift == 0)
-                {
-                   shift = 7;
-                   *dp++ = (png_byte)d;
-                   d = 0;
-@@ -2264,17 +2262,17 @@ png_do_write_interlace(png_row_infop row
- 
-             dp = row;
-             shift = 6;
-             d = 0;
- 
-             for (i = png_pass_start[pass]; i < row_width;
-                i += png_pass_inc[pass])
-             {
--               sp = row + (png_size_t)(i >> 2);
-+               sp = row + (size_t)(i >> 2);
-                value = (*sp >> ((3 - (int)(i & 0x03)) << 1)) & 0x03;
-                d |= (value << shift);
- 
-                if (shift == 0)
-                {
-                   shift = 6;
-                   *dp++ = (png_byte)d;
-                   d = 0;
-@@ -2300,17 +2298,17 @@ png_do_write_interlace(png_row_infop row
-             png_uint_32 row_width = row_info->width;
- 
-             dp = row;
-             shift = 4;
-             d = 0;
-             for (i = png_pass_start[pass]; i < row_width;
-                 i += png_pass_inc[pass])
-             {
--               sp = row + (png_size_t)(i >> 1);
-+               sp = row + (size_t)(i >> 1);
-                value = (*sp >> ((1 - (int)(i & 0x01)) << 2)) & 0x0f;
-                d |= (value << shift);
- 
-                if (shift == 0)
-                {
-                   shift = 4;
-                   *dp++ = (png_byte)d;
-                   d = 0;
-@@ -2326,30 +2324,30 @@ png_do_write_interlace(png_row_infop row
-          }
- 
-          default:
-          {
-             png_bytep sp;
-             png_bytep dp;
-             png_uint_32 i;
-             png_uint_32 row_width = row_info->width;
--            png_size_t pixel_bytes;
-+            size_t pixel_bytes;
- 
-             /* Start at the beginning */
-             dp = row;
- 
-             /* Find out how many bytes each pixel takes up */
-             pixel_bytes = (row_info->pixel_depth >> 3);
- 
-             /* Loop through the row, only looking at the pixels that matter */
-             for (i = png_pass_start[pass]; i < row_width;
-                i += png_pass_inc[pass])
-             {
-                /* Find out where the original pixel is */
--               sp = row + (png_size_t)i * pixel_bytes;
-+               sp = row + (size_t)i * pixel_bytes;
- 
-                /* Move the pixel */
-                if (dp != sp)
-                   memcpy(dp, sp, pixel_bytes);
- 
-                /* Next pixel */
-                dp += pixel_bytes;
-             }
-@@ -2370,26 +2368,26 @@ png_do_write_interlace(png_row_infop row
- 
- 
- /* This filters the row, chooses which filter to use, if it has not already
-  * been specified by the application, and then writes the row out with the
-  * chosen filter.
-  */
- static void /* PRIVATE */
- png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
--    png_size_t row_bytes);
-+    size_t row_bytes);
- 
- #ifdef PNG_WRITE_FILTER_SUPPORTED
--static png_size_t /* PRIVATE */
-+static size_t /* PRIVATE */
- png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
--    const png_size_t row_bytes, const png_size_t lmins)
-+    size_t row_bytes, size_t lmins)
- {
-    png_bytep rp, dp, lp;
--   png_size_t i;
--   png_size_t sum = 0;
-+   size_t i;
-+   size_t sum = 0;
-    unsigned int v;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1; i < bpp;
-         i++, rp++, dp++)
-    {
-       v = *dp = *rp;
-@@ -2414,43 +2412,42 @@ png_setup_sub_row(png_structrp png_ptr, 
-         break;
-    }
- 
-    return (sum);
- }
- 
- static void /* PRIVATE */
- png_setup_sub_row_only(png_structrp png_ptr, const png_uint_32 bpp,
--    const png_size_t row_bytes)
-+    size_t row_bytes)
- {
-    png_bytep rp, dp, lp;
--   png_size_t i;
-+   size_t i;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1; i < bpp;
-         i++, rp++, dp++)
-    {
-       *dp = *rp;
-    }
- 
-    for (lp = png_ptr->row_buf + 1; i < row_bytes;
-       i++, rp++, lp++, dp++)
-    {
-       *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
-    }
- }
- 
--static png_size_t /* PRIVATE */
--png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
--    const png_size_t lmins)
-+static size_t /* PRIVATE */
-+png_setup_up_row(png_structrp png_ptr, size_t row_bytes, size_t lmins)
- {
-    png_bytep rp, dp, pp;
--   png_size_t i;
--   png_size_t sum = 0;
-+   size_t i;
-+   size_t sum = 0;
-    unsigned int v;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
-        pp = png_ptr->prev_row + 1; i < row_bytes;
-        i++, rp++, pp++, dp++)
-    {
-@@ -2463,38 +2460,38 @@ png_setup_up_row(png_structrp png_ptr, c
- 
-       if (sum > lmins)  /* We are already worse, don't continue. */
-         break;
-    }
- 
-    return (sum);
- }
- static void /* PRIVATE */
--png_setup_up_row_only(png_structrp png_ptr, const png_size_t row_bytes)
-+png_setup_up_row_only(png_structrp png_ptr, size_t row_bytes)
- {
-    png_bytep rp, dp, pp;
--   png_size_t i;
-+   size_t i;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
-        pp = png_ptr->prev_row + 1; i < row_bytes;
-        i++, rp++, pp++, dp++)
-    {
-       *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
-    }
- }
- 
--static png_size_t /* PRIVATE */
-+static size_t /* PRIVATE */
- png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
--    const png_size_t row_bytes, const png_size_t lmins)
-+    size_t row_bytes, size_t lmins)
- {
-    png_bytep rp, dp, pp, lp;
-    png_uint_32 i;
--   png_size_t sum = 0;
-+   size_t sum = 0;
-    unsigned int v;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
-        pp = png_ptr->prev_row + 1; i < bpp; i++)
-    {
-       v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
-@@ -2520,17 +2517,17 @@ png_setup_avg_row(png_structrp png_ptr, 
-       if (sum > lmins)  /* We are already worse, don't continue. */
-         break;
-    }
- 
-    return (sum);
- }
- static void /* PRIVATE */
- png_setup_avg_row_only(png_structrp png_ptr, const png_uint_32 bpp,
--    const png_size_t row_bytes)
-+    size_t row_bytes)
- {
-    png_bytep rp, dp, pp, lp;
-    png_uint_32 i;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
-        pp = png_ptr->prev_row + 1; i < bpp; i++)
-@@ -2540,23 +2537,23 @@ png_setup_avg_row_only(png_structrp png_
- 
-    for (lp = png_ptr->row_buf + 1; i < row_bytes; i++)
-    {
-       *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
-           & 0xff);
-    }
- }
- 
--static png_size_t /* PRIVATE */
-+static size_t /* PRIVATE */
- png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
--    const png_size_t row_bytes, const png_size_t lmins)
-+    size_t row_bytes, size_t lmins)
- {
-    png_bytep rp, dp, pp, cp, lp;
--   png_size_t i;
--   png_size_t sum = 0;
-+   size_t i;
-+   size_t sum = 0;
-    unsigned int v;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
-        pp = png_ptr->prev_row + 1; i < bpp; i++)
-    {
-       v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
-@@ -2603,20 +2600,20 @@ png_setup_paeth_row(png_structrp png_ptr
-       if (sum > lmins)  /* We are already worse, don't continue. */
-         break;
-    }
- 
-    return (sum);
- }
- static void /* PRIVATE */
- png_setup_paeth_row_only(png_structrp png_ptr, const png_uint_32 bpp,
--    const png_size_t row_bytes)
-+    size_t row_bytes)
- {
-    png_bytep rp, dp, pp, cp, lp;
--   png_size_t i;
-+   size_t i;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
-        pp = png_ptr->prev_row + 1; i < bpp; i++)
-    {
-       *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
-    }
-@@ -2655,18 +2652,18 @@ png_write_find_filter(png_structrp png_p
- {
- #ifndef PNG_WRITE_FILTER_SUPPORTED
-    png_write_filtered_row(png_ptr, png_ptr->row_buf, row_info->rowbytes+1);
- #else
-    unsigned int filter_to_do = png_ptr->do_filter;
-    png_bytep row_buf;
-    png_bytep best_row;
-    png_uint_32 bpp;
--   png_size_t mins;
--   png_size_t row_bytes = row_info->rowbytes;
-+   size_t mins;
-+   size_t row_bytes = row_info->rowbytes;
- 
-    png_debug(1, "in png_write_find_filter");
- 
-    /* Find out how many bytes offset each pixel is */
-    bpp = (row_info->pixel_depth + 7) >> 3;
- 
-    row_buf = png_ptr->row_buf;
-    mins = PNG_SIZE_MAX - 256/* so we can detect potential overflow of the
-@@ -2711,18 +2708,18 @@ png_write_find_filter(png_structrp png_p
-    }
-    else if ((filter_to_do & PNG_FILTER_NONE) != 0 &&
-          filter_to_do != PNG_FILTER_NONE)
-    {
-       /* Overflow not possible and multiple filters in the list, including the
-        * 'none' filter.
-        */
-       png_bytep rp;
--      png_size_t sum = 0;
--      png_size_t i;
-+      size_t sum = 0;
-+      size_t i;
-       unsigned int v;
- 
-       {
-          for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
-          {
-             v = *rp;
- #ifdef PNG_USE_ABS
-             sum += 128 - abs((int)v - 128);
-@@ -2740,18 +2737,18 @@ png_write_find_filter(png_structrp png_p
-    /* It's the only filter so no testing is needed */
-    {
-       png_setup_sub_row_only(png_ptr, bpp, row_bytes);
-       best_row = png_ptr->try_row;
-    }
- 
-    else if ((filter_to_do & PNG_FILTER_SUB) != 0)
-    {
--      png_size_t sum;
--      png_size_t lmins = mins;
-+      size_t sum;
-+      size_t lmins = mins;
- 
-       sum = png_setup_sub_row(png_ptr, bpp, row_bytes, lmins);
- 
-       if (sum < mins)
-       {
-          mins = sum;
-          best_row = png_ptr->try_row;
-          if (png_ptr->tst_row != NULL)
-@@ -2766,18 +2763,18 @@ png_write_find_filter(png_structrp png_p
-    if (filter_to_do == PNG_FILTER_UP)
-    {
-       png_setup_up_row_only(png_ptr, row_bytes);
-       best_row = png_ptr->try_row;
-    }
- 
-    else if ((filter_to_do & PNG_FILTER_UP) != 0)
-    {
--      png_size_t sum;
--      png_size_t lmins = mins;
-+      size_t sum;
-+      size_t lmins = mins;
- 
-       sum = png_setup_up_row(png_ptr, row_bytes, lmins);
- 
-       if (sum < mins)
-       {
-          mins = sum;
-          best_row = png_ptr->try_row;
-          if (png_ptr->tst_row != NULL)
-@@ -2792,18 +2789,18 @@ png_write_find_filter(png_structrp png_p
-    if (filter_to_do == PNG_FILTER_AVG)
-    {
-       png_setup_avg_row_only(png_ptr, bpp, row_bytes);
-       best_row = png_ptr->try_row;
-    }
- 
-    else if ((filter_to_do & PNG_FILTER_AVG) != 0)
-    {
--      png_size_t sum;
--      png_size_t lmins = mins;
-+      size_t sum;
-+      size_t lmins = mins;
- 
-       sum= png_setup_avg_row(png_ptr, bpp, row_bytes, lmins);
- 
-       if (sum < mins)
-       {
-          mins = sum;
-          best_row = png_ptr->try_row;
-          if (png_ptr->tst_row != NULL)
-@@ -2818,18 +2815,18 @@ png_write_find_filter(png_structrp png_p
-    if (filter_to_do == PNG_FILTER_PAETH)
-    {
-       png_setup_paeth_row_only(png_ptr, bpp, row_bytes);
-       best_row = png_ptr->try_row;
-    }
- 
-    else if ((filter_to_do & PNG_FILTER_PAETH) != 0)
-    {
--      png_size_t sum;
--      png_size_t lmins = mins;
-+      size_t sum;
-+      size_t lmins = mins;
- 
-       sum = png_setup_paeth_row(png_ptr, bpp, row_bytes, lmins);
- 
-       if (sum < mins)
-       {
-          best_row = png_ptr->try_row;
-          if (png_ptr->tst_row != NULL)
-          {
-@@ -2844,17 +2841,17 @@ png_write_find_filter(png_structrp png_p
- 
- #endif /* WRITE_FILTER */
- }
- 
- 
- /* Do the actual writing of a previously filtered row. */
- static void
- png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
--    png_size_t full_row_length/*includes filter byte*/)
-+    size_t full_row_length/*includes filter byte*/)
- {
-    png_debug(1, "in png_write_filtered_row");
- 
-    png_debug1(2, "filter = %d", filtered_row[0]);
- 
-    png_compress_IDAT(png_ptr, filtered_row, full_row_length, Z_NO_FLUSH);
- 
- #ifdef PNG_WRITE_FILTER_SUPPORTED
-diff --git a/media/libpng/powerpc/filter_vsx_intrinsics.c b/media/libpng/powerpc/filter_vsx_intrinsics.c
---- a/media/libpng/powerpc/filter_vsx_intrinsics.c
-+++ b/media/libpng/powerpc/filter_vsx_intrinsics.c
-@@ -37,18 +37,18 @@
-  * whichever of a, b, or c is closest to p=a+b-c.
-  * ( this is taken from ../intel/filter_sse2_intrinsics.c )
-  */
- 
- #define vsx_declare_common_vars(row_info,row,prev_row,offset) \
-    png_byte i;\
-    png_bytep rp = row + offset;\
-    png_const_bytep pp = prev_row;\
--   png_size_t unaligned_top = 16 - (((png_size_t)rp % 16));\
--   png_size_t istop;\
-+   size_t unaligned_top = 16 - (((size_t)rp % 16));\
-+   size_t istop;\
-    if(unaligned_top == 16)\
-       unaligned_top = 0;\
-    istop = row_info->rowbytes;\
-    if((unaligned_top < istop))\
-       istop -= unaligned_top;\
-    else{\
-       unaligned_top = istop;\
-       istop = 0;\
-diff --git a/old-configure.in b/old-configure.in
---- a/old-configure.in
-+++ b/old-configure.in
-@@ -41,17 +41,17 @@ dnl ====================================
- _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
- _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
- _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
- _SUBDIR_CONFIG_ARGS="$ac_configure_args"
- 
- dnl Set the version number of the libs included with mozilla
- dnl ========================================================
- MOZJPEG=62
--MOZPNG=10634
-+MOZPNG=10635
- NSPR_VERSION=4
- NSPR_MINVER=4.23
- NSS_VERSION=3
- 
- dnl Set the minimum version of toolkit libs used by mozilla
- dnl ========================================================
- GLIB_VERSION=2.22
- # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.

+ 0 - 250
rel-257/mozilla-esr60/patches/1496823-1-64a1.patch

@@ -1,250 +0,0 @@
-# HG changeset patch
-# User Markus Stange <mstange@themasta.com>
-# Date 1539809003 0
-# Node ID 34f52a304c5251541685810ab2fb2e0a508d7508
-# Parent  76894869c1bee33885642b22f9310f57bc25903f
-Bug 1496823 - Remove setNeedsPendingDisplay infrastructure. r=spohl
-
-Many years ago, Gecko would sometimes call nsChildView::Invalidate during drawRect:.
-This is no longer the case: Widget invalidations now only happen outside of drawRect,
-usually from a refresh tick or from viewWillDraw.
-
-Differential Revision: https://phabricator.services.mozilla.com/D7922
-
-diff --git a/widget/cocoa/mozView.h b/widget/cocoa/mozView.h
---- a/widget/cocoa/mozView.h
-+++ b/widget/cocoa/mozView.h
-@@ -29,21 +29,16 @@ class TextInputHandler;
- - (void)uninstallTextInputHandler;
- 
- // access the nsIWidget associated with this view. DOES NOT ADDREF.
- - (nsIWidget*)widget;
- 
- // return a context menu for this view
- - (NSMenu*)contextMenu;
- 
--// Allows callers to do a delayed invalidate (e.g., if an invalidate
--// happens during drawing)
--- (void)setNeedsPendingDisplay;
--- (void)setNeedsPendingDisplayInRect:(NSRect)invalidRect;
--
- // called when our corresponding Gecko view goes away
- - (void)widgetDestroyed;
- 
- - (BOOL)isDragInProgress;
- 
- // Checks whether the view is first responder or not
- - (BOOL)isFirstResponder;
- 
-diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h
---- a/widget/cocoa/nsChildView.h
-+++ b/widget/cocoa/nsChildView.h
-@@ -140,21 +140,16 @@ class WidgetRenderingContext;
-   NSEvent* mLastKeyDownEvent;
- 
-   // Whether the last mouse down event was blocked from Gecko.
-   BOOL mBlockedLastMouseDown;
- 
-   // when acceptsFirstMouse: is called, we store the event here (strong)
-   NSEvent* mClickThroughMouseDownEvent;
- 
--  // rects that were invalidated during a draw, so have pending drawing
--  NSMutableArray* mPendingDirtyRects;
--  BOOL mPendingFullDisplay;
--  BOOL mPendingDisplay;
--
-   // WheelStart/Stop events should always come in pairs. This BOOL records the
-   // last received event so that, when we receive one of the events, we make sure
-   // to send its pair event first, in case we didn't yet for any reason.
-   BOOL mExpectingWheelStop;
- 
-   // Set to YES when our GL surface has been updated and we need to call
-   // updateGLContext before we composite.
-   BOOL mNeedsGLUpdate;
-diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
---- a/widget/cocoa/nsChildView.mm
-+++ b/widget/cocoa/nsChildView.mm
-@@ -173,18 +173,16 @@ static NSMutableDictionary* sNativeKeyEv
- - (void) convertCocoaMouseEvent:(NSEvent*)aMouseEvent
-                    toGeckoEvent:(WidgetInputEvent*)outGeckoEvent;
- - (void) convertCocoaTabletPointerEvent:(NSEvent*)aMouseEvent
-                            toGeckoEvent:(WidgetMouseEvent*)outGeckoEvent;
- - (NSMenu*)contextMenu;
- 
- - (BOOL)isRectObscuredBySubview:(NSRect)inRect;
- 
--- (void)processPendingRedraws;
--
- - (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext;
- - (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
- - (BOOL)isUsingMainThreadOpenGL;
- - (BOOL)isUsingOpenGL;
- - (void)drawUsingOpenGL;
- - (void)drawUsingOpenGLCallback;
- 
- - (BOOL)hasRoundedBottomCorners;
-@@ -1401,24 +1399,17 @@ nsChildView::Invalidate(const LayoutDevi
-   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
- 
-   if (!mView || !mVisible)
-     return;
- 
-   NS_ASSERTION(GetLayerManager()->GetBackendType() != LayersBackend::LAYERS_CLIENT,
-                "Shouldn't need to invalidate with accelerated OMTC layers!");
- 
--  if ([NSView focusView]) {
--    // if a view is focussed (i.e. being drawn), then postpone the invalidate so that we
--    // don't lose it.
--    [mView setNeedsPendingDisplayInRect:DevPixelsToCocoaPoints(aRect)];
--  }
--  else {
--    [mView setNeedsDisplayInRect:DevPixelsToCocoaPoints(aRect)];
--  }
-+  [mView setNeedsDisplayInRect:DevPixelsToCocoaPoints(aRect)];
- 
-   NS_OBJC_END_TRY_ABORT_BLOCK;
- }
- 
- bool
- nsChildView::WidgetTypeSupportsAcceleration()
- {
-   // We need to enable acceleration in popups which contain remote layer
-@@ -3287,17 +3278,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
- 
- // initWithFrame:geckoChild:
- - (id)initWithFrame:(NSRect)inFrame geckoChild:(nsChildView*)inChild
- {
-   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
- 
-   if ((self = [super initWithFrame:inFrame])) {
-     mGeckoChild = inChild;
--    mPendingDisplay = NO;
-     mBlockedLastMouseDown = NO;
-     mExpectingWheelStop = NO;
- 
-     mLastMouseDownEvent = nil;
-     mLastKeyDownEvent = nil;
-     mClickThroughMouseDownEvent = nil;
-     mDragService = nullptr;
- 
-@@ -3425,17 +3415,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
-   NS_OBJC_END_TRY_ABORT_BLOCK;
- }
- 
- - (void)dealloc
- {
-   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
- 
-   [mGLContext release];
--  [mPendingDirtyRects release];
-   [mLastMouseDownEvent release];
-   [mLastKeyDownEvent release];
-   [mClickThroughMouseDownEvent release];
-   CGImageRelease(mTopLeftCornerMask);
-   ChildViewMouseTracker::OnDestroyView(self);
- 
-   [[NSNotificationCenter defaultCenter] removeObserver:self];
-   [[NSDistributedNotificationCenter defaultCenter] removeObserver:self];
-@@ -3480,66 +3469,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
-       nsIPresShell* presShell = listener->GetPresShell();
-       if (presShell) {
-         presShell->ReconstructFrames();
-       }
-     }
-   }
- }
- 
--- (void)setNeedsPendingDisplay
--{
--  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
--
--  mPendingFullDisplay = YES;
--  if (!mPendingDisplay) {
--    [self performSelector:@selector(processPendingRedraws) withObject:nil afterDelay:0];
--    mPendingDisplay = YES;
--  }
--
--  NS_OBJC_END_TRY_ABORT_BLOCK;
--}
--
--- (void)setNeedsPendingDisplayInRect:(NSRect)invalidRect
--{
--  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
--
--  if (!mPendingDirtyRects)
--    mPendingDirtyRects = [[NSMutableArray alloc] initWithCapacity:1];
--  [mPendingDirtyRects addObject:[NSValue valueWithRect:invalidRect]];
--  if (!mPendingDisplay) {
--    [self performSelector:@selector(processPendingRedraws) withObject:nil afterDelay:0];
--    mPendingDisplay = YES;
--  }
--
--  NS_OBJC_END_TRY_ABORT_BLOCK;
--}
--
--// Clears the queue of any pending invalides
--- (void)processPendingRedraws
--{
--  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
--
--  if (mPendingFullDisplay) {
--    [self setNeedsDisplay:YES];
--  }
--  else if (mPendingDirtyRects) {
--    unsigned int count = [mPendingDirtyRects count];
--    for (unsigned int i = 0; i < count; ++i) {
--      [self setNeedsDisplayInRect:[[mPendingDirtyRects objectAtIndex:i] rectValue]];
--    }
--  }
--  mPendingFullDisplay = NO;
--  mPendingDisplay = NO;
--  [mPendingDirtyRects release];
--  mPendingDirtyRects = nil;
--
--  NS_OBJC_END_TRY_ABORT_BLOCK;
--}
--
- - (void)setNeedsDisplayInRect:(NSRect)aRect
- {
-   if (![self isUsingOpenGL]) {
-     [super setNeedsDisplayInRect:aRect];
-     return;
-   }
- 
-   if ([[self window] isVisible] && [self isUsingMainThreadOpenGL]) {
-@@ -3598,35 +3537,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
-     // inactive because at that point we've already been made active.
-     // Unfortunately, acceptsFirstMouse is called for PopupWindows even when
-     // their parent window is active, so ignore this on them for now.
-     mClickThroughMouseDownEvent = [aEvent retain];
-   }
-   return YES;
- }
- 
--- (void)scrollRect:(NSRect)aRect by:(NSSize)offset
--{
--  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
--
--  // Update any pending dirty rects to reflect the new scroll position
--  if (mPendingDirtyRects) {
--    unsigned int count = [mPendingDirtyRects count];
--    for (unsigned int i = 0; i < count; ++i) {
--      NSRect oldRect = [[mPendingDirtyRects objectAtIndex:i] rectValue];
--      NSRect newRect = NSOffsetRect(oldRect, offset.width, offset.height);
--      [mPendingDirtyRects replaceObjectAtIndex:i
--                                    withObject:[NSValue valueWithRect:newRect]];
--    }
--  }
--  [super scrollRect:aRect by:offset];
--
--  NS_OBJC_END_TRY_ABORT_BLOCK;
--}
--
- - (BOOL)mouseDownCanMoveWindow
- {
-   // Return YES so that parts of this view can be draggable. The non-draggable
-   // parts will be covered by NSViews that return NO from
-   // mouseDownCanMoveWindow and thus override draggability from the inside.
-   // These views are assembled in nsChildView::UpdateWindowDraggingRegion.
-   return YES;
- }

+ 0 - 473
rel-257/mozilla-esr60/patches/1496823-2-64a1.patch

@@ -1,473 +0,0 @@
-# HG changeset patch
-# User Markus Stange <mstange@themasta.com>
-# Date 1539809068 0
-# Node ID 959084361b1580b3dd586b6e229e21274cc83556
-# Parent  ddeb29e144604e61f669031917683b06093a5429
-Bug 1496823 - Remove EventThreadRunner and the pref that enabled it. r=kats,spohl
-
-This was an experiment before we had e10s. It's no longer needed.
-
-Depends on D7922
-
-Differential Revision: https://phabricator.services.mozilla.com/D7924
-
-diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h
---- a/gfx/thebes/gfxPrefs.h
-+++ b/gfx/thebes/gfxPrefs.h
-@@ -562,17 +562,16 @@ class gfxPrefs final {
-   DECL_GFX_PREF(Live, "layers.advanced.caret-layers",                 LayersAllowCaretLayers, bool, false);
-   DECL_OVERRIDE_PREF(Live, "layers.advanced.columnRule-layers",       LayersAllowColumnRuleLayers, gfxPrefs::OverrideBase_WebRender());
-   DECL_OVERRIDE_PREF(Live, "layers.advanced.image-layers",            LayersAllowImageLayers, gfxPrefs::OverrideBase_WebRender());
-   DECL_OVERRIDE_PREF(Live, "layers.advanced.outline-layers",          LayersAllowOutlineLayers, gfxPrefs::OverrideBase_WebRender());
-   DECL_GFX_PREF(Live, "layers.advanced.solid-color",                  LayersAllowSolidColorLayers, bool, false);
-   DECL_GFX_PREF(Live, "layers.advanced.table",                        LayersAllowTable, bool, false);
-   DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled",     LayersAMDSwitchableGfxEnabled, bool, false);
-   DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled",         AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
--  DECL_GFX_PREF(Once, "layers.async-pan-zoom.separate-event-thread", AsyncPanZoomSeparateEventThread, bool, false);
-   DECL_GFX_PREF(Live, "layers.bench.enabled",                  LayersBenchEnabled, bool, false);
-   DECL_GFX_PREF(Once, "layers.bufferrotation.enabled",         BufferRotationEnabled, bool, true);
-   DECL_GFX_PREF(Live, "layers.child-process-shutdown",         ChildProcessShutdown, bool, true);
- #ifdef MOZ_GFX_OPTIMIZE_MOBILE
-   // If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
-   // and ignore the preference.
-   DECL_GFX_PREF(Skip, "layers.componentalpha.enabled",         ComponentAlphaEnabled, bool, false);
- #else
-diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h
---- a/widget/cocoa/nsChildView.h
-+++ b/widget/cocoa/nsChildView.h
-@@ -247,17 +247,16 @@ class WidgetRenderingContext;
- - (void)swipeWithEvent:(NSEvent*)anEvent;
- - (void)beginGestureWithEvent:(NSEvent*)anEvent;
- - (void)magnifyWithEvent:(NSEvent*)anEvent;
- - (void)smartMagnifyWithEvent:(NSEvent*)anEvent;
- - (void)rotateWithEvent:(NSEvent*)anEvent;
- - (void)endGestureWithEvent:(NSEvent*)anEvent;
- 
- - (void)scrollWheel:(NSEvent*)anEvent;
--- (void)handleAsyncScrollEvent:(CGEventRef)cgEvent ofType:(CGEventType)type;
- 
- - (void)setUsingOMTCompositor:(BOOL)aUseOMTC;
- 
- - (NSEvent*)lastKeyDownEvent;
- 
- + (uint32_t)sUniqueKeyEventId;
- 
- + (NSMutableDictionary*)sNativeKeyEventsMap;
-@@ -491,18 +490,16 @@ class nsChildView final : public nsBaseW
-   }
- 
-   already_AddRefed<mozilla::gfx::DrawTarget> StartRemoteDrawingInRegion(
-       LayoutDeviceIntRegion& aInvalidRegion, mozilla::layers::BufferMode* aBufferMode) override;
-   void EndRemoteDrawing() override;
-   void CleanupRemoteDrawing() override;
-   bool InitCompositor(mozilla::layers::Compositor* aCompositor) override;
- 
--  IAPZCTreeManager* APZCTM() { return mAPZC; }
--
-   virtual MOZ_MUST_USE nsresult StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
-                                                int32_t aPanelX, int32_t aPanelY,
-                                                nsString& aCommitted) override;
- 
-   virtual void SetPluginFocused(bool& aFocused) override;
- 
-   bool IsPluginFocused() { return mPluginFocused; }
- 
-diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
---- a/widget/cocoa/nsChildView.mm
-+++ b/widget/cocoa/nsChildView.mm
-@@ -148,18 +148,16 @@ NSPoint ChildViewMouseTracker::sLastScro
- static void blinkRect(Rect* r);
- static void blinkRgn(RgnHandle rgn);
- #endif
- 
- bool gUserCancelledDrag = false;
- 
- uint32_t nsChildView::sLastInputEventCount = 0;
- 
--static uint32_t gNumberOfWidgetsNeedingEventThread = 0;
--
- static bool sIsTabletPointerActivated = false;
- 
- static uint32_t sUniqueKeyEventId = 0;
- 
- static NSMutableDictionary* sNativeKeyEventsMap =
-   [NSMutableDictionary dictionary];
- 
- @interface ChildView(Private)
-@@ -202,38 +200,26 @@ static NSMutableDictionary* sNativeKeyEv
- #endif
- 
- #ifdef ACCESSIBILITY
- - (id<mozAccessible>)accessible;
- #endif
- 
- - (LayoutDeviceIntPoint)convertWindowCoordinates:(NSPoint)aPoint;
- - (LayoutDeviceIntPoint)convertWindowCoordinatesRoundDown:(NSPoint)aPoint;
--- (IAPZCTreeManager*)apzctm;
- 
- - (BOOL)inactiveWindowAcceptsMouseEvent:(NSEvent*)aEvent;
- - (void)updateWindowDraggableState;
- 
- - (bool)beginOrEndGestureForEventPhase:(NSEvent*)aEvent;
- 
- - (bool)shouldConsiderStartingSwipeFromEvent:(NSEvent*)aEvent;
- 
- @end
- 
--@interface EventThreadRunner : NSObject
--{
--  NSThread* mThread;
--}
--- (id)init;
--
--+ (void)start;
--+ (void)stop;
--
--@end
--
- @interface NSView(NSThemeFrameCornerRadius)
- - (float)roundedCornerRadius;
- @end
- 
- @interface NSView(DraggableRegion)
- - (CGSRegionObj)_regionForOpaqueDescendants:(NSRect)aRect forMove:(BOOL)aForMove;
- - (CGSRegionObj)_regionForOpaqueDescendants:(NSRect)aRect forMove:(BOOL)aForMove forUnderTitlebar:(BOOL)aForUnderTitlebar;
- @end
-@@ -390,23 +376,16 @@ nsChildView::~nsChildView()
-   }
- 
-   NS_WARNING_ASSERTION(
-     mOnDestroyCalled,
-     "nsChildView object destroyed without calling Destroy()");
- 
-   DestroyCompositor();
- 
--  if (mAPZC && gfxPrefs::AsyncPanZoomSeparateEventThread()) {
--    gNumberOfWidgetsNeedingEventThread--;
--    if (gNumberOfWidgetsNeedingEventThread == 0) {
--      [EventThreadRunner stop];
--    }
--  }
--
-   // An nsChildView object that was in use can be destroyed without Destroy()
-   // ever being called on it.  So we also need to do a quick, safe cleanup
-   // here (it's too late to just call Destroy(), which can cause crashes).
-   // It's particularly important to make sure widgetDestroyed is called on our
-   // mView -- this method NULLs mView's mGeckoChild, and NULL checks on
-   // mGeckoChild are used throughout the ChildView class to tell if it's safe
-   // to use a ChildView object.
-   [mView widgetDestroyed]; // Safe if mView is nil.
-@@ -1970,35 +1949,22 @@ nsChildView::CreateCompositor()
-     [(ChildView *)mView setUsingOMTCompositor:true];
-   }
- }
- 
- void
- nsChildView::ConfigureAPZCTreeManager()
- {
-   nsBaseWidget::ConfigureAPZCTreeManager();
--
--  if (gfxPrefs::AsyncPanZoomSeparateEventThread()) {
--    if (gNumberOfWidgetsNeedingEventThread == 0) {
--      [EventThreadRunner start];
--    }
--    gNumberOfWidgetsNeedingEventThread++;
--  }
- }
- 
- void
- nsChildView::ConfigureAPZControllerThread()
- {
--  if (gfxPrefs::AsyncPanZoomSeparateEventThread()) {
--    // The EventThreadRunner is the controller thread, but it doesn't
--    // have a MessageLoop.
--    APZThreadUtils::SetControllerThread(nullptr);
--  } else {
--    nsBaseWidget::ConfigureAPZControllerThread();
--  }
-+  nsBaseWidget::ConfigureAPZControllerThread();
- }
- 
- LayoutDeviceIntRect
- nsChildView::RectContainingTitlebarControls()
- {
-   NSRect rect = NSZeroRect;
- 
-   // If we draw the titlebar title string, set the rect to the full window
-@@ -4855,22 +4821,16 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
-   // For line scrolls, or pre-10.12, just use the rounded up value of deltaX / deltaY.
-   return gfx::IntPoint(RoundUp([aEvent deltaX]), RoundUp([aEvent deltaY]));
- }
- 
- - (void)scrollWheel:(NSEvent*)theEvent
- {
-   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
- 
--  if (gfxPrefs::AsyncPanZoomSeparateEventThread() && [self apzctm]) {
--    // Disable main-thread scrolling completely when using APZ with the
--    // separate event thread. This is bug 1013412.
--    return;
--  }
--
-   nsAutoRetainCocoaObject kungFuDeathGrip(self);
- 
-   ChildViewMouseTracker::MouseScrolled(theEvent);
- 
-   if ([self maybeRollup:theEvent]) {
-     return;
-   }
- 
-@@ -4980,115 +4940,16 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
-     wheelEvent.mLineOrPageDeltaX = lineOrPageDelta.x;
-     wheelEvent.mLineOrPageDeltaY = lineOrPageDelta.y;
-     geckoChildDeathGrip->DispatchAPZWheelInputEvent(wheelEvent, false);
-   }
- 
-   NS_OBJC_END_TRY_ABORT_BLOCK;
- }
- 
--- (void)handleAsyncScrollEvent:(CGEventRef)cgEvent ofType:(CGEventType)type
--{
--  IAPZCTreeManager* apzctm = [self apzctm];
--  if (!apzctm) {
--    return;
--  }
--
--  CGPoint loc = CGEventGetLocation(cgEvent);
--  loc.y = nsCocoaUtils::FlippedScreenY(loc.y);
--  NSPoint locationInWindow =
--    nsCocoaUtils::ConvertPointFromScreen([self window], NSPointFromCGPoint(loc));
--  ScreenIntPoint location = ViewAs<ScreenPixel>(
--    [self convertWindowCoordinates:locationInWindow],
--    PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
--
--  static NSTimeInterval sStartTime = [NSDate timeIntervalSinceReferenceDate];
--  static TimeStamp sStartTimeStamp = TimeStamp::Now();
--
--  if (type == kCGEventScrollWheel) {
--    NSEvent* event = [NSEvent eventWithCGEvent:cgEvent];
--    NSEventPhase phase = nsCocoaUtils::EventPhase(event);
--    NSEventPhase momentumPhase = nsCocoaUtils::EventMomentumPhase(event);
--    CGFloat pixelDeltaX = 0, pixelDeltaY = 0;
--    nsCocoaUtils::GetScrollingDeltas(event, &pixelDeltaX, &pixelDeltaY);
--    uint32_t eventTime = ([event timestamp] - sStartTime) * 1000;
--    TimeStamp eventTimeStamp = sStartTimeStamp +
--      TimeDuration::FromSeconds([event timestamp] - sStartTime);
--    NSPoint locationInWindowMoved = NSMakePoint(
--      locationInWindow.x + pixelDeltaX,
--      locationInWindow.y - pixelDeltaY);
--    ScreenIntPoint locationMoved = ViewAs<ScreenPixel>(
--      [self convertWindowCoordinates:locationInWindowMoved],
--      PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
--    ScreenPoint delta = ScreenPoint(locationMoved - location);
--    ScrollableLayerGuid guid;
--
--    // MayBegin and Cancelled are dispatched when the fingers start or stop
--    // touching the touchpad before any scrolling has occurred. These events
--    // can be used to control scrollbar visibility or interrupt scroll
--    // animations. They are only dispatched on 10.8 or later, and only by
--    // relatively modern devices.
--    if (phase == NSEventPhaseMayBegin) {
--      PanGestureInput panInput(PanGestureInput::PANGESTURE_MAYSTART, eventTime,
--                               eventTimeStamp, location, ScreenPoint(0, 0), 0);
--      apzctm->ReceiveInputEvent(panInput, &guid, nullptr);
--      return;
--    }
--    if (phase == NSEventPhaseCancelled) {
--      PanGestureInput panInput(PanGestureInput::PANGESTURE_CANCELLED, eventTime,
--                               eventTimeStamp, location, ScreenPoint(0, 0), 0);
--      apzctm->ReceiveInputEvent(panInput, &guid, nullptr);
--      return;
--    }
--
--    // Legacy scroll events are dispatched by devices that do not have a
--    // concept of a scroll gesture, for example by USB mice with
--    // traditional mouse wheels.
--    // For these kinds of scrolls, we want to surround every single scroll
--    // event with a PANGESTURE_START and a PANGESTURE_END event. The APZC
--    // needs to know that the real scroll gesture can end abruptly after any
--    // one of these events.
--    bool isLegacyScroll = (phase == NSEventPhaseNone &&
--      momentumPhase == NSEventPhaseNone && delta != ScreenPoint(0, 0));
--
--    if (phase == NSEventPhaseBegan || isLegacyScroll) {
--      PanGestureInput panInput(PanGestureInput::PANGESTURE_START, eventTime,
--                               eventTimeStamp, location, ScreenPoint(0, 0), 0);
--      apzctm->ReceiveInputEvent(panInput, &guid, nullptr);
--    }
--    if (momentumPhase == NSEventPhaseNone && delta != ScreenPoint(0, 0)) {
--      PanGestureInput panInput(PanGestureInput::PANGESTURE_PAN, eventTime,
--                               eventTimeStamp, location, delta, 0);
--      apzctm->ReceiveInputEvent(panInput, &guid, nullptr);
--    }
--    if (phase == NSEventPhaseEnded || isLegacyScroll) {
--      PanGestureInput panInput(PanGestureInput::PANGESTURE_END, eventTime,
--                               eventTimeStamp, location, ScreenPoint(0, 0), 0);
--      apzctm->ReceiveInputEvent(panInput, &guid, nullptr);
--    }
--
--    // Any device that can dispatch momentum events supports all three momentum phases.
--    if (momentumPhase == NSEventPhaseBegan) {
--      PanGestureInput panInput(PanGestureInput::PANGESTURE_MOMENTUMSTART, eventTime,
--                               eventTimeStamp, location, ScreenPoint(0, 0), 0);
--      apzctm->ReceiveInputEvent(panInput, &guid, nullptr);
--    }
--    if (momentumPhase == NSEventPhaseChanged && delta != ScreenPoint(0, 0)) {
--      PanGestureInput panInput(PanGestureInput::PANGESTURE_MOMENTUMPAN, eventTime,
--                               eventTimeStamp, location, delta, 0);
--      apzctm->ReceiveInputEvent(panInput, &guid, nullptr);
--    }
--    if (momentumPhase == NSEventPhaseEnded) {
--      PanGestureInput panInput(PanGestureInput::PANGESTURE_MOMENTUMEND, eventTime,
--                               eventTimeStamp, location, ScreenPoint(0, 0), 0);
--      apzctm->ReceiveInputEvent(panInput, &guid, nullptr);
--    }
--  }
--}
--
- -(NSMenu*)menuForEvent:(NSEvent*)theEvent
- {
-   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
- 
-   if (!mGeckoChild)
-     return nil;
- 
-   nsAutoRetainCocoaObject kungFuDeathGrip(self);
-@@ -5964,21 +5825,16 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
-   if (!mGeckoChild) {
-     return LayoutDeviceIntPoint(0, 0);
-   }
- 
-   NSPoint localPoint = [self convertPoint:aPoint fromView:nil];
-   return mGeckoChild->CocoaPointsToDevPixelsRoundDown(localPoint);
- }
- 
--- (IAPZCTreeManager*)apzctm
--{
--  return mGeckoChild ? mGeckoChild->APZCTM() : nullptr;
--}
--
- // This is a utility function used by NSView drag event methods
- // to send events. It contains all of the logic needed for Gecko
- // dragging to work. Returns the appropriate cocoa drag operation code.
- - (NSDragOperation)doDragAction:(EventMessage)aMessage sender:(id)aSender
- {
-   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
- 
-   if (!mGeckoChild)
-@@ -6928,115 +6784,16 @@ ChildViewMouseTracker::WindowAcceptsEven
- 
-   // If we're here then we're dealing with a left click or mouse move on an
-   // inactive window or something similar. Ask Gecko what to do.
-   return [aView inactiveWindowAcceptsMouseEvent:aEvent];
- }
- 
- #pragma mark -
- 
--@interface EventThreadRunner(Private)
--- (void)runEventThread;
--- (void)shutdownAndReleaseCalledOnEventThread;
--- (void)shutdownAndReleaseCalledOnAnyThread;
--- (void)handleEvent:(CGEventRef)cgEvent type:(CGEventType)type;
--@end
--
--static EventThreadRunner* sEventThreadRunner = nil;
--
--@implementation EventThreadRunner
--
--+ (void)start
--{
--  sEventThreadRunner = [[EventThreadRunner alloc] init];
--}
--
--+ (void)stop
--{
--  if (sEventThreadRunner) {
--    [sEventThreadRunner shutdownAndReleaseCalledOnAnyThread];
--    sEventThreadRunner = nil;
--  }
--}
--
--- (id)init
--{
--  if ((self = [super init])) {
--    mThread = nil;
--    [NSThread detachNewThreadSelector:@selector(runEventThread)
--                             toTarget:self
--                           withObject:nil];
--  }
--  return self;
--}
--
--static CGEventRef
--HandleEvent(CGEventTapProxy aProxy, CGEventType aType,
--            CGEventRef aEvent, void* aClosure)
--{
--  [(EventThreadRunner*)aClosure handleEvent:aEvent type:aType];
--  return aEvent;
--}
--
--- (void)runEventThread
--{
--  PROFILER_REGISTER_THREAD("APZC Event Thread");
--  NS_SetCurrentThreadName("APZC Event Thread");
--
--  mThread = [NSThread currentThread];
--  ProcessSerialNumber currentProcess;
--  GetCurrentProcess(&currentProcess);
--  CFMachPortRef eventPort =
--    CGEventTapCreateForPSN(&currentProcess,
--                           kCGHeadInsertEventTap,
--                           kCGEventTapOptionListenOnly,
--                           CGEventMaskBit(kCGEventScrollWheel),
--                           HandleEvent,
--                           self);
--  CFRunLoopSourceRef eventPortSource =
--    CFMachPortCreateRunLoopSource(kCFAllocatorSystemDefault, eventPort, 0);
--  CFRunLoopAddSource(CFRunLoopGetCurrent(), eventPortSource, kCFRunLoopCommonModes);
--  CFRunLoopRun();
--  CFRunLoopRemoveSource(CFRunLoopGetCurrent(), eventPortSource, kCFRunLoopCommonModes);
--  CFRelease(eventPortSource);
--  CFRelease(eventPort);
--  [self release];
--}
--
--- (void)shutdownAndReleaseCalledOnEventThread
--{
--  CFRunLoopStop(CFRunLoopGetCurrent());
--}
--
--- (void)shutdownAndReleaseCalledOnAnyThread
--{
--  [self performSelector:@selector(shutdownAndReleaseCalledOnEventThread) onThread:mThread withObject:nil waitUntilDone:NO];
--}
--
--static const CGEventField kCGWindowNumberField = (const CGEventField) 51;
--
--// Called on scroll thread
--- (void)handleEvent:(CGEventRef)cgEvent type:(CGEventType)type
--{
--  if (type != kCGEventScrollWheel) {
--    return;
--  }
--
--  int windowNumber = CGEventGetIntegerValueField(cgEvent, kCGWindowNumberField);
--  NSWindow* window = [NSApp windowWithWindowNumber:windowNumber];
--  if (!window || ![window isKindOfClass:[BaseWindow class]]) {
--    return;
--  }
--
--  ChildView* childView = [(BaseWindow*)window mainChildView];
--  [childView handleAsyncScrollEvent:cgEvent ofType:type];
--}
--
--@end
--
- @interface NSView (MethodSwizzling)
- - (BOOL)nsChildView_NSView_mouseDownCanMoveWindow;
- @end
- 
- @implementation NSView (MethodSwizzling)
- 
- // All top-level browser windows belong to the ToolbarWindow class and have
- // NSTexturedBackgroundWindowMask turned on in their "style" (see particularly

+ 0 - 176
rel-257/mozilla-esr60/patches/1496823-3-64a1.patch

@@ -1,176 +0,0 @@
-# HG changeset patch
-# User Markus Stange <mstange@themasta.com>
-# Date 1539809176 0
-# Node ID 8848453f27af6f3ae1538e9cbadef50bf4e95455
-# Parent  2b51d75106b185885e12c7ce8fe92bf59d1d40f2
-Bug 1496823 - Remove -[ChildView isUsingMainThreadOpenGL] and dependent code because it always returns NO. r=spohl
-
-The main thread layer manager is always NONE, BASIC or CLIENT. It is never OPENGL anymore.
-Main-thread OpenGL rendering was removed in bug 924403.
-
-Depends on D7924
-
-Differential Revision: https://phabricator.services.mozilla.com/D7925
-
-diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h
---- a/widget/cocoa/nsChildView.h
-+++ b/widget/cocoa/nsChildView.h
-@@ -181,18 +181,16 @@ class WidgetRenderingContext;
-     eGestureState_None,
-     eGestureState_StartGesture,
-     eGestureState_MagnifyGesture,
-     eGestureState_RotateGesture
-   } mGestureState;
-   float mCumulativeMagnification;
-   float mCumulativeRotation;
- 
--  BOOL mWaitingForPaint;
--
- #ifdef __LP64__
-   // Support for fluid swipe tracking.
-   BOOL* mCancelSwipeAnimation;
- #endif
- 
-   // Whether this uses off-main-thread compositing.
-   BOOL mUsingOMTCompositor;
- 
-diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
---- a/widget/cocoa/nsChildView.mm
-+++ b/widget/cocoa/nsChildView.mm
-@@ -173,20 +173,18 @@ static NSMutableDictionary* sNativeKeyEv
- - (void) convertCocoaTabletPointerEvent:(NSEvent*)aMouseEvent
-                            toGeckoEvent:(WidgetMouseEvent*)outGeckoEvent;
- - (NSMenu*)contextMenu;
- 
- - (BOOL)isRectObscuredBySubview:(NSRect)inRect;
- 
- - (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext;
- - (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
--- (BOOL)isUsingMainThreadOpenGL;
- - (BOOL)isUsingOpenGL;
- - (void)drawUsingOpenGL;
--- (void)drawUsingOpenGLCallback;
- 
- - (BOOL)hasRoundedBottomCorners;
- - (CGFloat)cornerRadius;
- - (void)clearCorners;
- 
- -(void)setGLOpaque:(BOOL)aOpaque;
- 
- // Overlay drawing functions for traditional CGContext drawing
-@@ -3441,34 +3439,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
- }
- 
- - (void)setNeedsDisplayInRect:(NSRect)aRect
- {
-   if (![self isUsingOpenGL]) {
-     [super setNeedsDisplayInRect:aRect];
-     return;
-   }
--
--  if ([[self window] isVisible] && [self isUsingMainThreadOpenGL]) {
--    // Draw without calling drawRect. This prevent us from
--    // needing to access the normal window buffer surface unnecessarily, so we
--    // waste less time synchronizing the two surfaces. (These synchronizations
--    // show up in a profiler as CGSDeviceLock / _CGSLockWindow /
--    // _CGSSynchronizeWindowBackingStore.) It also means that Cocoa doesn't
--    // have any potentially expensive invalid rect management for us.
--    if (!mWaitingForPaint) {
--      mWaitingForPaint = YES;
--      // Use NSRunLoopCommonModes instead of the default NSDefaultRunLoopMode
--      // so that the timer also fires while a native menu is open.
--      [self performSelector:@selector(drawUsingOpenGLCallback)
--                 withObject:nil
--                 afterDelay:0
--                    inModes:[NSArray arrayWithObject:NSRunLoopCommonModes]];
--    }
--  }
- }
- 
- - (NSString*)description
- {
-   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
- 
-   return [NSString stringWithFormat:@"ChildView %p, gecko child %p, frame %@", self, mGeckoChild, NSStringFromRect([self frame])];
- 
-@@ -3632,22 +3612,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
-            aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height, aContext,
-            geckoBounds.x, geckoBounds.y, geckoBounds.width, geckoBounds.height);
- 
-   CGAffineTransform xform = CGContextGetCTM(aContext);
-   fprintf (stderr, "  xform in: [%f %f %f %f %f %f]\n", xform.a, xform.b, xform.c, xform.d, xform.tx, xform.ty);
- #endif
- 
-   if ([self isUsingOpenGL]) {
--    // For Gecko-initiated repaints in OpenGL mode, drawUsingOpenGL is
--    // directly called from a delayed perform callback - without going through
--    // drawRect.
--    // Paints that come through here are triggered by something that Cocoa
--    // controls, for example by window resizing or window focus changes.
--
-     // Since this view is usually declared as opaque, the window's pixel
-     // buffer may now contain garbage which we need to prevent from reaching
-     // the screen. The only place where garbage can show is in the window
-     // corners and the vibrant regions of the window - the rest of the window
-     // is covered by opaque content in our OpenGL surface.
-     // So we need to clear the pixel buffer contents in these areas.
-     mGeckoChild->ClearVibrantAreas();
-     [self clearCorners];
-@@ -3700,56 +3674,37 @@ NSEvent* gLastDragMouseDownEvent = nil;
-                             0.5);
- #endif
-   CGContextSetRGBStrokeColor(aContext, 1, 0, 0, 0.8);
-   CGContextSetLineWidth(aContext, 4.0);
-   CGContextStrokeRect(aContext, NSRectToCGRect(aRect));
- #endif
- }
- 
--- (BOOL)isUsingMainThreadOpenGL
--{
--  if (!mGeckoChild || ![self window])
--    return NO;
--
--  return mGeckoChild->GetLayerManager(nullptr)->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_OPENGL;
--}
--
- - (BOOL)isUsingOpenGL
- {
-   if (!mGeckoChild || ![self window])
-     return NO;
- 
--  return mGLContext || mUsingOMTCompositor || [self isUsingMainThreadOpenGL];
-+  return mGLContext || mUsingOMTCompositor;
- }
- 
- - (void)drawUsingOpenGL
- {
-   AUTO_PROFILER_LABEL("ChildView::drawUsingOpenGL", GRAPHICS);
- 
-   if (![self isUsingOpenGL] || !mGeckoChild->IsVisible())
-     return;
- 
--  mWaitingForPaint = NO;
--
-   LayoutDeviceIntRect geckoBounds = mGeckoChild->GetBounds();
-   LayoutDeviceIntRegion region(geckoBounds);
- 
-   mGeckoChild->PaintWindow(region);
- }
- 
--// Called asynchronously after setNeedsDisplay in order to avoid entering the
--// normal drawing machinery.
--- (void)drawUsingOpenGLCallback
--{
--  if (mWaitingForPaint) {
--    [self drawUsingOpenGL];
--  }
--}
--
- - (BOOL)hasRoundedBottomCorners
- {
-   return [[self window] respondsToSelector:@selector(bottomCornerRounded)] &&
-   [[self window] bottomCornerRounded];
- }
- 
- - (CGFloat)cornerRadius
- {

+ 0 - 44
rel-257/mozilla-esr60/patches/1496823-4-64a1.patch

@@ -1,44 +0,0 @@
-# HG changeset patch
-# User Markus Stange <mstange@themasta.com>
-# Date 1539809249 0
-# Node ID 56dc11bab861326c3981f8a38f08027a2b90ae7a
-# Parent  15eb1a002af2d2be2b175df86a9ec8e80637e2e9
-Bug 1496823 - Remove -[ChildView setNeedsDisplayInRect:] override. r=spohl
-
-This override was intended to ignore unnecessary nsChildView::Invalidate calls
-when using main thread OpenGL. With OMTC, Gecko no longer calls Invalidate in
-those cases, it just composites on the compositor thread, and the widget's main
-thread code doesn't really hear about it. So this workaround is no longer necessary.
-
-Depends on D7925
-
-Differential Revision: https://phabricator.services.mozilla.com/D7927
-
-diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
---- a/widget/cocoa/nsChildView.mm
-+++ b/widget/cocoa/nsChildView.mm
-@@ -3433,24 +3433,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
-       nsIPresShell* presShell = listener->GetPresShell();
-       if (presShell) {
-         presShell->ReconstructFrames();
-       }
-     }
-   }
- }
- 
--- (void)setNeedsDisplayInRect:(NSRect)aRect
--{
--  if (![self isUsingOpenGL]) {
--    [super setNeedsDisplayInRect:aRect];
--    return;
--  }
--}
--
- - (NSString*)description
- {
-   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
- 
-   return [NSString stringWithFormat:@"ChildView %p, gecko child %p, frame %@", self, mGeckoChild, NSStringFromRect([self frame])];
- 
-   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
- }

+ 0 - 77
rel-257/mozilla-esr60/patches/1496823-5-64a1.patch

@@ -1,77 +0,0 @@
-# HG changeset patch
-# User Markus Stange <mstange@themasta.com>
-# Date 1539809253 0
-# Node ID d1d878123a68f2f7bcd4f31f57fd7eb648975ada
-# Parent  faa0bbeb52fb0e95c3dba5a053ccba94c8c96d62
-Bug 1496823 - Remove unneeded debugging code. r=spohl
-
-I don't think anybody has made use of this code in years.
-
-Depends on D7927
-
-Differential Revision: https://phabricator.services.mozilla.com/D7928
-
-diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
---- a/widget/cocoa/nsChildView.mm
-+++ b/widget/cocoa/nsChildView.mm
-@@ -3591,28 +3591,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
-     // a non-main thread. Ignore those calls because Gecko can only react to
-     // them on the main thread.
-     return;
-   }
- 
-   if (!mGeckoChild || !mGeckoChild->IsVisible())
-     return;
- 
--#ifdef DEBUG_UPDATE
--  LayoutDeviceIntRect geckoBounds = mGeckoChild->GetBounds();
--
--  fprintf (stderr, "---- Update[%p][%p] [%f %f %f %f] cgc: %p\n  gecko bounds: [%d %d %d %d]\n",
--           self, mGeckoChild,
--           aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height, aContext,
--           geckoBounds.x, geckoBounds.y, geckoBounds.width, geckoBounds.height);
--
--  CGAffineTransform xform = CGContextGetCTM(aContext);
--  fprintf (stderr, "  xform in: [%f %f %f %f %f %f]\n", xform.a, xform.b, xform.c, xform.d, xform.tx, xform.ty);
--#endif
--
-   if ([self isUsingOpenGL]) {
-     // Since this view is usually declared as opaque, the window's pixel
-     // buffer may now contain garbage which we need to prevent from reaching
-     // the screen. The only place where garbage can show is in the window
-     // corners and the vibrant regions of the window - the rest of the window
-     // is covered by opaque content in our OpenGL surface.
-     // So we need to clear the pixel buffer contents in these areas.
-     mGeckoChild->ClearVibrantAreas();
-@@ -3649,31 +3637,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
-     CGContextSetRGBFillColor(aContext, 1, 1, 1, 1);
-     CGContextFillRect(aContext, NSRectToCGRect(aRect));
-   }
- 
-   if ([self isCoveringTitlebar]) {
-     [self drawTitleString];
-     [self maskTopCornersInContext:aContext];
-   }
--
--#ifdef DEBUG_UPDATE
--  fprintf (stderr, "---- update done ----\n");
--
--#if 0
--  CGContextSetRGBStrokeColor (aContext,
--                            ((((unsigned long)self) & 0xff)) / 255.0,
--                            ((((unsigned long)self) & 0xff00) >> 8) / 255.0,
--                            ((((unsigned long)self) & 0xff0000) >> 16) / 255.0,
--                            0.5);
--#endif
--  CGContextSetRGBStrokeColor(aContext, 1, 0, 0, 0.8);
--  CGContextSetLineWidth(aContext, 4.0);
--  CGContextStrokeRect(aContext, NSRectToCGRect(aRect));
--#endif
- }
- 
- - (BOOL)isUsingOpenGL
- {
-   if (!mGeckoChild || ![self window])
-     return NO;
- 
-   return mGLContext || mUsingOMTCompositor;

+ 0 - 85
rel-257/mozilla-esr60/patches/1496823-6-64a1.patch

@@ -1,85 +0,0 @@
-# HG changeset patch
-# User Markus Stange <mstange@themasta.com>
-# Date 1539809300 0
-# Node ID 408b8733a0a6c805eab8c6bbcb267a07e6bc7dfd
-# Parent  dee64584fc8fbdb092d2f820ea7f259b545adf16
-Bug 1496823 - Inline drawUsingOpenGL into drawRect:inContext: and tweak a comment. r=spohl
-
-Depends on D7928
-
-Differential Revision: https://phabricator.services.mozilla.com/D7929
-
-diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
---- a/widget/cocoa/nsChildView.mm
-+++ b/widget/cocoa/nsChildView.mm
-@@ -174,17 +174,16 @@ static NSMutableDictionary* sNativeKeyEv
-                            toGeckoEvent:(WidgetMouseEvent*)outGeckoEvent;
- - (NSMenu*)contextMenu;
- 
- - (BOOL)isRectObscuredBySubview:(NSRect)inRect;
- 
- - (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext;
- - (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
- - (BOOL)isUsingOpenGL;
--- (void)drawUsingOpenGL;
- 
- - (BOOL)hasRoundedBottomCorners;
- - (CGFloat)cornerRadius;
- - (void)clearCorners;
- 
- -(void)setGLOpaque:(BOOL)aOpaque;
- 
- // Overlay drawing functions for traditional CGContext drawing
-@@ -3601,18 +3600,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
-     // buffer may now contain garbage which we need to prevent from reaching
-     // the screen. The only place where garbage can show is in the window
-     // corners and the vibrant regions of the window - the rest of the window
-     // is covered by opaque content in our OpenGL surface.
-     // So we need to clear the pixel buffer contents in these areas.
-     mGeckoChild->ClearVibrantAreas();
-     [self clearCorners];
- 
--    // Do GL composition and return.
--    [self drawUsingOpenGL];
-+    // Force a sync OMTC composite into the OpenGL context and return.
-+    LayoutDeviceIntRect geckoBounds = mGeckoChild->GetBounds();
-+    LayoutDeviceIntRegion region(geckoBounds);
-+    mGeckoChild->PaintWindow(region);
-     return;
-   }
- 
-   AUTO_PROFILER_LABEL("ChildView::drawRect", GRAPHICS);
- 
-   // The CGContext that drawRect supplies us with comes with a transform that
-   // scales one user space unit to one Cocoa point, which can consist of
-   // multiple dev pixels. But Gecko expects its supplied context to be scaled
-@@ -3647,29 +3648,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
- - (BOOL)isUsingOpenGL
- {
-   if (!mGeckoChild || ![self window])
-     return NO;
- 
-   return mGLContext || mUsingOMTCompositor;
- }
- 
--- (void)drawUsingOpenGL
--{
--  AUTO_PROFILER_LABEL("ChildView::drawUsingOpenGL", GRAPHICS);
--
--  if (![self isUsingOpenGL] || !mGeckoChild->IsVisible())
--    return;
--
--  LayoutDeviceIntRect geckoBounds = mGeckoChild->GetBounds();
--  LayoutDeviceIntRegion region(geckoBounds);
--
--  mGeckoChild->PaintWindow(region);
--}
--
- - (BOOL)hasRoundedBottomCorners
- {
-   return [[self window] respondsToSelector:@selector(bottomCornerRounded)] &&
-   [[self window] bottomCornerRounded];
- }
- 
- - (CGFloat)cornerRadius
- {

+ 0 - 120
rel-257/mozilla-esr60/patches/1496823-7-64a1.patch

@@ -1,120 +0,0 @@
-# HG changeset patch
-# User Markus Stange <mstange@themasta.com>
-# Date 1539809358 0
-# Node ID c9da89f17cf9426dbfad7af2940ebc9f05225c3a
-# Parent  36f6ce2e1e457bd88b14ebf686b9f64cdd3db17e
-Bug 1496823 - Inline -[ChildView drawRect:inContext:] into -[ChildView drawRect:]. r=spohl
-
-This was separate because at some point in the past we were calling
--[ChildView drawRect:inContext:] from a separate draw-in-titlebar pass. That separate
-pass was removed in bug 676241.
-
-Depends on D7929
-
-Differential Revision: https://phabricator.services.mozilla.com/D7931
-
-diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
---- a/widget/cocoa/nsChildView.mm
-+++ b/widget/cocoa/nsChildView.mm
-@@ -171,17 +171,16 @@ static NSMutableDictionary* sNativeKeyEv
- - (void) convertCocoaMouseEvent:(NSEvent*)aMouseEvent
-                    toGeckoEvent:(WidgetInputEvent*)outGeckoEvent;
- - (void) convertCocoaTabletPointerEvent:(NSEvent*)aMouseEvent
-                            toGeckoEvent:(WidgetMouseEvent*)outGeckoEvent;
- - (NSMenu*)contextMenu;
- 
- - (BOOL)isRectObscuredBySubview:(NSRect)inRect;
- 
--- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext;
- - (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
- - (BOOL)isUsingOpenGL;
- 
- - (BOOL)hasRoundedBottomCorners;
- - (CGFloat)cornerRadius;
- - (void)clearCorners;
- 
- -(void)setGLOpaque:(BOOL)aOpaque;
-@@ -3574,32 +3573,29 @@ NSEvent* gLastDragMouseDownEvent = nil;
-   region.And(region, boundingRect);
-   return region;
- }
- 
- // The display system has told us that a portion of our view is dirty. Tell
- // gecko to paint it
- - (void)drawRect:(NSRect)aRect
- {
--  CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
--  [self drawRect:aRect inContext:cgContext];
--}
--
--- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext
--{
-   if (!NS_IsMainThread()) {
-     // In the presence of CoreAnimation, this method can sometimes be called on
-     // a non-main thread. Ignore those calls because Gecko can only react to
-     // them on the main thread.
-     return;
-   }
- 
-   if (!mGeckoChild || !mGeckoChild->IsVisible())
-     return;
- 
-+  CGContextRef cgContext =
-+    (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
-+
-   if ([self isUsingOpenGL]) {
-     // Since this view is usually declared as opaque, the window's pixel
-     // buffer may now contain garbage which we need to prevent from reaching
-     // the screen. The only place where garbage can show is in the window
-     // corners and the vibrant regions of the window - the rest of the window
-     // is covered by opaque content in our OpenGL surface.
-     // So we need to clear the pixel buffer contents in these areas.
-     mGeckoChild->ClearVibrantAreas();
-@@ -3614,39 +3610,40 @@ NSEvent* gLastDragMouseDownEvent = nil;
- 
-   AUTO_PROFILER_LABEL("ChildView::drawRect", GRAPHICS);
- 
-   // The CGContext that drawRect supplies us with comes with a transform that
-   // scales one user space unit to one Cocoa point, which can consist of
-   // multiple dev pixels. But Gecko expects its supplied context to be scaled
-   // to device pixels, so we need to reverse the scaling.
-   double scale = mGeckoChild->BackingScaleFactor();
--  CGContextSaveGState(aContext);
--  CGContextScaleCTM(aContext, 1.0 / scale, 1.0 / scale);
-+  CGContextSaveGState(cgContext);
-+  CGContextScaleCTM(cgContext, 1.0 / scale, 1.0 / scale);
- 
-   NSSize viewSize = [self bounds].size;
-   gfx::IntSize backingSize = gfx::IntSize::Truncate(viewSize.width * scale, viewSize.height * scale);
-   LayoutDeviceIntRegion region = [self nativeDirtyRegionWithBoundingRect:aRect];
- 
--  bool painted = mGeckoChild->PaintWindowInContext(aContext, region, backingSize);
-+  bool painted =
-+    mGeckoChild->PaintWindowInContext(cgContext, region, backingSize);
- 
-   // Undo the scale transform so that from now on the context is in
-   // CocoaPoints again.
--  CGContextRestoreGState(aContext);
-+  CGContextRestoreGState(cgContext);
- 
-   if (!painted && [self isOpaque]) {
-     // Gecko refused to draw, but we've claimed to be opaque, so we have to
-     // draw something--fill with white.
--    CGContextSetRGBFillColor(aContext, 1, 1, 1, 1);
--    CGContextFillRect(aContext, NSRectToCGRect(aRect));
-+    CGContextSetRGBFillColor(cgContext, 1, 1, 1, 1);
-+    CGContextFillRect(cgContext, NSRectToCGRect(aRect));
-   }
- 
-   if ([self isCoveringTitlebar]) {
-     [self drawTitleString];
--    [self maskTopCornersInContext:aContext];
-+    [self maskTopCornersInContext:cgContext];
-   }
- }
- 
- - (BOOL)isUsingOpenGL
- {
-   if (!mGeckoChild || ![self window])
-     return NO;
- 

+ 0 - 36
rel-257/mozilla-esr60/patches/1496823-8-64a1.patch

@@ -1,36 +0,0 @@
-# HG changeset patch
-# User Markus Stange <mstange@themasta.com>
-# Date 1539809409 0
-# Node ID 075201afc029437db5a51b94bd0fde25cb74c202
-# Parent  616a2e8a0dddac0042d1ee9e8d770683ea4a2eca
-Bug 1496823 - Remove declaration of -[NSView _regionForOpaqueDescendants:forMove:]. r=spohl
-
-Our implementation of this method was removed in bug 1070710. I forgot to remove the declaration in that bug.
-
-Differential Revision: https://phabricator.services.mozilla.com/D7947
-
-diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
---- a/widget/cocoa/nsChildView.mm
-+++ b/widget/cocoa/nsChildView.mm
-@@ -210,21 +210,16 @@ static NSMutableDictionary* sNativeKeyEv
- - (bool)shouldConsiderStartingSwipeFromEvent:(NSEvent*)aEvent;
- 
- @end
- 
- @interface NSView(NSThemeFrameCornerRadius)
- - (float)roundedCornerRadius;
- @end
- 
--@interface NSView(DraggableRegion)
--- (CGSRegionObj)_regionForOpaqueDescendants:(NSRect)aRect forMove:(BOOL)aForMove;
--- (CGSRegionObj)_regionForOpaqueDescendants:(NSRect)aRect forMove:(BOOL)aForMove forUnderTitlebar:(BOOL)aForUnderTitlebar;
--@end
--
- @interface NSWindow(NSWindowShouldZoomOnDoubleClick)
- + (BOOL)_shouldZoomOnDoubleClick; // present on 10.7 and above
- @end
- 
- // Starting with 10.7 the bottom corners of all windows are rounded.
- // Unfortunately, the standard rounding that OS X applies to OpenGL views
- // does not use anti-aliasing and looks very crude. Since we want a smooth,
- // anti-aliased curve, we'll draw it ourselves.

+ 0 - 3352
rel-257/mozilla-esr60/patches/1500637-65a1.patch

@@ -1,3352 +0,0 @@
-# HG changeset patch
-# User Jonathan Watt <jwatt@jwatt.org>
-# Date 1539821799 -3600
-# Node ID 5722affcf49d606d48cd70349443baea978caa98
-# Parent  a6429826679a3e0e13e79abfca63501ae1a3ccac
-Bug 1500637. Remove MOZ_WIDGET_TOOLKIT==gtk2 code. r=karlt
-
-Differential Revision: https://phabricator.services.mozilla.com/D9326
-
-diff --git a/old-configure.in b/old-configure.in
---- a/old-configure.in
-+++ b/old-configure.in
-@@ -2105,33 +2105,26 @@ if test "$COMPILE_ENVIRONMENT"; then
-     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
-     TK_CFLAGS=$MOZ_GTK3_CFLAGS
-     TK_LIBS=$MOZ_GTK3_LIBS
-     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
-     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
-     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
-     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
-   fi
--  if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
--    GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
--  fi
-   if test "$MOZ_ENABLE_GTK"; then
-     if test "$MOZ_X11"; then
-       GDK_PACKAGES=gdk-x11-2.0
-     fi
-     AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
-     AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
- 
-     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 $GDK_PACKAGES)
-     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
-   fi
--  if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
--    TK_CFLAGS=$MOZ_GTK2_CFLAGS
--    TK_LIBS=$MOZ_GTK2_LIBS
--  fi
- fi # COMPILE_ENVIRONMENT
- 
- AC_SUBST(MOZ_FS_LAYOUT)
- 
- dnl ========================================================
- dnl = startup-notification support module
- dnl ========================================================
- 
-diff --git a/widget/gtk/gtk2drawing.c b/widget/gtk/gtk2drawing.c
-deleted file mode 100644
---- a/widget/gtk/gtk2drawing.c
-+++ /dev/null
-@@ -1,3266 +0,0 @@
--/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
--/* This Source Code Form is subject to the terms of the Mozilla Public
-- * License, v. 2.0. If a copy of the MPL was not distributed with this
-- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
--
--/*
-- * This file contains painting functions for each of the gtk2 widgets.
-- * Adapted from the gtkdrawing.c, and gtk+2.0 source.
-- */
--
--#include <gtk/gtk.h>
--#include <gdk/gdkprivate.h>
--#include <string.h>
--#include "gtkdrawing.h"
--#include "mozilla/Assertions.h"
--#include "prinrval.h"
--
--#include <math.h>
--#include <stdbool.h>  // for MOZ_ASSERT_UNREACHABLE
--
--#define XTHICKNESS(style) (style->xthickness)
--#define YTHICKNESS(style) (style->ythickness)
--#define WINDOW_IS_MAPPED(window) \
--  ((window) && GDK_IS_WINDOW(window) && gdk_window_is_visible(window))
--
--static GtkWidget* gProtoWindow;
--static GtkWidget* gProtoLayout;
--static GtkWidget* gButtonWidget;
--static GtkWidget* gToggleButtonWidget;
--static GtkWidget* gButtonArrowWidget;
--static GtkWidget* gCheckboxWidget;
--static GtkWidget* gRadiobuttonWidget;
--static GtkWidget* gHorizScrollbarWidget;
--static GtkWidget* gVertScrollbarWidget;
--static GtkWidget* gSpinWidget;
--static GtkWidget* gHScaleWidget;
--static GtkWidget* gVScaleWidget;
--static GtkWidget* gEntryWidget;
--static GtkWidget* gComboBoxWidget;
--static GtkWidget* gComboBoxButtonWidget;
--static GtkWidget* gComboBoxArrowWidget;
--static GtkWidget* gComboBoxSeparatorWidget;
--static GtkWidget* gComboBoxEntryWidget;
--static GtkWidget* gComboBoxEntryTextareaWidget;
--static GtkWidget* gComboBoxEntryButtonWidget;
--static GtkWidget* gComboBoxEntryArrowWidget;
--static GtkWidget* gHandleBoxWidget;
--static GtkWidget* gToolbarWidget;
--static GtkWidget* gFrameWidget;
--static GtkWidget* gStatusbarWidget;
--static GtkWidget* gProgressWidget;
--static GtkWidget* gTabWidget;
--static GtkWidget* gTooltipWidget;
--static GtkWidget* gMenuBarWidget;
--static GtkWidget* gMenuBarItemWidget;
--static GtkWidget* gMenuPopupWidget;
--static GtkWidget* gMenuItemWidget;
--static GtkWidget* gCheckMenuItemWidget;
--static GtkWidget* gTreeViewWidget;
--static GtkTreeViewColumn* gMiddleTreeViewColumn;
--static GtkWidget* gTreeHeaderCellWidget;
--static GtkWidget* gTreeHeaderSortArrowWidget;
--static GtkWidget* gExpanderWidget;
--static GtkWidget* gToolbarSeparatorWidget;
--static GtkWidget* gMenuSeparatorWidget;
--static GtkWidget* gHPanedWidget;
--static GtkWidget* gVPanedWidget;
--static GtkWidget* gScrolledWindowWidget;
--
--static gboolean have_arrow_scaling;
--static gboolean is_initialized;
--
--/* Because we have such an unconventional way of drawing widgets, signal to the
--   GTK theme engine that they are drawing for Mozilla instead of a conventional
--   GTK app so they can do any specific things they may want to do. */
--static void moz_gtk_set_widget_name(GtkWidget* widget) {
--  gtk_widget_set_name(widget, "MozillaGtkWidget");
--}
--
--static gint ensure_window_widget() {
--  if (!gProtoWindow) {
--    gProtoWindow = gtk_window_new(GTK_WINDOW_POPUP);
--    gtk_widget_realize(gProtoWindow);
--    moz_gtk_set_widget_name(gProtoWindow);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint setup_widget_prototype(GtkWidget* widget) {
--  ensure_window_widget();
--  if (!gProtoLayout) {
--    gProtoLayout = gtk_fixed_new();
--    gtk_container_add(GTK_CONTAINER(gProtoWindow), gProtoLayout);
--  }
--
--  gtk_container_add(GTK_CONTAINER(gProtoLayout), widget);
--  gtk_widget_realize(widget);
--  g_object_set_data(G_OBJECT(widget), "transparent-bg-hint",
--                    GINT_TO_POINTER(TRUE));
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_button_widget() {
--  if (!gButtonWidget) {
--    gButtonWidget = gtk_button_new_with_label("M");
--    setup_widget_prototype(gButtonWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_hpaned_widget() {
--  if (!gHPanedWidget) {
--    gHPanedWidget = gtk_hpaned_new();
--    setup_widget_prototype(gHPanedWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_vpaned_widget() {
--  if (!gVPanedWidget) {
--    gVPanedWidget = gtk_vpaned_new();
--    setup_widget_prototype(gVPanedWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_toggle_button_widget() {
--  if (!gToggleButtonWidget) {
--    gToggleButtonWidget = gtk_toggle_button_new();
--    setup_widget_prototype(gToggleButtonWidget);
--    /* toggle button must be set active to get the right style on hover. */
--    GTK_TOGGLE_BUTTON(gToggleButtonWidget)->active = TRUE;
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_button_arrow_widget() {
--  if (!gButtonArrowWidget) {
--    ensure_toggle_button_widget();
--
--    gButtonArrowWidget = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
--    gtk_container_add(GTK_CONTAINER(gToggleButtonWidget), gButtonArrowWidget);
--    gtk_widget_realize(gButtonArrowWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_checkbox_widget() {
--  if (!gCheckboxWidget) {
--    gCheckboxWidget = gtk_check_button_new_with_label("M");
--    setup_widget_prototype(gCheckboxWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_radiobutton_widget() {
--  if (!gRadiobuttonWidget) {
--    gRadiobuttonWidget = gtk_radio_button_new_with_label(NULL, "M");
--    setup_widget_prototype(gRadiobuttonWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_scrollbar_widget() {
--  if (!gVertScrollbarWidget) {
--    gVertScrollbarWidget = gtk_vscrollbar_new(NULL);
--    setup_widget_prototype(gVertScrollbarWidget);
--  }
--  if (!gHorizScrollbarWidget) {
--    gHorizScrollbarWidget = gtk_hscrollbar_new(NULL);
--    setup_widget_prototype(gHorizScrollbarWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_spin_widget() {
--  if (!gSpinWidget) {
--    gSpinWidget = gtk_spin_button_new(NULL, 1, 0);
--    setup_widget_prototype(gSpinWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_scale_widget() {
--  if (!gHScaleWidget) {
--    gHScaleWidget = gtk_hscale_new(NULL);
--    setup_widget_prototype(gHScaleWidget);
--  }
--  if (!gVScaleWidget) {
--    gVScaleWidget = gtk_vscale_new(NULL);
--    setup_widget_prototype(gVScaleWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_entry_widget() {
--  if (!gEntryWidget) {
--    gEntryWidget = gtk_entry_new();
--    setup_widget_prototype(gEntryWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--/* We need to have pointers to the inner widgets (button, separator, arrow)
-- * of the ComboBox to get the correct rendering from theme engines which
-- * special cases their look. Since the inner layout can change, we ask GTK
-- * to NULL our pointers when they are about to become invalid because the
-- * corresponding widgets don't exist anymore. It's the role of
-- * g_object_add_weak_pointer().
-- * Note that if we don't find the inner widgets (which shouldn't happen), we
-- * fallback to use generic "non-inner" widgets, and they don't need that kind
-- * of weak pointer since they are explicit children of gProtoWindow and as
-- * such GTK holds a strong reference to them. */
--static void moz_gtk_get_combo_box_inner_button(GtkWidget* widget,
--                                               gpointer client_data) {
--  if (GTK_IS_TOGGLE_BUTTON(widget)) {
--    gComboBoxButtonWidget = widget;
--    g_object_add_weak_pointer(G_OBJECT(widget),
--                              (gpointer)&gComboBoxButtonWidget);
--    gtk_widget_realize(widget);
--    g_object_set_data(G_OBJECT(widget), "transparent-bg-hint",
--                      GINT_TO_POINTER(TRUE));
--  }
--}
--
--static void moz_gtk_get_combo_box_button_inner_widgets(GtkWidget* widget,
--                                                       gpointer client_data) {
--  if (GTK_IS_SEPARATOR(widget)) {
--    gComboBoxSeparatorWidget = widget;
--    g_object_add_weak_pointer(G_OBJECT(widget),
--                              (gpointer)&gComboBoxSeparatorWidget);
--  } else if (GTK_IS_ARROW(widget)) {
--    gComboBoxArrowWidget = widget;
--    g_object_add_weak_pointer(G_OBJECT(widget),
--                              (gpointer)&gComboBoxArrowWidget);
--  } else
--    return;
--  gtk_widget_realize(widget);
--  g_object_set_data(G_OBJECT(widget), "transparent-bg-hint",
--                    GINT_TO_POINTER(TRUE));
--}
--
--static gint ensure_combo_box_widgets() {
--  GtkWidget* buttonChild;
--
--  if (gComboBoxButtonWidget && gComboBoxArrowWidget) return MOZ_GTK_SUCCESS;
--
--  /* Create a ComboBox if needed */
--  if (!gComboBoxWidget) {
--    gComboBoxWidget = gtk_combo_box_new();
--    setup_widget_prototype(gComboBoxWidget);
--  }
--
--  /* Get its inner Button */
--  gtk_container_forall(GTK_CONTAINER(gComboBoxWidget),
--                       moz_gtk_get_combo_box_inner_button, NULL);
--
--  if (gComboBoxButtonWidget) {
--    /* Get the widgets inside the Button */
--    buttonChild = GTK_BIN(gComboBoxButtonWidget)->child;
--    if (GTK_IS_HBOX(buttonChild)) {
--      /* appears-as-list = FALSE, cell-view = TRUE; the button
--       * contains an hbox. This hbox is there because the ComboBox
--       * needs to place a cell renderer, a separator, and an arrow in
--       * the button when appears-as-list is FALSE. */
--      gtk_container_forall(GTK_CONTAINER(buttonChild),
--                           moz_gtk_get_combo_box_button_inner_widgets, NULL);
--    } else if (GTK_IS_ARROW(buttonChild)) {
--      /* appears-as-list = TRUE, or cell-view = FALSE;
--       * the button only contains an arrow */
--      gComboBoxArrowWidget = buttonChild;
--      g_object_add_weak_pointer(G_OBJECT(buttonChild),
--                                (gpointer)&gComboBoxArrowWidget);
--      gtk_widget_realize(gComboBoxArrowWidget);
--      g_object_set_data(G_OBJECT(gComboBoxArrowWidget), "transparent-bg-hint",
--                        GINT_TO_POINTER(TRUE));
--    }
--  } else {
--    /* Shouldn't be reached with current internal gtk implementation; we
--     * use a generic toggle button as last resort fallback to avoid
--     * crashing. */
--    ensure_toggle_button_widget();
--    gComboBoxButtonWidget = gToggleButtonWidget;
--  }
--
--  if (!gComboBoxArrowWidget) {
--    /* Shouldn't be reached with current internal gtk implementation;
--     * we gButtonArrowWidget as last resort fallback to avoid
--     * crashing. */
--    ensure_button_arrow_widget();
--    gComboBoxArrowWidget = gButtonArrowWidget;
--  }
--
--  /* We don't test the validity of gComboBoxSeparatorWidget since there
--   * is none when "appears-as-list" = TRUE or "cell-view" = FALSE; if it
--   * is invalid we just won't paint it. */
--
--  return MOZ_GTK_SUCCESS;
--}
--
--/* We need to have pointers to the inner widgets (entry, button, arrow) of
-- * the ComboBoxEntry to get the correct rendering from theme engines which
-- * special cases their look. Since the inner layout can change, we ask GTK
-- * to NULL our pointers when they are about to become invalid because the
-- * corresponding widgets don't exist anymore. It's the role of
-- * g_object_add_weak_pointer().
-- * Note that if we don't find the inner widgets (which shouldn't happen), we
-- * fallback to use generic "non-inner" widgets, and they don't need that kind
-- * of weak pointer since they are explicit children of gProtoWindow and as
-- * such GTK holds a strong reference to them. */
--static void moz_gtk_get_combo_box_entry_inner_widgets(GtkWidget* widget,
--                                                      gpointer client_data) {
--  if (GTK_IS_TOGGLE_BUTTON(widget)) {
--    gComboBoxEntryButtonWidget = widget;
--    g_object_add_weak_pointer(G_OBJECT(widget),
--                              (gpointer)&gComboBoxEntryButtonWidget);
--  } else if (GTK_IS_ENTRY(widget)) {
--    gComboBoxEntryTextareaWidget = widget;
--    g_object_add_weak_pointer(G_OBJECT(widget),
--                              (gpointer)&gComboBoxEntryTextareaWidget);
--  } else
--    return;
--  gtk_widget_realize(widget);
--  g_object_set_data(G_OBJECT(widget), "transparent-bg-hint",
--                    GINT_TO_POINTER(TRUE));
--}
--
--static void moz_gtk_get_combo_box_entry_arrow(GtkWidget* widget,
--                                              gpointer client_data) {
--  if (GTK_IS_ARROW(widget)) {
--    gComboBoxEntryArrowWidget = widget;
--    g_object_add_weak_pointer(G_OBJECT(widget),
--                              (gpointer)&gComboBoxEntryArrowWidget);
--    gtk_widget_realize(widget);
--    g_object_set_data(G_OBJECT(widget), "transparent-bg-hint",
--                      GINT_TO_POINTER(TRUE));
--  }
--}
--
--static gint ensure_combo_box_entry_widgets() {
--  GtkWidget* buttonChild;
--
--  if (gComboBoxEntryTextareaWidget && gComboBoxEntryButtonWidget &&
--      gComboBoxEntryArrowWidget)
--    return MOZ_GTK_SUCCESS;
--
--  /* Create a ComboBoxEntry if needed */
--  if (!gComboBoxEntryWidget) {
--    gComboBoxEntryWidget = gtk_combo_box_entry_new();
--    setup_widget_prototype(gComboBoxEntryWidget);
--  }
--
--  /* Get its inner Entry and Button */
--  gtk_container_forall(GTK_CONTAINER(gComboBoxEntryWidget),
--                       moz_gtk_get_combo_box_entry_inner_widgets, NULL);
--
--  if (!gComboBoxEntryTextareaWidget) {
--    ensure_entry_widget();
--    gComboBoxEntryTextareaWidget = gEntryWidget;
--  }
--
--  if (gComboBoxEntryButtonWidget) {
--    /* Get the Arrow inside the Button */
--    buttonChild = GTK_BIN(gComboBoxEntryButtonWidget)->child;
--    if (GTK_IS_HBOX(buttonChild)) {
--      /* appears-as-list = FALSE, cell-view = TRUE; the button
--       * contains an hbox. This hbox is there because ComboBoxEntry
--       * inherits from ComboBox which needs to place a cell renderer,
--       * a separator, and an arrow in the button when appears-as-list
--       * is FALSE. Here the hbox should only contain an arrow, since
--       * a ComboBoxEntry doesn't need all those widgets in the
--       * button. */
--      gtk_container_forall(GTK_CONTAINER(buttonChild),
--                           moz_gtk_get_combo_box_entry_arrow, NULL);
--    } else if (GTK_IS_ARROW(buttonChild)) {
--      /* appears-as-list = TRUE, or cell-view = FALSE;
--       * the button only contains an arrow */
--      gComboBoxEntryArrowWidget = buttonChild;
--      g_object_add_weak_pointer(G_OBJECT(buttonChild),
--                                (gpointer)&gComboBoxEntryArrowWidget);
--      gtk_widget_realize(gComboBoxEntryArrowWidget);
--      g_object_set_data(G_OBJECT(gComboBoxEntryArrowWidget),
--                        "transparent-bg-hint", GINT_TO_POINTER(TRUE));
--    }
--  } else {
--    /* Shouldn't be reached with current internal gtk implementation;
--     * we use a generic toggle button as last resort fallback to avoid
--     * crashing. */
--    ensure_toggle_button_widget();
--    gComboBoxEntryButtonWidget = gToggleButtonWidget;
--  }
--
--  if (!gComboBoxEntryArrowWidget) {
--    /* Shouldn't be reached with current internal gtk implementation;
--     * we gButtonArrowWidget as last resort fallback to avoid
--     * crashing. */
--    ensure_button_arrow_widget();
--    gComboBoxEntryArrowWidget = gButtonArrowWidget;
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_handlebox_widget() {
--  if (!gHandleBoxWidget) {
--    gHandleBoxWidget = gtk_handle_box_new();
--    setup_widget_prototype(gHandleBoxWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_toolbar_widget() {
--  if (!gToolbarWidget) {
--    ensure_handlebox_widget();
--    gToolbarWidget = gtk_toolbar_new();
--    gtk_container_add(GTK_CONTAINER(gHandleBoxWidget), gToolbarWidget);
--    gtk_widget_realize(gToolbarWidget);
--    g_object_set_data(G_OBJECT(gToolbarWidget), "transparent-bg-hint",
--                      GINT_TO_POINTER(TRUE));
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_toolbar_separator_widget() {
--  if (!gToolbarSeparatorWidget) {
--    ensure_toolbar_widget();
--    gToolbarSeparatorWidget = GTK_WIDGET(gtk_separator_tool_item_new());
--    setup_widget_prototype(gToolbarSeparatorWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_tooltip_widget() {
--  if (!gTooltipWidget) {
--    gTooltipWidget = gtk_window_new(GTK_WINDOW_POPUP);
--    gtk_widget_realize(gTooltipWidget);
--    moz_gtk_set_widget_name(gTooltipWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_tab_widget() {
--  if (!gTabWidget) {
--    gTabWidget = gtk_notebook_new();
--    setup_widget_prototype(gTabWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_progress_widget() {
--  if (!gProgressWidget) {
--    gProgressWidget = gtk_progress_bar_new();
--    setup_widget_prototype(gProgressWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_statusbar_widget() {
--  if (!gStatusbarWidget) {
--    gStatusbarWidget = gtk_statusbar_new();
--    setup_widget_prototype(gStatusbarWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_frame_widget() {
--  if (!gFrameWidget) {
--    ensure_statusbar_widget();
--    gFrameWidget = gtk_frame_new(NULL);
--    gtk_container_add(GTK_CONTAINER(gStatusbarWidget), gFrameWidget);
--    gtk_widget_realize(gFrameWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_menu_bar_widget() {
--  if (!gMenuBarWidget) {
--    gMenuBarWidget = gtk_menu_bar_new();
--    setup_widget_prototype(gMenuBarWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_menu_bar_item_widget() {
--  if (!gMenuBarItemWidget) {
--    ensure_menu_bar_widget();
--    gMenuBarItemWidget = gtk_menu_item_new();
--    gtk_menu_shell_append(GTK_MENU_SHELL(gMenuBarWidget), gMenuBarItemWidget);
--    gtk_widget_realize(gMenuBarItemWidget);
--    g_object_set_data(G_OBJECT(gMenuBarItemWidget), "transparent-bg-hint",
--                      GINT_TO_POINTER(TRUE));
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_menu_popup_widget() {
--  if (!gMenuPopupWidget) {
--    ensure_menu_bar_item_widget();
--    gMenuPopupWidget = gtk_menu_new();
--    gtk_menu_item_set_submenu(GTK_MENU_ITEM(gMenuBarItemWidget),
--                              gMenuPopupWidget);
--    gtk_widget_realize(gMenuPopupWidget);
--    g_object_set_data(G_OBJECT(gMenuPopupWidget), "transparent-bg-hint",
--                      GINT_TO_POINTER(TRUE));
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_menu_item_widget() {
--  if (!gMenuItemWidget) {
--    ensure_menu_popup_widget();
--    gMenuItemWidget = gtk_menu_item_new_with_label("M");
--    gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget), gMenuItemWidget);
--    gtk_widget_realize(gMenuItemWidget);
--    g_object_set_data(G_OBJECT(gMenuItemWidget), "transparent-bg-hint",
--                      GINT_TO_POINTER(TRUE));
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_menu_separator_widget() {
--  if (!gMenuSeparatorWidget) {
--    ensure_menu_popup_widget();
--    gMenuSeparatorWidget = gtk_separator_menu_item_new();
--    gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
--                          gMenuSeparatorWidget);
--    gtk_widget_realize(gMenuSeparatorWidget);
--    g_object_set_data(G_OBJECT(gMenuSeparatorWidget), "transparent-bg-hint",
--                      GINT_TO_POINTER(TRUE));
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_check_menu_item_widget() {
--  if (!gCheckMenuItemWidget) {
--    ensure_menu_popup_widget();
--    gCheckMenuItemWidget = gtk_check_menu_item_new_with_label("M");
--    gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
--                          gCheckMenuItemWidget);
--    gtk_widget_realize(gCheckMenuItemWidget);
--    g_object_set_data(G_OBJECT(gCheckMenuItemWidget), "transparent-bg-hint",
--                      GINT_TO_POINTER(TRUE));
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_tree_view_widget() {
--  if (!gTreeViewWidget) {
--    gTreeViewWidget = gtk_tree_view_new();
--    setup_widget_prototype(gTreeViewWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_tree_header_cell_widget() {
--  if (!gTreeHeaderCellWidget) {
--    /*
--     * Some GTK engines paint the first and last cell
--     * of a TreeView header with a highlight.
--     * Since we do not know where our widget will be relative
--     * to the other buttons in the TreeView header, we must
--     * paint it as a button that is between two others,
--     * thus ensuring it is neither the first or last button
--     * in the header.
--     * GTK doesn't give us a way to do this explicitly,
--     * so we must paint with a button that is between two
--     * others.
--     */
--
--    GtkTreeViewColumn* firstTreeViewColumn;
--    GtkTreeViewColumn* lastTreeViewColumn;
--
--    ensure_tree_view_widget();
--
--    /* Create and append our three columns */
--    firstTreeViewColumn = gtk_tree_view_column_new();
--    gtk_tree_view_column_set_title(firstTreeViewColumn, "M");
--    gtk_tree_view_append_column(GTK_TREE_VIEW(gTreeViewWidget),
--                                firstTreeViewColumn);
--
--    gMiddleTreeViewColumn = gtk_tree_view_column_new();
--    gtk_tree_view_column_set_title(gMiddleTreeViewColumn, "M");
--    gtk_tree_view_append_column(GTK_TREE_VIEW(gTreeViewWidget),
--                                gMiddleTreeViewColumn);
--
--    lastTreeViewColumn = gtk_tree_view_column_new();
--    gtk_tree_view_column_set_title(lastTreeViewColumn, "M");
--    gtk_tree_view_append_column(GTK_TREE_VIEW(gTreeViewWidget),
--                                lastTreeViewColumn);
--
--    /* Use the middle column's header for our button */
--    gTreeHeaderCellWidget = gMiddleTreeViewColumn->button;
--    gTreeHeaderSortArrowWidget = gMiddleTreeViewColumn->arrow;
--    g_object_set_data(G_OBJECT(gTreeHeaderCellWidget), "transparent-bg-hint",
--                      GINT_TO_POINTER(TRUE));
--    g_object_set_data(G_OBJECT(gTreeHeaderSortArrowWidget),
--                      "transparent-bg-hint", GINT_TO_POINTER(TRUE));
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_expander_widget() {
--  if (!gExpanderWidget) {
--    gExpanderWidget = gtk_expander_new("M");
--    setup_widget_prototype(gExpanderWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint ensure_scrolled_window_widget() {
--  if (!gScrolledWindowWidget) {
--    gScrolledWindowWidget = gtk_scrolled_window_new(NULL, NULL);
--    setup_widget_prototype(gScrolledWindowWidget);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static GtkStateType ConvertGtkState(GtkWidgetState* state) {
--  if (state->disabled)
--    return GTK_STATE_INSENSITIVE;
--  else if (state->depressed)
--    return (state->inHover ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
--  else if (state->inHover)
--    return (state->active ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT);
--  else
--    return GTK_STATE_NORMAL;
--}
--
--static gint TSOffsetStyleGCArray(GdkGC** gcs, gint xorigin, gint yorigin) {
--  int i;
--  /* there are 5 gc's in each array, for each of the widget states */
--  for (i = 0; i < 5; ++i) gdk_gc_set_ts_origin(gcs[i], xorigin, yorigin);
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint TSOffsetStyleGCs(GtkStyle* style, gint xorigin, gint yorigin) {
--  TSOffsetStyleGCArray(style->fg_gc, xorigin, yorigin);
--  TSOffsetStyleGCArray(style->bg_gc, xorigin, yorigin);
--  TSOffsetStyleGCArray(style->light_gc, xorigin, yorigin);
--  TSOffsetStyleGCArray(style->dark_gc, xorigin, yorigin);
--  TSOffsetStyleGCArray(style->mid_gc, xorigin, yorigin);
--  TSOffsetStyleGCArray(style->text_gc, xorigin, yorigin);
--  TSOffsetStyleGCArray(style->base_gc, xorigin, yorigin);
--  gdk_gc_set_ts_origin(style->black_gc, xorigin, yorigin);
--  gdk_gc_set_ts_origin(style->white_gc, xorigin, yorigin);
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_init() {
--  GtkWidgetClass* entry_class;
--
--  if (is_initialized) return MOZ_GTK_SUCCESS;
--
--  is_initialized = TRUE;
--  have_arrow_scaling = (gtk_major_version > 2 ||
--                        (gtk_major_version == 2 && gtk_minor_version >= 12));
--
--  /* Add style property to GtkEntry.
--   * Adding the style property to the normal GtkEntry class means that it
--   * will work without issues inside GtkComboBox and for Spinbuttons. */
--  entry_class = g_type_class_ref(GTK_TYPE_ENTRY);
--  gtk_widget_class_install_style_property(
--      entry_class,
--      g_param_spec_boolean("honors-transparent-bg-hint",
--                           "Transparent BG enabling flag",
--                           "If TRUE, the theme is able to draw the GtkEntry on "
--                           "non-prefilled background.",
--                           FALSE, G_PARAM_READWRITE));
--
--  return MOZ_GTK_SUCCESS;
--}
--
--GdkColormap* moz_gtk_widget_get_colormap() {
--  /* Child widgets inherit the colormap from the GtkWindow. */
--  ensure_window_widget();
--  return gtk_widget_get_colormap(gProtoWindow);
--}
--
--gint moz_gtk_checkbox_get_metrics(gint* indicator_size,
--                                  gint* indicator_spacing) {
--  ensure_checkbox_widget();
--
--  gtk_widget_style_get(gCheckboxWidget, "indicator_size", indicator_size,
--                       "indicator_spacing", indicator_spacing, NULL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing) {
--  ensure_radiobutton_widget();
--
--  gtk_widget_style_get(gRadiobuttonWidget, "indicator_size", indicator_size,
--                       "indicator_spacing", indicator_spacing, NULL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_get_focus_outline_size(gint* focus_h_width, gint* focus_v_width) {
--  gboolean interior_focus;
--  gint focus_width = 0;
--
--  ensure_entry_widget();
--  gtk_widget_style_get(gEntryWidget, "interior-focus", &interior_focus,
--                       "focus-line-width", &focus_width, NULL);
--  if (interior_focus) {
--    *focus_h_width = XTHICKNESS(gEntryWidget->style) + focus_width;
--    *focus_v_width = YTHICKNESS(gEntryWidget->style) + focus_width;
--  } else {
--    *focus_h_width = focus_width;
--    *focus_v_width = focus_width;
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_widget_get_focus(GtkWidget* widget,
--                                     gboolean* interior_focus,
--                                     gint* focus_width, gint* focus_pad) {
--  gtk_widget_style_get(widget, "interior-focus", interior_focus,
--                       "focus-line-width", focus_width, "focus-padding",
--                       focus_pad, NULL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_menuitem_get_horizontal_padding(gint* horizontal_padding) {
--  ensure_menu_item_widget();
--
--  gtk_widget_style_get(gMenuItemWidget, "horizontal-padding",
--                       horizontal_padding, NULL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_checkmenuitem_get_horizontal_padding(gint* horizontal_padding) {
--  ensure_check_menu_item_widget();
--
--  gtk_widget_style_get(gCheckMenuItemWidget, "horizontal-padding",
--                       horizontal_padding, NULL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_button_get_default_overflow(gint* border_top, gint* border_left,
--                                         gint* border_bottom,
--                                         gint* border_right) {
--  GtkBorder* default_outside_border;
--
--  ensure_button_widget();
--  gtk_widget_style_get(gButtonWidget, "default-outside-border",
--                       &default_outside_border, NULL);
--
--  if (default_outside_border) {
--    *border_top = default_outside_border->top;
--    *border_left = default_outside_border->left;
--    *border_bottom = default_outside_border->bottom;
--    *border_right = default_outside_border->right;
--    gtk_border_free(default_outside_border);
--  } else {
--    *border_top = *border_left = *border_bottom = *border_right = 0;
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_button_get_default_border(gint* border_top,
--                                              gint* border_left,
--                                              gint* border_bottom,
--                                              gint* border_right) {
--  GtkBorder* default_border;
--
--  ensure_button_widget();
--  gtk_widget_style_get(gButtonWidget, "default-border", &default_border, NULL);
--
--  if (default_border) {
--    *border_top = default_border->top;
--    *border_left = default_border->left;
--    *border_bottom = default_border->bottom;
--    *border_right = default_border->right;
--    gtk_border_free(default_border);
--  } else {
--    /* see gtkbutton.c */
--    *border_top = *border_left = *border_bottom = *border_right = 1;
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_splitter_get_metrics(gint orientation, gint* size) {
--  if (orientation == GTK_ORIENTATION_HORIZONTAL) {
--    ensure_hpaned_widget();
--    gtk_widget_style_get(gHPanedWidget, "handle_size", size, NULL);
--  } else {
--    ensure_vpaned_widget();
--    gtk_widget_style_get(gVPanedWidget, "handle_size", size, NULL);
--  }
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_button_get_inner_border(GtkWidget* widget,
--                                            GtkBorder* inner_border) {
--  static const GtkBorder default_inner_border = {1, 1, 1, 1};
--  GtkBorder* tmp_border;
--
--  gtk_widget_style_get(widget, "inner-border", &tmp_border, NULL);
--
--  if (tmp_border) {
--    *inner_border = *tmp_border;
--    gtk_border_free(tmp_border);
--  } else
--    *inner_border = default_inner_border;
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_button_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                 GdkRectangle* cliprect, GtkWidgetState* state,
--                                 GtkReliefStyle relief, GtkWidget* widget,
--                                 GtkTextDirection direction) {
--  GtkShadowType shadow_type;
--  GtkStyle* style = widget->style;
--  GtkStateType button_state = ConvertGtkState(state);
--  gint x = rect->x, y = rect->y, width = rect->width, height = rect->height;
--
--  gboolean interior_focus;
--  gint focus_width, focus_pad;
--
--  moz_gtk_widget_get_focus(widget, &interior_focus, &focus_width, &focus_pad);
--
--  if (WINDOW_IS_MAPPED(drawable)) {
--    gdk_window_set_back_pixmap(drawable, NULL, TRUE);
--    gdk_window_clear_area(drawable, cliprect->x, cliprect->y, cliprect->width,
--                          cliprect->height);
--  }
--
--  gtk_widget_set_state(widget, button_state);
--  gtk_widget_set_direction(widget, direction);
--
--  if (state->isDefault) GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_DEFAULT);
--
--  GTK_BUTTON(widget)->relief = relief;
--
--  /* Some theme engines love to cause us pain in that gtk_paint_focus is a
--     no-op on buttons and button-like widgets. They only listen to this flag. */
--  if (state->focused && !state->disabled)
--    GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
--
--  if (!interior_focus && state->focused) {
--    x += focus_width + focus_pad;
--    y += focus_width + focus_pad;
--    width -= 2 * (focus_width + focus_pad);
--    height -= 2 * (focus_width + focus_pad);
--  }
--
--  shadow_type = button_state == GTK_STATE_ACTIVE || state->depressed
--                    ? GTK_SHADOW_IN
--                    : GTK_SHADOW_OUT;
--
--  if (state->isDefault && relief == GTK_RELIEF_NORMAL) {
--    /* handle default borders both outside and inside the button */
--    gint default_top, default_left, default_bottom, default_right;
--    moz_gtk_button_get_default_overflow(&default_top, &default_left,
--                                        &default_bottom, &default_right);
--    x -= default_left;
--    y -= default_top;
--    width += default_left + default_right;
--    height += default_top + default_bottom;
--    gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, cliprect,
--                  widget, "buttondefault", x, y, width, height);
--
--    moz_gtk_button_get_default_border(&default_top, &default_left,
--                                      &default_bottom, &default_right);
--    x += default_left;
--    y += default_top;
--    width -= (default_left + default_right);
--    height -= (default_top + default_bottom);
--  }
--
--  if (relief != GTK_RELIEF_NONE || state->depressed ||
--      (button_state != GTK_STATE_NORMAL &&
--       button_state != GTK_STATE_INSENSITIVE)) {
--    TSOffsetStyleGCs(style, x, y);
--    /* the following line can trigger an assertion (Crux theme)
--       file ../../gdk/gdkwindow.c: line 1846 (gdk_window_clear_area):
--       assertion `GDK_IS_WINDOW (window)' failed */
--    gtk_paint_box(style, drawable, button_state, shadow_type, cliprect, widget,
--                  "button", x, y, width, height);
--  }
--
--  if (state->focused) {
--    if (interior_focus) {
--      x += widget->style->xthickness + focus_pad;
--      y += widget->style->ythickness + focus_pad;
--      width -= 2 * (widget->style->xthickness + focus_pad);
--      height -= 2 * (widget->style->ythickness + focus_pad);
--    } else {
--      x -= focus_width + focus_pad;
--      y -= focus_width + focus_pad;
--      width += 2 * (focus_width + focus_pad);
--      height += 2 * (focus_width + focus_pad);
--    }
--
--    TSOffsetStyleGCs(style, x, y);
--    gtk_paint_focus(style, drawable, button_state, cliprect, widget, "button",
--                    x, y, width, height);
--  }
--
--  GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_DEFAULT);
--  GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_toggle_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                 GdkRectangle* cliprect, GtkWidgetState* state,
--                                 gboolean selected, gboolean inconsistent,
--                                 gboolean isradio, GtkTextDirection direction) {
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkShadowType shadow_type = (selected) ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
--  gint indicator_size, indicator_spacing;
--  gint x, y, width, height;
--  gint focus_x, focus_y, focus_width, focus_height;
--  GtkWidget* w;
--  GtkStyle* style;
--
--  if (isradio) {
--    moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing);
--    w = gRadiobuttonWidget;
--  } else {
--    moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing);
--    w = gCheckboxWidget;
--  }
--
--  // Clamp the rect and paint it center aligned in the rect.
--  x = rect->x;
--  y = rect->y;
--  width = rect->width;
--  height = rect->height;
--
--  if (rect->width < rect->height) {
--    y = rect->y + (rect->height - rect->width) / 2;
--    height = rect->width;
--  }
--
--  if (rect->height < rect->width) {
--    x = rect->x + (rect->width - rect->height) / 2;
--    width = rect->height;
--  }
--
--  focus_x = x - indicator_spacing;
--  focus_y = y - indicator_spacing;
--  focus_width = width + 2 * indicator_spacing;
--  focus_height = height + 2 * indicator_spacing;
--
--  style = w->style;
--  TSOffsetStyleGCs(style, x, y);
--
--  gtk_widget_set_sensitive(w, !state->disabled);
--  gtk_widget_set_direction(w, direction);
--  GTK_TOGGLE_BUTTON(w)->active = selected;
--
--  if (isradio) {
--    gtk_paint_option(style, drawable, state_type, shadow_type, cliprect,
--                     gRadiobuttonWidget, "radiobutton", x, y, width, height);
--    if (state->focused) {
--      gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect,
--                      gRadiobuttonWidget, "radiobutton", focus_x, focus_y,
--                      focus_width, focus_height);
--    }
--  } else {
--    /*
--     * 'indeterminate' type on checkboxes. In GTK, the shadow type
--     * must also be changed for the state to be drawn.
--     */
--    if (inconsistent) {
--      gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget),
--                                         TRUE);
--      shadow_type = GTK_SHADOW_ETCHED_IN;
--    } else {
--      gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget),
--                                         FALSE);
--    }
--
--    gtk_paint_check(style, drawable, state_type, shadow_type, cliprect,
--                    gCheckboxWidget, "checkbutton", x, y, width, height);
--    if (state->focused) {
--      gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect,
--                      gCheckboxWidget, "checkbutton", focus_x, focus_y,
--                      focus_width, focus_height);
--    }
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint calculate_button_inner_rect(GtkWidget* button, GdkRectangle* rect,
--                                        GdkRectangle* inner_rect,
--                                        GtkTextDirection direction,
--                                        gboolean ignore_focus) {
--  GtkBorder inner_border;
--  gboolean interior_focus;
--  gint focus_width, focus_pad;
--  GtkStyle* style;
--
--  style = button->style;
--
--  /* This mirrors gtkbutton's child positioning */
--  moz_gtk_button_get_inner_border(button, &inner_border);
--  moz_gtk_widget_get_focus(button, &interior_focus, &focus_width, &focus_pad);
--
--  if (ignore_focus) focus_width = focus_pad = 0;
--
--  inner_rect->x = rect->x + XTHICKNESS(style) + focus_width + focus_pad;
--  inner_rect->x +=
--      direction == GTK_TEXT_DIR_LTR ? inner_border.left : inner_border.right;
--  inner_rect->y =
--      rect->y + inner_border.top + YTHICKNESS(style) + focus_width + focus_pad;
--  inner_rect->width =
--      MAX(1, rect->width - inner_border.left - inner_border.right -
--                 (XTHICKNESS(style) + focus_pad + focus_width) * 2);
--  inner_rect->height =
--      MAX(1, rect->height - inner_border.top - inner_border.bottom -
--                 (YTHICKNESS(style) + focus_pad + focus_width) * 2);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint calculate_arrow_rect(GtkWidget* arrow, GdkRectangle* rect,
--                                 GdkRectangle* arrow_rect,
--                                 GtkTextDirection direction) {
--  /* defined in gtkarrow.c */
--  gfloat arrow_scaling = 0.7;
--  gfloat xalign, xpad;
--  gint extent;
--  GtkMisc* misc = GTK_MISC(arrow);
--
--  if (have_arrow_scaling)
--    gtk_widget_style_get(arrow, "arrow_scaling", &arrow_scaling, NULL);
--
--  extent =
--      MIN((rect->width - misc->xpad * 2), (rect->height - misc->ypad * 2)) *
--      arrow_scaling;
--
--  xalign = direction == GTK_TEXT_DIR_LTR ? misc->xalign : 1.0 - misc->xalign;
--  xpad = misc->xpad + (rect->width - extent) * xalign;
--
--  arrow_rect->x = direction == GTK_TEXT_DIR_LTR ? floor(rect->x + xpad)
--                                                : ceil(rect->x + xpad);
--  arrow_rect->y =
--      floor(rect->y + misc->ypad + ((rect->height - extent) * misc->yalign));
--
--  arrow_rect->width = arrow_rect->height = extent;
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_scrollbar_button_paint(GdkDrawable* drawable,
--                                           GdkRectangle* rect,
--                                           GdkRectangle* cliprect,
--                                           GtkWidgetState* state,
--                                           GtkScrollbarButtonFlags flags,
--                                           GtkTextDirection direction) {
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkShadowType shadow_type = (state->active) ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
--  GdkRectangle arrow_rect;
--  GtkStyle* style;
--  GtkWidget* scrollbar;
--  GtkArrowType arrow_type;
--  gint arrow_displacement_x, arrow_displacement_y;
--  const char* detail =
--      (flags & MOZ_GTK_STEPPER_VERTICAL) ? "vscrollbar" : "hscrollbar";
--
--  ensure_scrollbar_widget();
--
--  if (flags & MOZ_GTK_STEPPER_VERTICAL)
--    scrollbar = gVertScrollbarWidget;
--  else
--    scrollbar = gHorizScrollbarWidget;
--
--  gtk_widget_set_direction(scrollbar, direction);
--
--  /* Some theme engines (i.e., ClearLooks) check the scrollbar's allocation
--     to determine where it should paint rounded corners on the buttons.
--     We need to trick them into drawing the buttons the way we want them. */
--
--  scrollbar->allocation.x = rect->x;
--  scrollbar->allocation.y = rect->y;
--  scrollbar->allocation.width = rect->width;
--  scrollbar->allocation.height = rect->height;
--
--  if (flags & MOZ_GTK_STEPPER_VERTICAL) {
--    scrollbar->allocation.height *= 5;
--    if (flags & MOZ_GTK_STEPPER_DOWN) {
--      arrow_type = GTK_ARROW_DOWN;
--      if (flags & MOZ_GTK_STEPPER_BOTTOM)
--        scrollbar->allocation.y -= 4 * rect->height;
--      else
--        scrollbar->allocation.y -= rect->height;
--
--    } else {
--      arrow_type = GTK_ARROW_UP;
--      if (flags & MOZ_GTK_STEPPER_BOTTOM)
--        scrollbar->allocation.y -= 3 * rect->height;
--    }
--  } else {
--    scrollbar->allocation.width *= 5;
--    if (flags & MOZ_GTK_STEPPER_DOWN) {
--      arrow_type = GTK_ARROW_RIGHT;
--      if (flags & MOZ_GTK_STEPPER_BOTTOM)
--        scrollbar->allocation.x -= 4 * rect->width;
--      else
--        scrollbar->allocation.x -= rect->width;
--    } else {
--      arrow_type = GTK_ARROW_LEFT;
--      if (flags & MOZ_GTK_STEPPER_BOTTOM)
--        scrollbar->allocation.x -= 3 * rect->width;
--    }
--  }
--
--  style = scrollbar->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  gtk_paint_box(style, drawable, state_type, shadow_type, cliprect, scrollbar,
--                detail, rect->x, rect->y, rect->width, rect->height);
--
--  arrow_rect.width = rect->width / 2;
--  arrow_rect.height = rect->height / 2;
--  arrow_rect.x = rect->x + (rect->width - arrow_rect.width) / 2;
--  arrow_rect.y = rect->y + (rect->height - arrow_rect.height) / 2;
--
--  if (state_type == GTK_STATE_ACTIVE) {
--    gtk_widget_style_get(scrollbar, "arrow-displacement-x",
--                         &arrow_displacement_x, "arrow-displacement-y",
--                         &arrow_displacement_y, NULL);
--
--    arrow_rect.x += arrow_displacement_x;
--    arrow_rect.y += arrow_displacement_y;
--  }
--
--  gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, scrollbar,
--                  detail, arrow_type, TRUE, arrow_rect.x, arrow_rect.y,
--                  arrow_rect.width, arrow_rect.height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_scrollbar_trough_paint(
--    WidgetNodeType widget, GdkDrawable* drawable, GdkRectangle* rect,
--    GdkRectangle* cliprect, GtkWidgetState* state, GtkTextDirection direction) {
--  GtkStyle* style;
--  GtkScrollbar* scrollbar;
--
--  ensure_scrollbar_widget();
--
--  if (widget == MOZ_GTK_SCROLLBAR_HORIZONTAL)
--    scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget);
--  else
--    scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget);
--
--  gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction);
--
--  style = GTK_WIDGET(scrollbar)->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_ACTIVE,
--                                     cliprect, rect->x, rect->y, rect->width,
--                                     rect->height);
--
--  gtk_paint_box(style, drawable, GTK_STATE_ACTIVE, GTK_SHADOW_IN, cliprect,
--                GTK_WIDGET(scrollbar), "trough", rect->x, rect->y, rect->width,
--                rect->height);
--
--  if (state->focused) {
--    gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect,
--                    GTK_WIDGET(scrollbar), "trough", rect->x, rect->y,
--                    rect->width, rect->height);
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_scrollbar_thumb_paint(
--    WidgetNodeType widget, GdkDrawable* drawable, GdkRectangle* rect,
--    GdkRectangle* cliprect, GtkWidgetState* state, GtkTextDirection direction) {
--  GtkStateType state_type =
--      (state->inHover || state->active) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
--  GtkShadowType shadow_type = GTK_SHADOW_OUT;
--  GtkStyle* style;
--  GtkScrollbar* scrollbar;
--  GtkAdjustment* adj;
--  gboolean activate_slider;
--
--  ensure_scrollbar_widget();
--
--  if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL)
--    scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget);
--  else
--    scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget);
--
--  gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction);
--
--  /* Make sure to set the scrollbar range before painting so that
--     everything is drawn properly.  At least the bluecurve (and
--     maybe other) themes don't draw the top or bottom black line
--     surrounding the scrollbar if the theme thinks that it's butted
--     up against the scrollbar arrows.  Note the increases of the
--     clip rect below. */
--  adj = gtk_range_get_adjustment(GTK_RANGE(scrollbar));
--
--  if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) {
--    adj->page_size = rect->width;
--  } else {
--    adj->page_size = rect->height;
--  }
--
--  adj->lower = 0;
--  adj->value = state->curpos;
--  adj->upper = state->maxpos;
--  gtk_adjustment_changed(adj);
--
--  style = GTK_WIDGET(scrollbar)->style;
--
--  gtk_widget_style_get(GTK_WIDGET(scrollbar), "activate-slider",
--                       &activate_slider, NULL);
--
--  if (activate_slider && state->active) {
--    shadow_type = GTK_SHADOW_IN;
--    state_type = GTK_STATE_ACTIVE;
--  }
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  gtk_paint_slider(style, drawable, state_type, shadow_type, cliprect,
--                   GTK_WIDGET(scrollbar), "slider", rect->x, rect->y,
--                   rect->width, rect->height,
--                   (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL)
--                       ? GTK_ORIENTATION_HORIZONTAL
--                       : GTK_ORIENTATION_VERTICAL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_inner_spin_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                     GtkWidgetState* state,
--                                     GtkTextDirection direction) {
--  GdkRectangle arrow_rect;
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkShadowType shadow_type =
--      state_type == GTK_STATE_ACTIVE ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
--  GtkStyle* style;
--
--  ensure_spin_widget();
--  style = gSpinWidget->style;
--  gtk_widget_set_direction(gSpinWidget, direction);
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_paint_box(style, drawable, state_type, shadow_type, NULL, gSpinWidget,
--                "spinbutton", rect->x, rect->y, rect->width, rect->height);
--
--  /* hard code these values */
--  arrow_rect.width = 6;
--  arrow_rect.height = 6;
--
--  // align spin to the left
--  arrow_rect.x = rect->x;
--
--  // up button
--  arrow_rect.y = rect->y + (rect->height - arrow_rect.height) / 2 - 3;
--  gtk_paint_arrow(style, drawable, state_type, shadow_type, NULL, gSpinWidget,
--                  "spinbutton", GTK_ARROW_UP, TRUE, arrow_rect.x, arrow_rect.y,
--                  arrow_rect.width, arrow_rect.height);
--
--  // down button
--  arrow_rect.y = rect->y + (rect->height - arrow_rect.height) / 2 + 3;
--  gtk_paint_arrow(style, drawable, state_type, shadow_type, NULL, gSpinWidget,
--                  "spinbutton", GTK_ARROW_DOWN, arrow_rect.x, arrow_rect.y,
--                  arrow_rect.width, arrow_rect.height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_spin_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                               GtkTextDirection direction) {
--  GtkStyle* style;
--
--  ensure_spin_widget();
--  gtk_widget_set_direction(gSpinWidget, direction);
--  style = gSpinWidget->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL,
--                gSpinWidget, "spinbutton", rect->x, rect->y, rect->width,
--                rect->height);
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_spin_updown_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                      gboolean isDown, GtkWidgetState* state,
--                                      GtkTextDirection direction) {
--  GdkRectangle arrow_rect;
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkShadowType shadow_type =
--      state_type == GTK_STATE_ACTIVE ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
--  GtkStyle* style;
--
--  ensure_spin_widget();
--  style = gSpinWidget->style;
--  gtk_widget_set_direction(gSpinWidget, direction);
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_paint_box(style, drawable, state_type, shadow_type, NULL, gSpinWidget,
--                isDown ? "spinbutton_down" : "spinbutton_up", rect->x, rect->y,
--                rect->width, rect->height);
--
--  /* hard code these values */
--  arrow_rect.width = 6;
--  arrow_rect.height = 6;
--  arrow_rect.x = rect->x + (rect->width - arrow_rect.width) / 2;
--  arrow_rect.y = rect->y + (rect->height - arrow_rect.height) / 2;
--  arrow_rect.y += isDown ? -1 : 1;
--
--  gtk_paint_arrow(style, drawable, state_type, shadow_type, NULL, gSpinWidget,
--                  "spinbutton", isDown ? GTK_ARROW_DOWN : GTK_ARROW_UP, TRUE,
--                  arrow_rect.x, arrow_rect.y, arrow_rect.width,
--                  arrow_rect.height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_scale_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                GdkRectangle* cliprect, GtkWidgetState* state,
--                                GtkOrientation flags,
--                                GtkTextDirection direction) {
--  gint x = 0, y = 0;
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkStyle* style;
--  GtkWidget* widget;
--
--  ensure_scale_widget();
--  widget =
--      ((flags == GTK_ORIENTATION_HORIZONTAL) ? gHScaleWidget : gVScaleWidget);
--  gtk_widget_set_direction(widget, direction);
--
--  style = widget->style;
--
--  if (flags == GTK_ORIENTATION_HORIZONTAL) {
--    x = XTHICKNESS(style);
--    y++;
--  } else {
--    x++;
--    y = YTHICKNESS(style);
--  }
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  gtk_paint_box(style, drawable, GTK_STATE_ACTIVE, GTK_SHADOW_IN, cliprect,
--                widget, "trough", rect->x + x, rect->y + y, rect->width - 2 * x,
--                rect->height - 2 * y);
--
--  if (state->focused)
--    gtk_paint_focus(style, drawable, state_type, cliprect, widget, "trough",
--                    rect->x, rect->y, rect->width, rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_scale_thumb_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                      GdkRectangle* cliprect,
--                                      GtkWidgetState* state,
--                                      GtkOrientation flags,
--                                      GtkTextDirection direction) {
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkStyle* style;
--  GtkWidget* widget;
--  gint thumb_width, thumb_height, x, y;
--
--  ensure_scale_widget();
--  widget =
--      ((flags == GTK_ORIENTATION_HORIZONTAL) ? gHScaleWidget : gVScaleWidget);
--  gtk_widget_set_direction(widget, direction);
--
--  style = widget->style;
--
--  /* determine the thumb size, and position the thumb in the center in the
--   * opposite axis */
--  if (flags == GTK_ORIENTATION_HORIZONTAL) {
--    moz_gtk_get_scalethumb_metrics(GTK_ORIENTATION_HORIZONTAL, &thumb_width,
--                                   &thumb_height);
--    x = rect->x;
--    y = rect->y + (rect->height - thumb_height) / 2;
--  } else {
--    moz_gtk_get_scalethumb_metrics(GTK_ORIENTATION_VERTICAL, &thumb_height,
--                                   &thumb_width);
--    x = rect->x + (rect->width - thumb_width) / 2;
--    y = rect->y;
--  }
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_paint_slider(style, drawable, state_type, GTK_SHADOW_OUT, cliprect,
--                   widget,
--                   (flags == GTK_ORIENTATION_HORIZONTAL) ? "hscale" : "vscale",
--                   x, y, thumb_width, thumb_height, flags);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_gripper_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                  GdkRectangle* cliprect, GtkWidgetState* state,
--                                  GtkTextDirection direction) {
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkShadowType shadow_type;
--  GtkStyle* style;
--
--  ensure_handlebox_widget();
--  gtk_widget_set_direction(gHandleBoxWidget, direction);
--
--  style = gHandleBoxWidget->style;
--  shadow_type = GTK_HANDLE_BOX(gHandleBoxWidget)->shadow_type;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_paint_box(style, drawable, state_type, shadow_type, cliprect,
--                gHandleBoxWidget, "handlebox_bin", rect->x, rect->y,
--                rect->width, rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_hpaned_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                 GdkRectangle* cliprect,
--                                 GtkWidgetState* state) {
--  GtkStateType hpaned_state = ConvertGtkState(state);
--
--  ensure_hpaned_widget();
--  gtk_paint_handle(gHPanedWidget->style, drawable, hpaned_state,
--                   GTK_SHADOW_NONE, cliprect, gHPanedWidget, "paned", rect->x,
--                   rect->y, rect->width, rect->height,
--                   GTK_ORIENTATION_VERTICAL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_vpaned_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                 GdkRectangle* cliprect,
--                                 GtkWidgetState* state) {
--  GtkStateType vpaned_state = ConvertGtkState(state);
--
--  ensure_vpaned_widget();
--  gtk_paint_handle(gVPanedWidget->style, drawable, vpaned_state,
--                   GTK_SHADOW_NONE, cliprect, gVPanedWidget, "paned", rect->x,
--                   rect->y, rect->width, rect->height,
--                   GTK_ORIENTATION_HORIZONTAL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_entry_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                GdkRectangle* cliprect, GtkWidgetState* state,
--                                GtkWidget* widget, GtkTextDirection direction) {
--  GtkStateType bg_state =
--      state->disabled ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL;
--  gint x, y, width = rect->width, height = rect->height;
--  GtkStyle* style;
--  gboolean interior_focus;
--  gboolean theme_honors_transparency = FALSE;
--  gint focus_width;
--  int draw_focus_outline_only = state->depressed;  // NS_THEME_FOCUS_OUTLINE
--
--  gtk_widget_set_direction(widget, direction);
--
--  style = widget->style;
--
--  gtk_widget_style_get(widget, "interior-focus", &interior_focus,
--                       "focus-line-width", &focus_width,
--                       "honors-transparent-bg-hint", &theme_honors_transparency,
--                       NULL);
--
--  if (draw_focus_outline_only) {
--    // Inflate the given 'rect' with the focus outline size.
--    gint h, v;
--    moz_gtk_get_focus_outline_size(&h, &v);
--    rect->x -= h;
--    rect->width += 2 * h;
--    rect->y -= v;
--    rect->height += 2 * v;
--    width = rect->width;
--    height = rect->height;
--  }
--
--  /* gtkentry.c uses two windows, one for the entire widget and one for the
--   * text area inside it. The background of both windows is set to the "base"
--   * color of the new state in gtk_entry_state_changed, but only the inner
--   * textarea window uses gtk_paint_flat_box when exposed */
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  /* This gets us a lovely greyish disabledish look */
--  gtk_widget_set_sensitive(widget, !state->disabled);
--
--  /* GTK fills the outer widget window with the base color before drawing the
--   * widget. Some older themes rely on this behavior, but many themes nowadays
--   * use rounded corners on their widgets. While most GTK apps are blissfully
--   * unaware of this problem due to their use of the default window background,
--   * we render widgets on many kinds of backgrounds on the web. If the theme is
--   * able to cope with transparency, then we can skip pre-filling and notify the
--   * theme it will paint directly on the canvas. */
--  if (theme_honors_transparency) {
--    g_object_set_data(G_OBJECT(widget), "transparent-bg-hint",
--                      GINT_TO_POINTER(TRUE));
--  } else {
--    GdkRectangle clipped_rect;
--    gdk_rectangle_intersect(rect, cliprect, &clipped_rect);
--    if (clipped_rect.width != 0) {
--      gdk_draw_rectangle(drawable, style->base_gc[bg_state], TRUE,
--                         clipped_rect.x, clipped_rect.y, clipped_rect.width,
--                         clipped_rect.height);
--    }
--    g_object_set_data(G_OBJECT(widget), "transparent-bg-hint",
--                      GINT_TO_POINTER(FALSE));
--  }
--
--  if (!draw_focus_outline_only) {
--    /* Get the position of the inner window, see _gtk_entry_get_borders */
--    x = XTHICKNESS(style);
--    y = YTHICKNESS(style);
--
--    if (!interior_focus) {
--      x += focus_width;
--      y += focus_width;
--    }
--
--    /* Simulate an expose of the inner window */
--    gtk_paint_flat_box(style, drawable, bg_state, GTK_SHADOW_NONE, cliprect,
--                       widget, "entry_bg", rect->x + x, rect->y + y,
--                       rect->width - 2 * x, rect->height - 2 * y);
--  }
--
--  /* Now paint the shadow and focus border.
--   * We do like in gtk_entry_draw_frame, we first draw the shadow, a tad
--   * smaller when focused if the focus is not interior, then the focus. */
--  x = rect->x;
--  y = rect->y;
--
--  if (state->focused && !state->disabled) {
--    /* This will get us the lit borders that focused textboxes enjoy on
--     * some themes. */
--    GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
--
--    if (!interior_focus) {
--      /* Indent the border a little bit if we have exterior focus
--         (this is what GTK does to draw native entries) */
--      x += focus_width;
--      y += focus_width;
--      width -= 2 * focus_width;
--      height -= 2 * focus_width;
--    }
--  }
--
--  if (!draw_focus_outline_only || interior_focus) {
--    gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, cliprect,
--                     widget, "entry", x, y, width, height);
--  }
--
--  if (state->focused && !state->disabled) {
--    if (!interior_focus) {
--      gtk_paint_focus(style, drawable, GTK_STATE_NORMAL, cliprect, widget,
--                      "entry", rect->x, rect->y, rect->width, rect->height);
--    }
--
--    /* Now unset the focus flag. We don't want other entries to look
--     * like they're focused too! */
--    GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_treeview_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                   GdkRectangle* cliprect,
--                                   GtkWidgetState* state,
--                                   GtkTextDirection direction) {
--  gint xthickness, ythickness;
--
--  GtkStyle* style;
--  GtkStateType state_type;
--
--  ensure_tree_view_widget();
--  ensure_scrolled_window_widget();
--
--  gtk_widget_set_direction(gTreeViewWidget, direction);
--  gtk_widget_set_direction(gScrolledWindowWidget, direction);
--
--  /* only handle disabled and normal states, otherwise the whole background
--   * area will be painted differently with other states */
--  state_type = state->disabled ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL;
--
--  /* In GTK the treeview sets the background of the window
--   * which contains the cells to the treeview base color.
--   * If we don't set it here the background color will not be correct.*/
--  gtk_widget_modify_bg(gTreeViewWidget, state_type,
--                       &gTreeViewWidget->style->base[state_type]);
--
--  style = gScrolledWindowWidget->style;
--  xthickness = XTHICKNESS(style);
--  ythickness = YTHICKNESS(style);
--
--  TSOffsetStyleGCs(gTreeViewWidget->style, rect->x, rect->y);
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  gtk_paint_flat_box(
--      gTreeViewWidget->style, drawable, state_type, GTK_SHADOW_NONE, cliprect,
--      gTreeViewWidget, "treeview", rect->x + xthickness, rect->y + ythickness,
--      rect->width - 2 * xthickness, rect->height - 2 * ythickness);
--
--  gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, cliprect,
--                   gScrolledWindowWidget, "scrolled_window", rect->x, rect->y,
--                   rect->width, rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_tree_header_cell_paint(
--    GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect,
--    GtkWidgetState* state, gboolean isSorted, GtkTextDirection direction) {
--  gtk_tree_view_column_set_sort_indicator(gMiddleTreeViewColumn, isSorted);
--
--  moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL,
--                       gTreeHeaderCellWidget, direction);
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_tree_header_sort_arrow_paint(
--    GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect,
--    GtkWidgetState* state, GtkArrowType flags, GtkTextDirection direction) {
--  GdkRectangle arrow_rect;
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkShadowType shadow_type = GTK_SHADOW_IN;
--  GtkArrowType arrow_type = flags;
--  GtkStyle* style;
--
--  ensure_tree_header_cell_widget();
--  gtk_widget_set_direction(gTreeHeaderSortArrowWidget, direction);
--
--  /* hard code these values */
--  arrow_rect.width = 11;
--  arrow_rect.height = 11;
--  arrow_rect.x = rect->x + (rect->width - arrow_rect.width) / 2;
--  arrow_rect.y = rect->y + (rect->height - arrow_rect.height) / 2;
--
--  style = gTreeHeaderSortArrowWidget->style;
--  TSOffsetStyleGCs(style, arrow_rect.x, arrow_rect.y);
--
--  gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
--                  gTreeHeaderSortArrowWidget, "arrow", arrow_type, TRUE,
--                  arrow_rect.x, arrow_rect.y, arrow_rect.width,
--                  arrow_rect.height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_treeview_expander_paint(GdkDrawable* drawable,
--                                            GdkRectangle* rect,
--                                            GdkRectangle* cliprect,
--                                            GtkWidgetState* state,
--                                            GtkExpanderStyle expander_state,
--                                            GtkTextDirection direction) {
--  GtkStyle* style;
--  GtkStateType state_type;
--
--  ensure_tree_view_widget();
--  gtk_widget_set_direction(gTreeViewWidget, direction);
--
--  style = gTreeViewWidget->style;
--
--  /* Because the frame we get is of the entire treeview, we can't get the
--   * precise event state of one expander, thus rendering hover and active
--   * feedback useless. */
--  state_type = state->disabled ? GTK_STATE_INSENSITIVE :
--               state->inHover  ? GTK_STATE_PRELIGHT :
--               state->selected ? GTK_STATE_SELECTED :
--                                 GTK_STATE_NORMAL;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_paint_expander(style, drawable, state_type, cliprect, gTreeViewWidget,
--                     "treeview", rect->x + rect->width / 2,
--                     rect->y + rect->height / 2, expander_state);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_combo_box_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                    GdkRectangle* cliprect,
--                                    GtkWidgetState* state, gboolean ishtml,
--                                    GtkTextDirection direction) {
--  GdkRectangle arrow_rect, real_arrow_rect;
--  gint separator_width;
--  gboolean wide_separators;
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
--  GtkStyle* style;
--  GtkRequisition arrow_req;
--
--  ensure_combo_box_widgets();
--
--  /* Also sets the direction on gComboBoxButtonWidget, which is then
--   * inherited by the separator and arrow */
--  moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL,
--                       gComboBoxButtonWidget, direction);
--
--  calculate_button_inner_rect(gComboBoxButtonWidget, rect, &arrow_rect,
--                              direction, ishtml);
--  /* Now arrow_rect contains the inner rect ; we want to correct the width
--   * to what the arrow needs (see gtk_combo_box_size_allocate) */
--  gtk_widget_size_request(gComboBoxArrowWidget, &arrow_req);
--  if (direction == GTK_TEXT_DIR_LTR)
--    arrow_rect.x += arrow_rect.width - arrow_req.width;
--  arrow_rect.width = arrow_req.width;
--
--  calculate_arrow_rect(gComboBoxArrowWidget, &arrow_rect, &real_arrow_rect,
--                       direction);
--
--  style = gComboBoxArrowWidget->style;
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  gtk_widget_size_allocate(gComboBoxWidget, rect);
--
--  gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
--                  gComboBoxArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE,
--                  real_arrow_rect.x, real_arrow_rect.y, real_arrow_rect.width,
--                  real_arrow_rect.height);
--
--  /* If there is no separator in the theme, there's nothing left to do. */
--  if (!gComboBoxSeparatorWidget) return MOZ_GTK_SUCCESS;
--
--  style = gComboBoxSeparatorWidget->style;
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  gtk_widget_style_get(gComboBoxSeparatorWidget, "wide-separators",
--                       &wide_separators, "separator-width", &separator_width,
--                       NULL);
--
--  if (wide_separators) {
--    if (direction == GTK_TEXT_DIR_LTR)
--      arrow_rect.x -= separator_width;
--    else
--      arrow_rect.x += arrow_rect.width;
--
--    gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
--                  cliprect, gComboBoxSeparatorWidget, "vseparator",
--                  arrow_rect.x, arrow_rect.y, separator_width,
--                  arrow_rect.height);
--  } else {
--    if (direction == GTK_TEXT_DIR_LTR)
--      arrow_rect.x -= XTHICKNESS(style);
--    else
--      arrow_rect.x += arrow_rect.width;
--
--    gtk_paint_vline(style, drawable, GTK_STATE_NORMAL, cliprect,
--                    gComboBoxSeparatorWidget, "vseparator", arrow_rect.y,
--                    arrow_rect.y + arrow_rect.height, arrow_rect.x);
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                GdkRectangle* cliprect, GtkWidgetState* state,
--                                GtkArrowType arrow_type,
--                                GtkTextDirection direction) {
--  GtkStyle* style;
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
--  GdkRectangle arrow_rect;
--
--  ensure_button_arrow_widget();
--  style = gButtonArrowWidget->style;
--  gtk_widget_set_direction(gButtonArrowWidget, direction);
--
--  calculate_arrow_rect(gButtonArrowWidget, rect, &arrow_rect, direction);
--
--  if (direction == GTK_TEXT_DIR_RTL) {
--    if (arrow_type == GTK_ARROW_LEFT)
--      arrow_type = GTK_ARROW_RIGHT;
--    else if (arrow_type == GTK_ARROW_RIGHT)
--      arrow_type = GTK_ARROW_LEFT;
--  }
--
--  TSOffsetStyleGCs(style, arrow_rect.x, arrow_rect.y);
--  gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
--                  gButtonArrowWidget, "arrow", arrow_type, TRUE, arrow_rect.x,
--                  arrow_rect.y, arrow_rect.width, arrow_rect.height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_combo_box_entry_button_paint(
--    GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect,
--    GtkWidgetState* state, gboolean input_focus, GtkTextDirection direction) {
--  gint x_displacement, y_displacement;
--  GdkRectangle arrow_rect, real_arrow_rect;
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
--  GtkStyle* style;
--
--  ensure_combo_box_entry_widgets();
--
--  if (input_focus) {
--    /* Some themes draw a complementary focus ring for the dropdown button
--     * when the dropdown entry has focus */
--    GTK_WIDGET_SET_FLAGS(gComboBoxEntryTextareaWidget, GTK_HAS_FOCUS);
--  }
--
--  moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL,
--                       gComboBoxEntryButtonWidget, direction);
--
--  if (input_focus)
--    GTK_WIDGET_UNSET_FLAGS(gComboBoxEntryTextareaWidget, GTK_HAS_FOCUS);
--
--  calculate_button_inner_rect(gComboBoxEntryButtonWidget, rect, &arrow_rect,
--                              direction, FALSE);
--  if (state_type == GTK_STATE_ACTIVE) {
--    gtk_widget_style_get(gComboBoxEntryButtonWidget, "child-displacement-x",
--                         &x_displacement, "child-displacement-y",
--                         &y_displacement, NULL);
--    arrow_rect.x += x_displacement;
--    arrow_rect.y += y_displacement;
--  }
--
--  calculate_arrow_rect(gComboBoxEntryArrowWidget, &arrow_rect, &real_arrow_rect,
--                       direction);
--
--  style = gComboBoxEntryArrowWidget->style;
--  TSOffsetStyleGCs(style, real_arrow_rect.x, real_arrow_rect.y);
--
--  gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
--                  gComboBoxEntryArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE,
--                  real_arrow_rect.x, real_arrow_rect.y, real_arrow_rect.width,
--                  real_arrow_rect.height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_container_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                    GdkRectangle* cliprect,
--                                    GtkWidgetState* state, gboolean isradio,
--                                    GtkTextDirection direction) {
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkStyle* style;
--  GtkWidget* widget;
--  gboolean interior_focus;
--  gint focus_width, focus_pad;
--
--  if (isradio) {
--    ensure_radiobutton_widget();
--    widget = gRadiobuttonWidget;
--  } else {
--    ensure_checkbox_widget();
--    widget = gCheckboxWidget;
--  }
--  gtk_widget_set_direction(widget, direction);
--
--  style = widget->style;
--  moz_gtk_widget_get_focus(widget, &interior_focus, &focus_width, &focus_pad);
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  /* The detail argument for the gtk_paint_* calls below are "checkbutton"
--     even for radio buttons, to match what gtk does. */
--
--  /* this is for drawing a prelight box */
--  if (state_type == GTK_STATE_PRELIGHT || state_type == GTK_STATE_ACTIVE) {
--    gtk_paint_flat_box(style, drawable, GTK_STATE_PRELIGHT,
--                       GTK_SHADOW_ETCHED_OUT, cliprect, widget, "checkbutton",
--                       rect->x, rect->y, rect->width, rect->height);
--  }
--
--  if (state_type != GTK_STATE_NORMAL && state_type != GTK_STATE_PRELIGHT)
--    state_type = GTK_STATE_NORMAL;
--
--  if (state->focused && !interior_focus) {
--    gtk_paint_focus(style, drawable, state_type, cliprect, widget,
--                    "checkbutton", rect->x, rect->y, rect->width, rect->height);
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_toggle_label_paint(GdkDrawable* drawable,
--                                       GdkRectangle* rect,
--                                       GdkRectangle* cliprect,
--                                       GtkWidgetState* state, gboolean isradio,
--                                       GtkTextDirection direction) {
--  GtkStateType state_type;
--  GtkStyle* style;
--  GtkWidget* widget;
--  gboolean interior_focus;
--
--  if (!state->focused) return MOZ_GTK_SUCCESS;
--
--  if (isradio) {
--    ensure_radiobutton_widget();
--    widget = gRadiobuttonWidget;
--  } else {
--    ensure_checkbox_widget();
--    widget = gCheckboxWidget;
--  }
--  gtk_widget_set_direction(widget, direction);
--
--  gtk_widget_style_get(widget, "interior-focus", &interior_focus, NULL);
--  if (!interior_focus) return MOZ_GTK_SUCCESS;
--
--  state_type = ConvertGtkState(state);
--
--  style = widget->style;
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  /* Always "checkbutton" to match gtkcheckbutton.c */
--  gtk_paint_focus(style, drawable, state_type, cliprect, widget, "checkbutton",
--                  rect->x, rect->y, rect->width, rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_toolbar_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                  GdkRectangle* cliprect,
--                                  GtkTextDirection direction) {
--  GtkStyle* style;
--  GtkShadowType shadow_type;
--
--  ensure_toolbar_widget();
--  gtk_widget_set_direction(gToolbarWidget, direction);
--
--  style = gToolbarWidget->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL,
--                                     cliprect, rect->x, rect->y, rect->width,
--                                     rect->height);
--
--  gtk_widget_style_get(gToolbarWidget, "shadow-type", &shadow_type, NULL);
--
--  gtk_paint_box(style, drawable, GTK_STATE_NORMAL, shadow_type, cliprect,
--                gToolbarWidget, "toolbar", rect->x, rect->y, rect->width,
--                rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_toolbar_separator_paint(GdkDrawable* drawable,
--                                            GdkRectangle* rect,
--                                            GdkRectangle* cliprect,
--                                            GtkTextDirection direction) {
--  GtkStyle* style;
--  gint separator_width;
--  gint paint_width;
--  gboolean wide_separators;
--
--  /* Defined as constants in GTK+ 2.10.14 */
--  const double start_fraction = 0.2;
--  const double end_fraction = 0.8;
--
--  ensure_toolbar_separator_widget();
--  gtk_widget_set_direction(gToolbarSeparatorWidget, direction);
--
--  style = gToolbarSeparatorWidget->style;
--
--  gtk_widget_style_get(gToolbarWidget, "wide-separators", &wide_separators,
--                       "separator-width", &separator_width, NULL);
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  if (wide_separators) {
--    if (separator_width > rect->width) separator_width = rect->width;
--
--    gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
--                  cliprect, gToolbarWidget, "vseparator",
--                  rect->x + (rect->width - separator_width) / 2,
--                  rect->y + rect->height * start_fraction, separator_width,
--                  rect->height * (end_fraction - start_fraction));
--
--  } else {
--    paint_width = style->xthickness;
--
--    if (paint_width > rect->width) paint_width = rect->width;
--
--    gtk_paint_vline(style, drawable, GTK_STATE_NORMAL, cliprect,
--                    gToolbarSeparatorWidget, "toolbar",
--                    rect->y + rect->height * start_fraction,
--                    rect->y + rect->height * end_fraction,
--                    rect->x + (rect->width - paint_width) / 2);
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_tooltip_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                  GdkRectangle* cliprect,
--                                  GtkTextDirection direction) {
--  GtkStyle* style;
--
--  ensure_tooltip_widget();
--  gtk_widget_set_direction(gTooltipWidget, direction);
--
--  style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), "gtk-tooltips",
--                                    "GtkWindow", GTK_TYPE_WINDOW);
--
--  style = gtk_style_attach(style, gTooltipWidget->window);
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_paint_flat_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
--                     cliprect, gTooltipWidget, "tooltip", rect->x, rect->y,
--                     rect->width, rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_resizer_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                  GdkRectangle* cliprect, GtkWidgetState* state,
--                                  GtkTextDirection direction) {
--  GtkStyle* style;
--  GtkStateType state_type = ConvertGtkState(state);
--
--  ensure_frame_widget();
--  gtk_widget_set_direction(gStatusbarWidget, direction);
--
--  style = gStatusbarWidget->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  gtk_paint_resize_grip(
--      style, drawable, state_type, cliprect, gStatusbarWidget, "statusbar",
--      (direction == GTK_TEXT_DIR_LTR) ? GDK_WINDOW_EDGE_SOUTH_EAST
--                                      : GDK_WINDOW_EDGE_SOUTH_WEST,
--      rect->x, rect->y, rect->width, rect->height);
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_frame_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                GdkRectangle* cliprect,
--                                GtkTextDirection direction) {
--  GtkStyle* style;
--  GtkShadowType shadow_type;
--
--  ensure_frame_widget();
--  gtk_widget_set_direction(gFrameWidget, direction);
--
--  style = gFrameWidget->style;
--
--  gtk_widget_style_get(gStatusbarWidget, "shadow-type", &shadow_type, NULL);
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, shadow_type, cliprect,
--                   gFrameWidget, "frame", rect->x, rect->y, rect->width,
--                   rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_progressbar_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                      GdkRectangle* cliprect,
--                                      GtkTextDirection direction) {
--  GtkStyle* style;
--
--  ensure_progress_widget();
--  gtk_widget_set_direction(gProgressWidget, direction);
--
--  style = gProgressWidget->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, cliprect,
--                gProgressWidget, "trough", rect->x, rect->y, rect->width,
--                rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_progress_chunk_paint(GdkDrawable* drawable,
--                                         GdkRectangle* rect,
--                                         GdkRectangle* cliprect,
--                                         GtkTextDirection direction,
--                                         WidgetNodeType widget) {
--  GtkStyle* style;
--
--  ensure_progress_widget();
--  gtk_widget_set_direction(gProgressWidget, direction);
--
--  style = gProgressWidget->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
--      widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
--    /**
--     * The bar's size and the bar speed are set depending of the progress'
--     * size. These could also be constant for all progress bars easily.
--     */
--    gboolean vertical =
--        (widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE);
--
--    /* The size of the dimension we are going to use for the animation. */
--    const gint progressSize = vertical ? rect->height : rect->width;
--
--    /* The bar is using a fifth of the element size, based on GtkProgressBar
--     * activity-blocks property. */
--    const gint barSize = MAX(1, progressSize / 5);
--
--    /* Represents the travel that has to be done for a complete cycle. */
--    const gint travel = 2 * (progressSize - barSize);
--
--    /* period equals to travel / pixelsPerMillisecond
--     * where pixelsPerMillisecond equals progressSize / 1000.0.
--     * This is equivalent to 1600. */
--    static const guint period = 1600;
--    const gint t = PR_IntervalToMilliseconds(PR_IntervalNow()) % period;
--    const gint dx = travel * t / period;
--
--    if (vertical) {
--      rect->y += (dx < travel / 2) ? dx : travel - dx;
--      rect->height = barSize;
--    } else {
--      rect->x += (dx < travel / 2) ? dx : travel - dx;
--      rect->width = barSize;
--    }
--  }
--
--  gtk_paint_box(style, drawable, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, cliprect,
--                gProgressWidget, "bar", rect->x, rect->y, rect->width,
--                rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_get_tab_thickness(WidgetNodeType aNodeType) {
--  ensure_tab_widget();
--  if (YTHICKNESS(gTabWidget->style) < 2)
--    return 2; /* some themes don't set ythickness correctly */
--
--  return YTHICKNESS(gTabWidget->style);
--}
--
--static gint moz_gtk_tab_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                              GdkRectangle* cliprect, GtkWidgetState* state,
--                              GtkTabFlags flags, GtkTextDirection direction,
--                              WidgetNodeType widget) {
--  /* When the tab isn't selected, we just draw a notebook extension.
--   * When it is selected, we overwrite the adjacent border of the tabpanel
--   * touching the tab with a pierced border (called "the gap") to make the
--   * tab appear physically attached to the tabpanel; see details below. */
--
--  GtkStyle* style;
--  GdkRectangle focusRect;
--  gboolean isBottomTab = (widget == MOZ_GTK_TAB_BOTTOM);
--
--  ensure_tab_widget();
--  gtk_widget_set_direction(gTabWidget, direction);
--
--  style = gTabWidget->style;
--  focusRect = *rect;
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  if ((flags & MOZ_GTK_TAB_SELECTED) == 0) {
--    /* Only draw the tab */
--    gtk_paint_extension(style, drawable, GTK_STATE_ACTIVE, GTK_SHADOW_OUT,
--                        cliprect, gTabWidget, "tab", rect->x, rect->y,
--                        rect->width, rect->height,
--                        isBottomTab ? GTK_POS_TOP : GTK_POS_BOTTOM);
--  } else {
--    /* Draw the tab and the gap
--     * We want the gap to be positioned exactly on the tabpanel top
--     * border; since tabbox.css may set a negative margin so that the tab
--     * frame rect already overlaps the tabpanel frame rect, we need to take
--     * that into account when drawing. To that effect, nsNativeThemeGTK
--     * passes us this negative margin (bmargin in the graphic below) in the
--     * lowest bits of |flags|.  We use it to set gap_voffset, the distance
--     * between the top of the gap and the bottom of the tab (resp. the
--     * bottom of the gap and the top of the tab when we draw a bottom tab),
--     * while ensuring that the gap always touches the border of the tab,
--     * i.e. 0 <= gap_voffset <= gap_height, to avoid surprinsing results
--     * with big negative or positive margins.
--     * Here is a graphical explanation in the case of top tabs:
--     *             ___________________________
--     *            /                           \
--     *           |            T A B            |
--     * ----------|. . . . . . . . . . . . . . .|----- top of tabpanel
--     *           :    ^       bmargin          :  ^
--     *           :    | (-negative margin,     :  |
--     *  bottom   :    v  passed in flags)      :  |       gap_height
--     *    of  -> :.............................:  |    (the size of the
--     * the tab   .       part of the gap       .  |  tabpanel top border)
--     *           .      outside of the tab     .  v
--     * ----------------------------------------------
--     *
--     * To draw the gap, we use gtk_paint_box_gap(), see comment in
--     * moz_gtk_tabpanels_paint(). This box_gap is made 3 * gap_height tall,
--     * which should suffice to ensure that the only visible border is the
--     * pierced one.  If the tab is in the middle, we make the box_gap begin
--     * a bit to the left of the tab and end a bit to the right, adjusting
--     * the gap position so it still is under the tab, because we want the
--     * rendering of a gap in the middle of a tabpanel.  This is the role of
--     * the gints gap_{l,r}_offset. On the contrary, if the tab is the
--     * first, we align the start border of the box_gap with the start
--     * border of the tab (left if LTR, right if RTL), by setting the
--     * appropriate offset to 0.*/
--    gint gap_loffset, gap_roffset, gap_voffset, gap_height;
--
--    /* Get height needed by the gap */
--    gap_height = moz_gtk_get_tab_thickness(widget);
--
--    /* Extract gap_voffset from the first bits of flags */
--    gap_voffset = flags & MOZ_GTK_TAB_MARGIN_MASK;
--    if (gap_voffset > gap_height) gap_voffset = gap_height;
--
--    /* Set gap_{l,r}_offset to appropriate values */
--    gap_loffset = gap_roffset = 20; /* should be enough */
--    if (flags & MOZ_GTK_TAB_FIRST) {
--      if (direction == GTK_TEXT_DIR_RTL)
--        gap_roffset = 0;
--      else
--        gap_loffset = 0;
--    }
--
--    if (isBottomTab) {
--      /* Draw the tab */
--      focusRect.y += gap_voffset;
--      focusRect.height -= gap_voffset;
--      gtk_paint_extension(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
--                          cliprect, gTabWidget, "tab", rect->x,
--                          rect->y + gap_voffset, rect->width,
--                          rect->height - gap_voffset, GTK_POS_TOP);
--
--      /* Draw the gap; erase with background color before painting in
--       * case theme does not */
--      gtk_style_apply_default_background(
--          style, drawable, TRUE, GTK_STATE_NORMAL, cliprect, rect->x,
--          rect->y + gap_voffset - gap_height, rect->width, gap_height);
--      gtk_paint_box_gap(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
--                        cliprect, gTabWidget, "notebook", rect->x - gap_loffset,
--                        rect->y + gap_voffset - 3 * gap_height,
--                        rect->width + gap_loffset + gap_roffset, 3 * gap_height,
--                        GTK_POS_BOTTOM, gap_loffset, rect->width);
--    } else {
--      /* Draw the tab */
--      focusRect.height -= gap_voffset;
--      gtk_paint_extension(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
--                          cliprect, gTabWidget, "tab", rect->x, rect->y,
--                          rect->width, rect->height - gap_voffset,
--                          GTK_POS_BOTTOM);
--
--      /* Draw the gap; erase with background color before painting in
--       * case theme does not */
--      gtk_style_apply_default_background(
--          style, drawable, TRUE, GTK_STATE_NORMAL, cliprect, rect->x,
--          rect->y + rect->height - gap_voffset, rect->width, gap_height);
--      gtk_paint_box_gap(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
--                        cliprect, gTabWidget, "notebook", rect->x - gap_loffset,
--                        rect->y + rect->height - gap_voffset,
--                        rect->width + gap_loffset + gap_roffset, 3 * gap_height,
--                        GTK_POS_TOP, gap_loffset, rect->width);
--    }
--  }
--
--  if (state->focused) {
--    /* Paint the focus ring */
--    focusRect.x += XTHICKNESS(style);
--    focusRect.width -= XTHICKNESS(style) * 2;
--    focusRect.y += YTHICKNESS(style);
--    focusRect.height -= YTHICKNESS(style) * 2;
--
--    gtk_paint_focus(
--        style, drawable,
--        /* Believe it or not, NORMAL means a selected tab and
--           ACTIVE means an unselected tab. */
--        (flags & MOZ_GTK_TAB_SELECTED) ? GTK_STATE_NORMAL : GTK_STATE_ACTIVE,
--        cliprect, gTabWidget, "tab", focusRect.x, focusRect.y, focusRect.width,
--        focusRect.height);
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_tabpanels_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                    GdkRectangle* cliprect,
--                                    GtkTextDirection direction) {
--  /* We have three problems here:
--   * - Most engines draw gtk_paint_box differently to gtk_paint_box_gap, the
--   *   former implies there are no tabs, eg. Clearlooks.
--   * - Wanting a gap of width 0 doesn't actually guarantee a zero-width gap, eg.
--   *   Clearlooks.
--   * - Our old approach of a negative X position could cause rendering errors
--   *   on the box's corner, eg. themes using the Pixbuf engine.
--   */
--  GtkStyle* style;
--  GdkRectangle halfClipRect;
--
--  ensure_tab_widget();
--  gtk_widget_set_direction(gTabWidget, direction);
--
--  style = gTabWidget->style;
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  /* Our approach is as follows:
--   * - Draw the box in two passes. Pass in a clip rect to draw the left half of
--   * the box, with the gap specified to the right outside the clip rect so that
--   * it is not drawn.
--   * - The right half is drawn with the gap to the left outside the modified
--   * clip rect.
--   */
--  if (!gdk_rectangle_intersect(rect, cliprect, &halfClipRect))
--    return MOZ_GTK_SUCCESS;
--
--  halfClipRect.width = (halfClipRect.width / 2) + 1;
--  gtk_paint_box_gap(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
--                    &halfClipRect, gTabWidget, "notebook", rect->x, rect->y,
--                    rect->width, rect->height, GTK_POS_TOP,
--                    halfClipRect.width + 1, 0);
--
--  halfClipRect.x += halfClipRect.width;
--  gtk_paint_box_gap(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
--                    &halfClipRect, gTabWidget, "notebook", rect->x, rect->y,
--                    rect->width, rect->height, GTK_POS_TOP, -10, 0);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_tab_scroll_arrow_paint(GdkDrawable* drawable,
--                                           GdkRectangle* rect,
--                                           GdkRectangle* cliprect,
--                                           GtkWidgetState* state,
--                                           GtkArrowType arrow_type,
--                                           GtkTextDirection direction) {
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
--  GtkStyle* style;
--  gint arrow_size = MIN(rect->width, rect->height);
--  gint x = rect->x + (rect->width - arrow_size) / 2;
--  gint y = rect->y + (rect->height - arrow_size) / 2;
--
--  ensure_tab_widget();
--
--  style = gTabWidget->style;
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  if (direction == GTK_TEXT_DIR_RTL) {
--    arrow_type =
--        (arrow_type == GTK_ARROW_LEFT) ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT;
--  }
--
--  gtk_paint_arrow(style, drawable, state_type, shadow_type, NULL, gTabWidget,
--                  "notebook", arrow_type, TRUE, x, y, arrow_size, arrow_size);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_menu_bar_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                   GdkRectangle* cliprect,
--                                   GtkTextDirection direction) {
--  GtkStyle* style;
--  GtkShadowType shadow_type;
--  ensure_menu_bar_widget();
--  gtk_widget_set_direction(gMenuBarWidget, direction);
--
--  gtk_widget_style_get(gMenuBarWidget, "shadow-type", &shadow_type, NULL);
--
--  style = gMenuBarWidget->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL,
--                                     cliprect, rect->x, rect->y, rect->width,
--                                     rect->height);
--
--  gtk_paint_box(style, drawable, GTK_STATE_NORMAL, shadow_type, cliprect,
--                gMenuBarWidget, "menubar", rect->x, rect->y, rect->width,
--                rect->height);
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_menu_popup_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                     GdkRectangle* cliprect,
--                                     GtkTextDirection direction) {
--  GtkStyle* style;
--  ensure_menu_popup_widget();
--  gtk_widget_set_direction(gMenuPopupWidget, direction);
--
--  style = gMenuPopupWidget->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL,
--                                     cliprect, rect->x, rect->y, rect->width,
--                                     rect->height);
--  gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT, cliprect,
--                gMenuPopupWidget, "menu", rect->x, rect->y, rect->width,
--                rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_menu_separator_paint(GdkDrawable* drawable,
--                                         GdkRectangle* rect,
--                                         GdkRectangle* cliprect,
--                                         GtkTextDirection direction) {
--  GtkStyle* style;
--  gboolean wide_separators;
--  gint separator_height;
--  guint horizontal_padding;
--  gint paint_height;
--
--  ensure_menu_separator_widget();
--  gtk_widget_set_direction(gMenuSeparatorWidget, direction);
--
--  style = gMenuSeparatorWidget->style;
--
--  gtk_widget_style_get(gMenuSeparatorWidget, "wide-separators",
--                       &wide_separators, "separator-height", &separator_height,
--                       "horizontal-padding", &horizontal_padding, NULL);
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--
--  if (wide_separators) {
--    if (separator_height > rect->height) separator_height = rect->height;
--
--    gtk_paint_box(
--        style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, cliprect,
--        gMenuSeparatorWidget, "hseparator",
--        rect->x + horizontal_padding + style->xthickness,
--        rect->y + (rect->height - separator_height - style->ythickness) / 2,
--        rect->width - 2 * (horizontal_padding + style->xthickness),
--        separator_height);
--  } else {
--    paint_height = style->ythickness;
--    if (paint_height > rect->height) paint_height = rect->height;
--
--    gtk_paint_hline(
--        style, drawable, GTK_STATE_NORMAL, cliprect, gMenuSeparatorWidget,
--        "menuitem", rect->x + horizontal_padding + style->xthickness,
--        rect->x + rect->width - horizontal_padding - style->xthickness - 1,
--        rect->y + (rect->height - style->ythickness) / 2);
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_menu_item_paint(WidgetNodeType widget,
--                                    GdkDrawable* drawable, GdkRectangle* rect,
--                                    GdkRectangle* cliprect,
--                                    GtkWidgetState* state,
--                                    GtkTextDirection direction) {
--  GtkStyle* style;
--  GtkShadowType shadow_type;
--  GtkWidget* item_widget;
--
--  if (state->inHover && !state->disabled) {
--    if (widget == MOZ_GTK_MENUBARITEM) {
--      ensure_menu_bar_item_widget();
--      item_widget = gMenuBarItemWidget;
--    } else {
--      ensure_menu_item_widget();
--      item_widget = gMenuItemWidget;
--    }
--    gtk_widget_set_direction(item_widget, direction);
--
--    style = item_widget->style;
--    TSOffsetStyleGCs(style, rect->x, rect->y);
--
--    gtk_widget_style_get(item_widget, "selected-shadow-type", &shadow_type,
--                         NULL);
--
--    gtk_paint_box(style, drawable, GTK_STATE_PRELIGHT, shadow_type, cliprect,
--                  item_widget, "menuitem", rect->x, rect->y, rect->width,
--                  rect->height);
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_menu_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                     GdkRectangle* cliprect,
--                                     GtkWidgetState* state,
--                                     GtkTextDirection direction) {
--  GtkStyle* style;
--  GtkStateType state_type = ConvertGtkState(state);
--
--  ensure_menu_item_widget();
--  gtk_widget_set_direction(gMenuItemWidget, direction);
--
--  style = gMenuItemWidget->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_paint_arrow(
--      style, drawable, state_type,
--      (state_type == GTK_STATE_PRELIGHT) ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
--      cliprect, gMenuItemWidget, "menuitem",
--      (direction == GTK_TEXT_DIR_LTR) ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT, TRUE,
--      rect->x, rect->y, rect->width, rect->height);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_check_menu_item_paint(GdkDrawable* drawable,
--                                          GdkRectangle* rect,
--                                          GdkRectangle* cliprect,
--                                          GtkWidgetState* state,
--                                          gboolean checked, gboolean isradio,
--                                          GtkTextDirection direction) {
--  GtkStateType state_type = ConvertGtkState(state);
--  GtkStyle* style;
--  GtkShadowType shadow_type = (checked) ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
--  gint offset;
--  gint indicator_size, horizontal_padding;
--  gint x, y;
--
--  moz_gtk_menu_item_paint(MOZ_GTK_MENUITEM, drawable, rect, cliprect, state,
--                          direction);
--
--  ensure_check_menu_item_widget();
--  gtk_widget_set_direction(gCheckMenuItemWidget, direction);
--
--  gtk_widget_style_get(gCheckMenuItemWidget, "indicator-size", &indicator_size,
--                       "horizontal-padding", &horizontal_padding, NULL);
--
--  if (checked ||
--      GTK_CHECK_MENU_ITEM(gCheckMenuItemWidget)->always_show_toggle) {
--    style = gCheckMenuItemWidget->style;
--
--    offset = GTK_CONTAINER(gCheckMenuItemWidget)->border_width +
--             gCheckMenuItemWidget->style->xthickness + 2;
--
--    x = (direction == GTK_TEXT_DIR_RTL)
--            ? rect->width - indicator_size - offset - horizontal_padding
--            : rect->x + offset + horizontal_padding;
--    y = rect->y + (rect->height - indicator_size) / 2;
--
--    TSOffsetStyleGCs(style, x, y);
--    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gCheckMenuItemWidget),
--                                   checked);
--
--    if (isradio) {
--      gtk_paint_option(style, drawable, state_type, shadow_type, cliprect,
--                       gCheckMenuItemWidget, "option", x, y, indicator_size,
--                       indicator_size);
--    } else {
--      gtk_paint_check(style, drawable, state_type, shadow_type, cliprect,
--                      gCheckMenuItemWidget, "check", x, y, indicator_size,
--                      indicator_size);
--    }
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--static gint moz_gtk_window_paint(GdkDrawable* drawable, GdkRectangle* rect,
--                                 GdkRectangle* cliprect,
--                                 GtkTextDirection direction) {
--  GtkStyle* style;
--
--  ensure_window_widget();
--  gtk_widget_set_direction(gProtoWindow, direction);
--
--  style = gProtoWindow->style;
--
--  TSOffsetStyleGCs(style, rect->x, rect->y);
--  gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL,
--                                     cliprect, rect->x, rect->y, rect->width,
--                                     rect->height);
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
--                               gint* right, gint* bottom,
--                               GtkTextDirection direction, gboolean inhtml) {
--  GtkWidget* w;
--
--  switch (widget) {
--    case MOZ_GTK_BUTTON:
--    case MOZ_GTK_TOOLBAR_BUTTON: {
--      GtkBorder inner_border;
--      gboolean interior_focus;
--      gint focus_width, focus_pad;
--
--      ensure_button_widget();
--      *left = *top = *right = *bottom =
--          GTK_CONTAINER(gButtonWidget)->border_width;
--
--      /* Don't add this padding in HTML, otherwise the buttons will
--         become too big and stuff the layout. */
--      if (!inhtml) {
--        moz_gtk_widget_get_focus(gButtonWidget, &interior_focus, &focus_width,
--                                 &focus_pad);
--        moz_gtk_button_get_inner_border(gButtonWidget, &inner_border);
--        *left += focus_width + focus_pad + inner_border.left;
--        *right += focus_width + focus_pad + inner_border.right;
--        *top += focus_width + focus_pad + inner_border.top;
--        *bottom += focus_width + focus_pad + inner_border.bottom;
--      }
--
--      *left += gButtonWidget->style->xthickness;
--      *right += gButtonWidget->style->xthickness;
--      *top += gButtonWidget->style->ythickness;
--      *bottom += gButtonWidget->style->ythickness;
--      return MOZ_GTK_SUCCESS;
--    }
--    case MOZ_GTK_ENTRY:
--      ensure_entry_widget();
--      w = gEntryWidget;
--      break;
--    case MOZ_GTK_TREEVIEW:
--      ensure_tree_view_widget();
--      w = gTreeViewWidget;
--      break;
--    case MOZ_GTK_TREE_HEADER_CELL: {
--      /* A Tree Header in GTK is just a different styled button
--       * It must be placed in a TreeView for getting the correct style
--       * assigned.
--       * That is why the following code is the same as for MOZ_GTK_BUTTON.
--       * */
--
--      GtkBorder inner_border;
--      gboolean interior_focus;
--      gint focus_width, focus_pad;
--
--      ensure_tree_header_cell_widget();
--      *left = *top = *right = *bottom =
--          GTK_CONTAINER(gTreeHeaderCellWidget)->border_width;
--
--      moz_gtk_widget_get_focus(gTreeHeaderCellWidget, &interior_focus,
--                               &focus_width, &focus_pad);
--      moz_gtk_button_get_inner_border(gTreeHeaderCellWidget, &inner_border);
--      *left += focus_width + focus_pad + inner_border.left;
--      *right += focus_width + focus_pad + inner_border.right;
--      *top += focus_width + focus_pad + inner_border.top;
--      *bottom += focus_width + focus_pad + inner_border.bottom;
--
--      *left += gTreeHeaderCellWidget->style->xthickness;
--      *right += gTreeHeaderCellWidget->style->xthickness;
--      *top += gTreeHeaderCellWidget->style->ythickness;
--      *bottom += gTreeHeaderCellWidget->style->ythickness;
--      return MOZ_GTK_SUCCESS;
--    }
--    case MOZ_GTK_TREE_HEADER_SORTARROW:
--      ensure_tree_header_cell_widget();
--      w = gTreeHeaderSortArrowWidget;
--      break;
--    case MOZ_GTK_DROPDOWN_ENTRY:
--      ensure_combo_box_entry_widgets();
--      w = gComboBoxEntryTextareaWidget;
--      break;
--    case MOZ_GTK_DROPDOWN_ARROW:
--      ensure_combo_box_entry_widgets();
--      w = gComboBoxEntryButtonWidget;
--      break;
--    case MOZ_GTK_DROPDOWN: {
--      /* We need to account for the arrow on the dropdown, so text
--       * doesn't come too close to the arrow, or in some cases spill
--       * into the arrow. */
--      gboolean ignored_interior_focus, wide_separators;
--      gint focus_width, focus_pad, separator_width;
--      GtkRequisition arrow_req;
--
--      ensure_combo_box_widgets();
--
--      *left = GTK_CONTAINER(gComboBoxButtonWidget)->border_width;
--
--      if (!inhtml) {
--        moz_gtk_widget_get_focus(gComboBoxButtonWidget, &ignored_interior_focus,
--                                 &focus_width, &focus_pad);
--        *left += focus_width + focus_pad;
--      }
--
--      *top = *left + gComboBoxButtonWidget->style->ythickness;
--      *left += gComboBoxButtonWidget->style->xthickness;
--
--      *right = *left;
--      *bottom = *top;
--
--      /* If there is no separator, don't try to count its width. */
--      separator_width = 0;
--      if (gComboBoxSeparatorWidget) {
--        gtk_widget_style_get(gComboBoxSeparatorWidget, "wide-separators",
--                             &wide_separators, "separator-width",
--                             &separator_width, NULL);
--
--        if (!wide_separators)
--          separator_width = XTHICKNESS(gComboBoxSeparatorWidget->style);
--      }
--
--      gtk_widget_size_request(gComboBoxArrowWidget, &arrow_req);
--
--      if (direction == GTK_TEXT_DIR_RTL)
--        *left += separator_width + arrow_req.width;
--      else
--        *right += separator_width + arrow_req.width;
--
--      return MOZ_GTK_SUCCESS;
--    }
--    case MOZ_GTK_TABPANELS:
--      ensure_tab_widget();
--      w = gTabWidget;
--      break;
--    case MOZ_GTK_PROGRESSBAR:
--      ensure_progress_widget();
--      w = gProgressWidget;
--      break;
--    case MOZ_GTK_SPINBUTTON_ENTRY:
--    case MOZ_GTK_SPINBUTTON_UP:
--    case MOZ_GTK_SPINBUTTON_DOWN:
--      ensure_spin_widget();
--      w = gSpinWidget;
--      break;
--    case MOZ_GTK_SCALE_HORIZONTAL:
--      ensure_scale_widget();
--      w = gHScaleWidget;
--      break;
--    case MOZ_GTK_SCALE_VERTICAL:
--      ensure_scale_widget();
--      w = gVScaleWidget;
--      break;
--    case MOZ_GTK_FRAME:
--      ensure_frame_widget();
--      w = gFrameWidget;
--      break;
--    case MOZ_GTK_CHECKBUTTON_LABEL:
--    case MOZ_GTK_RADIOBUTTON_LABEL: {
--      gboolean interior_focus;
--      gint focus_width, focus_pad;
--
--      /* If the focus is interior, then the label has a border of
--         (focus_width + focus_pad). */
--      if (widget == MOZ_GTK_CHECKBUTTON_LABEL) {
--        ensure_checkbox_widget();
--        moz_gtk_widget_get_focus(gCheckboxWidget, &interior_focus, &focus_width,
--                                 &focus_pad);
--      } else {
--        ensure_radiobutton_widget();
--        moz_gtk_widget_get_focus(gRadiobuttonWidget, &interior_focus,
--                                 &focus_width, &focus_pad);
--      }
--
--      if (interior_focus)
--        *left = *top = *right = *bottom = (focus_width + focus_pad);
--      else
--        *left = *top = *right = *bottom = 0;
--
--      return MOZ_GTK_SUCCESS;
--    }
--
--    case MOZ_GTK_CHECKBUTTON_CONTAINER:
--    case MOZ_GTK_RADIOBUTTON_CONTAINER: {
--      gboolean interior_focus;
--      gint focus_width, focus_pad;
--
--      /* If the focus is _not_ interior, then the container has a border
--         of (focus_width + focus_pad). */
--      if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) {
--        ensure_checkbox_widget();
--        moz_gtk_widget_get_focus(gCheckboxWidget, &interior_focus, &focus_width,
--                                 &focus_pad);
--        w = gCheckboxWidget;
--      } else {
--        ensure_radiobutton_widget();
--        moz_gtk_widget_get_focus(gRadiobuttonWidget, &interior_focus,
--                                 &focus_width, &focus_pad);
--        w = gRadiobuttonWidget;
--      }
--
--      *left = *top = *right = *bottom = GTK_CONTAINER(w)->border_width;
--
--      if (!interior_focus) {
--        *left += (focus_width + focus_pad);
--        *right += (focus_width + focus_pad);
--        *top += (focus_width + focus_pad);
--        *bottom += (focus_width + focus_pad);
--      }
--
--      return MOZ_GTK_SUCCESS;
--    }
--    case MOZ_GTK_MENUPOPUP:
--      ensure_menu_popup_widget();
--      w = gMenuPopupWidget;
--      break;
--    case MOZ_GTK_MENUBARITEM:
--      // Bug 1274143 for MOZ_GTK_MENUBARITEM.
--      // Fall through to MOZ_GTK_MENUITEM for now.
--    case MOZ_GTK_MENUITEM:
--      ensure_menu_item_widget();
--      ensure_menu_bar_item_widget();
--      w = gMenuItemWidget;
--      break;
--    case MOZ_GTK_CHECKMENUITEM:
--    case MOZ_GTK_RADIOMENUITEM:
--      ensure_check_menu_item_widget();
--      w = gCheckMenuItemWidget;
--      break;
--    case MOZ_GTK_TAB_TOP:
--    case MOZ_GTK_TAB_BOTTOM:
--      ensure_tab_widget();
--      w = gTabWidget;
--      break;
--    case MOZ_GTK_TOOLTIP:
--      // In GTK 2 the spacing between box is set to 4.
--      *left = *top = *right = *bottom = 4;
--      return MOZ_GTK_SUCCESS;
--    /* These widgets have no borders, since they are not containers. */
--    case MOZ_GTK_SPLITTER_HORIZONTAL:
--    case MOZ_GTK_SPLITTER_VERTICAL:
--    case MOZ_GTK_CHECKBUTTON:
--    case MOZ_GTK_RADIOBUTTON:
--    case MOZ_GTK_SCROLLBAR_BUTTON:
--    case MOZ_GTK_SCROLLBAR_HORIZONTAL:
--    case MOZ_GTK_SCROLLBAR_TROUGH_HORIZONTAL:
--    case MOZ_GTK_SCROLLBAR_VERTICAL:
--    case MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL:
--    case MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL:
--    case MOZ_GTK_SCROLLBAR_THUMB_VERTICAL:
--    case MOZ_GTK_SCALE_THUMB_HORIZONTAL:
--    case MOZ_GTK_SCALE_THUMB_VERTICAL:
--    case MOZ_GTK_GRIPPER:
--    case MOZ_GTK_PROGRESS_CHUNK:
--    case MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE:
--    case MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE:
--    case MOZ_GTK_TREEVIEW_EXPANDER:
--    case MOZ_GTK_TOOLBAR_SEPARATOR:
--    case MOZ_GTK_MENUSEPARATOR:
--    /* These widgets have no borders.*/
--    case MOZ_GTK_INNER_SPIN_BUTTON:
--    case MOZ_GTK_SPINBUTTON:
--    case MOZ_GTK_WINDOW:
--    case MOZ_GTK_RESIZER:
--    case MOZ_GTK_MENUARROW:
--    case MOZ_GTK_TOOLBARBUTTON_ARROW:
--    case MOZ_GTK_TOOLBAR:
--    case MOZ_GTK_MENUBAR:
--    case MOZ_GTK_TAB_SCROLLARROW:
--      *left = *top = *right = *bottom = 0;
--      return MOZ_GTK_SUCCESS;
--    default:
--      g_warning("Unsupported widget type: %d", widget);
--      return MOZ_GTK_UNKNOWN_WIDGET;
--  }
--
--  *right = *left = XTHICKNESS(w->style);
--  *bottom = *top = YTHICKNESS(w->style);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_get_tab_border(gint* left, gint* top, gint* right, gint* bottom,
--                            GtkTextDirection direction, GtkTabFlags flags,
--                            WidgetNodeType widget) {
--  moz_gtk_get_widget_border(widget, left, top, right, bottom, direction, FALSE);
--
--  // Top tabs have no bottom border, bottom tabs have no top border
--  if (widget == MOZ_GTK_TAB_BOTTOM) {
--    *top = 0;
--  } else {
--    *bottom = 0;
--  }
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_get_combo_box_entry_button_size(gint* width, gint* height) {
--  /*
--   * We get the requisition of the drop down button, which includes
--   * all padding, border and focus line widths the button uses,
--   * as well as the minimum arrow size and its padding
--   * */
--  GtkRequisition requisition;
--  ensure_combo_box_entry_widgets();
--
--  gtk_widget_size_request(gComboBoxEntryButtonWidget, &requisition);
--  *width = requisition.width;
--  *height = requisition.height;
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height) {
--  gint arrow_size;
--
--  ensure_tab_widget();
--  gtk_widget_style_get(gTabWidget, "scroll-arrow-hlength", &arrow_size, NULL);
--
--  *height = *width = arrow_size;
--
--  return MOZ_GTK_SUCCESS;
--}
--
--void moz_gtk_get_arrow_size(WidgetNodeType widgetType, gint* width,
--                            gint* height) {
--  GtkWidget* widget;
--  switch (widgetType) {
--    case MOZ_GTK_DROPDOWN:
--      ensure_combo_box_widgets();
--      widget = gComboBoxArrowWidget;
--      break;
--    default:
--      ensure_button_arrow_widget();
--      widget = gButtonArrowWidget;
--      break;
--  }
--
--  GtkRequisition requisition;
--  gtk_widget_size_request(widget, &requisition);
--  *width = requisition.width;
--  *height = requisition.height;
--}
--
--gint moz_gtk_get_toolbar_separator_width(gint* size) {
--  gboolean wide_separators;
--  gint separator_width;
--  GtkStyle* style;
--
--  ensure_toolbar_widget();
--
--  style = gToolbarWidget->style;
--
--  gtk_widget_style_get(gToolbarWidget, "space-size", size, "wide-separators",
--                       &wide_separators, "separator-width", &separator_width,
--                       NULL);
--
--  /* Just in case... */
--  *size = MAX(*size, (wide_separators ? separator_width : style->xthickness));
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_get_expander_size(gint* size) {
--  ensure_expander_widget();
--  gtk_widget_style_get(gExpanderWidget, "expander-size", size, NULL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_get_treeview_expander_size(gint* size) {
--  ensure_tree_view_widget();
--  gtk_widget_style_get(gTreeViewWidget, "expander-size", size, NULL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_get_menu_separator_height(gint* size) {
--  gboolean wide_separators;
--  gint separator_height;
--
--  ensure_menu_separator_widget();
--
--  gtk_widget_style_get(gMenuSeparatorWidget, "wide-separators",
--                       &wide_separators, "separator-height", &separator_height,
--                       NULL);
--
--  if (wide_separators)
--    *size = separator_height + gMenuSeparatorWidget->style->ythickness;
--  else
--    *size = gMenuSeparatorWidget->style->ythickness * 2;
--
--  return MOZ_GTK_SUCCESS;
--}
--
--void moz_gtk_get_scale_metrics(GtkOrientation orient, gint* scale_width,
--                               gint* scale_height) {
--  moz_gtk_get_scalethumb_metrics(orient, scale_width, scale_height);
--}
--
--gint moz_gtk_get_scalethumb_metrics(GtkOrientation orient, gint* thumb_length,
--                                    gint* thumb_height) {
--  GtkWidget* widget;
--
--  ensure_scale_widget();
--  widget =
--      ((orient == GTK_ORIENTATION_HORIZONTAL) ? gHScaleWidget : gVScaleWidget);
--
--  gtk_widget_style_get(widget, "slider_length", thumb_length, "slider_width",
--                       thumb_height, NULL);
--
--  return MOZ_GTK_SUCCESS;
--}
--
--gint moz_gtk_get_scrollbar_metrics(MozGtkScrollbarMetrics* metrics) {
--  ensure_scrollbar_widget();
--
--  gtk_widget_style_get(gHorizScrollbarWidget, "slider_width",
--                       &metrics->slider_width, "trough_border",
--                       &metrics->trough_border, "stepper_size",
--                       &metrics->stepper_size, "stepper_spacing",
--                       &metrics->stepper_spacing, NULL);
--
--  metrics->min_slider_size = GTK_RANGE(gHorizScrollbarWidget)->min_slider_size;
--
--  return MOZ_GTK_SUCCESS;
--}
--void moz_gtk_get_widget_min_size(WidgetNodeType aGtkWidgetType, int* width,
--                                 int* height) {
--  MOZ_ASSERT_UNREACHABLE("get_widget_min_size not available for GTK2");
--}
--
--gint moz_gtk_widget_paint(WidgetNodeType widget, GdkDrawable* drawable,
--                          GdkRectangle* rect, GdkRectangle* cliprect,
--                          GtkWidgetState* state, gint flags,
--                          GtkTextDirection direction) {
--  switch (widget) {
--    case MOZ_GTK_BUTTON:
--    case MOZ_GTK_TOOLBAR_BUTTON:
--      if (state->depressed) {
--        ensure_toggle_button_widget();
--        return moz_gtk_button_paint(drawable, rect, cliprect, state,
--                                    (GtkReliefStyle)flags, gToggleButtonWidget,
--                                    direction);
--      }
--      ensure_button_widget();
--      return moz_gtk_button_paint(drawable, rect, cliprect, state,
--                                  (GtkReliefStyle)flags, gButtonWidget,
--                                  direction);
--      break;
--    case MOZ_GTK_CHECKBUTTON:
--    case MOZ_GTK_RADIOBUTTON:
--      return moz_gtk_toggle_paint(drawable, rect, cliprect, state,
--                                  !!(flags & MOZ_GTK_WIDGET_CHECKED),
--                                  !!(flags & MOZ_GTK_WIDGET_INCONSISTENT),
--                                  (widget == MOZ_GTK_RADIOBUTTON), direction);
--      break;
--    case MOZ_GTK_SCROLLBAR_BUTTON:
--      return moz_gtk_scrollbar_button_paint(drawable, rect, cliprect, state,
--                                            (GtkScrollbarButtonFlags)flags,
--                                            direction);
--      break;
--    case MOZ_GTK_SCROLLBAR_HORIZONTAL:
--    case MOZ_GTK_SCROLLBAR_VERTICAL:
--      return moz_gtk_scrollbar_trough_paint(widget, drawable, rect, cliprect,
--                                            state, direction);
--      break;
--    case MOZ_GTK_SCROLLBAR_TROUGH_HORIZONTAL:
--    case MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL:
--      return MOZ_GTK_SUCCESS;
--      break;
--    case MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL:
--    case MOZ_GTK_SCROLLBAR_THUMB_VERTICAL:
--      return moz_gtk_scrollbar_thumb_paint(widget, drawable, rect, cliprect,
--                                           state, direction);
--      break;
--    case MOZ_GTK_SCALE_HORIZONTAL:
--    case MOZ_GTK_SCALE_VERTICAL:
--      return moz_gtk_scale_paint(drawable, rect, cliprect, state,
--                                 (GtkOrientation)flags, direction);
--      break;
--    case MOZ_GTK_SCALE_THUMB_HORIZONTAL:
--    case MOZ_GTK_SCALE_THUMB_VERTICAL:
--      return moz_gtk_scale_thumb_paint(drawable, rect, cliprect, state,
--                                       (GtkOrientation)flags, direction);
--      break;
--    case MOZ_GTK_INNER_SPIN_BUTTON:
--      return moz_gtk_inner_spin_paint(drawable, rect, state, direction);
--      break;
--    case MOZ_GTK_SPINBUTTON:
--      return moz_gtk_spin_paint(drawable, rect, direction);
--      break;
--    case MOZ_GTK_SPINBUTTON_UP:
--    case MOZ_GTK_SPINBUTTON_DOWN:
--      return moz_gtk_spin_updown_paint(drawable, rect,
--                                       (widget == MOZ_GTK_SPINBUTTON_DOWN),
--                                       state, direction);
--      break;
--    case MOZ_GTK_SPINBUTTON_ENTRY:
--      ensure_spin_widget();
--      return moz_gtk_entry_paint(drawable, rect, cliprect, state, gSpinWidget,
--                                 direction);
--      break;
--    case MOZ_GTK_GRIPPER:
--      return moz_gtk_gripper_paint(drawable, rect, cliprect, state, direction);
--      break;
--    case MOZ_GTK_TREEVIEW:
--      return moz_gtk_treeview_paint(drawable, rect, cliprect, state, direction);
--      break;
--    case MOZ_GTK_TREE_HEADER_CELL:
--      return moz_gtk_tree_header_cell_paint(drawable, rect, cliprect, state,
--                                            flags, direction);
--      break;
--    case MOZ_GTK_TREE_HEADER_SORTARROW:
--      return moz_gtk_tree_header_sort_arrow_paint(
--          drawable, rect, cliprect, state, (GtkArrowType)flags, direction);
--      break;
--    case MOZ_GTK_TREEVIEW_EXPANDER:
--      return moz_gtk_treeview_expander_paint(
--          drawable, rect, cliprect, state, (GtkExpanderStyle)flags, direction);
--      break;
--    case MOZ_GTK_ENTRY:
--      ensure_entry_widget();
--      return moz_gtk_entry_paint(drawable, rect, cliprect, state, gEntryWidget,
--                                 direction);
--      break;
--    case MOZ_GTK_DROPDOWN:
--      return moz_gtk_combo_box_paint(drawable, rect, cliprect, state,
--                                     (gboolean)flags, direction);
--      break;
--    case MOZ_GTK_DROPDOWN_ARROW:
--      return moz_gtk_combo_box_entry_button_paint(drawable, rect, cliprect,
--                                                  state, flags, direction);
--      break;
--    case MOZ_GTK_DROPDOWN_ENTRY:
--      ensure_combo_box_entry_widgets();
--      return moz_gtk_entry_paint(drawable, rect, cliprect, state,
--                                 gComboBoxEntryTextareaWidget, direction);
--      break;
--    case MOZ_GTK_CHECKBUTTON_CONTAINER:
--    case MOZ_GTK_RADIOBUTTON_CONTAINER:
--      return moz_gtk_container_paint(drawable, rect, cliprect, state,
--                                     (widget == MOZ_GTK_RADIOBUTTON_CONTAINER),
--                                     direction);
--      break;
--    case MOZ_GTK_CHECKBUTTON_LABEL:
--    case MOZ_GTK_RADIOBUTTON_LABEL:
--      return moz_gtk_toggle_label_paint(drawable, rect, cliprect, state,
--                                        (widget == MOZ_GTK_RADIOBUTTON_LABEL),
--                                        direction);
--      break;
--    case MOZ_GTK_TOOLBAR:
--      return moz_gtk_toolbar_paint(drawable, rect, cliprect, direction);
--      break;
--    case MOZ_GTK_TOOLBAR_SEPARATOR:
--      return moz_gtk_toolbar_separator_paint(drawable, rect, cliprect,
--                                             direction);
--      break;
--    case MOZ_GTK_TOOLTIP:
--      return moz_gtk_tooltip_paint(drawable, rect, cliprect, direction);
--      break;
--    case MOZ_GTK_FRAME:
--      return moz_gtk_frame_paint(drawable, rect, cliprect, direction);
--      break;
--    case MOZ_GTK_RESIZER:
--      return moz_gtk_resizer_paint(drawable, rect, cliprect, state, direction);
--      break;
--    case MOZ_GTK_PROGRESSBAR:
--      return moz_gtk_progressbar_paint(drawable, rect, cliprect, direction);
--      break;
--    case MOZ_GTK_PROGRESS_CHUNK:
--    case MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE:
--    case MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE:
--      return moz_gtk_progress_chunk_paint(drawable, rect, cliprect, direction,
--                                          widget);
--      break;
--    case MOZ_GTK_TAB_TOP:
--    case MOZ_GTK_TAB_BOTTOM:
--      return moz_gtk_tab_paint(drawable, rect, cliprect, state,
--                               (GtkTabFlags)flags, direction, widget);
--      break;
--    case MOZ_GTK_TABPANELS:
--      return moz_gtk_tabpanels_paint(drawable, rect, cliprect, direction);
--      break;
--    case MOZ_GTK_TAB_SCROLLARROW:
--      return moz_gtk_tab_scroll_arrow_paint(drawable, rect, cliprect, state,
--                                            (GtkArrowType)flags, direction);
--      break;
--    case MOZ_GTK_MENUBAR:
--      return moz_gtk_menu_bar_paint(drawable, rect, cliprect, direction);
--      break;
--    case MOZ_GTK_MENUPOPUP:
--      return moz_gtk_menu_popup_paint(drawable, rect, cliprect, direction);
--      break;
--    case MOZ_GTK_MENUSEPARATOR:
--      return moz_gtk_menu_separator_paint(drawable, rect, cliprect, direction);
--      break;
--    case MOZ_GTK_MENUBARITEM:
--    case MOZ_GTK_MENUITEM:
--      return moz_gtk_menu_item_paint(widget, drawable, rect, cliprect, state,
--                                     direction);
--      break;
--    case MOZ_GTK_MENUARROW:
--      return moz_gtk_menu_arrow_paint(drawable, rect, cliprect, state,
--                                      direction);
--      break;
--    case MOZ_GTK_TOOLBARBUTTON_ARROW:
--      return moz_gtk_arrow_paint(drawable, rect, cliprect, state,
--                                 (GtkArrowType)flags, direction);
--      break;
--    case MOZ_GTK_CHECKMENUITEM:
--    case MOZ_GTK_RADIOMENUITEM:
--      return moz_gtk_check_menu_item_paint(
--          drawable, rect, cliprect, state, (gboolean)flags,
--          (widget == MOZ_GTK_RADIOMENUITEM), direction);
--      break;
--    case MOZ_GTK_SPLITTER_HORIZONTAL:
--      return moz_gtk_vpaned_paint(drawable, rect, cliprect, state);
--      break;
--    case MOZ_GTK_SPLITTER_VERTICAL:
--      return moz_gtk_hpaned_paint(drawable, rect, cliprect, state);
--      break;
--    case MOZ_GTK_WINDOW:
--      return moz_gtk_window_paint(drawable, rect, cliprect, direction);
--      break;
--    default:
--      g_warning("Unknown widget type: %d", widget);
--  }
--
--  return MOZ_GTK_UNKNOWN_WIDGET;
--}
--
--GtkWidget* moz_gtk_get_scrollbar_widget(void) {
--  MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
--  ensure_scrollbar_widget();
--  return gHorizScrollbarWidget;
--}
--
--gboolean moz_gtk_has_scrollbar_buttons(void) {
--  gboolean backward, forward, secondary_backward, secondary_forward;
--  MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
--  ensure_scrollbar_widget();
--  gtk_widget_style_get(gHorizScrollbarWidget, "has-backward-stepper", &backward,
--                       "has-forward-stepper", &forward,
--                       "has-secondary-backward-stepper", &secondary_backward,
--                       "has-secondary-forward-stepper", &secondary_forward,
--                       NULL);
--  return backward | forward | secondary_forward | secondary_forward;
--}
--
--gint moz_gtk_shutdown() {
--  GtkWidgetClass* entry_class;
--
--  if (gTooltipWidget) gtk_widget_destroy(gTooltipWidget);
--  /* This will destroy all of our widgets */
--  if (gProtoWindow) gtk_widget_destroy(gProtoWindow);
--
--  gProtoWindow = NULL;
--  gProtoLayout = NULL;
--  gButtonWidget = NULL;
--  gToggleButtonWidget = NULL;
--  gButtonArrowWidget = NULL;
--  gCheckboxWidget = NULL;
--  gRadiobuttonWidget = NULL;
--  gHorizScrollbarWidget = NULL;
--  gVertScrollbarWidget = NULL;
--  gSpinWidget = NULL;
--  gHScaleWidget = NULL;
--  gVScaleWidget = NULL;
--  gEntryWidget = NULL;
--  gComboBoxWidget = NULL;
--  gComboBoxButtonWidget = NULL;
--  gComboBoxSeparatorWidget = NULL;
--  gComboBoxArrowWidget = NULL;
--  gComboBoxEntryWidget = NULL;
--  gComboBoxEntryButtonWidget = NULL;
--  gComboBoxEntryArrowWidget = NULL;
--  gComboBoxEntryTextareaWidget = NULL;
--  gHandleBoxWidget = NULL;
--  gToolbarWidget = NULL;
--  gStatusbarWidget = NULL;
--  gFrameWidget = NULL;
--  gProgressWidget = NULL;
--  gTabWidget = NULL;
--  gTooltipWidget = NULL;
--  gMenuBarWidget = NULL;
--  gMenuBarItemWidget = NULL;
--  gMenuPopupWidget = NULL;
--  gMenuItemWidget = NULL;
--  gCheckMenuItemWidget = NULL;
--  gTreeViewWidget = NULL;
--  gMiddleTreeViewColumn = NULL;
--  gTreeHeaderCellWidget = NULL;
--  gTreeHeaderSortArrowWidget = NULL;
--  gExpanderWidget = NULL;
--  gToolbarSeparatorWidget = NULL;
--  gMenuSeparatorWidget = NULL;
--  gHPanedWidget = NULL;
--  gVPanedWidget = NULL;
--  gScrolledWindowWidget = NULL;
--
--  entry_class = g_type_class_peek(GTK_TYPE_ENTRY);
--  g_type_class_unref(entry_class);
--
--  is_initialized = FALSE;
--
--  return MOZ_GTK_SUCCESS;
--}
-diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
---- a/widget/gtk/moz.build
-+++ b/widget/gtk/moz.build
-@@ -103,26 +103,21 @@ if CONFIG['MOZ_WAYLAND']:
-         'WindowSurfaceWayland.cpp',
-     ]
- 
- if CONFIG['ACCESSIBILITY']:
-     UNIFIED_SOURCES += [
-         'maiRedundantObjectFactory.c',
-     ]
- 
--if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
--    UNIFIED_SOURCES += [
--        'gtk2drawing.c',
--    ]
--else:
--    UNIFIED_SOURCES += [
--        'gtk3drawing.cpp',
--        'nsApplicationChooser.cpp',
--        'WidgetStyleCache.cpp',
--    ]
-+UNIFIED_SOURCES += [
-+    'gtk3drawing.cpp',
-+    'nsApplicationChooser.cpp',
-+    'WidgetStyleCache.cpp',
-+]
- 
- include('/ipc/chromium/chromium-config.mozbuild')
- 
- FINAL_LIBRARY = 'xul'
- 
- LOCAL_INCLUDES += [
-     '/layout/generic',
-     '/layout/xul',

+ 0 - 544
rel-257/mozilla-esr60/patches/1502747-65a1.patch

@@ -1,544 +0,0 @@
-# HG changeset patch
-# User Ehsan Akhgari <ehsan@mozilla.com>
-# Date 1540885735 0
-# Node ID 60129b9fe3f652601b1fdbe0d3bc2786f0ca4105
-# Parent  307d45ba0b837b15c12d1a06e831c173f9bd62a3
-Bug 1502747 - Remove nsIContentPermissionType.access and all of its supporting code r=snorp,baku
-
-This field was originally added for the b2g-only DeviceStorage API,
-and isn't used for anything else right now.
-
-This reverts the remaining parts of bug 1043136 and bug 1043136
-as well as some support code for mobile.
-
-Differential Revision: https://phabricator.services.mozilla.com/D10014
-
-diff --git a/dom/base/nsContentPermissionHelper.cpp b/dom/base/nsContentPermissionHelper.cpp
---- a/dom/base/nsContentPermissionHelper.cpp
-+++ b/dom/base/nsContentPermissionHelper.cpp
-@@ -190,38 +190,31 @@ bool ContentPermissionRequestParent::IsB
-   // It's unsafe to send out any message now.
-   ContentParent* contentParent = static_cast<ContentParent*>(Manager());
-   return !contentParent->IsAlive();
- }
- 
- NS_IMPL_ISUPPORTS(ContentPermissionType, nsIContentPermissionType)
- 
- ContentPermissionType::ContentPermissionType(
--    const nsACString& aType, const nsACString& aAccess,
-+    const nsACString& aType,
-     const nsTArray<nsString>& aOptions) {
-   mType = aType;
--  mAccess = aAccess;
-   mOptions = aOptions;
- }
- 
- ContentPermissionType::~ContentPermissionType() {}
- 
- NS_IMETHODIMP
- ContentPermissionType::GetType(nsACString& aType) {
-   aType = mType;
-   return NS_OK;
- }
- 
- NS_IMETHODIMP
--ContentPermissionType::GetAccess(nsACString& aAccess) {
--  aAccess = mAccess;
--  return NS_OK;
--}
--
--NS_IMETHODIMP
- ContentPermissionType::GetOptions(nsIArray** aOptions) {
-   NS_ENSURE_ARG_POINTER(aOptions);
- 
-   *aOptions = nullptr;
- 
-   nsresult rv;
-   nsCOMPtr<nsIMutableArray> options =
-       do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
-@@ -246,32 +239,30 @@ ContentPermissionType::GetOptions(nsIArr
- 
- // nsContentPermissionUtils
- 
- /* static */ uint32_t nsContentPermissionUtils::ConvertPermissionRequestToArray(
-     nsTArray<PermissionRequest>& aSrcArray, nsIMutableArray* aDesArray) {
-   uint32_t len = aSrcArray.Length();
-   for (uint32_t i = 0; i < len; i++) {
-     RefPtr<ContentPermissionType> cpt = new ContentPermissionType(
--        aSrcArray[i].type(), aSrcArray[i].access(), aSrcArray[i].options());
-+        aSrcArray[i].type(), aSrcArray[i].options());
-     aDesArray->AppendElement(cpt);
-   }
-   return len;
- }
- 
- /* static */ uint32_t nsContentPermissionUtils::ConvertArrayToPermissionRequest(
-     nsIArray* aSrcArray, nsTArray<PermissionRequest>& aDesArray) {
-   uint32_t len = 0;
-   aSrcArray->GetLength(&len);
-   for (uint32_t i = 0; i < len; i++) {
-     nsCOMPtr<nsIContentPermissionType> cpt = do_QueryElementAt(aSrcArray, i);
-     nsAutoCString type;
--    nsAutoCString access;
-     cpt->GetType(type);
--    cpt->GetAccess(access);
- 
-     nsCOMPtr<nsIArray> optionArray;
-     cpt->GetOptions(getter_AddRefs(optionArray));
-     uint32_t optionsLength = 0;
-     if (optionArray) {
-       optionArray->GetLength(&optionsLength);
-     }
-     nsTArray<nsString> options;
-@@ -280,17 +271,17 @@ ContentPermissionType::GetOptions(nsIArr
-           do_QueryElementAt(optionArray, j);
-       if (isupportsString) {
-         nsString option;
-         isupportsString->GetData(option);
-         options.AppendElement(option);
-       }
-     }
- 
--    aDesArray.AppendElement(PermissionRequest(type, access, options));
-+    aDesArray.AppendElement(PermissionRequest(type, options));
-   }
-   return len;
- }
- 
- static std::map<PContentPermissionRequestParent*, TabId>&
- ContentPermissionRequestParentMap() {
-   MOZ_ASSERT(NS_IsMainThread());
-   static std::map<PContentPermissionRequestParent*, TabId>
-@@ -302,21 +293,21 @@ static std::map<PContentPermissionReques
- ContentPermissionRequestChildMap() {
-   MOZ_ASSERT(NS_IsMainThread());
-   static std::map<PContentPermissionRequestChild*, TabId>
-       sPermissionRequestChildMap;
-   return sPermissionRequestChildMap;
- }
- 
- /* static */ nsresult nsContentPermissionUtils::CreatePermissionArray(
--    const nsACString& aType, const nsACString& aAccess,
-+    const nsACString& aType,
-     const nsTArray<nsString>& aOptions, nsIArray** aTypesArray) {
-   nsCOMPtr<nsIMutableArray> types = do_CreateInstance(NS_ARRAY_CONTRACTID);
-   RefPtr<ContentPermissionType> permType =
--      new ContentPermissionType(aType, aAccess, aOptions);
-+      new ContentPermissionType(aType, aOptions);
-   types->AppendElement(permType);
-   types.forget(aTypesArray);
- 
-   return NS_OK;
- }
- 
- /* static */ PContentPermissionRequestParent*
- nsContentPermissionUtils::CreateContentPermissionRequestParent(
-diff --git a/dom/base/nsContentPermissionHelper.h b/dom/base/nsContentPermissionHelper.h
---- a/dom/base/nsContentPermissionHelper.h
-+++ b/dom/base/nsContentPermissionHelper.h
-@@ -41,37 +41,35 @@ class PermissionRequest;
- class ContentPermissionRequestParent;
- class PContentPermissionRequestParent;
- 
- class ContentPermissionType : public nsIContentPermissionType {
-  public:
-   NS_DECL_ISUPPORTS
-   NS_DECL_NSICONTENTPERMISSIONTYPE
- 
--  ContentPermissionType(const nsACString& aType, const nsACString& aAccess,
-+  ContentPermissionType(const nsACString& aType,
-                         const nsTArray<nsString>& aOptions);
- 
-  protected:
-   virtual ~ContentPermissionType();
- 
-   nsCString mType;
--  nsCString mAccess;
-   nsTArray<nsString> mOptions;
- };
- 
- class nsContentPermissionUtils {
-  public:
-   static uint32_t ConvertPermissionRequestToArray(
-       nsTArray<PermissionRequest>& aSrcArray, nsIMutableArray* aDesArray);
- 
-   static uint32_t ConvertArrayToPermissionRequest(
-       nsIArray* aSrcArray, nsTArray<PermissionRequest>& aDesArray);
- 
-   static nsresult CreatePermissionArray(const nsACString& aType,
--                                        const nsACString& aAccess,
-                                         const nsTArray<nsString>& aOptions,
-                                         nsIArray** aTypesArray);
- 
-   static PContentPermissionRequestParent* CreateContentPermissionRequestParent(
-       const nsTArray<PermissionRequest>& aRequests, Element* aElement,
-       const IPC::Principal& aPrincipal, const bool aIsHandlingUserInput,
-       const TabId& aTabId);
- 
-diff --git a/dom/geolocation/nsGeolocation.cpp b/dom/geolocation/nsGeolocation.cpp
---- a/dom/geolocation/nsGeolocation.cpp
-+++ b/dom/geolocation/nsGeolocation.cpp
-@@ -334,17 +334,17 @@ nsGeolocationRequest::GetPrincipal(nsIPr
- 
-   return NS_OK;
- }
- 
- NS_IMETHODIMP
- nsGeolocationRequest::GetTypes(nsIArray** aTypes) {
-   nsTArray<nsString> emptyOptions;
-   return nsContentPermissionUtils::CreatePermissionArray(
--      NS_LITERAL_CSTRING("geolocation"), NS_LITERAL_CSTRING("unused"),
-+      NS_LITERAL_CSTRING("geolocation"),
-       emptyOptions, aTypes);
- }
- 
- NS_IMETHODIMP
- nsGeolocationRequest::GetWindow(mozIDOMWindow** aRequestingWindow) {
-   NS_ENSURE_ARG_POINTER(aRequestingWindow);
- 
-   nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(mLocator->GetOwner());
-diff --git a/dom/interfaces/base/nsIContentPermissionPrompt.idl b/dom/interfaces/base/nsIContentPermissionPrompt.idl
---- a/dom/interfaces/base/nsIContentPermissionPrompt.idl
-+++ b/dom/interfaces/base/nsIContentPermissionPrompt.idl
-@@ -16,22 +16,16 @@ interface nsIArray;
- interface nsIContentPermissionType : nsISupports {
-   /**
-    *  The type of the permission request, such as
-    *  "geolocation".
-    */
-   readonly attribute ACString type;
- 
-   /**
--   *  The access of the permission request, such as
--   *  "read".
--   */
--  readonly attribute ACString access;
--
--  /**
-    * The array of available options.
-    */
-   readonly attribute nsIArray options; // ["choice1", "choice2"]
- };
- 
- /**
-  *  Interface provides the callback type.
-  */
-diff --git a/dom/ipc/PContentPermission.ipdlh b/dom/ipc/PContentPermission.ipdlh
---- a/dom/ipc/PContentPermission.ipdlh
-+++ b/dom/ipc/PContentPermission.ipdlh
-@@ -2,17 +2,16 @@
-  * License, v. 2.0. If a copy of the MPL was not distributed with this
-  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- 
- namespace mozilla {
- namespace dom {
- 
- struct PermissionRequest {
-   nsCString type;
--  nsCString access;
-   nsString[] options;
- };
- 
- struct PermissionChoice {
-   nsCString type;
-   nsString choice;
- };
- 
-diff --git a/dom/midi/MIDIPermissionRequest.cpp b/dom/midi/MIDIPermissionRequest.cpp
---- a/dom/midi/MIDIPermissionRequest.cpp
-+++ b/dom/midi/MIDIPermissionRequest.cpp
-@@ -59,17 +59,17 @@ MIDIPermissionRequest::GetRequester(
- NS_IMETHODIMP
- MIDIPermissionRequest::GetTypes(nsIArray** aTypes) {
-   NS_ENSURE_ARG_POINTER(aTypes);
-   nsTArray<nsString> options;
-   if (mNeedsSysex) {
-     options.AppendElement(NS_LITERAL_STRING("sysex"));
-   }
-   return nsContentPermissionUtils::CreatePermissionArray(
--      NS_LITERAL_CSTRING("midi"), NS_LITERAL_CSTRING("unused"), options,
-+      NS_LITERAL_CSTRING("midi"), options,
-       aTypes);
- }
- 
- NS_IMETHODIMP
- MIDIPermissionRequest::GetPrincipal(nsIPrincipal** aRequestingPrincipal) {
-   NS_ENSURE_ARG_POINTER(aRequestingPrincipal);
-   NS_IF_ADDREF(*aRequestingPrincipal = mPrincipal);
-   return NS_OK;
-diff --git a/dom/notification/Notification.cpp b/dom/notification/Notification.cpp
---- a/dom/notification/Notification.cpp
-+++ b/dom/notification/Notification.cpp
-@@ -583,17 +583,17 @@ nsresult NotificationPermissionRequest::
-   mPromise->MaybeResolve(mPermission);
-   return rv;
- }
- 
- NS_IMETHODIMP
- NotificationPermissionRequest::GetTypes(nsIArray** aTypes) {
-   nsTArray<nsString> emptyOptions;
-   return nsContentPermissionUtils::CreatePermissionArray(
--      NS_LITERAL_CSTRING("desktop-notification"), NS_LITERAL_CSTRING("unused"),
-+      NS_LITERAL_CSTRING("desktop-notification"),
-       emptyOptions, aTypes);
- }
- 
- NS_IMPL_ISUPPORTS(NotificationTelemetryService, nsIObserver)
- 
- NotificationTelemetryService::NotificationTelemetryService()
-     : mDNDRecorded(false) {}
- 
-diff --git a/dom/push/Push.js b/dom/push/Push.js
---- a/dom/push/Push.js
-+++ b/dom/push/Push.js
-@@ -175,17 +175,16 @@ Push.prototype = {
-     } catch (e) {}
-     return permission;
-   },
- 
-   _requestPermission: function(allowCallback, cancelCallback) {
-     // Create an array with a single nsIContentPermissionType element.
-     let type = {
-       type: "desktop-notification",
--      access: null,
-       options: [],
-       QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionType]),
-     };
-     let typeArray = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
-     typeArray.appendElement(type);
- 
-     // create a nsIContentPermissionRequest
-     let request = {
-diff --git a/dom/quota/StorageManager.cpp b/dom/quota/StorageManager.cpp
---- a/dom/quota/StorageManager.cpp
-+++ b/dom/quota/StorageManager.cpp
-@@ -730,17 +730,17 @@ PersistentStoragePermissionRequest::GetR
- 
- NS_IMETHODIMP
- PersistentStoragePermissionRequest::GetTypes(nsIArray** aTypes) {
-   MOZ_ASSERT(aTypes);
- 
-   nsTArray<nsString> emptyOptions;
- 
-   return nsContentPermissionUtils::CreatePermissionArray(
--      NS_LITERAL_CSTRING("persistent-storage"), NS_LITERAL_CSTRING("unused"),
-+      NS_LITERAL_CSTRING("persistent-storage"),
-       emptyOptions, aTypes);
- }
- 
- /*******************************************************************************
-  * StorageManager
-  ******************************************************************************/
- 
- StorageManager::StorageManager(nsIGlobalObject* aGlobal) : mOwner(aGlobal) {
-diff --git a/mobile/android/components/ContentPermissionPrompt.js b/mobile/android/components/ContentPermissionPrompt.js
---- a/mobile/android/components/ContentPermissionPrompt.js
-+++ b/mobile/android/components/ContentPermissionPrompt.js
-@@ -12,42 +12,36 @@ ChromeUtils.defineModuleGetter(this, "Do
-                                "resource://gre/modules/Prompt.jsm");
- 
- const kEntities = {
-   "contacts": "contacts",
-   "desktop-notification": "desktopNotification2",
-   "geolocation": "geolocation",
- };
- 
--// For these types, prompt for permission if action is unknown.
--const PROMPT_FOR_UNKNOWN = [
--  "desktop-notification",
--  "geolocation",
--];
--
- function ContentPermissionPrompt() {}
- 
- ContentPermissionPrompt.prototype = {
-   classID: Components.ID("{C6E8C44D-9F39-4AF7-BCC0-76E38A8310F5}"),
- 
-   QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt]),
- 
--  handleExistingPermission: function handleExistingPermission(request, type, denyUnknown, callback) {
-+  handleExistingPermission: function handleExistingPermission(request, type, isApp, callback) {
-     let result = Services.perms.testExactPermissionFromPrincipal(request.principal, type);
-     if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
-       callback(/* allow */ true);
-       return true;
-     }
- 
-     if (result == Ci.nsIPermissionManager.DENY_ACTION) {
-       callback(/* allow */ false);
-       return true;
-     }
- 
--    if (denyUnknown && result == Ci.nsIPermissionManager.UNKNOWN_ACTION) {
-+    if (isApp && result == Ci.nsIPermissionManager.UNKNOWN_ACTION) {
-       callback(/* allow */ false);
-       return true;
-     }
- 
-     return false;
-   },
- 
-   getChromeWindow: function getChromeWindow(aWindow) {
-@@ -92,45 +86,42 @@ ContentPermissionPrompt.prototype = {
-             (granted ? request.allow : request.cancel)();
-           });
-         return;
-       }
-       request.allow();
-     };
- 
-     // Returns true if the request was handled
--    let access = (perm.access && perm.access !== "unused") ?
--                 (perm.type + "-" + perm.access) : perm.type;
--    if (this.handleExistingPermission(request, access,
--          /* denyUnknown */ isApp || !PROMPT_FOR_UNKNOWN.includes(perm.type), callback)) {
-+    if (this.handleExistingPermission(request, perm.type, isApp, callback)) {
-        return;
-     }
- 
-     let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
-     let entityName = kEntities[perm.type];
- 
-     let buttons = [{
-       label: browserBundle.GetStringFromName(entityName + ".dontAllow"),
-       callback: function(aChecked) {
-         // If the user checked "Don't ask again" or this is a desktopNotification, make a permanent exception
-         if (aChecked || entityName == "desktopNotification2")
--          Services.perms.addFromPrincipal(request.principal, access, Ci.nsIPermissionManager.DENY_ACTION);
-+          Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.DENY_ACTION);
- 
-         callback(/* allow */ false);
-       }
-     },
-     {
-       label: browserBundle.GetStringFromName(entityName + ".allow"),
-       callback: function(aChecked) {
-         // If the user checked "Don't ask again" or this is a desktopNotification, make a permanent exception
-         if (aChecked || entityName == "desktopNotification2") {
--          Services.perms.addFromPrincipal(request.principal, access, Ci.nsIPermissionManager.ALLOW_ACTION);
-+          Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.ALLOW_ACTION);
-         } else if (isApp) {
-           // Otherwise allow the permission for the current session if the request comes from an app
--          Services.perms.addFromPrincipal(request.principal, access, Ci.nsIPermissionManager.ALLOW_ACTION, Ci.nsIPermissionManager.EXPIRE_SESSION);
-+          Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.ALLOW_ACTION, Ci.nsIPermissionManager.EXPIRE_SESSION);
-         }
- 
-         callback(/* allow */ true);
-       },
-       positive: true
-     }];
- 
-     let chromeWin = this.getChromeForRequest(request);
-diff --git a/mobile/android/components/geckoview/GeckoViewPermission.js b/mobile/android/components/geckoview/GeckoViewPermission.js
---- a/mobile/android/components/geckoview/GeckoViewPermission.js
-+++ b/mobile/android/components/geckoview/GeckoViewPermission.js
-@@ -181,17 +181,16 @@ GeckoViewPermission.prototype = {
- 
-     let perm = types.queryElementAt(0, Ci.nsIContentPermissionType);
-     let dispatcher = GeckoViewUtils.getDispatcherForWindow(
-         aRequest.window ? aRequest.window : aRequest.element.ownerGlobal);
-     dispatcher.sendRequestForResult({
-         type: "GeckoView:ContentPermission",
-         uri: aRequest.principal.URI.displaySpec,
-         perm: perm.type,
--        access: perm.access !== "unused" ? perm.access : null,
-     }).then(granted => {
-       if (!granted) {
-         return false;
-       }
-       // Ask for app permission after asking for content permission.
-       if (perm.type === "geolocation") {
-         return this.getAppPermissions(dispatcher, [PERM_ACCESS_FINE_LOCATION]);
-       }
-diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt
---- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt
-+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt
-@@ -49,17 +49,17 @@ class Callbacks private constructor() {
-         }
-     }
- 
-     interface PermissionDelegate : GeckoSession.PermissionDelegate {
-         override fun onAndroidPermissionsRequest(session: GeckoSession, permissions: Array<out String>, callback: GeckoSession.PermissionDelegate.Callback) {
-             callback.reject()
-         }
- 
--        override fun onContentPermissionRequest(session: GeckoSession, uri: String, type: Int, access: String, callback: GeckoSession.PermissionDelegate.Callback) {
-+        override fun onContentPermissionRequest(session: GeckoSession, uri: String, type: Int, callback: GeckoSession.PermissionDelegate.Callback) {
-             callback.reject()
-         }
- 
-         override fun onMediaPermissionRequest(session: GeckoSession, uri: String, video: Array<out GeckoSession.PermissionDelegate.MediaSource>, audio: Array<out GeckoSession.PermissionDelegate.MediaSource>, callback: GeckoSession.PermissionDelegate.MediaCallback) {
-             callback.reject()
-         }
-     }
- 
-diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
---- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
-+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
-@@ -285,18 +285,17 @@ public class GeckoSession extends LayerS
-                         type = PermissionDelegate.PERMISSION_GEOLOCATION;
-                     } else if ("desktop_notification".equals(typeString)) {
-                         type = PermissionDelegate.PERMISSION_DESKTOP_NOTIFICATION;
-                     } else {
-                         throw new IllegalArgumentException("Unknown permission request: " + typeString);
-                     }
-                     delegate.onContentPermissionRequest(
-                             GeckoSession.this, message.getString("uri"),
--                            type, message.getString("access"),
--                            new PermissionCallback(typeString, callback));
-+                            type, new PermissionCallback(typeString, callback));
-                 } else if ("GeckoView:MediaPermission".equals(event)) {
-                     GeckoBundle[] videoBundles = message.getBundleArray("video");
-                     GeckoBundle[] audioBundles = message.getBundleArray("audio");
-                     PermissionDelegate.MediaSource[] videos = null;
-                     PermissionDelegate.MediaSource[] audios = null;
- 
-                     if (videoBundles != null) {
-                         videos = new PermissionDelegate.MediaSource[videoBundles.length];
-@@ -2096,21 +2095,20 @@ public class GeckoSession extends LayerS
-         /**
-          * Request content permission.
-          *
-          * @param session GeckoSession instance requesting the permission.
-          * @param uri The URI of the content requesting the permission.
-          * @param type The type of the requested permission; possible values are,
-          *             PERMISSION_GEOLOCATION
-          *             PERMISSION_DESKTOP_NOTIFICATION
--         * @param access Not used.
-          * @param callback Callback interface.
-          */
--        void onContentPermissionRequest(GeckoSession session, String uri, int type,
--                                      String access, Callback callback);
-+        void onContentPermissionRequest(GeckoSession session, String uri,
-+                                        int type, Callback callback);
- 
-         class MediaSource {
-             /**
-              * The media source is a camera.
-              */
-             public static final int SOURCE_CAMERA = 0;
- 
-             /**
-diff --git a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java
---- a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java
-+++ b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java
-@@ -258,18 +258,17 @@ public class GeckoViewActivity extends A
-                 return;
-             }
-             mCallback = callback;
-             requestPermissions(permissions, androidPermissionRequestCode);
-         }
- 
-         @Override
-         public void onContentPermissionRequest(final GeckoSession session, final String uri,
--                                             final int type, final String access,
--                                             final Callback callback) {
-+                                             final int type, final Callback callback) {
-             final int resId;
-             if (PERMISSION_GEOLOCATION == type) {
-                 resId = R.string.request_geolocation;
-             } else if (PERMISSION_DESKTOP_NOTIFICATION == type) {
-                 resId = R.string.request_notification;
-             } else {
-                 Log.w(LOGTAG, "Unknown permission: " + type);
-                 callback.reject();

+ 0 - 172
rel-257/mozilla-esr60/patches/1506027-1-65a1.patch

@@ -1,172 +0,0 @@
-# HG changeset patch
-# User Mike Hommey <mh+mozilla@glandium.org>
-# Date 1541753082 0
-# Node ID 93d3226434c23c02afee626f7c7e728b05fde2bd
-# Parent  2056a2610462f6b4ab1a89bae9303c5ad112088e
-Bug 1506027 - Remove remaining (now useless) MOZ_WIDGET_GTK >= 3 tests. r=karlt
-
-Those are leftovers from bug 1278282.
-
-Differential Revision: https://phabricator.services.mozilla.com/D11434
-
-diff --git a/toolkit/crashreporter/client/crashreporter_linux.cpp b/toolkit/crashreporter/client/crashreporter_linux.cpp
---- a/toolkit/crashreporter/client/crashreporter_linux.cpp
-+++ b/toolkit/crashreporter/client/crashreporter_linux.cpp
-@@ -170,19 +170,17 @@ static void ViewReportClicked(GtkButton*
- 
-   GtkWidget* scrolled = gtk_scrolled_window_new(0, 0);
-   gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(dialog)),
-                     scrolled);
-   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
-                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
-   gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled),
-                                       GTK_SHADOW_IN);
--#if (MOZ_WIDGET_GTK >= 3)
-   gtk_widget_set_vexpand(scrolled, TRUE);
--#endif
- 
-   GtkWidget* viewReportTextView = gtk_text_view_new();
-   gtk_container_add(GTK_CONTAINER(scrolled), viewReportTextView);
-   gtk_text_view_set_editable(GTK_TEXT_VIEW(viewReportTextView), FALSE);
-   gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(viewReportTextView), GTK_WRAP_WORD);
-   gtk_widget_set_size_request(GTK_WIDGET(viewReportTextView), -1, 100);
- 
-   ShowReportInfo(GTK_TEXT_VIEW(viewReportTextView));
-@@ -431,20 +429,18 @@ bool UIShowCrashUI(const StringTable& fi
-                    0);
- 
-   GtkWidget* scrolled = gtk_scrolled_window_new(0, 0);
-   gtk_container_add(GTK_CONTAINER(innerVBox), scrolled);
-   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
-                                  GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
-   gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled),
-                                       GTK_SHADOW_IN);
--#if (MOZ_WIDGET_GTK >= 3)
-   gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled),
-                                              100);
--#endif
- 
-   gCommentTextLabel = gtk_label_new(gStrings[ST_COMMENTGRAYTEXT].c_str());
-   gCommentText = gtk_text_view_new();
-   gtk_label_set_mnemonic_widget(GTK_LABEL(gCommentTextLabel), gCommentText);
-   gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(gCommentText), FALSE);
-   g_signal_connect(gCommentText, "focus-in-event",
-                    G_CALLBACK(CommentFocusChange), 0);
-   g_signal_connect(gCommentText, "focus-out-event",
-diff --git a/widget/gtk/ScreenHelperGTK.cpp b/widget/gtk/ScreenHelperGTK.cpp
---- a/widget/gtk/ScreenHelperGTK.cpp
-+++ b/widget/gtk/ScreenHelperGTK.cpp
-@@ -98,26 +98,24 @@ ScreenHelperGTK::~ScreenHelperGTK() {
- 
-     gdk_window_remove_filter(mRootWindow, root_window_event_filter, this);
-     g_object_unref(mRootWindow);
-     mRootWindow = nullptr;
-   }
- }
- 
- gint ScreenHelperGTK::GetGTKMonitorScaleFactor(gint aMonitorNum) {
--#if (MOZ_WIDGET_GTK >= 3)
-   // Since GDK 3.10
-   static auto sGdkScreenGetMonitorScaleFactorPtr =
-       (gint(*)(GdkScreen*, gint))dlsym(RTLD_DEFAULT,
-                                        "gdk_screen_get_monitor_scale_factor");
-   if (sGdkScreenGetMonitorScaleFactorPtr) {
-     GdkScreen* screen = gdk_screen_get_default();
-     return sGdkScreenGetMonitorScaleFactorPtr(screen, aMonitorNum);
-   }
--#endif
-   return 1;
- }
- 
- static uint32_t GetGTKPixelDepth() {
-   GdkVisual* visual = gdk_screen_get_system_visual(gdk_screen_get_default());
-   return gdk_visual_get_depth(visual);
- }
- 
-diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
---- a/widget/gtk/nsWindow.cpp
-+++ b/widget/gtk/nsWindow.cpp
-@@ -4045,17 +4045,16 @@ nsTransparencyMode nsWindow::GetTranspar
- // with -moz-window-dragging: drag.
- void nsWindow::UpdateWindowDraggingRegion(
-     const LayoutDeviceIntRegion &aRegion) {
-   if (mDraggableRegion != aRegion) {
-     mDraggableRegion = aRegion;
-   }
- }
- 
--#if (MOZ_WIDGET_GTK >= 3)
- void nsWindow::UpdateOpaqueRegion(const LayoutDeviceIntRegion &aOpaqueRegion) {
-   // Available as of GTK 3.10+
-   static auto sGdkWindowSetOpaqueRegion =
-       (void (*)(GdkWindow *, cairo_region_t *))dlsym(
-           RTLD_DEFAULT, "gdk_window_set_opaque_region");
- 
-   if (sGdkWindowSetOpaqueRegion && mGdkWindow &&
-       gdk_window_get_window_type(mGdkWindow) == GDK_WINDOW_TOPLEVEL) {
-@@ -4068,17 +4067,16 @@ void nsWindow::UpdateOpaqueRegion(const 
-         cairo_rectangle_int_t rect = {r.x, r.y, r.width, r.height};
-         cairo_region_union_rectangle(region, &rect);
-       }
-       (*sGdkWindowSetOpaqueRegion)(mGdkWindow, region);
-       cairo_region_destroy(region);
-     }
-   }
- }
--#endif
- 
- nsresult nsWindow::ConfigureChildren(
-     const nsTArray<Configuration> &aConfigurations) {
-   // If this is a remotely updated widget we receive clipping, position, and
-   // size information from a source other than our owner. Don't let our parent
-   // update this information.
-   if (mWindowType == eWindowType_plugin_ipc_chrome) {
-     return NS_OK;
-@@ -6014,23 +6012,21 @@ void nsWindow::SetDrawsInTitlebar(bool a
- 
-     gtk_widget_destroy(tmpWindow);
-   }
- 
-   mDrawInTitlebar = aState;
- }
- 
- gint nsWindow::GdkScaleFactor() {
--#if (MOZ_WIDGET_GTK >= 3)
-   // Available as of GTK 3.10+
-   static auto sGdkWindowGetScaleFactorPtr =
-       (gint(*)(GdkWindow *))dlsym(RTLD_DEFAULT, "gdk_window_get_scale_factor");
-   if (sGdkWindowGetScaleFactorPtr && mGdkWindow)
-     return (*sGdkWindowGetScaleFactorPtr)(mGdkWindow);
--#endif
-   return ScreenHelperGTK::GetGTKMonitorScaleFactor();
- }
- 
- gint nsWindow::DevicePixelsToGdkCoordRoundUp(int pixels) {
-   gint scale = GdkScaleFactor();
-   return (pixels + scale - 1) / scale;
- }
- 
-diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
---- a/widget/gtk/nsWindow.h
-+++ b/widget/gtk/nsWindow.h
-@@ -290,20 +290,18 @@ class nsWindow final : public nsBaseWidg
- 
-   // These methods are for toplevel windows only.
-   void ResizeTransparencyBitmap();
-   void ApplyTransparencyBitmap();
-   void ClearTransparencyBitmap();
- 
-   virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
-   virtual nsTransparencyMode GetTransparencyMode() override;
--#if (MOZ_WIDGET_GTK >= 3)
-   virtual void UpdateOpaqueRegion(
-       const LayoutDeviceIntRegion& aOpaqueRegion) override;
--#endif
-   virtual nsresult ConfigureChildren(
-       const nsTArray<Configuration>& aConfigurations) override;
-   nsresult UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
-                                                 uint8_t* aAlphas,
-                                                 int32_t aStride);
- 
-   virtual void ReparentNativeWidget(nsIWidget* aNewParent) override;
- 

+ 0 - 43
rel-257/mozilla-esr60/patches/1509867-65a1.patch

@@ -1,43 +0,0 @@
-# HG changeset patch
-# User byron jones <glob@mozilla.com>
-# Date 1543242758 0
-# Node ID 689677e786f3ed6c9c54094bc9e55ee482ba797e
-# Parent  a01dfd031addc694ece01c4f46a2bf9083881436
-Bug 1509867 - add moz.yaml to libpng, r=aosmond
-
-Differential Revision: https://phabricator.services.mozilla.com/D12901
-
-diff --git a/media/libpng/MOZCHANGES b/media/libpng/MOZCHANGES
---- a/media/libpng/MOZCHANGES
-+++ b/media/libpng/MOZCHANGES
-@@ -1,10 +1,11 @@
- 
- Changes made to pristine libpng source by mozilla.org developers.
-+Update the 'release' field in moz.yaml when you update this file.
- 
- 2018/09/14  -- Synced with libpng-1.6.35 (bug #1491467).
- 
- 2017/08/30  -- Synced with libpng-1.6.34 (bug #1402057).
- 
- 2017/03/18  -- Synced with libpng-1.6.31 (bug #1377118).
- 
- 2017/03/18  -- Synced with libpng-1.6.29 (bug #1348356).
-diff --git a/media/libpng/moz.yaml b/media/libpng/moz.yaml
-new file mode 100644
---- /dev/null
-+++ b/media/libpng/moz.yaml
-@@ -0,0 +1,14 @@
-+schema: 1
-+
-+bugzilla:
-+  product: "Core"
-+  component: "ImageLib"
-+
-+origin:
-+  name: "libpng"
-+  description: "PNG reference library"
-+
-+  url: "http://www.libpng.org/pub/png/libpng.html"
-+  license: "libpng"
-+
-+  release: "1.6.35"

+ 0 - 43
rel-257/mozilla-esr60/patches/1510276-67a1.patch

@@ -1,43 +0,0 @@
-# HG changeset patch
-# User Robert Strong <robert.bugzilla@gmail.com>
-# Date 1551723774 0
-# Node ID a9bb4a23d4072a2735b50b577f9668728af06d30
-# Parent  1747dedcfe3444ea0b40fcd0e8c47ca55f9f340b
-Bug 1510276 - Fix GetLongPath so it returns the proper case for the path. r=mhowell
-
-Always uppercase the first char of the path in GetLongPath
-Remove GetLongPathNameW since it isn't setting the proper case for the path segments below the leaf name
-
-Differential Revision: https://phabricator.services.mozilla.com/D21873
-
-diff --git a/toolkit/mozapps/installer/windows/nsis/common.nsh b/toolkit/mozapps/installer/windows/nsis/common.nsh
---- a/toolkit/mozapps/installer/windows/nsis/common.nsh
-+++ b/toolkit/mozapps/installer/windows/nsis/common.nsh
-@@ -2198,21 +2198,22 @@
-       Push $R5
-       Push $R4
- 
-       ClearErrors
- 
-       GetFullPathName $R8 "$R9"
-       IfErrors end_GetLongPath +1 ; If the path doesn't exist return an empty string.
- 
--      System::Call 'kernel32::GetLongPathNameW(w R8, w .R7, i 1024)i .R6'
--      StrCmp "$R7" "" +4 +1 ; Empty string when GetLongPathNameW is not present.
--      StrCmp $R6 0 +3 +1    ; Should never equal 0 since the path exists.
--      StrCpy $R9 "$R7"
--      GoTo end_GetLongPath
-+      ; Make the drive letter uppercase.
-+      StrCpy $R9 "$R8" 1    ; Copy the first char.
-+      StrCpy $R8 "$R8" "" 1 ; Copy everything after the first char.
-+      ; Convert the first char to uppercase.
-+      System::Call "User32::CharUpper(w R9 R9)i"
-+      StrCpy $R8 "$R9$R8"   ; Copy the uppercase char and the rest of the chars.
- 
-       ; Do it the hard way.
-       StrCpy $R4 0     ; Stores the position in the string of the last \ found.
-       StrCpy $R6 -1    ; Set the counter to -1 so it will start at 0.
- 
-       loop_GetLongPath:
-       IntOp $R6 $R6 + 1      ; Increment the counter.
-       StrCpy $R7 $R8 1 $R6   ; Starting from the counter copy the next char.

+ 0 - 5558
rel-257/mozilla-esr60/patches/1513236-68a1.patch

@@ -1,5558 +0,0 @@
-# HG changeset patch
-# User Ryan VanderMeulen <ryanvm@gmail.com>
-# Date 1556057075 0
-# Node ID 179c0370dfa12b59d2214509d41a8356962f5df7
-# Parent  98c4e99bc09f8827b127015649f2143fa5efa4c5
-Bug 1513236 - Update libpng to version 1.6.37. r=aosmond
-
-Differential Revision: https://phabricator.services.mozilla.com/D15239
-
-diff --git a/media/libpng/ANNOUNCE b/media/libpng/ANNOUNCE
-new file mode 100644
---- /dev/null
-+++ b/media/libpng/ANNOUNCE
-@@ -0,0 +1,47 @@
-+libpng 1.6.37 - April 14, 2019
-+==============================
-+
-+This is a public release of libpng, intended for use in production code.
-+
-+
-+Files available for download
-+----------------------------
-+
-+Source files with LF line endings (for Unix/Linux):
-+
-+ * libpng-1.6.37.tar.xz (LZMA-compressed, recommended)
-+ * libpng-1.6.37.tar.gz
-+
-+Source files with CRLF line endings (for Windows):
-+
-+ * lp1637.7z (LZMA-compressed, recommended)
-+ * lp1637.zip
-+
-+Other information:
-+
-+ * README.md
-+ * LICENSE.md
-+ * AUTHORS.md
-+ * TRADEMARK.md
-+
-+
-+Changes since the previous public release (version 1.6.36)
-+----------------------------------------------------------
-+
-+ * Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
-+ * Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
-+ * Fixed a memory leak in pngtest.c.
-+ * Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
-+   contrib/pngminus; refactor.
-+ * Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
-+   (Contributed by Willem van Schaik)
-+ * Fixed a typo in the libpng license v2.
-+   (Contributed by Miguel Ojeda)
-+ * Added makefiles for AddressSanitizer-enabled builds.
-+ * Cleaned up various makefiles.
-+
-+
-+Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
-+Subscription is required; visit
-+https://lists.sourceforge.net/lists/listinfo/png-mng-implement
-+to subscribe.
-diff --git a/media/libpng/AUTHORS b/media/libpng/AUTHORS
-new file mode 100644
---- /dev/null
-+++ b/media/libpng/AUTHORS
-@@ -0,0 +1,45 @@
-+PNG REFERENCE LIBRARY AUTHORS
-+=============================
-+
-+This is the list of PNG Reference Library ("libpng") Contributing
-+Authors, for copyright and licensing purposes.
-+
-+ * Andreas Dilger
-+ * Cosmin Truta
-+ * Dave Martindale
-+ * Eric S. Raymond
-+ * Gilles Vollant
-+ * Glenn Randers-Pehrson
-+ * Greg Roelofs
-+ * Guy Eric Schalnat
-+ * James Yu
-+ * John Bowler
-+ * Kevin Bracey
-+ * Magnus Holmgren
-+ * Mandar Sahastrabuddhe
-+ * Mans Rullgard
-+ * Matt Sarett
-+ * Mike Klein
-+ * Paul Schmidt
-+ * Sam Bushell
-+ * Samuel Williams
-+ * Simon-Pierre Cadieux
-+ * Tim Wegner
-+ * Tom Lane
-+ * Tom Tanner
-+ * Vadim Barkov
-+ * Willem van Schaik
-+ * Zhijie Liang
-+ * Arm Holdings
-+   - Richard Townsend
-+ * Google Inc.
-+   - Matt Sarett
-+   - Mike Klein
-+
-+The build projects, the build scripts, the test scripts, and other
-+files in the "projects", "scripts" and "tests" directories, have other
-+copyright owners, but are released under the libpng license.
-+
-+Some files in the "contrib" directory, and some tools-generated files
-+that are distributed with libpng, have other copyright owners, and are
-+released under other open source licenses.
-diff --git a/media/libpng/CHANGES b/media/libpng/CHANGES
---- a/media/libpng/CHANGES
-+++ b/media/libpng/CHANGES
-@@ -6058,14 +6058,52 @@ Version 1.6.35beta02 [March 28, 2018]
- 
- Version 1.6.35 [July 15, 2018]
-   Replaced the remaining uses of png_size_t with size_t (Cosmin)
-   Fixed the calculation of row_factor in png_check_chunk_length
-     (reported by Thuan Pham in SourceForge issue #278)
-   Added missing parentheses to a macro definition
-     (suggested by "irwir" in GitHub issue #216)
- 
--Send comments/corrections/commendations to png-mng-implement at lists.sf.net
--(subscription required; visit
-+Version 1.6.36 [December 1, 2018]
-+  Optimized png_do_expand_palette for ARM processors.
-+  Improved performance by around 10-22% on a recent ARM Chromebook.
-+    (Contributed by Richard Townsend, ARM Holdings)
-+  Fixed manipulation of machine-specific optimization options.
-+    (Contributed by Vicki Pfau)
-+  Used memcpy instead of manual pointer arithmetic on Intel SSE2.
-+    (Contributed by Samuel Williams)
-+  Fixed build errors with MSVC on ARM64.
-+    (Contributed by Zhijie Liang)
-+  Fixed detection of libm in CMakeLists.
-+    (Contributed by Cameron Cawley)
-+  Fixed incorrect creation of pkg-config file in CMakeLists.
-+    (Contributed by Kyle Bentley)
-+  Fixed the CMake build on Windows MSYS by avoiding symlinks.
-+  Fixed a build warning on OpenBSD.
-+    (Contributed by Theo Buehler)
-+  Fixed various typos in comments.
-+    (Contributed by "luz.paz")
-+  Raised the minimum required CMake version from 3.0.2 to 3.1.
-+  Removed yet more of the vestigial support for pre-ANSI C compilers.
-+  Removed ancient makefiles for ancient systems that have been broken
-+    across all previous libpng-1.6.x versions.
-+  Removed the Y2K compliance statement and the export control
-+    information.
-+  Applied various code style and documentation fixes.
-+
-+Version 1.6.37 [April 14, 2019]
-+  Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
-+  Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
-+  Fixed a memory leak in pngtest.c.
-+  Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
-+    contrib/pngminus; refactor.
-+  Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
-+    (Contributed by Willem van Schaik)
-+  Fixed a typo in the libpng license v2.
-+    (Contributed by Miguel Ojeda)
-+  Added makefiles for AddressSanitizer-enabled builds.
-+  Cleaned up various makefiles.
-+
-+Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
-+Subscription is required; visit
- https://lists.sourceforge.net/lists/listinfo/png-mng-implement
--to subscribe).
--
--Glenn R-P
-+to subscribe.
-diff --git a/media/libpng/LICENSE b/media/libpng/LICENSE
---- a/media/libpng/LICENSE
-+++ b/media/libpng/LICENSE
-@@ -1,143 +1,134 @@
-+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
-+=========================================
- 
--This copy of the libpng notices is provided for your convenience.  In case of
--any discrepancy between this copy and the notices in the file png.h that is
--included in the libpng distribution, the latter shall prevail.
-+PNG Reference Library License version 2
-+---------------------------------------
- 
--COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
--
--If you modify libpng you may insert additional notices immediately following
--this sentence.
-+ * Copyright (c) 1995-2019 The PNG Reference Library Authors.
-+ * Copyright (c) 2018-2019 Cosmin Truta.
-+ * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
-+ * Copyright (c) 1996-1997 Andreas Dilger.
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
- 
--pnglibconf.h and moz.build are distributed under the Mozilla Public License,
--v. 2.0. If a copy of the MPL was not distributed with this file, You can
--obtain one at http://mozilla.org/MPL/2.0/.
-+The software is supplied "as is", without warranty of any kind,
-+express or implied, including, without limitation, the warranties
-+of merchantability, fitness for a particular purpose, title, and
-+non-infringement.  In no event shall the Copyright owners, or
-+anyone distributing the software, be liable for any damages or
-+other liability, whether in contract, tort or otherwise, arising
-+from, out of, or in connection with the software, or the use or
-+other dealings in the software, even if advised of the possibility
-+of such damage.
-+
-+Permission is hereby granted to use, copy, modify, and distribute
-+this software, or portions hereof, for any purpose, without fee,
-+subject to the following restrictions:
- 
--This modified version of libpng code adds animated PNG support and is
--released under the libpng license described below. The modifications are
--Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2017 Max Stepin,
--and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives
--surrounding them in the modified libpng source files.
-+ 1. The origin of this software must not be misrepresented; you
-+    must not claim that you wrote the original software.  If you
-+    use this software in a product, an acknowledgment in the product
-+    documentation would be appreciated, but is not required.
-+
-+ 2. Altered source versions must be plainly marked as such, and must
-+    not be misrepresented as being the original software.
- 
--This code is released under the libpng license.
-+ 3. This Copyright notice may not be removed or altered from any
-+    source or altered source distribution.
-+
- 
--libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
-+PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
-+-----------------------------------------------------------------------
-+
-+libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
- Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
- derived from libpng-1.0.6, and are distributed according to the same
- disclaimer and license as libpng-1.0.6 with the following individuals
- added to the list of Contributing Authors:
- 
--   Simon-Pierre Cadieux
--   Eric S. Raymond
--   Mans Rullgard
--   Cosmin Truta
--   Gilles Vollant
--   James Yu
--   Mandar Sahastrabuddhe
--   Google Inc.
--   Vadim Barkov
-+    Simon-Pierre Cadieux
-+    Eric S. Raymond
-+    Mans Rullgard
-+    Cosmin Truta
-+    Gilles Vollant
-+    James Yu
-+    Mandar Sahastrabuddhe
-+    Google Inc.
-+    Vadim Barkov
- 
- and with the following additions to the disclaimer:
- 
--   There is no warranty against interference with your enjoyment of the
--   library or against infringement.  There is no warranty that our
--   efforts or the library will fulfill any of your particular purposes
--   or needs.  This library is provided with all faults, and the entire
--   risk of satisfactory quality, performance, accuracy, and effort is with
--   the user.
-+    There is no warranty against interference with your enjoyment of
-+    the library or against infringement.  There is no warranty that our
-+    efforts or the library will fulfill any of your particular purposes
-+    or needs.  This library is provided with all faults, and the entire
-+    risk of satisfactory quality, performance, accuracy, and effort is
-+    with the user.
- 
- Some files in the "contrib" directory and some configure-generated
--files that are distributed with libpng have other copyright owners and
-+files that are distributed with libpng have other copyright owners, and
- are released under other open source licenses.
- 
- libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
- Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
- libpng-0.96, and are distributed according to the same disclaimer and
--license as libpng-0.96, with the following individuals added to the list
--of Contributing Authors:
-+license as libpng-0.96, with the following individuals added to the
-+list of Contributing Authors:
- 
--   Tom Lane
--   Glenn Randers-Pehrson
--   Willem van Schaik
-+    Tom Lane
-+    Glenn Randers-Pehrson
-+    Willem van Schaik
- 
- libpng versions 0.89, June 1996, through 0.96, May 1997, are
- Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
- and are distributed according to the same disclaimer and license as
- libpng-0.88, with the following individuals added to the list of
- Contributing Authors:
- 
--   John Bowler
--   Kevin Bracey
--   Sam Bushell
--   Magnus Holmgren
--   Greg Roelofs
--   Tom Tanner
-+    John Bowler
-+    Kevin Bracey
-+    Sam Bushell
-+    Magnus Holmgren
-+    Greg Roelofs
-+    Tom Tanner
- 
--Some files in the "scripts" directory have other copyright owners
-+Some files in the "scripts" directory have other copyright owners,
- but are released under this license.
- 
- libpng versions 0.5, May 1995, through 0.88, January 1996, are
- Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
- 
- For the purposes of this copyright and license, "Contributing Authors"
- is defined as the following set of individuals:
- 
--   Andreas Dilger
--   Dave Martindale
--   Guy Eric Schalnat
--   Paul Schmidt
--   Tim Wegner
-+    Andreas Dilger
-+    Dave Martindale
-+    Guy Eric Schalnat
-+    Paul Schmidt
-+    Tim Wegner
- 
--The PNG Reference Library is supplied "AS IS".  The Contributing Authors
--and Group 42, Inc. disclaim all warranties, expressed or implied,
--including, without limitation, the warranties of merchantability and of
--fitness for any purpose.  The Contributing Authors and Group 42, Inc.
--assume no liability for direct, indirect, incidental, special, exemplary,
--or consequential damages, which may result from the use of the PNG
--Reference Library, even if advised of the possibility of such damage.
-+The PNG Reference Library is supplied "AS IS".  The Contributing
-+Authors and Group 42, Inc. disclaim all warranties, expressed or
-+implied, including, without limitation, the warranties of
-+merchantability and of fitness for any purpose.  The Contributing
-+Authors and Group 42, Inc. assume no liability for direct, indirect,
-+incidental, special, exemplary, or consequential damages, which may
-+result from the use of the PNG Reference Library, even if advised of
-+the possibility of such damage.
- 
- Permission is hereby granted to use, copy, modify, and distribute this
- source code, or portions hereof, for any purpose, without fee, subject
- to the following restrictions:
- 
--  1. The origin of this source code must not be misrepresented.
--
--  2. Altered versions must be plainly marked as such and must not
--     be misrepresented as being the original source.
--
--  3. This Copyright notice may not be removed or altered from any
--     source or altered source distribution.
-+ 1. The origin of this source code must not be misrepresented.
- 
--The Contributing Authors and Group 42, Inc. specifically permit, without
--fee, and encourage the use of this source code as a component to
--supporting the PNG file format in commercial products.  If you use this
--source code in a product, acknowledgment is not required but would be
--appreciated.
--
--END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
--
--TRADEMARK:
-+ 2. Altered versions must be plainly marked as such and must not
-+    be misrepresented as being the original source.
- 
--The name "libpng" has not been registered by the Copyright owner
--as a trademark in any jurisdiction.  However, because libpng has
--been distributed and maintained world-wide, continually since 1995,
--the Copyright owner claims "common-law trademark protection" in any
--jurisdiction where common-law trademark is recognized.
--
--OSI CERTIFICATION:
--
--Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
--a certification mark of the Open Source Initiative. OSI has not addressed
--the additional disclaimers inserted at version 1.0.7.
-+ 3. This Copyright notice may not be removed or altered from any
-+    source or altered source distribution.
- 
--EXPORT CONTROL:
--
--The Copyright owner believes that the Export Control Classification
--Number (ECCN) for libpng is EAR99, which means not subject to export
--controls or International Traffic in Arms Regulations (ITAR) because
--it is open source, publicly available software, that does not contain
--any encryption software.  See the EAR, paragraphs 734.3(b)(3) and
--734.7(b).
--
--Glenn Randers-Pehrson
--glennrp at users.sourceforge.net
--July 15, 2018
-+The Contributing Authors and Group 42, Inc. specifically permit,
-+without fee, and encourage the use of this source code as a component
-+to supporting the PNG file format in commercial products.  If you use
-+this source code in a product, acknowledgment is not required but would
-+be appreciated.
-diff --git a/media/libpng/MOZCHANGES b/media/libpng/MOZCHANGES
---- a/media/libpng/MOZCHANGES
-+++ b/media/libpng/MOZCHANGES
-@@ -1,12 +1,23 @@
--
- Changes made to pristine libpng source by mozilla.org developers.
- Update the 'release' field in moz.yaml when you update this file.
- 
-+pnglibconf.h and moz.build are distributed under the Mozilla Public License,
-+v. 2.0. If a copy of the MPL was not distributed with this file, You can
-+obtain one at http://mozilla.org/MPL/2.0/.
-+
-+This modified version of libpng code adds animated PNG support and is
-+released under the same license as the upstream library. The modifications
-+are Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2017 Max Stepin,
-+and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives
-+surrounding them in the modified libpng source files.
-+
-+2019/04/15  -- Synced with libpng-1.6.37 (bug #1513236)
-+
- 2018/09/14  -- Synced with libpng-1.6.35 (bug #1491467).
- 
- 2017/08/30  -- Synced with libpng-1.6.34 (bug #1402057).
- 
- 2017/03/18  -- Synced with libpng-1.6.31 (bug #1377118).
- 
- 2017/03/18  -- Synced with libpng-1.6.29 (bug #1348356).
- 
-diff --git a/media/libpng/README b/media/libpng/README
---- a/media/libpng/README
-+++ b/media/libpng/README
-@@ -1,20 +1,21 @@
--README for libpng version 1.6.35 - July 15, 2018 (shared library 16.0)
--See the note about version numbers near the top of png.h
-+README for libpng version 1.6.37 - April 14, 2019
-+=================================================
- 
-+See the note about version numbers near the top of png.h.
- See INSTALL for instructions on how to install libpng.
- 
- Libpng comes in several distribution formats.  Get libpng-*.tar.gz or
--libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
--or lpng*.7z or lpng*.zip if you want DOS-style line endings.
-+libpng-*.tar.xz or if you want UNIX-style line endings in the text
-+files, or lpng*.7z or lpng*.zip if you want DOS-style line endings.
- 
- Version 0.89 was the first official release of libpng.  Don't let the
--fact that it's the first release fool you.  The libpng library has been in
--extensive use and testing since mid-1995.  By late 1997 it had
-+fact that it's the first release fool you.  The libpng library has been
-+in extensive use and testing since mid-1995.  By late 1997 it had
- finally gotten to the stage where there hadn't been significant
- changes to the API in some time, and people have a bad feeling about
- libraries with versions < 1.0.  Version 1.0.0 was released in
- March 1998.
- 
- ****
- Note that some of the changes to the png_info structure render this
- version of the library binary incompatible with libpng-0.89 or
-@@ -55,104 +56,69 @@ conversion.
- The additions since 0.89 include the ability to read from a PNG stream
- which has had some (or all) of the signature bytes read by the calling
- application.  This also allows the reading of embedded PNG streams that
- do not have the PNG file signature.  As well, it is now possible to set
- the library action on the detection of chunk CRC errors.  It is possible
- to set different actions based on whether the CRC error occurred in a
- critical or an ancillary chunk.
- 
--The changes made to the library, and bugs fixed are based on discussions
--on the PNG-implement mailing list and not on material submitted
--privately to Guy, Andreas, or Glenn.  They will forward any good
--suggestions to the list.
--
--For a detailed description on using libpng, read libpng-manual.txt.  For
--examples of libpng in a program, see example.c and pngtest.c.  For usage
--information and restrictions (what little they are) on libpng, see
--png.h.  For a description on using zlib (the compression library used by
--libpng) and zlib's restrictions, see zlib.h
-+For a detailed description on using libpng, read libpng-manual.txt.
-+For examples of libpng in a program, see example.c and pngtest.c.  For
-+usage information and restrictions (what little they are) on libpng,
-+see png.h.  For a description on using zlib (the compression library
-+used by libpng) and zlib's restrictions, see zlib.h
- 
- I have included a general makefile, as well as several machine and
--compiler specific ones, but you may have to modify one for your own needs.
-+compiler specific ones, but you may have to modify one for your own
-+needs.
- 
- You should use zlib 1.0.4 or later to run this, but it MAY work with
- versions as old as zlib 0.95.  Even so, there are bugs in older zlib
- versions which can cause the output of invalid compression streams for
--some images.  You will definitely need zlib 1.0.4 or later if you are
--taking advantage of the MS-DOS "far" structure allocation for the small
--and medium memory models.  You should also note that zlib is a
--compression library that is useful for more things than just PNG files.
--You can use zlib as a drop-in replacement for fread() and fwrite() if
--you are so inclined.
-+some images.
- 
--zlib should be available at the same place that libpng is, or at zlib.net.
-+You should also note that zlib is a compression library that is useful
-+for more things than just PNG files.  You can use zlib as a drop-in
-+replacement for fread() and fwrite(), if you are so inclined.
-+
-+zlib should be available at the same place that libpng is, or at
-+https://zlib.net.
- 
- You may also want a copy of the PNG specification.  It is available
- as an RFC, a W3C Recommendation, and an ISO/IEC Standard.  You can find
- these at http://www.libpng.org/pub/png/pngdocs.html .
- 
- This code is currently being archived at libpng.sourceforge.io in the
--[DOWNLOAD] area, and at http://libpng.download/src .  If you
--can't find it in any of those places, e-mail me, and I'll help you find it.
--
--I am not a lawyer, but I believe that the Export Control Classification
--Number (ECCN) for libpng is EAR99, which means not subject to export
--controls or International Traffic in Arms Regulations (ITAR) because it
--is open source, publicly available software, that does not contain any
--encryption software.  See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
-+[DOWNLOAD] area, and at http://libpng.download/src .
- 
--If you have any code changes, requests, problems, etc., please e-mail
--them to me.  Also, I'd appreciate any make files or project files,
--and any modifications you needed to make to get libpng to compile,
--along with a #define variable to tell what compiler/system you are on.
--If you needed to add transformations to libpng, or wish libpng would
--provide the image in a different way, drop me a note (and code, if
--possible), so I can consider supporting the transformation.
--Finally, if you get any warning messages when compiling libpng
--(note: not zlib), and they are easy to fix, I'd appreciate the
--fix.  Please mention "libpng" somewhere in the subject line.  Thanks.
--
--This release was created and will be supported by myself (of course
--based in a large way on Guy's and Andreas' earlier work), and the PNG
-+This release, based in a large way on Glenn's, Guy's and Andreas'
-+earlier work, was created and will be supported by myself and the PNG
- development group.
- 
- Send comments/corrections/commendations to png-mng-implement at
- lists.sourceforge.net (subscription required; visit
- https://lists.sourceforge.net/lists/listinfo/png-mng-implement
- to subscribe).
- 
--You can't reach Guy, the original libpng author, at the addresses
--given in previous versions of this document.  He and Andreas will
--read mail addressed to the png-implement list, however.
--
--Please do not send general questions about PNG.  Send them to
--png-mng-misc at lists.sf.net (subscription required; visit
-+Send general questions about the PNG specification to png-mng-misc
-+at lists.sourceforge.net (subscription required; visit
- https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
--subscribe).  If you have a question about something
--in the PNG specification that is related to using libpng, send it
--to me.  Send me any questions that start with "I was using libpng,
--and ...".  If in doubt, send questions to me.  I'll bounce them
--to others, if necessary.
--
--Please do not send suggestions on how to change PNG.  We have
--been discussing PNG for twenty years now, and it is official and
--finished.  If you have suggestions for libpng, however, I'll
--gladly listen.  Even if your suggestion is not used immediately,
--it may be used later.
-+subscribe).
- 
- Files in this distribution:
- 
-       ANNOUNCE      =>  Announcement of this version, with recent changes
-+      AUTHORS       =>  List of contributing authors
-       CHANGES       =>  Description of changes between libpng versions
-       KNOWNBUG      =>  List of known bugs and deficiencies
-       LICENSE       =>  License to use and redistribute libpng
-       README        =>  This file
-       TODO          =>  Things not implemented in the current library
--      Y2KINFO       =>  Statement of Y2K compliance
-+      TRADEMARK     =>  Trademark information
-       example.c     =>  Example code for using libpng functions
-       libpng.3      =>  manual page for libpng (includes libpng-manual.txt)
-       libpng-manual.txt  =>  Description of libpng and its functions
-       libpngpf.3    =>  manual page for libpng's private functions
-       png.5         =>  manual page for the PNG format
-       png.c         =>  Basic interface functions common to library
-       png.h         =>  Library function and interface declarations (public)
-       pngpriv.h     =>  Library function and interface declarations (private)
-@@ -203,20 +169,15 @@ Files in this distribution:
-        owatcom          =>  Contains a WATCOM project for building libpng
-        visualc71        =>  Contains a Microsoft Visual C++ (MSVC)
-                             workspace for building libpng and zlib
-        vstudio          =>  Contains a Microsoft Visual C++ (MSVC)
-                             workspace for building libpng and zlib
-       scripts       =>  Directory containing scripts for building libpng:
-                             (see scripts/README.txt for the list of scripts)
- 
--Good luck, and happy coding.
--
---Glenn Randers-Pehrson (current maintainer, since 1998)
-- Internet: glennrp at users.sourceforge.net
-+Good luck, and happy coding!
- 
---Andreas Eric Dilger (former maintainer, 1996-1997)
-- Internet: adilger at enel.ucalgary.ca
-- Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
--
---Guy Eric Schalnat (original author and former maintainer, 1995-1996)
-- (formerly of Group 42, Inc)
-- Internet: gschal at infinet.com
-+ * Cosmin Truta (current maintainer, since 2018)
-+ * Glenn Randers-Pehrson (former maintainer, 1998-2018)
-+ * Andreas Eric Dilger (former maintainer, 1996-1997)
-+ * Guy Eric Schalnat (original author and former maintainer, 1995-1996)
-+   (formerly of Group 42, Inc.)
-diff --git a/media/libpng/TRADEMARK b/media/libpng/TRADEMARK
-new file mode 100644
---- /dev/null
-+++ b/media/libpng/TRADEMARK
-@@ -0,0 +1,8 @@
-+TRADEMARK
-+=========
-+
-+The name "libpng" has not been registered by the Copyright owners
-+as a trademark in any jurisdiction.  However, because libpng has
-+been distributed and maintained world-wide, continually since 1995,
-+the Copyright owners claim "common-law trademark protection" in any
-+jurisdiction where common-law trademark is recognized.
-diff --git a/media/libpng/apng.patch b/media/libpng/apng.patch
---- a/media/libpng/apng.patch
-+++ b/media/libpng/apng.patch
-@@ -1,103 +1,25 @@
--diff --git a/LICENSE b/LICENSE
----- a/LICENSE
--+++ b/LICENSE
--@@ -7,8 +7,14 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENS
-- 
-- If you modify libpng you may insert additional notices immediately following
-- this sentence.
-- 
--+This modified version of libpng code adds animated PNG support and is
--+released under the libpng license described below. The modifications are
--+Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2017 Max Stepin,
--+and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives
--+surrounding them in the modified libpng source files.
--+
-- This code is released under the libpng license.
-- 
-- libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
-- Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
--diff --git a/png.c b/png.c
----- a/png.c
--+++ b/png.c
--@@ -815,19 +815,23 @@ png_get_copyright(png_const_structrp png
--    return PNG_STRING_COPYRIGHT
-- #else
-- #  ifdef __STDC__
--    return PNG_STRING_NEWLINE \
---      "libpng version 1.6.35 - July 15, 2018" PNG_STRING_NEWLINE \
--+      "libpng version 1.6.35+apng - July 15, 2018" PNG_STRING_NEWLINE \
--       "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
--       PNG_STRING_NEWLINE \
--       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
--       "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
---      PNG_STRING_NEWLINE;
--+      PNG_STRING_NEWLINE \
--+      "Portions Copyright (c) 2006-2007 Andrew Smith" PNG_STRING_NEWLINE \
--+      "Portions Copyright (c) 2008-2018 Max Stepin" PNG_STRING_NEWLINE ;
-- #  else
---   return "libpng version 1.6.35 - July 15, 2018\
--+   return "libpng version 1.6.35+apng - July 15, 2018\
--       Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson\
--       Copyright (c) 1996-1997 Andreas Dilger\
---      Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
--+      Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\
--+      Portions Copyright (c) 2006-2007 Andrew Smith\
--+      Portions Copyright (c) 2008-2018 Max Stepin";
-- #  endif
-- #endif
-- }
-- 
- diff --git a/png.h b/png.h
- --- a/png.h
- +++ b/png.h
--@@ -22,8 +22,14 @@
--  *
--  * If you modify libpng you may insert additional notices immediately following
--  * this sentence.
--  *
--+ * This modified version of libpng code adds animated PNG support and is
--+ * released under the libpng license described below. The modifications are
--+ * Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2017 Max Stepin,
--+ * and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives
--+ * surrounding them in the modified libpng source files.
--+ *
--  * This code is released under the libpng license.
--  *
--  * libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
--  * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
--@@ -308,10 +314,11 @@
--  * skip to the end of this file and read the section entitled 'simplified API'.
--  */
-- 
-- /* Version information for png.h - this should match the version in png.c */
---#define PNG_LIBPNG_VER_STRING "1.6.35"
---#define PNG_HEADER_VERSION_STRING " libpng version 1.6.35 - July 15, 2018\n"
--+#define PNG_LIBPNG_VER_STRING "1.6.35+apng"
--+#define PNG_HEADER_VERSION_STRING \
--+     " libpng version 1.6.35+apng - July 15, 2018\n"
-- 
-- #define PNG_LIBPNG_VER_SONUM   16
-- #define PNG_LIBPNG_VER_DLLNUM  16
-- 
--@@ -360,8 +367,12 @@
-+@@ -329,8 +329,12 @@
-   */
-  #   include "pnglibconf.h"
-  #endif
-  
- +#define PNG_APNG_SUPPORTED
- +#define PNG_READ_APNG_SUPPORTED
- +#define PNG_WRITE_APNG_SUPPORTED
- +
-  #ifndef PNG_VERSION_INFO_ONLY
-  /* Machine specific configuration. */
-  #  include "pngconf.h"
-  #endif
--@@ -455,8 +466,19 @@ extern "C" {
-+@@ -424,8 +428,19 @@ extern "C" {
-   * constants.
-   * See pngconf.h for base types that vary by machine/system
-   */
-  
- +#ifdef PNG_APNG_SUPPORTED
- +/* dispose_op flags from inside fcTL */
- +#define PNG_DISPOSE_OP_NONE        0x00
- +#define PNG_DISPOSE_OP_BACKGROUND  0x01
-@@ -106,44 +28,44 @@ diff --git a/png.h b/png.h
- +/* blend_op flags from inside fcTL */
- +#define PNG_BLEND_OP_SOURCE        0x00
- +#define PNG_BLEND_OP_OVER          0x01
- +#endif /* APNG */
- +
-  /* This triggers a compiler error in png.c, if png.c and png.h
-   * do not agree upon the version number.
-   */
-- typedef char* png_libpng_version_1_6_35;
--@@ -776,8 +798,12 @@ typedef png_unknown_chunk * * png_unknow
-+ typedef char* png_libpng_version_1_6_37;
-+@@ -745,8 +760,12 @@ typedef png_unknown_chunk * * png_unknow
-  #define PNG_INFO_sPLT 0x2000U  /* ESR, 1.0.6 */
-  #define PNG_INFO_sCAL 0x4000U  /* ESR, 1.0.6 */
-  #define PNG_INFO_IDAT 0x8000U  /* ESR, 1.0.6 */
-  #define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
- +#ifdef PNG_APNG_SUPPORTED
- +#define PNG_INFO_acTL 0x20000U
- +#define PNG_INFO_fcTL 0x40000U
- +#endif
-  
-  /* This is used for the transformation routines, as some of them
-   * change these values for the row.  It also should enable using
-   * the routines for other purposes.
--@@ -813,8 +839,12 @@ typedef PNG_CALLBACK(void, *png_write_st
-+@@ -782,8 +801,12 @@ typedef PNG_CALLBACK(void, *png_write_st
-  
-  #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-  typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
-  typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
- +#ifdef PNG_APNG_SUPPORTED
- +typedef PNG_CALLBACK(void, *png_progressive_frame_ptr, (png_structp,
- +    png_uint_32));
- +#endif
-  
-  /* The following callback receives png_uint_32 row_number, int pass for the
-   * png_bytep data of the row.  When transforming an interlaced image the
-   * row number is the row number within the sub-image of the interlace pass, so
--@@ -3257,17 +3287,90 @@ PNG_EXPORT(244, int, png_set_option, (pn
-+@@ -3226,17 +3249,90 @@ PNG_EXPORT(244, int, png_set_option, (pn
-  /*******************************************************************************
-   *  END OF HARDWARE AND SOFTWARE OPTIONS
-   ******************************************************************************/
-  
- +#ifdef PNG_APNG_SUPPORTED
- +PNG_EXPORT(248, png_uint_32, png_get_acTL, (png_structp png_ptr,
- +   png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
- +
-@@ -666,30 +588,30 @@ diff --git a/pngpread.c b/pngpread.c
- +
-  png_voidp PNGAPI
-  png_get_progressive_ptr(png_const_structrp png_ptr)
-  {
-     if (png_ptr == NULL)
- diff --git a/pngpriv.h b/pngpriv.h
- --- a/pngpriv.h
- +++ b/pngpriv.h
--@@ -633,8 +633,12 @@
-+@@ -636,8 +636,12 @@
-  #define PNG_HAVE_PNG_SIGNATURE    0x1000U
-  #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
-                     /*             0x4000U (unused) */
-  #define PNG_IS_READ_STRUCT        0x8000U /* Else is a write struct */
- +#ifdef PNG_APNG_SUPPORTED
- +#define PNG_HAVE_acTL            0x10000U
- +#define PNG_HAVE_fcTL            0x20000U
- +#endif
-  
-  /* Flags for the transformations the PNG library does on the image data */
-  #define PNG_BGR                 0x0001U
-  #define PNG_INTERLACE           0x0002U
--@@ -869,8 +873,18 @@
-+@@ -872,8 +876,18 @@
-  #define png_tIME PNG_U32(116,  73,  77,  69)
-  #define png_tRNS PNG_U32(116,  82,  78,  83)
-  #define png_zTXt PNG_U32(122,  84,  88, 116)
-  
- +#ifdef PNG_APNG_SUPPORTED
- +#define png_acTL PNG_U32( 97,  99,  84,  76)
- +#define png_fcTL PNG_U32(102,  99,  84,  76)
- +#define png_fdAT PNG_U32(102, 100,  65,  84)
-@@ -698,17 +620,17 @@ diff --git a/pngpriv.h b/pngpriv.h
- +#define PNG_FIRST_FRAME_HIDDEN       0x0001U
- +#define PNG_APNG_APP                 0x0002U
- +#endif
- +
-  /* The following will work on (signed char*) strings, whereas the get_uint_32
-   * macro will fail on top-bit-set values because of the sign extension.
-   */
-  #define PNG_CHUNK_FROM_STRING(s)\
--@@ -1620,8 +1634,51 @@ PNG_INTERNAL_FUNCTION(void,png_push_read
-+@@ -1623,8 +1637,51 @@ PNG_INTERNAL_FUNCTION(void,png_push_read
-  #  endif
-  
-  #endif /* PROGRESSIVE_READ */
-  
- +#ifdef PNG_APNG_SUPPORTED
- +PNG_INTERNAL_FUNCTION(void,png_ensure_fcTL_is_valid,(png_structp png_ptr,
- +   png_uint_32 width, png_uint_32 height,
- +   png_uint_32 x_offset, png_uint_32 y_offset,
-@@ -875,17 +797,17 @@ diff --git a/pngrutil.c b/pngrutil.c
- +   png_ptr->first_frame_width = width;
- +   png_ptr->first_frame_height = height;
- +#endif
- +
-     /* Set internal variables */
-     png_ptr->width = width;
-     png_ptr->height = height;
-     png_ptr->bit_depth = (png_byte)bit_depth;
--@@ -2857,8 +2862,182 @@ png_handle_iTXt(png_structrp png_ptr, pn
-+@@ -2856,8 +2861,182 @@ png_handle_iTXt(png_structrp png_ptr, pn
-        png_chunk_benign_error(png_ptr, errmsg);
-  }
-  #endif
-  
- +#ifdef PNG_READ_APNG_SUPPORTED
- +void /* PRIVATE */
- +png_handle_acTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
- +{
-@@ -1058,31 +980,31 @@ diff --git a/pngrutil.c b/pngrutil.c
- +    png_ptr->next_seq_num++;
- +}
- +#endif /* READ_APNG */
- +
-  #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
-  /* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */
-  static int
-  png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
--@@ -3162,9 +3341,13 @@ png_check_chunk_length(png_const_structr
-+@@ -3161,9 +3340,13 @@ png_check_chunk_length(png_const_structr
-  # elif PNG_USER_CHUNK_MALLOC_MAX > 0
-     if (PNG_USER_CHUNK_MALLOC_MAX < limit)
-        limit = PNG_USER_CHUNK_MALLOC_MAX;
-  # endif
- +#ifdef PNG_READ_APNG_SUPPORTED
- +   if (png_ptr->chunk_name == png_IDAT || png_ptr->chunk_name == png_fdAT)
- +#else
-     if (png_ptr->chunk_name == png_IDAT)
- +#endif
-     {
-        png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
-        size_t row_factor =
-           (size_t)png_ptr->width
--@@ -4166,8 +4349,40 @@ png_read_IDAT_data(png_structrp png_ptr,
-+@@ -4165,8 +4348,40 @@ png_read_IDAT_data(png_structrp png_ptr,
-        {
-           uInt avail_in;
-           png_bytep buffer;
-  
- +#ifdef PNG_READ_APNG_SUPPORTED
- +         png_uint_32 bytes_to_skip = 0;
- +
- +         while (png_ptr->idat_size == 0 || bytes_to_skip != 0)
-@@ -1113,39 +1035,39 @@ diff --git a/pngrutil.c b/pngrutil.c
- +               png_ptr->idat_size -= 4;
- +            }
- +         }
- +#else
-           while (png_ptr->idat_size == 0)
-           {
-              png_crc_finish(png_ptr, 0);
-  
--@@ -4177,8 +4392,9 @@ png_read_IDAT_data(png_structrp png_ptr,
-+@@ -4176,8 +4391,9 @@ png_read_IDAT_data(png_structrp png_ptr,
-               */
-              if (png_ptr->chunk_name != png_IDAT)
-                 png_error(png_ptr, "Not enough image data");
-           }
- +#endif /* READ_APNG */
-  
-           avail_in = png_ptr->IDAT_read_size;
-  
-           if (avail_in > png_ptr->idat_size)
--@@ -4240,8 +4456,11 @@ png_read_IDAT_data(png_structrp png_ptr,
-+@@ -4239,8 +4455,11 @@ png_read_IDAT_data(png_structrp png_ptr,
-           png_ptr->zstream.next_out = NULL;
-  
-           png_ptr->mode |= PNG_AFTER_IDAT;
-           png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
- +#ifdef PNG_READ_APNG_SUPPORTED
- +         png_ptr->num_frames_read++;
- +#endif
-  
-           if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
-              png_chunk_benign_error(png_ptr, "Extra compressed data");
-           break;
--@@ -4678,5 +4897,81 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED
-+@@ -4677,5 +4896,81 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED
-        png_error(png_ptr, png_ptr->zstream.msg);
-  
-     png_ptr->flags |= PNG_FLAG_ROW_INIT;
-  }
- +
- +#ifdef PNG_READ_APNG_SUPPORTED
- +/* This function is to be called after the main IDAT set has been read and
- + * before a new IDAT is read. It resets some parts of png_ptr
-@@ -1386,17 +1308,17 @@ diff --git a/pngset.c b/pngset.c
- +
-  #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
-  static png_byte
-  check_location(png_const_structrp png_ptr, int location)
-  {
- diff --git a/pngstruct.h b/pngstruct.h
- --- a/pngstruct.h
- +++ b/pngstruct.h
--@@ -402,8 +402,29 @@ struct png_struct_def
-+@@ -408,8 +408,29 @@ struct png_struct_def
-  #ifdef PNG_MNG_FEATURES_SUPPORTED
-     png_byte filter_type;
-  #endif
-  
- +#ifdef PNG_APNG_SUPPORTED
- +   png_uint_32 apng_flags;
- +   png_uint_32 next_seq_num;         /* next fcTL/fdAT chunk sequence number */
- +   png_uint_32 first_frame_width;
-diff --git a/media/libpng/arm.patch b/media/libpng/arm.patch
---- a/media/libpng/arm.patch
-+++ b/media/libpng/arm.patch
-@@ -1,12 +1,12 @@
- diff --git a/arm/arm_init.c b/arm/arm_init.c
- --- a/arm/arm_init.c
- +++ b/arm/arm_init.c
--@@ -33,9 +33,9 @@
-+@@ -34,9 +34,9 @@
-   * implementation which reads /proc/cpufino.
-   */
-  #ifndef PNG_ARM_NEON_FILE
-  #  ifdef __linux__
- -#     define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
- +#     define PNG_ARM_NEON_FILE "linux.c"
-  #  endif
-  #endif
-diff --git a/media/libpng/arm/arm_init.c b/media/libpng/arm/arm_init.c
---- a/media/libpng/arm/arm_init.c
-+++ b/media/libpng/arm/arm_init.c
-@@ -1,19 +1,20 @@
- 
- /* arm_init.c - NEON optimised filter functions
-  *
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 2014,2016 Glenn Randers-Pehrson
-  * Written by Mans Rullgard, 2011.
-- * Last changed in libpng 1.6.22 [May 26, 2016]
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
-+
- /* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
-  * called.
-  */
- #define _POSIX_SOURCE 1
- 
- #include "../pngpriv.h"
- 
- #ifdef PNG_READ_SUPPORTED
-diff --git a/media/libpng/arm/filter_neon.S b/media/libpng/arm/filter_neon.S
---- a/media/libpng/arm/filter_neon.S
-+++ b/media/libpng/arm/filter_neon.S
-@@ -1,14 +1,14 @@
- 
- /* filter_neon.S - NEON optimised filter functions
-  *
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 2014,2017 Glenn Randers-Pehrson
-  * Written by Mans Rullgard, 2011.
-- * Last changed in libpng 1.6.31 [July 27, 2017]
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- /* These are required because Mozilla's moz.build system doesn't pass
-  * -DDefined macros to the assembler.
-diff --git a/media/libpng/arm/filter_neon_intrinsics.c b/media/libpng/arm/filter_neon_intrinsics.c
---- a/media/libpng/arm/filter_neon_intrinsics.c
-+++ b/media/libpng/arm/filter_neon_intrinsics.c
-@@ -1,43 +1,51 @@
- 
- /* filter_neon_intrinsics.c - NEON optimised filter functions
-  *
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 2014,2016 Glenn Randers-Pehrson
-  * Written by James Yu <james.yu at linaro.org>, October 2013.
-  * Based on filter_neon.S, written by Mans Rullgard, 2011.
-  *
-- * Last changed in libpng 1.6.22 [May 26, 2016]
-- *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- #include "../pngpriv.h"
- 
- #ifdef PNG_READ_SUPPORTED
- 
- /* This code requires -mfpu=neon on the command line: */
- #if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
- 
--#include <arm_neon.h>
-+#if defined(_MSC_VER) && defined(_M_ARM64) && !defined(__clang__)
-+#  include <arm64_neon.h>
-+#else
-+#  include <arm_neon.h>
-+#endif
- 
- /* libpng row pointers are not necessarily aligned to any particular boundary,
-  * however this code will only work with appropriate alignment.  arm/arm_init.c
-  * checks for this (and will not compile unless it is done). This code uses
-  * variants of png_aligncast to avoid compiler warnings.
-  */
- #define png_ptr(type,pointer) png_aligncast(type *,pointer)
- #define png_ptrc(type,pointer) png_aligncastconst(const type *,pointer)
- 
- /* The following relies on a variable 'temp_pointer' being declared with type
-  * 'type'.  This is written this way just to hide the GCC strict aliasing
-  * warning; note that the code is safe because there never is an alias between
-  * the input and output pointers.
-+ *
-+ * When compiling with MSVC ARM64, the png_ldr macro can't be passed directly
-+ * to vst4_lane_u32, because of an internal compiler error inside MSVC.
-+ * To avoid this compiler bug, we use a temporary variable (vdest_val) to store
-+ * the result of png_ldr.
-  */
- #define png_ldr(type,pointer)\
-    (temp_pointer = png_ptr(type,pointer), *temp_pointer)
- 
- #if PNG_ARM_NEON_OPT > 0
- 
- void
- png_read_filter_row_up_neon(png_row_infop row_info, png_bytep row,
-@@ -120,22 +128,25 @@ png_read_filter_row_sub4_neon(png_row_in
-    png_debug(1, "in png_read_filter_row_sub4_neon");
- 
-    for (; rp < rp_stop; rp += 16)
-    {
-       uint32x2x4_t vtmp = vld4_u32(png_ptr(uint32_t,rp));
-       uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp);
-       uint8x8x4_t vrp = *vrpt;
-       uint32x2x4_t *temp_pointer;
-+      uint32x2x4_t vdest_val;
- 
-       vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
-       vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
-       vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
-       vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
--      vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
-+
-+      vdest_val = png_ldr(uint32x2x4_t, &vdest);
-+      vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
-    }
- 
-    PNG_UNUSED(prev_row)
- }
- 
- void
- png_read_filter_row_avg3_neon(png_row_infop row_info, png_bytep row,
-    png_const_bytep prev_row)
-@@ -218,16 +229,17 @@ png_read_filter_row_avg4_neon(png_row_in
-    png_debug(1, "in png_read_filter_row_avg4_neon");
- 
-    for (; rp < rp_stop; rp += 16, pp += 16)
-    {
-       uint32x2x4_t vtmp;
-       uint8x8x4_t *vrpt, *vppt;
-       uint8x8x4_t vrp, vpp;
-       uint32x2x4_t *temp_pointer;
-+      uint32x2x4_t vdest_val;
- 
-       vtmp = vld4_u32(png_ptr(uint32_t,rp));
-       vrpt = png_ptr(uint8x8x4_t,&vtmp);
-       vrp = *vrpt;
-       vtmp = vld4_u32(png_ptrc(uint32_t,pp));
-       vppt = png_ptr(uint8x8x4_t,&vtmp);
-       vpp = *vppt;
- 
-@@ -235,17 +247,18 @@ png_read_filter_row_avg4_neon(png_row_in
-       vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]);
-       vdest.val[1] = vhadd_u8(vdest.val[0], vpp.val[1]);
-       vdest.val[1] = vadd_u8(vdest.val[1], vrp.val[1]);
-       vdest.val[2] = vhadd_u8(vdest.val[1], vpp.val[2]);
-       vdest.val[2] = vadd_u8(vdest.val[2], vrp.val[2]);
-       vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]);
-       vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
- 
--      vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
-+      vdest_val = png_ldr(uint32x2x4_t, &vdest);
-+      vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
-    }
- }
- 
- static uint8x8_t
- paeth(uint8x8_t a, uint8x8_t b, uint8x8_t c)
- {
-    uint8x8_t d, e;
-    uint16x8_t p1, pa, pb, pc;
-@@ -354,16 +367,17 @@ png_read_filter_row_paeth4_neon(png_row_
-    png_debug(1, "in png_read_filter_row_paeth4_neon");
- 
-    for (; rp < rp_stop; rp += 16, pp += 16)
-    {
-       uint32x2x4_t vtmp;
-       uint8x8x4_t *vrpt, *vppt;
-       uint8x8x4_t vrp, vpp;
-       uint32x2x4_t *temp_pointer;
-+      uint32x2x4_t vdest_val;
- 
-       vtmp = vld4_u32(png_ptr(uint32_t,rp));
-       vrpt = png_ptr(uint8x8x4_t,&vtmp);
-       vrp = *vrpt;
-       vtmp = vld4_u32(png_ptrc(uint32_t,pp));
-       vppt = png_ptr(uint8x8x4_t,&vtmp);
-       vpp = *vppt;
- 
-@@ -373,15 +387,16 @@ png_read_filter_row_paeth4_neon(png_row_
-       vdest.val[1] = vadd_u8(vdest.val[1], vrp.val[1]);
-       vdest.val[2] = paeth(vdest.val[1], vpp.val[2], vpp.val[1]);
-       vdest.val[2] = vadd_u8(vdest.val[2], vrp.val[2]);
-       vdest.val[3] = paeth(vdest.val[2], vpp.val[3], vpp.val[2]);
-       vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
- 
-       vlast = vpp.val[3];
- 
--      vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
-+      vdest_val = png_ldr(uint32x2x4_t, &vdest);
-+      vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
-    }
- }
- 
- #endif /* PNG_ARM_NEON_OPT > 0 */
- #endif /* PNG_ARM_NEON_IMPLEMENTATION == 1 (intrinsics) */
- #endif /* READ */
-diff --git a/media/libpng/arm/palette_neon_intrinsics.c b/media/libpng/arm/palette_neon_intrinsics.c
-new file mode 100644
---- /dev/null
-+++ b/media/libpng/arm/palette_neon_intrinsics.c
-@@ -0,0 +1,149 @@
-+
-+/* palette_neon_intrinsics.c - NEON optimised palette expansion functions
-+ *
-+ * Copyright (c) 2018-2019 Cosmin Truta
-+ * Copyright (c) 2017-2018 Arm Holdings. All rights reserved.
-+ * Written by Richard Townsend <Richard.Townsend@arm.com>, February 2017.
-+ *
-+ * This code is released under the libpng license.
-+ * For conditions of distribution and use, see the disclaimer
-+ * and license in png.h
-+ */
-+
-+#include "../pngpriv.h"
-+
-+#if PNG_ARM_NEON_IMPLEMENTATION == 1
-+
-+#if defined(_MSC_VER) && defined(_M_ARM64) && !defined(__clang__)
-+#  include <arm64_neon.h>
-+#else
-+#  include <arm_neon.h>
-+#endif
-+
-+/* Build an RGBA8 palette from the separate RGB and alpha palettes. */
-+void
-+png_riffle_palette_neon(png_structrp png_ptr)
-+{
-+   png_const_colorp palette = png_ptr->palette;
-+   png_bytep riffled_palette = png_ptr->riffled_palette;
-+   png_const_bytep trans_alpha = png_ptr->trans_alpha;
-+   int num_trans = png_ptr->num_trans;
-+   int i;
-+
-+   png_debug(1, "in png_riffle_palette_neon");
-+
-+   /* Initially black, opaque. */
-+   uint8x16x4_t w = {{
-+      vdupq_n_u8(0x00),
-+      vdupq_n_u8(0x00),
-+      vdupq_n_u8(0x00),
-+      vdupq_n_u8(0xff),
-+   }};
-+
-+   /* First, riffle the RGB colours into an RGBA8 palette.
-+    * The alpha component is set to opaque for now.
-+    */
-+   for (i = 0; i < 256; i += 16)
-+   {
-+      uint8x16x3_t v = vld3q_u8((png_const_bytep)(palette + i));
-+      w.val[0] = v.val[0];
-+      w.val[1] = v.val[1];
-+      w.val[2] = v.val[2];
-+      vst4q_u8(riffled_palette + (i << 2), w);
-+   }
-+
-+   /* Fix up the missing transparency values. */
-+   for (i = 0; i < num_trans; i++)
-+      riffled_palette[(i << 2) + 3] = trans_alpha[i];
-+}
-+
-+/* Expands a palettized row into RGBA8. */
-+int
-+png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
-+    png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
-+{
-+   png_uint_32 row_width = row_info->width;
-+   const png_uint_32 *riffled_palette =
-+      (const png_uint_32 *)png_ptr->riffled_palette;
-+   const png_int_32 pixels_per_chunk = 4;
-+   int i;
-+
-+   png_debug(1, "in png_do_expand_palette_rgba8_neon");
-+
-+   if (row_width < pixels_per_chunk)
-+      return 0;
-+
-+   /* This function originally gets the last byte of the output row.
-+    * The NEON part writes forward from a given position, so we have
-+    * to seek this back by 4 pixels x 4 bytes.
-+    */
-+   *ddp = *ddp - ((pixels_per_chunk * sizeof(png_uint_32)) - 1);
-+
-+   for (i = 0; i < row_width; i += pixels_per_chunk)
-+   {
-+      uint32x4_t cur;
-+      png_bytep sp = *ssp - i, dp = *ddp - (i << 2);
-+      cur = vld1q_dup_u32 (riffled_palette + *(sp - 3));
-+      cur = vld1q_lane_u32(riffled_palette + *(sp - 2), cur, 1);
-+      cur = vld1q_lane_u32(riffled_palette + *(sp - 1), cur, 2);
-+      cur = vld1q_lane_u32(riffled_palette + *(sp - 0), cur, 3);
-+      vst1q_u32((void *)dp, cur);
-+   }
-+   if (i != row_width)
-+   {
-+      /* Remove the amount that wasn't processed. */
-+      i -= pixels_per_chunk;
-+   }
-+
-+   /* Decrement output pointers. */
-+   *ssp = *ssp - i;
-+   *ddp = *ddp - (i << 2);
-+   return i;
-+}
-+
-+/* Expands a palettized row into RGB8. */
-+int
-+png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
-+    png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
-+{
-+   png_uint_32 row_width = row_info->width;
-+   png_const_bytep palette = (png_const_bytep)png_ptr->palette;
-+   const png_uint_32 pixels_per_chunk = 8;
-+   int i;
-+
-+   png_debug(1, "in png_do_expand_palette_rgb8_neon");
-+
-+   if (row_width <= pixels_per_chunk)
-+      return 0;
-+
-+   /* Seeking this back by 8 pixels x 3 bytes. */
-+   *ddp = *ddp - ((pixels_per_chunk * sizeof(png_color)) - 1);
-+
-+   for (i = 0; i < row_width; i += pixels_per_chunk)
-+   {
-+      uint8x8x3_t cur;
-+      png_bytep sp = *ssp - i, dp = *ddp - ((i << 1) + i);
-+      cur = vld3_dup_u8(palette + sizeof(png_color) * (*(sp - 7)));
-+      cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 6)), cur, 1);
-+      cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 5)), cur, 2);
-+      cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 4)), cur, 3);
-+      cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 3)), cur, 4);
-+      cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 2)), cur, 5);
-+      cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 1)), cur, 6);
-+      cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 0)), cur, 7);
-+      vst3_u8((void *)dp, cur);
-+   }
-+
-+   if (i != row_width)
-+   {
-+      /* Remove the amount that wasn't processed. */
-+      i -= pixels_per_chunk;
-+   }
-+
-+   /* Decrement output pointers. */
-+   *ssp = *ssp - i;
-+   *ddp = *ddp - ((i << 1) + i);
-+   return i;
-+}
-+
-+#endif /* PNG_ARM_NEON_IMPLEMENTATION */
-diff --git a/media/libpng/intel/filter_sse2_intrinsics.c b/media/libpng/intel/filter_sse2_intrinsics.c
---- a/media/libpng/intel/filter_sse2_intrinsics.c
-+++ b/media/libpng/intel/filter_sse2_intrinsics.c
-@@ -1,17 +1,16 @@
- 
- /* filter_sse2_intrinsics.c - SSE2 optimized filter functions
-  *
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 2016-2017 Glenn Randers-Pehrson
-  * Written by Mike Klein and Matt Sarett
-  * Derived from arm/filter_neon_intrinsics.c
-  *
-- * Last changed in libpng 1.6.31 [July 27, 2017]
-- *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- #include "../pngpriv.h"
- 
- #ifdef PNG_READ_SUPPORTED
-@@ -24,49 +23,35 @@
-  * They're positioned like this:
-  *    prev:  c b
-  *    row:   a d
-  * The Sub filter predicts d=a, Avg d=(a+b)/2, and Paeth predicts d to be
-  * whichever of a, b, or c is closest to p=a+b-c.
-  */
- 
- static __m128i load4(const void* p) {
--   return _mm_cvtsi32_si128(*(const int*)p);
-+   int tmp;
-+   memcpy(&tmp, p, sizeof(tmp));
-+   return _mm_cvtsi32_si128(tmp);
- }
- 
- static void store4(void* p, __m128i v) {
--   *(int*)p = _mm_cvtsi128_si32(v);
-+   int tmp = _mm_cvtsi128_si32(v);
-+   memcpy(p, &tmp, sizeof(int));
- }
- 
- static __m128i load3(const void* p) {
--   /* We'll load 2 bytes, then 1 byte,
--    * then mask them together, and finally load into SSE.
--    */
--   const png_uint_16* p01 = (png_const_uint_16p)p;
--   const png_byte*    p2  = (const png_byte*)(p01+1);
--
--   png_uint_32 v012 = (png_uint_32)(*p01)
--                    | (png_uint_32)(*p2) << 16;
--   return load4(&v012);
-+   png_uint_32 tmp = 0;
-+   memcpy(&tmp, p, 3);
-+   return _mm_cvtsi32_si128(tmp);
- }
- 
- static void store3(void* p, __m128i v) {
--   /* We'll pull from SSE as a 32-bit int, then write
--    * its bottom two bytes, then its third byte.
--    */
--   png_uint_32 v012;
--   png_uint_16* p01;
--   png_byte*    p2;
--
--   store4(&v012, v);
--
--   p01 = (png_uint_16p)p;
--   p2  = (png_byte*)(p01+1);
--   *p01 = (png_uint_16)v012;
--   *p2  = (png_byte)(v012 >> 16);
-+   int tmp = _mm_cvtsi128_si32(v);
-+   memcpy(p, &tmp, 3);
- }
- 
- void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
-    png_const_bytep prev)
- {
-    /* The Sub filter predicts each pixel as the previous pixel, a.
-     * There is no pixel to the left of the first pixel.  It's encoded directly.
-     * That works with our main loop if we just say that left pixel was zero.
-diff --git a/media/libpng/intel/intel_init.c b/media/libpng/intel/intel_init.c
---- a/media/libpng/intel/intel_init.c
-+++ b/media/libpng/intel/intel_init.c
-@@ -1,17 +1,16 @@
- 
- /* intel_init.c - SSE2 optimized filter functions
-  *
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 2016-2017 Glenn Randers-Pehrson
-  * Written by Mike Klein and Matt Sarett, Google, Inc.
-  * Derived from arm/arm_init.c
-  *
-- * Last changed in libpng 1.6.29 [March 16, 2017]
-- *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- #include "../pngpriv.h"
- 
- #ifdef PNG_READ_SUPPORTED
-diff --git a/media/libpng/libpng-manual.txt b/media/libpng/libpng-manual.txt
---- a/media/libpng/libpng-manual.txt
-+++ b/media/libpng/libpng-manual.txt
-@@ -1,23 +1,26 @@
- libpng-manual.txt - A description on how to use and modify libpng
- 
-- libpng version 1.6.35 - July 15, 2018
-- Updated and distributed by Glenn Randers-Pehrson
-+ Copyright (c) 2018-2019 Cosmin Truta
-  Copyright (c) 1998-2018 Glenn Randers-Pehrson
- 
-  This document is released under the libpng license.
-  For conditions of distribution and use, see the disclaimer
-  and license in png.h
- 
-  Based on:
- 
-- libpng versions 0.97, January 1998, through 1.6.35 - July 15, 2018
-+ libpng version 1.6.36, December 2018, through 1.6.37 - April 2019
-+ Updated and distributed by Cosmin Truta
-+ Copyright (c) 2018-2019 Cosmin Truta
-+
-+ libpng versions 0.97, January 1998, through 1.6.35 - July 2018
-  Updated and distributed by Glenn Randers-Pehrson
-- Copyright (c) 1998-2017 Glenn Randers-Pehrson
-+ Copyright (c) 1998-2018 Glenn Randers-Pehrson
- 
-  libpng 1.0 beta 6 - version 0.96 - May 28, 1997
-  Updated and distributed by Andreas Dilger
-  Copyright (c) 1996, 1997 Andreas Dilger
- 
-  libpng 1.0 beta 2 - version 0.88 - January 26, 1996
-  For conditions of distribution and use, see copyright
-  notice in png.h. Copyright (c) 1995, 1996 Guy Eric
-@@ -39,17 +42,16 @@ libpng-manual.txt - A description on how
-  VIII. Changes to Libpng from version 0.88
-    IX. Changes to Libpng from version 1.0.x to 1.2.x
-     X. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x
-    XI. Changes to Libpng from version 1.4.x to 1.5.x
-   XII. Changes to Libpng from version 1.5.x to 1.6.x
-  XIII. Detecting libpng
-   XIV. Source code repository
-    XV. Coding style
--  XVI. Y2K Compliance in libpng
- 
- I. Introduction
- 
- This file describes how to use and modify the PNG reference library
- (known as libpng) for your own use.  In addition to this
- file, example.c is a good starting point for using the library, as
- it is heavily commented and should include everything most people
- will need.  We assume that libpng is already installed; see the
-@@ -60,27 +62,27 @@ and the files in the "contrib" directory
- the libpng distribution.
- 
- Libpng was written as a companion to the PNG specification, as a way
- of reducing the amount of time and effort it takes to support the PNG
- file format in application programs.
- 
- The PNG specification (second edition), November 2003, is available as
- a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at
--<https://www.w3.org/TR/2003/REC-PNG-20031110/
-+<https://www.w3.org/TR/2003/REC-PNG-20031110/>.
- The W3C and ISO documents have identical technical content.
- 
- The PNG-1.2 specification is available at
- <https://png-mng.sourceforge.io/pub/png/spec/1.2/>.
- It is technically equivalent
- to the PNG specification (second edition) but has some additional material.
- 
--The PNG-1.0 specification is available as RFC 2083
-+The PNG-1.0 specification is available as RFC 2083 at
- <https://png-mng.sourceforge.io/pub/png/spec/1.0/> and as a
--W3C Recommendation <https://www.w3.org/TR/REC-png-961001>.
-+W3C Recommendation at <https://www.w3.org/TR/REC-png-961001>.
- 
- Some additional chunks are described in the special-purpose public chunks
- documents at <http://www.libpng.org/pub/png/spec/register/>
- 
- Other information
- about PNG, and the latest version of libpng, can be found at the PNG home
- page, <http://www.libpng.org/pub/png/>.
- 
-@@ -4049,17 +4051,17 @@ Information about the whole row, or whol
-    you don't want to allocate a color-map in this case.
- 
- PNG_IMAGE_FLAG_*
- 
- Flags containing additional information about the image are held in
- the 'flags' field of png_image.
- 
-   PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB == 0x01
--    This indicates the the RGB values of the in-memory bitmap do not
-+    This indicates that the RGB values of the in-memory bitmap do not
-     correspond to the red, green and blue end-points defined by sRGB.
- 
-   PNG_IMAGE_FLAG_FAST == 0x02
-    On write emphasise speed over compression; the resultant PNG file will be
-    larger but will be produced significantly faster, particular for large
-    images.  Do not use this option for images which will be distributed, only
-    used it when producing intermediate files that will be read back in
-    repeatedly.  For a typical 24-bit image the option will double the read
-@@ -4515,17 +4517,17 @@ can still use PNG_DEBUG to control your 
-    #ifdef PNG_DEBUG
-        fprintf(stderr, ...
-    #endif
- 
- When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
- having level = 0 will be printed.  There aren't any such statements in
- this version of libpng, but if you insert some they will be printed.
- 
--VII.  MNG support
-+VII. MNG support
- 
- The MNG specification (available at http://www.libpng.org/pub/mng) allows
- certain extensions to PNG for PNG images that are embedded in MNG datastreams.
- Libpng can support some of these extensions.  To enable them, use the
- png_permit_mng_features() function:
- 
-    feature_set = png_permit_mng_features(png_ptr, mask)
- 
-@@ -4542,17 +4544,17 @@ png_permit_mng_features() function:
- It is an error to use this function when reading or writing a standalone
- PNG file with the PNG 8-byte signature.  The PNG datastream must be wrapped
- in a MNG datastream.  As a minimum, it must have the MNG 8-byte signature
- and the MHDR and MEND chunks.  Libpng does not provide support for these
- or any other MNG chunks; your application must provide its own support for
- them.  You may wish to consider using libmng (available at
- https://www.libmng.com/) instead.
- 
--VIII.  Changes to Libpng from version 0.88
-+VIII. Changes to Libpng from version 0.88
- 
- It should be noted that versions of libpng later than 0.96 are not
- distributed by the original libpng author, Guy Schalnat, nor by
- Andreas Dilger, who had taken over from Guy during 1996 and 1997, and
- distributed versions 0.89 through 0.96, but rather by another member
- of the original PNG Group, Glenn Randers-Pehrson.  Guy and Andreas are
- still alive and well, but they have moved on to other things.
- 
-@@ -4597,17 +4599,17 @@ version with leading zero, and release n
- Note that this function does not take a png_ptr, so you can call it
- before you've created one.
- 
- You can also check which version of png.h you used when compiling your
- application:
- 
-    png_uint_32 application_vn = PNG_LIBPNG_VER;
- 
--IX.  Changes to Libpng from version 1.0.x to 1.2.x
-+IX. Changes to Libpng from version 1.0.x to 1.2.x
- 
- Support for user memory management was enabled by default.  To
- accomplish this, the functions png_create_read_struct_2(),
- png_create_write_struct_2(), png_set_mem_fn(), png_get_mem_ptr(),
- png_malloc_default(), and png_free_default() were added.
- 
- Support for the iTXt chunk has been enabled by default as of
- version 1.2.41.
-@@ -4694,17 +4696,17 @@ was replaced with
- It has been deprecated since libpng-0.90.
- 
- The function
-     png_set_gray_1_2_4_to_8()
- which also expands tRNS to alpha was replaced with
-     png_set_expand_gray_1_2_4_to_8()
- which does not. It has been deprecated since libpng-1.0.18 and 1.2.9.
- 
--X.  Changes to Libpng from version 1.0.x/1.2.x to 1.4.x
-+X. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x
- 
- Private libpng prototypes and macro definitions were moved from
- png.h and pngconf.h into a new pngpriv.h header file.
- 
- Functions png_set_benign_errors(), png_benign_error(), and
- png_chunk_benign_error() were added.
- 
- Support for setting the maximum amount of memory that the application
-@@ -4804,17 +4806,17 @@ PNG_READ_DITHER_SUPPORTED defined.  In l
- was re-enabled, but the function was renamed png_set_quantize() to
- reflect more accurately what it actually does.  At the same time,
- the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to
- PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS, and PNG_READ_DITHER_SUPPORTED
- was renamed to PNG_READ_QUANTIZE_SUPPORTED.
- 
- We removed the trailing '.' from the warning and error messages.
- 
--XI.  Changes to Libpng from version 1.4.x to 1.5.x
-+XI. Changes to Libpng from version 1.4.x to 1.5.x
- 
- From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
- function) incorrectly returned a value of type png_uint_32.
- The incorrect macro was removed from libpng-1.4.5.
- 
- Checking for invalid palette index on write was added at libpng
- 1.5.10.  If a pixel contains an invalid (out-of-range) index libpng issues
- a benign error.  This is enabled by default because this condition is an
-@@ -4867,17 +4869,17 @@ macros into a private header file (pngpr
- applications.
- 
- In png_get_iCCP, the type of "profile" was changed from png_charpp
- to png_bytepp, and in png_set_iCCP, from png_charp to png_const_bytep.
- 
- There are changes of form in png.h, including new and changed macros to
- declare parts of the API.  Some API functions with arguments that are
- pointers to data not modified within the function have been corrected to
--declare these arguments with PNG_CONST.
-+declare these arguments with const.
- 
- Much of the internal use of C macros to control the library build has also
- changed and some of this is visible in the exported header files, in
- particular the use of macros to control data and API elements visible
- during application compilation may require significant revision to
- application code.  (It is extremely rare for an application to do this.)
- 
- Any program that compiled against libpng 1.4 and did not use deprecated
-@@ -5062,17 +5064,17 @@ emulation.
- 
- 4) Added PNG_{READ,WRITE}_INT_FUNCTIONS_SUPPORTED.  This allows the
- functions to read and write ints to be disabled independently of
- PNG_USE_READ_MACROS, which allows libpng to be built with the functions
- even though the default is to use the macros - this allows applications
- to choose at app buildtime whether or not to use macros (previously
- impossible because the functions weren't in the default build.)
- 
--XII.  Changes to Libpng from version 1.5.x to 1.6.x
-+XII. Changes to Libpng from version 1.5.x to 1.6.x
- 
- A "simplified API" has been added (see documentation in png.h and a simple
- example in contrib/examples/pngtopng.c).  The new publicly visible API
- includes the following:
- 
-    macros:
-      PNG_FORMAT_*
-      PNG_IMAGE_*
-@@ -5225,17 +5227,17 @@ is an error. Previously this requirement
- enforced, and the palette was always limited to 256 entries. An over-length
- PLTE chunk found in an input PNG is silently truncated.
- 
- Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not
- attempt to decode the Exif profile; it simply returns a byte array
- containing the profile to the calling application which must do its own
- decoding.
- 
--XIII.  Detecting libpng
-+XIII. Detecting libpng
- 
- The png_get_io_ptr() function has been present since libpng-0.88, has never
- changed, and is unaffected by conditional compilation macros.  It is the
- best choice for use in configure scripts for detecting the presence of any
- libpng version since 0.88.  In an autoconf "configure.in" you could use
- 
-     AC_CHECK_LIB(png, png_get_io_ptr, ...
- 
-@@ -5250,17 +5252,17 @@ at
-     https://git.code.sf.net/p/libpng/code.git
- 
- or you can browse it with a web browser at
- 
-     https://github.com/glennrp/libpng or
-     https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
- 
- Patches can be sent to png-mng-implement at lists.sourceforge.net or
--you can upload them to the libpng bug tracker at
-+uploaded to the libpng bug tracker at
- 
-     https://libpng.sourceforge.io/
- 
- or as a "pull request" to
- 
-     https://github.com/glennrp/libpng/pulls
- 
- We also accept patches built from the tar or zip distributions, and
-@@ -5400,63 +5402,8 @@ We prefer "if (something != 0)" and "if 
- "if (something)" and if "(!something)", respectively, and for pointers
- we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
- 
- We do not use the TAB character for indentation in the C sources.
- 
- Lines do not exceed 80 characters.
- 
- Other rules can be inferred by inspecting the libpng source.
--
--XVI. Y2K Compliance in libpng
--
--Since the PNG Development group is an ad-hoc body, we can't make
--an official declaration.
--
--This is your unofficial assurance that libpng from version 0.71 and
--upward through 1.6.35 are Y2K compliant.  It is my belief that earlier
--versions were also Y2K compliant.
--
--Libpng only has two year fields.  One is a 2-byte unsigned integer
--that will hold years up to 65535.  The other, which is deprecated,
--holds the date in text format, and will hold years up to 9999.
--
--The integer is
--    "png_uint_16 year" in png_time_struct.
--
--The string is
--    "char time_buffer[29]" in png_struct.  This is no longer used
--in libpng-1.6.x and will be removed from libpng-1.7.0.
--
--There are seven time-related functions:
--
--    png_convert_to_rfc_1123_buffer() in png.c
--      (formerly png_convert_to_rfc_1152() in error, and
--      also formerly png_convert_to_rfc_1123())
--    png_convert_from_struct_tm() in pngwrite.c, called
--      in pngwrite.c
--    png_convert_from_time_t() in pngwrite.c
--    png_get_tIME() in pngget.c
--    png_handle_tIME() in pngrutil.c, called in pngread.c
--    png_set_tIME() in pngset.c
--    png_write_tIME() in pngwutil.c, called in pngwrite.c
--
--All appear to handle dates properly in a Y2K environment.  The
--png_convert_from_time_t() function calls gmtime() to convert from system
--clock time, which returns (year - 1900), which we properly convert to
--the full 4-digit year.  There is a possibility that applications using
--libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
--function, or that they are incorrectly passing only a 2-digit year
--instead of "year - 1900" into the png_convert_from_struct_tm() function,
--but this is not under our control.  The libpng documentation has always
--stated that it works with 4-digit years, and the APIs have been
--documented as such.
--
--The tIME chunk itself is also Y2K compliant.  It uses a 2-byte unsigned
--integer to hold the year, and can hold years as large as 65535.
--
--zlib, upon which libpng depends, is also Y2K compliant.  It contains
--no date-related code.
--
--
--   Glenn Randers-Pehrson
--   libpng maintainer
--   PNG Development Group
-diff --git a/media/libpng/mips/filter_msa_intrinsics.c b/media/libpng/mips/filter_msa_intrinsics.c
-new file mode 100644
---- /dev/null
-+++ b/media/libpng/mips/filter_msa_intrinsics.c
-@@ -0,0 +1,808 @@
-+
-+/* filter_msa_intrinsics.c - MSA optimised filter functions
-+ *
-+ * Copyright (c) 2018 Cosmin Truta
-+ * Copyright (c) 2016 Glenn Randers-Pehrson
-+ * Written by Mandar Sahastrabuddhe, August 2016.
-+ *
-+ * This code is released under the libpng license.
-+ * For conditions of distribution and use, see the disclaimer
-+ * and license in png.h
-+ */
-+
-+#include <stdio.h>
-+#include <stdint.h>
-+#include "../pngpriv.h"
-+
-+#ifdef PNG_READ_SUPPORTED
-+
-+/* This code requires -mfpu=msa on the command line: */
-+#if PNG_MIPS_MSA_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
-+
-+#include <msa.h>
-+
-+/* libpng row pointers are not necessarily aligned to any particular boundary,
-+ * however this code will only work with appropriate alignment. mips/mips_init.c
-+ * checks for this (and will not compile unless it is done). This code uses
-+ * variants of png_aligncast to avoid compiler warnings.
-+ */
-+#define png_ptr(type,pointer) png_aligncast(type *,pointer)
-+#define png_ptrc(type,pointer) png_aligncastconst(const type *,pointer)
-+
-+/* The following relies on a variable 'temp_pointer' being declared with type
-+ * 'type'.  This is written this way just to hide the GCC strict aliasing
-+ * warning; note that the code is safe because there never is an alias between
-+ * the input and output pointers.
-+ */
-+#define png_ldr(type,pointer)\
-+   (temp_pointer = png_ptr(type,pointer), *temp_pointer)
-+
-+#if PNG_MIPS_MSA_OPT > 0
-+
-+#ifdef CLANG_BUILD
-+   #define MSA_SRLI_B(a, b)   __msa_srli_b((v16i8) a, b)
-+
-+   #define LW(psrc)                              \
-+   ( {                                           \
-+       uint8_t *psrc_lw_m = (uint8_t *) (psrc);  \
-+       uint32_t val_m;                           \
-+                                                 \
-+       asm volatile (                            \
-+           "lw  %[val_m],  %[psrc_lw_m]  \n\t"   \
-+                                                 \
-+           : [val_m] "=r" (val_m)                \
-+           : [psrc_lw_m] "m" (*psrc_lw_m)        \
-+       );                                        \
-+                                                 \
-+       val_m;                                    \
-+   } )
-+
-+   #define SH(val, pdst)                         \
-+   {                                             \
-+       uint8_t *pdst_sh_m = (uint8_t *) (pdst);  \
-+       uint16_t val_m = (val);                   \
-+                                                 \
-+       asm volatile (                            \
-+           "sh  %[val_m],  %[pdst_sh_m]  \n\t"   \
-+                                                 \
-+           : [pdst_sh_m] "=m" (*pdst_sh_m)       \
-+           : [val_m] "r" (val_m)                 \
-+       );                                        \
-+   }
-+
-+   #define SW(val, pdst)                         \
-+   {                                             \
-+       uint8_t *pdst_sw_m = (uint8_t *) (pdst);  \
-+       uint32_t val_m = (val);                   \
-+                                                 \
-+       asm volatile (                            \
-+           "sw  %[val_m],  %[pdst_sw_m]  \n\t"   \
-+                                                 \
-+           : [pdst_sw_m] "=m" (*pdst_sw_m)       \
-+           : [val_m] "r" (val_m)                 \
-+       );                                        \
-+   }
-+
-+       #if (__mips == 64)
-+        #define SD(val, pdst)                         \
-+        {                                             \
-+            uint8_t *pdst_sd_m = (uint8_t *) (pdst);  \
-+            uint64_t val_m = (val);                   \
-+                                                      \
-+            asm volatile (                            \
-+                "sd  %[val_m],  %[pdst_sd_m]  \n\t"   \
-+                                                      \
-+                : [pdst_sd_m] "=m" (*pdst_sd_m)       \
-+                : [val_m] "r" (val_m)                 \
-+            );                                        \
-+        }
-+    #else
-+        #define SD(val, pdst)                                          \
-+        {                                                              \
-+            uint8_t *pdst_sd_m = (uint8_t *) (pdst);                   \
-+            uint32_t val0_m, val1_m;                                   \
-+                                                                       \
-+            val0_m = (uint32_t) ((val) & 0x00000000FFFFFFFF);          \
-+            val1_m = (uint32_t) (((val) >> 32) & 0x00000000FFFFFFFF);  \
-+                                                                       \
-+            SW(val0_m, pdst_sd_m);                                     \
-+            SW(val1_m, pdst_sd_m + 4);                                 \
-+        }
-+    #endif
-+#else
-+   #define MSA_SRLI_B(a, b)   (a >> b)
-+
-+#if (__mips_isa_rev >= 6)
-+   #define LW(psrc)                              \
-+   ( {                                           \
-+       uint8_t *psrc_lw_m = (uint8_t *) (psrc);  \
-+       uint32_t val_m;                           \
-+                                                 \
-+       asm volatile (                            \
-+           "lw  %[val_m],  %[psrc_lw_m]  \n\t"   \
-+                                                 \
-+           : [val_m] "=r" (val_m)                \
-+           : [psrc_lw_m] "m" (*psrc_lw_m)        \
-+       );                                        \
-+                                                 \
-+       val_m;                                    \
-+   } )
-+
-+   #define SH(val, pdst)                         \
-+   {                                             \
-+       uint8_t *pdst_sh_m = (uint8_t *) (pdst);  \
-+       uint16_t val_m = (val);                   \
-+                                                 \
-+       asm volatile (                            \
-+           "sh  %[val_m],  %[pdst_sh_m]  \n\t"   \
-+                                                 \
-+           : [pdst_sh_m] "=m" (*pdst_sh_m)       \
-+           : [val_m] "r" (val_m)                 \
-+       );                                        \
-+   }
-+
-+   #define SW(val, pdst)                         \
-+   {                                             \
-+       uint8_t *pdst_sw_m = (uint8_t *) (pdst);  \
-+       uint32_t val_m = (val);                   \
-+                                                 \
-+       asm volatile (                            \
-+           "sw  %[val_m],  %[pdst_sw_m]  \n\t"   \
-+                                                 \
-+           : [pdst_sw_m] "=m" (*pdst_sw_m)       \
-+           : [val_m] "r" (val_m)                 \
-+       );                                        \
-+   }
-+
-+   #if (__mips == 64)
-+        #define SD(val, pdst)                         \
-+        {                                             \
-+            uint8_t *pdst_sd_m = (uint8_t *) (pdst);  \
-+            uint64_t val_m = (val);                   \
-+                                                      \
-+            asm volatile (                            \
-+                "sd  %[val_m],  %[pdst_sd_m]  \n\t"   \
-+                                                      \
-+                : [pdst_sd_m] "=m" (*pdst_sd_m)       \
-+                : [val_m] "r" (val_m)                 \
-+            );                                        \
-+        }
-+    #else
-+        #define SD(val, pdst)                                          \
-+        {                                                              \
-+            uint8_t *pdst_sd_m = (uint8_t *) (pdst);                   \
-+            uint32_t val0_m, val1_m;                                   \
-+                                                                       \
-+            val0_m = (uint32_t) ((val) & 0x00000000FFFFFFFF);          \
-+            val1_m = (uint32_t) (((val) >> 32) & 0x00000000FFFFFFFF);  \
-+                                                                       \
-+            SW(val0_m, pdst_sd_m);                                     \
-+            SW(val1_m, pdst_sd_m + 4);                                 \
-+        }
-+    #endif
-+#else  // !(__mips_isa_rev >= 6)
-+   #define LW(psrc)                              \
-+   ( {                                           \
-+       uint8_t *psrc_lw_m = (uint8_t *) (psrc);  \
-+       uint32_t val_m;                           \
-+                                                 \
-+       asm volatile (                            \
-+           "ulw  %[val_m],  %[psrc_lw_m]  \n\t"  \
-+                                                 \
-+           : [val_m] "=r" (val_m)                \
-+           : [psrc_lw_m] "m" (*psrc_lw_m)        \
-+       );                                        \
-+                                                 \
-+       val_m;                                    \
-+   } )
-+
-+   #define SH(val, pdst)                         \
-+   {                                             \
-+       uint8_t *pdst_sh_m = (uint8_t *) (pdst);  \
-+       uint16_t val_m = (val);                   \
-+                                                 \
-+       asm volatile (                            \
-+           "ush  %[val_m],  %[pdst_sh_m]  \n\t"  \
-+                                                 \
-+           : [pdst_sh_m] "=m" (*pdst_sh_m)       \
-+           : [val_m] "r" (val_m)                 \
-+       );                                        \
-+   }
-+
-+   #define SW(val, pdst)                         \
-+   {                                             \
-+       uint8_t *pdst_sw_m = (uint8_t *) (pdst);  \
-+       uint32_t val_m = (val);                   \
-+                                                 \
-+       asm volatile (                            \
-+           "usw  %[val_m],  %[pdst_sw_m]  \n\t"  \
-+                                                 \
-+           : [pdst_sw_m] "=m" (*pdst_sw_m)       \
-+           : [val_m] "r" (val_m)                 \
-+       );                                        \
-+   }
-+
-+   #define SD(val, pdst)                                          \
-+    {                                                              \
-+        uint8_t *pdst_sd_m = (uint8_t *) (pdst);                   \
-+        uint32_t val0_m, val1_m;                                   \
-+                                                                   \
-+        val0_m = (uint32_t) ((val) & 0x00000000FFFFFFFF);          \
-+        val1_m = (uint32_t) (((val) >> 32) & 0x00000000FFFFFFFF);  \
-+                                                                   \
-+        SW(val0_m, pdst_sd_m);                                     \
-+        SW(val1_m, pdst_sd_m + 4);                                 \
-+    }
-+
-+    #define SW_ZERO(pdst)                      \
-+    {                                          \
-+        uint8_t *pdst_m = (uint8_t *) (pdst);  \
-+                                               \
-+        asm volatile (                         \
-+            "usw  $0,  %[pdst_m]  \n\t"        \
-+                                               \
-+            : [pdst_m] "=m" (*pdst_m)          \
-+            :                                  \
-+        );                                     \
-+    }
-+#endif  // (__mips_isa_rev >= 6)
-+#endif
-+
-+#define LD_B(RTYPE, psrc) *((RTYPE *) (psrc))
-+#define LD_UB(...) LD_B(v16u8, __VA_ARGS__)
-+#define LD_B2(RTYPE, psrc, stride, out0, out1)  \
-+{                                               \
-+    out0 = LD_B(RTYPE, (psrc));                 \
-+    out1 = LD_B(RTYPE, (psrc) + stride);        \
-+}
-+#define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__)
-+#define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3)   \
-+{                                                            \
-+    LD_B2(RTYPE, (psrc), stride, out0, out1);                \
-+    LD_B2(RTYPE, (psrc) + 2 * stride , stride, out2, out3);  \
-+}
-+#define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__)
-+
-+#define ST_B(RTYPE, in, pdst) *((RTYPE *) (pdst)) = (in)
-+#define ST_UB(...) ST_B(v16u8, __VA_ARGS__)
-+#define ST_B2(RTYPE, in0, in1, pdst, stride)  \
-+{                                             \
-+    ST_B(RTYPE, in0, (pdst));                 \
-+    ST_B(RTYPE, in1, (pdst) + stride);        \
-+}
-+#define ST_UB2(...) ST_B2(v16u8, __VA_ARGS__)
-+#define ST_B4(RTYPE, in0, in1, in2, in3, pdst, stride)    \
-+{                                                         \
-+    ST_B2(RTYPE, in0, in1, (pdst), stride);               \
-+    ST_B2(RTYPE, in2, in3, (pdst) + 2 * stride, stride);  \
-+}
-+#define ST_UB4(...) ST_B4(v16u8, __VA_ARGS__)
-+
-+#define ADD2(in0, in1, in2, in3, out0, out1)  \
-+{                                             \
-+    out0 = in0 + in1;                         \
-+    out1 = in2 + in3;                         \
-+}
-+#define ADD3(in0, in1, in2, in3, in4, in5,  \
-+             out0, out1, out2)              \
-+{                                           \
-+    ADD2(in0, in1, in2, in3, out0, out1);   \
-+    out2 = in4 + in5;                       \
-+}
-+#define ADD4(in0, in1, in2, in3, in4, in5, in6, in7,  \
-+             out0, out1, out2, out3)                  \
-+{                                                     \
-+    ADD2(in0, in1, in2, in3, out0, out1);             \
-+    ADD2(in4, in5, in6, in7, out2, out3);             \
-+}
-+
-+#define ILVR_B2(RTYPE, in0, in1, in2, in3, out0, out1)      \
-+{                                                           \
-+    out0 = (RTYPE) __msa_ilvr_b((v16i8) in0, (v16i8) in1);  \
-+    out1 = (RTYPE) __msa_ilvr_b((v16i8) in2, (v16i8) in3);  \
-+}
-+#define ILVR_B2_SH(...) ILVR_B2(v8i16, __VA_ARGS__)
-+
-+#define HSUB_UB2(RTYPE, in0, in1, out0, out1)                 \
-+{                                                             \
-+    out0 = (RTYPE) __msa_hsub_u_h((v16u8) in0, (v16u8) in0);  \
-+    out1 = (RTYPE) __msa_hsub_u_h((v16u8) in1, (v16u8) in1);  \
-+}
-+#define HSUB_UB2_SH(...) HSUB_UB2(v8i16, __VA_ARGS__)
-+
-+#define SLDI_B2_0(RTYPE, in0, in1, out0, out1, slide_val)                 \
-+{                                                                         \
-+    v16i8 zero_m = { 0 };                                                 \
-+    out0 = (RTYPE) __msa_sldi_b((v16i8) zero_m, (v16i8) in0, slide_val);  \
-+    out1 = (RTYPE) __msa_sldi_b((v16i8) zero_m, (v16i8) in1, slide_val);  \
-+}
-+#define SLDI_B2_0_UB(...) SLDI_B2_0(v16u8, __VA_ARGS__)
-+
-+#define SLDI_B3_0(RTYPE, in0, in1, in2, out0, out1, out2,  slide_val)     \
-+{                                                                         \
-+    v16i8 zero_m = { 0 };                                                 \
-+    SLDI_B2_0(RTYPE, in0, in1, out0, out1, slide_val);                    \
-+    out2 = (RTYPE) __msa_sldi_b((v16i8) zero_m, (v16i8) in2, slide_val);  \
-+}
-+#define SLDI_B3_0_UB(...) SLDI_B3_0(v16u8, __VA_ARGS__)
-+
-+#define ILVEV_W2(RTYPE, in0, in1, in2, in3, out0, out1)      \
-+{                                                            \
-+    out0 = (RTYPE) __msa_ilvev_w((v4i32) in1, (v4i32) in0);  \
-+    out1 = (RTYPE) __msa_ilvev_w((v4i32) in3, (v4i32) in2);  \
-+}
-+#define ILVEV_W2_UB(...) ILVEV_W2(v16u8, __VA_ARGS__)
-+
-+#define ADD_ABS_H3(RTYPE, in0, in1, in2, out0, out1, out2)  \
-+{                                                           \
-+    RTYPE zero = {0};                                       \
-+                                                            \
-+    out0 = __msa_add_a_h((v8i16) zero, in0);                \
-+    out1 = __msa_add_a_h((v8i16) zero, in1);                \
-+    out2 = __msa_add_a_h((v8i16) zero, in2);                \
-+}
-+#define ADD_ABS_H3_SH(...) ADD_ABS_H3(v8i16, __VA_ARGS__)
-+
-+#define VSHF_B2(RTYPE, in0, in1, in2, in3, mask0, mask1, out0, out1)       \
-+{                                                                          \
-+    out0 = (RTYPE) __msa_vshf_b((v16i8) mask0, (v16i8) in1, (v16i8) in0);  \
-+    out1 = (RTYPE) __msa_vshf_b((v16i8) mask1, (v16i8) in3, (v16i8) in2);  \
-+}
-+#define VSHF_B2_UB(...) VSHF_B2(v16u8, __VA_ARGS__)
-+
-+#define CMP_AND_SELECT(inp0, inp1, inp2, inp3, inp4, inp5, out0)              \
-+{                                                                             \
-+   v8i16 _sel_h0, _sel_h1;                                                    \
-+   v16u8 _sel_b0, _sel_b1;                                                    \
-+   _sel_h0 = (v8i16) __msa_clt_u_h((v8u16) inp1, (v8u16) inp0);               \
-+   _sel_b0 = (v16u8) __msa_pckev_b((v16i8) _sel_h0, (v16i8) _sel_h0);         \
-+   inp0 = (v8i16) __msa_bmnz_v((v16u8) inp0, (v16u8) inp1, (v16u8) _sel_h0);  \
-+   inp4 = (v16u8) __msa_bmnz_v(inp3, inp4, _sel_b0);                          \
-+   _sel_h1 = (v8i16) __msa_clt_u_h((v8u16) inp2, (v8u16) inp0);               \
-+   _sel_b1 = (v16u8) __msa_pckev_b((v16i8) _sel_h1, (v16i8) _sel_h1);         \
-+   inp4 = (v16u8) __msa_bmnz_v(inp4, inp5, _sel_b1);                          \
-+   out0 += inp4;                                                              \
-+}
-+
-+void png_read_filter_row_up_msa(png_row_infop row_info, png_bytep row,
-+                                png_const_bytep prev_row)
-+{
-+   size_t i, cnt, cnt16, cnt32;
-+   size_t istop = row_info->rowbytes;
-+   png_bytep rp = row;
-+   png_const_bytep pp = prev_row;
-+   v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
-+
-+   for (i = 0; i < (istop >> 6); i++)
-+   {
-+      LD_UB4(rp, 16, src0, src1, src2, src3);
-+      LD_UB4(pp, 16, src4, src5, src6, src7);
-+      pp += 64;
-+
-+	  ADD4(src0, src4, src1, src5, src2, src6, src3, src7,
-+	       src0, src1, src2, src3);
-+
-+      ST_UB4(src0, src1, src2, src3, rp, 16);
-+      rp += 64;
-+   }
-+
-+   if (istop & 0x3F)
-+   {
-+      cnt32 = istop & 0x20;
-+      cnt16 = istop & 0x10;
-+      cnt = istop & 0xF;
-+
-+      if(cnt32)
-+      {
-+         if (cnt16 && cnt)
-+         {
-+            LD_UB4(rp, 16, src0, src1, src2, src3);
-+            LD_UB4(pp, 16, src4, src5, src6, src7);
-+
-+            ADD4(src0, src4, src1, src5, src2, src6, src3, src7,
-+	             src0, src1, src2, src3);
-+
-+            ST_UB4(src0, src1, src2, src3, rp, 16);
-+            rp += 64;
-+         }
-+         else if (cnt16 || cnt)
-+         {
-+            LD_UB2(rp, 16, src0, src1);
-+            LD_UB2(pp, 16, src4, src5);
-+            pp += 32;
-+            src2 = LD_UB(rp + 32);
-+            src6 = LD_UB(pp);
-+
-+            ADD3(src0, src4, src1, src5, src2, src6, src0, src1, src2);
-+
-+            ST_UB2(src0, src1, rp, 16);
-+            rp += 32;
-+            ST_UB(src2, rp);
-+            rp += 16;
-+         }
-+         else
-+         {
-+            LD_UB2(rp, 16, src0, src1);
-+            LD_UB2(pp, 16, src4, src5);
-+
-+			ADD2(src0, src4, src1, src5, src0, src1);
-+
-+            ST_UB2(src0, src1, rp, 16);
-+            rp += 32;
-+         }
-+      }
-+      else if (cnt16 && cnt)
-+      {
-+         LD_UB2(rp, 16, src0, src1);
-+         LD_UB2(pp, 16, src4, src5);
-+
-+         ADD2(src0, src4, src1, src5, src0, src1);
-+
-+         ST_UB2(src0, src1, rp, 16);
-+         rp += 32;
-+      }
-+      else if (cnt16 || cnt)
-+      {
-+         src0 = LD_UB(rp);
-+         src4 = LD_UB(pp);
-+         pp += 16;
-+
-+         src0 += src4;
-+
-+         ST_UB(src0, rp);
-+         rp += 16;
-+      }
-+   }
-+}
-+
-+void png_read_filter_row_sub4_msa(png_row_infop row_info, png_bytep row,
-+                                  png_const_bytep prev_row)
-+{
-+   size_t count;
-+   size_t istop = row_info->rowbytes;
-+   png_bytep src = row;
-+   png_bytep nxt = row + 4;
-+   int32_t inp0;
-+   v16u8 src0, src1, src2, src3, src4;
-+   v16u8 dst0, dst1;
-+   v16u8 zero = { 0 };
-+
-+   istop -= 4;
-+
-+   inp0 = LW(src);
-+   src += 4;
-+   src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
-+
-+   for (count = 0; count < istop; count += 16)
-+   {
-+      src1 = LD_UB(src);
-+      src += 16;
-+
-+      src2 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 4);
-+      src3 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 8);
-+      src4 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 12);
-+      src1 += src0;
-+      src2 += src1;
-+      src3 += src2;
-+      src4 += src3;
-+      src0 = src4;
-+      ILVEV_W2_UB(src1, src2, src3, src4, dst0, dst1);
-+      dst0 = (v16u8) __msa_pckev_d((v2i64) dst1, (v2i64) dst0);
-+
-+      ST_UB(dst0, nxt);
-+      nxt += 16;
-+   }
-+}
-+
-+void png_read_filter_row_sub3_msa(png_row_infop row_info, png_bytep row,
-+                                  png_const_bytep prev_row)
-+{
-+   size_t count;
-+   size_t istop = row_info->rowbytes;
-+   png_bytep src = row;
-+   png_bytep nxt = row + 3;
-+   int64_t out0;
-+   int32_t inp0, out1;
-+   v16u8 src0, src1, src2, src3, src4, dst0, dst1;
-+   v16u8 zero = { 0 };
-+   v16i8 mask0 = { 0, 1, 2, 16, 17, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-+   v16i8 mask1 = { 0, 1, 2, 3, 4, 5, 16, 17, 18, 19, 20, 21, 0, 0, 0, 0 };
-+
-+   istop -= 3;
-+
-+   inp0 = LW(src);
-+   src += 3;
-+   src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
-+
-+   for (count = 0; count < istop; count += 12)
-+   {
-+      src1 = LD_UB(src);
-+      src += 12;
-+
-+      src2 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 3);
-+      src3 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 6);
-+      src4 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 9);
-+      src1 += src0;
-+      src2 += src1;
-+      src3 += src2;
-+      src4 += src3;
-+      src0 = src4;
-+      VSHF_B2_UB(src1, src2, src3, src4, mask0, mask0, dst0, dst1);
-+      dst0 = (v16u8) __msa_vshf_b(mask1, (v16i8) dst1, (v16i8) dst0);
-+      out0 = __msa_copy_s_d((v2i64) dst0, 0);
-+      out1 = __msa_copy_s_w((v4i32) dst0, 2);
-+
-+      SD(out0, nxt);
-+      nxt += 8;
-+      SW(out1, nxt);
-+      nxt += 4;
-+   }
-+}
-+
-+void png_read_filter_row_avg4_msa(png_row_infop row_info, png_bytep row,
-+                                  png_const_bytep prev_row)
-+{
-+   size_t i;
-+   png_bytep src = row;
-+   png_bytep nxt = row;
-+   png_const_bytep pp = prev_row;
-+   size_t istop = row_info->rowbytes - 4;
-+   int32_t inp0, inp1, out0;
-+   v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, dst0, dst1;
-+   v16u8 zero = { 0 };
-+
-+   inp0 = LW(pp);
-+   pp += 4;
-+   inp1 = LW(src);
-+   src += 4;
-+   src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
-+   src1 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp1);
-+   src0 = (v16u8) MSA_SRLI_B(src0, 1);
-+   src1 += src0;
-+   out0 = __msa_copy_s_w((v4i32) src1, 0);
-+   SW(out0, nxt);
-+   nxt += 4;
-+
-+   for (i = 0; i < istop; i += 16)
-+   {
-+      src2 = LD_UB(pp);
-+      pp += 16;
-+      src6 = LD_UB(src);
-+      src += 16;
-+
-+      SLDI_B2_0_UB(src2, src6, src3, src7, 4);
-+      SLDI_B2_0_UB(src2, src6, src4, src8, 8);
-+      SLDI_B2_0_UB(src2, src6, src5, src9, 12);
-+      src2 = __msa_ave_u_b(src2, src1);
-+      src6 += src2;
-+      src3 = __msa_ave_u_b(src3, src6);
-+      src7 += src3;
-+      src4 = __msa_ave_u_b(src4, src7);
-+      src8 += src4;
-+      src5 = __msa_ave_u_b(src5, src8);
-+      src9 += src5;
-+      src1 = src9;
-+      ILVEV_W2_UB(src6, src7, src8, src9, dst0, dst1);
-+      dst0 = (v16u8) __msa_pckev_d((v2i64) dst1, (v2i64) dst0);
-+
-+      ST_UB(dst0, nxt);
-+      nxt += 16;
-+   }
-+}
-+
-+void png_read_filter_row_avg3_msa(png_row_infop row_info, png_bytep row,
-+                                  png_const_bytep prev_row)
-+{
-+   size_t i;
-+   png_bytep src = row;
-+   png_bytep nxt = row;
-+   png_const_bytep pp = prev_row;
-+   size_t istop = row_info->rowbytes - 3;
-+   int64_t out0;
-+   int32_t inp0, inp1, out1;
-+   int16_t out2;
-+   v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, dst0, dst1;
-+   v16u8 zero = { 0 };
-+   v16i8 mask0 = { 0, 1, 2, 16, 17, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-+   v16i8 mask1 = { 0, 1, 2, 3, 4, 5, 16, 17, 18, 19, 20, 21, 0, 0, 0, 0 };
-+
-+   inp0 = LW(pp);
-+   pp += 3;
-+   inp1 = LW(src);
-+   src += 3;
-+   src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
-+   src1 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp1);
-+   src0 = (v16u8) MSA_SRLI_B(src0, 1);
-+   src1 += src0;
-+   out2 = __msa_copy_s_h((v8i16) src1, 0);
-+   SH(out2, nxt);
-+   nxt += 2;
-+   nxt[0] = src1[2];
-+   nxt++;
-+
-+   for (i = 0; i < istop; i += 12)
-+   {
-+      src2 = LD_UB(pp);
-+      pp += 12;
-+      src6 = LD_UB(src);
-+      src += 12;
-+
-+      SLDI_B2_0_UB(src2, src6, src3, src7, 3);
-+      SLDI_B2_0_UB(src2, src6, src4, src8, 6);
-+      SLDI_B2_0_UB(src2, src6, src5, src9, 9);
-+      src2 = __msa_ave_u_b(src2, src1);
-+      src6 += src2;
-+      src3 = __msa_ave_u_b(src3, src6);
-+      src7 += src3;
-+      src4 = __msa_ave_u_b(src4, src7);
-+      src8 += src4;
-+      src5 = __msa_ave_u_b(src5, src8);
-+      src9 += src5;
-+      src1 = src9;
-+      VSHF_B2_UB(src6, src7, src8, src9, mask0, mask0, dst0, dst1);
-+      dst0 = (v16u8) __msa_vshf_b(mask1, (v16i8) dst1, (v16i8) dst0);
-+      out0 = __msa_copy_s_d((v2i64) dst0, 0);
-+      out1 = __msa_copy_s_w((v4i32) dst0, 2);
-+
-+      SD(out0, nxt);
-+      nxt += 8;
-+      SW(out1, nxt);
-+      nxt += 4;
-+   }
-+}
-+
-+void png_read_filter_row_paeth4_msa(png_row_infop row_info,
-+                                    png_bytep row,
-+                                    png_const_bytep prev_row)
-+{
-+   int32_t count, rp_end;
-+   png_bytep nxt;
-+   png_const_bytep prev_nxt;
-+   int32_t inp0, inp1, res0;
-+   v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9;
-+   v16u8 src10, src11, src12, src13, dst0, dst1;
-+   v8i16 vec0, vec1, vec2;
-+   v16u8 zero = { 0 };
-+
-+   nxt = row;
-+   prev_nxt = prev_row;
-+
-+   inp0 = LW(nxt);
-+   inp1 = LW(prev_nxt);
-+   prev_nxt += 4;
-+   src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
-+   src1 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp1);
-+
-+   src1 += src0;
-+   res0 = __msa_copy_s_w((v4i32) src1, 0);
-+
-+   SW(res0, nxt);
-+   nxt += 4;
-+
-+   /* Remainder */
-+   rp_end = row_info->rowbytes - 4;
-+
-+   for (count = 0; count < rp_end; count += 16)
-+   {
-+      src2 = LD_UB(prev_nxt);
-+      prev_nxt += 16;
-+      src6 = LD_UB(prev_row);
-+      prev_row += 16;
-+      src10 = LD_UB(nxt);
-+
-+      SLDI_B3_0_UB(src2, src6, src10, src3, src7, src11, 4);
-+      SLDI_B3_0_UB(src2, src6, src10, src4, src8, src12, 8);
-+      SLDI_B3_0_UB(src2, src6, src10, src5, src9, src13, 12);
-+      ILVR_B2_SH(src2, src6, src1, src6, vec0, vec1);
-+      HSUB_UB2_SH(vec0, vec1, vec0, vec1);
-+      vec2 = vec0 + vec1;
-+      ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
-+      CMP_AND_SELECT(vec0, vec1, vec2, src1, src2, src6, src10);
-+      ILVR_B2_SH(src3, src7, src10, src7, vec0, vec1);
-+      HSUB_UB2_SH(vec0, vec1, vec0, vec1);
-+      vec2 = vec0 + vec1;
-+      ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
-+      CMP_AND_SELECT(vec0, vec1, vec2, src10, src3, src7, src11);
-+      ILVR_B2_SH(src4, src8, src11, src8, vec0, vec1);
-+      HSUB_UB2_SH(vec0, vec1, vec0, vec1);
-+      vec2 = vec0 + vec1;
-+      ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
-+      CMP_AND_SELECT(vec0, vec1, vec2, src11, src4, src8, src12);
-+      ILVR_B2_SH(src5, src9, src12, src9, vec0, vec1);
-+      HSUB_UB2_SH(vec0, vec1, vec0, vec1);
-+      vec2 = vec0 + vec1;
-+      ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
-+      CMP_AND_SELECT(vec0, vec1, vec2, src12, src5, src9, src13);
-+      src1 = src13;
-+      ILVEV_W2_UB(src10, src11, src12, src1, dst0, dst1);
-+      dst0 = (v16u8) __msa_pckev_d((v2i64) dst1, (v2i64) dst0);
-+
-+      ST_UB(dst0, nxt);
-+      nxt += 16;
-+   }
-+}
-+
-+void png_read_filter_row_paeth3_msa(png_row_infop row_info,
-+                                    png_bytep row,
-+                                    png_const_bytep prev_row)
-+{
-+   int32_t count, rp_end;
-+   png_bytep nxt;
-+   png_const_bytep prev_nxt;
-+   int64_t out0;
-+   int32_t inp0, inp1, out1;
-+   int16_t out2;
-+   v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, dst0, dst1;
-+   v16u8 src10, src11, src12, src13;
-+   v8i16 vec0, vec1, vec2;
-+   v16u8 zero = { 0 };
-+   v16i8 mask0 = { 0, 1, 2, 16, 17, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-+   v16i8 mask1 = { 0, 1, 2, 3, 4, 5, 16, 17, 18, 19, 20, 21, 0, 0, 0, 0 };
-+
-+   nxt = row;
-+   prev_nxt = prev_row;
-+
-+   inp0 = LW(nxt);
-+   inp1 = LW(prev_nxt);
-+   prev_nxt += 3;
-+   src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
-+   src1 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp1);
-+
-+   src1 += src0;
-+   out2 = __msa_copy_s_h((v8i16) src1, 0);
-+
-+   SH(out2, nxt);
-+   nxt += 2;
-+   nxt[0] = src1[2];
-+   nxt++;
-+
-+   /* Remainder */
-+   rp_end = row_info->rowbytes - 3;
-+
-+   for (count = 0; count < rp_end; count += 12)
-+   {
-+      src2 = LD_UB(prev_nxt);
-+      prev_nxt += 12;
-+      src6 = LD_UB(prev_row);
-+      prev_row += 12;
-+      src10 = LD_UB(nxt);
-+
-+      SLDI_B3_0_UB(src2, src6, src10, src3, src7, src11, 3);
-+      SLDI_B3_0_UB(src2, src6, src10, src4, src8, src12, 6);
-+      SLDI_B3_0_UB(src2, src6, src10, src5, src9, src13, 9);
-+      ILVR_B2_SH(src2, src6, src1, src6, vec0, vec1);
-+      HSUB_UB2_SH(vec0, vec1, vec0, vec1);
-+      vec2 = vec0 + vec1;
-+      ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
-+      CMP_AND_SELECT(vec0, vec1, vec2, src1, src2, src6, src10);
-+      ILVR_B2_SH(src3, src7, src10, src7, vec0, vec1);
-+      HSUB_UB2_SH(vec0, vec1, vec0, vec1);
-+      vec2 = vec0 + vec1;
-+      ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
-+      CMP_AND_SELECT(vec0, vec1, vec2, src10, src3, src7, src11);
-+      ILVR_B2_SH(src4, src8, src11, src8, vec0, vec1);
-+      HSUB_UB2_SH(vec0, vec1, vec0, vec1);
-+      vec2 = vec0 + vec1;
-+      ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
-+      CMP_AND_SELECT(vec0, vec1, vec2, src11, src4, src8, src12);
-+      ILVR_B2_SH(src5, src9, src12, src9, vec0, vec1);
-+      HSUB_UB2_SH(vec0, vec1, vec0, vec1);
-+      vec2 = vec0 + vec1;
-+      ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
-+      CMP_AND_SELECT(vec0, vec1, vec2, src12, src5, src9, src13);
-+      src1 = src13;
-+      VSHF_B2_UB(src10, src11, src12, src13, mask0, mask0, dst0, dst1);
-+      dst0 = (v16u8) __msa_vshf_b(mask1, (v16i8) dst1, (v16i8) dst0);
-+      out0 = __msa_copy_s_d((v2i64) dst0, 0);
-+      out1 = __msa_copy_s_w((v4i32) dst0, 2);
-+
-+      SD(out0, nxt);
-+      nxt += 8;
-+      SW(out1, nxt);
-+      nxt += 4;
-+   }
-+}
-+
-+#endif /* PNG_MIPS_MSA_OPT > 0 */
-+#endif /* PNG_MIPS_MSA_IMPLEMENTATION == 1 (intrinsics) */
-+#endif /* READ */
-diff --git a/media/libpng/mips/mips_init.c b/media/libpng/mips/mips_init.c
-new file mode 100644
---- /dev/null
-+++ b/media/libpng/mips/mips_init.c
-@@ -0,0 +1,130 @@
-+
-+/* mips_init.c - MSA optimised filter functions
-+ *
-+ * Copyright (c) 2018 Cosmin Truta
-+ * Copyright (c) 2016 Glenn Randers-Pehrson
-+ * Written by Mandar Sahastrabuddhe, 2016.
-+ *
-+ * This code is released under the libpng license.
-+ * For conditions of distribution and use, see the disclaimer
-+ * and license in png.h
-+ */
-+
-+/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
-+ * called.
-+ */
-+#define _POSIX_SOURCE 1
-+
-+#include <stdio.h>
-+#include "../pngpriv.h"
-+
-+#ifdef PNG_READ_SUPPORTED
-+
-+#if PNG_MIPS_MSA_OPT > 0
-+#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED /* Do run-time checks */
-+/* WARNING: it is strongly recommended that you do not build libpng with
-+ * run-time checks for CPU features if at all possible.  In the case of the MIPS
-+ * MSA instructions there is no processor-specific way of detecting the
-+ * presence of the required support, therefore run-time detection is extremely
-+ * OS specific.
-+ *
-+ * You may set the macro PNG_MIPS_MSA_FILE to the file name of file containing
-+ * a fragment of C source code which defines the png_have_msa function.  There
-+ * are a number of implementations in contrib/mips-msa, but the only one that
-+ * has partial support is contrib/mips-msa/linux.c - a generic Linux
-+ * implementation which reads /proc/cpufino.
-+ */
-+#ifndef PNG_MIPS_MSA_FILE
-+#  ifdef __linux__
-+#     define PNG_MIPS_MSA_FILE "contrib/mips-msa/linux.c"
-+#  endif
-+#endif
-+
-+#ifdef PNG_MIPS_MSA_FILE
-+
-+#include <signal.h> /* for sig_atomic_t */
-+static int png_have_msa(png_structp png_ptr);
-+#include PNG_MIPS_MSA_FILE
-+
-+#else  /* PNG_MIPS_MSA_FILE */
-+#  error "PNG_MIPS_MSA_FILE undefined: no support for run-time MIPS MSA checks"
-+#endif /* PNG_MIPS_MSA_FILE */
-+#endif /* PNG_MIPS_MSA_CHECK_SUPPORTED */
-+
-+#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
-+#  error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
-+#endif
-+
-+void
-+png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
-+{
-+   /* The switch statement is compiled in for MIPS_MSA_API, the call to
-+    * png_have_msa is compiled in for MIPS_MSA_CHECK. If both are defined
-+    * the check is only performed if the API has not set the MSA option on
-+    * or off explicitly. In this case the check controls what happens.
-+    */
-+
-+#ifdef PNG_MIPS_MSA_API_SUPPORTED
-+   switch ((pp->options >> PNG_MIPS_MSA) & 3)
-+   {
-+      case PNG_OPTION_UNSET:
-+         /* Allow the run-time check to execute if it has been enabled -
-+          * thus both API and CHECK can be turned on.  If it isn't supported
-+          * this case will fall through to the 'default' below, which just
-+          * returns.
-+          */
-+#endif /* PNG_MIPS_MSA_API_SUPPORTED */
-+#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED
-+         {
-+            static volatile sig_atomic_t no_msa = -1; /* not checked */
-+
-+            if (no_msa < 0)
-+               no_msa = !png_have_msa(pp);
-+
-+            if (no_msa)
-+               return;
-+         }
-+#ifdef PNG_MIPS_MSA_API_SUPPORTED
-+         break;
-+#endif
-+#endif /* PNG_MIPS_MSA_CHECK_SUPPORTED */
-+
-+#ifdef PNG_MIPS_MSA_API_SUPPORTED
-+      default: /* OFF or INVALID */
-+         return;
-+
-+      case PNG_OPTION_ON:
-+         /* Option turned on */
-+         break;
-+   }
-+#endif
-+
-+   /* IMPORTANT: any new external functions used here must be declared using
-+    * PNG_INTERNAL_FUNCTION in ../pngpriv.h.  This is required so that the
-+    * 'prefix' option to configure works:
-+    *
-+    *    ./configure --with-libpng-prefix=foobar_
-+    *
-+    * Verify you have got this right by running the above command, doing a build
-+    * and examining pngprefix.h; it must contain a #define for every external
-+    * function you add.  (Notice that this happens automatically for the
-+    * initialization function.)
-+    */
-+   pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_msa;
-+
-+   if (bpp == 3)
-+   {
-+      pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_msa;
-+      pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_msa;
-+      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_msa;
-+   }
-+
-+   else if (bpp == 4)
-+   {
-+      pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_msa;
-+      pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_msa;
-+      pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_msa;
-+   }
-+}
-+#endif /* PNG_MIPS_MSA_OPT > 0 */
-+#endif /* READ */
-diff --git a/media/libpng/moz.build b/media/libpng/moz.build
---- a/media/libpng/moz.build
-+++ b/media/libpng/moz.build
-@@ -25,41 +25,43 @@ UNIFIED_SOURCES += [
-     'pngrutil.c',
-     'pngset.c',
-     'pngtrans.c',
-     'pngwio.c',
-     'pngwrite.c',
-     'pngwutil.c'
- ]
- 
--if CONFIG['CPU_ARCH'] == 'arm':
-+if CONFIG['CPU_ARCH'] == 'arm' or CONFIG['CPU_ARCH'] == 'aarch64':
-     DEFINES['MOZ_PNG_USE_ARM_NEON'] = True
-     UNIFIED_SOURCES += [
-         'arm/arm_init.c',
--        'arm/filter_neon_intrinsics.c'
--    ]
--
--    SOURCES += [
--        'arm/filter_neon.S'
-+        'arm/filter_neon_intrinsics.c',
-+        'arm/palette_neon_intrinsics.c'
-     ]
- 
--if CONFIG['CPU_ARCH'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang', 'gcc'):
--    DEFINES['MOZ_PNG_USE_ARM_NEON'] = True
--    UNIFIED_SOURCES += [
--        'arm/arm_init.c',
--        'arm/filter_neon_intrinsics.c'
--    ]
-+    if CONFIG['CPU_ARCH'] == 'arm':
-+        SOURCES += [
-+            'arm/filter_neon.S'
-+        ]
- 
- if CONFIG['INTEL_ARCHITECTURE']:
-     DEFINES['MOZ_PNG_USE_INTEL_SSE'] = True
-     UNIFIED_SOURCES += [
-         'intel/filter_sse2_intrinsics.c',
-         'intel/intel_init.c'
-     ]
- 
-+if CONFIG['CPU_ARCH'] == 'mips':
-+    DEFINES['MOZ_PNG_USE_MIPS_MSA'] = True
-+    UNIFIED_SOURCES += [
-+        'mips/filter_msa_intrinsics.c',
-+        'mips/mips_init.c'
-+    ]
-+
- if CONFIG['HAVE_ALTIVEC']:
-     DEFINES['MOZ_PNG_USE_POWERPC'] = True
-     UNIFIED_SOURCES += [
-         'powerpc/filter_vsx_intrinsics.c',
-         'powerpc/powerpc_init.c'
-     ]
- 
- if CONFIG['MOZ_TREE_FREETYPE']:
-diff --git a/media/libpng/moz.yaml b/media/libpng/moz.yaml
---- a/media/libpng/moz.yaml
-+++ b/media/libpng/moz.yaml
-@@ -6,9 +6,9 @@ bugzilla:
- 
- origin:
-   name: "libpng"
-   description: "PNG reference library"
- 
-   url: "http://www.libpng.org/pub/png/libpng.html"
-   license: "libpng"
- 
--  release: "1.6.35"
-+  release: "1.6.37"
-diff --git a/media/libpng/png.c b/media/libpng/png.c
---- a/media/libpng/png.c
-+++ b/media/libpng/png.c
-@@ -1,25 +1,25 @@
- 
- /* png.c - location for general purpose libpng functions
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018-2019 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- #include "pngpriv.h"
- 
- /* Generate a compiler error if there is an old png.h in the search path. */
--typedef png_libpng_version_1_6_35 Your_png_h_is_not_version_1_6_35;
-+typedef png_libpng_version_1_6_37 Your_png_h_is_not_version_1_6_37;
- 
- #ifdef __GNUC__
- /* The version tests may need to be added to, but the problem warning has
-  * consistently been fixed in GCC versions which obtain wide-spread release.
-  * The problem is that many versions of GCC rearrange comparison expressions in
-  * the optimizer in such a way that the results of the comparison will change
-  * if signed integer overflow occurs.  Such comparisons are not permitted in
-  * ANSI C90, however GCC isn't clever enough to work out that that do not occur
-@@ -731,17 +731,17 @@ png_save_int_32(png_bytep buf, png_int_3
- 
- #  ifdef PNG_TIME_RFC1123_SUPPORTED
- /* Convert the supplied time into an RFC 1123 string suitable for use in
-  * a "Creation Time" or other text-based time string.
-  */
- int PNGAPI
- png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
- {
--   static PNG_CONST char short_months[12][4] =
-+   static const char short_months[12][4] =
-         {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
-          "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
- 
-    if (out == NULL)
-       return 0;
- 
-    if (ptime->year > 9999 /* RFC1123 limitation */ ||
-        ptime->month == 0    ||  ptime->month > 12  ||
-@@ -809,34 +809,24 @@ png_convert_to_rfc1123(png_structrp png_
- 
- png_const_charp PNGAPI
- png_get_copyright(png_const_structrp png_ptr)
- {
-    PNG_UNUSED(png_ptr)  /* Silence compiler warning about unused png_ptr */
- #ifdef PNG_STRING_COPYRIGHT
-    return PNG_STRING_COPYRIGHT
- #else
--#  ifdef __STDC__
-    return PNG_STRING_NEWLINE \
--      "libpng version 1.6.35+apng - July 15, 2018" PNG_STRING_NEWLINE \
-+      "libpng version 1.6.37" PNG_STRING_NEWLINE \
-+      "Copyright (c) 2018-2019 Cosmin Truta" PNG_STRING_NEWLINE \
-       "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
-       PNG_STRING_NEWLINE \
-       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
-       "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
--      PNG_STRING_NEWLINE \
--      "Portions Copyright (c) 2006-2007 Andrew Smith" PNG_STRING_NEWLINE \
--      "Portions Copyright (c) 2008-2018 Max Stepin" PNG_STRING_NEWLINE ;
--#  else
--   return "libpng version 1.6.35+apng - July 15, 2018\
--      Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson\
--      Copyright (c) 1996-1997 Andreas Dilger\
--      Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\
--      Portions Copyright (c) 2006-2007 Andrew Smith\
--      Portions Copyright (c) 2008-2018 Max Stepin";
--#  endif
-+      PNG_STRING_NEWLINE;
- #endif
- }
- 
- /* The following return the library version as a short string in the
-  * format 1.0.0 through 99.99.99zz.  To get the version of *.h files
-  * used with your application, print out PNG_LIBPNG_VER_STRING, which
-  * is defined in png.h.
-  * Note: now there is no difference between png_get_libpng_ver() and
-@@ -1120,17 +1110,17 @@ png_colorspace_check_gamma(png_const_str
-    return 1;
- }
- 
- void /* PRIVATE */
- png_colorspace_set_gamma(png_const_structrp png_ptr,
-     png_colorspacerp colorspace, png_fixed_point gAMA)
- {
-    /* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
--    * occur.  Since the fixed point representation is asymetrical it is
-+    * occur.  Since the fixed point representation is asymmetrical it is
-     * possible for 1/gamma to overflow the limit of 21474 and this means the
-     * gamma value must be at least 5/100000 and hence at most 20000.0.  For
-     * safety the limits here are a little narrower.  The values are 0.00016 to
-     * 6250.0, which are truly ridiculous gamma values (and will produce
-     * displays that are all black or all white.)
-     *
-     * In 1.6.0 this test replaces the ones in pngrutil.c, in the gAMA chunk
-     * handling code, which only required the value to be >0.
-@@ -3133,21 +3123,21 @@ png_ascii_from_fp(png_const_structrp png
-                   *ascii++ = (char)(48 + (int)d); ++cdigits;
-                }
-             }
-             while (cdigits+czero < precision+clead && fp > DBL_MIN);
- 
-             /* The total output count (max) is now 4+precision */
- 
-             /* Check for an exponent, if we don't need one we are
--             * done and just need to terminate the string.  At
--             * this point exp_b10==(-1) is effectively a flag - it got
--             * to '-1' because of the decrement after outputting
--             * the decimal point above (the exponent required is
--             * *not* -1!)
-+             * done and just need to terminate the string.  At this
-+             * point, exp_b10==(-1) is effectively a flag: it got
-+             * to '-1' because of the decrement, after outputting
-+             * the decimal point above. (The exponent required is
-+             * *not* -1.)
-              */
-             if (exp_b10 >= (-1) && exp_b10 <= 2)
-             {
-                /* The following only happens if we didn't output the
-                 * leading zeros above for negative exponent, so this
-                 * doesn't add to the digit requirement.  Note that the
-                 * two zeros here can only be output if the two leading
-                 * zeros were *not* output, so this doesn't increase
-@@ -3975,28 +3965,28 @@ png_gamma_correct(png_structrp png_ptr, 
-  * to shift the input values right (or 16-number_of_signifiant_bits).
-  *
-  * The caller is responsible for ensuring that the table gets cleaned up on
-  * png_error (i.e. if one of the mallocs below fails) - i.e. the *table argument
-  * should be somewhere that will be cleaned.
-  */
- static void
- png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
--    PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
-+    unsigned int shift, png_fixed_point gamma_val)
- {
-    /* Various values derived from 'shift': */
--   PNG_CONST unsigned int num = 1U << (8U - shift);
-+   unsigned int num = 1U << (8U - shift);
- #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
-    /* CSE the division and work round wacky GCC warnings (see the comments
-     * in png_gamma_8bit_correct for where these come from.)
-     */
--   PNG_CONST double fmax = 1./(((png_int_32)1 << (16U - shift))-1);
-+   double fmax = 1.0 / (((png_int_32)1 << (16U - shift)) - 1);
- #endif
--   PNG_CONST unsigned int max = (1U << (16U - shift))-1U;
--   PNG_CONST unsigned int max_by_2 = 1U << (15U-shift);
-+   unsigned int max = (1U << (16U - shift)) - 1U;
-+   unsigned int max_by_2 = 1U << (15U - shift);
-    unsigned int i;
- 
-    png_uint_16pp table = *ptable =
-        (png_uint_16pp)png_calloc(png_ptr, num * (sizeof (png_uint_16p)));
- 
-    for (i = 0; i < num; i++)
-    {
-       png_uint_16p sub_table = table[i] =
-@@ -4052,20 +4042,20 @@ png_build_16bit_table(png_structrp png_p
-    }
- }
- 
- /* NOTE: this function expects the *inverse* of the overall gamma transformation
-  * required.
-  */
- static void
- png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable,
--    PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
-+    unsigned int shift, png_fixed_point gamma_val)
- {
--   PNG_CONST unsigned int num = 1U << (8U - shift);
--   PNG_CONST unsigned int max = (1U << (16U - shift))-1U;
-+   unsigned int num = 1U << (8U - shift);
-+   unsigned int max = (1U << (16U - shift))-1U;
-    unsigned int i;
-    png_uint_32 last;
- 
-    png_uint_16pp table = *ptable =
-        (png_uint_16pp)png_calloc(png_ptr, num * (sizeof (png_uint_16p)));
- 
-    /* 'num' is the number of tables and also the number of low bits of low
-     * bits of the input 16-bit value used to select a table.  Each table is
-@@ -4120,17 +4110,17 @@ png_build_16to8_table(png_structrp png_p
- #endif /* 16BIT */
- 
- /* Build a single 8-bit table: same as the 16-bit case but much simpler (and
-  * typically much faster).  Note that libpng currently does no sBIT processing
-  * (apparently contrary to the spec) so a 256-entry table is always generated.
-  */
- static void
- png_build_8bit_table(png_structrp png_ptr, png_bytepp ptable,
--    PNG_CONST png_fixed_point gamma_val)
-+    png_fixed_point gamma_val)
- {
-    unsigned int i;
-    png_bytep table = *ptable = (png_bytep)png_malloc(png_ptr, 256);
- 
-    if (png_gamma_significant(gamma_val) != 0)
-       for (i=0; i<256; i++)
-          table[i] = png_gamma_8bit_correct(i, gamma_val);
- 
-diff --git a/media/libpng/png.h b/media/libpng/png.h
---- a/media/libpng/png.h
-+++ b/media/libpng/png.h
-@@ -1,158 +1,176 @@
- 
- /* png.h - header file for PNG reference library
-  *
-- * libpng version 1.6.35, July 15, 2018
-+ * libpng version 1.6.37 - April 14, 2019
-  *
-+ * Copyright (c) 2018-2019 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-- * This code is released under the libpng license (See LICENSE, below)
-+ * This code is released under the libpng license. (See LICENSE, below.)
-  *
-  * Authors and maintainers:
-  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
-  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
-- *   libpng versions 0.97, January 1998, through 1.6.35, July 15, 2018:
-- *     Glenn Randers-Pehrson.
-+ *   libpng versions 0.97, January 1998, through 1.6.35, July 2018:
-+ *     Glenn Randers-Pehrson
-+ *   libpng versions 1.6.36, December 2018, through 1.6.37, April 2019:
-+ *     Cosmin Truta
-  *   See also "Contributing Authors", below.
-  */
- 
- /*
-- * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
-+ * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
-+ * =========================================
-+ *
-+ * PNG Reference Library License version 2
-+ * ---------------------------------------
-  *
-- * If you modify libpng you may insert additional notices immediately following
-- * this sentence.
-+ *  * Copyright (c) 1995-2019 The PNG Reference Library Authors.
-+ *  * Copyright (c) 2018-2019 Cosmin Truta.
-+ *  * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
-+ *  * Copyright (c) 1996-1997 Andreas Dilger.
-+ *  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-- * This modified version of libpng code adds animated PNG support and is
-- * released under the libpng license described below. The modifications are
-- * Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2017 Max Stepin,
-- * and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives
-- * surrounding them in the modified libpng source files.
-+ * The software is supplied "as is", without warranty of any kind,
-+ * express or implied, including, without limitation, the warranties
-+ * of merchantability, fitness for a particular purpose, title, and
-+ * non-infringement.  In no event shall the Copyright owners, or
-+ * anyone distributing the software, be liable for any damages or
-+ * other liability, whether in contract, tort or otherwise, arising
-+ * from, out of, or in connection with the software, or the use or
-+ * other dealings in the software, even if advised of the possibility
-+ * of such damage.
-+ *
-+ * Permission is hereby granted to use, copy, modify, and distribute
-+ * this software, or portions hereof, for any purpose, without fee,
-+ * subject to the following restrictions:
-  *
-- * This code is released under the libpng license.
-+ *  1. The origin of this software must not be misrepresented; you
-+ *     must not claim that you wrote the original software.  If you
-+ *     use this software in a product, an acknowledgment in the product
-+ *     documentation would be appreciated, but is not required.
-+ *
-+ *  2. Altered source versions must be plainly marked as such, and must
-+ *     not be misrepresented as being the original software.
-  *
-- * libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
-+ *  3. This Copyright notice may not be removed or altered from any
-+ *     source or altered source distribution.
-+ *
-+ *
-+ * PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
-+ * -----------------------------------------------------------------------
-+ *
-+ * libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
-  * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
-  * derived from libpng-1.0.6, and are distributed according to the same
-  * disclaimer and license as libpng-1.0.6 with the following individuals
-  * added to the list of Contributing Authors:
-  *
-- *    Simon-Pierre Cadieux
-- *    Eric S. Raymond
-- *    Mans Rullgard
-- *    Cosmin Truta
-- *    Gilles Vollant
-- *    James Yu
-- *    Mandar Sahastrabuddhe
-- *    Google Inc.
-- *    Vadim Barkov
-+ *     Simon-Pierre Cadieux
-+ *     Eric S. Raymond
-+ *     Mans Rullgard
-+ *     Cosmin Truta
-+ *     Gilles Vollant
-+ *     James Yu
-+ *     Mandar Sahastrabuddhe
-+ *     Google Inc.
-+ *     Vadim Barkov
-  *
-  * and with the following additions to the disclaimer:
-  *
-- *    There is no warranty against interference with your enjoyment of the
-- *    library or against infringement.  There is no warranty that our
-- *    efforts or the library will fulfill any of your particular purposes
-- *    or needs.  This library is provided with all faults, and the entire
-- *    risk of satisfactory quality, performance, accuracy, and effort is with
-- *    the user.
-+ *     There is no warranty against interference with your enjoyment of
-+ *     the library or against infringement.  There is no warranty that our
-+ *     efforts or the library will fulfill any of your particular purposes
-+ *     or needs.  This library is provided with all faults, and the entire
-+ *     risk of satisfactory quality, performance, accuracy, and effort is
-+ *     with the user.
-  *
-  * Some files in the "contrib" directory and some configure-generated
-- * files that are distributed with libpng have other copyright owners and
-+ * files that are distributed with libpng have other copyright owners, and
-  * are released under other open source licenses.
-  *
-  * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
-  * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
-  * libpng-0.96, and are distributed according to the same disclaimer and
-- * license as libpng-0.96, with the following individuals added to the list
-- * of Contributing Authors:
-+ * license as libpng-0.96, with the following individuals added to the
-+ * list of Contributing Authors:
-  *
-- *    Tom Lane
-- *    Glenn Randers-Pehrson
-- *    Willem van Schaik
-+ *     Tom Lane
-+ *     Glenn Randers-Pehrson
-+ *     Willem van Schaik
-  *
-  * libpng versions 0.89, June 1996, through 0.96, May 1997, are
-  * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
-  * and are distributed according to the same disclaimer and license as
-  * libpng-0.88, with the following individuals added to the list of
-  * Contributing Authors:
-  *
-- *    John Bowler
-- *    Kevin Bracey
-- *    Sam Bushell
-- *    Magnus Holmgren
-- *    Greg Roelofs
-- *    Tom Tanner
-+ *     John Bowler
-+ *     Kevin Bracey
-+ *     Sam Bushell
-+ *     Magnus Holmgren
-+ *     Greg Roelofs
-+ *     Tom Tanner
-  *
-- * Some files in the "scripts" directory have other copyright owners
-+ * Some files in the "scripts" directory have other copyright owners,
-  * but are released under this license.
-  *
-  * libpng versions 0.5, May 1995, through 0.88, January 1996, are
-  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * For the purposes of this copyright and license, "Contributing Authors"
-  * is defined as the following set of individuals:
-  *
-- *    Andreas Dilger
-- *    Dave Martindale
-- *    Guy Eric Schalnat
-- *    Paul Schmidt
-- *    Tim Wegner
-+ *     Andreas Dilger
-+ *     Dave Martindale
-+ *     Guy Eric Schalnat
-+ *     Paul Schmidt
-+ *     Tim Wegner
-  *
-- * The PNG Reference Library is supplied "AS IS".  The Contributing Authors
-- * and Group 42, Inc. disclaim all warranties, expressed or implied,
-- * including, without limitation, the warranties of merchantability and of
-- * fitness for any purpose.  The Contributing Authors and Group 42, Inc.
-- * assume no liability for direct, indirect, incidental, special, exemplary,
-- * or consequential damages, which may result from the use of the PNG
-- * Reference Library, even if advised of the possibility of such damage.
-+ * The PNG Reference Library is supplied "AS IS".  The Contributing
-+ * Authors and Group 42, Inc. disclaim all warranties, expressed or
-+ * implied, including, without limitation, the warranties of
-+ * merchantability and of fitness for any purpose.  The Contributing
-+ * Authors and Group 42, Inc. assume no liability for direct, indirect,
-+ * incidental, special, exemplary, or consequential damages, which may
-+ * result from the use of the PNG Reference Library, even if advised of
-+ * the possibility of such damage.
-  *
-  * Permission is hereby granted to use, copy, modify, and distribute this
-  * source code, or portions hereof, for any purpose, without fee, subject
-  * to the following restrictions:
-  *
-- *   1. The origin of this source code must not be misrepresented.
-+ *  1. The origin of this source code must not be misrepresented.
-  *
-- *   2. Altered versions must be plainly marked as such and must not
-- *      be misrepresented as being the original source.
-+ *  2. Altered versions must be plainly marked as such and must not
-+ *     be misrepresented as being the original source.
-  *
-- *   3. This Copyright notice may not be removed or altered from any
-- *      source or altered source distribution.
-+ *  3. This Copyright notice may not be removed or altered from any
-+ *     source or altered source distribution.
-  *
-- * The Contributing Authors and Group 42, Inc. specifically permit, without
-- * fee, and encourage the use of this source code as a component to
-- * supporting the PNG file format in commercial products.  If you use this
-- * source code in a product, acknowledgment is not required but would be
-- * appreciated.
-+ * The Contributing Authors and Group 42, Inc. specifically permit,
-+ * without fee, and encourage the use of this source code as a component
-+ * to supporting the PNG file format in commercial products.  If you use
-+ * this source code in a product, acknowledgment is not required but would
-+ * be appreciated.
-  *
-  * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
-  *
-- * TRADEMARK:
-+ * TRADEMARK
-+ * =========
-  *
-- * The name "libpng" has not been registered by the Copyright owner
-+ * The name "libpng" has not been registered by the Copyright owners
-  * as a trademark in any jurisdiction.  However, because libpng has
-  * been distributed and maintained world-wide, continually since 1995,
-- * the Copyright owner claims "common-law trademark protection" in any
-+ * the Copyright owners claim "common-law trademark protection" in any
-  * jurisdiction where common-law trademark is recognized.
-- *
-- * OSI CERTIFICATION:
-- *
-- * Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
-- * a certification mark of the Open Source Initiative. OSI has not addressed
-- * the additional disclaimers inserted at version 1.0.7.
-- *
-- * EXPORT CONTROL:
-- *
-- * The Copyright owner believes that the Export Control Classification
-- * Number (ECCN) for libpng is EAR99, which means not subject to export
-- * controls or International Traffic in Arms Regulations (ITAR) because
-- * it is open source, publicly available software, that does not contain
-- * any encryption software.  See the EAR, paragraphs 734.3(b)(3) and
-- * 734.7(b).
-  */
- 
- /*
-  * A "png_get_copyright" function is available, for convenient use in "about"
-  * boxes and the like:
-  *
-  *    printf("%s", png_get_copyright(NULL));
-  *
-@@ -208,101 +226,46 @@
-  *    1.0.6h                        10007  10.6h (testing xy.z so-numbering)
-  *    1.0.6i                        10007  10.6i
-  *    1.0.6j                        10007  2.1.0.6j (incompatible with 1.0.0)
-  *    1.0.7beta11-14        DLLNUM  10007  2.1.0.7beta11-14 (binary compatible)
-  *    1.0.7beta15-18           1    10007  2.1.0.7beta15-18 (binary compatible)
-  *    1.0.7rc1-2               1    10007  2.1.0.7rc1-2 (binary compatible)
-  *    1.0.7                    1    10007  (still compatible)
-  *    ...
-- *    1.0.19                  10    10019  10.so.0.19[.0]
-+ *    1.0.69                  10    10069  10.so.0.69[.0]
-  *    ...
-- *    1.2.59                  13    10257  12.so.0.59[.0]
-+ *    1.2.59                  13    10259  12.so.0.59[.0]
-  *    ...
-- *    1.5.30                  15    10527  15.so.15.30[.0]
-+ *    1.4.20                  14    10420  14.so.0.20[.0]
-  *    ...
-- *    1.6.35                  16    10635  16.so.16.35[.0]
-+ *    1.5.30                  15    10530  15.so.15.30[.0]
-+ *    ...
-+ *    1.6.37                  16    10637  16.so.16.37[.0]
-  *
-- *    Henceforth the source version will match the shared-library major
-- *    and minor numbers; the shared-library major version number will be
-- *    used for changes in backward compatibility, as it is intended.  The
-- *    PNG_LIBPNG_VER macro, which is not used within libpng but is available
-- *    for applications, is an unsigned integer of the form xyyzz corresponding
-- *    to the source version x.y.z (leading zeros in y and z).  Beta versions
-- *    were given the previous public release number plus a letter, until
-- *    version 1.0.6j; from then on they were given the upcoming public
-- *    release number plus "betaNN" or "rcNN".
-+ *    Henceforth the source version will match the shared-library major and
-+ *    minor numbers; the shared-library major version number will be used for
-+ *    changes in backward compatibility, as it is intended.
-+ *    The PNG_LIBPNG_VER macro, which is not used within libpng but is
-+ *    available for applications, is an unsigned integer of the form XYYZZ
-+ *    corresponding to the source version X.Y.Z (leading zeros in Y and Z).
-+ *    Beta versions were given the previous public release number plus a
-+ *    letter, until version 1.0.6j; from then on they were given the upcoming
-+ *    public release number plus "betaNN" or "rcNN".
-  *
-  *    Binary incompatibility exists only when applications make direct access
-  *    to the info_ptr or png_ptr members through png.h, and the compiled
-  *    application is loaded with a different version of the library.
-  *
-  *    DLLNUM will change each time there are forward or backward changes
-  *    in binary compatibility (e.g., when a new feature is added).
-  *
-  * See libpng.txt or libpng.3 for more information.  The PNG specification
-- * is available as a W3C Recommendation and as an ISO Specification,
-- * <https://www.w3.org/TR/2003/REC-PNG-20031110/
-- */
--
--/*
-- * Y2K compliance in libpng:
-- * =========================
-- *
-- *    July 15, 2018
-- *
-- *    Since the PNG Development group is an ad-hoc body, we can't make
-- *    an official declaration.
-- *
-- *    This is your unofficial assurance that libpng from version 0.71 and
-- *    upward through 1.6.35 are Y2K compliant.  It is my belief that
-- *    earlier versions were also Y2K compliant.
-- *
-- *    Libpng only has two year fields.  One is a 2-byte unsigned integer
-- *    that will hold years up to 65535.  The other, which is deprecated,
-- *    holds the date in text format, and will hold years up to 9999.
-- *
-- *    The integer is
-- *        "png_uint_16 year" in png_time_struct.
-- *
-- *    The string is
-- *        "char time_buffer[29]" in png_struct.  This is no longer used
-- *    in libpng-1.6.x and will be removed from libpng-1.7.0.
-- *
-- *    There are seven time-related functions:
-- *        png.c: png_convert_to_rfc_1123_buffer() in png.c
-- *          (formerly png_convert_to_rfc_1123() prior to libpng-1.5.x and
-- *          png_convert_to_rfc_1152() in error prior to libpng-0.98)
-- *        png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
-- *        png_convert_from_time_t() in pngwrite.c
-- *        png_get_tIME() in pngget.c
-- *        png_handle_tIME() in pngrutil.c, called in pngread.c
-- *        png_set_tIME() in pngset.c
-- *        png_write_tIME() in pngwutil.c, called in pngwrite.c
-- *
-- *    All handle dates properly in a Y2K environment.  The
-- *    png_convert_from_time_t() function calls gmtime() to convert from system
-- *    clock time, which returns (year - 1900), which we properly convert to
-- *    the full 4-digit year.  There is a possibility that libpng applications
-- *    are not passing 4-digit years into the png_convert_to_rfc_1123_buffer()
-- *    function, or that they are incorrectly passing only a 2-digit year
-- *    instead of "year - 1900" into the png_convert_from_struct_tm() function,
-- *    but this is not under our control.  The libpng documentation has always
-- *    stated that it works with 4-digit years, and the APIs have been
-- *    documented as such.
-- *
-- *    The tIME chunk itself is also Y2K compliant.  It uses a 2-byte unsigned
-- *    integer to hold the year, and can hold years as large as 65535.
-- *
-- *    zlib, upon which libpng depends, is also Y2K compliant.  It contains
-- *    no date-related code.
-- *
-- *       Glenn Randers-Pehrson
-- *       libpng maintainer
-- *       PNG Development Group
-+ * is available as a W3C Recommendation and as an ISO/IEC Standard; see
-+ * <https://www.w3.org/TR/2003/REC-PNG-20031110/>
-  */
- 
- #ifndef PNG_H
- #define PNG_H
- 
- /* This is not the place to learn how to use libpng. The file libpng-manual.txt
-  * describes how to use libpng, and the file example.c summarizes it
-  * with some code on which to build.  This file is useful for looking
-@@ -310,58 +273,57 @@
-  * file has been stripped from your copy of libpng, you can find it at
-  * <http://www.libpng.org/pub/png/libpng-manual.txt>
-  *
-  * If you just need to read a PNG file and don't want to read the documentation
-  * skip to the end of this file and read the section entitled 'simplified API'.
-  */
- 
- /* Version information for png.h - this should match the version in png.c */
--#define PNG_LIBPNG_VER_STRING "1.6.35+apng"
--#define PNG_HEADER_VERSION_STRING \
--     " libpng version 1.6.35+apng - July 15, 2018\n"
-+#define PNG_LIBPNG_VER_STRING "1.6.37"
-+#define PNG_HEADER_VERSION_STRING " libpng version 1.6.37 - April 14, 2019\n"
- 
- #define PNG_LIBPNG_VER_SONUM   16
- #define PNG_LIBPNG_VER_DLLNUM  16
- 
- /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
- #define PNG_LIBPNG_VER_MAJOR   1
- #define PNG_LIBPNG_VER_MINOR   6
--#define PNG_LIBPNG_VER_RELEASE 35
--
--/* This should match the numeric part of the final component of
-- * PNG_LIBPNG_VER_STRING, omitting any leading zero:
-+#define PNG_LIBPNG_VER_RELEASE 37
-+
-+/* This should be zero for a public release, or non-zero for a
-+ * development version.  [Deprecated]
-  */
--
--#define PNG_LIBPNG_VER_BUILD  02
-+#define PNG_LIBPNG_VER_BUILD  0
- 
- /* Release Status */
- #define PNG_LIBPNG_BUILD_ALPHA    1
- #define PNG_LIBPNG_BUILD_BETA     2
- #define PNG_LIBPNG_BUILD_RC       3
- #define PNG_LIBPNG_BUILD_STABLE   4
- #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
- 
- /* Release-Specific Flags */
- #define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with
-                                        PNG_LIBPNG_BUILD_STABLE only */
- #define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with
-                                        PNG_LIBPNG_BUILD_SPECIAL */
- #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
-                                        PNG_LIBPNG_BUILD_PRIVATE */
- 
--#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
--
--/* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
-- * We must not include leading zeros.
-- * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
-- * version 1.0.0 was mis-numbered 100 instead of 10000).  From
-- * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
-+#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
-+
-+/* Careful here.  At one time, Guy wanted to use 082, but that
-+ * would be octal.  We must not include leading zeros.
-+ * Versions 0.7 through 1.0.0 were in the range 0 to 100 here
-+ * (only version 1.0.0 was mis-numbered 100 instead of 10000).
-+ * From version 1.0.1 it is:
-+ * XXYYZZ, where XX=major, YY=minor, ZZ=release
-  */
--#define PNG_LIBPNG_VER 10635 /* 1.6.35 */
-+#define PNG_LIBPNG_VER 10637 /* 1.6.37 */
- 
- /* Library configuration: these options cannot be changed after
-  * the library has been built.
-  */
- #ifndef PNGLCONF_H
- /* If pnglibconf.h is missing, you can
-  * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
-  */
-@@ -476,17 +438,17 @@ extern "C" {
- /* blend_op flags from inside fcTL */
- #define PNG_BLEND_OP_SOURCE        0x00
- #define PNG_BLEND_OP_OVER          0x01
- #endif /* APNG */
- 
- /* This triggers a compiler error in png.c, if png.c and png.h
-  * do not agree upon the version number.
-  */
--typedef char* png_libpng_version_1_6_35;
-+typedef char* png_libpng_version_1_6_37;
- 
- /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
-  *
-  * png_struct is the cache of information used while reading or writing a single
-  * PNG file.  One of these is always required, although the simplified API
-  * (below) hides the creation and destruction of it.
-  */
- typedef struct png_struct_def png_struct;
-@@ -2038,22 +2000,22 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM
-     png_fixed_point int_blue_X, png_fixed_point int_blue_Y,
-     png_fixed_point int_blue_Z))
- #endif
- 
- #ifdef PNG_eXIf_SUPPORTED
- PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
-     png_inforp info_ptr, png_bytep *exif));
- PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr,
--    png_inforp info_ptr, const png_bytep exif));
-+    png_inforp info_ptr, png_bytep exif));
- 
- PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr,
-     png_const_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif));
- PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr,
--    png_inforp info_ptr, const png_uint_32 num_exif, const png_bytep exif));
-+    png_inforp info_ptr, png_uint_32 num_exif, png_bytep exif));
- #endif
- 
- #ifdef PNG_gAMA_SUPPORTED
- PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
-     png_const_inforp info_ptr, double *file_gamma))
- PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed,
-     (png_const_structrp png_ptr, png_const_inforp info_ptr,
-     png_fixed_point *int_file_gamma))
-@@ -2789,17 +2751,17 @@ typedef struct
-  * b) As a value in the range 0..65535, contained in a 2-byte integer.  All
-  * channels can be converted to the original value by dividing by 65535; all
-  * channels are linear.  Color channels use the RGB encoding (RGB end-points) of
-  * the sRGB specification.  This encoding is identified by the
-  * PNG_FORMAT_FLAG_LINEAR flag below.
-  *
-  * When the simplified API needs to convert between sRGB and linear colorspaces,
-  * the actual sRGB transfer curve defined in the sRGB specification (see the
-- * article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
-+ * article at <https://en.wikipedia.org/wiki/SRGB>) is used, not the gamma=1/2.2
-  * approximation used elsewhere in libpng.
-  *
-  * When an alpha channel is present it is expected to denote pixel coverage
-  * of the color or luminance channels and is returned as an associated alpha
-  * channel: the color/gray channels are scaled (pre-multiplied) by the alpha
-  * value.
-  *
-  * The samples are either contained directly in the image data, between 1 and 8
-@@ -2992,17 +2954,17 @@ typedef struct
-     */
- 
- /* PNG_IMAGE_FLAG_*
-  *
-  * Flags containing additional information about the image are held in the
-  * 'flags' field of png_image.
-  */
- #define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 0x01
--   /* This indicates the the RGB values of the in-memory bitmap do not
-+   /* This indicates that the RGB values of the in-memory bitmap do not
-     * correspond to the red, green and blue end-points defined by sRGB.
-     */
- 
- #define PNG_IMAGE_FLAG_FAST 0x02
-    /* On write emphasise speed over compression; the resultant PNG file will be
-     * larger but will be produced significantly faster, particular for large
-     * images.  Do not use this option for images which will be distributed, only
-     * used it when producing intermediate files that will be read back in
-diff --git a/media/libpng/pngconf.h b/media/libpng/pngconf.h
---- a/media/libpng/pngconf.h
-+++ b/media/libpng/pngconf.h
-@@ -1,16 +1,17 @@
- 
--/* pngconf.h - machine configurable file for libpng
-+/* pngconf.h - machine-configurable file for libpng
-+ *
-+ * libpng version 1.6.37
-  *
-- * libpng version 1.6.35, July 15, 2018
-- *
-+ * Copyright (c) 2018-2019 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * Any machine specific code is near the front of this file, so if you
-  * are configuring libpng for a machine, you may want to read the section
-  * starting here down to where it starts to typedef png_color, png_text,
-@@ -52,24 +53,23 @@
- 
- #ifdef PNG_CONVERT_tIME_SUPPORTED
-    /* Required for struct tm: */
- #  include <time.h>
- #endif
- 
- #endif /* PNG_BUILDING_SYMBOL_TABLE */
- 
--/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using
-- * PNG_NO_CONST; this is no longer supported except for data declarations which
-- * apparently still cause problems in 2011 on some compilers.
-+/* Prior to 1.6.0, it was possible to turn off 'const' in declarations,
-+ * using PNG_NO_CONST.  This is no longer supported.
-  */
- #define PNG_CONST const /* backward compatibility only */
- 
--/* This controls optimization of the reading of 16-bit and 32-bit values
-- * from PNG files.  It can be set on a per-app-file basis - it
-+/* This controls optimization of the reading of 16-bit and 32-bit
-+ * values from PNG files.  It can be set on a per-app-file basis: it
-  * just changes whether a macro is used when the function is called.
-  * The library builder sets the default; if read functions are not
-  * built into the library the macro implementation is forced on.
-  */
- #ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
- #  define PNG_USE_READ_MACROS
- #endif
- #if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
-diff --git a/media/libpng/pngdebug.h b/media/libpng/pngdebug.h
---- a/media/libpng/pngdebug.h
-+++ b/media/libpng/pngdebug.h
-@@ -1,15 +1,15 @@
- 
- /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
-  *
-- * Last changed in libpng 1.6.8 [December 19, 2013]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- /* Define PNG_DEBUG at compile time for debugging information.  Higher
-  * numbers for PNG_DEBUG mean more debugging information.  This has
-diff --git a/media/libpng/pngerror.c b/media/libpng/pngerror.c
---- a/media/libpng/pngerror.c
-+++ b/media/libpng/pngerror.c
-@@ -1,15 +1,15 @@
- 
- /* pngerror.c - stub functions for i/o and memory allocation
-  *
-- * Last changed in libpng 1.6.31 [July 27, 2017]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file provides a location for all error handling.  Users who
-  * need special error handling are expected to write replacement functions
-  * and use png_set_error_fn() to use those functions.  See the instructions
-@@ -420,17 +420,17 @@ png_app_error(png_const_structrp png_ptr
-    (defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
- /* These utilities are used internally to build an error message that relates
-  * to the current chunk.  The chunk name comes from png_ptr->chunk_name,
-  * which is used to prefix the message.  The message is limited in length
-  * to 63 bytes. The name characters are output as hex digits wrapped in []
-  * if the character is invalid.
-  */
- #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
--static PNG_CONST char png_digit[16] = {
-+static const char png_digit[16] = {
-    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-    'A', 'B', 'C', 'D', 'E', 'F'
- };
- 
- static void /* PRIVATE */
- png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
-     error_message)
- {
-@@ -880,17 +880,17 @@ png_set_strip_error_numbers(png_structrp
-    /* Currently the above both depend on SETJMP_SUPPORTED, however it would be
-     * possible to implement without setjmp support just so long as there is some
-     * way to handle the error return here:
-     */
- PNG_FUNCTION(void /* PRIVATE */, (PNGCBAPI
- png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message),
-     PNG_NORETURN)
- {
--   const png_const_structrp png_ptr = png_nonconst_ptr;
-+   png_const_structrp png_ptr = png_nonconst_ptr;
-    png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
- 
-    /* An error is always logged here, overwriting anything (typically a warning)
-     * that is already there:
-     */
-    if (image != NULL)
-    {
-       png_safecat(image->message, (sizeof image->message), 0, error_message);
-@@ -915,17 +915,17 @@ png_safe_error),(png_structp png_noncons
-    /* Here on an internal programming error. */
-    abort();
- }
- 
- #ifdef PNG_WARNINGS_SUPPORTED
- void /* PRIVATE */ PNGCBAPI
- png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
- {
--   const png_const_structrp png_ptr = png_nonconst_ptr;
-+   png_const_structrp png_ptr = png_nonconst_ptr;
-    png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
- 
-    /* A warning is only logged if there is no prior warning or error. */
-    if (image->warning_or_error == 0)
-    {
-       png_safecat(image->message, (sizeof image->message), 0, warning_message);
-       image->warning_or_error |= PNG_IMAGE_WARNING;
-    }
-diff --git a/media/libpng/pngget.c b/media/libpng/pngget.c
---- a/media/libpng/pngget.c
-+++ b/media/libpng/pngget.c
-@@ -1,15 +1,15 @@
- 
- /* pngget.c - retrieval of values from info struct
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  */
- 
- #include "pngpriv.h"
-diff --git a/media/libpng/pnginfo.h b/media/libpng/pnginfo.h
---- a/media/libpng/pnginfo.h
-+++ b/media/libpng/pnginfo.h
-@@ -1,15 +1,15 @@
- 
- /* pnginfo.h - header file for PNG reference library
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
-  /* png_info is a structure that holds the information in a PNG file so
-  * that the application can find out the characteristics of the image.
-diff --git a/media/libpng/pngmem.c b/media/libpng/pngmem.c
---- a/media/libpng/pngmem.c
-+++ b/media/libpng/pngmem.c
-@@ -1,15 +1,15 @@
- 
- /* pngmem.c - stub functions for memory allocation
-  *
-- * Last changed in libpng 1.6.26 [October 20, 2016]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file provides a location for all memory allocation.  Users who
-  * need special memory handling are expected to supply replacement
-  * functions for png_malloc() and png_free(), and to use
-diff --git a/media/libpng/pngpread.c b/media/libpng/pngpread.c
---- a/media/libpng/pngpread.c
-+++ b/media/libpng/pngpread.c
-@@ -1,15 +1,15 @@
- 
- /* pngpread.c - read a png file in push mode
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- #include "pngpriv.h"
- 
-@@ -1124,30 +1124,30 @@ png_push_process_row(png_structrp png_pt
- 
- void /* PRIVATE */
- png_read_push_finish_row(png_structrp png_ptr)
- {
- #ifdef PNG_READ_INTERLACING_SUPPORTED
-    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
- 
-    /* Start of interlace block */
--   static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
-+   static const png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
- 
-    /* Offset to next interlace block */
--   static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
-+   static const png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
- 
-    /* Start of interlace block in the y direction */
--   static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
-+   static const png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
- 
-    /* Offset to next interlace block in the y direction */
--   static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
-+   static const png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
- 
-    /* Height of interlace block.  This is not currently used - if you need
-     * it, uncomment it here and in png.h
--   static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
-+   static const png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
-    */
- #endif
- 
-    png_ptr->row_number++;
-    if (png_ptr->row_number < png_ptr->num_rows)
-       return;
- 
- #ifdef PNG_READ_INTERLACING_SUPPORTED
-diff --git a/media/libpng/pngpriv.h b/media/libpng/pngpriv.h
---- a/media/libpng/pngpriv.h
-+++ b/media/libpng/pngpriv.h
-@@ -1,15 +1,15 @@
- 
- /* pngpriv.h - private declarations for use inside libpng
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018-2019 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- /* The symbols declared in this file (including the functions declared
-  * as extern) are PRIVATE.  They are not part of the libpng public
-@@ -169,17 +169,20 @@
-              */
- #           if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
- #              define PNG_ARM_NEON_IMPLEMENTATION 2
- #           endif /* no GNUC support */
- #        endif /* __GNUC__ */
- #     else /* !defined __ARM_NEON__ */
-          /* The 'intrinsics' code simply won't compile without this -mfpu=neon:
-           */
--#        define PNG_ARM_NEON_IMPLEMENTATION 2
-+#        if !defined(__aarch64__)
-+            /* The assembler code currently does not work on ARM64 */
-+#          define PNG_ARM_NEON_IMPLEMENTATION 2
-+#        endif /* __aarch64__ */
- #     endif /* __ARM_NEON__ */
- #  endif /* !PNG_ARM_NEON_IMPLEMENTATION */
- 
- #  ifndef PNG_ARM_NEON_IMPLEMENTATION
-       /* Use the intrinsics code by default. */
- #     define PNG_ARM_NEON_IMPLEMENTATION 1
- #  endif
- #endif /* PNG_ARM_NEON_OPT > 0 */
-@@ -1543,20 +1546,20 @@ PNG_INTERNAL_FUNCTION(void,png_handle_tR
- #endif
- 
- #ifdef PNG_READ_zTXt_SUPPORTED
- PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
-     png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
- #endif
- 
- PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
--    const png_uint_32 chunk_name),PNG_EMPTY);
-+    png_uint_32 chunk_name),PNG_EMPTY);
- 
- PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
--    const png_uint_32 chunk_length),PNG_EMPTY);
-+    png_uint_32 chunk_length),PNG_EMPTY);
- 
- PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
-     png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
-    /* This is the function that gets called for unknown chunks.  The 'keep'
-     * argument is either non-zero for a known chunk that has been set to be
-     * handled as unknown or zero for an unknown chunk.  By default the function
-     * just skips the chunk or errors out if it is critical.
-     */
-@@ -2166,16 +2169,39 @@ PNG_INTERNAL_FUNCTION(void, png_init_fil
- PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
-    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
- #  endif
- #endif
- 
- PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
-    png_const_charp key, png_bytep new_key), PNG_EMPTY);
- 
-+#if PNG_ARM_NEON_IMPLEMENTATION == 1
-+PNG_INTERNAL_FUNCTION(void,
-+                      png_riffle_palette_neon,
-+                      (png_structrp),
-+                      PNG_EMPTY);
-+PNG_INTERNAL_FUNCTION(int,
-+                      png_do_expand_palette_rgba8_neon,
-+                      (png_structrp,
-+                       png_row_infop,
-+                       png_const_bytep,
-+                       const png_bytepp,
-+                       const png_bytepp),
-+                      PNG_EMPTY);
-+PNG_INTERNAL_FUNCTION(int,
-+                      png_do_expand_palette_rgb8_neon,
-+                      (png_structrp,
-+                       png_row_infop,
-+                       png_const_bytep,
-+                       const png_bytepp,
-+                       const png_bytepp),
-+                      PNG_EMPTY);
-+#endif
-+
- /* Maintainer: Put new private prototypes here ^ */
- 
- #include "pngdebug.h"
- 
- #ifdef __cplusplus
- }
- #endif
- 
-diff --git a/media/libpng/pngread.c b/media/libpng/pngread.c
---- a/media/libpng/pngread.c
-+++ b/media/libpng/pngread.c
-@@ -1,15 +1,15 @@
- 
- /* pngread.c - read a PNG file
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018-2019 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file contains routines that an application calls directly to
-  * read a PNG file or stream.
-  */
-@@ -1069,16 +1069,22 @@ png_read_destroy(png_structrp png_ptr)
-    png_ptr->unknown_chunk.data = NULL;
- #endif
- 
- #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
-    png_free(png_ptr, png_ptr->chunk_list);
-    png_ptr->chunk_list = NULL;
- #endif
- 
-+#if defined(PNG_READ_EXPAND_SUPPORTED) && \
-+    defined(PNG_ARM_NEON_IMPLEMENTATION)
-+   png_free(png_ptr, png_ptr->riffled_palette);
-+   png_ptr->riffled_palette = NULL;
-+#endif
-+
-    /* NOTE: the 'setjmp' buffer may still be allocated and the memory and error
-     * callbacks are still set at this point.  They are required to complete the
-     * destruction of the png_struct itself.
-     */
- }
- 
- /* Free all memory used by the read */
- void PNGAPI
-@@ -1696,17 +1702,17 @@ png_image_skip_unused_chunks(png_structr
-     * potential vulnerability to security problems in the unused chunks.
-     *
-     * At present the iCCP chunk data isn't used, so iCCP chunk can be ignored
-     * too.  This allows the simplified API to be compiled without iCCP support,
-     * however if the support is there the chunk is still checked to detect
-     * errors (which are unfortunately quite common.)
-     */
-    {
--         static PNG_CONST png_byte chunks_to_process[] = {
-+         static const png_byte chunks_to_process[] = {
-             98,  75,  71,  68, '\0',  /* bKGD */
-             99,  72,  82,  77, '\0',  /* cHRM */
-            103,  65,  77,  65, '\0',  /* gAMA */
- #        ifdef PNG_READ_iCCP_SUPPORTED
-            105,  67,  67,  80, '\0',  /* iCCP */
- #        endif
-            115,  66,  73,  84, '\0',  /* sBIT */
-            115,  82,  71,  66, '\0',  /* sRGB */
-@@ -1833,19 +1839,19 @@ png_colormap_compose(png_image_read_cont
-  * be 8-bit.
-  */
- static void
- png_create_colormap_entry(png_image_read_control *display,
-     png_uint_32 ip, png_uint_32 red, png_uint_32 green, png_uint_32 blue,
-     png_uint_32 alpha, int encoding)
- {
-    png_imagep image = display->image;
--   const int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ?
-+   int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ?
-        P_LINEAR : P_sRGB;
--   const int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 &&
-+   int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 &&
-        (red != green || green != blue);
- 
-    if (ip > 255)
-       png_error(image->opaque->png_ptr, "color-map index out of range");
- 
-    /* Update the cache with whether the file gamma is significantly different
-     * from sRGB.
-     */
-@@ -1944,23 +1950,23 @@ png_create_colormap_entry(png_image_read
-    }
- 
-    if (encoding != output_encoding)
-       png_error(image->opaque->png_ptr, "bad encoding (internal error)");
- 
-    /* Store the value. */
-    {
- #     ifdef PNG_FORMAT_AFIRST_SUPPORTED
--         const int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
-+         int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
-             (image->format & PNG_FORMAT_FLAG_ALPHA) != 0;
- #     else
- #        define afirst 0
- #     endif
- #     ifdef PNG_FORMAT_BGR_SUPPORTED
--         const int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0;
-+         int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0;
- #     else
- #        define bgr 0
- #     endif
- 
-       if (output_encoding == P_LINEAR)
-       {
-          png_uint_16p entry = png_voidcast(png_uint_16p, display->colormap);
- 
-@@ -2160,21 +2166,21 @@ make_rgb_colormap(png_image_read_control
- #define PNG_RGB_INDEX(r,g,b) \
-    ((png_byte)(6 * (6 * PNG_DIV51(r) + PNG_DIV51(g)) + PNG_DIV51(b)))
- 
- static int
- png_image_read_colormap(png_voidp argument)
- {
-    png_image_read_control *display =
-       png_voidcast(png_image_read_control*, argument);
--   const png_imagep image = display->image;
--
--   const png_structrp png_ptr = image->opaque->png_ptr;
--   const png_uint_32 output_format = image->format;
--   const int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ?
-+   png_imagep image = display->image;
-+
-+   png_structrp png_ptr = image->opaque->png_ptr;
-+   png_uint_32 output_format = image->format;
-+   int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ?
-       P_LINEAR : P_sRGB;
- 
-    unsigned int cmap_entries;
-    unsigned int output_processing;        /* Output processing option */
-    unsigned int data_encoding = P_NOTSET; /* Encoding libpng must produce */
- 
-    /* Background information; the background color and the index of this color
-     * in the color-map if it exists (else 256).
-@@ -2877,17 +2883,17 @@ png_image_read_colormap(png_voidp argume
-       case PNG_COLOR_TYPE_PALETTE:
-          /* It's already got a color-map.  It may be necessary to eliminate the
-           * tRNS entries though.
-           */
-          {
-             unsigned int num_trans = png_ptr->num_trans;
-             png_const_bytep trans = num_trans > 0 ? png_ptr->trans_alpha : NULL;
-             png_const_colorp colormap = png_ptr->palette;
--            const int do_background = trans != NULL &&
-+            int do_background = trans != NULL &&
-                (output_format & PNG_FORMAT_FLAG_ALPHA) == 0;
-             unsigned int i;
- 
-             /* Just in case: */
-             if (trans == NULL)
-                num_trans = 0;
- 
-             output_processing = PNG_CMAP_NONE;
-@@ -4021,17 +4027,17 @@ png_image_read_direct(png_voidp argument
-          }
- #     endif
- 
-       /* If the *output* is 16-bit then we need to check for a byte-swap on this
-        * architecture.
-        */
-       if (linear != 0)
-       {
--         PNG_CONST png_uint_16 le = 0x0001;
-+         png_uint_16 le = 0x0001;
- 
-          if ((*(png_const_bytep) & le) != 0)
-             png_set_swap(png_ptr);
-       }
- 
-       /* If change is not now 0 some transformation is missing - error out. */
-       if (change != 0)
-          png_error(png_ptr, "png_read_image: unsupported transformation");
-@@ -4183,28 +4189,28 @@ png_image_finish_read(png_imagep image, 
-     void *buffer, png_int_32 row_stride, void *colormap)
- {
-    if (image != NULL && image->version == PNG_IMAGE_VERSION)
-    {
-       /* Check for row_stride overflow.  This check is not performed on the
-        * original PNG format because it may not occur in the output PNG format
-        * and libpng deals with the issues of reading the original.
-        */
--      const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
-+      unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
- 
-       /* The following checks just the 'row_stride' calculation to ensure it
-        * fits in a signed 32-bit value.  Because channels/components can be
-        * either 1 or 2 bytes in size the length of a row can still overflow 32
-        * bits; this is just to verify that the 'row_stride' argument can be
-        * represented.
-        */
-       if (image->width <= 0x7fffffffU/channels) /* no overflow */
-       {
-          png_uint_32 check;
--         const png_uint_32 png_row_stride = image->width * channels;
-+         png_uint_32 png_row_stride = image->width * channels;
- 
-          if (row_stride == 0)
-             row_stride = (png_int_32)/*SAFE*/png_row_stride;
- 
-          if (row_stride < 0)
-             check = (png_uint_32)(-row_stride);
- 
-          else
-diff --git a/media/libpng/pngrio.c b/media/libpng/pngrio.c
---- a/media/libpng/pngrio.c
-+++ b/media/libpng/pngrio.c
-@@ -1,15 +1,15 @@
- 
- /* pngrio.c - functions for data input
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file provides a location for all input.  Users who need
-  * special handling are expected to write a function that has the same
-  * arguments as this and performs a similar function, but that possibly
-diff --git a/media/libpng/pngrtran.c b/media/libpng/pngrtran.c
---- a/media/libpng/pngrtran.c
-+++ b/media/libpng/pngrtran.c
-@@ -1,28 +1,39 @@
- 
- /* pngrtran.c - transforms the data in a row for PNG readers
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018-2019 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file contains functions optionally called by an application
-  * in order to tell libpng how to handle data when reading a PNG.
-  * Transformations that are used in both reading and writing are
-  * in pngtrans.c.
-  */
- 
- #include "pngpriv.h"
- 
-+#ifdef PNG_ARM_NEON_IMPLEMENTATION
-+#  if PNG_ARM_NEON_IMPLEMENTATION == 1
-+#    define PNG_ARM_NEON_INTRINSICS_AVAILABLE
-+#    if defined(_MSC_VER) && defined(_M_ARM64) && !defined(__clang__)
-+#      include <arm64_neon.h>
-+#    else
-+#      include <arm_neon.h>
-+#    endif
-+#  endif
-+#endif
-+
- #ifdef PNG_READ_SUPPORTED
- 
- /* Set the action on getting a CRC error for an ancillary or critical chunk. */
- void PNGAPI
- png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action)
- {
-    png_debug(1, "in png_set_crc_action");
- 
-@@ -1166,30 +1177,30 @@ png_init_palette_transformations(png_str
-          png_ptr->background.red   =
-              png_ptr->palette[png_ptr->background.index].red;
-          png_ptr->background.green =
-              png_ptr->palette[png_ptr->background.index].green;
-          png_ptr->background.blue  =
-              png_ptr->palette[png_ptr->background.index].blue;
- 
- #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
--        if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
--        {
--           if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0)
--           {
--              /* Invert the alpha channel (in tRNS) unless the pixels are
--               * going to be expanded, in which case leave it for later
--               */
--              int i, istop = png_ptr->num_trans;
--
--              for (i=0; i<istop; i++)
--                 png_ptr->trans_alpha[i] = (png_byte)(255 -
--                    png_ptr->trans_alpha[i]);
--           }
--        }
-+         if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
-+         {
-+            if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0)
-+            {
-+               /* Invert the alpha channel (in tRNS) unless the pixels are
-+                * going to be expanded, in which case leave it for later
-+                */
-+               int i, istop = png_ptr->num_trans;
-+
-+               for (i = 0; i < istop; i++)
-+                  png_ptr->trans_alpha[i] =
-+                      (png_byte)(255 - png_ptr->trans_alpha[i]);
-+            }
-+         }
- #endif /* READ_INVERT_ALPHA */
-       }
-    } /* background expand and (therefore) no alpha association. */
- #endif /* READ_EXPAND && READ_BACKGROUND */
- }
- 
- static void /* PRIVATE */
- png_init_rgb_transformations(png_structrp png_ptr)
-@@ -2981,31 +2992,29 @@ png_do_gray_to_rgb(png_row_infop row_inf
-  *
-  *  Other integer coefficients can be used via png_set_rgb_to_gray().  Because
-  *  the API takes just red and green coefficients the blue coefficient is
-  *  calculated to make the sum 32768.  This will result in different rounding
-  *  to that used above.
-  */
- static int
- png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
--
- {
-    int rgb_error = 0;
- 
-    png_debug(1, "in png_do_rgb_to_gray");
- 
-    if ((row_info->color_type & PNG_COLOR_MASK_PALETTE) == 0 &&
-        (row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
-    {
--      PNG_CONST png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff;
--      PNG_CONST png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff;
--      PNG_CONST png_uint_32 bc = 32768 - rc - gc;
--      PNG_CONST png_uint_32 row_width = row_info->width;
--      PNG_CONST int have_alpha =
--         (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0;
-+      png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff;
-+      png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff;
-+      png_uint_32 bc = 32768 - rc - gc;
-+      png_uint_32 row_width = row_info->width;
-+      int have_alpha = (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0;
- 
-       if (row_info->bit_depth == 8)
-       {
- #ifdef PNG_READ_GAMMA_SUPPORTED
-          /* Notice that gamma to/from 1 are not necessarily inverses (if
-           * there is an overall gamma correction).  Prior to 1.5.5 this code
-           * checked the linearized values for equality; this doesn't match
-           * the documentation, the original values must be checked.
-@@ -4138,42 +4147,40 @@ png_do_encode_alpha(png_row_infop row_in
-    png_uint_32 row_width = row_info->width;
- 
-    png_debug(1, "in png_do_encode_alpha");
- 
-    if ((row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0)
-    {
-       if (row_info->bit_depth == 8)
-       {
--         PNG_CONST png_bytep table = png_ptr->gamma_from_1;
-+         png_bytep table = png_ptr->gamma_from_1;
- 
-          if (table != NULL)
-          {
--            PNG_CONST int step =
--               (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 4 : 2;
-+            int step = (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 4 : 2;
- 
-             /* The alpha channel is the last component: */
-             row += step - 1;
- 
-             for (; row_width > 0; --row_width, row += step)
-                *row = table[*row];
- 
-             return;
-          }
-       }
- 
-       else if (row_info->bit_depth == 16)
-       {
--         PNG_CONST png_uint_16pp table = png_ptr->gamma_16_from_1;
--         PNG_CONST int gamma_shift = png_ptr->gamma_shift;
-+         png_uint_16pp table = png_ptr->gamma_16_from_1;
-+         int gamma_shift = png_ptr->gamma_shift;
- 
-          if (table != NULL)
-          {
--            PNG_CONST int step =
--               (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 8 : 4;
-+            int step = (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 8 : 4;
- 
-             /* The alpha channel is the last component: */
-             row += step - 2;
- 
-             for (; row_width > 0; --row_width, row += step)
-             {
-                png_uint_16 v;
- 
-@@ -4194,18 +4201,19 @@ png_do_encode_alpha(png_row_infop row_in
- }
- #endif
- 
- #ifdef PNG_READ_EXPAND_SUPPORTED
- /* Expands a palette row to an RGB or RGBA row depending
-  * upon whether you supply trans and num_trans.
-  */
- static void
--png_do_expand_palette(png_row_infop row_info, png_bytep row,
--    png_const_colorp palette, png_const_bytep trans_alpha, int num_trans)
-+png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info,
-+    png_bytep row, png_const_colorp palette, png_const_bytep trans_alpha,
-+    int num_trans)
- {
-    int shift, value;
-    png_bytep sp, dp;
-    png_uint_32 i;
-    png_uint_32 row_width=row_info->width;
- 
-    png_debug(1, "in png_do_expand_palette");
- 
-@@ -4299,42 +4307,62 @@ png_do_expand_palette(png_row_infop row_
-       if (row_info->bit_depth == 8)
-       {
-          {
-             if (num_trans > 0)
-             {
-                sp = row + (size_t)row_width - 1;
-                dp = row + ((size_t)row_width << 2) - 1;
- 
--               for (i = 0; i < row_width; i++)
-+               i = 0;
-+#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
-+               if (png_ptr->riffled_palette != NULL)
-+               {
-+                  /* The RGBA optimization works with png_ptr->bit_depth == 8
-+                   * but sometimes row_info->bit_depth has been changed to 8.
-+                   * In these cases, the palette hasn't been riffled.
-+                   */
-+                  i = png_do_expand_palette_rgba8_neon(png_ptr, row_info, row,
-+                      &sp, &dp);
-+               }
-+#else
-+               PNG_UNUSED(png_ptr)
-+#endif
-+
-+               for (; i < row_width; i++)
-                {
-                   if ((int)(*sp) >= num_trans)
-                      *dp-- = 0xff;
--
-                   else
-                      *dp-- = trans_alpha[*sp];
--
-                   *dp-- = palette[*sp].blue;
-                   *dp-- = palette[*sp].green;
-                   *dp-- = palette[*sp].red;
-                   sp--;
-                }
-                row_info->bit_depth = 8;
-                row_info->pixel_depth = 32;
-                row_info->rowbytes = row_width * 4;
-                row_info->color_type = 6;
-                row_info->channels = 4;
-             }
- 
-             else
-             {
-                sp = row + (size_t)row_width - 1;
-                dp = row + (size_t)(row_width * 3) - 1;
--
--               for (i = 0; i < row_width; i++)
-+               i = 0;
-+#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
-+               i = png_do_expand_palette_rgb8_neon(png_ptr, row_info, row,
-+                   &sp, &dp);
-+#else
-+               PNG_UNUSED(png_ptr)
-+#endif
-+
-+               for (; i < row_width; i++)
-                {
-                   *dp-- = palette[*sp].blue;
-                   *dp-- = palette[*sp].green;
-                   *dp-- = palette[*sp].red;
-                   sp--;
-                }
- 
-                row_info->bit_depth = 8;
-@@ -4738,17 +4766,29 @@ png_do_read_transformations(png_structrp
-       png_error(png_ptr, "Uninitialized row");
-    }
- 
- #ifdef PNG_READ_EXPAND_SUPPORTED
-    if ((png_ptr->transformations & PNG_EXPAND) != 0)
-    {
-       if (row_info->color_type == PNG_COLOR_TYPE_PALETTE)
-       {
--         png_do_expand_palette(row_info, png_ptr->row_buf + 1,
-+#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
-+         if ((png_ptr->num_trans > 0) && (png_ptr->bit_depth == 8))
-+         {
-+            if (png_ptr->riffled_palette == NULL)
-+            {
-+               /* Initialize the accelerated palette expansion. */
-+               png_ptr->riffled_palette =
-+                   (png_bytep)png_malloc(png_ptr, 256 * 4);
-+               png_riffle_palette_neon(png_ptr);
-+            }
-+         }
-+#endif
-+         png_do_expand_palette(png_ptr, row_info, png_ptr->row_buf + 1,
-              png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
-       }
- 
-       else
-       {
-          if (png_ptr->num_trans != 0 &&
-              (png_ptr->transformations & PNG_EXPAND_tRNS) != 0)
-             png_do_expand(row_info, png_ptr->row_buf + 1,
-diff --git a/media/libpng/pngrutil.c b/media/libpng/pngrutil.c
---- a/media/libpng/pngrutil.c
-+++ b/media/libpng/pngrutil.c
-@@ -1,15 +1,15 @@
- 
- /* pngrutil.c - utilities to read a PNG file
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file contains routines that are only called from within
-  * libpng itself during the course of reading an image.
-  */
-@@ -1461,36 +1461,35 @@ png_handle_iCCP(png_structrp png_ptr, pn
-                (void)png_inflate_read(png_ptr, local_buffer,
-                    (sizeof local_buffer), &length, profile_header, &size,
-                    0/*finish: don't, because the output is too small*/);
- 
-                if (size == 0)
-                {
-                   /* We have the ICC profile header; do the basic header checks.
-                    */
--                  const png_uint_32 profile_length =
--                     png_get_uint_32(profile_header);
-+                  png_uint_32 profile_length = png_get_uint_32(profile_header);
- 
-                   if (png_icc_check_length(png_ptr, &png_ptr->colorspace,
-                       keyword, profile_length) != 0)
-                   {
-                      /* The length is apparently ok, so we can check the 132
-                       * byte header.
-                       */
-                      if (png_icc_check_header(png_ptr, &png_ptr->colorspace,
-                          keyword, profile_length, profile_header,
-                          png_ptr->color_type) != 0)
-                      {
-                         /* Now read the tag table; a variable size buffer is
-                          * needed at this point, allocate one for the whole
-                          * profile.  The header check has already validated
-                          * that none of this stuff will overflow.
-                          */
--                        const png_uint_32 tag_count = png_get_uint_32(
--                            profile_header+128);
-+                        png_uint_32 tag_count =
-+                           png_get_uint_32(profile_header + 128);
-                         png_bytep profile = png_read_buffer(png_ptr,
-                             profile_length, 2/*silent*/);
- 
-                         if (profile != NULL)
-                         {
-                            memcpy(profile, profile_header,
-                                (sizeof profile_header));
- 
-@@ -3306,17 +3305,17 @@ png_handle_unknown(png_structrp png_ptr,
-  */
- 
- /* Bit hacking: the test for an invalid byte in the 4 byte chunk name is:
-  *
-  * ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
-  */
- 
- void /* PRIVATE */
--png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name)
-+png_check_chunk_name(png_const_structrp png_ptr, png_uint_32 chunk_name)
- {
-    int i;
-    png_uint_32 cn=chunk_name;
- 
-    png_debug(1, "in png_check_chunk_name");
- 
-    for (i=1; i<=4; ++i)
-    {
-@@ -3325,17 +3324,17 @@ png_check_chunk_name(png_const_structrp 
-       if (c < 65 || c > 122 || (c > 90 && c < 97))
-          png_chunk_error(png_ptr, "invalid chunk type");
- 
-       cn >>= 8;
-    }
- }
- 
- void /* PRIVATE */
--png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
-+png_check_chunk_length(png_const_structrp png_ptr, png_uint_32 length)
- {
-    png_alloc_size_t limit = PNG_UINT_31_MAX;
- 
- # ifdef PNG_SET_USER_LIMITS_SUPPORTED
-    if (png_ptr->user_chunk_malloc_max > 0 &&
-        png_ptr->user_chunk_malloc_max < limit)
-       limit = png_ptr->user_chunk_malloc_max;
- # elif PNG_USER_CHUNK_MALLOC_MAX > 0
-@@ -3541,28 +3540,28 @@ png_combine_row(png_const_structrp png_p
- 
- #        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
- 
- #        define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
- 
-          /* Hence the pre-compiled masks indexed by PACKSWAP (or not), depth and
-           * then pass:
-           */
--         static PNG_CONST png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] =
-+         static const png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] =
-          {
-             /* Little-endian byte masks for PACKSWAP */
-             { S_MASKS(1,0), S_MASKS(2,0), S_MASKS(4,0) },
-             /* Normal (big-endian byte) masks - PNG format */
-             { S_MASKS(1,1), S_MASKS(2,1), S_MASKS(4,1) }
-          };
- 
-          /* display_mask has only three entries for the odd passes, so index by
-           * pass>>1.
-           */
--         static PNG_CONST png_uint_32 display_mask[2][3][3] =
-+         static const png_uint_32 display_mask[2][3][3] =
-          {
-             /* Little-endian byte masks for PACKSWAP */
-             { B_MASKS(1,0), B_MASKS(2,0), B_MASKS(4,0) },
-             /* Normal (big-endian byte) masks - PNG format */
-             { B_MASKS(1,1), B_MASKS(2,1), B_MASKS(4,1) }
-          };
- 
- #        define MASK(pass,depth,display,png)\
-@@ -3865,17 +3864,17 @@ png_combine_row(png_const_structrp png_p
- 
- #ifdef PNG_READ_INTERLACING_SUPPORTED
- void /* PRIVATE */
- png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
-     png_uint_32 transformations /* Because these may affect the byte layout */)
- {
-    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
-    /* Offset to next interlace block */
--   static PNG_CONST unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-+   static const unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
- 
-    png_debug(1, "in png_do_read_interlace");
-    if (row != NULL && row_info != NULL)
-    {
-       png_uint_32 final_width;
- 
-       final_width = row_info->width * png_pass_inc[pass];
- 
-@@ -4543,26 +4542,26 @@ png_read_finish_IDAT(png_structrp png_pt
- }
- 
- void /* PRIVATE */
- png_read_finish_row(png_structrp png_ptr)
- {
-    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
- 
-    /* Start of interlace block */
--   static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
-+   static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
- 
-    /* Offset to next interlace block */
--   static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-+   static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
- 
-    /* Start of interlace block in the y direction */
--   static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
-+   static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
- 
-    /* Offset to next interlace block in the y direction */
--   static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
-+   static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
- 
-    png_debug(1, "in png_read_finish_row");
-    png_ptr->row_number++;
-    if (png_ptr->row_number < png_ptr->num_rows)
-       return;
- 
-    if (png_ptr->interlaced != 0)
-    {
-@@ -4608,26 +4607,26 @@ png_read_finish_row(png_structrp png_ptr
- #endif /* SEQUENTIAL_READ */
- 
- void /* PRIVATE */
- png_read_start_row(png_structrp png_ptr)
- {
-    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
- 
-    /* Start of interlace block */
--   static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
-+   static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
- 
-    /* Offset to next interlace block */
--   static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-+   static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
- 
-    /* Start of interlace block in the y direction */
--   static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
-+   static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
- 
-    /* Offset to next interlace block in the y direction */
--   static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
-+   static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
- 
-    unsigned int max_pixel_depth;
-    size_t row_bytes;
- 
-    png_debug(1, "in png_read_start_row");
- 
- #ifdef PNG_READ_TRANSFORMS_SUPPORTED
-    png_init_read_transformations(png_ptr);
-diff --git a/media/libpng/pngset.c b/media/libpng/pngset.c
---- a/media/libpng/pngset.c
-+++ b/media/libpng/pngset.c
-@@ -1,15 +1,15 @@
- 
- /* pngset.c - storage of image information into info struct
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * The functions here are used during reads to store data from the file
-  * into the info struct, and during writes to store application data
-  * into the info struct for writing into the file.  This abstracts the
-@@ -132,26 +132,26 @@ png_set_cHRM_XYZ(png_const_structrp png_
- }
- #  endif /* FLOATING_POINT */
- 
- #endif /* cHRM */
- 
- #ifdef PNG_eXIf_SUPPORTED
- void PNGAPI
- png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
--    const png_bytep eXIf_buf)
-+    png_bytep eXIf_buf)
- {
-   png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1");
-   PNG_UNUSED(info_ptr)
-   PNG_UNUSED(eXIf_buf)
- }
- 
- void PNGAPI
- png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr,
--    const png_uint_32 num_exif, const png_bytep eXIf_buf)
-+    png_uint_32 num_exif, png_bytep eXIf_buf)
- {
-    int i;
- 
-    png_debug1(1, "in %s storage function", "eXIf");
- 
-    if (png_ptr == NULL || info_ptr == NULL)
-       return;
- 
-@@ -1539,17 +1539,17 @@ png_set_keep_unknown_chunks(png_structrp
-         return;
-    }
- 
-    if (num_chunks_in < 0)
-    {
-       /* Ignore all unknown chunks and all chunks recognized by
-        * libpng except for IHDR, PLTE, tRNS, IDAT, and IEND
-        */
--      static PNG_CONST png_byte chunks_to_ignore[] = {
-+      static const png_byte chunks_to_ignore[] = {
-          98,  75,  71,  68, '\0',  /* bKGD */
-          99,  72,  82,  77, '\0',  /* cHRM */
-         101,  88,  73, 102, '\0',  /* eXIf */
-         103,  65,  77,  65, '\0',  /* gAMA */
-         104,  73,  83,  84, '\0',  /* hIST */
-         105,  67,  67,  80, '\0',  /* iCCP */
-         105,  84,  88, 116, '\0',  /* iTXt */
-         111,  70,  70, 115, '\0',  /* oFFs */
-diff --git a/media/libpng/pngstruct.h b/media/libpng/pngstruct.h
---- a/media/libpng/pngstruct.h
-+++ b/media/libpng/pngstruct.h
-@@ -1,15 +1,15 @@
- 
- /* pngstruct.h - header file for PNG reference library
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018-2019 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- /* The structure that holds the information to read and write PNG files.
-  * The only people who need to care about what is inside of this are the
-@@ -387,16 +387,22 @@ struct png_struct_def
-    /* Added in libpng 1.5.5 to record setting of coefficients: */
-    png_byte rgb_to_gray_coefficients_set;
-    /* These were changed from png_byte in libpng-1.0.6 */
-    png_uint_16 rgb_to_gray_red_coeff;
-    png_uint_16 rgb_to_gray_green_coeff;
-    /* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
- #endif
- 
-+/* New member added in libpng-1.6.36 */
-+#if defined(PNG_READ_EXPAND_SUPPORTED) && \
-+    defined(PNG_ARM_NEON_IMPLEMENTATION)
-+   png_bytep riffled_palette; /* buffer for accelerated palette expansion */
-+#endif
-+
- /* New member added in libpng-1.0.4 (renamed in 1.0.9) */
- #if defined(PNG_MNG_FEATURES_SUPPORTED)
- /* Changed from png_byte to png_uint_32 at version 1.2.0 */
-    png_uint_32 mng_features_permitted;
- #endif
- 
- /* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
- #ifdef PNG_MNG_FEATURES_SUPPORTED
-diff --git a/media/libpng/pngtrans.c b/media/libpng/pngtrans.c
---- a/media/libpng/pngtrans.c
-+++ b/media/libpng/pngtrans.c
-@@ -1,15 +1,15 @@
- 
- /* pngtrans.c - transforms the data in a row (used by both readers and writers)
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- #include "pngpriv.h"
- 
-@@ -340,17 +340,17 @@ png_do_swap(png_row_infop row_info, png_
- #endif
-       }
-    }
- }
- #endif
- #endif
- 
- #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
--static PNG_CONST png_byte onebppswaptable[256] = {
-+static const png_byte onebppswaptable[256] = {
-    0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
-    0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
-    0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
-    0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
-    0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4,
-    0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
-    0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC,
-    0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
-@@ -375,17 +375,17 @@ static PNG_CONST png_byte onebppswaptabl
-    0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
-    0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
-    0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7,
-    0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
-    0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF,
-    0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
- };
- 
--static PNG_CONST png_byte twobppswaptable[256] = {
-+static const png_byte twobppswaptable[256] = {
-    0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0,
-    0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0,
-    0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4,
-    0x24, 0x64, 0xA4, 0xE4, 0x34, 0x74, 0xB4, 0xF4,
-    0x08, 0x48, 0x88, 0xC8, 0x18, 0x58, 0x98, 0xD8,
-    0x28, 0x68, 0xA8, 0xE8, 0x38, 0x78, 0xB8, 0xF8,
-    0x0C, 0x4C, 0x8C, 0xCC, 0x1C, 0x5C, 0x9C, 0xDC,
-    0x2C, 0x6C, 0xAC, 0xEC, 0x3C, 0x7C, 0xBC, 0xFC,
-@@ -410,17 +410,17 @@ static PNG_CONST png_byte twobppswaptabl
-    0x07, 0x47, 0x87, 0xC7, 0x17, 0x57, 0x97, 0xD7,
-    0x27, 0x67, 0xA7, 0xE7, 0x37, 0x77, 0xB7, 0xF7,
-    0x0B, 0x4B, 0x8B, 0xCB, 0x1B, 0x5B, 0x9B, 0xDB,
-    0x2B, 0x6B, 0xAB, 0xEB, 0x3B, 0x7B, 0xBB, 0xFB,
-    0x0F, 0x4F, 0x8F, 0xCF, 0x1F, 0x5F, 0x9F, 0xDF,
-    0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF
- };
- 
--static PNG_CONST png_byte fourbppswaptable[256] = {
-+static const png_byte fourbppswaptable[256] = {
-    0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
-    0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0,
-    0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,
-    0x81, 0x91, 0xA1, 0xB1, 0xC1, 0xD1, 0xE1, 0xF1,
-    0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x62, 0x72,
-    0x82, 0x92, 0xA2, 0xB2, 0xC2, 0xD2, 0xE2, 0xF2,
-    0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73,
-    0x83, 0x93, 0xA3, 0xB3, 0xC3, 0xD3, 0xE3, 0xF3,
-diff --git a/media/libpng/pngwio.c b/media/libpng/pngwio.c
---- a/media/libpng/pngwio.c
-+++ b/media/libpng/pngwio.c
-@@ -1,15 +1,15 @@
- 
- /* pngwio.c - functions for data output
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2014,2016,2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  *
-  * This file provides a location for all output.  Users who need
-  * special handling are expected to write functions that have the same
-  * arguments as these and perform similar functions, but that possibly
-diff --git a/media/libpng/pngwrite.c b/media/libpng/pngwrite.c
---- a/media/libpng/pngwrite.c
-+++ b/media/libpng/pngwrite.c
-@@ -1,15 +1,15 @@
- 
- /* pngwrite.c - general routines to write a PNG file
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018-2019 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- #include "pngpriv.h"
- #ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
-@@ -473,17 +473,17 @@ png_write_end(png_structrp png_ptr, png_
- #  ifdef PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED
-    png_flush(png_ptr);
- #  endif
- #endif
- }
- 
- #ifdef PNG_CONVERT_tIME_SUPPORTED
- void PNGAPI
--png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm * ttime)
-+png_convert_from_struct_tm(png_timep ptime, const struct tm * ttime)
- {
-    png_debug(1, "in png_convert_from_struct_tm");
- 
-    ptime->year = (png_uint_16)(1900 + ttime->tm_year);
-    ptime->month = (png_byte)(ttime->tm_mon + 1);
-    ptime->day = (png_byte)ttime->tm_mday;
-    ptime->hour = (png_byte)ttime->tm_hour;
-    ptime->minute = (png_byte)ttime->tm_min;
-@@ -1540,17 +1540,17 @@ png_write_image_16bit(png_voidp argument
-        argument);
-    png_imagep image = display->image;
-    png_structrp png_ptr = image->opaque->png_ptr;
- 
-    png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
-        display->first_row);
-    png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
-    png_uint_16p row_end;
--   const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
-+   unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
-        3 : 1;
-    int aindex = 0;
-    png_uint_32 y = image->height;
- 
-    if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
-    {
- #   ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
-       if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
-@@ -1577,17 +1577,17 @@ png_write_image_16bit(png_voidp argument
- 
-    for (; y > 0; --y)
-    {
-       png_const_uint_16p in_ptr = input_row;
-       png_uint_16p out_ptr = output_row;
- 
-       while (out_ptr < row_end)
-       {
--         const png_uint_16 alpha = in_ptr[aindex];
-+         png_uint_16 alpha = in_ptr[aindex];
-          png_uint_32 reciprocal = 0;
-          int c;
- 
-          out_ptr[aindex] = alpha;
- 
-          /* Calculate a reciprocal.  The correct calculation is simply
-           * component/alpha*65535 << 15. (I.e. 15 bits of precision); this
-           * allows correct rounding by adding .5 before the shift.  'reciprocal'
-@@ -1699,17 +1699,17 @@ png_write_image_8bit(png_voidp argument)
-        argument);
-    png_imagep image = display->image;
-    png_structrp png_ptr = image->opaque->png_ptr;
- 
-    png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
-        display->first_row);
-    png_bytep output_row = png_voidcast(png_bytep, display->local_row);
-    png_uint_32 y = image->height;
--   const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
-+   unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
-        3 : 1;
- 
-    if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
-    {
-       png_bytep row_end;
-       int aindex;
- 
- #   ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
-@@ -1787,35 +1787,35 @@ png_write_image_8bit(png_voidp argument)
-    }
- 
-    return 1;
- }
- 
- static void
- png_image_set_PLTE(png_image_write_control *display)
- {
--   const png_imagep image = display->image;
-+   png_imagep image = display->image;
-    const void *cmap = display->colormap;
--   const int entries = image->colormap_entries > 256 ? 256 :
-+   int entries = image->colormap_entries > 256 ? 256 :
-        (int)image->colormap_entries;
- 
-    /* NOTE: the caller must check for cmap != NULL and entries != 0 */
--   const png_uint_32 format = image->format;
--   const unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
-+   png_uint_32 format = image->format;
-+   unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
- 
- #   if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
-       defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
--      const int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
-+      int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
-           (format & PNG_FORMAT_FLAG_ALPHA) != 0;
- #   else
- #     define afirst 0
- #   endif
- 
- #   ifdef PNG_FORMAT_BGR_SUPPORTED
--      const int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0;
-+      int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0;
- #   else
- #     define bgr 0
- #   endif
- 
-    int i, num_trans;
-    png_color palette[256];
-    png_byte tRNS[256];
- 
-@@ -1955,22 +1955,22 @@ png_image_write_main(png_voidp argument)
-       /* Make sure we error out on any bad situation */
-       png_set_benign_errors(png_ptr, 0/*error*/);
- #   endif
- 
-    /* Default the 'row_stride' parameter if required, also check the row stride
-     * and total image size to ensure that they are within the system limits.
-     */
-    {
--      const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
-+      unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
- 
-       if (image->width <= 0x7fffffffU/channels) /* no overflow */
-       {
-          png_uint_32 check;
--         const png_uint_32 png_row_stride = image->width * channels;
-+         png_uint_32 png_row_stride = image->width * channels;
- 
-          if (display->row_stride == 0)
-             display->row_stride = (png_int_32)/*SAFE*/png_row_stride;
- 
-          if (display->row_stride < 0)
-             check = (png_uint_32)(-display->row_stride);
- 
-          else
-@@ -2056,17 +2056,17 @@ png_image_write_main(png_voidp argument)
- 
-    /* Now set up the data transformations (*after* the header is written),
-     * remove the handled transformations from the 'format' flags for checking.
-     *
-     * First check for a little endian system if writing 16-bit files.
-     */
-    if (write_16bit != 0)
-    {
--      PNG_CONST png_uint_16 le = 0x0001;
-+      png_uint_16 le = 0x0001;
- 
-       if ((*(png_const_bytep) & le) != 0)
-          png_set_swap(png_ptr);
-    }
- 
- #   ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
-       if ((format & PNG_FORMAT_FLAG_BGR) != 0)
-       {
-@@ -2170,17 +2170,17 @@ png_image_write_main(png_voidp argument)
- }
- 
- 
- static void (PNGCBAPI
- image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data, size_t size)
- {
-    png_image_write_control *display = png_voidcast(png_image_write_control*,
-        png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/);
--   const png_alloc_size_t ob = display->output_bytes;
-+   png_alloc_size_t ob = display->output_bytes;
- 
-    /* Check for overflow; this should never happen: */
-    if (size <= ((png_alloc_size_t)-1) - ob)
-    {
-       /* I don't think libpng ever does this, but just in case: */
-       if (size > 0)
-       {
-          if (display->memory_bytes >= ob+size) /* writing */
-diff --git a/media/libpng/pngwtran.c b/media/libpng/pngwtran.c
---- a/media/libpng/pngwtran.c
-+++ b/media/libpng/pngwtran.c
-@@ -1,15 +1,15 @@
- 
- /* pngwtran.c - transforms the data in a row for PNG writers
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- #include "pngpriv.h"
- 
-@@ -249,18 +249,17 @@ png_do_shift(png_row_infop row_info, png
-       else if (row_info->bit_depth == 8)
-       {
-          png_bytep bp = row;
-          png_uint_32 i;
-          png_uint_32 istop = channels * row_info->width;
- 
-          for (i = 0; i < istop; i++, bp++)
-          {
--
--            const unsigned int c = i%channels;
-+            unsigned int c = i%channels;
-             int j;
-             unsigned int v, out;
- 
-             v = *bp;
-             out = 0;
- 
-             for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
-             {
-@@ -278,17 +277,17 @@ png_do_shift(png_row_infop row_info, png
-       else
-       {
-          png_bytep bp;
-          png_uint_32 i;
-          png_uint_32 istop = channels * row_info->width;
- 
-          for (bp = row, i = 0; i < istop; i++)
-          {
--            const unsigned int c = i%channels;
-+            unsigned int c = i%channels;
-             int j;
-             unsigned int value, v;
- 
-             v = png_get_uint_16(bp);
-             value = 0;
- 
-             for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
-             {
-diff --git a/media/libpng/pngwutil.c b/media/libpng/pngwutil.c
---- a/media/libpng/pngwutil.c
-+++ b/media/libpng/pngwutil.c
-@@ -1,15 +1,15 @@
- 
- /* pngwutil.c - utilities to write a PNG file
-  *
-- * Last changed in libpng 1.6.35 [July 15, 2018]
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
-- * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
-- * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
-+ * Copyright (c) 1996-1997 Andreas Dilger
-+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
- 
- #include "pngpriv.h"
- 
-@@ -1989,26 +1989,26 @@ png_write_fdAT(png_structp png_ptr,
- /* Initializes the row writing capability of libpng */
- void /* PRIVATE */
- png_write_start_row(png_structrp png_ptr)
- {
- #ifdef PNG_WRITE_INTERLACING_SUPPORTED
-    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
- 
-    /* Start of interlace block */
--   static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
-+   static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
- 
-    /* Offset to next interlace block */
--   static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-+   static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
- 
-    /* Start of interlace block in the y direction */
--   static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
-+   static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
- 
-    /* Offset to next interlace block in the y direction */
--   static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
-+   static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
- #endif
- 
-    png_alloc_size_t buf_size;
-    int usr_pixel_depth;
- 
- #ifdef PNG_WRITE_FILTER_SUPPORTED
-    png_byte filters;
- #endif
-@@ -2104,26 +2104,26 @@ png_write_start_row(png_structrp png_ptr
- /* Internal use only.  Called when finished processing a row of data. */
- void /* PRIVATE */
- png_write_finish_row(png_structrp png_ptr)
- {
- #ifdef PNG_WRITE_INTERLACING_SUPPORTED
-    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
- 
-    /* Start of interlace block */
--   static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
-+   static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
- 
-    /* Offset to next interlace block */
--   static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-+   static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
- 
-    /* Start of interlace block in the y direction */
--   static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
-+   static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
- 
-    /* Offset to next interlace block in the y direction */
--   static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
-+   static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
- #endif
- 
-    png_debug(1, "in png_write_finish_row");
- 
-    /* Next row */
-    png_ptr->row_number++;
- 
-    /* See if we are done */
-@@ -2194,20 +2194,20 @@ png_write_finish_row(png_structrp png_pt
-  * See the default: case for the easiest code to understand.
-  */
- void /* PRIVATE */
- png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
- {
-    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
- 
-    /* Start of interlace block */
--   static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
-+   static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
- 
-    /* Offset to next interlace block */
--   static PNG_CONST png_byte  png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-+   static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
- 
-    png_debug(1, "in png_do_write_interlace");
- 
-    /* We don't have to do anything on the last pass (6) */
-    if (pass < 6)
-    {
-       /* Each pixel depth is handled separately */
-       switch (row_info->pixel_depth)
-@@ -2372,17 +2372,17 @@ png_do_write_interlace(png_row_infop row
-  * chosen filter.
-  */
- static void /* PRIVATE */
- png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
-     size_t row_bytes);
- 
- #ifdef PNG_WRITE_FILTER_SUPPORTED
- static size_t /* PRIVATE */
--png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
-+png_setup_sub_row(png_structrp png_ptr, png_uint_32 bpp,
-     size_t row_bytes, size_t lmins)
- {
-    png_bytep rp, dp, lp;
-    size_t i;
-    size_t sum = 0;
-    unsigned int v;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
-@@ -2411,17 +2411,17 @@ png_setup_sub_row(png_structrp png_ptr, 
-       if (sum > lmins)  /* We are already worse, don't continue. */
-         break;
-    }
- 
-    return (sum);
- }
- 
- static void /* PRIVATE */
--png_setup_sub_row_only(png_structrp png_ptr, const png_uint_32 bpp,
-+png_setup_sub_row_only(png_structrp png_ptr, png_uint_32 bpp,
-     size_t row_bytes)
- {
-    png_bytep rp, dp, lp;
-    size_t i;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1; i < bpp;
-@@ -2476,17 +2476,17 @@ png_setup_up_row_only(png_structrp png_p
-        pp = png_ptr->prev_row + 1; i < row_bytes;
-        i++, rp++, pp++, dp++)
-    {
-       *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
-    }
- }
- 
- static size_t /* PRIVATE */
--png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
-+png_setup_avg_row(png_structrp png_ptr, png_uint_32 bpp,
-     size_t row_bytes, size_t lmins)
- {
-    png_bytep rp, dp, pp, lp;
-    png_uint_32 i;
-    size_t sum = 0;
-    unsigned int v;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
-@@ -2516,17 +2516,17 @@ png_setup_avg_row(png_structrp png_ptr, 
- 
-       if (sum > lmins)  /* We are already worse, don't continue. */
-         break;
-    }
- 
-    return (sum);
- }
- static void /* PRIVATE */
--png_setup_avg_row_only(png_structrp png_ptr, const png_uint_32 bpp,
-+png_setup_avg_row_only(png_structrp png_ptr, png_uint_32 bpp,
-     size_t row_bytes)
- {
-    png_bytep rp, dp, pp, lp;
-    png_uint_32 i;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
-@@ -2538,17 +2538,17 @@ png_setup_avg_row_only(png_structrp png_
-    for (lp = png_ptr->row_buf + 1; i < row_bytes; i++)
-    {
-       *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
-           & 0xff);
-    }
- }
- 
- static size_t /* PRIVATE */
--png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
-+png_setup_paeth_row(png_structrp png_ptr, png_uint_32 bpp,
-     size_t row_bytes, size_t lmins)
- {
-    png_bytep rp, dp, pp, cp, lp;
-    size_t i;
-    size_t sum = 0;
-    unsigned int v;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
-@@ -2599,17 +2599,17 @@ png_setup_paeth_row(png_structrp png_ptr
- 
-       if (sum > lmins)  /* We are already worse, don't continue. */
-         break;
-    }
- 
-    return (sum);
- }
- static void /* PRIVATE */
--png_setup_paeth_row_only(png_structrp png_ptr, const png_uint_32 bpp,
-+png_setup_paeth_row_only(png_structrp png_ptr, png_uint_32 bpp,
-     size_t row_bytes)
- {
-    png_bytep rp, dp, pp, cp, lp;
-    size_t i;
- 
-    png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
- 
-    for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
-diff --git a/media/libpng/powerpc/filter_vsx_intrinsics.c b/media/libpng/powerpc/filter_vsx_intrinsics.c
---- a/media/libpng/powerpc/filter_vsx_intrinsics.c
-+++ b/media/libpng/powerpc/filter_vsx_intrinsics.c
-@@ -1,18 +1,19 @@
- /* filter_vsx_intrinsics.c - PowerPC optimised filter functions
-  *
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 2017 Glenn Randers-Pehrson
-  * Written by Vadim Barkov, 2017.
-- * Last changed in libpng 1.6.29 [March 16, 2017]
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
-+
- #include <stdio.h>
- #include <stdint.h>
- #include "../pngpriv.h"
- 
- #ifdef PNG_READ_SUPPORTED
- 
- /* This code requires -maltivec and -mvsx on the command line: */
- #if PNG_POWERPC_VSX_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
-@@ -168,17 +169,17 @@ static const vector unsigned char VSX_SH
- #  define vsx_abs(number) abs(number)
- #else
- #  define vsx_abs(number) (number > 0) ? (number) : -(number)
- #endif
- 
- void png_read_filter_row_sub4_vsx(png_row_infop row_info, png_bytep row,
-                                   png_const_bytep prev_row)
- {
--   const png_byte bpp = 4;
-+   png_byte bpp = 4;
- 
-    vector unsigned char rp_vec;
-    vector unsigned char part_vec;
- 
-    vsx_declare_common_vars(row_info,row,prev_row,bpp)
- 
-    PNG_UNUSED(pp)
- 
-@@ -225,17 +226,17 @@ void png_read_filter_row_sub4_vsx(png_ro
-          rp++;
-       }
- 
- }
- 
- void png_read_filter_row_sub3_vsx(png_row_infop row_info, png_bytep row,
-                                   png_const_bytep prev_row)
- {
--   const png_byte bpp = 3;
-+   png_byte bpp = 3;
- 
-    vector unsigned char rp_vec;
-    vector unsigned char part_vec;
- 
-    vsx_declare_common_vars(row_info,row,prev_row,bpp)
- 
-    PNG_UNUSED(pp)
- 
-@@ -289,17 +290,17 @@ void png_read_filter_row_sub3_vsx(png_ro
-          *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff);
-          rp++;
-       }
- }
- 
- void png_read_filter_row_avg4_vsx(png_row_infop row_info, png_bytep row,
-                                   png_const_bytep prev_row)
- {
--   const png_byte bpp = 4;
-+   png_byte bpp = 4;
- 
-    vector unsigned char rp_vec;
-    vector unsigned char pp_vec;
-    vector unsigned char pp_part_vec;
-    vector unsigned char rp_part_vec;
-    vector unsigned char avg_vec;
- 
-    vsx_declare_common_vars(row_info,row,prev_row,bpp)
-@@ -376,17 +377,17 @@ void png_read_filter_row_avg4_vsx(png_ro
- 
-          rp++;
-       }
- }
- 
- void png_read_filter_row_avg3_vsx(png_row_infop row_info, png_bytep row,
-                                   png_const_bytep prev_row)
- {
--  const png_byte bpp = 3;
-+  png_byte bpp = 3;
- 
-   vector unsigned char rp_vec;
-   vector unsigned char pp_vec;
-   vector unsigned char pp_part_vec;
-   vector unsigned char rp_part_vec;
-   vector unsigned char avg_vec;
- 
-   vsx_declare_common_vars(row_info,row,prev_row,bpp)
-@@ -494,17 +495,17 @@ void png_read_filter_row_avg3_vsx(png_ro
-       if (pc < pa) a = c;\
-       a += *rp;\
-       *rp++ = (png_byte)a;\
-       }
- 
- void png_read_filter_row_paeth4_vsx(png_row_infop row_info, png_bytep row,
-    png_const_bytep prev_row)
- {
--   const png_byte bpp = 4;
-+   png_byte bpp = 4;
- 
-    int a, b, c, pa, pb, pc, p;
-    vector unsigned char rp_vec;
-    vector unsigned char pp_vec;
-    vector unsigned short a_vec,b_vec,c_vec,nearest_vec;
-    vector signed short pa_vec,pb_vec,pc_vec,smallest_vec;
- 
-    vsx_declare_common_vars(row_info,row,prev_row,bpp)
-@@ -614,17 +615,17 @@ void png_read_filter_row_paeth4_vsx(png_
-       {
-          vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp)
-       }
- }
- 
- void png_read_filter_row_paeth3_vsx(png_row_infop row_info, png_bytep row,
-    png_const_bytep prev_row)
- {
--  const png_byte bpp = 3;
-+  png_byte bpp = 3;
- 
-   int a, b, c, pa, pb, pc, p;
-   vector unsigned char rp_vec;
-   vector unsigned char pp_vec;
-   vector unsigned short a_vec,b_vec,c_vec,nearest_vec;
-   vector signed short pa_vec,pb_vec,pc_vec,smallest_vec;
- 
-   vsx_declare_common_vars(row_info,row,prev_row,bpp)
-diff --git a/media/libpng/powerpc/powerpc_init.c b/media/libpng/powerpc/powerpc_init.c
---- a/media/libpng/powerpc/powerpc_init.c
-+++ b/media/libpng/powerpc/powerpc_init.c
-@@ -1,19 +1,20 @@
- 
- /* powerpc_init.c - POWERPC optimised filter functions
-  *
-+ * Copyright (c) 2018 Cosmin Truta
-  * Copyright (c) 2017 Glenn Randers-Pehrson
-  * Written by Vadim Barkov, 2017.
-- * Last changed in libpng 1.6.29 [March 16, 2017]
-  *
-  * This code is released under the libpng license.
-  * For conditions of distribution and use, see the disclaimer
-  * and license in png.h
-  */
-+
- /* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
-  * called.
-  */
- #define _POSIX_SOURCE 1
- 
- #include <stdio.h>
- #include "../pngpriv.h"
- 
-diff --git a/old-configure.in b/old-configure.in
---- a/old-configure.in
-+++ b/old-configure.in
-@@ -41,17 +41,17 @@ dnl ====================================
- _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
- _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
- _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
- _SUBDIR_CONFIG_ARGS="$ac_configure_args"
- 
- dnl Set the version number of the libs included with mozilla
- dnl ========================================================
- MOZJPEG=62
--MOZPNG=10635
-+MOZPNG=10637
- NSPR_VERSION=4
- NSPR_MINVER=4.23
- NSS_VERSION=3
- 
- dnl Set the minimum version of toolkit libs used by mozilla
- dnl ========================================================
- GLIB_VERSION=2.22
- # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.

+ 0 - 53
rel-257/mozilla-esr60/patches/1516325-68a1.patch

@@ -1,53 +0,0 @@
-# HG changeset patch
-# User Jed Davis <jld@mozilla.com>
-# Date 1553336718 0
-# Node ID b4e4c1cb485de23dcf46c551be73d3900e3802d3
-# Parent  757c4b2f0e9c611b53d59c71199e9702677af146
-Bug 1516325. r=glandium
-
-Differential Revision: https://phabricator.services.mozilla.com/D22638
-
-diff --git a/config/external/nspr/pr/moz.build b/config/external/nspr/pr/moz.build
---- a/config/external/nspr/pr/moz.build
-+++ b/config/external/nspr/pr/moz.build
-@@ -35,17 +35,18 @@ elif CONFIG['OS_TARGET'] in ('FreeBSD', 
-         HAVE_BSD_FLOCK=True,
-         HAVE_SOCKLEN_T=True,
-         HAVE_POINTER_LOCALTIME_R=True,
-     )
-     DEFINES[CONFIG['OS_TARGET'].upper()] = True
-     SOURCES += ['/nsprpub/pr/src/md/unix/%s.c' % CONFIG['OS_TARGET'].lower()]
- elif CONFIG['OS_TARGET'] == 'Darwin':
-     OS_LIBS += ['-framework CoreServices']
--    DEFINES['FD_SETSIZE'] = 10240
-+    # See also IncreaseDescriptorLimits in toolkit/xre/nsAppRunner.cpp
-+    DEFINES['FD_SETSIZE'] = 4096
-     DEFINES['_DARWIN_UNLIMITED_SELECT'] = True
-     if not CONFIG['HOST_MAJOR_VERSION']:
-         DEFINES.update(
-             HAS_CONNECTX=True,
-         )
-     elif CONFIG['HOST_MAJOR_VERSION'] >= '15':
-         DEFINES.update(
-             HAS_CONNECTX=True,
-diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
---- a/toolkit/xre/nsAppRunner.cpp
-+++ b/toolkit/xre/nsAppRunner.cpp
-@@ -3056,16 +3056,17 @@ static bool CheckForUserMismatch() {
- }
- #else  // !XP_UNIX || ANDROID
- static bool CheckForUserMismatch() { return false; }
- #endif
- 
- static void IncreaseDescriptorLimits() {
- #ifdef XP_UNIX
-   // Increase the fd limit to accomodate IPC resources like shared memory.
-+  // See also the Darwin case in config/external/nspr/pr/moz.build
-   static const rlim_t kFDs = 4096;
-   struct rlimit rlim;
- 
-   if (getrlimit(RLIMIT_NOFILE, &rlim) != 0) {
-     Output(false, "getrlimit: %s\n", strerror(errno));
-     return;
-   }
-   // Don't decrease the limit if it's already high enough, but don't

+ 0 - 42
rel-257/mozilla-esr60/patches/1516605-66a1.patch

@@ -1,42 +0,0 @@
-# HG changeset patch
-# User Makoto Kato <m_kato@ga2.so-net.ne.jp>
-# Date 1546438291 0
-# Node ID 129f8c60783c4daba0c04106c3082c2f94890b66
-# Parent  89493fd7e26ba523fa086ebe339d1614dfb7e1b9
-Bug 1516605 - Turn on NEON on aarch64 when using gcc or clang. r=aosmond
-
-libpng has NEON support using intrinsics, not assembler, so we should use it
-even if aarch64.
-
-MSVC build still turns off NEON since libpng doesn't support it on stable
-version although upstream has it.
-
-Differential Revision: https://phabricator.services.mozilla.com/D15462
-
-diff --git a/media/libpng/moz.build b/media/libpng/moz.build
---- a/media/libpng/moz.build
-+++ b/media/libpng/moz.build
-@@ -36,16 +36,23 @@ if CONFIG['CPU_ARCH'] == 'arm':
-         'arm/arm_init.c',
-         'arm/filter_neon_intrinsics.c'
-     ]
- 
-     SOURCES += [
-         'arm/filter_neon.S'
-     ]
- 
-+if CONFIG['CPU_ARCH'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang', 'gcc'):
-+    DEFINES['MOZ_PNG_USE_ARM_NEON'] = True
-+    UNIFIED_SOURCES += [
-+        'arm/arm_init.c',
-+        'arm/filter_neon_intrinsics.c'
-+    ]
-+
- if CONFIG['INTEL_ARCHITECTURE']:
-     DEFINES['MOZ_PNG_USE_INTEL_SSE'] = True
-     UNIFIED_SOURCES += [
-         'intel/filter_sse2_intrinsics.c',
-         'intel/intel_init.c'
-     ]
- 
- if CONFIG['HAVE_ALTIVEC']:

+ 0 - 41
rel-257/mozilla-esr60/patches/1516642-67a1.patch

@@ -1,41 +0,0 @@
-# HG changeset patch
-# User Mike Hommey <mh+mozilla@glandium.org>
-# Date 1549633716 0
-# Node ID 57664c81a1de82de2e2dc34a9a2806fccf2cc5c0
-# Parent  a1e972193302697563395b544ac4bd2c40c71519
-Bug 1516642 - Add a function declaration for arc4random_buf in expat. r=peterv
-
-The function has been in bionic (Android's libc since the first commit
-in the upstream repository), but it's not been in stdlib.h until
-recently. As it happens, we have a similar declaration in
-xpcom/base/nsUUIDGenerator.cpp.
-
-Differential Revision: https://phabricator.services.mozilla.com/D19120
-
-diff --git a/parser/expat/lib/xmlparse.c b/parser/expat/lib/xmlparse.c
---- a/parser/expat/lib/xmlparse.c
-+++ b/parser/expat/lib/xmlparse.c
-@@ -813,16 +813,23 @@ gather_time_entropy(void)
-   return tv.tv_usec;
- #endif
- }
- 
- #if defined(HAVE_ARC4RANDOM_BUF) && defined(HAVE_LIBBSD)
- # include <bsd/stdlib.h>
- #endif
- 
-+/* BEGIN MOZILLA CHANGE (not all Android NDK versions have the function
-+ * declaration, although the function has been available in bionic forever) */
-+#if defined(HAVE_ARC4RANDOM_BUF) && defined(__ANDROID__)
-+__attribute__((visibility("default"))) void arc4random_buf(void*, size_t);
-+#endif
-+/* END MOZILLA CHANGE */
-+
- static unsigned long
- ENTROPY_DEBUG(const char * label, unsigned long entropy) {
- /* BEGIN MOZILLA CHANGE (don't getenv every time we set up a hash) */
- #if 0
-   const char * const EXPAT_ENTROPY_DEBUG = getenv("EXPAT_ENTROPY_DEBUG");
-   if (EXPAT_ENTROPY_DEBUG && ! strcmp(EXPAT_ENTROPY_DEBUG, "1")) {
-     fprintf(stderr, "Entropy: %s --> 0x%0*lx (%lu bytes)\n",
-         label,

+ 0 - 48
rel-257/mozilla-esr60/patches/1518762-66a1.patch

@@ -1,48 +0,0 @@
-# HG changeset patch
-# User Rob Wu <rob@robwu.nl>
-# Date 1548173799 0
-# Node ID e26eda77b71c6c02db69441236dd95fc0db5c7f2
-# Parent  41ccaba649c95b9c578b55d966a5ed2845419f14
-Bug 1518762 - Avoid error in psutil.disk_io_counters in resourcemonitor r=ahal
-
-Imports https://github.com/giampaolo/psutil/commit/8f99f3782663959062ee868bbfdbc336307a3a4d
-to fix a bug with Linux kernel 4.18+, https://github.com/giampaolo/psutil/issues/1354
-(to be included in a future release of psutil, version 5.5.0)
-
-Differential Revision: https://phabricator.services.mozilla.com/D16028
-
-diff --git a/third_party/python/psutil/psutil/_pslinux.py b/third_party/python/psutil/psutil/_pslinux.py
---- a/third_party/python/psutil/psutil/_pslinux.py
-+++ b/third_party/python/psutil/psutil/_pslinux.py
-@@ -1046,28 +1046,30 @@ def disk_io_counters():
-         # On Linux 2.4 each line has always 15 fields, e.g.:
-         # "3     0   8 hda 8 8 8 8 8 8 8 8 8 8 8"
-         # On Linux 2.6+ each line *usually* has 14 fields, and the disk
-         # name is in another position, like this:
-         # "3    0   hda 8 8 8 8 8 8 8 8 8 8 8"
-         # ...unless (Linux 2.6) the line refers to a partition instead
-         # of a disk, in which case the line has less fields (7):
-         # "3    1   hda1 8 8 8 8"
-+        # 4.18+ has 4 fields added:
-+        # "3    0   hda 8 8 8 8 8 8 8 8 8 8 8 0 0 0 0"
-         # See:
-         # https://www.kernel.org/doc/Documentation/iostats.txt
-         # https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats
-         fields = line.split()
-         fields_len = len(fields)
-         if fields_len == 15:
-             # Linux 2.4
-             name = fields[3]
-             reads = int(fields[2])
-             (reads_merged, rbytes, rtime, writes, writes_merged,
-                 wbytes, wtime, _, busy_time, _) = map(int, fields[4:14])
--        elif fields_len == 14:
-+        elif fields_len == 14 or fields_len == 18:
-             # Linux 2.6+, line referring to a disk
-             name = fields[2]
-             (reads, reads_merged, rbytes, rtime, writes, writes_merged,
-                 wbytes, wtime, _, busy_time, _) = map(int, fields[3:14])
-         elif fields_len == 7:
-             # Linux 2.6+, line referring to a partition
-             name = fields[2]
-             reads, rbytes, writes, wbytes = map(int, fields[3:])

+ 0 - 33
rel-257/mozilla-esr60/patches/1519209-66a1.patch

@@ -1,33 +0,0 @@
-# HG changeset patch
-# User Eric Rahm <erahm@mozilla.com>
-# Date 1547154881 28800
-# Node ID 0801165e31759dfe84480650d254924336e4fe76
-# Parent  07245d176ba65bd89b76b246a1d89c7eb7ecc5b7
-Bug 1519209 - Disable NSS_ALLOW_SSLKEYLOGFILE in beta and release. r=glandium
-
-This disables NSS_ALLOW_SSLKEYLOGFILE in beta in release in order to avoid shutdown hangs until the NSS project has time to fix the root cause of the issue.
-
-diff --git a/python/mozbuild/mozbuild/frontend/gyp_reader.py b/python/mozbuild/mozbuild/frontend/gyp_reader.py
---- a/python/mozbuild/mozbuild/frontend/gyp_reader.py
-+++ b/python/mozbuild/mozbuild/frontend/gyp_reader.py
-@@ -244,16 +244,20 @@ def process_gyp_result(gyp_result, gyp_d
- 
-             defines = target_conf.get('defines', [])
-             if bool(config.substs['_MSC_VER']) and no_chromium:
-                 msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, {})
-                 defines.extend(msvs_settings.GetComputedDefines(c))
-             for define in defines:
-                 if '=' in define:
-                     name, value = define.split('=', 1)
-+                    # The NSS gyp file doesn't expose a way to override this
-+                    # currently, so we do so here.
-+                    if name == 'NSS_ALLOW_SSLKEYLOGFILE' and config.substs.get('RELEASE_OR_BETA', False):
-+                        continue
-                     context['DEFINES'][name] = value
-                 else:
-                     context['DEFINES'][define] = True
- 
-             product_dir_dist = '$PRODUCT_DIR/dist/'
-             for include in target_conf.get('include_dirs', []):
-                 if include.startswith(product_dir_dist):
-                     # special-case includes of <(PRODUCT_DIR)/dist/ to match

+ 0 - 73
rel-257/mozilla-esr60/patches/1520909-65a1.patch

@@ -1,73 +0,0 @@
-# HG changeset patch
-# User Ted Campbell <tcampbell@mozilla.com>
-# Date 1540497002 0
-# Node ID 1c4bf766a99a657e2f88183afbef240e9e8e38ac
-# Parent  0e2815647e05a339b3b88f8d72346cc9c84293f6
-Bug 1502090 - Fix bailout tracking with fun.call. r=nbp
-
-NOTE: Multi-arg array.push is still disabled in Ion.
-
-Differential Revision: https://phabricator.services.mozilla.com/D9803
-
-diff --git a/js/src/jit-test/tests/ion/bug1502090.js b/js/src/jit-test/tests/ion/bug1502090.js
-new file mode 100644
---- /dev/null
-+++ b/js/src/jit-test/tests/ion/bug1502090.js
-@@ -0,0 +1,13 @@
-+function f(o) {
-+   var a = [o];
-+   a.length = a[0];
-+   var useless = function() {}
-+   var sz = Array.prototype.push.call(a, 42, 43);
-+   (function(){
-+       sz;
-+   })(new Boolean(false));
-+}
-+for (var i = 0; i < 2; i++) {
-+   f(1);
-+}
-+f(2);
-diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp
---- a/js/src/jit/IonBuilder.cpp
-+++ b/js/src/jit/IonBuilder.cpp
-@@ -4854,32 +4854,38 @@ AbortReasonOr<Ok> IonBuilder::jsop_funca
-     return makeCall(native, callInfo);
-   }
-   current->peek(calleeDepth)->setImplicitlyUsedUnchecked();
- 
-   // Extract call target.
-   TemporaryTypeSet* funTypes = current->peek(funcDepth)->resultTypeSet();
-   JSFunction* target = getSingleCallTarget(funTypes);
- 
-+  CallInfo callInfo(alloc(), pc, /* constructing = */ false,
-+                    /* ignoresReturnValue = */ BytecodeIsPopped(pc));
-+
-+  // Save prior call stack in case we need to resolve during bailout
-+  // recovery of inner inlined function. This includes the JSFunction and the
-+  // 'call' native function.
-+  MOZ_TRY(callInfo.savePriorCallStack(this, current, argc + 2));
-+
-   // Shimmy the slots down to remove the native 'call' function.
-   current->shimmySlots(funcDepth - 1);
- 
-   bool zeroArguments = (argc == 0);
- 
-   // If no |this| argument was provided, explicitly pass Undefined.
-   // Pushing is safe here, since one stack slot has been removed.
-   if (zeroArguments) {
-     pushConstant(UndefinedValue());
-   } else {
-     // |this| becomes implicit in the call.
-     argc -= 1;
-   }
- 
--  CallInfo callInfo(alloc(), pc, /* constructing = */ false,
--                    /* ignoresReturnValue = */ BytecodeIsPopped(pc));
-   if (!callInfo.init(current, argc)) return abort(AbortReason::Alloc);
- 
-   // Try to inline the call.
-   if (!zeroArguments) {
-     InliningDecision decision = makeInliningDecision(target, callInfo);
-     switch (decision) {
-       case InliningDecision_Error:
-         return abort(AbortReason::Error);

+ 0 - 136
rel-257/mozilla-esr60/patches/1523665-67a1.patch

@@ -1,136 +0,0 @@
-# HG changeset patch
-# User Mark Banner <standard8@mozilla.com>
-# Date 1548784196 0
-# Node ID ba41803aea537cac4ce379b1935ec4cdb6f76185
-# Parent  7d859be3530e0a14df6eef6c08adaa1b37c662a1
-Bug 1523665 - Bookmarks.insertTree should take account of invalid bookmark info causing an insertion of zero items. r=mak
-
-Differential Revision: https://phabricator.services.mozilla.com/D17954
-
-diff --git a/toolkit/components/places/Bookmarks.jsm b/toolkit/components/places/Bookmarks.jsm
---- a/toolkit/components/places/Bookmarks.jsm
-+++ b/toolkit/components/places/Bookmarks.jsm
-@@ -327,17 +327,17 @@ var Bookmarks = Object.freeze({
-    *         - fixupOrSkipInvalidEntries: makes the insert more lenient to
-    *           mistakes in the input tree.  Properties of an entry that are
-    *           fixable will be corrected, otherwise the entry will be skipped.
-    *           This is particularly convenient for import/restore operations,
-    *           but should not be abused for common inserts, since it may hide
-    *           bugs in the calling code.
-    *
-    * @return {Promise} resolved when the creation is complete.
--   * @resolves to an object representing the created bookmark.
-+   * @resolves to an array of objects representing the created bookmark(s).
-    * @rejects if it's not possible to create the requested bookmark.
-    * @throws if the arguments are invalid.
-    */
-   insertTree(tree, options) {
-     if (!tree || typeof tree != "object") {
-       throw new Error("Should be provided a valid tree object.");
-     }
-     if (!Array.isArray(tree.children) || !tree.children.length) {
-@@ -489,16 +489,22 @@ var Bookmarks = Object.freeze({
-       return lastAddedForParent;
-     }
- 
-     // We want to validate synchronously, but we can't know the index at which
-     // we're inserting into the parent. We just use NULL instead,
-     // and the SQL query with which we insert will update it as necessary.
-     let lastAddedForParent = appendInsertionInfoForInfoArray(tree.children, null, tree.guid);
- 
-+    // appendInsertionInfoForInfoArray will remove invalid items and may leave
-+    // us with nothing to insert, if so, just return early.
-+    if (!insertInfos.length) {
-+      return [];
-+    }
-+
-     return (async function() {
-       let treeParent = await fetchBookmark({ guid: tree.guid });
-       if (!treeParent) {
-         throw new Error("The parent you specified doesn't exist.");
-       }
- 
-       if (treeParent._parentId == PlacesUtils.tagsFolderId) {
-         throw new Error("Can't use insertTree to insert tags.");
-diff --git a/toolkit/components/places/tests/unit/bookmarks_corrupt.json b/toolkit/components/places/tests/unit/bookmarks_corrupt.json
---- a/toolkit/components/places/tests/unit/bookmarks_corrupt.json
-+++ b/toolkit/components/places/tests/unit/bookmarks_corrupt.json
-@@ -41,11 +41,32 @@
-           "title": "Bad URL",
-           "id": 9,
-           "dateAdded": 1361551979356436,
-           "lastModified": 1361551979362718,
-           "type": "text/x-moz-place",
-           "uri": "http:///"
-         }
-       ]
-+    },
-+    {
-+      "guid": "toolbar_____",
-+      "title": "Bookmarks Toolbar",
-+      "id": 2,
-+      "parent": 1,
-+      "dateAdded": 1361551978957783,
-+      "lastModified": 1361551979382837,
-+      "type": "text/x-moz-place-container",
-+      "root": "toolbarFolder",
-+      "children": [
-+        {
-+          "guid": "OCyeUO5uu9FG",
-+          "title": "Bad URL",
-+          "id": 9,
-+          "dateAdded": 1361551979356436,
-+          "lastModified": 1361551979362718,
-+          "type": "text/x-moz-place",
-+          "uri": "http:///"
-+        }
-+      ]
-     }
-   ]
- }
-diff --git a/toolkit/components/places/tests/unit/test_bookmarks_json_corrupt.js b/toolkit/components/places/tests/unit/test_bookmarks_json_corrupt.js
---- a/toolkit/components/places/tests/unit/test_bookmarks_json_corrupt.js
-+++ b/toolkit/components/places/tests/unit/test_bookmarks_json_corrupt.js
-@@ -1,24 +1,41 @@
- /* This Source Code Form is subject to the terms of the Mozilla Public
-  * License, v. 2.0. If a copy of the MPL was not distributed with this
-  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- 
-+/**
-+ * Tests for importing a corrupt json file.
-+ *
-+ * The corrupt json file attempts to import into:
-+ *   - the menu folder:
-+ *     - A bookmark with an invalid type.
-+ *     - A valid bookmark.
-+ *     - A bookmark with an invalid url.
-+ *   - the toolbar folder:
-+ *     - A bookmark with an invalid url.
-+ *
-+ * The menu case ensure that we strip out invalid bookmarks, but retain valid
-+ * ones.
-+ * The toolbar case ensures that if no valid bookmarks remain, then we do not
-+ * throw an error.
-+ */
-+
- ChromeUtils.import("resource://gre/modules/BookmarkJSONUtils.jsm");
- 
- // Exported bookmarks file pointer.
- var bookmarksExportedFile;
- 
- add_task(async function test_import_bookmarks() {
-   let bookmarksFile = OS.Path.join(do_get_cwd().path, "bookmarks_corrupt.json");
- 
-   await BookmarkJSONUtils.importFromFile(bookmarksFile, true);
-   await PlacesTestUtils.promiseAsyncUpdates();
- 
-   let bookmarks = await PlacesUtils.promiseBookmarksTree(PlacesUtils.bookmarks.menuGuid);
- 
--  Assert.equal(bookmarks.children.length, 1, "should only be one bookmark");
-+  Assert.equal(bookmarks.children.length, 1, "should only be one bookmark in the menu");
-   let bookmark = bookmarks.children[0];
-   Assert.equal(bookmark.guid, "OCyeUO5uu9FH", "should have correct guid");
-   Assert.equal(bookmark.title, "Customize Firefox", "should have correct title");
-   Assert.equal(bookmark.uri, "http://en-us.www.mozilla.com/en-US/firefox/customize/",
-     "should have correct uri");
- });

+ 0 - 44
rel-257/mozilla-esr60/patches/1529902-67a1.patch

@@ -1,44 +0,0 @@
-# HG changeset patch
-# User Masatoshi Kimura <VYV03354@nifty.ne.jp>
-# Date 1550842668 -32400
-# Node ID 1c74156717f19c20279571e493dac202cf89d4ef
-# Parent  2e22d147d42187e26837f78ef8b6e043819d3d08
-Bug 1529902 - Fix invalid use of NS_ConvertUTF16toUTF8. r=aklotz
-
-diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp
---- a/widget/windows/WinUtils.cpp
-+++ b/widget/windows/WinUtils.cpp
-@@ -1248,31 +1248,30 @@ NS_IMETHODIMP AsyncEncodeAndWriteIcon::R
-                   "Should not be called on the main thread.");
- 
-   // Note that since we're off the main thread we can't use
-   // gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()
-   RefPtr<DataSourceSurface> surface = Factory::CreateWrappingDataSourceSurface(
-       mBuffer.get(), mStride, IntSize(mWidth, mHeight),
-       SurfaceFormat::B8G8R8A8);
- 
--  FILE* file = fopen(NS_ConvertUTF16toUTF8(mIconPath).get(), "wb");
-+  FILE* file = _wfopen(mIconPath.get(), L"wb");
-   if (!file) {
-     // Maybe the directory doesn't exist; try creating it, then fopen again.
-     nsresult rv = NS_ERROR_FAILURE;
-     nsCOMPtr<nsIFile> comFile = do_CreateInstance("@mozilla.org/file/local;1");
-     if (comFile) {
--      // NS_ConvertUTF8toUTF16 utf16path(mIconPath);
-       rv = comFile->InitWithPath(mIconPath);
-       if (NS_SUCCEEDED(rv)) {
-         nsCOMPtr<nsIFile> dirPath;
-         comFile->GetParent(getter_AddRefs(dirPath));
-         if (dirPath) {
-           rv = dirPath->Create(nsIFile::DIRECTORY_TYPE, 0777);
-           if (NS_SUCCEEDED(rv) || rv == NS_ERROR_FILE_ALREADY_EXISTS) {
--            file = fopen(NS_ConvertUTF16toUTF8(mIconPath).get(), "wb");
-+            file = _wfopen(mIconPath.get(), L"wb");
-             if (!file) {
-               rv = NS_ERROR_FAILURE;
-             }
-           }
-         }
-       }
-     }
-     if (!file) {

+ 0 - 61
rel-257/mozilla-esr60/patches/1541282-68a1.patch

@@ -1,61 +0,0 @@
-# HG changeset patch
-# User Randall E. Barker <rbarker@mozilla.com>
-# Date 1554251002 0
-# Node ID dbb61d5c5944a9394e87244dace7ebfd5b0b0801
-# Parent  aef98278b81af78a26e42f1f18eb3a96969b385d
-Bug 1541282 - Use native call in NS_SetCurrentThreadName() on Android r=froydnj
-
-PR_SetCurrentThreadName() is broken on Android (Bug 1541216).
-In order to work around this issue, NS_SetCurrentThreadName() will
-call  prctl(PR_SET_NAME, name) until the underlying nspr can be
-fixed.
-
-Differential Revision: https://phabricator.services.mozilla.com/D25891
-
-diff --git a/xpcom/threads/nsThreadUtils.cpp b/xpcom/threads/nsThreadUtils.cpp
---- a/xpcom/threads/nsThreadUtils.cpp
-+++ b/xpcom/threads/nsThreadUtils.cpp
-@@ -22,16 +22,20 @@
- #endif
- 
- #ifdef XP_WIN
- #include <windows.h>
- #elif defined(XP_MACOSX)
- #include <sys/resource.h>
- #endif
- 
-+#if defined(ANDROID)
-+#include <sys/prctl.h>
-+#endif
-+
- using namespace mozilla;
- 
- #ifndef XPCOM_GLUE_AVOID_NSPR
- 
- NS_IMPL_ISUPPORTS(IdlePeriod, nsIIdlePeriod)
- 
- NS_IMETHODIMP
- IdlePeriod::GetIdlePeriodHint(TimeStamp* aIdleDeadline) {
-@@ -451,17 +455,22 @@ bool NS_ProcessNextEvent(nsIThread* aThr
-     aThread = current.get();
-   }
- #endif
-   bool val;
-   return NS_SUCCEEDED(aThread->ProcessNextEvent(aMayWait, &val)) && val;
- }
- 
- void NS_SetCurrentThreadName(const char* aName) {
-+#if defined(ANDROID)
-+  // Workaround for Bug 1541216 - PR_SetCurrentThreadName() Fails to set the thread name on Android.
-+  prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(aName));
-+#else
-   PR_SetCurrentThreadName(aName);
-+#endif
-   CrashReporter::SetCurrentThreadName(aName);
- }
- 
- #ifdef MOZILLA_INTERNAL_API
- nsIThread* NS_GetCurrentThread() {
-   return nsThreadManager::get().GetCurrentThread();
- }
- 

+ 0 - 92
rel-257/mozilla-esr60/patches/1562176-70a1.patch

@@ -1,92 +0,0 @@
-# HG changeset patch
-# User Gijs Kruitbosch <gijskruitbosch@gmail.com>
-# Date 1562701510 0
-# Node ID b4f105259931fe50fd1313de876ec69f23cbee3e
-# Parent  ac43e24a9918f8576b43649598834257cd3772b9
-Bug 1562176 - fix colons in 'save file as' filenames, r=mak
-
-Differential Revision: https://phabricator.services.mozilla.com/D37400
-
-diff --git a/toolkit/components/downloads/DownloadPaths.jsm b/toolkit/components/downloads/DownloadPaths.jsm
---- a/toolkit/components/downloads/DownloadPaths.jsm
-+++ b/toolkit/components/downloads/DownloadPaths.jsm
-@@ -16,28 +16,28 @@ ChromeUtils.import("resource://gre/modul
- 
- ChromeUtils.defineModuleGetter(this, "AppConstants",
-                                "resource://gre/modules/AppConstants.jsm");
- 
- /**
-  * Platform-dependent regular expression used by the "sanitize" method.
-  */
- XPCOMUtils.defineLazyGetter(this, "gConvertToSpaceRegExp", () => {
-+  // Note: we remove colons everywhere to avoid issues in subresource URL
-+  // parsing, as well as filename restrictions on some OSes (see bug 1562176).
-   /* eslint-disable no-control-regex */
-   switch (AppConstants.platform) {
-     // On mobile devices, the file system may be very limited in what it
-     // considers valid characters. To avoid errors, sanitize conservatively.
-     case "android":
-       return /[\x00-\x1f\x7f-\x9f:*?|"<>;,+=\[\]]+/g;
-     case "win":
-       return /[\x00-\x1f\x7f-\x9f:*?|]+/g;
--    case "macosx":
-+    default:
-       return /[\x00-\x1f\x7f-\x9f:]+/g;
--    default:
--      return /[\x00-\x1f\x7f-\x9f]+/g;
-   }
-   /* eslint-enable no-control-regex */
- });
- 
- var DownloadPaths = {
-   /**
-    * Sanitizes an arbitrary string for use as the local file name of a download.
-    * The input is often a document title or a manually edited name. The output
-diff --git a/toolkit/components/downloads/test/unit/test_DownloadPaths.js b/toolkit/components/downloads/test/unit/test_DownloadPaths.js
---- a/toolkit/components/downloads/test/unit/test_DownloadPaths.js
-+++ b/toolkit/components/downloads/test/unit/test_DownloadPaths.js
-@@ -49,21 +49,21 @@ add_task(async function test_sanitize() 
-     testSanitize("Directory Listing: /a/b/", "Directory Listing  _a_b_");
-   } else if (AppConstants.platform == "macosx") {
-     testSanitize(kSpecialChars, "A *?|\"\"<<>>;,+=[]B][=+,;>><<\"\"|?* C");
-     testSanitize(" :: Website :: ", "Website");
-     testSanitize("* Website!", "* Website!");
-     testSanitize("Website | Page!", "Website | Page!");
-     testSanitize("Directory Listing: /a/b/", "Directory Listing  _a_b_");
-   } else {
--    testSanitize(kSpecialChars, kSpecialChars);
--    testSanitize(" :: Website :: ", ":: Website ::");
-+    testSanitize(kSpecialChars, kSpecialChars.replace(/[:]/g, " "));
-+    testSanitize(" :: Website :: ", "Website");
-     testSanitize("* Website!", "* Website!");
-     testSanitize("Website | Page!", "Website | Page!");
--    testSanitize("Directory Listing: /a/b/", "Directory Listing: _a_b_");
-+    testSanitize("Directory Listing: /a/b/", "Directory Listing  _a_b_");
-   }
- 
-   // Conversion of consecutive runs of slashes and backslashes to underscores.
-   testSanitize("\\ \\\\Website\\/Page// /", "_ _Website_Page_ _");
- 
-   // Removal of leading and trailing whitespace and dots after conversion.
-   testSanitize("  Website  ", "Website");
-   testSanitize(". . Website . Page . .", "Website . Page");
-@@ -76,16 +76,19 @@ add_task(async function test_sanitize() 
-   testSanitize(".", "");
-   testSanitize("..", "");
-   testSanitize(" ", "");
-   testSanitize(" . ", "");
- 
-   // Stripping of BIDI formatting characters.
-   testSanitize("\u200e \u202b\u202c\u202d\u202etest\x7f\u200f", "test");
-   testSanitize("AB\x7f\u202a\x7f\u202a\x7fCD", "AB CD");
-+
-+  // Stripping of colons:
-+  testSanitize("foo:bar", "foo bar");
- });
- 
- add_task(async function test_splitBaseNameAndExtension() {
-   // Usual file names.
-   testSplitBaseNameAndExtension("base", ["base", ""]);
-   testSplitBaseNameAndExtension("base.ext", ["base", ".ext"]);
-   testSplitBaseNameAndExtension("base.application", ["base", ".application"]);
-   testSplitBaseNameAndExtension("base.x.Z", ["base", ".x.Z"]);

+ 0 - 383
rel-257/mozilla-esr60/patches/1565919-70a1.patch

@@ -1,383 +0,0 @@
-# HG changeset patch
-# User Makoto Kato <m_kato@ga2.so-net.ne.jp>
-# Date 1564839896 0
-# Node ID 15fbd2a9c32d7504bb24fdc153781e14ee82e090
-# Parent  f8bf6887ca0be008e334fd16e5f993fdc6b0ba98
-Bug 1565919 - Don't separate words by contextual-based character. r=Ehsan
-
-Original regression was by bug 1362858, and bug 1418629 wasn't enough to fix.
-
-By bug 1362858, we use `CHAR_CLASS_SEPARATOR` in additional to DOM word separator. But some characters such as single quote, `@` and etc are `CHAR_CLASS_SEPARATOR`, so we may check spell by incomplete word.
-
-We shouldn't separate word by characters that is email part, URL part or conditional punctuation.
-
-And I also update test cases for this situation. `<textarea>` is better for spell checking since it can has multiple anonymous text nodes.
-
-Differential Revision: https://phabricator.services.mozilla.com/D39829
-
-diff --git a/editor/libeditor/tests/spellcheck.js b/editor/libeditor/tests/spellcheck.js
---- a/editor/libeditor/tests/spellcheck.js
-+++ b/editor/libeditor/tests/spellcheck.js
-@@ -1,20 +1,36 @@
- function isSpellingCheckOk(aEditor, aMisspelledWords) {
-   var selcon = aEditor.selectionController;
-   var sel = selcon.getSelection(selcon.SELECTION_SPELLCHECK);
-   var numWords = sel.rangeCount;
- 
--  is(numWords, aMisspelledWords.length, "Correct number of misspellings and words.");
-+  if (aTodo) {
-+    todo_is(
-+      numWords,
-+      aMisspelledWords.length,
-+      "Correct number of misspellings and words."
-+    );
-+  } else {
-+    is(
-+      numWords,
-+      aMisspelledWords.length,
-+      "Correct number of misspellings and words."
-+    );
-+  }
- 
-   if (numWords !== aMisspelledWords.length) {
-     return false;
-   }
- 
-   for (var i = 0; i < numWords; ++i) {
-     var word = String(sel.getRangeAt(i));
--    is(word, aMisspelledWords[i], "Misspelling is what we think it is.");
-+    if (aTodo) {
-+      todo_is(word, aMisspelledWords[i], "Misspelling is what we think it is.");
-+    } else {
-+      is(word, aMisspelledWords[i], "Misspelling is what we think it is.");
-+    }
-     if (word !== aMisspelledWords[i]) {
-       return false;
-     }
-   }
-   return true;
- }
-diff --git a/editor/spellchecker/tests/test_bug1418629.html b/editor/spellchecker/tests/test_bug1418629.html
---- a/editor/spellchecker/tests/test_bug1418629.html
-+++ b/editor/spellchecker/tests/test_bug1418629.html
-@@ -10,87 +10,209 @@
- </head>
- <body>
- <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1418629">Mozilla Bug 1418629</a>
- <p id="display"></p>
- <div id="content" style="display: none;">
- 
- </div>
- 
--<input id="input1" autofocus spellcheck="true">
-+<input id="input1" spellcheck="true">
-+<textarea id="textarea1"></textarea>
-+<div id="edit1" contenteditable=true></div>
- 
- <script>
- const {onSpellCheck} = SpecialPowers.Cu.import("resource://testing-common/AsyncSpellCheckTestHelper.jsm", {});
- 
- SimpleTest.waitForExplicitFinish();
- 
--add_task(async function() {
--  await new Promise((resolve) => {
--    SimpleTest.waitForFocus(() => {
--      SimpleTest.executeSoon(resolve);
--    }, window);
--  });
-+function getEditor(input) {
-+  if (input instanceof HTMLInputElement ||
-+      input instanceof HTMLTextAreaElement) {
-+    return SpecialPowers.wrap(input).editor;
-+  }
-+
-+  return SpecialPowers.wrap(window).docShell.editor;
-+}
- 
-+function resetEditableContent(input) {
-+  if (input instanceof HTMLInputElement ||
-+      input instanceof HTMLTextAreaElement) {
-+    input.value = "";
-+    return;
-+  }
-+  input.innerHTML = "";
-+}
-+
-+async function test_with_single_quote(input) {
-   let misspeltWords = [];
--  let input = document.getElementById("input1");
- 
-   input.focus();
--  input.value = "";
-+  resetEditableContent(input);
-+
-   synthesizeKey("d");
-   synthesizeKey("o");
-   synthesizeKey("e");
-   synthesizeKey("s");
- 
-   await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  let editor = getEditor(input);
-   // isSpellingCheckOk is defined in spellcheck.js
-   // eslint-disable-next-line no-undef
--  ok(isSpellingCheckOk(SpecialPowers.wrap(input).editor, misspeltWords),
--     "no misspelt words");
-+  ok(isSpellingCheckOk(editor, misspeltWords), "no misspelt words");
- 
-   synthesizeKey("n");
-   synthesizeKey("\'");
--  is(input.value, "doesn\'", "");
--
--  await new Promise((resolve) => { onSpellCheck(input, resolve); });
--  // isSpellingCheckOk is defined in spellcheck.js
--  // eslint-disable-next-line no-undef
--  ok(isSpellingCheckOk(SpecialPowers.wrap(input).editor, misspeltWords),
--     "don't run spellchecker during inputting word");
--
--  synthesizeKey(" ");
--  is(input.value, "doesn\' ", "");
-+  is(input.value || input.textContent, "doesn\'", "");
- 
-   await new Promise((resolve) => { onSpellCheck(input, resolve); });
--  misspeltWords.push("doesn\'");
-+  // XXX This won't work since mozInlineSpellWordUtil::SplitDOM removes
-+  // last single quote unfortunately that is during inputting.
-   // isSpellingCheckOk is defined in spellcheck.js
-   // eslint-disable-next-line no-undef
--  ok(isSpellingCheckOk(SpecialPowers.wrap(input).editor, misspeltWords),
--     "should run spellchecker");
--});
-+  todo_is(isSpellingCheckOk(editor, misspeltWords, true), true,
-+          "don't run spellchecker during inputting word");
-+
-+  synthesizeKey(" ");
-+  is(input.value || input.textContent, "doesn\' ", "");
- 
--async function test_with_twice_characters(ch) {
-+  await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  misspeltWords.push("doesn");
-+  // isSpellingCheckOk is defined in spellcheck.js
-+  // eslint-disable-next-line no-undef
-+  ok(isSpellingCheckOk(editor, misspeltWords), "should run spellchecker");
-+}
-+
-+async function test_with_twice_characters(input, ch) {
-   let misspeltWords = [];
--  let input = document.getElementById("input1");
- 
-   input.focus();
--  input.value = "";
-+  resetEditableContent(input);
-+
-   synthesizeKey("d");
-   synthesizeKey("o");
-   synthesizeKey("e");
-   synthesizeKey("s");
-   synthesizeKey("n");
-   synthesizeKey(ch);
-   synthesizeKey(ch);
--  is(input.value, "doesn" + ch + ch, "");
-+  is(input.value || input.textContent, "doesn" + ch + ch, "");
-+
-+  // trigger spellchecker
-+  synthesizeKey(" ");
- 
-   await new Promise((resolve) => { onSpellCheck(input, resolve); });
-   misspeltWords.push("doesn");
-+  let editor = getEditor(input);
-   // isSpellingCheckOk is defined in spellcheck.js
-   // eslint-disable-next-line no-undef
--  ok(isSpellingCheckOk(SpecialPowers.wrap(input).editor, misspeltWords),
--     "should run spellchecker");
-+  ok(isSpellingCheckOk(editor, misspeltWords), "should run spellchecker");
-+}
-+
-+async function test_between_single_quote(input) {
-+  let misspeltWords = [];
-+
-+  input.focus();
-+  resetEditableContent(input);
-+
-+  synthesizeKey("\'");
-+  synthesizeKey("t");
-+  synthesizeKey("e");
-+  synthesizeKey("s");
-+  synthesizeKey("t");
-+  synthesizeKey("\'");
-+
-+  await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  let editor = getEditor(input);
-+  // eslint-disable-next-line no-undef
-+  ok(isSpellingCheckOk(editor, misspeltWords),
-+     "don't run spellchecker between single qoute");
- }
- 
--add_task(test_with_twice_characters.bind(null, "\'"));
--add_task(test_with_twice_characters.bind(null, String.fromCharCode(0x2019)));
-+async function test_with_email(input) {
-+  let misspeltWords = [];
-+
-+  input.focus();
-+  resetEditableContent(input);
-+
-+  synthesizeKey("t");
-+  synthesizeKey("t");
-+  synthesizeKey("t");
-+  synthesizeKey("t");
-+  synthesizeKey("@");
-+  synthesizeKey("t");
-+  synthesizeKey("t");
-+  synthesizeKey("t");
-+  synthesizeKey("t");
-+  synthesizeKey(".");
-+  synthesizeKey("c");
-+  synthesizeKey("o");
-+  synthesizeKey("m");
-+
-+  await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  let editor = getEditor(input);
-+  // eslint-disable-next-line no-undef
-+  ok(isSpellingCheckOk(editor, misspeltWords),
-+     "don't run spellchecker for email address");
-+
-+  synthesizeKey(" ");
-+
-+  await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  // eslint-disable-next-line no-undef
-+  ok(isSpellingCheckOk(editor, misspeltWords),
-+     "no misspelt words due to email address");
-+}
-+
-+async function test_with_url(input) {
-+  let misspeltWords = [];
-+
-+  input.focus();
-+  resetEditableContent(input);
-+
-+  synthesizeKey("h");
-+  synthesizeKey("t");
-+  synthesizeKey("t");
-+  synthesizeKey("p");
-+  synthesizeKey(":");
-+  synthesizeKey("/");
-+  synthesizeKey("/");
-+  synthesizeKey("t");
-+  synthesizeKey("t");
-+  synthesizeKey("t");
-+  synthesizeKey("t");
-+  synthesizeKey(".");
-+  synthesizeKey("c");
-+  synthesizeKey("o");
-+  synthesizeKey("m");
-+
-+  await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  let editor = getEditor(input);
-+  // eslint-disable-next-line no-undef
-+  ok(isSpellingCheckOk(editor, misspeltWords),
-+     "don't run spellchecker for URL");
-+
-+  synthesizeKey(" ");
-+
-+  await new Promise((resolve) => { onSpellCheck(input, resolve); });
-+  // eslint-disable-next-line no-undef
-+  ok(isSpellingCheckOk(editor, misspeltWords),
-+     "no misspelt words due to URL");
-+}
-+
-+SimpleTest.waitForFocus(() => {
-+  for (let n of ["input1", "textarea1", "edit1"])  {
-+    add_task(test_with_single_quote.bind(null,
-+                                         document.getElementById(n)));
-+    add_task(test_with_twice_characters.bind(null,
-+                                             document.getElementById(n),
-+                                             "\'"));
-+    add_task(test_with_twice_characters.bind(null,
-+                                             document.getElementById(n),
-+                                             String.fromCharCode(0x2019)));
-+    add_task(test_between_single_quote.bind(null,
-+                                            document.getElementById(n)));
-+    add_task(test_with_email.bind(null, document.getElementById(n)));
-+    add_task(test_with_url.bind(null, document.getElementById(n)));
-+  }
-+});
- </script>
- </body>
- </html>
-diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
---- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
-+++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
-@@ -41,16 +41,22 @@ inline bool IsIgnorableCharacter(char16_
- //    Some characters (like apostrophes) require characters on each side to be
- //    part of a word, and are otherwise punctuation.
- 
- inline bool IsConditionalPunctuation(char16_t ch) {
-   return (ch == '\'' || ch == 0x2019 ||  // RIGHT SINGLE QUOTATION MARK
-           ch == 0x00B7);                 // MIDDLE DOT
- }
- 
-+static bool IsAmbiguousDOMWordSeprator(char16_t ch) {
-+  // This class may be CHAR_CLASS_SEPARATOR, but it depends on context.
-+  return (ch == '@' || ch == ':' || ch == '.' || ch == '/' || ch == '-' ||
-+          IsConditionalPunctuation(ch));
-+}
-+
- // mozInlineSpellWordUtil::Init
- 
- nsresult mozInlineSpellWordUtil::Init(TextEditor* aTextEditor) {
-   if (NS_WARN_IF(!aTextEditor)) {
-     return NS_ERROR_FAILURE;
-   }
- 
-   mDocument = aTextEditor->GetDocument();
-@@ -386,25 +392,16 @@ CharClass WordSplitState::ClassifyCharac
-     if (ClassifyCharacter(aIndex - 1, false) != CHAR_CLASS_WORD)
-       return CHAR_CLASS_SEPARATOR;
-     // If the previous charatcer is a word-char, make sure that it's not a
-     // special dot character.
-     if (mDOMWordText[aIndex - 1] == '.') return CHAR_CLASS_SEPARATOR;
- 
-     // now we know left char is a word-char, check the right-hand character
-     if (aIndex == int32_t(mDOMWordText.Length() - 1)) {
--      if (mDOMWordText[aIndex] == '\'' || mDOMWordText[aIndex] == 0x2019) {
--        nsUGenCategory prevCategory =
--            mozilla::unicode::GetGenCategory(mDOMWordText[aIndex - 1]);
--        if (prevCategory == nsUGenCategory::kLetter ||
--            prevCategory == nsUGenCategory::kNumber) {
--          // If single quotation mark is last, we don't return separator yet.
--          return CHAR_CLASS_WORD;
--        }
--      }
-       return CHAR_CLASS_SEPARATOR;
-     }
- 
-     if (ClassifyCharacter(aIndex + 1, false) != CHAR_CLASS_WORD)
-       return CHAR_CLASS_SEPARATOR;
-     // If the next charatcer is a word-char, make sure that it's not a
-     // special dot character.
-     if (mDOMWordText[aIndex + 1] == '.') return CHAR_CLASS_SEPARATOR;
-@@ -600,21 +597,23 @@ static bool TextNodeContainsDOMWordSepar
-   int32_t end = std::min(aBeforeOffset, int32_t(textFragment->GetLength()));
-   bool ok = textFragment->AppendTo(text, 0, end, mozilla::fallible);
-   if(!ok)
-     return false;
- 
-   WordSplitState state(nullptr, text, 0, end);
-   for (int32_t i = end - 1; i >= 0; --i) {
-     if (IsDOMWordSeparator(textFragment->CharAt(i)) ||
--        state.ClassifyCharacter(i, true) == CHAR_CLASS_SEPARATOR) {
-+        (!IsAmbiguousDOMWordSeprator(textFragment->CharAt(i)) &&
-+         state.ClassifyCharacter(i, true) == CHAR_CLASS_SEPARATOR)) {
-       // Be greedy, find as many separators as we can
-       for (int32_t j = i - 1; j >= 0; --j) {
-         if (IsDOMWordSeparator(textFragment->CharAt(j)) ||
--            state.ClassifyCharacter(j, true) == CHAR_CLASS_SEPARATOR) {
-+            (!IsAmbiguousDOMWordSeprator(textFragment->CharAt(j)) &&
-+             state.ClassifyCharacter(j, true) == CHAR_CLASS_SEPARATOR)) {
-           i = j;
-         } else {
-           break;
-         }
-       }
-       *aSeparatorOffset = i;
-       return true;
-     }

+ 0 - 30
rel-257/mozilla-esr60/patches/1566465-70a1.patch

@@ -1,30 +0,0 @@
-# HG changeset patch
-# User Christian Holler <choller@mozilla.com>
-# Date 1564559465 0
-# Node ID 3c6c96c10ba41a91b8ea9130c05ebfbe9730e803
-# Parent  20004f472050540a6d225db12e83bcc3a28103b4
-Bug 1566465 - Fix crash in Http2Session::RecvAltSvc. r=dragana
-
-Differential Revision: https://phabricator.services.mozilla.com/D38197
-
-diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp
---- a/netwerk/protocol/http/Http2Session.cpp
-+++ b/netwerk/protocol/http/Http2Session.cpp
-@@ -2500,16 +2500,17 @@ nsresult Http2Session::RecvAltSvc(Http2S
-     if (!origin.IsEmpty()) {
-       LOG(("Http2Session %p Alt-Svc pulled stream has non empty origin\n",
-            self));
-       self->ResetDownstreamState();
-       return NS_OK;
-     }
- 
-     if (NS_FAILED(self->SetInputFrameDataStream(self->mInputFrameID)) ||
-+        !self->mInputFrameDataStream ||
-         !self->mInputFrameDataStream->Transaction() ||
-         !self->mInputFrameDataStream->Transaction()->RequestHead()) {
-       LOG3(
-           ("Http2Session::RecvAltSvc %p got frame w/o origin on invalid stream",
-            self));
-       self->ResetDownstreamState();
-       return NS_OK;
-     }

+ 0 - 33
rel-257/mozilla-esr60/patches/1574573-70a1.patch

@@ -1,33 +0,0 @@
-# HG changeset patch
-# User David Major <dmajor@mozilla.com>
-# Date 1566003979 0
-# Node ID d9bd2bdfa7a6b7fc5359a0b3e0265ad19694fad7
-# Parent  9369a02e25706ac8dd33decee5c25c88147a3199
-Bug 1574573 - Disambiguate a use of `Handle` in XPCShellEnvironment.cpp r=Ehsan
-
-Otherwise it could also refer to Handle from MacTypes.h.
-
-Differential Revision: https://phabricator.services.mozilla.com/D42358
-
-diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp
---- a/ipc/testshell/XPCShellEnvironment.cpp
-+++ b/ipc/testshell/XPCShellEnvironment.cpp
-@@ -50,17 +50,17 @@ using mozilla::dom::AutoJSAPI;
- using mozilla::dom::AutoEntryScript;
- using namespace JS;
- 
- namespace {
- 
- static const char kDefaultRuntimeScriptFilename[] = "xpcshell.js";
- 
- inline XPCShellEnvironment*
--Environment(Handle<JSObject*> global)
-+Environment(JS::Handle<JSObject*> global)
- {
-     AutoJSAPI jsapi;
-     if (!jsapi.Init(global)) {
-         return nullptr;
-     }
-     JSContext* cx = jsapi.cx();
-     Rooted<Value> v(cx);
-     if (!JS_GetProperty(cx, global, "__XPCShellEnvironment", &v) ||

+ 0 - 85
rel-257/mozilla-esr60/patches/1576463-71a1.patch

@@ -1,85 +0,0 @@
-# HG changeset patch
-# User Andrea Marchesini <amarchesini@mozilla.com>
-# Date 1568179004 0
-# Node ID 30509dab7f702a13cb37d8244f8f49f33ac4d68e
-# Parent  d83622ebdc5251f54861020747d882c85e31b9b6
-Bug 1576463 - canvas toDataURL and toBlob should not throw for serialization errors, r=jya
-
-Differential Revision: https://phabricator.services.mozilla.com/D45121
-
-diff --git a/dom/base/ImageEncoder.cpp b/dom/base/ImageEncoder.cpp
---- a/dom/base/ImageEncoder.cpp
-+++ b/dom/base/ImageEncoder.cpp
-@@ -96,16 +96,18 @@ class EncodingCompleteEvent : public Can
- 
-     if (!mFailed) {
-       // The correct parentObject has to be set by the mEncodeCompleteCallback.
-       RefPtr<Blob> blob =
-           Blob::CreateMemoryBlob(nullptr, mImgData, mImgSize, mType);
-       MOZ_ASSERT(blob);
- 
-       rv = mEncodeCompleteCallback->ReceiveBlob(blob.forget());
-+    } else {
-+      rv = mEncodeCompleteCallback->ReceiveBlob(nullptr);
-     }
- 
-     mEncodeCompleteCallback = nullptr;
- 
-     return rv;
-   }
- 
-   void SetMembers(void* aImgData, uint64_t aImgSize,
-diff --git a/dom/canvas/CanvasRenderingContextHelper.cpp b/dom/canvas/CanvasRenderingContextHelper.cpp
---- a/dom/canvas/CanvasRenderingContextHelper.cpp
-+++ b/dom/canvas/CanvasRenderingContextHelper.cpp
-@@ -29,19 +29,24 @@ void CanvasRenderingContextHelper::ToBlo
-    public:
-     EncodeCallback(nsIGlobalObject* aGlobal, BlobCallback* aCallback)
-         : mGlobal(aGlobal), mBlobCallback(aCallback) {}
- 
-     // This is called on main thread.
-     nsresult ReceiveBlob(already_AddRefed<Blob> aBlob) override {
-       RefPtr<Blob> blob = aBlob;
- 
--      RefPtr<Blob> newBlob = Blob::Create(mGlobal, blob->Impl());
-+      RefPtr<Blob> newBlob;
-+
-+      if (blob) {
-+        newBlob = Blob::Create(mGlobal, blob->Impl());
-+      }
- 
-       ErrorResult rv;
-+
-       mBlobCallback->Call(newBlob, rv);
- 
-       mGlobal = nullptr;
-       mBlobCallback = nullptr;
- 
-       return rv.StealNSResult();
-     }
- 
-diff --git a/dom/html/HTMLCanvasElement.cpp b/dom/html/HTMLCanvasElement.cpp
---- a/dom/html/HTMLCanvasElement.cpp
-+++ b/dom/html/HTMLCanvasElement.cpp
-@@ -587,17 +587,20 @@ void HTMLCanvasElement::ToDataURL(JSCont
-                                   JS::Handle<JS::Value> aParams,
-                                   nsAString& aDataURL, ErrorResult& aRv) {
-   // mWriteOnly check is redundant, but optimizes for the common case.
-   if (mWriteOnly && !CallerCanRead(aCx)) {
-     aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
-     return;
-   }
- 
--  aRv = ToDataURLImpl(aCx, aType, aParams, aDataURL);
-+  nsresult rv = ToDataURLImpl(aCx, aType, aParams, aDataURL);
-+  if (NS_FAILED(rv)) {
-+    aDataURL.AssignLiteral("data:,");
-+  }
- }
- 
- void HTMLCanvasElement::SetMozPrintCallback(PrintCallback* aCallback) {
-   mPrintCallback = aCallback;
- }
- 
- PrintCallback* HTMLCanvasElement::GetMozPrintCallback() const {
-   if (mOriginalCanvas) {

+ 0 - 153
rel-257/mozilla-esr60/patches/1578075-71a1.patch

@@ -1,153 +0,0 @@
-# HG changeset patch
-# User Ryan Hunt <rhunt@eqrion.net>
-# Date 1568128834 0
-# Node ID cd0ea6dafa051426035949cfbbfdeb04c1c05661
-# Parent  043288bd5362454f19d0103347fc40937213b777
-Bug 1578075 - Increase stack size of paint thread/workers on OSX Catalina or higher to workaround crash from recursion in CoreText. r=jrmuizel
-
-Differential Revision: https://phabricator.services.mozilla.com/D45370
-
-diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
---- a/gfx/layers/PaintThread.cpp
-+++ b/gfx/layers/PaintThread.cpp
-@@ -14,17 +14,21 @@
- #include "GeckoProfiler.h"
- #include "mozilla/layers/CompositorBridgeChild.h"
- #include "mozilla/layers/ShadowLayers.h"
- #include "mozilla/layers/SyncObject.h"
- #include "mozilla/gfx/2D.h"
- #include "mozilla/Preferences.h"
- #include "mozilla/SharedThreadPool.h"
- #include "mozilla/SyncRunnable.h"
-+#ifdef XP_MACOSX
-+#include "nsCocoaFeatures.h"
-+#endif
- #include "nsIPropertyBag2.h"
-+#include "nsIThreadManager.h"
- #include "nsServiceManagerUtils.h"
- #include "prsystem.h"
- 
- // Uncomment the following line to dispatch sync runnables when
- // painting so that rasterization happens synchronously from
- // the perspective of the main thread
- // #define OMTP_FORCE_SYNC
- 
-@@ -117,21 +121,38 @@ void PaintThread::AddRef() {}
-   PaintThread::sSingleton = new PaintThread();
- 
-   if (!PaintThread::sSingleton->Init()) {
-     gfxCriticalNote << "Unable to start paint thread";
-     PaintThread::sSingleton = nullptr;
-   }
- }
- 
-+static uint32_t GetPaintThreadStackSize() {
-+#ifndef XP_MACOSX
-+  return nsIThreadManager::DEFAULT_STACK_SIZE;
-+#else
-+  // Workaround bug 1578075 by increasing the stack size of paint threads
-+  if (nsCocoaFeatures::OnCatalinaOrLater()) {
-+    static const uint32_t kCatalinaPaintThreadStackSize = 512 * 1024;
-+    static_assert(kCatalinaPaintThreadStackSize >= nsIThreadManager::DEFAULT_STACK_SIZE,
-+                  "update default stack size of paint "
-+                  "workers");
-+    return kCatalinaPaintThreadStackSize;
-+  }
-+  return nsIThreadManager::DEFAULT_STACK_SIZE;
-+#endif
-+}
-+
- bool PaintThread::Init() {
-   MOZ_ASSERT(NS_IsMainThread());
- 
-   RefPtr<nsIThread> thread;
--  nsresult rv = NS_NewNamedThread("PaintThread", getter_AddRefs(thread));
-+  nsresult rv = NS_NewNamedThread("PaintThread", getter_AddRefs(thread),
-+                                  nullptr, GetPaintThreadStackSize());
-   if (NS_FAILED(rv)) {
-     return false;
-   }
-   sThread = thread;
- 
-   // Only create paint workers for tiling if we are using tiling or could
-   // expect to dynamically switch to tiling in the future
-   if (gfxPlatform::GetPlatform()->UsesTiling()) {
-@@ -150,16 +171,17 @@ void PaintThread::InitOnPaintThread() {
- }
- 
- void PaintThread::InitPaintWorkers() {
-   MOZ_ASSERT(NS_IsMainThread());
-   int32_t count = PaintThread::CalculatePaintWorkerCount();
-   if (count != 1) {
-     mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
-                                           count);
-+    mPaintWorkers->SetThreadStackSize(GetPaintThreadStackSize());
-   }
- }
- 
- void DestroyPaintThread(UniquePtr<PaintThread>&& pt) {
-   MOZ_ASSERT(PaintThread::IsOnPaintThread());
-   pt->ShutdownOnPaintThread();
- }
- 
-diff --git a/widget/cocoa/nsCocoaFeatures.h b/widget/cocoa/nsCocoaFeatures.h
---- a/widget/cocoa/nsCocoaFeatures.h
-+++ b/widget/cocoa/nsCocoaFeatures.h
-@@ -18,16 +18,17 @@ class nsCocoaFeatures {
-   static int32_t OSXVersionMajor();
-   static int32_t OSXVersionMinor();
-   static int32_t OSXVersionBugFix();
-   static bool OnYosemiteOrLater();
-   static bool OnElCapitanOrLater();
-   static bool OnSierraOrLater();
-   static bool OnHighSierraOrLater();
-   static bool OnMojaveOrLater();
-+  static bool OnCatalinaOrLater();
- 
-   static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor,
-                                int32_t aBugFix = 0);
- 
-   // These are utilities that do not change or depend on the value of
-   // mOSXVersion and instead just encapsulate the encoding algorithm.  Note that
-   // GetVersion actually adjusts to the lowest supported OS, so it will always
-   // return a "supported" version.  GetSystemVersion does not make any
-diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm
---- a/widget/cocoa/nsCocoaFeatures.mm
-+++ b/widget/cocoa/nsCocoaFeatures.mm
-@@ -16,16 +16,17 @@
- #define MAC_OS_X_VERSION_10_7_HEX  0x00001070
- #define MAC_OS_X_VERSION_10_8_HEX  0x00001080
- #define MAC_OS_X_VERSION_10_9_HEX  0x00001090
- #define MAC_OS_X_VERSION_10_10_HEX 0x000010A0
- #define MAC_OS_X_VERSION_10_11_HEX 0x000010B0
- #define MAC_OS_X_VERSION_10_12_HEX 0x000010C0
- #define MAC_OS_X_VERSION_10_13_HEX 0x000010D0
- #define MAC_OS_X_VERSION_10_14_HEX 0x000010E0
-+#define MAC_OS_X_VERSION_10_15_HEX 0x000010F0
- 
- #include "nsCocoaFeatures.h"
- #include "nsCocoaUtils.h"
- #include "nsDebug.h"
- #include "nsObjCExceptions.h"
- 
- #import <Cocoa/Cocoa.h>
- 
-@@ -184,12 +185,18 @@ Gecko_OnSierraOrLater()
- 
- /* static */ bool
- nsCocoaFeatures::OnMojaveOrLater()
- {
-     return (OSXVersion() >= MAC_OS_X_VERSION_10_14_HEX);
- }
- 
- /* static */ bool
-+nsCocoaFeatures::OnCatalinaOrLater()
-+{
-+    return (OSXVersion() >= MAC_OS_X_VERSION_10_15_HEX);
-+}
-+
-+/* static */ bool
- nsCocoaFeatures::IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix)
- {
-     return OSXVersion() >= GetVersion(aMajor, aMinor, aBugFix);
- }

+ 0 - 31
rel-257/mozilla-esr60/patches/1578303_enable_loginmanagercontextmenu-71a1.patch

@@ -1,31 +0,0 @@
-# HG changeset patch
-# User Ian Neal <iann_cvs@blueyonder.co.uk>
-# Date 1567531902 0
-# Node ID 7532820fe4b9e8605dc75edf5731336e99ad78fe
-# Parent  f9b58406c73be12a080c33ae03fd1bb017f10caa
-Bug 1578303 - Enable LoginManagerContextMenu.jsm for SeaMonkey r=MattN
-
-Differential Revision: https://phabricator.services.mozilla.com/D44408
-
-diff --git a/toolkit/components/passwordmgr/moz.build b/toolkit/components/passwordmgr/moz.build
---- a/toolkit/components/passwordmgr/moz.build
-+++ b/toolkit/components/passwordmgr/moz.build
-@@ -62,17 +62,17 @@ else:
-         'LoginStore.jsm',
-     ]
- 
- if CONFIG['OS_TARGET'] == 'WINNT':
-     EXTRA_JS_MODULES += [
-         'OSCrypto_win.js',
-     ]
- 
--if CONFIG['MOZ_BUILD_APP'] == 'browser':
-+if CONFIG['MOZ_BUILD_APP'] == 'browser' or CONFIG['MOZ_SUITE']:
-     EXTRA_JS_MODULES += [
-         'LoginManagerContextMenu.jsm',
-     ]
- 
- JAR_MANIFESTS += ['jar.mn']
- 
- with Files('**'):
-     BUG_COMPONENT = ('Toolkit', 'Password Manager')

File diff suppressed because it is too large
+ 0 - 23820
rel-257/mozilla-esr60/patches/1602261-retsulcksat.patch


+ 0 - 29
rel-257/mozilla-esr60/patches/1602262-safebrowsing-pref.patch

@@ -1,29 +0,0 @@
-# HG changeset patch
-# User Frank-Rainer Grahl <frgrahl@gmx.net>
-# Date 1560180720 -7200
-# Parent  7597a60149ae3d25be5f12cdb1452470f32d61e0
-Bug 1602262 - Changes to Safe Browsing ESR60 lost in the patch trenches of the trees. r=IanN a=IanN
-
-diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
---- a/modules/libpref/init/all.js
-+++ b/modules/libpref/init/all.js
-@@ -5524,17 +5524,18 @@ pref("urlclassifier.downloadBlockTable",
- // Tables for login reputation
- pref("urlclassifier.passwordAllowTable", "goog-passwordwhite-proto");
- 
- // Tables for tracking protection
- pref("urlclassifier.trackingTable", "test-track-simple,base-track-digest256");
- pref("urlclassifier.trackingWhitelistTable", "test-trackwhite-simple,mozstd-trackwhite-digest256");
- 
- // These tables will never trigger a gethash call.
--pref("urlclassifier.disallow_completions", "test-malware-simple,test-harmful-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,except-flashinfobar-digest256,goog-passwordwhite-proto,ads-track-digest256,social-track-digest256,analytics-track-digest256");
-+pref("urlclassifier.disallow_completions", "test-malware-simple,test-harmful-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,except-flashinfobar-digest256");
-+//pref("urlclassifier.disallow_completions", "test-malware-simple,test-harmful-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,except-flashinfobar-digest256,goog-passwordwhite-proto,ads-track-digest256,social-track-digest256,analytics-track-digest256");
- 
- // Number of random entries to send with a gethash request
- pref("urlclassifier.gethashnoise", 4);
- 
- // Gethash timeout for Safe Browsing
- pref("urlclassifier.gethash.timeout_ms", 5000);
- // Update server response timeout for Safe Browsing
- pref("urlclassifier.update.response_timeout_ms", 30000);

+ 0 - 67
rel-257/mozilla-esr60/patches/series

@@ -1,70 +1,3 @@
-1446809-1-61a1.patch
-1446809-2-61a1.patch
-1446809-3-61a1.patch
-1446809-4-61a1.patch
-1446809-5-61a1.patch
-1446809-6-61a1.patch
-1446809-7-61a1.patch
-1446809-8-61a1.patch
-1446809-9-61a1.patch
-1477678-63a1.patch
-1447873-61a1.patch
-1455408-1-61a1.patch
-1455408-2-61a1.patch
-1455408-3-61a1.patch
-1488401-64a1.patch
-1502747-65a1.patch
-1523665-67a1.patch
-1529902-67a1.patch
-1437661-67a1.patch
-1510276-67a1.patch
-1233768-61a1.patch
-1340588-61a1.patch
-1476000-63a1.patch
-1500637-65a1.patch
-1506027-1-65a1.patch
-1464834-1-62a1.patch
-1464834-2-62a1.patch
-1602262-safebrowsing-pref.patch
-1478815-7partial-63a1.patch
-1372458-63a1.patch
-1472672-63a1.patch
-1520909-65a1.patch
-1445671-61a1.patch
-1602261-retsulcksat.patch
-1469790-63a1.patch
-1491467-64a1.patch
-1509867-65a1.patch
-1516605-66a1.patch
-1513236-68a1.patch
-1362858-1partial-56a1.patch
-1418629-68a1.patch
-1565919-70a1.patch
-1562176-70a1.patch
-1566465-70a1.patch
-1578303_enable_loginmanagercontextmenu-71a1.patch
-1454978-61a1.patch
-1458462-61a1.patch
-1461775-62a1.patch
-1477799-63a1.patch
-1473732-63a1.patch
-1578075-71a1.patch
-1574573-70a1.patch
-1576463-71a1.patch
-1518762-66a1.patch
-1519209-66a1.patch
-1516642-67a1.patch
-1401776-62a1.patch
-1516325-68a1.patch
-1541282-68a1.patch
-1496823-1-64a1.patch
-1496823-2-64a1.patch
-1496823-3-64a1.patch
-1496823-4-64a1.patch
-1496823-5-64a1.patch
-1496823-6-64a1.patch
-1496823-7-64a1.patch
-1496823-8-64a1.patch
 1434844-61a1.patch
 1474684-1-63a1.patch
 1474684-2-63a1.patch

Some files were not shown because too many files changed in this diff