diff options
Diffstat (limited to 'src/gui/text')
59 files changed, 721 insertions, 500 deletions
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp index ff2497817e..2278378613 100644 --- a/src/gui/text/qabstracttextdocumentlayout.cpp +++ b/src/gui/text/qabstracttextdocumentlayout.cpp @@ -602,9 +602,32 @@ QTextDocument *QAbstractTextDocumentLayout::document() const */ QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const { + QTextCharFormat fmt = formatAt(pos).toCharFormat(); + return fmt.anchorHref(); +} + +/*! + \since 5.8 + + Returns the source of the image at the given position \a pos, or an empty + string if no image exists at that point. +*/ +QString QAbstractTextDocumentLayout::imageAt(const QPointF &pos) const +{ + QTextImageFormat fmt = formatAt(pos).toImageFormat(); + return fmt.name(); +} + +/*! + \since 5.8 + + Returns the text format at the given position \a pos. +*/ +QTextFormat QAbstractTextDocumentLayout::formatAt(const QPointF &pos) const +{ int cursorPos = hitTest(pos, Qt::ExactHit); if (cursorPos == -1) - return QString(); + return QTextFormat(); // compensate for preedit in the hit text block QTextBlock block = document()->firstBlock(); @@ -623,8 +646,7 @@ QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const QTextDocumentPrivate *pieceTable = qobject_cast<const QTextDocument *>(parent())->docHandle(); QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos); - QTextCharFormat fmt = pieceTable->formatCollection()->charFormat(it->format); - return fmt.anchorHref(); + return pieceTable->formatCollection()->format(it->format); } /*! diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index 01704fe37b..438ad6e70b 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -40,6 +40,7 @@ #ifndef QABSTRACTTEXTDOCUMENTLAYOUT_H #define QABSTRACTTEXTDOCUMENTLAYOUT_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> #include <QtGui/qtextlayout.h> #include <QtGui/qtextdocument.h> @@ -82,7 +83,10 @@ public: virtual void draw(QPainter *painter, const PaintContext &context) = 0; virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const = 0; + QString anchorAt(const QPointF& pos) const; + QString imageAt(const QPointF &pos) const; + QTextFormat formatAt(const QPointF &pos) const; virtual int pageCount() const = 0; virtual QSizeF documentSize() const = 0; diff --git a/src/gui/text/qabstracttextdocumentlayout_p.h b/src/gui/text/qabstracttextdocumentlayout_p.h index fc39d8ec5c..191c463dc6 100644 --- a/src/gui/text/qabstracttextdocumentlayout_p.h +++ b/src/gui/text/qabstracttextdocumentlayout_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "private/qobject_p.h" #include "QtCore/qhash.h" diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index c237d80d34..72c5d5ff33 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -900,7 +900,7 @@ static QBrush brushFromData(const BrushData& c, const QPalette &pal) } } -static BorderStyle parseStyleValue(QCss::Value v) +static BorderStyle parseStyleValue(const QCss::Value &v) { if (v.type == Value::KnownIdentifier) { switch (v.variant.toInt()) { @@ -1867,12 +1867,15 @@ bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node) do { match = basicSelectorMatches(sel, node); if (!match) { - if (sel.relationToNext == BasicSelector::MatchNextSelectorIfParent - || i == selector.basicSelectors.count() - 1) // first element must always match! + if (i == selector.basicSelectors.count() - 1) // first element must always match! + break; + if (sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor && + sel.relationToNext != BasicSelector::MatchNextSelectorIfIndirectAdjecent) break; } - if (match || sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor) + if (match || (sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor && + sel.relationToNext != BasicSelector::MatchNextSelectorIfIndirectAdjecent)) --i; if (i < 0) @@ -1885,16 +1888,18 @@ bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node) NodePtr nextParent = parentNode(node); freeNode(node); node = nextParent; - } else if (sel.relationToNext == BasicSelector::MatchNextSelectorIfPreceeds) { + } else if (sel.relationToNext == BasicSelector::MatchNextSelectorIfDirectAdjecent + || sel.relationToNext == BasicSelector::MatchNextSelectorIfIndirectAdjecent) { NodePtr previousSibling = previousSiblingNode(node); freeNode(node); node = previousSibling; - } + } if (isNullNode(node)) { match = false; break; } - } while (i >= 0 && (match || sel.relationToNext == BasicSelector::MatchNextSelectorIfAncestor)); + } while (i >= 0 && (match || sel.relationToNext == BasicSelector::MatchNextSelectorIfAncestor + || sel.relationToNext == BasicSelector::MatchNextSelectorIfIndirectAdjecent)); freeNode(node); @@ -1914,18 +1919,38 @@ bool StyleSelector::basicSelectorMatches(const BasicSelector &sel, NodePtr node) if (attrValue.isNull()) return false; - if (a.valueMatchCriterium == QCss::AttributeSelector::MatchContains) { + switch (a.valueMatchCriterium) { + case QCss::AttributeSelector::NoMatch: + break; + case QCss::AttributeSelector::MatchEqual: + if (attrValue != a.value) + return false; + break; + case QCss::AttributeSelector::MatchIncludes: { const auto lst = attrValue.splitRef(QLatin1Char(' ')); if (!lst.contains(QStringRef(&a.value))) return false; - } else if ( - (a.valueMatchCriterium == QCss::AttributeSelector::MatchEqual - && attrValue != a.value) - || - (a.valueMatchCriterium == QCss::AttributeSelector::MatchBeginsWith - && !attrValue.startsWith(a.value)) - ) - return false; + break; + } + case QCss::AttributeSelector::MatchDashMatch: { + const QString dashPrefix = a.value + QLatin1Char('-'); + if (attrValue != a.value && !attrValue.startsWith(dashPrefix)) + return false; + break; + } + case QCss::AttributeSelector::MatchBeginsWith: + if (!attrValue.startsWith(a.value)) + return false; + break; + case QCss::AttributeSelector::MatchEndsWith: + if (!attrValue.endsWith(a.value)) + return false; + break; + case QCss::AttributeSelector::MatchContains: + if (!attrValue.contains(a.value)) + return false; + break; + } } } @@ -2336,9 +2361,11 @@ bool Parser::parseCombinator(BasicSelector::Relation *relation) prev(); } if (test(PLUS)) { - *relation = BasicSelector::MatchNextSelectorIfPreceeds; + *relation = BasicSelector::MatchNextSelectorIfDirectAdjecent; } else if (test(GREATER)) { *relation = BasicSelector::MatchNextSelectorIfParent; + } else if (test(TILDE)) { + *relation = BasicSelector::MatchNextSelectorIfIndirectAdjecent; } skipSpace(); return true; @@ -2439,7 +2466,7 @@ bool Parser::parseSimpleSelector(BasicSelector *basicSel) onceMore = true; AttributeSelector a; a.name = QLatin1String("class"); - a.valueMatchCriterium = AttributeSelector::MatchContains; + a.valueMatchCriterium = AttributeSelector::MatchIncludes; if (!parseClass(&a.value)) return false; basicSel->attributeSelectors.append(a); } else if (testAttrib()) { @@ -2485,9 +2512,15 @@ bool Parser::parseAttrib(AttributeSelector *attr) if (test(EQUAL)) { attr->valueMatchCriterium = AttributeSelector::MatchEqual; } else if (test(INCLUDES)) { - attr->valueMatchCriterium = AttributeSelector::MatchContains; + attr->valueMatchCriterium = AttributeSelector::MatchIncludes; } else if (test(DASHMATCH)) { + attr->valueMatchCriterium = AttributeSelector::MatchDashMatch; + } else if (test(BEGINSWITH)) { attr->valueMatchCriterium = AttributeSelector::MatchBeginsWith; + } else if (test(ENDSWITH)) { + attr->valueMatchCriterium = AttributeSelector::MatchEndsWith; + } else if (test(CONTAINS)) { + attr->valueMatchCriterium = AttributeSelector::MatchContains; } else { return next(RBRACKET); } diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index 4da7b62dba..f5cd5395b2 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/QStringList> #include <QtCore/QVector> #include <QtCore/QVariant> @@ -538,8 +539,11 @@ struct AttributeSelector enum ValueMatchType { NoMatch, MatchEqual, - MatchContains, - MatchBeginsWith + MatchIncludes, + MatchDashMatch, + MatchBeginsWith, + MatchEndsWith, + MatchContains }; inline AttributeSelector() : valueMatchCriterium(NoMatch) {} @@ -557,7 +561,8 @@ struct BasicSelector NoRelation, MatchNextSelectorIfAncestor, MatchNextSelectorIfParent, - MatchNextSelectorIfPreceeds + MatchNextSelectorIfDirectAdjecent, + MatchNextSelectorIfIndirectAdjecent, }; QString elementName; @@ -678,11 +683,15 @@ enum TokenType { CDC, INCLUDES, DASHMATCH, + BEGINSWITH, + ENDSWITH, + CONTAINS, LBRACE, PLUS, GREATER, COMMA, + TILDE, STRING, INVALID, @@ -782,7 +791,7 @@ public: inline bool testImport() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("import")); } inline bool testMedia() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("media")); } inline bool testPage() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("page")); } - inline bool testCombinator() { return test(PLUS) || test(GREATER) || test(S); } + inline bool testCombinator() { return test(PLUS) || test(GREATER) || test(TILDE) || test(S); } inline bool testProperty() { return test(IDENT); } bool testTerm(); inline bool testExpr() { return testTerm(); } diff --git a/src/gui/text/qcssscanner.cpp b/src/gui/text/qcssscanner.cpp index f6b25d50ba..33dc01c8bc 100644 --- a/src/gui/text/qcssscanner.cpp +++ b/src/gui/text/qcssscanner.cpp @@ -88,8 +88,10 @@ int QCssScanner_Generated::lex() goto state_3; if (ch.unicode() == 35) goto state_4; - if (ch.unicode() == 39) + if (ch.unicode() == 36) goto state_5; + if (ch.unicode() == 39) + goto state_6; if (ch.unicode() == 40) { token = QCss::LPAREN; goto found; @@ -98,22 +100,20 @@ int QCssScanner_Generated::lex() token = QCss::RPAREN; goto found; } - if (ch.unicode() == 42) { - token = QCss::STAR; - goto found; - } - if (ch.unicode() == 43) + if (ch.unicode() == 42) goto state_9; - if (ch.unicode() == 44) + if (ch.unicode() == 43) goto state_10; - if (ch.unicode() == 45) + if (ch.unicode() == 44) goto state_11; - if (ch.unicode() == 46) + if (ch.unicode() == 45) goto state_12; - if (ch.unicode() == 47) + if (ch.unicode() == 46) goto state_13; - if (ch.unicode() >= 48 && ch.unicode() <= 57) + if (ch.unicode() == 47) goto state_14; + if (ch.unicode() >= 48 && ch.unicode() <= 57) + goto state_15; if (ch.unicode() == 58) { token = QCss::COLON; goto found; @@ -123,147 +123,167 @@ int QCssScanner_Generated::lex() goto found; } if (ch.unicode() == 60) - goto state_17; + goto state_18; if (ch.unicode() == 61) { token = QCss::EQUAL; goto found; } if (ch.unicode() == 62) - goto state_19; - if (ch.unicode() == 64) goto state_20; + if (ch.unicode() == 64) + goto state_21; if (ch.unicode() == 91) { token = QCss::LBRACKET; goto found; } if (ch.unicode() == 92) - goto state_22; + goto state_23; if (ch.unicode() == 93) { token = QCss::RBRACKET; goto found; } + if (ch.unicode() == 94) + goto state_25; if (ch.unicode() == 95) - goto state_24; + goto state_26; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_24; + goto state_26; if (ch.unicode() == 123) - goto state_25; + goto state_27; if (ch.unicode() == 124) - goto state_26; + goto state_28; if (ch.unicode() == 125) { token = QCss::RBRACE; goto found; } if (ch.unicode() == 126) - goto state_28; + goto state_30; goto out; state_1: lastAcceptingPos = pos; token = QCss::S; ch = next(); if (ch.unicode() >= 9 && ch.unicode() <= 10) - goto state_29; + goto state_31; if (ch.unicode() >= 12 && ch.unicode() <= 13) - goto state_29; + goto state_31; if (ch.unicode() == 32) - goto state_29; + goto state_31; if (ch.unicode() == 43) - goto state_9; - if (ch.unicode() == 44) goto state_10; + if (ch.unicode() == 44) + goto state_11; if (ch.unicode() == 62) - goto state_19; + goto state_20; if (ch.unicode() == 123) - goto state_25; + goto state_27; + if (ch.unicode() == 126) + goto state_32; goto out; state_3: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_30; + goto state_33; if (ch.unicode() == 11) - goto state_30; + goto state_33; if (ch.unicode() >= 14 && ch.unicode() <= 33) - goto state_30; + goto state_33; if (ch.unicode() == 34) - goto state_31; + goto state_34; if (ch.unicode() >= 35 && ch.unicode() <= 91) - goto state_30; + goto state_33; if (ch.unicode() == 92) - goto state_32; + goto state_35; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_30; + goto state_33; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_30; + goto state_33; if (ch.unicode() >= 123) - goto state_30; + goto state_33; goto out; state_4: ch = next(); if (ch.unicode() == 45) - goto state_33; + goto state_36; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_33; + goto state_36; if (ch.unicode() == 92) - goto state_34; + goto state_37; if (ch.unicode() == 95) - goto state_33; + goto state_36; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_33; + goto state_36; goto out; state_5: + ch = next(); + if (ch.unicode() == 61) { + token = QCss::ENDSWITH; + goto found; + } + goto out; + state_6: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_35; + goto state_39; if (ch.unicode() == 11) - goto state_35; + goto state_39; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_35; + goto state_39; if (ch.unicode() == 39) - goto state_36; + goto state_40; if (ch.unicode() >= 40 && ch.unicode() <= 91) - goto state_35; + goto state_39; if (ch.unicode() == 92) - goto state_37; + goto state_41; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_35; + goto state_39; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_35; + goto state_39; if (ch.unicode() >= 123) - goto state_35; + goto state_39; goto out; state_9: lastAcceptingPos = pos; - token = QCss::PLUS; + token = QCss::STAR; + ch = next(); + if (ch.unicode() == 61) { + token = QCss::CONTAINS; + goto found; + } goto out; state_10: lastAcceptingPos = pos; - token = QCss::COMMA; + token = QCss::PLUS; goto out; state_11: lastAcceptingPos = pos; + token = QCss::COMMA; + goto out; + state_12: + lastAcceptingPos = pos; token = QCss::MINUS; ch = next(); if (ch.unicode() == 45) - goto state_38; + goto state_43; if (ch.unicode() == 92) - goto state_22; + goto state_23; if (ch.unicode() == 95) - goto state_24; + goto state_26; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_24; + goto state_26; goto out; - state_12: + state_13: lastAcceptingPos = pos; token = QCss::DOT; ch = next(); if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_39; + goto state_44; goto out; - state_13: + state_14: lastAcceptingPos = pos; token = QCss::SLASH; ch = next(); @@ -272,80 +292,87 @@ int QCssScanner_Generated::lex() goto found; } goto out; - state_14: + state_15: lastAcceptingPos = pos; token = QCss::NUMBER; ch = next(); if (ch.unicode() == 37) - goto state_41; + goto state_46; if (ch.unicode() == 45) - goto state_42; + goto state_47; if (ch.unicode() == 46) - goto state_43; + goto state_48; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_44; + goto state_49; if (ch.unicode() == 92) - goto state_45; + goto state_50; if (ch.unicode() == 95) - goto state_46; + goto state_51; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_46; + goto state_51; goto out; - state_17: + state_18: ch = next(); if (ch.unicode() == 33) - goto state_47; + goto state_52; goto out; - state_19: + state_20: lastAcceptingPos = pos; token = QCss::GREATER; goto out; - state_20: + state_21: ch = next(); if (ch.unicode() == 45) - goto state_48; + goto state_53; if (ch.unicode() == 92) - goto state_49; + goto state_54; if (ch.unicode() == 95) - goto state_50; + goto state_55; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_50; + goto state_55; goto out; - state_22: + state_23: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_51; + goto state_56; if (ch.unicode() == 11) - goto state_51; + goto state_56; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_51; + goto state_56; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_51; + goto state_56; if (ch.unicode() >= 103) - goto state_51; + goto state_56; + goto out; + state_25: + ch = next(); + if (ch.unicode() == 61) { + token = QCss::BEGINSWITH; + goto found; + } goto out; - state_24: + state_26: lastAcceptingPos = pos; token = QCss::IDENT; ch = next(); if (ch.unicode() == 40) - goto state_52; + goto state_58; if (ch.unicode() == 45) - goto state_53; + goto state_59; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_53; + goto state_59; if (ch.unicode() == 92) - goto state_54; + goto state_60; if (ch.unicode() == 95) - goto state_53; + goto state_59; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_53; + goto state_59; goto out; - state_25: + state_27: lastAcceptingPos = pos; token = QCss::LBRACE; goto out; - state_26: + state_28: lastAcceptingPos = pos; token = QCss::OR; ch = next(); @@ -354,782 +381,790 @@ int QCssScanner_Generated::lex() goto found; } goto out; - state_28: + state_30: + lastAcceptingPos = pos; + token = QCss::TILDE; ch = next(); if (ch.unicode() == 61) { token = QCss::INCLUDES; goto found; } goto out; - state_29: + state_31: lastAcceptingPos = pos; token = QCss::S; ch = next(); if (ch.unicode() >= 9 && ch.unicode() <= 10) - goto state_29; + goto state_31; if (ch.unicode() >= 12 && ch.unicode() <= 13) - goto state_29; + goto state_31; if (ch.unicode() == 32) - goto state_29; + goto state_31; if (ch.unicode() == 43) - goto state_9; - if (ch.unicode() == 44) goto state_10; + if (ch.unicode() == 44) + goto state_11; if (ch.unicode() == 62) - goto state_19; + goto state_20; if (ch.unicode() == 123) - goto state_25; + goto state_27; + if (ch.unicode() == 126) + goto state_32; goto out; - state_30: + state_32: + lastAcceptingPos = pos; + token = QCss::TILDE; + goto out; + state_33: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_30; + goto state_33; if (ch.unicode() == 11) - goto state_30; + goto state_33; if (ch.unicode() >= 14 && ch.unicode() <= 33) - goto state_30; + goto state_33; if (ch.unicode() == 34) - goto state_31; + goto state_34; if (ch.unicode() >= 35 && ch.unicode() <= 91) - goto state_30; + goto state_33; if (ch.unicode() == 92) - goto state_32; + goto state_35; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_30; + goto state_33; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_30; + goto state_33; if (ch.unicode() >= 123) - goto state_30; + goto state_33; goto out; - state_31: + state_34: lastAcceptingPos = pos; token = QCss::STRING; goto out; - state_32: + state_35: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_57; + goto state_63; if (ch.unicode() == 10) - goto state_58; + goto state_64; if (ch.unicode() == 11) - goto state_57; + goto state_63; if (ch.unicode() == 12) - goto state_59; + goto state_65; if (ch.unicode() == 13) - goto state_60; + goto state_66; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_57; + goto state_63; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_57; + goto state_63; if (ch.unicode() >= 103) - goto state_57; + goto state_63; goto out; - state_33: + state_36: lastAcceptingPos = pos; token = QCss::HASH; ch = next(); if (ch.unicode() == 45) - goto state_61; + goto state_67; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_61; + goto state_67; if (ch.unicode() == 92) - goto state_62; + goto state_68; if (ch.unicode() == 95) - goto state_61; + goto state_67; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_61; + goto state_67; goto out; - state_34: + state_37: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_63; + goto state_69; if (ch.unicode() == 11) - goto state_63; + goto state_69; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_63; + goto state_69; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_63; + goto state_69; if (ch.unicode() >= 103) - goto state_63; + goto state_69; goto out; - state_35: + state_39: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_35; + goto state_39; if (ch.unicode() == 11) - goto state_35; + goto state_39; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_35; + goto state_39; if (ch.unicode() == 39) - goto state_36; + goto state_40; if (ch.unicode() >= 40 && ch.unicode() <= 91) - goto state_35; + goto state_39; if (ch.unicode() == 92) - goto state_37; + goto state_41; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_35; + goto state_39; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_35; + goto state_39; if (ch.unicode() >= 123) - goto state_35; + goto state_39; goto out; - state_36: + state_40: lastAcceptingPos = pos; token = QCss::STRING; goto out; - state_37: + state_41: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_64; + goto state_70; if (ch.unicode() == 10) - goto state_65; + goto state_71; if (ch.unicode() == 11) - goto state_64; + goto state_70; if (ch.unicode() == 12) - goto state_66; + goto state_72; if (ch.unicode() == 13) - goto state_67; + goto state_73; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_64; + goto state_70; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_64; + goto state_70; if (ch.unicode() >= 103) - goto state_64; + goto state_70; goto out; - state_38: + state_43: ch = next(); if (ch.unicode() == 62) { token = QCss::CDC; goto found; } goto out; - state_39: + state_44: lastAcceptingPos = pos; token = QCss::NUMBER; ch = next(); if (ch.unicode() == 37) - goto state_41; + goto state_46; if (ch.unicode() == 45) - goto state_42; + goto state_47; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_69; + goto state_75; if (ch.unicode() == 92) - goto state_45; + goto state_50; if (ch.unicode() == 95) - goto state_46; + goto state_51; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_46; + goto state_51; goto out; - state_41: + state_46: lastAcceptingPos = pos; token = QCss::PERCENTAGE; goto out; - state_42: + state_47: ch = next(); if (ch.unicode() == 92) - goto state_45; + goto state_50; if (ch.unicode() == 95) - goto state_46; + goto state_51; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_46; + goto state_51; goto out; - state_43: + state_48: ch = next(); if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_39; + goto state_44; goto out; - state_44: + state_49: lastAcceptingPos = pos; token = QCss::NUMBER; ch = next(); if (ch.unicode() == 37) - goto state_41; + goto state_46; if (ch.unicode() == 45) - goto state_42; + goto state_47; if (ch.unicode() == 46) - goto state_43; + goto state_48; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_44; + goto state_49; if (ch.unicode() == 92) - goto state_45; + goto state_50; if (ch.unicode() == 95) - goto state_46; + goto state_51; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_46; + goto state_51; goto out; - state_45: + state_50: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_70; + goto state_76; if (ch.unicode() == 11) - goto state_70; + goto state_76; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_70; + goto state_76; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_70; + goto state_76; if (ch.unicode() >= 103) - goto state_70; + goto state_76; goto out; - state_46: + state_51: lastAcceptingPos = pos; token = QCss::LENGTH; ch = next(); if (ch.unicode() == 45) - goto state_71; + goto state_77; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_71; + goto state_77; if (ch.unicode() == 92) - goto state_72; + goto state_78; if (ch.unicode() == 95) - goto state_71; + goto state_77; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_71; + goto state_77; goto out; - state_47: + state_52: ch = next(); if (ch.unicode() == 45) - goto state_73; + goto state_79; goto out; - state_48: + state_53: ch = next(); if (ch.unicode() == 92) - goto state_49; + goto state_54; if (ch.unicode() == 95) - goto state_50; + goto state_55; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_50; + goto state_55; goto out; - state_49: + state_54: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_74; + goto state_80; if (ch.unicode() == 11) - goto state_74; + goto state_80; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_74; + goto state_80; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_74; + goto state_80; if (ch.unicode() >= 103) - goto state_74; + goto state_80; goto out; - state_50: + state_55: lastAcceptingPos = pos; token = QCss::ATKEYWORD_SYM; ch = next(); if (ch.unicode() == 45) - goto state_75; + goto state_81; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_75; + goto state_81; if (ch.unicode() == 92) - goto state_76; + goto state_82; if (ch.unicode() == 95) - goto state_75; + goto state_81; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_75; + goto state_81; goto out; - state_51: + state_56: lastAcceptingPos = pos; token = QCss::IDENT; ch = next(); if (ch.unicode() == 40) - goto state_52; + goto state_58; if (ch.unicode() == 45) - goto state_53; + goto state_59; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_53; + goto state_59; if (ch.unicode() == 92) - goto state_54; + goto state_60; if (ch.unicode() == 95) - goto state_53; + goto state_59; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_53; + goto state_59; goto out; - state_52: + state_58: lastAcceptingPos = pos; token = QCss::FUNCTION; goto out; - state_53: + state_59: lastAcceptingPos = pos; token = QCss::IDENT; ch = next(); if (ch.unicode() == 40) - goto state_52; + goto state_58; if (ch.unicode() == 45) - goto state_53; + goto state_59; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_53; + goto state_59; if (ch.unicode() == 92) - goto state_54; + goto state_60; if (ch.unicode() == 95) - goto state_53; + goto state_59; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_53; + goto state_59; goto out; - state_54: + state_60: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_77; + goto state_83; if (ch.unicode() == 11) - goto state_77; + goto state_83; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_77; + goto state_83; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_77; + goto state_83; if (ch.unicode() >= 103) - goto state_77; + goto state_83; goto out; - state_57: + state_63: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_30; + goto state_33; if (ch.unicode() == 11) - goto state_30; + goto state_33; if (ch.unicode() >= 14 && ch.unicode() <= 33) - goto state_30; + goto state_33; if (ch.unicode() == 34) - goto state_31; + goto state_34; if (ch.unicode() >= 35 && ch.unicode() <= 91) - goto state_30; + goto state_33; if (ch.unicode() == 92) - goto state_32; + goto state_35; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_30; + goto state_33; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_30; + goto state_33; if (ch.unicode() >= 123) - goto state_30; + goto state_33; goto out; - state_58: + state_64: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_30; + goto state_33; if (ch.unicode() == 11) - goto state_30; + goto state_33; if (ch.unicode() >= 14 && ch.unicode() <= 33) - goto state_30; + goto state_33; if (ch.unicode() == 34) - goto state_31; + goto state_34; if (ch.unicode() >= 35 && ch.unicode() <= 91) - goto state_30; + goto state_33; if (ch.unicode() == 92) - goto state_32; + goto state_35; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_30; + goto state_33; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_30; + goto state_33; if (ch.unicode() >= 123) - goto state_30; + goto state_33; goto out; - state_59: + state_65: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_30; + goto state_33; if (ch.unicode() == 11) - goto state_30; + goto state_33; if (ch.unicode() >= 14 && ch.unicode() <= 33) - goto state_30; + goto state_33; if (ch.unicode() == 34) - goto state_31; + goto state_34; if (ch.unicode() >= 35 && ch.unicode() <= 91) - goto state_30; + goto state_33; if (ch.unicode() == 92) - goto state_32; + goto state_35; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_30; + goto state_33; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_30; + goto state_33; if (ch.unicode() >= 123) - goto state_30; + goto state_33; goto out; - state_60: + state_66: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_30; + goto state_33; if (ch.unicode() == 10) - goto state_78; + goto state_84; if (ch.unicode() == 11) - goto state_30; + goto state_33; if (ch.unicode() >= 14 && ch.unicode() <= 33) - goto state_30; + goto state_33; if (ch.unicode() == 34) - goto state_31; + goto state_34; if (ch.unicode() >= 35 && ch.unicode() <= 91) - goto state_30; + goto state_33; if (ch.unicode() == 92) - goto state_32; + goto state_35; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_30; + goto state_33; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_30; + goto state_33; if (ch.unicode() >= 123) - goto state_30; + goto state_33; goto out; - state_61: + state_67: lastAcceptingPos = pos; token = QCss::HASH; ch = next(); if (ch.unicode() == 45) - goto state_61; + goto state_67; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_61; + goto state_67; if (ch.unicode() == 92) - goto state_62; + goto state_68; if (ch.unicode() == 95) - goto state_61; + goto state_67; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_61; + goto state_67; goto out; - state_62: + state_68: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_79; + goto state_85; if (ch.unicode() == 11) - goto state_79; + goto state_85; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_79; + goto state_85; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_79; + goto state_85; if (ch.unicode() >= 103) - goto state_79; + goto state_85; goto out; - state_63: + state_69: lastAcceptingPos = pos; token = QCss::HASH; ch = next(); if (ch.unicode() == 45) - goto state_61; + goto state_67; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_61; + goto state_67; if (ch.unicode() == 92) - goto state_62; + goto state_68; if (ch.unicode() == 95) - goto state_61; + goto state_67; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_61; + goto state_67; goto out; - state_64: + state_70: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_35; + goto state_39; if (ch.unicode() == 11) - goto state_35; + goto state_39; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_35; + goto state_39; if (ch.unicode() == 39) - goto state_36; + goto state_40; if (ch.unicode() >= 40 && ch.unicode() <= 91) - goto state_35; + goto state_39; if (ch.unicode() == 92) - goto state_37; + goto state_41; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_35; + goto state_39; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_35; + goto state_39; if (ch.unicode() >= 123) - goto state_35; + goto state_39; goto out; - state_65: + state_71: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_35; + goto state_39; if (ch.unicode() == 11) - goto state_35; + goto state_39; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_35; + goto state_39; if (ch.unicode() == 39) - goto state_36; + goto state_40; if (ch.unicode() >= 40 && ch.unicode() <= 91) - goto state_35; + goto state_39; if (ch.unicode() == 92) - goto state_37; + goto state_41; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_35; + goto state_39; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_35; + goto state_39; if (ch.unicode() >= 123) - goto state_35; + goto state_39; goto out; - state_66: + state_72: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_35; + goto state_39; if (ch.unicode() == 11) - goto state_35; + goto state_39; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_35; + goto state_39; if (ch.unicode() == 39) - goto state_36; + goto state_40; if (ch.unicode() >= 40 && ch.unicode() <= 91) - goto state_35; + goto state_39; if (ch.unicode() == 92) - goto state_37; + goto state_41; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_35; + goto state_39; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_35; + goto state_39; if (ch.unicode() >= 123) - goto state_35; + goto state_39; goto out; - state_67: + state_73: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_35; + goto state_39; if (ch.unicode() == 10) - goto state_80; + goto state_86; if (ch.unicode() == 11) - goto state_35; + goto state_39; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_35; + goto state_39; if (ch.unicode() == 39) - goto state_36; + goto state_40; if (ch.unicode() >= 40 && ch.unicode() <= 91) - goto state_35; + goto state_39; if (ch.unicode() == 92) - goto state_37; + goto state_41; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_35; + goto state_39; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_35; + goto state_39; if (ch.unicode() >= 123) - goto state_35; + goto state_39; goto out; - state_69: + state_75: lastAcceptingPos = pos; token = QCss::NUMBER; ch = next(); if (ch.unicode() == 37) - goto state_41; + goto state_46; if (ch.unicode() == 45) - goto state_42; + goto state_47; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_69; + goto state_75; if (ch.unicode() == 92) - goto state_45; + goto state_50; if (ch.unicode() == 95) - goto state_46; + goto state_51; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_46; + goto state_51; goto out; - state_70: + state_76: lastAcceptingPos = pos; token = QCss::LENGTH; ch = next(); if (ch.unicode() == 45) - goto state_71; + goto state_77; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_71; + goto state_77; if (ch.unicode() == 92) - goto state_72; + goto state_78; if (ch.unicode() == 95) - goto state_71; + goto state_77; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_71; + goto state_77; goto out; - state_71: + state_77: lastAcceptingPos = pos; token = QCss::LENGTH; ch = next(); if (ch.unicode() == 45) - goto state_71; + goto state_77; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_71; + goto state_77; if (ch.unicode() == 92) - goto state_72; + goto state_78; if (ch.unicode() == 95) - goto state_71; + goto state_77; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_71; + goto state_77; goto out; - state_72: + state_78: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_81; + goto state_87; if (ch.unicode() == 11) - goto state_81; + goto state_87; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_81; + goto state_87; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_81; + goto state_87; if (ch.unicode() >= 103) - goto state_81; + goto state_87; goto out; - state_73: + state_79: ch = next(); if (ch.unicode() == 45) { token = QCss::CDO; goto found; } goto out; - state_74: + state_80: lastAcceptingPos = pos; token = QCss::ATKEYWORD_SYM; ch = next(); if (ch.unicode() == 45) - goto state_75; + goto state_81; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_75; + goto state_81; if (ch.unicode() == 92) - goto state_76; + goto state_82; if (ch.unicode() == 95) - goto state_75; + goto state_81; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_75; + goto state_81; goto out; - state_75: + state_81: lastAcceptingPos = pos; token = QCss::ATKEYWORD_SYM; ch = next(); if (ch.unicode() == 45) - goto state_75; + goto state_81; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_75; + goto state_81; if (ch.unicode() == 92) - goto state_76; + goto state_82; if (ch.unicode() == 95) - goto state_75; + goto state_81; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_75; + goto state_81; goto out; - state_76: + state_82: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_83; + goto state_89; if (ch.unicode() == 11) - goto state_83; + goto state_89; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_83; + goto state_89; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_83; + goto state_89; if (ch.unicode() >= 103) - goto state_83; + goto state_89; goto out; - state_77: + state_83: lastAcceptingPos = pos; token = QCss::IDENT; ch = next(); if (ch.unicode() == 40) - goto state_52; + goto state_58; if (ch.unicode() == 45) - goto state_53; + goto state_59; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_53; + goto state_59; if (ch.unicode() == 92) - goto state_54; + goto state_60; if (ch.unicode() == 95) - goto state_53; + goto state_59; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_53; + goto state_59; goto out; - state_78: + state_84: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_30; + goto state_33; if (ch.unicode() == 11) - goto state_30; + goto state_33; if (ch.unicode() >= 14 && ch.unicode() <= 33) - goto state_30; + goto state_33; if (ch.unicode() == 34) - goto state_31; + goto state_34; if (ch.unicode() >= 35 && ch.unicode() <= 91) - goto state_30; + goto state_33; if (ch.unicode() == 92) - goto state_32; + goto state_35; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_30; + goto state_33; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_30; + goto state_33; if (ch.unicode() >= 123) - goto state_30; + goto state_33; goto out; - state_79: + state_85: lastAcceptingPos = pos; token = QCss::HASH; ch = next(); if (ch.unicode() == 45) - goto state_61; + goto state_67; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_61; + goto state_67; if (ch.unicode() == 92) - goto state_62; + goto state_68; if (ch.unicode() == 95) - goto state_61; + goto state_67; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_61; + goto state_67; goto out; - state_80: + state_86: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_35; + goto state_39; if (ch.unicode() == 11) - goto state_35; + goto state_39; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_35; + goto state_39; if (ch.unicode() == 39) - goto state_36; + goto state_40; if (ch.unicode() >= 40 && ch.unicode() <= 91) - goto state_35; + goto state_39; if (ch.unicode() == 92) - goto state_37; + goto state_41; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_35; + goto state_39; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_35; + goto state_39; if (ch.unicode() >= 123) - goto state_35; + goto state_39; goto out; - state_81: + state_87: lastAcceptingPos = pos; token = QCss::LENGTH; ch = next(); if (ch.unicode() == 45) - goto state_71; + goto state_77; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_71; + goto state_77; if (ch.unicode() == 92) - goto state_72; + goto state_78; if (ch.unicode() == 95) - goto state_71; + goto state_77; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_71; + goto state_77; goto out; - state_83: + state_89: lastAcceptingPos = pos; token = QCss::ATKEYWORD_SYM; ch = next(); if (ch.unicode() == 45) - goto state_75; + goto state_81; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_75; + goto state_81; if (ch.unicode() == 92) - goto state_76; + goto state_82; if (ch.unicode() == 95) - goto state_75; + goto state_81; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_75; + goto state_81; goto out; found: lastAcceptingPos = pos; diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index 5a696807b4..933dd1bf54 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -45,6 +45,8 @@ QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcDistanceField, "qt.distanceField"); + namespace { enum FillHDir @@ -736,8 +738,40 @@ static bool imageHasNarrowOutlines(const QImage &im) return minHThick == 1 || minVThick == 1; } +static int QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = 54; +static int QT_DISTANCEFIELD_DEFAULT_SCALE = 16; +static int QT_DISTANCEFIELD_DEFAULT_RADIUS = 80; +static int QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = 2000; + +static void initialDistanceFieldFactor() +{ + static bool initialized = false; + if (initialized) + return; + initialized = true; + + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE")) { + QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE:" << QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE; + } + + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_SCALE")) { + QT_DISTANCEFIELD_DEFAULT_SCALE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_SCALE"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_SCALE:" << QT_DISTANCEFIELD_DEFAULT_SCALE; + } + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_RADIUS")) { + QT_DISTANCEFIELD_DEFAULT_RADIUS = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_RADIUS"); + qDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_RADIUS:" << QT_DISTANCEFIELD_DEFAULT_RADIUS; + } + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT")) { + QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT:" << QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT; + } +} + bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine) { + initialDistanceFieldFactor(); QFontEngine *fe = fontEngine->cloneWithSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE); if (!fe) return false; @@ -757,6 +791,7 @@ bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine) bool qt_fontHasNarrowOutlines(const QRawFont &f) { QRawFont font = f; + initialDistanceFieldFactor(); font.setPixelSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE); if (!font.isValid()) return false; @@ -769,6 +804,41 @@ bool qt_fontHasNarrowOutlines(const QRawFont &f) QRawFont::PixelAntialiasing)); } +int QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2; + else + return QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE; +} + +int QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_SCALE / 2; + else + return QT_DISTANCEFIELD_DEFAULT_SCALE; +} + +int QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_RADIUS / 2; + else + return QT_DISTANCEFIELD_DEFAULT_RADIUS; +} + +int QT_DISTANCEFIELD_HIGHGLYPHCOUNT() +{ + initialDistanceFieldFactor(); + return QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT; +} QDistanceFieldData::QDistanceFieldData(const QDistanceFieldData &other) : QSharedData(other) diff --git a/src/gui/text/qdistancefield_p.h b/src/gui/text/qdistancefield_p.h index c6c5e6b650..27ab84332c 100644 --- a/src/gui/text/qdistancefield_p.h +++ b/src/gui/text/qdistancefield_p.h @@ -51,30 +51,24 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <qrawfont.h> #include <private/qfontengine_p.h> #include <QtCore/qshareddata.h> +#include <QtCore/qglobal.h> +#include <QLoggingCategory> QT_BEGIN_NAMESPACE -#define QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE 54 -#define QT_DISTANCEFIELD_DEFAULT_SCALE 16 -#define QT_DISTANCEFIELD_DEFAULT_RADIUS 80 -#define QT_DISTANCEFIELD_HIGHGLYPHCOUNT 2000 - -#define QT_DISTANCEFIELD_BASEFONTSIZE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2 : \ - QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE) -#define QT_DISTANCEFIELD_SCALE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_SCALE / 2 : \ - QT_DISTANCEFIELD_DEFAULT_SCALE) -#define QT_DISTANCEFIELD_RADIUS(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_RADIUS / 2 : \ - QT_DISTANCEFIELD_DEFAULT_RADIUS) - bool Q_GUI_EXPORT qt_fontHasNarrowOutlines(const QRawFont &f); bool Q_GUI_EXPORT qt_fontHasNarrowOutlines(QFontEngine *fontEngine); +int Q_GUI_EXPORT QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_TILESIZE(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_HIGHGLYPHCOUNT(); + class Q_GUI_EXPORT QDistanceFieldData : public QSharedData { public: diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 9e4f61ebee..5e72e6969c 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2001,7 +2001,7 @@ QString QFont::key() const QString QFont::toString() const { const QChar comma(QLatin1Char(',')); - return family() + comma + + QString fontDescription = family() + comma + QString::number( pointSizeF()) + comma + QString::number( pixelSize()) + comma + QString::number((int) styleHint()) + comma + @@ -2011,6 +2011,12 @@ QString QFont::toString() const QString::number((int) strikeOut()) + comma + QString::number((int)fixedPitch()) + comma + QString::number((int) false); + + QString fontStyle = styleName(); + if (!fontStyle.isEmpty()) + fontDescription += comma + fontStyle; + + return fontDescription; } /*! @@ -2054,7 +2060,7 @@ bool QFont::fromString(const QString &descrip) setUnderline(l[5].toInt()); setStrikeOut(l[6].toInt()); setFixedPitch(l[7].toInt()); - } else if (count == 10) { + } else if (count >= 10) { if (l[2].toInt() > 0) setPixelSize(l[2].toInt()); setStyleHint((StyleHint) l[3].toInt()); @@ -2063,7 +2069,10 @@ bool QFont::fromString(const QString &descrip) setUnderline(l[6].toInt()); setStrikeOut(l[7].toInt()); setFixedPitch(l[8].toInt()); + if (count == 11) + d->request.styleName = l[10].toString(); } + if (count >= 9 && !d->request.fixedPitch) // assume 'false' fixedPitch equals default d->request.ignorePitch = true; diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 85a237643c..b295e13f61 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -40,6 +40,7 @@ #ifndef QFONT_H #define QFONT_H +#include <QtGui/qtguiglobal.h> #include <QtGui/qwindowdefs.h> #include <QtCore/qstring.h> #include <QtCore/qsharedpointer.h> diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 3979bb27ac..21823dc12f 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "QtGui/qfont.h" #include "QtCore/qmap.h" #include "QtCore/qhash.h" diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index c4a130e04c..ef09a0cacd 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -2221,10 +2221,18 @@ QString QFontDatabase::writingSystemSample(WritingSystem writingSystem) sample += QChar(0x05D3); break; case Arabic: + sample += QChar(0x0623); sample += QChar(0x0628); + sample += QChar(0x062C); + sample += QChar(0x062F); + sample += QChar(0x064A); + sample += QChar(0x0629); + sample += QChar(0x0020); + sample += QChar(0x0639); + sample += QChar(0x0631); + sample += QChar(0x0628); + sample += QChar(0x064A); sample += QChar(0x0629); - sample += QChar(0x062A); - sample += QChar(0x063A); break; case Syriac: sample += QChar(0x0715); diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index 67cf671304..e6aef493bd 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -40,6 +40,7 @@ #ifndef QFONTDATABASE_H #define QFONTDATABASE_H +#include <QtGui/qtguiglobal.h> #include <QtGui/qwindowdefs.h> #include <QtCore/qstring.h> #include <QtGui/qfont.h> diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index fe5d544dba..adc8f634dc 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1845,7 +1845,11 @@ QFontEngine *QFontEngineMulti::loadEngine(int at) glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const { glyph_t glyph = engine(0)->glyphIndex(ucs4); - if (glyph == 0 && ucs4 != QChar::LineSeparator) { + if (glyph == 0 + && ucs4 != QChar::LineSeparator + && ucs4 != QChar::LineFeed + && ucs4 != QChar::CarriageReturn + && ucs4 != QChar::ParagraphSeparator) { if (!m_fallbackFamiliesQueried) const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried(); for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) { @@ -1883,7 +1887,11 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, QStringIterator it(str, str + len); while (it.hasNext()) { const uint ucs4 = it.peekNext(); - if (glyphs->glyphs[glyph_pos] == 0 && ucs4 != QChar::LineSeparator) { + if (glyphs->glyphs[glyph_pos] == 0 + && ucs4 != QChar::LineSeparator + && ucs4 != QChar::LineFeed + && ucs4 != QChar::CarriageReturn + && ucs4 != QChar::ParagraphSeparator) { if (!m_fallbackFamiliesQueried) const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried(); for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) { diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 1430444c7e..f3eeddab41 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "QtCore/qglobal.h" +#include <QtGui/private/qtguiglobal_p.h> #include "QtCore/qatomic.h" #include <QtCore/qvarlengtharray.h> #include <QtCore/QLinkedList> diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h index 54b9af71df..fd5db1ecf5 100644 --- a/src/gui/text/qfontengineglyphcache_p.h +++ b/src/gui/text/qfontengineglyphcache_p.h @@ -52,7 +52,7 @@ // -#include "QtCore/qglobal.h" +#include <QtGui/private/qtguiglobal_p.h> #include "QtCore/qatomic.h" #include <QtCore/qvarlengtharray.h> #include "private/qfont_p.h" diff --git a/src/gui/text/qfontinfo.h b/src/gui/text/qfontinfo.h index ee368e26bd..f5e05775b4 100644 --- a/src/gui/text/qfontinfo.h +++ b/src/gui/text/qfontinfo.h @@ -40,6 +40,7 @@ #ifndef QFONTINFO_H #define QFONTINFO_H +#include <QtGui/qtguiglobal.h> #include <QtGui/qfont.h> #include <QtCore/qsharedpointer.h> diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h index 1d7241c9f2..22e51f29f7 100644 --- a/src/gui/text/qfontmetrics.h +++ b/src/gui/text/qfontmetrics.h @@ -40,6 +40,7 @@ #ifndef QFONTMETRICS_H #define QFONTMETRICS_H +#include <QtGui/qtguiglobal.h> #include <QtGui/qfont.h> #include <QtCore/qsharedpointer.h> #ifndef QT_INCLUDE_COMPAT diff --git a/src/gui/text/qfontsubset_p.h b/src/gui/text/qfontsubset_p.h index a7328df4ed..e7c6053beb 100644 --- a/src/gui/text/qfontsubset_p.h +++ b/src/gui/text/qfontsubset_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "private/qfontengine_p.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qfragmentmap_p.h b/src/gui/text/qfragmentmap_p.h index b54d7261d0..35f60ac961 100644 --- a/src/gui/text/qfragmentmap_p.h +++ b/src/gui/text/qfragmentmap_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "QtCore/qglobal.h" +#include <QtGui/private/qtguiglobal_p.h> #include <stdlib.h> #include <private/qtools_p.h> diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h index 6016925d27..6182c4f749 100644 --- a/src/gui/text/qglyphrun.h +++ b/src/gui/text/qglyphrun.h @@ -40,6 +40,7 @@ #ifndef QGLYPHRUN_H #define QGLYPHRUN_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qsharedpointer.h> #include <QtCore/qvector.h> #include <QtCore/qpoint.h> diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h index 52fa03f150..5b6bdad648 100644 --- a/src/gui/text/qglyphrun_p.h +++ b/src/gui/text/qglyphrun_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "qglyphrun.h" #include "qrawfont.h" diff --git a/src/gui/text/qharfbuzzng_p.h b/src/gui/text/qharfbuzzng_p.h index 28f20338dd..95a21eedb6 100644 --- a/src/gui/text/qharfbuzzng_p.h +++ b/src/gui/text/qharfbuzzng_p.h @@ -52,6 +52,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qchar.h> #include <harfbuzz/hb.h> diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h index 61c892ad8b..13d8cbde60 100644 --- a/src/gui/text/qplatformfontdatabase.h +++ b/src/gui/text/qplatformfontdatabase.h @@ -49,7 +49,7 @@ // source and binary incompatible with future versions of Qt. // -#include <QtCore/qconfig.h> +#include <QtGui/qtguiglobal.h> #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QList> diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index aa98363229..5791c6af16 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -40,6 +40,7 @@ #ifndef QRAWFONT_H #define QRAWFONT_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qstring.h> #include <QtCore/qiodevice.h> #include <QtCore/qglobal.h> diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h index ee54578cf9..0fc8739bfb 100644 --- a/src/gui/text/qrawfont_p.h +++ b/src/gui/text/qrawfont_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "qrawfont.h" #include "qfontengine_p.h" diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h index 2da74825a2..00dfccc144 100644 --- a/src/gui/text/qstatictext.h +++ b/src/gui/text/qstatictext.h @@ -40,6 +40,7 @@ #ifndef QSTATICTEXT_H #define QSTATICTEXT_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qsize.h> #include <QtCore/qstring.h> #include <QtCore/qmetatype.h> diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h index 7fdf46c101..dda566a22b 100644 --- a/src/gui/text/qstatictext_p.h +++ b/src/gui/text/qstatictext_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "qstatictext.h" #include <private/qtextureglyphcache_p.h> diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h index 2ccb3a68b9..d87f89f0fd 100644 --- a/src/gui/text/qsyntaxhighlighter.h +++ b/src/gui/text/qsyntaxhighlighter.h @@ -40,7 +40,7 @@ #ifndef QSYNTAXHIGHLIGHTER_H #define QSYNTAXHIGHLIGHTER_H -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #ifndef QT_NO_SYNTAXHIGHLIGHTER diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h index 9610e61b39..1a00b753ad 100644 --- a/src/gui/text/qtextcursor.h +++ b/src/gui/text/qtextcursor.h @@ -40,6 +40,7 @@ #ifndef QTEXTCURSOR_H #define QTEXTCURSOR_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qstring.h> #include <QtCore/qshareddata.h> #include <QtGui/qtextformat.h> diff --git a/src/gui/text/qtextcursor_p.h b/src/gui/text/qtextcursor_p.h index 84f912a3fa..3569317b6d 100644 --- a/src/gui/text/qtextcursor_p.h +++ b/src/gui/text/qtextcursor_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "qtextcursor.h" #include "qtextdocument.h" #include "qtextdocument_p.h" diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 723918ae69..75899dec80 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -94,7 +94,7 @@ bool Qt::mightBeRichText(const QString& text) ++start; // skip a leading <?xml ... ?> as for example with xhtml - if (text.mid(start, 5) == QLatin1String("<?xml")) { + if (text.midRef(start, 5).compare(QLatin1String("<?xml")) == 0) { while (start < text.length()) { if (text.at(start) == QLatin1Char('?') && start + 2 < text.length() @@ -109,12 +109,12 @@ bool Qt::mightBeRichText(const QString& text) ++start; } - if (text.mid(start, 5).toLower() == QLatin1String("<!doc")) + if (text.midRef(start, 5).compare(QLatin1String("<!doc"), Qt::CaseInsensitive) == 0) return true; int open = start; while (open < text.length() && text.at(open) != QLatin1Char('<') && text.at(open) != QLatin1Char('\n')) { - if (text.at(open) == QLatin1Char('&') && text.mid(open+1,3) == QLatin1String("lt;")) + if (text.at(open) == QLatin1Char('&') && text.midRef(open + 1, 3) == QLatin1String("lt;")) return true; // support desperate attempt of user to see <...> ++open; } @@ -3135,7 +3135,7 @@ void QTextHtmlExporter::emitTable(const QTextTable *table) html += QLatin1String("</table>"); } -void QTextHtmlExporter::emitFrame(QTextFrame::Iterator frameIt) +void QTextHtmlExporter::emitFrame(const QTextFrame::Iterator &frameIt) { if (!frameIt.atEnd()) { QTextFrame::Iterator next = frameIt; diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index 02cfa97bce..1888088f0d 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -40,6 +40,7 @@ #ifndef QTEXTDOCUMENT_H #define QTEXTDOCUMENT_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> #include <QtCore/qsize.h> #include <QtCore/qrect.h> diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index ffc5d7418b..3537adba9e 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -1078,8 +1078,9 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c) const QTextUndoCommand &last = undoStack.at(lastIdx); if ( (last.block_part && c.block_part && !last.block_end) // part of the same block => can merge - || (!c.block_part && !last.block_part)) { // two single undo items => can merge - + || (!c.block_part && !last.block_part) // two single undo items => can merge + || (c.command == QTextUndoCommand::Inserted && last.command == c.command && (last.block_part && !c.block_part))) { + // two sequential inserts that are not part of the same block => can merge if (undoStack[lastIdx].tryMerge(c)) return; } diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index 34849df0bb..cad9131fbf 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "QtCore/qglobal.h" +#include <QtGui/private/qtguiglobal_p.h> #include "QtCore/qstring.h" #include "QtCore/qvector.h" #include "QtCore/qlist.h" @@ -158,7 +158,7 @@ public: }; Q_DECLARE_TYPEINFO(QTextUndoCommand, Q_PRIMITIVE_TYPE); -class Q_AUTOTEST_EXPORT QTextDocumentPrivate : public QObjectPrivate +class Q_GUI_EXPORT QTextDocumentPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QTextDocument) public: @@ -378,7 +378,7 @@ private: enum StyleMode { EmitStyleTag, OmitStyleTag }; enum FrameType { TextFrame, TableFrame, RootFrame }; - void emitFrame(QTextFrame::Iterator frameIt); + void emitFrame(const QTextFrame::Iterator &frameIt); void emitTextFrame(const QTextFrame *frame); void emitBlock(const QTextBlock &block); void emitTable(const QTextTable *table); diff --git a/src/gui/text/qtextdocumentfragment.h b/src/gui/text/qtextdocumentfragment.h index d1c1adfd0a..a56f6d06d6 100644 --- a/src/gui/text/qtextdocumentfragment.h +++ b/src/gui/text/qtextdocumentfragment.h @@ -40,6 +40,7 @@ #ifndef QTEXTDOCUMENTFRAGMENT_H #define QTEXTDOCUMENTFRAGMENT_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qstring.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qtextdocumentfragment_p.h b/src/gui/text/qtextdocumentfragment_p.h index 56dff01149..e8699545f7 100644 --- a/src/gui/text/qtextdocumentfragment_p.h +++ b/src/gui/text/qtextdocumentfragment_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "QtGui/qtextdocument.h" #include "private/qtexthtmlparser_p.h" #include "private/qtextdocument_p.h" diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index b6cbd9617f..8ad2d85e7c 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -295,7 +295,7 @@ static inline bool isEmptyBlockBeforeTable(const QTextBlock &block, const QTextB ; } -static inline bool isEmptyBlockBeforeTable(QTextFrame::Iterator it) +static inline bool isEmptyBlockBeforeTable(const QTextFrame::Iterator &it) { QTextFrame::Iterator next = it; ++next; if (it.currentFrame()) @@ -419,7 +419,7 @@ static bool operator<(int pos, const QCheckPoint &checkPoint) #endif -static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, QRectF gradientRect = QRectF()) +static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, const QRectF &gradientRect = QRectF()) { p->save(); if (brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern) { @@ -1504,7 +1504,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p painter->restore(); } -static QFixed flowPosition(const QTextFrame::iterator it) +static QFixed flowPosition(const QTextFrame::iterator &it) { if (it.atEnd()) return 0; @@ -2921,11 +2921,11 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length) { Q_D(QTextDocumentLayout); - QTextBlock startIt = document()->findBlock(from); + QTextBlock blockIt = document()->findBlock(from); QTextBlock endIt = document()->findBlock(qMax(0, from + length - 1)); if (endIt.isValid()) endIt = endIt.next(); - for (QTextBlock blockIt = startIt; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next()) + for (; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next()) blockIt.clearLayout(); if (d->docPrivate->pageSize.isNull()) @@ -2967,9 +2967,6 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length) d->insideDocumentChange = false; - for (QTextBlock blockIt = startIt; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next()) - emit updateBlock(blockIt); - if (d->showLayoutProgress) { const QSizeF newSize = dynamicDocumentSize(); if (newSize != d->lastReportedSize) { diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h index a9cd6cf289..710c49628e 100644 --- a/src/gui/text/qtextdocumentlayout_p.h +++ b/src/gui/text/qtextdocumentlayout_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "QtGui/qabstracttextdocumentlayout.h" #include "QtGui/qtextoption.h" #include "QtGui/qtextobject.h" diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp index a7c58ac2a6..731aaf1fcf 100644 --- a/src/gui/text/qtextdocumentwriter.cpp +++ b/src/gui/text/qtextdocumentwriter.cpp @@ -139,12 +139,9 @@ QTextDocumentWriter::QTextDocumentWriter(QIODevice *device, const QByteArray &fo format by inspecting the extension of \a fileName. */ QTextDocumentWriter::QTextDocumentWriter(const QString &fileName, const QByteArray &format) - : d(new QTextDocumentWriterPrivate(this)) + : QTextDocumentWriter(new QFile(fileName), format) { - QFile *file = new QFile(fileName); - d->device = file; d->deleteDevice = true; - d->format = format; } /*! diff --git a/src/gui/text/qtextdocumentwriter.h b/src/gui/text/qtextdocumentwriter.h index b7917e55a4..0502bf1a96 100644 --- a/src/gui/text/qtextdocumentwriter.h +++ b/src/gui/text/qtextdocumentwriter.h @@ -39,6 +39,7 @@ #ifndef QTEXTDOCUMENTWRITER_H #define QTEXTDOCUMENTWRITER_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qstring.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 7378b129a9..cad30b0c77 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -843,7 +843,7 @@ enum JustificationClass { Adds an inter character justification opportunity after the number or letter character and a space justification opportunity after the space character. */ -static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, QGlyphLayout g, ushort *log_clusters, int spaceAs) +static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, const QGlyphLayout &g, ushort *log_clusters, int spaceAs) { int str_pos = 0; while (str_pos < length) { @@ -877,7 +877,7 @@ static inline void qt_getDefaultJustificationOpportunities(const ushort *string, } } -static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, QGlyphLayout g, ushort *log_clusters) +static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, const QGlyphLayout &g, ushort *log_clusters) { Q_ASSERT(length > 0 && g.numGlyphs > 0); @@ -1292,9 +1292,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, #ifdef Q_OS_DARWIN if (actualFontEngine->type() == QFontEngine::Mac) { - // CTRunGetPosition has a bug which applies matrix on 10.6, so we disable - // scaling the advances for this particular version - if (QSysInfo::MacintoshVersion != QSysInfo::MV_10_6 && actualFontEngine->fontDef.stretch != 100) { + if (actualFontEngine->fontDef.stretch != 100) { QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100); for (uint i = 0; i < num_glyphs; ++i) g.advances[i] *= stretch; @@ -3519,7 +3517,7 @@ QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex, } -QTransform qt_true_matrix(qreal w, qreal h, QTransform x) +QTransform qt_true_matrix(qreal w, qreal h, const QTransform &x) { QRectF rect = x.mapRect(QRectF(0, 0, w, h)); return x * QTransform::fromTranslate(-rect.x(), -rect.y()); diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 56c9825cc1..160e9ce490 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "QtCore/qglobal.h" +#include <QtGui/private/qtguiglobal_p.h> #include "QtCore/qstring.h" #include "QtCore/qvarlengtharray.h" #include "QtCore/qnamespace.h" diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index 805affd87c..28c3035537 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -40,6 +40,7 @@ #ifndef QTEXTFORMAT_H #define QTEXTFORMAT_H +#include <QtGui/qtguiglobal.h> #include <QtGui/qcolor.h> #include <QtGui/qfont.h> #include <QtCore/qshareddata.h> diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h index 45a432d2f5..f05bfaff71 100644 --- a/src/gui/text/qtextformat_p.h +++ b/src/gui/text/qtextformat_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "QtGui/qtextformat.h" #include "QtCore/qvector.h" diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h index 4c0dd967f9..4ea6e44138 100644 --- a/src/gui/text/qtexthtmlparser_p.h +++ b/src/gui/text/qtexthtmlparser_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "QtCore/qvector.h" #include "QtGui/qbrush.h" #include "QtGui/qcolor.h" diff --git a/src/gui/text/qtextimagehandler_p.h b/src/gui/text/qtextimagehandler_p.h index 4bc19d49c3..a22c91ecbf 100644 --- a/src/gui/text/qtextimagehandler_p.h +++ b/src/gui/text/qtextimagehandler_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "QtCore/qobject.h" #include "QtGui/qabstracttextdocumentlayout.h" diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 3b1ee8ec03..f5827bb683 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -975,7 +975,7 @@ void QTextLayout::setFlags(int flags) } static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPointF &pos, QTextLayout::FormatRange *selection, - QPainterPath *region, QRectF boundingRect) + QPainterPath *region, const QRectF &boundingRect) { const QScriptLine &line = eng->lines[lineNumber]; @@ -1326,7 +1326,11 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition && (p->transform().type() > QTransform::TxTranslate); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing); + QPainter::CompositionMode origCompositionMode = p->compositionMode(); + if (p->paintEngine()->hasFeature(QPaintEngine::RasterOpModes)) + p->setCompositionMode(QPainter::RasterOp_NotDestination); p->fillRect(QRectF(x, y, qreal(width), (base + descent).toReal()), p->pen().brush()); + p->setCompositionMode(origCompositionMode); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing, false); if (d->layoutData->hasBidi) { diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h index 1cbb5ac8d8..980a099b05 100644 --- a/src/gui/text/qtextlayout.h +++ b/src/gui/text/qtextlayout.h @@ -39,6 +39,7 @@ #ifndef QTEXTLAYOUT_H #define QTEXTLAYOUT_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qstring.h> #include <QtCore/qnamespace.h> #include <QtCore/qrect.h> diff --git a/src/gui/text/qtextlist.h b/src/gui/text/qtextlist.h index 71da175a14..3967787f03 100644 --- a/src/gui/text/qtextlist.h +++ b/src/gui/text/qtextlist.h @@ -40,6 +40,7 @@ #ifndef QTEXTLIST_H #define QTEXTLIST_H +#include <QtGui/qtguiglobal.h> #include <QtGui/qtextobject.h> #include <QtCore/qobject.h> diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index d3f6b3d0ac..a5030de112 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -40,6 +40,7 @@ #ifndef QTEXTOBJECT_H #define QTEXTOBJECT_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> #include <QtGui/qtextformat.h> #include <QtGui/qtextlayout.h> diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h index ffc331e99d..81ab023cc3 100644 --- a/src/gui/text/qtextobject_p.h +++ b/src/gui/text/qtextobject_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "QtGui/qtextobject.h" #include "private/qobject_p.h" #include "QtGui/qtextdocument.h" diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index ad537b7126..73d2e545ba 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -295,7 +295,7 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc writer.writeStartElement(textNS, QString::fromLatin1("span")); QString fragmentText = frag.fragment().text(); - if (fragmentText.length() == 1 && fragmentText[0] == 0xFFFC) { // its an inline character. + if (fragmentText.length() == 1 && fragmentText[0] == QChar(0xFFFC)) { // its an inline character. writeInlineCharacter(writer, frag.fragment()); writer.writeEndElement(); // span continue; @@ -510,7 +510,7 @@ void QTextOdfWriter::writeBlockFormat(QXmlStreamWriter &writer, QTextBlockFormat case QTextOption::CenterTab: type = QString::fromLatin1("center"); break; } writer.writeAttribute(styleNS, QString::fromLatin1("type"), type); - if (iterator->delimiter != 0) + if (!iterator->delimiter.isNull()) writer.writeAttribute(styleNS, QString::fromLatin1("char"), iterator->delimiter); ++iterator; } diff --git a/src/gui/text/qtextodfwriter_p.h b/src/gui/text/qtextodfwriter_p.h index d4cd91f8a3..c1a5652760 100644 --- a/src/gui/text/qtextodfwriter_p.h +++ b/src/gui/text/qtextodfwriter_p.h @@ -40,7 +40,7 @@ #ifndef QTEXTODFWRITER_H #define QTEXTODFWRITER_H -#include <QtCore/qglobal.h> +#include <QtGui/private/qtguiglobal_p.h> #ifndef QT_NO_TEXTODFWRITER diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h index f9c24ffeaf..9ef9cee9bb 100644 --- a/src/gui/text/qtextoption.h +++ b/src/gui/text/qtextoption.h @@ -40,6 +40,7 @@ #ifndef QTEXTOPTION_H #define QTEXTOPTION_H +#include <QtGui/qtguiglobal.h> #include <QtCore/qnamespace.h> #include <QtCore/qchar.h> #include <QtCore/qmetatype.h> diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h index 14525aae25..ee8e974396 100644 --- a/src/gui/text/qtexttable.h +++ b/src/gui/text/qtexttable.h @@ -40,7 +40,7 @@ #ifndef QTEXTTABLE_H #define QTEXTTABLE_H -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #include <QtCore/qobject.h> #include <QtGui/qtextobject.h> diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h index 72d9d8c639..848537272d 100644 --- a/src/gui/text/qtexttable_p.h +++ b/src/gui/text/qtexttable_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/private/qtguiglobal_p.h> #include "private/qtextobject_p.h" #include "private/qtextdocument_p.h" diff --git a/src/gui/text/qzipreader_p.h b/src/gui/text/qzipreader_p.h index 5603f0f0d6..eed6ee6a62 100644 --- a/src/gui/text/qzipreader_p.h +++ b/src/gui/text/qzipreader_p.h @@ -40,6 +40,7 @@ #ifndef QZIPREADER_H #define QZIPREADER_H +#include <QtGui/private/qtguiglobal_p.h> #include <QtCore/qglobal.h> #ifndef QT_NO_TEXTODFWRITER diff --git a/src/gui/text/qzipwriter_p.h b/src/gui/text/qzipwriter_p.h index 0a4763855e..433bbab31e 100644 --- a/src/gui/text/qzipwriter_p.h +++ b/src/gui/text/qzipwriter_p.h @@ -39,7 +39,7 @@ #ifndef QZIPWRITER_H #define QZIPWRITER_H -#include <QtCore/qglobal.h> +#include <QtGui/private/qtguiglobal_p.h> #ifndef QT_NO_TEXTODFWRITER |