Skip to content

Commit 95e4c3f

Browse files
author
Antonio Gomes
committed
[Qt] tst_QWebHistoryInterface::visitedLinks() fails
https://bugs.webkit.org/show_bug.cgi?id=37323 Patch by Antonio Gomes <tonikitoo@webkit.org>, Yi Shen <yi.4.shen@nokia.com> on 2010-04-28 Reviewed by NOBODY Simon Hausmann. Patch fixes styleProperty method of QWebElement to make use of CSSComputedStyleDeclaration::computedStyle 'allowVisitedStyle' parameter and the corresponding failing QWebHistoryInterface::visitedLinks method. * Api/qwebelement.cpp: (QWebElement::styleProperty): * tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp: (tst_QWebHistoryInterface::visitedLinks): Canonical link: https://commits.webkit.org/49696@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@58427 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent e5fcd39 commit 95e4c3f

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

WebKit/qt/Api/qwebelement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str
821821

822822
int propID = cssPropertyID(name);
823823

824-
RefPtr<CSSComputedStyleDeclaration> style = computedStyle(m_element);
824+
RefPtr<CSSComputedStyleDeclaration> style = computedStyle(m_element, true);
825825
if (!propID || !style)
826826
return QString();
827827

WebKit/qt/ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2010-04-28 Antonio Gomes <tonikitoo@webkit.org>, Yi Shen <yi.4.shen@nokia.com>
2+
3+
Reviewed by Simon Hausmann.
4+
5+
[Qt] tst_QWebHistoryInterface::visitedLinks() fails
6+
https://bugs.webkit.org/show_bug.cgi?id=37323
7+
8+
Patch fixes styleProperty method of QWebElement to make use of
9+
CSSComputedStyleDeclaration::computedStyle 'allowVisitedStyle' parameter
10+
and the corresponding failing QWebHistoryInterface::visitedLinks method.
11+
12+
* Api/qwebelement.cpp:
13+
(QWebElement::styleProperty):
14+
* tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp:
15+
(tst_QWebHistoryInterface::visitedLinks):
16+
117
2010-04-28 Luiz Agostini <luiz.agostini@openbossa.org>
218

319
Reviewed by Kenneth Rohde Christiansen.

WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <qwebpage.h>
2424
#include <qwebview.h>
2525
#include <qwebframe.h>
26+
#include <qwebelement.h>
2627
#include <qwebhistoryinterface.h>
2728
#include <QDebug>
2829

@@ -85,9 +86,10 @@ class FakeHistoryImplementation : public QWebHistoryInterface {
8586
void tst_QWebHistoryInterface::visitedLinks()
8687
{
8788
QWebHistoryInterface::setDefaultInterface(new FakeHistoryImplementation);
88-
m_view->setHtml("<html><body><a href='http://www.trolltech.com'>Trolltech</a></body></html>");
89-
QCOMPARE(m_page->mainFrame()->evaluateJavaScript("document.querySelectorAll(':visited').length;").toString(),
90-
QString::fromLatin1("1"));
89+
m_view->setHtml("<html><style>:link{color:green}:visited{color:red}</style><body><a href='http://www.trolltech.com' id='vlink'>Trolltech</a></body></html>");
90+
QWebElement anchor = m_view->page()->mainFrame()->findFirstElement("a[id=vlink]");
91+
QString linkColor = anchor.styleProperty("color", QWebElement::ComputedStyle);
92+
QCOMPARE(linkColor, QString::fromLatin1("rgb(255, 0, 0)"));
9193
}
9294

9395
QTEST_MAIN(tst_QWebHistoryInterface)

0 commit comments

Comments
 (0)