From 197577e2af0bd544bf2ece0a89248fab04cf808a Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Sat, 4 May 2019 00:09:08 +0000
Subject: [PATCH] extra/chromium to 74.0.3729.131-2

---
 extra/chromium/PKGBUILD                       |  8 ++-
 ...romium-fix-the-flash-for-new-windows.patch | 54 +++++++++++++++++++
 2 files changed, 60 insertions(+), 2 deletions(-)
 create mode 100644 extra/chromium/chromium-fix-the-flash-for-new-windows.patch

diff --git a/extra/chromium/PKGBUILD b/extra/chromium/PKGBUILD
index ef051f3e9..8ff797761 100644
--- a/extra/chromium/PKGBUILD
+++ b/extra/chromium/PKGBUILD
@@ -13,11 +13,10 @@
 
 buildarch=12
 highmem=1
-noautobuild=1
 
 pkgname=chromium
 pkgver=74.0.3729.131
-pkgrel=1
+pkgrel=2
 _launcher_ver=6
 pkgdesc="A web browser built for speed, simplicity, and security"
 arch=('x86_64')
@@ -36,6 +35,7 @@ source=(https://commondatastorage.googleapis.com/chromium-browser-official/$pkgn
         chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz
         chromium-system-icu.patch
         chromium-glibc-2.29.patch
+        chromium-fix-the-flash-for-new-windows.patch
         chromium-widevine.patch
         chromium-skia-harmony.patch
         0001-crashpad-include-limits.patch)
@@ -43,6 +43,7 @@ sha256sums=('d178c7842f8f858ac876d88ce866cbd2132d7ca6c73940613ebf7e9c3fada986'
             '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
             'e2d284311f49c529ea45083438a768db390bde52949995534034d2a814beab89'
             'dd791f154b48e69cd47fd94753c45448655b529590995fd71ac1591c53a3d60c'
+            '6d82c052eb1f1ae5644a09f7ad7a88d9e2966d1836124445ca4df93b7657c10a'
             'd081f2ef8793544685aad35dea75a7e6264a2cb987ff3541e6377f4a3650a28b'
             '5887f78b55c4ecbbcba5930f3f0bb7bc0117c2a41c2f761805fcf7f46f1ca2b3'
             'df99f49ad58b70c9a3e1827d7e80b62e4363419334ed83373cf55b79c17b6f10')
@@ -108,6 +109,9 @@ prepare() {
   # https://crbug.com/949312
   patch -Np1 -i ../chromium-glibc-2.29.patch
 
+  # https://crbug.com/956061
+  patch -Np1 -i ../chromium-fix-the-flash-for-new-windows.patch
+
   # Load Widevine CDM if available
   patch -Np1 -i ../chromium-widevine.patch
 
diff --git a/extra/chromium/chromium-fix-the-flash-for-new-windows.patch b/extra/chromium/chromium-fix-the-flash-for-new-windows.patch
new file mode 100644
index 000000000..5a1f48777
--- /dev/null
+++ b/extra/chromium/chromium-fix-the-flash-for-new-windows.patch
@@ -0,0 +1,54 @@
+From adc543fe6a7b3bae9522257e651205140615fecb Mon Sep 17 00:00:00 2001
+From: Peng Huang <penghuang@chromium.org>
+Date: Fri, 3 May 2019 20:40:41 +0000
+Subject: [PATCH] Fix the flash for any new created window.
+
+The flash is because the child window created by GLSurfaceGLX doesn't
+match the visual of parent window. Fix the problem by always creating
+parent window with the same visual.
+
+Bug: 956061
+Change-Id: I88cb65b4a0313be6fdea1bd8d6770d351500ccbb
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1591946
+Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
+Reviewed-by: Antoine Labour <piman@chromium.org>
+Commit-Queue: Peng Huang <penghuang@chromium.org>
+Cr-Commit-Position: refs/heads/master@{#656497}
+---
+ .../desktop_window_tree_host_x11.cc           | 19 +++++--------------
+ 1 file changed, 5 insertions(+), 14 deletions(-)
+
+diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+index 4dda760a4d..8bdb7b026d 100644
+--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
++++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+@@ -1426,24 +1426,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
+   if (override_redirect_)
+     attribute_mask |= CWOverrideRedirect;
+ 
+-  bool enable_transparent_visuals;
+-  switch (params.opacity) {
+-    case Widget::InitParams::OPAQUE_WINDOW:
+-      enable_transparent_visuals = false;
+-      break;
+-    case Widget::InitParams::TRANSLUCENT_WINDOW:
+-      enable_transparent_visuals = true;
+-      break;
+-    case Widget::InitParams::INFER_OPACITY:
+-    default:
+-      enable_transparent_visuals = params.type == Widget::InitParams::TYPE_DRAG;
+-  }
+-
+   Visual* visual = CopyFromParent;
+   int depth = CopyFromParent;
+   Colormap colormap = CopyFromParent;
++
++  // GLSurfaceGLX always create child window with alpha channel. If the parent
++  // window doesn't have alpha channel, it causes flash, so always request argb
++  // visual.
+   ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
+-      enable_transparent_visuals, &visual, &depth, &colormap,
++      true /* want_argb_visual */, &visual, &depth, &colormap,
+       &use_argb_visual_);
+ 
+   if (colormap != CopyFromParent) {