Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/svg/qsvghandler.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    7575#define QT_INHERIT QLatin1String(qt_inherit_text)
    7676
    77 Q_DECL_IMPORT double qstrtod(const char *s00, char const **se, bool *ok);
     77Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok);
    7878
    7979// ======== duplicated from qcolor_p
     
    12831283
    12841284    if (!attributes.fontSize.isEmpty() && attributes.fontSize != QT_INHERIT) {
     1285        // TODO: Support relative sizes 'larger' and 'smaller'.
    12851286        QSvgHandler::LengthType dummy; // should always be pixel size
    1286         fontStyle->setSize(parseLength(attributes.fontSize.toString(), dummy, handler));
     1287        qreal size = 0;
     1288        static const qreal sizeTable[] = { qreal(6.9), qreal(8.3), qreal(10.0), qreal(12.0), qreal(14.4), qreal(17.3), qreal(20.7) };
     1289        enum AbsFontSize { XXSmall, XSmall, Small, Medium, Large, XLarge, XXLarge };
     1290        switch (attributes.fontSize.at(0).unicode()) {
     1291        case 'x':
     1292            if (attributes.fontSize == QLatin1String("xx-small"))
     1293                size = sizeTable[XXSmall];
     1294            else if (attributes.fontSize == QLatin1String("x-small"))
     1295                size = sizeTable[XSmall];
     1296            else if (attributes.fontSize == QLatin1String("x-large"))
     1297                size = sizeTable[XLarge];
     1298            else if (attributes.fontSize == QLatin1String("xx-large"))
     1299                size = sizeTable[XXLarge];
     1300            break;
     1301        case 's':
     1302            if (attributes.fontSize == QLatin1String("small"))
     1303                size = sizeTable[Small];
     1304            break;
     1305        case 'm':
     1306            if (attributes.fontSize == QLatin1String("medium"))
     1307                size = sizeTable[Medium];
     1308            break;
     1309        case 'l':
     1310            if (attributes.fontSize == QLatin1String("large"))
     1311                size = sizeTable[Large];
     1312            break;
     1313        default:
     1314            size = parseLength(attributes.fontSize.toString(), dummy, handler);
     1315            break;
     1316        }
     1317        fontStyle->setSize(size);
    12871318    }
    12881319
     
    29632994        nry = bounds.height()/2;
    29642995
    2965     if (nrx && !nry)
     2996    if (!rx.isEmpty() && ry.isEmpty())
    29662997        nry = nrx;
    2967     else if (nry && !nrx)
     2998    else if (!ry.isEmpty() && rx.isEmpty())
    29682999        nrx = nry;
    29693000
     
    35263557            // this point is to do what everyone else seems to do and
    35273558            // ignore the reported namespaceUri completely.
    3528             startElement(xml->name().toString(), xml->attributes());
     3559            if (!startElement(xml->name().toString(), xml->attributes())) {
     3560                delete m_doc;
     3561                m_doc = 0;
     3562                return;
     3563            }
    35293564            break;
    35303565        case QXmlStreamReader::EndElement:
     
    35703605        m_whitespaceMode.push(QSvgText::Default);
    35713606    }
     3607
     3608    if (!m_doc && localName != QLatin1String("svg"))
     3609        return false;
    35723610
    35733611    if (FactoryMethod method = findGroupFactory(localName)) {
     
    37453783        m_selector->styleSheets.append(sheet);
    37463784        return true;
    3747     } else if (m_skipNodes.isEmpty() || m_skipNodes.top() == Unknown)
     3785    } else if (m_skipNodes.isEmpty() || m_skipNodes.top() == Unknown || m_nodes.isEmpty())
    37483786        return true;
    37493787
Note: See TracChangeset for help on using the changeset viewer.