Title: [89830] trunk/Source
Revision
89830
Author
[email protected]
Date
2011-06-27 10:18:24 -0700 (Mon, 27 Jun 2011)

Log Message

2011-06-27  Caio Marcelo de Oliveira Filho  <[email protected]>

        Reviewed by Andreas Kling.

        [Qt] tst_QWebFrame::overloadedSlots() fails
        https://bugs.webkit.org/show_bug.cgi?id=37319

        This patch is based on Noam Rosenthal original patch in the same bug.

        When hinted with QWebElement metatype, we qualify the conversion
        from JSElement as a "perfect match".

        The test was failing because the wrong slot was called, since the QWebElement
        match was taken as equal to the others and not chosen when the metacall happened.

        * bridge/qt/qt_runtime.cpp:
        (JSC::Bindings::convertValueToQVariant): Identify the conversion between JSElement
        to QWebElement as a "perfect match" (dist = 0). Add comments to explain the reason
        why we have the implicit conversion.
2011-06-27  Caio Marcelo de Oliveira Filho  <[email protected]>

        Reviewed by Andreas Kling.

        [Qt] tst_QWebFrame::overloadedSlots() fails
        https://bugs.webkit.org/show_bug.cgi?id=37319

        * tests/qwebframe/tst_qwebframe.cpp:
        (tst_QWebFrame::overloadedSlots): Remove expected failure and
        fix the comment.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89829 => 89830)


--- trunk/Source/WebCore/ChangeLog	2011-06-27 17:16:42 UTC (rev 89829)
+++ trunk/Source/WebCore/ChangeLog	2011-06-27 17:18:24 UTC (rev 89830)
@@ -1,3 +1,23 @@
+2011-06-27  Caio Marcelo de Oliveira Filho  <[email protected]>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] tst_QWebFrame::overloadedSlots() fails
+        https://bugs.webkit.org/show_bug.cgi?id=37319
+
+        This patch is based on Noam Rosenthal original patch in the same bug.
+
+        When hinted with QWebElement metatype, we qualify the conversion
+        from JSElement as a "perfect match".
+
+        The test was failing because the wrong slot was called, since the QWebElement
+        match was taken as equal to the others and not chosen when the metacall happened.
+
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::convertValueToQVariant): Identify the conversion between JSElement
+        to QWebElement as a "perfect match" (dist = 0). Add comments to explain the reason
+        why we have the implicit conversion.
+
 2011-06-27  ChangSeok Oh  <[email protected]>
 
         Reviewed by Martin Robinson.

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.cpp (89829 => 89830)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2011-06-27 17:16:42 UTC (rev 89829)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2011-06-27 17:18:24 UTC (rev 89830)
@@ -778,11 +778,21 @@
             } else if (QtPixmapInstance::canHandle(static_cast<QMetaType::Type>(hint))) {
                 ret = QtPixmapInstance::variantFromObject(object, static_cast<QMetaType::Type>(hint));
             } else if (hint == (QMetaType::Type) qMetaTypeId<QWebElement>()) {
-                if (object && object->inherits(&JSHTMLElement::s_info))
-                    ret = QVariant::fromValue<QWebElement>(QtWebElementRuntime::create((static_cast<JSHTMLElement*>(object))->impl()));
-                else if (object && object->inherits(&JSDocument::s_info))
+                if (object && object->inherits(&JSElement::s_info)) {
+                    ret = QVariant::fromValue<QWebElement>(QtWebElementRuntime::create((static_cast<JSElement*>(object))->impl()));
+                    dist = 0;
+                    // Allow other objects to reach this one. This won't cause our algorithm to
+                    // loop since when we find an Element we do not recurse.
+                    visitedObjects->remove(object);
+                    break;
+                }
+                if (object && object->inherits(&JSDocument::s_info)) {
+                    // To support LayoutTestControllerQt::nodesFromRect(), used in DRT, we do an implicit
+                    // conversion from 'document' to the QWebElement representing the 'document.documentElement'.
+                    // We can't simply use a QVariantMap in nodesFromRect() because it currently times out
+                    // when serializing DOMMimeType and DOMPlugin, even if we limit the recursion.
                     ret = QVariant::fromValue<QWebElement>(QtWebElementRuntime::create((static_cast<JSDocument*>(object))->impl()->documentElement()));
-                else
+                } else
                     ret = QVariant::fromValue<QWebElement>(QWebElement());
             } else if (hint == (QMetaType::Type) qMetaTypeId<QDRTNode>()) {
                 if (object && object->inherits(&JSNode::s_info))

Modified: trunk/Source/WebKit/qt/ChangeLog (89829 => 89830)


--- trunk/Source/WebKit/qt/ChangeLog	2011-06-27 17:16:42 UTC (rev 89829)
+++ trunk/Source/WebKit/qt/ChangeLog	2011-06-27 17:18:24 UTC (rev 89830)
@@ -1,3 +1,14 @@
+2011-06-27  Caio Marcelo de Oliveira Filho  <[email protected]>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] tst_QWebFrame::overloadedSlots() fails
+        https://bugs.webkit.org/show_bug.cgi?id=37319
+
+        * tests/qwebframe/tst_qwebframe.cpp:
+        (tst_QWebFrame::overloadedSlots): Remove expected failure and
+        fix the comment.
+
 2011-06-20  Robert Hogan  <[email protected]>
 
         Reviewed by Antonio Gomes.

Modified: trunk/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp (89829 => 89830)


--- trunk/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp	2011-06-27 17:16:42 UTC (rev 89829)
+++ trunk/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp	2011-06-27 17:18:24 UTC (rev 89830)
@@ -2004,10 +2004,9 @@
     QCOMPARE(m_myObject->qtFunctionInvoked(), 35);
     */
 
-    // should pick myOverloadedSlot(QRegExp)
+    // Should pick myOverloadedSlot(QWebElement).
     m_myObject->resetQtFunctionInvoked();
     evalJS("myObject.myOverloadedSlot(document.body)");
-    QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=37319", Continue);
     QCOMPARE(m_myObject->qtFunctionInvoked(), 36);
 
     // should pick myOverloadedSlot(QObject*)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to