diff options
author | Matthias Rauter <matthias.rauter@qt.io> | 2024-04-16 10:20:16 +0200 |
---|---|---|
committer | Matthias Rauter <matthias.rauter@qt.io> | 2024-04-19 08:31:26 +0200 |
commit | bcfbccf32711ea0b93a03ada30c5f73af0da5121 (patch) | |
tree | 9adf1487c32abe7c9446301778be1aae2d0b65cc | |
parent | 158e9e6a0380619c4b8c57a0161883c01a626325 (diff) |
Consider the % symbol for the filter size
The % symbol was not parsed in the filter size, leading to filter sizes
100 times too big. This is corrected by considering the % symbol during
parsing.
Fixes: QTBUG-124287
Pick-to: 6.7
Change-Id: I517df1ef989890d0e6ed62e9bd7f91575af8e691
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
-rw-r--r-- | src/svg/qsvghandler.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 28a6fe5..bf906e8 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -3162,6 +3162,10 @@ static void parseFilterBounds(QSvgNode *, const QXmlStreamAttributes &attributes x = parseLength(xStr.toString(), &type, handler); if (type != QSvgHandler::LT_PT) x = convertToPixels(x, true, type); + if (type == QSvgHandler::LT_PERCENT) { + x /= 100.; + rect->setUnitX(QtSvg::UnitTypes::objectBoundingBox); + } rect->setX(x); } else { rect->setX(-0.1); @@ -3173,6 +3177,10 @@ static void parseFilterBounds(QSvgNode *, const QXmlStreamAttributes &attributes y = parseLength(yStr.toString(), &type, handler); if (type != QSvgHandler::LT_PT) y = convertToPixels(y, false, type); + if (type == QSvgHandler::LT_PERCENT) { + y /= 100.; + rect->setUnitX(QtSvg::UnitTypes::objectBoundingBox); + } rect->setY(y); } else { rect->setY(-0.1); @@ -3184,6 +3192,10 @@ static void parseFilterBounds(QSvgNode *, const QXmlStreamAttributes &attributes width = parseLength(widthStr.toString(), &type, handler); if (type != QSvgHandler::LT_PT) width = convertToPixels(width, true, type); + if (type == QSvgHandler::LT_PERCENT) { + width /= 100.; + rect->setUnitX(QtSvg::UnitTypes::objectBoundingBox); + } rect->setWidth(width); } else { rect->setWidth(1.2); @@ -3195,6 +3207,10 @@ static void parseFilterBounds(QSvgNode *, const QXmlStreamAttributes &attributes height = parseLength(heightStr.toString(), &type, handler); if (type != QSvgHandler::LT_PT) height = convertToPixels(height, false, type); + if (type == QSvgHandler::LT_PERCENT) { + height /= 100.; + rect->setUnitX(QtSvg::UnitTypes::objectBoundingBox); + } rect->setHeight(height); } else { rect->setHeight(1.2); |