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/gui/text/qtextdocumentlayout.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)
     
    8080// ################ should probably add frameFormatChange notification!
    8181
    82 struct QLayoutStruct;
     82struct QTextLayoutStruct;
    8383
    8484class QTextFrameData : public QTextFrameLayoutData
     
    110110    QFixed maximumWidth;
    111111
    112     QLayoutStruct *currentLayoutStruct;
     112    QTextLayoutStruct *currentLayoutStruct;
    113113
    114114    bool sizeDirty;
     
    124124}
    125125
    126 struct QLayoutStruct {
    127     QLayoutStruct() : maximumWidth(QFIXED_MAX), fullLayout(false)
     126struct QTextLayoutStruct {
     127    QTextLayoutStruct() : maximumWidth(QFIXED_MAX), fullLayout(false)
    128128    {}
    129129    QTextFrame *frame;
     
    328328/*
    329329
    330 Optimisation strategies:
     330Optimization strategies:
    331331
    332332HTML layout:
     
    478478    HitPoint hitTest(QTextBlock bl, const QFixedPoint &point, int *position, QTextLayout **l, Qt::HitTestAccuracy accuracy) const;
    479479
    480     QLayoutStruct layoutCell(QTextTable *t, const QTextTableCell &cell, QFixed width,
    481                             int layoutFrom, int layoutTo, QTextTableData *tableData, QFixed absoluteTableY,
    482                             bool withPageBreaks);
     480    QTextLayoutStruct layoutCell(QTextTable *t, const QTextTableCell &cell, QFixed width,
     481                                 int layoutFrom, int layoutTo, QTextTableData *tableData, QFixed absoluteTableY,
     482                                 bool withPageBreaks);
    483483    void setCellPosition(QTextTable *t, const QTextTableCell &cell, const QPointF &pos);
    484484    QRectF layoutTable(QTextTable *t, int layoutFrom, int layoutTo, QFixed parentY);
     
    491491
    492492    void layoutBlock(const QTextBlock &bl, int blockPosition, const QTextBlockFormat &blockFormat,
    493                      QLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat);
    494     void layoutFlow(QTextFrame::Iterator it, QLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, QFixed width = 0);
    495     void pageBreakInsideTable(QTextTable *table, QLayoutStruct *layoutStruct);
    496 
    497 
    498     void floatMargins(const QFixed &y, const QLayoutStruct *layoutStruct, QFixed *left, QFixed *right) const;
    499     QFixed findY(QFixed yFrom, const QLayoutStruct *layoutStruct, QFixed requiredWidth) const;
     493                     QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat);
     494    void layoutFlow(QTextFrame::Iterator it, QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, QFixed width = 0);
     495    void pageBreakInsideTable(QTextTable *table, QTextLayoutStruct *layoutStruct);
     496
     497
     498    void floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct, QFixed *left, QFixed *right) const;
     499    QFixed findY(QFixed yFrom, const QTextLayoutStruct *layoutStruct, QFixed requiredWidth) const;
    500500
    501501    QVector<QCheckPoint> checkPoints;
     
    13701370    Q_ASSERT(firstLine.isValid());
    13711371    QPointF pos = (offset + layout->position()).toPoint();
    1372     Qt::LayoutDirection dir = docPrivate->defaultTextOption.textDirection();
    1373     if (blockFormat.hasProperty(QTextFormat::LayoutDirection))
    1374         dir = blockFormat.layoutDirection();
     1372    Qt::LayoutDirection dir = bl.textDirection();
    13751373    {
    13761374        QRectF textRect = firstLine.naturalTextRect();
     
    14881486}
    14891487
    1490 QLayoutStruct QTextDocumentLayoutPrivate::layoutCell(QTextTable *t, const QTextTableCell &cell, QFixed width,
    1491                                                     int layoutFrom, int layoutTo, QTextTableData *td,
    1492                                                     QFixed absoluteTableY, bool withPageBreaks)
     1488QTextLayoutStruct QTextDocumentLayoutPrivate::layoutCell(QTextTable *t, const QTextTableCell &cell, QFixed width,
     1489                                                        int layoutFrom, int layoutTo, QTextTableData *td,
     1490                                                        QFixed absoluteTableY, bool withPageBreaks)
    14931491{
    14941492    LDEBUG << "layoutCell";
    1495     QLayoutStruct layoutStruct;
     1493    QTextLayoutStruct layoutStruct;
    14961494    layoutStruct.frame = t;
    14971495    layoutStruct.minimumWidth = 0;
     
    16421640            // maximum width. otherwise the maxwidth calculation sometimes
    16431641            // returns wrong values
    1644             QLayoutStruct layoutStruct = layoutCell(table, cell, QFIXED_MAX, layoutFrom,
    1645                                                     layoutTo, td, absoluteTableY,
    1646                                                     /*withPageBreaks =*/false);
     1642            QTextLayoutStruct layoutStruct = layoutCell(table, cell, QFIXED_MAX, layoutFrom,
     1643                                                        layoutTo, td, absoluteTableY,
     1644                                                        /*withPageBreaks =*/false);
    16471645
    16481646            // distribute the minimum width over all columns the cell spans
     
    18691867
    18701868            const QFixed width = td->cellWidth(c, cspan) - widthPadding;
    1871             QLayoutStruct layoutStruct = layoutCell(table, cell, width,
    1872                                                     layoutFrom, layoutTo,
    1873                                                     td, absoluteTableY,
    1874                                                     /*withPageBreaks =*/true);
     1869            QTextLayoutStruct layoutStruct = layoutCell(table, cell, width,
     1870                                                       layoutFrom, layoutTo,
     1871                                                       td, absoluteTableY,
     1872                                                       /*withPageBreaks =*/true);
    18751873
    18761874            const QFixed height = layoutStruct.y + bottomPadding + topPadding;
     
    19771975    Q_ASSERT(pd && pd->currentLayoutStruct);
    19781976
    1979     QLayoutStruct *layoutStruct = pd->currentLayoutStruct;
     1977    QTextLayoutStruct *layoutStruct = pd->currentLayoutStruct;
    19801978
    19811979    if (!pd->floats.contains(frame))
     
    21172115    fd->contentsWidth = newContentsWidth;
    21182116
    2119     QLayoutStruct layoutStruct;
     2117    QTextLayoutStruct layoutStruct;
    21202118    layoutStruct.frame = f;
    21212119    layoutStruct.x_left = fd->leftMargin + fd->border + fd->padding;
     
    21802178}
    21812179
    2182 void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QLayoutStruct *layoutStruct,
     2180void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayoutStruct *layoutStruct,
    21832181                                            int layoutFrom, int layoutTo, QFixed width)
    21842182{
     
    25102508
    25112509void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosition, const QTextBlockFormat &blockFormat,
    2512                                              QLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat)
     2510                                             QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat)
    25132511{
    25142512    Q_Q(QTextDocumentLayout);
     
    25312529    //QTextFrameData *fd = data(layoutStruct->frame);
    25322530
    2533     Qt::LayoutDirection dir = docPrivate->defaultTextOption.textDirection();
    2534     if (blockFormat.hasProperty(QTextFormat::LayoutDirection))
    2535         dir = blockFormat.layoutDirection();
     2531    Qt::LayoutDirection dir = bl.textDirection();
    25362532
    25372533    QFixed extraMargin;
     
    27192715}
    27202716
    2721 void QTextDocumentLayoutPrivate::floatMargins(const QFixed &y, const QLayoutStruct *layoutStruct,
     2717void QTextDocumentLayoutPrivate::floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct,
    27222718                                              QFixed *left, QFixed *right) const
    27232719{
     
    27412737}
    27422738
    2743 QFixed QTextDocumentLayoutPrivate::findY(QFixed yFrom, const QLayoutStruct *layoutStruct, QFixed requiredWidth) const
     2739QFixed QTextDocumentLayoutPrivate::findY(QFixed yFrom, const QTextLayoutStruct *layoutStruct, QFixed requiredWidth) const
    27442740{
    27452741    QFixed right, left;
Note: See TracChangeset for help on using the changeset viewer.