update to upstream version 5.15.2

This commit is contained in:
pei-jiankang 2022-01-10 11:03:41 +08:00
parent 48db4c3684
commit 247f178ad0
7 changed files with 47 additions and 99 deletions

View File

@ -1,76 +0,0 @@
From cb6fce016d88622cc361a9f609518db753502e46 Mon Sep 17 00:00:00 2001
From: Chih-Hsuan Yen <yen@chyen.cc>
Date: Wed, 23 Jan 2019 16:41:35 +0800
Subject: [PATCH] Allow <style> without type attribute
According to https://www.w3.org/TR/SVG/styling.html#StyleElement, `type`
can be omitted.
> If the attribute is not specified, then the style sheet language is assumed to be CSS.
Original-Author: Christoph Feck
Fixes: QTBUG-58326
Fixes: QTBUG-69378
Change-Id: Ic3d0e8db99da8c81e5a01c0dda33fb38428e38d5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
---
src/svg/qsvghandler.cpp | 2 +-
tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp | 22 ++++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 6d2e279..132c4ec 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -3203,7 +3203,7 @@ static bool parseStyleNode(QSvgNode *parent,
Q_UNUSED(handler)
#else
const QStringRef type = attributes.value(QLatin1String("type"));
- if (type.compare(QLatin1String("text/css"), Qt::CaseInsensitive) == 0)
+ if (type.compare(QLatin1String("text/css"), Qt::CaseInsensitive) == 0 || type.isNull())
handler->setInStyle(true);
#endif
diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
index 87d24c7..1bc8b94 100644
--- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
+++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
@@ -74,6 +74,7 @@ private slots:
void testStopOffsetOpacity();
void testUseElement();
void smallFont();
+ void styleSheet();
#ifndef QT_NO_COMPRESS
void testGzLoading();
@@ -1376,5 +1377,26 @@ void tst_QSvgRenderer::smallFont()
QVERIFY(images[0] != images[1]);
}
+void tst_QSvgRenderer::styleSheet()
+{
+ static const char *svgs[] = { "<svg><style type=\"text/css\">.cls {fill:#ff0000;}</style><rect class=\"cls\" x = \"10\" y = \"10\" width = \"30\" height = \"30\"/></svg>",
+ "<svg><style>.cls {fill:#ff0000;}</style><rect class=\"cls\" x = \"10\" y = \"10\" width = \"30\" height = \"30\"/></svg>",
+ };
+ const int COUNT = sizeof(svgs) / sizeof(svgs[0]);
+ QImage images[COUNT];
+ QPainter p;
+
+ for (int i = 0; i < COUNT; ++i) {
+ QByteArray data(svgs[i]);
+ QSvgRenderer renderer(data);
+ images[i] = QImage(50, 50, QImage::Format_ARGB32_Premultiplied);
+ images[i].fill(-1);
+ p.begin(&images[i]);
+ renderer.render(&p);
+ p.end();
+ }
+ QCOMPARE(images[0], images[1]);
+}
+
QTEST_MAIN(tst_QSvgRenderer)
#include "tst_qsvgrenderer.moc"
--
2.18.1

View File

@ -1,12 +1,14 @@
Name: qt5-qtsvg
Version: 5.11.1
Release: 6
Summary: Qt GUI toolkit for rendering and displaying SVG
License: LGPLv2 with exceptions or GPLv3 with exceptions
Url: http://www.qt.io
Source0: https://download.qt.io/new_archive/qt/5.11/%{version}/submodules/qtsvg-everywhere-src-%{version}.tar.xz
Patch0001: qtsvg-opensource-src-5.6.0-beta1-example-install.patch
Patch0002: 0001-Allow-style-without-type-attribute.patch
Name: qt5-qtsvg
Version: 5.15.2
Release: 1
Summary: Qt GUI toolkit for rendering and displaying SVG
License: LGPLv2 with exceptions or GPLv3 with exceptions
Url: http://www.qt.io
%global majmin %(echo %{version} | cut -d. -f1-2)
Source0: https://download.qt.io/official_releases/qt/%{majmin}/%{version}/submodules/qtsvg-everywhere-src-%{version}.tar.xz
Patch0: qtsvg-5.15.2-clamp-parsed-doubles-to-float-representtable-values.patch
BuildRequires: make
BuildRequires: qt5-qtbase-devel >= %{version} pkgconfig(zlib) qt5-qtbase-private-devel
%{?_qt5:Requires: %{_qt5} = %{_qt5_version}}
@ -52,6 +54,7 @@ popd
%dir %{_qt5_libdir}/cmake/Qt5Svg/
%{_qt5_libdir}/{libQt5Svg.so.5*,cmake/Qt5Svg/Qt5Svg_*Plugin.cmake}
%{_qt5_plugindir}/{iconengines/libqsvgicon.so,imageformats/libqsvg.so}
%{_qt5_libdir}/cmake/Qt5Gui/Qt5Gui_QSvg*Plugin.cmake
%files devel
%{_qt5_examplesdir}/
@ -61,6 +64,9 @@ popd
%{_qt5_archdatadir}/mkspecs/modules/qt_lib_svg*.pri
%changelog
* Wed Dec 29 2021 peijiankang <peijiankang@kylinos.cn> - 5.15.2-1
- update to upstream version 5.15.2
* Wed Dec 08 2021 liuxinhao <liuxinhao@kylinos.com.cn> - 5.11.1-6
- Allow style without type attribute

View File

@ -1,4 +1,4 @@
version_control: git
src_repo: https://code.qt.io/qt/qtsvg.git
tag_prefix: ^v
seperator: .
tag_prefix: "^v"
separator: "."

View File

@ -0,0 +1,30 @@
diff -up qtsvg-everywhere-src-5.15.2/src/svg/qsvghandler.cpp.orig qtsvg-everywhere-src-5.15.2/src/svg/qsvghandler.cpp
--- qtsvg-everywhere-src-5.15.2/src/svg/qsvghandler.cpp.orig 2020-10-27 09:02:11.000000000 +0100
+++ qtsvg-everywhere-src-5.15.2/src/svg/qsvghandler.cpp 2021-03-09 17:48:50.187425243 +0100
@@ -65,6 +65,7 @@
#include "private/qmath_p.h"
#include "float.h"
+#include <cmath>
QT_BEGIN_NAMESPACE
@@ -672,6 +673,9 @@ static qreal toDouble(const QChar *&str)
val = -val;
} else {
val = QByteArray::fromRawData(temp, pos).toDouble();
+ // Do not tolerate values too wild to be represented normally by floats
+ if (std::fpclassify(float(val)) != FP_NORMAL)
+ val = 0;
}
return val;
@@ -3043,6 +3047,8 @@ static QSvgStyleProperty *createRadialGr
ncy = toDouble(cy);
if (!r.isEmpty())
nr = toDouble(r);
+ if (nr < 0.5)
+ nr = 0.5;
qreal nfx = ncx;
if (!fx.isEmpty())

Binary file not shown.

Binary file not shown.

View File

@ -1,12 +0,0 @@
diff --git a/examples/svg/richtext/textobject/textobject.pro b/examples/svg/richtext/textobject/textobject.pro
index 8892ae7..f9ec7c6 100644
--- a/examples/svg/richtext/textobject/textobject.pro
+++ b/examples/svg/richtext/textobject/textobject.pro
@@ -14,6 +14,6 @@ INSTALLS += target
wince*{
filesToDeploy.files = files/*.svg
- filesToDeploy.path = files
+ filesToDeploy.path = $$[QT_INSTALL_EXAMPLES]/svg/richtext/textobject/files
DEPLOYMENT += filesToDeploy
}