src/svg/qsvghandler.cpp
changeset 30 5dc02b23752f
parent 22 79de32ba3296
child 37 758a864f9613
--- a/src/svg/qsvghandler.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/svg/qsvghandler.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -2962,9 +2962,9 @@
     if (nry > bounds.height()/2)
         nry = bounds.height()/2;
 
-    if (nrx && !nry)
+    if (!rx.isEmpty() && ry.isEmpty())
         nry = nrx;
-    else if (nry && !nrx)
+    else if (!ry.isEmpty() && rx.isEmpty())
         nrx = nry;
 
     //we draw rounded rect from 0...99
@@ -3525,7 +3525,11 @@
             // namespaceUri is empty. The only possible strategy at
             // this point is to do what everyone else seems to do and
             // ignore the reported namespaceUri completely.
-            startElement(xml->name().toString(), xml->attributes());
+            if (!startElement(xml->name().toString(), xml->attributes())) {
+                delete m_doc;
+                m_doc = 0;
+                return;
+            }
             break;
         case QXmlStreamReader::EndElement:
             endElement(xml->name());
@@ -3570,6 +3574,9 @@
         m_whitespaceMode.push(QSvgText::Default);
     }
 
+    if (!m_doc && localName != QLatin1String("svg"))
+        return false;
+
     if (FactoryMethod method = findGroupFactory(localName)) {
         //group
         node = method(m_doc ? m_nodes.top() : 0, attributes, this);
@@ -3744,7 +3751,7 @@
         QCss::Parser(css).parse(&sheet);
         m_selector->styleSheets.append(sheet);
         return true;
-    } else if (m_skipNodes.isEmpty() || m_skipNodes.top() == Unknown)
+    } else if (m_skipNodes.isEmpty() || m_skipNodes.top() == Unknown || m_nodes.isEmpty())
         return true;
 
     if (m_nodes.top()->type() == QSvgNode::TEXT || m_nodes.top()->type() == QSvgNode::TEXTAREA) {