[Webkit-unassigned] [Bug 93002] New: webkit_dom_document_create_tree_walker impossible to use due to WebKitDOMNodeFilter

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 2 09:34:11 PDT 2012


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

           Summary: webkit_dom_document_create_tree_walker impossible to
                    use due to WebKitDOMNodeFilter
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Major
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: charles at hailoo.com


As per http://lists.webkit.org/pipermail/webkit-gtk/2012-August/001186.html, the following bug (incomplete functionality) exists with the WebKitDOMTreeWalker API:

webkit_dom_document_create_tree_walker is not possible to use, because:

1) It requires a non-NULL WebKitDOMNodeFilter pointer

As per the usage of document.createTreeWalker in Javascript, this is a bug because you are allowed to pass "null" for the Filter parameter in Javascript.  In WebKitDOMDocument.cpp, in the function body for webkit_dom_document_create_tree_walker, the line g_return_val_if_fail(filter, 0) should be removed, because WebCore::Document::createTreeWalker() will accept a NULL filter.  The Document::createTreeWalker() function will convert the null raw pointer to a smart pointer, and pass it to a WebCore::Traversal instance.  WebCore::Traversal will then check for a NULL filter in Traversal::acceptNode.  So there is no reason for the GTK layer to check for a NULL with g_return_val_if_fail(filter, 0).

2) The Webkit GTK API does not expose any means to create a WebKitDOMNodeFilter object.  (The header file WebKitDOMNodeFilter.h does not expose a constructor.)

In combination with (1), this second bug makes WebKitDOMTreeWalker impossible to use at all, since the Webkit GTK API exposes no way to instantiate a WebKitDOMNodeFilter instance.  In WebKitDOMNodeFilter.h there needs to be a constructor function exposed, which wraps a WebCore::NodeFilter object.  It's also unclear how the WebKit GTK API handles user-provided Node Filters (which are handled using the virtual function NodeFilterCondition::acceptNode() in WebCore.)  Presumably, a derived class of webCore::NodeFilterCondition would need to be created which just defers to a wrapped C function provided at the Webkit-GTK layer.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list