• caio.oliveira@openbossa.org's avatar
    2011-06-14 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> · 591e492e
    caio.oliveira@openbossa.org authored
            Reviewed by Andreas Kling.
    
            [Qt] tst_QWebFrame::overloadedSlots() fails
            https://bugs.webkit.org/show_bug.cgi?id=37319
    
            Increase the likeness that JSElements are converted to QWebElements. 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.
    
            We also remove the implicit conversion between JSDocument (which is not an
            element) to QWebElement. The conversion only worked for calling slots, while
            without hint it returned a QVariantMap (as can be seen in domCycles test). It was
            added for supporting DRT, but since this change we can use it as QVariantMap and
            get the value for "documentElement".
    
            This patch is based on Noam Rosenthal original patch in the same bug.
    
            * bridge/qt/qt_runtime.cpp:
            (JSC::Bindings::hintForRealType):
            Extracted function to choose the metatype hint based on the JSValue type.  Add
            QWebElement metatype as a hint for JSElement objects, this way if no hint is
            provided, JSElement objects will always be converted to QWebElements.
    
            (JSC::Bindings::convertValueToQVariant):
            Use previous function. Identify the conversion between JSElement to QWebElement
            as a "perfect match" (dist = 0). And remove the implicit conversion when the hint
            is QWebElement metatype and we have a JSDocument.  Changed from JSHTMLElement to
            JSElement to cover the 'documentElement'.
    2011-06-14  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
    
            Reviewed by Andreas Kling.
    
            [Qt] tst_QWebFrame::overloadedSlots() fails
            https://bugs.webkit.org/show_bug.cgi?id=37319
    
            Since the implicit conversion was removed, change support functions of DRT to
            expect a QVariantMap instead of a QWebElement. This matches the exposed function
            in the controller, which takes 'document' and not 'document.documentElement'.
    
            And now that Element -> QWebElement is a perfect match, we must use QWebElement
            instead of QVariantMap, like in plainText().
    
            * WebCoreSupport/DumpRenderTreeSupportQt.h:
            * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
            (DumpRenderTreeSupportQt::plainText): Fix to use QWebElement instead of
            QVariantMap when getting the startContainer. Also use QVariantMap directly,
            bridge will do conversion for us now.
    
            (getCoreDocumentFromVariantMap): Extracts the WebCore::Document* from the
            QVariantMap that Qt bridge gives us when 'document' is passed from JS.
    
            (DumpRenderTreeSupportQt::nodesFromRect): Use helper function.
    
            * tests/qwebframe/tst_qwebframe.cpp: Splitted the test domCycles() into two
            different tests. In practice, the original test just checked whether we could
            create a QVariantMap representing 'document' without infinite looping due to
            cycles in the DOM. This was more evident before since we haven't a conversion
            from JSElement to QWebElement, but from JSElement to QVariantMap.
    
            (tst_QWebFrame::documentHasDocumentElement): Evaluates 'document' and extracts
            'documentElement' from it. Compares to QWebFrame::documentElement().
    
            (tst_QWebFrame::documentAllHasDocumentElement): Look inside 'document.all' for
            the documentElement.
    
            (tst_QWebFrame::overloadedSlots): Remove expected failure and fix wrong comment.
    2011-06-14  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
    
            Reviewed by Andreas Kling.
    
            [Qt] tst_QWebFrame::overloadedSlots() fails
            https://bugs.webkit.org/show_bug.cgi?id=37319
    
            Since we don't implictly convert 'document' object to QWebElement
            in metacalls anymore, change the controller to expect QVariantMap instead.
    
            The method plainText() was updated to use QVariantMap as well to let the bridge
            do the conversion directly for us.
    
            * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
            (LayoutTestController::nodesFromRect):
            * DumpRenderTree/qt/LayoutTestControllerQt.h:
            * DumpRenderTree/qt/PlainTextControllerQt.cpp:
            (PlainTextController::plainText):
            * DumpRenderTree/qt/PlainTextControllerQt.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88796 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    591e492e
qt_runtime.cpp 70.7 KB