Changeset 39173 in webkit


Ignore:
Timestamp:
Dec 10, 2008, 8:41:50 AM (16 years ago)
Author:
zecke@webkit.org
Message:

2008-12-10 Holger Hans Peter Freyther <zecke@selfish.org>

Reviewed by Simon Hausmann.

API changes discussed with Simon Hausmann, Tor Arne
Vestbø, Ariya Hidayat...

  • Api/qwebdatabase.cpp: (QWebDatabase::fileName): (QWebDatabase::removeDatabase):
  • Api/qwebdatabase.h:
  • Api/qwebframe.cpp: (QWebFrame::scroll): (QWebFrame::scrollPosition): (QWebFrame::setScrollPosition):
  • Api/qwebframe.h:
  • Api/qwebpage.cpp: (QWebPage::setContentEditable): (QWebPage::isContentEditable): (QWebPage::extension):
  • Api/qwebpage.h:
  • Api/qwebsecurityorigin.cpp:
  • Api/qwebsettings.cpp: (QWebSettingsPrivate::apply): (QWebSettings::QWebSettings):
  • Api/qwebsettings.h:
  • QtLauncher/main.cpp: (MainWindow::setEditable):
  • WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::exceededDatabaseQuota): (WebCore::ChromeClientQt::runOpenPanel):
  • WebCoreSupport/EditorClientQt.cpp: (WebCore::EditorClientQt::isEditable):
  • tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::database):
Location:
trunk/WebKit/qt
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qwebdatabase.cpp

    r38904 r39173  
    101101
    102102/*!
    103     Returns the path to the web database on disk.
     103    Returns the file name of the web database.
    104104
    105     The path can be used to access the database through the QtSql database module, for example:
     105    The name can be used to access the database through the QtSql database module, for example:
    106106    \code
    107107      QWebDatabase webdb = ...
    108108      QSqlDatabase sqldb = QSqlDatabase::addDatabase("QSQLITE", "myconnection");
    109       sqldb.setDatabaseName(webdb.absoluteFilePath());
     109      sqldb.setDatabaseName(webdb.fileName());
    110110      if (sqldb.open()) {
    111111          QStringList tables = sqldb.tables();
     
    117117    is not very efficient because Sqlite is used as WebKit's database backend.
    118118*/
    119 QString QWebDatabase::absoluteFilePath() const
     119QString QWebDatabase::fileName() const
    120120{
    121121    return DatabaseTracker::tracker().fullPathForDatabase(d->origin.get(), d->name, false);
     
    136136    will be destroyed.
    137137*/
    138 void QWebDatabase::remove()
     138void QWebDatabase::removeDatabase(const QWebDatabase &db)
    139139{
    140     DatabaseTracker::tracker().deleteDatabase(d->origin.get(), d->name);
     140    DatabaseTracker::tracker().deleteDatabase(db.d->origin.get(), db.d->name);
    141141}
    142142
  • trunk/WebKit/qt/Api/qwebdatabase.h

    r38400 r39173  
    4343    qint64 expectedSize() const;
    4444    qint64 size() const;
    45     QString absoluteFilePath() const;
     45    QString fileName() const;
    4646    QWebSecurityOrigin origin() const;
    47     void remove();
     47
     48    static void removeDatabase(const QWebDatabase &db);
    4849
    4950private:
  • trunk/WebKit/qt/Api/qwebframe.cpp

    r38904 r39173  
    304304    \endtable
    305305
    306     This function returns a multi map to support multiple meta tags with the same name attribute.
     306    This function returns a multi map to support multiple meta tags with the same attribute name.
    307307*/
    308308QMultiMap<QString, QString> QWebFrame::metaData() const
     
    663663  \a dx and \a dy may be negative.
    664664 
    665   \sa QWebFrame::scrollOffset
    666 */
    667 
    668 void QWebFrame::scroll(int dx, int dy) const
     665  \sa QWebFrame::scrollPosition
     666*/
     667
     668void QWebFrame::scroll(int dx, int dy)
    669669{
    670670    if (!d->frame->view())
     
    675675
    676676/*!
    677   \property QWebFrame::scrollOffset
    678   \brief The offset from the start this frame is currently scrolled to.
    679 */
    680 
    681 QPoint QWebFrame::scrollOffset() const
     677  \property QWebFrame::scrollPosition
     678  \since 4.5
     679  \brief the position the frame is currently scrolled to.
     680*/
     681
     682QPoint QWebFrame::scrollPosition() const
    682683{
    683684    if (!d->frame->view())
     
    688689}
    689690
    690 void QWebFrame::setScrollOffset(const QPoint &offset) const
    691 {
    692     QPoint current = scrollOffset();
    693     int dx = offset.x() - current.x();
    694     int dy = offset.y() - current.y();
     691void QWebFrame::setScrollPosition(const QPoint &pos)
     692{
     693    QPoint current = scrollPosition();
     694    int dx = pos.x() - current.x();
     695    int dy = pos.y() - current.y();
    695696    scroll(dx, dy);
    696697}
     
    10271028  This signal is emitted shortly before the history of navigated pages
    10281029  is changed, for example when navigating back in the history.
     1030
     1031  The \a item parameter refers to the currently displayed frame.
    10291032
    10301033  A potential use-case for this signal is to store custom data in
     
    11471150/*!
    11481151    \since 4.5
    1149     Returns the bounding box of the element.
     1152    Returns the bounding rect of the element.
    11501153*/
    11511154QRect QWebHitTestResult::boundingRect() const
  • trunk/WebKit/qt/Api/qwebframe.h

    r38396 r39173  
    106106    Q_PROPERTY(QIcon icon READ icon)
    107107    Q_PROPERTY(QSize contentsSize READ contentsSize)
    108     Q_PROPERTY(QPoint scrollOffset READ scrollOffset WRITE setScrollOffset)
     108    Q_PROPERTY(QPoint scrollPosition READ scrollPosition WRITE setScrollPosition)
    109109private:
    110110    QWebFrame(QWebPage *parent, QWebFrameData *frameData);
     
    150150    int scrollBarMaximum(Qt::Orientation orientation) const;
    151151
    152     void scroll(int, int) const;
    153     QPoint scrollOffset() const;
    154     void setScrollOffset(const QPoint &offset) const;
     152    void scroll(int, int);
     153    QPoint scrollPosition() const;
     154    void setScrollPosition(const QPoint &pos);
    155155
    156156    void render(QPainter *painter, const QRegion &clip);
  • trunk/WebKit/qt/Api/qwebpage.cpp

    r39132 r39173  
    18201820
    18211821/*!
    1822     \property QWebPage::editable
     1822    \property QWebPage::contentEditable
    18231823    \brief whether the content in this QWebPage is editable or not
    18241824    \since 4.5
     
    18281828    \c{contenteditable} attribute set are editable.
    18291829*/
    1830 void QWebPage::setEditable(bool editable)
     1830void QWebPage::setContentEditable(bool editable)
    18311831{
    18321832    if (d->editable != editable) {
     
    18481848}
    18491849
    1850 bool QWebPage::isEditable() const
     1850bool QWebPage::isContentEditable() const
    18511851{
    18521852    return d->editable;
     
    20432043    if (extension == ChooseMultipleFilesExtension) {
    20442044        // FIXME: do not ignore suggestedFiles
    2045         QStringList suggestedFiles = reinterpret_cast<const ChooseMultipleFilesExtensionOption*>(option)->suggestedFiles;
     2045        QStringList suggestedFiles = static_cast<const ChooseMultipleFilesExtensionOption*>(option)->suggestedFileNames;
    20462046        QStringList names = QFileDialog::getOpenFileNames(d->view, QString::null);
    2047         reinterpret_cast<ChooseMultipleFilesExtensionReturn*>(output)->files = names;
     2047        static_cast<ChooseMultipleFilesExtensionReturn*>(output)->fileNames = names;
    20482048        return true;
    20492049    }
     
    24722472/*!
    24732473    \fn void QWebPage::contentsChanged()
    2474 
    2475     This signal is emitted whenever the content changes during editing.
    2476 
    2477     \sa selectedText()
     2474    \since 4.5
     2475
     2476    This signal is emitted whenever the text in form elements changes
     2477    as well as other editable content.
     2478
     2479    \sa contentEditable(), QWebFrame::toHtml(), QWebFrame::toPlainText()
    24782480*/
    24792481
     
    25852587
    25862588/*!
    2587     \fn void QWebPage::exceededDatabaseQuota(QWebFrame* frame, QString databaseName);
     2589    \fn void QWebPage::databaseQuotaExceeded(QWebFrame* frame, QString databaseName);
     2590    \since 4.5
    25882591
    25892592    This signal is emitted whenever a web site is asking to store data to the database \a databaseName
  • trunk/WebKit/qt/Api/qwebpage.h

    r39132 r39173  
    6868    Q_PROPERTY(LinkDelegationPolicy linkDelegationPolicy READ linkDelegationPolicy WRITE setLinkDelegationPolicy)
    6969    Q_PROPERTY(QPalette palette READ palette WRITE setPalette)
    70     Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
     70    Q_PROPERTY(bool contentEditable READ isContentEditable WRITE setContentEditable)
    7171    Q_ENUMS(LinkDelegationPolicy NavigationType WebAction)
    7272public:
     
    229229    QPalette palette() const;
    230230
    231     void setEditable(bool editable);
    232     bool isEditable() const;
     231    void setContentEditable(bool editable);
     232    bool isContentEditable() const;
    233233
    234234#ifndef QT_NO_CONTEXTMENU
     
    250250    public:
    251251        QWebFrame *parentFrame;
    252         QStringList suggestedFiles;
     252        QStringList suggestedFileNames;
    253253    };
    254254
    255255    class ChooseMultipleFilesExtensionReturn : public ExtensionReturn {
    256256    public:
    257         QStringList files;
     257        QStringList fileNames;
    258258    };
    259259
     
    288288    void microFocusChanged();
    289289    void contentsChanged();
    290     void exceededDatabaseQuota(QWebFrame* frame, QString databaseName);
     290    void databaseQuotaExceeded(QWebFrame* frame, QString databaseName);
    291291
    292292protected:
  • trunk/WebKit/qt/Api/qwebsecurityorigin.cpp

    r38904 r39173  
    3737
    3838    QWebSecurityOrigin provides access to the security domains defined by web sites.
    39     An origin is consists of a host name, a scheme, and a port number. Web sites with the same
     39    An origin consists of a host name, a scheme, and a port number. Web sites with the same
    4040    security origin can access each other's resources for client-side scripting or databases.
    4141
  • trunk/WebKit/qt/Api/qwebsettings.cpp

    r39136 r39173  
    169169        settings->setZoomsTextOnly(value);
    170170
    171         value = attributes.value(QWebSettings::PrintBackgroundElements,
    172                                       global->attributes.value(QWebSettings::PrintBackgroundElements));
     171        value = attributes.value(QWebSettings::PrintElementBackgrounds,
     172                                      global->attributes.value(QWebSettings::PrintElementBackgrounds));
    173173        settings->setShouldPrintBackgrounds(value);
    174174
     
    292292    \value ZoomTextOnly Specifies whether the zoom factor on a frame applies to
    293293        only the text or all content.
    294     \value PrintBackgroundElements Specifies whether the background color and images
     294    \value PrintElementBackgrounds Specifies whether the background color and images
    295295        are also drawn when the page is printed.
    296296*/
     
    319319    d->attributes.insert(QWebSettings::LinksIncludedInFocusChain, true);
    320320    d->attributes.insert(QWebSettings::ZoomTextOnly, false);
    321     d->attributes.insert(QWebSettings::PrintBackgroundElements, true);
     321    d->attributes.insert(QWebSettings::PrintElementBackgrounds, true);
    322322    d->attributes.insert(QWebSettings::OfflineStorageDatabaseEnabled, true);
    323323    d->attributes.insert(QWebSettings::OfflineWebApplicationCacheEnabled, true);
  • trunk/WebKit/qt/Api/qwebsettings.h

    r38396 r39173  
    6161        LinksIncludedInFocusChain,
    6262        ZoomTextOnly,
    63         PrintBackgroundElements,
     63        PrintElementBackgrounds,
    6464        OfflineStorageDatabaseEnabled,
    6565        OfflineWebApplicationCacheEnabled,
  • trunk/WebKit/qt/ChangeLog

    r39170 r39173  
     12008-12-10  Holger Hans Peter Freyther  <zecke@selfish.org>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        API changes discussed with Simon Hausmann, Tor Arne
     6        Vestbø, Ariya Hidayat...
     7
     8        * Api/qwebdatabase.cpp:
     9        (QWebDatabase::fileName):
     10        (QWebDatabase::removeDatabase):
     11        * Api/qwebdatabase.h:
     12        * Api/qwebframe.cpp:
     13        (QWebFrame::scroll):
     14        (QWebFrame::scrollPosition):
     15        (QWebFrame::setScrollPosition):
     16        * Api/qwebframe.h:
     17        * Api/qwebpage.cpp:
     18        (QWebPage::setContentEditable):
     19        (QWebPage::isContentEditable):
     20        (QWebPage::extension):
     21        * Api/qwebpage.h:
     22        * Api/qwebsecurityorigin.cpp:
     23        * Api/qwebsettings.cpp:
     24        (QWebSettingsPrivate::apply):
     25        (QWebSettings::QWebSettings):
     26        * Api/qwebsettings.h:
     27        * QtLauncher/main.cpp:
     28        (MainWindow::setEditable):
     29        * WebCoreSupport/ChromeClientQt.cpp:
     30        (WebCore::ChromeClientQt::exceededDatabaseQuota):
     31        (WebCore::ChromeClientQt::runOpenPanel):
     32        * WebCoreSupport/EditorClientQt.cpp:
     33        (WebCore::EditorClientQt::isEditable):
     34        * tests/qwebpage/tst_qwebpage.cpp:
     35        (tst_QWebPage::database):
     36
    1372008-12-09  Balazs Kelemen  <Kelemen.Balazs.3@stud.u-szeged.hu>
    238
  • trunk/WebKit/qt/QtLauncher/main.cpp

    r39170 r39173  
    175175
    176176    void setEditable(bool on) {
    177         view->page()->setEditable(on);
     177        view->page()->setContentEditable(on);
    178178        formatMenuAction->setVisible(on);
    179179    }
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r39132 r39173  
    389389        DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), quota);
    390390#endif
    391     emit m_webPage->exceededDatabaseQuota(QWebFramePrivate::kit(frame), databaseName);
     391    emit m_webPage->databaseQuotaExceeded(QWebFramePrivate::kit(frame), databaseName);
    392392}
    393393
     
    403403        if (!fileChooser->filenames().isEmpty())
    404404            for (int i = 0; i < fileChooser->filenames().size(); ++i)
    405                 option.suggestedFiles += fileChooser->filenames()[i];
     405                option.suggestedFileNames += fileChooser->filenames()[i];
    406406
    407407        QWebPage::ChooseMultipleFilesExtensionReturn output;
    408408        m_webPage->extension(QWebPage::ChooseMultipleFilesExtension, &option, &output);
    409409
    410         if (!output.files.isEmpty()) {
     410        if (!output.fileNames.isEmpty()) {
    411411            Vector<String> names;
    412             for (int i = 0; i < output.files.count(); ++i)
    413                 names.append(output.files[i]);
     412            for (int i = 0; i < output.fileNames.count(); ++i)
     413                names.append(output.fileNames.at(i));
    414414            fileChooser->chooseFiles(names);
    415415        }
  • trunk/WebKit/qt/WebCoreSupport/EditorClientQt.cpp

    r38738 r39173  
    247247bool EditorClientQt::isEditable()
    248248{
    249     return m_page->isEditable();
     249    return m_page->isContentEditable();
    250250}
    251251
  • trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r38820 r39173  
    381381
    382382    qRegisterMetaType<QWebFrame*>("QWebFrame*");
    383     QSignalSpy spy(m_page, SIGNAL(exceededDatabaseQuota(QWebFrame *, QString)));
     383    QSignalSpy spy(m_page, SIGNAL(databaseQuotaExceeded(QWebFrame *, QString)));
    384384    m_view->setHtml(QString("<html><head><script>var db; db=openDatabase('testdb', '1.0', 'test database API', 50000); </script></head><body><div></div></body></html>"), QUrl("http://www.myexample.com"));
    385385    QTRY_COMPARE(spy.count(), 1);
     
    405405    QList<QWebDatabase> dbs = origin.databases();
    406406    if (dbs.count() > 0) {
    407         QString filePath = dbs[0].absoluteFilePath();
    408         QVERIFY(QFile::exists(filePath));
    409         dbs[0].remove();
    410         QVERIFY(!QFile::exists(filePath));
     407        QString fileName = dbs[0].fileName();
     408        QVERIFY(QFile::exists(fileName));
     409        QWebDatabase::removeDatabase(dbs[0]);
     410        QVERIFY(!QFile::exists(fileName));
    411411    }
    412412    QTest::qWait(1000);
Note: See TracChangeset for help on using the changeset viewer.