qt5-5.9.0.patch 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. --- qtwebengine/src/core/web_engine_context.cpp
  2. +++ qtwebengine/src/core/web_engine_context.cpp
  3. @@ -347,6 +347,12 @@
  4. parsedCommandLine->AppendSwitchASCII(switches::kProfilerTiming, switches::kProfilerTimingDisabledValue);
  5. }
  6. + parsedCommandLine->AppendSwitch(switches::kEnableViewport);
  7. +#if defined(Q_OS_WIN)
  8. + parsedCommandLine->AppendSwitch(switches::kDisableGpu);
  9. +#endif
  10. + parsedCommandLine->AppendSwitch(switches::kDisableWebSecurity);
  11. +
  12. GLContextHelper::initialize();
  13. const char *glType = 0;
  14. @@ -389,8 +395,10 @@
  15. }
  16. }
  17. } else {
  18. + QSurfaceFormat format = qt_gl_global_share_context()->format();
  19. + // NOTE: kGLImplementationDesktopGLCoreProfileName is only implemented on macOS at the moment
  20. if (!qt_gl_global_share_context()->isOpenGLES())
  21. - glType = gl::kGLImplementationDesktopName;
  22. + glType = format.majorVersion() < 3 ? gl::kGLImplementationDesktopName : gl::kGLImplementationDesktopGLCoreProfileName;
  23. }
  24. } else {
  25. qWarning("WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed.");
  26. --- qtbase/src/plugins/platforms/cocoa/qnsview.mm
  27. +++ qtbase/src/plugins/platforms/cocoa/qnsview.mm
  28. @@ -563,7 +563,7 @@
  29. return NO;
  30. if ([self isTransparentForUserInput])
  31. return NO;
  32. - return YES;
  33. + return NO;
  34. }
  35. - (NSView *)hitTest:(NSPoint)aPoint
  36. --- qtbase/src/gui/kernel/qsurfaceformat.cpp
  37. +++ qtbase/src/gui/kernel/qsurfaceformat.cpp
  38. @@ -110,6 +110,7 @@
  39. int major;
  40. int minor;
  41. int swapInterval;
  42. + QSurfaceFormat::OrientationFlags orientationFlags;
  43. };
  44. /*!
  45. @@ -736,6 +737,16 @@
  46. return d->swapInterval;
  47. }
  48. +QSurfaceFormat::OrientationFlags QSurfaceFormat::orientationFlags() const
  49. +{
  50. + return d->orientationFlags;
  51. +}
  52. +
  53. +void QSurfaceFormat::setOrientationFlags(QSurfaceFormat::OrientationFlags orientationFlags)
  54. +{
  55. + d->orientationFlags = orientationFlags;
  56. +}
  57. +
  58. Q_GLOBAL_STATIC(QSurfaceFormat, qt_default_surface_format)
  59. /*!
  60. --- qtbase/src/gui/kernel/qsurfaceformat.h
  61. +++ qtbase/src/gui/kernel/qsurfaceformat.h
  62. @@ -57,7 +57,8 @@
  63. StereoBuffers = 0x0001,
  64. DebugContext = 0x0002,
  65. DeprecatedFunctions = 0x0004,
  66. - ResetNotification = 0x0008
  67. + ResetNotification = 0x0008,
  68. + UseOptimalOrientation = 0x0010
  69. };
  70. Q_ENUM(FormatOption)
  71. Q_DECLARE_FLAGS(FormatOptions, FormatOption)
  72. @@ -85,6 +86,11 @@
  73. };
  74. Q_ENUM(OpenGLContextProfile)
  75. + enum OrientationFlag {
  76. + MirrorVertically = 0x0001,
  77. + };
  78. + Q_DECLARE_FLAGS(OrientationFlags, OrientationFlag)
  79. +
  80. QSurfaceFormat();
  81. /*implicit*/ QSurfaceFormat(FormatOptions options);
  82. QSurfaceFormat(const QSurfaceFormat &other);
  83. @@ -145,6 +151,9 @@
  84. int swapInterval() const;
  85. void setSwapInterval(int interval);
  86. + QSurfaceFormat::OrientationFlags orientationFlags() const;
  87. + void setOrientationFlags(QSurfaceFormat::OrientationFlags orientationFlags);
  88. +
  89. static void setDefaultFormat(const QSurfaceFormat &format);
  90. static QSurfaceFormat defaultFormat();
  91. --- qtbase/src/plugins/platforms/windows/qwindowseglcontext.cpp
  92. +++ qtbase/src/plugins/platforms/windows/qwindowseglcontext.cpp
  93. @@ -297,11 +297,25 @@
  94. return new QWindowsEGLContext(this, context->format(), context->shareHandle());
  95. }
  96. -void *QWindowsEGLStaticContext::createWindowSurface(void *nativeWindow, void *nativeConfig, int *err)
  97. +void *QWindowsEGLStaticContext::createWindowSurface(void *nativeWindow, void *nativeConfig, const QSurfaceFormat format, int *err)
  98. {
  99. *err = 0;
  100. +
  101. + std::vector<EGLint> attrib_list;
  102. +#ifdef EGL_ANGLE_surface_orientation
  103. + if (format.testOption(QSurfaceFormat::UseOptimalOrientation)) {
  104. + EGLint surfaceOrientation = 0;
  105. + libEGL.eglGetConfigAttrib(m_display, nativeConfig, EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE, &surfaceOrientation);
  106. + if (surfaceOrientation & EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE) {
  107. + attrib_list.push_back(EGL_SURFACE_ORIENTATION_ANGLE);
  108. + attrib_list.push_back(EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE);
  109. + }
  110. + }
  111. +#endif
  112. + attrib_list.push_back(EGL_NONE);
  113. EGLSurface surface = libEGL.eglCreateWindowSurface(m_display, nativeConfig,
  114. - static_cast<EGLNativeWindowType>(nativeWindow), 0);
  115. + static_cast<EGLNativeWindowType>(nativeWindow),
  116. + &attrib_list[0]);
  117. if (surface == EGL_NO_SURFACE) {
  118. *err = libEGL.eglGetError();
  119. qWarning("%s: Could not create the EGL window surface: 0x%x", __FUNCTION__, *err);
  120. @@ -350,6 +364,14 @@
  121. format.setStereo(false);
  122. format.setSwapInterval(referenceFormat.swapInterval());
  123. +#ifdef EGL_ANGLE_surface_orientation
  124. + if (referenceFormat.testOption(QSurfaceFormat::UseOptimalOrientation)) {
  125. + EGLint surfaceOrientation = 0;
  126. + libEGL.eglGetConfigAttrib(display, config, EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE, &surfaceOrientation);
  127. + format.setOrientationFlags((surfaceOrientation & EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE) ? QSurfaceFormat::MirrorVertically : QSurfaceFormat::OrientationFlags());
  128. + }
  129. +#endif
  130. +
  131. // Clear the EGL error state because some of the above may
  132. // have errored out because the attribute is not applicable
  133. // to the surface type. Such errors don't matter.
  134. @@ -443,7 +465,7 @@
  135. }
  136. }
  137. m_format.setProfile(QSurfaceFormat::NoProfile);
  138. - m_format.setOptions(QSurfaceFormat::FormatOptions());
  139. + m_format.setOptions(m_format.options() & QSurfaceFormat::UseOptimalOrientation);
  140. QWindowsEGLStaticContext::libEGL.eglMakeCurrent(prevDisplay, prevSurfaceDraw, prevSurfaceRead, prevContext);
  141. }
  142. QWindowsEGLStaticContext::libEGL.eglDestroySurface(m_eglDisplay, pbuffer);
  143. --- qtbase/src/plugins/platforms/windows/qwindowseglcontext.h
  144. +++ qtbase/src/plugins/platforms/windows/qwindowseglcontext.h
  145. @@ -121,7 +121,7 @@
  146. void *moduleHandle() const override { return libGLESv2.moduleHandle(); }
  147. QOpenGLContext::OpenGLModuleType moduleType() const override { return QOpenGLContext::LibGLES; }
  148. - void *createWindowSurface(void *nativeWindow, void *nativeConfig, int *err) override;
  149. + void *createWindowSurface(void *nativeWindow, void *nativeConfig, const QSurfaceFormat format, int *err) Q_DECL_OVERRIDE;
  150. void destroyWindowSurface(void *nativeSurface) override;
  151. QSurfaceFormat formatFromConfig(EGLDisplay display, EGLConfig config, const QSurfaceFormat &referenceFormat);
  152. --- qtbase/src/plugins/platforms/windows/qwindowsopenglcontext.h
  153. +++ qtbase/src/plugins/platforms/windows/qwindowsopenglcontext.h
  154. @@ -62,7 +62,7 @@ public:
  155. // If the windowing system interface needs explicitly created window surfaces (like EGL),
  156. // reimplement these.
  157. - virtual void *createWindowSurface(void * /*nativeWindow*/, void * /*nativeConfig*/, int * /*err*/) { return 0; }
  158. + virtual void *createWindowSurface(void * /*nativeWindow*/, void * /*nativeConfig*/, const QSurfaceFormat /*format*/, int * /*err*/) { return 0; }
  159. virtual void destroyWindowSurface(void * /*nativeSurface*/) { }
  160. private:
  161. --- qtbase/src/plugins/platforms/windows/qwindowswindow.cpp
  162. +++ qtbase/src/plugins/platforms/windows/qwindowswindow.cpp
  163. @@ -2384,7 +2384,7 @@
  164. #else
  165. if (!m_surface) {
  166. if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext())
  167. - m_surface = staticOpenGLContext->createWindowSurface(m_data.hwnd, nativeConfig, err);
  168. + m_surface = staticOpenGLContext->createWindowSurface(m_data.hwnd, nativeConfig, m_format, err);
  169. }
  170. return m_surface;
  171. --- qtwebengine/src/core/web_engine_settings.cpp
  172. +++ qtwebengine/src/core/web_engine_settings.cpp
  173. @@ -299,6 +299,8 @@
  174. {
  175. // Override for now
  176. prefs->touch_enabled = isTouchScreenAvailable();
  177. + prefs->viewport_meta_enabled = true;
  178. + prefs->shrinks_viewport_contents_to_fit = true;
  179. if (prefs->viewport_enabled) {
  180. // We should enable viewport and viewport-meta together, but since 5.7 we
  181. // no longer have a command-line flag for viewport-meta.
  182. --- qtdeclarative/src/quick/items/qquickwindow.cpp
  183. +++ qtdeclarative/src/quick/items/qquickwindow.cpp
  184. @@ -465,7 +465,13 @@
  185. QRect rect(QPoint(0, 0), devicePixelRatio * size);
  186. renderer->setDeviceRect(rect);
  187. renderer->setViewportRect(rect);
  188. - renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), size));
  189. + QRectF projRect(QPoint(0, 0), size);
  190. + bool mirrorVertically = QOpenGLContext::currentContext()->format().orientationFlags() & QSurfaceFormat::MirrorVertically;
  191. + QRectF mirrored(projRect.left(),
  192. + mirrorVertically ? projRect.bottom() : projRect.top(),
  193. + projRect.width(),
  194. + mirrorVertically ? -projRect.height() : projRect.height());
  195. + renderer->setProjectionMatrixToRect(mirrored);
  196. renderer->setDevicePixelRatio(devicePixelRatio);
  197. }
  198. --- qtbase/src/network/ssl/qsslsocket_mac.cpp
  199. +++ qtbase/src/network/ssl/qsslsocket_mac.cpp
  200. @@ -1220,7 +1220,10 @@
  201. for (const QSslCertificate &cert : qAsConst(configuration.caCertificates)) {
  202. QCFType<CFDataRef> certData = cert.d->derData.toCFData();
  203. QCFType<SecCertificateRef> certRef = SecCertificateCreateWithData(NULL, certData);
  204. - CFArrayAppendValue(certArray, certRef);
  205. + // This should not be null but we don't know why
  206. + // https://bugreports.qt.io/browse/QTBUG-58213
  207. + if (certRef)
  208. + CFArrayAppendValue(certArray, certRef);
  209. }
  210. SecTrustSetAnchorCertificates(trust, certArray);
  211. // Secure Transport should use anchors only from our QSslConfiguration:
  212. --- qtwebengine/src/3rdparty/chromium/ui/gl/gl_implementation.cc
  213. +++ qtwebengine/src/3rdparty/chromium/ui/gl/gl_implementation.cc
  214. @@ -29,6 +29,7 @@
  215. GLImplementation implementation;
  216. } kGLImplementationNamePairs[] = {
  217. { kGLImplementationDesktopName, kGLImplementationDesktopGL },
  218. + { kGLImplementationDesktopGLCoreProfileName, kGLImplementationDesktopGLCoreProfile },
  219. { kGLImplementationOSMesaName, kGLImplementationOSMesaGL },
  220. #if defined(OS_MACOSX)
  221. { kGLImplementationAppleName, kGLImplementationAppleGL },
  222. --- qtwebengine/src/3rdparty/chromium/ui/gl/gl_switches.cc
  223. +++ qtwebengine/src/3rdparty/chromium/ui/gl/gl_switches.cc
  224. @@ -8,6 +8,7 @@
  225. namespace gl {
  226. const char kGLImplementationDesktopName[] = "desktop";
  227. +const char kGLImplementationDesktopGLCoreProfileName[] = "desktop-core";
  228. const char kGLImplementationOSMesaName[] = "osmesa";
  229. const char kGLImplementationAppleName[] = "apple";
  230. const char kGLImplementationEGLName[] = "egl";
  231. --- qtwebengine/src/3rdparty/chromium/ui/gl/gl_switches.h
  232. +++ qtwebengine/src/3rdparty/chromium/ui/gl/gl_switches.h
  233. @@ -13,6 +13,7 @@ namespace gl {
  234. // The GL implementation names that can be passed to --use-gl.
  235. GL_EXPORT extern const char kGLImplementationDesktopName[];
  236. +GL_EXPORT extern const char kGLImplementationDesktopGLCoreProfileName[];
  237. GL_EXPORT extern const char kGLImplementationOSMesaName[];
  238. GL_EXPORT extern const char kGLImplementationAppleName[];
  239. GL_EXPORT extern const char kGLImplementationEGLName[];
  240. --- qtwebengine/mkspecs/features/gn_generator.prf
  241. +++ qtwebengine/mkspecs/features/gn_generator.prf
  242. @@ -179,22 +179,21 @@
  243. GN_CONTENTS += " ]"
  244. GN_CONTENTS += " if (!defined(ldflags)) {"\
  245. " ldflags = []"\
  246. " }"
  247. GN_CONTENTS += " ldflags += ["
  248. for (flag, QMAKE_LFLAGS): GN_CONTENTS += " \"$$filter_flag_values($$flag)\","
  249. for (flag, GN_FLAGS): GN_CONTENTS += " \"$$flag\","
  250. !isEmpty(QMAKE_RPATHDIR) {
  251. for (rpath, QMAKE_RPATHDIR) {
  252. - macos: GN_CONTENTS += " \"-Wl,-rpath,$${rpath}\","
  253. - else:unix: GN_CONTENTS += " \"-Wl,-rpath=$${rpath}\","
  254. + unix:!macos: GN_CONTENTS += " \"-Wl,-rpath=$${rpath}\","
  255. }
  256. }
  257. !isEmpty(QMAKE_RPATHLINKDIR): GN_CONTENTS += " \"-Wl,-rpath-link=$${QMAKE_RPATHLINKDIR}\","
  258. GN_CONTENTS += " ]"
  259. GN_CONTENTS += " if (!defined(lib_dirs)) {"\
  260. " lib_dirs = []"\
  261. " }"
  262. GN_CONTENTS += " lib_dirs += ["
  263. lib_dirs = $$find(LIBS, ^-L.*)
  264. --- qtwebengine/src/3rdparty/chromium/base/memory/shared_memory_mac.cc
  265. +++ qtwebengine/src/3rdparty/chromium/base/memory/shared_memory_mac.cc
  266. @@ -102,7 +102,7 @@ void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) {
  267. // static
  268. size_t SharedMemory::GetHandleLimit() {
  269. // This should be effectively unlimited on OS X.
  270. - return 10000;
  271. + return std::numeric_limits<int>::max();
  272. }
  273. // static
  274. --- qtwebengine/src/3rdparty/chromium/net/base/ip_address.cc
  275. +++ qtwebengine/src/3rdparty/chromium/net/base/ip_address.cc
  276. @@ -13,6 +13,8 @@
  277. #include "url/gurl.h"
  278. #include "url/url_canon_ip.h"
  279. +#include "base/strings/string_util.h"
  280. +
  281. namespace {
  282. // The prefix for IPv6 mapped IPv4 addresses.
  283. @@ -119,6 +121,17 @@ bool ParseIPLiteralToBytes(const base::StringPiece& ip_literal,
  284. bytes->data());
  285. }
  286. + if (ip_literal.ends_with(".plex.direct")) {
  287. + std::string literal2 = ip_literal.substr(0, ip_literal.find('.')).as_string();
  288. + base::ReplaceChars(literal2, "-", ".", &literal2);
  289. + bytes->resize(4); // 32 bits.
  290. + url::Component comp2(0, literal2.size());
  291. + int num_comp2;
  292. + url::CanonHostInfo::Family family2 = url::IPv4AddressToNumber(
  293. + literal2.data(), comp2, bytes->data(), &num_comp2);
  294. + return family2 == url::CanonHostInfo::IPV4;
  295. + }
  296. +
  297. // Otherwise the string is an IPv4 address.
  298. bytes->resize(4); // 32 bits.
  299. url::Component host_comp(0, ip_literal.size());
  300. --- qtwebengine/src/3rdparty/chromium/cc/trees/layer_tree_settings.cc
  301. +++ qtwebengine/src/3rdparty/chromium/cc/trees/layer_tree_settings.cc
  302. @@ -16,7 +16,7 @@ LayerTreeSettings::LayerTreeSettings()
  303. gpu_memory_policy(64 * 1024 * 1024,
  304. gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING,
  305. ManagedMemoryPolicy::kDefaultNumResourcesLimit),
  306. - software_memory_policy(128 * 1024 * 1024,
  307. + software_memory_policy(512 * 1024 * 1024,
  308. gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
  309. ManagedMemoryPolicy::kDefaultNumResourcesLimit) {}