Changeset 42238 in webkit
- Timestamp:
- Apr 6, 2009 4:25:37 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 9 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.pro (modified) (1 diff)
-
WebCore/bridge/qt/qt_runtime.h (modified) (1 diff)
-
WebKit/qt/Api/headers.pri (modified) (1 diff)
-
WebKit/qt/Api/qwebelement.cpp (added)
-
WebKit/qt/Api/qwebelement.h (added)
-
WebKit/qt/Api/qwebframe.cpp (modified) (3 diffs)
-
WebKit/qt/Api/qwebframe.h (modified) (4 diffs)
-
WebKit/qt/ChangeLog (modified) (1 diff)
-
WebKit/qt/QtLauncher/main.cpp (modified) (4 diffs)
-
WebKit/qt/tests/qwebelement (added)
-
WebKit/qt/tests/qwebelement/qwebelement.pro (added)
-
WebKit/qt/tests/qwebelement/tst_qwebelement.cpp (added)
-
WebKit/qt/tests/tests.pro (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r42237 r42238 1 2009-04-06 Simon Hausmann <simon.hausmann@nokia.com> 2 3 Reviewed by Tor Arne Vestbø. 4 5 Add new files to the Qt build. 6 Export helper function from the Qt JSC binding, needed in WebKit/qt. 7 8 * WebCore.pro: Add new files. 9 * bridge/qt/qt_runtime.h: Declare convertQVariantToValue. 10 1 11 2009-04-06 Simon Hausmann <simon.hausmann@nokia.com> 2 12 -
trunk/WebCore/WebCore.pro
r42167 r42238 1193 1193 ../WebKit/qt/Api/qwebpage.cpp \ 1194 1194 ../WebKit/qt/Api/qwebview.cpp \ 1195 ../WebKit/qt/Api/qwebelement.cpp \ 1195 1196 ../WebKit/qt/Api/qwebhistory.cpp \ 1196 1197 ../WebKit/qt/Api/qwebsettings.cpp \ -
trunk/WebCore/bridge/qt/qt_runtime.h
r42233 r42238 225 225 226 226 QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Type hint, int *distance); 227 JSValuePtr convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& variant); 227 228 228 229 } // namespace Bindings -
trunk/WebKit/qt/Api/headers.pri
r39744 r42238 6 6 $$PWD/qwebhistoryinterface.h \ 7 7 $$PWD/qwebdatabase.h \ 8 $$PWD/qwebsecurityorigin.h 8 $$PWD/qwebsecurityorigin.h \ 9 $$PWD/qwebelement.h -
trunk/WebKit/qt/Api/qwebframe.cpp
r42099 r42238 26 26 #include "qwebsecurityorigin.h" 27 27 #include "qwebsecurityorigin_p.h" 28 #include "qwebelement.h" 28 29 29 30 #include "DocumentLoader.h" … … 962 963 return QSize(); 963 964 return QSize(view->contentsWidth(), view->contentsHeight()); 965 } 966 967 /*! 968 \since 4.6 969 970 Returns the document element of this frame. 971 972 The document element provides access to the entire structured 973 content of the frame. 974 */ 975 QWebElement QWebFrame::documentElement() const 976 { 977 WebCore::Document *doc = d->frame->document(); 978 if (!doc) 979 return QWebElement(); 980 return QWebElement(doc->documentElement()); 981 } 982 983 /*! 984 \since 4.6 985 Returns a new selection of elements that are children of the frame's 986 document element and that match the given CSS selector \a query. 987 */ 988 QWebElementSelection QWebFrame::selectElements(const QString &query) const 989 { 990 return documentElement().select(query); 991 } 992 993 /*! 994 \since 4.6 995 Returns the first element in the frame's document that matches the 996 given CSS selector \a query. Returns a null element if there is no 997 match. 998 */ 999 QWebElement QWebFrame::selectElement(const QString &query) const 1000 { 1001 return documentElement().selectFirst(query); 964 1002 } 965 1003 … … 1448 1486 1449 1487 /*! 1488 \since 4.6 1489 Returns the underlying DOM element as QWebElement. 1490 */ 1491 QWebElement QWebHitTestResult::element() const 1492 { 1493 if (!d || !d->innerNonSharedNode || !d->innerNonSharedNode->isElementNode()) 1494 return QWebElement(); 1495 1496 return QWebElement(static_cast<WebCore::Element*>(d->innerNonSharedNode.get())); 1497 } 1498 1499 /*! 1450 1500 Returns the frame the hit test was executed in. 1451 1501 */ -
trunk/WebKit/qt/Api/qwebframe.h
r40973 r42238 1 1 /* 2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)2 Copyright (C) 2008,2009 Nokia Corporation and/or its subsidiary(-ies) 3 3 Copyright (C) 2007 Staikos Computing Services Inc. 4 4 … … 50 50 class QWebHistoryItem; 51 51 class QWebSecurityOrigin; 52 class QWebElement; 53 class QWebElementSelection; 52 54 53 55 namespace WebCore { … … 88 90 bool isContentEditable() const; 89 91 bool isContentSelected() const; 92 93 QWebElement element() const; 90 94 91 95 QWebFrame *frame() const; … … 175 179 QSize contentsSize() const; 176 180 181 QWebElement documentElement() const; 182 QWebElementSelection selectElements(const QString &query) const; 183 QWebElement selectElement(const QString &query) const; 184 177 185 QWebHitTestResult hitTestContent(const QPoint &pos) const; 178 186 -
trunk/WebKit/qt/ChangeLog
r42166 r42238 1 2009-04-06 Simon Hausmann <simon.hausmann@nokia.com> 2 Ariya Hidayat <ariya.hidayat@nokia.com> 3 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 4 Genevieve Mak <gen@staikos.net> 5 6 Reviewed by Tor Arne Vestbø, Simon Hausmann 7 8 First revision of new API in the Qt port to access the DOM. 9 10 * Api/headers.pri: Added qwebelement.h to the API headers. 11 * Api/qwebelement.cpp: Added. 12 * Api/qwebelement.h: Added. 13 * Api/qwebframe.cpp: 14 (QWebFrame::documentElement): Added accessor for the document element. 15 (QWebFrame::selectElements): Added convenienc query method. 16 (QWebFrame::selectElement): Ditto. 17 (QWebHitTestResult::element): Added accessor for underlying DOM element. 18 * Api/qwebframe.h: 19 * QtLauncher/main.cpp: Simple test gui for element selections. 20 * tests/qwebelement/qwebelement.pro: Added. 21 * tests/qwebelement/tst_qwebelement.cpp: Added. 22 * tests/tests.pro: Added QWebElement & QWebElementSelection unit tests. 23 1 24 2009-04-02 Simon Hausmann <simon.hausmann@nokia.com> 2 25 -
trunk/WebKit/qt/QtLauncher/main.cpp
r39173 r42238 1 1 /* 2 * Copyright (C) 200 8Nokia Corporation and/or its subsidiary(-ies)2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 3 3 * Copyright (C) 2006 George Staikos <staikos@kde.org> 4 4 * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> … … 34 34 #include <qwebframe.h> 35 35 #include <qwebsettings.h> 36 #include <qwebelement.h> 36 37 37 38 #include <QtGui> … … 182 183 qDebug() << "HTML: " << view->page()->mainFrame()->toHtml(); 183 184 } 185 186 void selectElements() { 187 bool ok; 188 QString str = QInputDialog::getText(this, "Select elements", "Choose elements", 189 QLineEdit::Normal, "a", &ok); 190 if (ok && !str.isEmpty()) { 191 QWebElementSelection result = view->page()->mainFrame()->selectElements(str); 192 foreach (QWebElement e, result) 193 e.setStyleProperty("background-color", "yellow"); 194 statusBar()->showMessage(QString("%1 element(s) selected").arg(result.count()), 5000); 195 } 196 } 197 184 198 private: 185 199 … … 273 287 view->pageAction(QWebPage::ToggleItalic)->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_I)); 274 288 view->pageAction(QWebPage::ToggleUnderline)->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_U)); 289 290 QMenu *toolsMenu = menuBar()->addMenu("&Tools"); 291 toolsMenu->addAction("Select elements...", this, SLOT(selectElements())); 292 275 293 } 276 294 -
trunk/WebKit/qt/tests/tests.pro
r35621 r42238 1 1 2 2 TEMPLATE = subdirs 3 SUBDIRS = qwebframe qwebpage 3 SUBDIRS = qwebframe qwebpage qwebelement
Note: See TracChangeset
for help on using the changeset viewer.