Changeset 54857 in webkit
- Timestamp:
- Feb 16, 2010, 6:29:57 PM (16 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 4 edited
-
Api/qwebframe.cpp (modified) (1 diff)
-
Api/qwebframe.h (modified) (1 diff)
-
ChangeLog (modified) (1 diff)
-
tests/qwebframe/tst_qwebframe.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qwebframe.cpp
r54612 r54857 1141 1141 1142 1142 /*! 1143 \since 4.7 1144 Scrolls the frame to the given \a anchor name. 1145 */ 1146 void QWebFrame::scrollToAnchor(const QString& anchor) 1147 { 1148 FrameView *view = d->frame->view(); 1149 if (view) 1150 view->scrollToAnchor(anchor); 1151 } 1152 1153 /*! 1143 1154 \since 4.6 1144 1155 Render the \a layer of the frame using \a painter clipping to \a clip. -
trunk/WebKit/qt/Api/qwebframe.h
r52311 r54857 161 161 void setScrollPosition(const QPoint &pos); 162 162 163 void scrollToAnchor(const QString& anchor); 164 163 165 enum RenderLayer { 164 166 ContentsLayer = 0x10, -
trunk/WebKit/qt/ChangeLog
r54854 r54857 1 2010-02-16 Ariya Hidayat <ariya.hidayat@gmail.com> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] Allow scrolling to an anchor programmatically. 6 https://bugs.webkit.org/show_bug.cgi?id=29856 7 8 * Api/qwebframe.cpp: 9 (QWebFrame::scrollToAnchor): New API function. 10 * Api/qwebframe.h: 11 * tests/qwebframe/tst_qwebframe.cpp: New tests for scrollToAnchor(). 12 1 13 2010-02-16 Ariya Hidayat <ariya.hidayat@gmail.com> 2 14 -
trunk/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
r54775 r54857 585 585 void render(); 586 586 void scrollPosition(); 587 void scrollToAnchor(); 587 588 void evaluateWillCauseRepaint(); 588 589 void qObjectWrapperWithSameIdentity(); … … 2765 2766 } 2766 2767 2768 void tst_QWebFrame::scrollToAnchor() 2769 { 2770 QWebPage page; 2771 page.setViewportSize(QSize(480, 800)); 2772 QWebFrame* frame = page.mainFrame(); 2773 2774 QString html("<html><body><p style=\"margin-bottom: 1500px;\">Hello.</p>" 2775 "<p><a id=\"foo\">This</a> is an anchor</p>" 2776 "<p style=\"margin-bottom: 1500px;\"><a id=\"bar\">This</a> is another anchor</p>" 2777 "</body></html>"); 2778 frame->setHtml(html); 2779 frame->setScrollPosition(QPoint(0, 0)); 2780 QCOMPARE(frame->scrollPosition().x(), 0); 2781 QCOMPARE(frame->scrollPosition().y(), 0); 2782 2783 QWebElement fooAnchor = frame->findFirstElement("a[id=foo]"); 2784 2785 frame->scrollToAnchor("foo"); 2786 QCOMPARE(frame->scrollPosition().y(), fooAnchor.geometry().top()); 2787 2788 frame->scrollToAnchor("bar"); 2789 frame->scrollToAnchor("foo"); 2790 QCOMPARE(frame->scrollPosition().y(), fooAnchor.geometry().top()); 2791 2792 frame->scrollToAnchor("top"); 2793 QCOMPARE(frame->scrollPosition().y(), 0); 2794 2795 frame->scrollToAnchor("bar"); 2796 frame->scrollToAnchor("notexist"); 2797 QVERIFY(frame->scrollPosition().y() != 0); 2798 } 2799 2767 2800 void tst_QWebFrame::evaluateWillCauseRepaint() 2768 2801 {
Note:
See TracChangeset
for help on using the changeset viewer.