Changeset 75189 in webkit


Ignore:
Timestamp:
Jan 6, 2011 12:54:44 PM (13 years ago)
Author:
robert@webkit.org
Message:

2011-01-06 Robert Hogan <robert@webkit.org>

Reviewed by Antonio Gomes.

[Qt] Introduce QDRTNode for passing WebCore::Node across JS bridge

This allows LayoutTestController to pass WebCore::Node back to
layout tests.

Also amend nodesFromRect-links-and-text.html and
nodesFromRect-inner-documents.html so that they do not produce
platform-specific results.

Unskip:
fast/dom/nodesFromRect-links-and-text.html
fast/dom/nodesFromRect-inner-documents.html

https://bugs.webkit.org/show_bug.cgi?id=48957

  • fast/dom/nodesFromRect-inner-documents-expected.txt:
  • fast/dom/nodesFromRect-inner-documents.html:
  • fast/dom/nodesFromRect-links-and-text-expected.txt:
  • fast/dom/nodesFromRect-links-and-text.html:
  • fast/dom/resources/nodesFromRect.js: (check): (getTopFor): (getBottomFor):
  • platform/qt/Skipped:

2011-01-06 Robert Hogan <robert@webkit.org>

Reviewed by Antonio Gomes.

[Qt] Introduce QDRTNode for passing WebCore::Node across JS bridge

This allows LayoutTestController to pass WebCore::Node back to
layout tests.

Also amend nodesFromRect-links-and-text.html and
nodesFromRect-inner-documents.html so that they do not produce
platform-specific results.

Unskip:
fast/dom/nodesFromRect-links-and-text.html
fast/dom/nodesFromRect-inner-documents.html

https://bugs.webkit.org/show_bug.cgi?id=48957

  • bridge/qt/qt_runtime.cpp: (JSC::Bindings::QtDRTNodeRuntime::create): (JSC::Bindings::QtDRTNodeRuntime::get): (JSC::Bindings::convertValueToQVariant): (JSC::Bindings::convertQVariantToValue):

2011-01-06 Robert Hogan <robert@webkit.org>

Reviewed by Antonio Gomes.

[Qt] Introduce QDRTNode for passing WebCore::Node across JS bridge

This allows LayoutTestController to pass WebCore::Node back to
layout tests.

Also amend nodesFromRect-links-and-text.html and
nodesFromRect-inner-documents.html so that they do not produce
platform-specific results.

Unskip:
fast/dom/nodesFromRect-links-and-text.html
fast/dom/nodesFromRect-inner-documents.html

https://bugs.webkit.org/show_bug.cgi?id=48957

  • WebCoreSupport/DumpRenderTreeSupportQt.cpp: (QDRTNode::QDRTNode): (QDRTNode::~QDRTNode): (DumpRenderTreeSupportQt::nodesFromRect):
  • WebCoreSupport/DumpRenderTreeSupportQt.h:
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r75181 r75189  
     12011-01-06  Robert Hogan  <robert@webkit.org>
     2
     3        Reviewed by Antonio Gomes.
     4
     5        [Qt] Introduce QDRTNode for passing WebCore::Node across JS bridge
     6
     7        This allows LayoutTestController to pass WebCore::Node back to
     8        layout tests.
     9
     10        Also amend nodesFromRect-links-and-text.html and
     11        nodesFromRect-inner-documents.html so that they do not produce
     12        platform-specific results.
     13
     14        Unskip:
     15        fast/dom/nodesFromRect-links-and-text.html
     16        fast/dom/nodesFromRect-inner-documents.html
     17
     18        https://bugs.webkit.org/show_bug.cgi?id=48957
     19
     20        * fast/dom/nodesFromRect-inner-documents-expected.txt:
     21        * fast/dom/nodesFromRect-inner-documents.html:
     22        * fast/dom/nodesFromRect-links-and-text-expected.txt:
     23        * fast/dom/nodesFromRect-links-and-text.html:
     24        * fast/dom/resources/nodesFromRect.js:
     25        (check):
     26        (getTopFor):
     27        (getBottomFor):
     28        * platform/qt/Skipped:
     29
    1302011-01-06  Stephen White  <senorblanco@chromium.org>
    231
  • trunk/LayoutTests/fast/dom/nodesFromRect-basic-expected.txt

    r69939 r75189  
    22
    33TEST COMPLETE
    4 PASS All correct nodes found for rect [53,71], [0,0,0,0]
    5 PASS All correct nodes found for rect [53,71], [10,0,0,0]
    6 PASS All correct nodes found for rect [53,71], [0,10,0,0]
    7 PASS All correct nodes found for rect [53,71], [0,0,10,0]
    8 PASS All correct nodes found for rect [53,71], [0,0,0,10]
    9 PASS All correct nodes found for rect [53,71], [0,10,0,10]
    10 PASS All correct nodes found for rect [53,71], [10,0,10,0]
    11 PASS All correct nodes found for rect [53,71], [10,10,10,10]
    12 PASS All correct nodes found for rect [152,105], [10,0,0,0]
    13 PASS All correct nodes found for rect [152,105], [0,10,0,0]
    14 PASS All correct nodes found for rect [152,105], [0,0,10,0]
    15 PASS All correct nodes found for rect [152,105], [0,0,0,10]
    16 PASS All correct nodes found for rect [152,105], [10,0,10,0]
    17 PASS All correct nodes found for rect [152,105], [0,10,0,10]
    18 PASS All correct nodes found for rect [152,105], [10,10,10,10]
    19 PASS All correct nodes found for rect [153,193], [0,0,0,0]
    20 PASS All correct nodes found for rect [153,193], [0,20,0,20]
    21 PASS All correct nodes found for rect [153,193], [20,0,20,0]
    22 PASS All correct nodes found for rect [77,240], [0,0,0,0]
    23 PASS All correct nodes found for rect [77,240], [1,0,0,0]
    24 PASS All correct nodes found for rect [77,240], [0,0,1,0]
    25 PASS All correct nodes found for rect [77,240], [1,0,1,0]
    26 PASS All correct nodes found for rect [144,183], [0,0,0,0]
    27 PASS All correct nodes found for rect [144,183], [1,0,1,0]
    28 PASS All correct nodes found for rect [144,183], [0,1,0,1]
    29 PASS All correct nodes found for rect [144,183], [0,0,1,0]
    30 PASS All correct nodes found for rect [144,183], [0,0,0,1]
    31 PASS All correct nodes found for rect [144,183], [0,0,1,1]
    32 PASS All correct nodes found for rect [144,183], [1,1,1,1]
    33 PASS All correct nodes found for rect [77,240], [0,0,0,0]
    34 PASS All correct nodes found for rect [77,240], [0,1,0,1]
    35 PASS All correct nodes found for rect [77,240], [1,0,0,0]
    36 PASS All correct nodes found for rect [77,240], [0,0,1,0]
    37 PASS All correct nodes found for rect [77,240], [1,0,1,0]
    38 PASS All correct nodes found for rect [77,240], [1,1,1,1]
    39 PASS All correct nodes found for rect [39,212], [0,0,0,0]
    40 PASS All correct nodes found for rect [39,212], [10,0,0,0]
    41 PASS All correct nodes found for rect [39,212], [0,0,10,0]
    42 PASS All correct nodes found for rect [39,212], [10,1,30,0]
    43 PASS All correct nodes found for rect [39,212], [10,5,30,0]
    44 PASS All correct nodes found for rect [39,212], [10,15,30,0]
    45 PASS All correct nodes found for rect [39,212], [10,0,10,0]
    46 PASS All correct nodes found for rect [39,212], [0,10,0,10]
    47 PASS All correct nodes found for rect [39,212], [10,10,10,10]
     4PASS All correct nodes found for rect
     5PASS All correct nodes found for rect
     6PASS All correct nodes found for rect
     7PASS All correct nodes found for rect
     8PASS All correct nodes found for rect
     9PASS All correct nodes found for rect
     10PASS All correct nodes found for rect
     11PASS All correct nodes found for rect
     12PASS All correct nodes found for rect
     13PASS All correct nodes found for rect
     14PASS All correct nodes found for rect
     15PASS All correct nodes found for rect
     16PASS All correct nodes found for rect
     17PASS All correct nodes found for rect
     18PASS All correct nodes found for rect
     19PASS All correct nodes found for rect
     20PASS All correct nodes found for rect
     21PASS All correct nodes found for rect
     22PASS All correct nodes found for rect
     23PASS All correct nodes found for rect
     24PASS All correct nodes found for rect
     25PASS All correct nodes found for rect
     26PASS All correct nodes found for rect
     27PASS All correct nodes found for rect
     28PASS All correct nodes found for rect
     29PASS All correct nodes found for rect
     30PASS All correct nodes found for rect
     31PASS All correct nodes found for rect
     32PASS All correct nodes found for rect
     33PASS All correct nodes found for rect
     34PASS All correct nodes found for rect
     35PASS All correct nodes found for rect
     36PASS All correct nodes found for rect
     37PASS All correct nodes found for rect
     38PASS All correct nodes found for rect
     39PASS All correct nodes found for rect
     40PASS All correct nodes found for rect
     41PASS All correct nodes found for rect
     42PASS All correct nodes found for rect
     43PASS All correct nodes found for rect
     44PASS All correct nodes found for rect
     45PASS All correct nodes found for rect
     46PASS All correct nodes found for rect
     47PASS All correct nodes found for rect
    4848
  • trunk/LayoutTests/fast/dom/nodesFromRect-inner-documents-expected.txt

    r70147 r75189  
    22
    33TEST COMPLETE
    4 PASS All correct nodes found for rect [176,120], [0,0,0,0]
    5 PASS All correct nodes found for rect [176,120], [10,10,10,10]
    6 PASS All correct nodes found for rect [14,167], [0,10,0,0]
    7 PASS All correct nodes found for rect [150,17], [0,0,0,0]
    8 PASS All correct nodes found for rect [150,17], [0,0,10,0]
    9 PASS All correct nodes found for rect [150,17], [0,0,25,0]
     4PASS All correct nodes found for rect
     5PASS All correct nodes found for rect
     6PASS All correct nodes found for rect
     7PASS All correct nodes found for rect
     8PASS All correct nodes found for rect
     9PASS All correct nodes found for rect
    1010
  • trunk/LayoutTests/fast/dom/nodesFromRect-inner-documents.html

    r70147 r75189  
    3939      var body = innerDocument.getElementsByTagName('body')[0];
    4040      var divCenter = getCenterFor(div);
     41      var divBottom = getBottomFor(div);
     42      var pCenter = getCenterFor(p);
    4143      check(divCenter.x, divCenter.y, 0, 0, 0, 0, [div], innerDocument);
    42       check(divCenter.x, divCenter.y, 0, 0, 10, 0, [div, body], innerDocument);
    43       check(divCenter.x, divCenter.y, 0, 0, 25, 0, [p, div, body], innerDocument);
     44      check(divCenter.x, divCenter.y, 0, 0, divBottom.y - divCenter.y, 0, [div, body], innerDocument);
     45      check(divCenter.x, divCenter.y, 0, 0, pCenter.y - divCenter.y, 0, [p, div, body], innerDocument);
    4446
    4547      if (window.layoutTestController)
  • trunk/LayoutTests/fast/dom/nodesFromRect-links-and-text-expected.txt

    r70078 r75189  
    55
    66TEST COMPLETE
    7 PASS All correct nodes found for rect [37,32], [0,0,0,0]
    8 PASS All correct nodes found for rect [37,32], [10,0,0,0]
    9 PASS All correct nodes found for rect [37,32], [0,0,18,0]
    10 PASS All correct nodes found for rect [37,32], [0,11.5,0,0]
    11 PASS All correct nodes found for rect [37,32], [0,23,0,0]
    12 PASS All correct nodes found for rect [37,32], [0,23,18,0]
     7PASS All correct nodes found for rect
     8PASS All correct nodes found for rect
     9PASS All correct nodes found for rect
     10PASS All correct nodes found for rect
     11PASS All correct nodes found for rect
     12PASS All correct nodes found for rect
    1313
  • trunk/LayoutTests/fast/dom/nodesFromRect-links-and-text.html

    r70058 r75189  
    2727      var centerA2 = getCenterFor(e.a2);
    2828      var centerA3 = getCenterFor(e.a3);
     29      var topP1 = getTopFor(e.p1);
     30      var topA1 = getTopFor(e.a1);
    2931      var centerText = { x : (centerA2.x + centerA1.x) / 2, y : centerA1.y }; //text node between a1 and a2
    3032
    3133      check(centerA1.x, centerA1.y, 0, 0, 0, 0, [e.a1.firstChild]);
    32       check(centerA1.x, centerA1.y, 10, 0, 0, 0, [e.a1.firstChild, e.a1, e.p1]);
     34      check(centerA1.x, centerA1.y, topA1.y - topP1.y, 0, 0, 0, [e.a1.firstChild, e.a1, e.p1]);
    3335
    3436      check(centerA1.x, centerA1.y, 0, 0, centerA3.y - centerA1.y, 0, [e.a3.firstChild, e.a3, e.p1, e.a1.firstChild, e.a1]);
  • trunk/LayoutTests/fast/dom/resources/nodesFromRect.js

    r70147 r75189  
    3535  }
    3636
    37   testPassed("All correct nodes found for rect "  +
    38              "[" + x + "," + y + "], " +
    39              "[" + topPadding + "," + rightPadding +
    40              "," + bottomPadding + "," + leftPadding + "]");
     37  testPassed("All correct nodes found for rect");
    4138}
    4239
     
    4744}
    4845
     46function getTopFor(element)
     47{
     48  var rect = element.getBoundingClientRect();
     49  return { x : parseInt((rect.left + rect.right) / 2) , y : parseInt(rect.top)};
     50}
     51
     52function getBottomFor(element)
     53{
     54  var rect = element.getBoundingClientRect();
     55  return { x : parseInt((rect.left + rect.right) / 2) , y : parseInt(rect.bottom)};
     56}
     57
    4958var successfullyParsed = true;
  • trunk/LayoutTests/platform/qt/Skipped

    r75150 r75189  
    52885288fast/filesystem
    52895289
    5290 # Needs more investigation.
    5291 fast/dom/nodesFromRect-links-and-text.html
    5292 fast/dom/nodesFromRect-inner-documents.html
    5293 
    52945290# It fails, because 3D canvas is disabled by default.
    52955291http/tests/canvas/webgl/origin-clean-conformance.html
  • trunk/WebCore/ChangeLog

    r75188 r75189  
     12011-01-06  Robert Hogan  <robert@webkit.org>
     2
     3        Reviewed by Antonio Gomes.
     4
     5        [Qt] Introduce QDRTNode for passing WebCore::Node across JS bridge
     6
     7        This allows LayoutTestController to pass WebCore::Node back to
     8        layout tests.
     9
     10        Also amend nodesFromRect-links-and-text.html and
     11        nodesFromRect-inner-documents.html so that they do not produce
     12        platform-specific results.
     13
     14        Unskip:
     15        fast/dom/nodesFromRect-links-and-text.html
     16        fast/dom/nodesFromRect-inner-documents.html
     17
     18        https://bugs.webkit.org/show_bug.cgi?id=48957
     19
     20        * bridge/qt/qt_runtime.cpp:
     21        (JSC::Bindings::QtDRTNodeRuntime::create):
     22        (JSC::Bindings::QtDRTNodeRuntime::get):
     23        (JSC::Bindings::convertValueToQVariant):
     24        (JSC::Bindings::convertQVariantToValue):
     25
    1262011-01-06  Joone Hur  <joone.hur@collabora.co.uk>
    227
  • trunk/WebCore/bridge/qt/qt_runtime.cpp

    r71004 r75189  
    2525#include "DateMath.h"
    2626#include "DatePrototype.h"
     27#include "DumpRenderTreeSupportQt.h"
    2728#include "FunctionPrototype.h"
    2829#include "Interpreter.h"
     
    131132    {
    132133        return element.m_element;
     134    }
     135};
     136
     137// this is here as a proxy, so we'd have a class to friend in QDRTNode,
     138// as getting/setting a WebCore in QDRTNode is private.
     139// We only need to pass WebCore Nodes for layout tests.
     140class QtDRTNodeRuntime {
     141public:
     142    static QDRTNode create(Node* node)
     143    {
     144        return QDRTNode(node);
     145    }
     146
     147    static Node* get(const QDRTNode& node)
     148    {
     149        return node.m_node;
    133150    }
    134151};
     
    753770                else
    754771                    ret = QVariant::fromValue<QWebElement>(QWebElement());
     772            } else if (hint == (QMetaType::Type) qMetaTypeId<QDRTNode>()) {
     773                if (object && object->inherits(&JSNode::s_info))
     774                    ret = QVariant::fromValue<QDRTNode>(QtDRTNodeRuntime::create((static_cast<JSNode*>(object))->impl()));
    755775            } else if (hint == (QMetaType::Type) qMetaTypeId<QVariant>()) {
    756776                if (value.isUndefinedOrNull()) {
     
    897917
    898918        return toJS(exec, toJSDOMGlobalObject(document, exec), QtWebElementRuntime::get(variant.value<QWebElement>()));
     919    }
     920
     921    if (type == qMetaTypeId<QDRTNode>()) {
     922        if (!root->globalObject()->inherits(&JSDOMWindow::s_info))
     923            return jsUndefined();
     924
     925        Document* document = (static_cast<JSDOMWindow*>(root->globalObject()))->impl()->document();
     926        if (!document)
     927            return jsUndefined();
     928
     929        return toJS(exec, toJSDOMGlobalObject(document, exec), QtDRTNodeRuntime::get(variant.value<QDRTNode>()));
    899930    }
    900931
  • trunk/WebKit/qt/ChangeLog

    r75119 r75189  
     12011-01-06  Robert Hogan  <robert@webkit.org>
     2
     3        Reviewed by Antonio Gomes.
     4
     5        [Qt] Introduce QDRTNode for passing WebCore::Node across JS bridge
     6
     7        This allows LayoutTestController to pass WebCore::Node back to
     8        layout tests.
     9
     10        Also amend nodesFromRect-links-and-text.html and
     11        nodesFromRect-inner-documents.html so that they do not produce
     12        platform-specific results.
     13
     14        Unskip:
     15        fast/dom/nodesFromRect-links-and-text.html
     16        fast/dom/nodesFromRect-inner-documents.html
     17
     18        https://bugs.webkit.org/show_bug.cgi?id=48957
     19
     20        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
     21        (QDRTNode::QDRTNode):
     22        (QDRTNode::~QDRTNode):
     23        (DumpRenderTreeSupportQt::nodesFromRect):
     24        * WebCoreSupport/DumpRenderTreeSupportQt.h:
     25
    1262011-01-04  Girish Ramakrishnan  <girish@forwardbias.in>
    227
  • trunk/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp

    r73862 r75189  
    8383QMap<int, QWebScriptWorld*> m_worldMap;
    8484
     85QDRTNode::QDRTNode()
     86    : m_node(0)
     87{
     88}
     89
     90QDRTNode::QDRTNode(WebCore::Node* node)
     91    : m_node(0)
     92{
     93    if (node) {
     94        m_node = node;
     95        m_node->ref();
     96    }
     97}
     98
     99QDRTNode::~QDRTNode()
     100{
     101    if (m_node)
     102        m_node->deref();
     103}
     104
     105
    85106DumpRenderTreeSupportQt::DumpRenderTreeSupportQt()
    86107{
     
    855876        QVariant v;
    856877        // QWebElement will be null if the Node is not an HTML Element
    857         v.setValue(QWebElement(nodes->item(i)));
     878        if (nodes->item(i)->isHTMLElement())
     879            v.setValue(QWebElement(nodes->item(i)));
     880        else
     881            v.setValue(QDRTNode(nodes->item(i)));
    858882        res << v;
    859883    }
  • trunk/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h

    r73862 r75189  
    2727#include <QVariant>
    2828
     29namespace WebCore {
     30class Text;
     31class Node;
     32}
     33
     34
     35#if defined(WTF_USE_V8) && WTF_USE_V8
     36namespace V8 {
     37namespace Bindings {
     38class QtDRTNodeRuntime;
     39}
     40}
     41#else
     42namespace JSC {
     43namespace Bindings {
     44class QtDRTNodeRuntime;
     45}
     46}
     47#endif
     48
    2949class QWebElement;
    3050class QWebFrame;
     
    3454
    3555extern QMap<int, QWebScriptWorld*> m_worldMap;
     56
     57// Used to pass WebCore::Node's to layout tests using LayoutTestController
     58class QWEBKIT_EXPORT QDRTNode {
     59public:
     60    QDRTNode();
     61    ~QDRTNode();
     62
     63private:
     64    explicit QDRTNode(WebCore::Node*);
     65
     66    friend class DumpRenderTreeSupportQt;
     67
     68#if defined(WTF_USE_V8) && WTF_USE_V8
     69    friend class V8::Bindings::QtDRTNodeRuntime;
     70#else
     71    friend class JSC::Bindings::QtDRTNodeRuntime;
     72#endif
     73
     74    WebCore::Node* m_node;
     75};
     76
     77Q_DECLARE_METATYPE(QDRTNode)
    3678
    3779class QWEBKIT_EXPORT DumpRenderTreeSupportQt {
Note: See TracChangeset for help on using the changeset viewer.