[webkit-help] Doing eventing in native code without using javascript part

85.mukesh 85.mukesh at gmail.com
Tue Apr 2 22:44:01 PDT 2013


Hi All,
 *Please read my problem statement:*
*JS Code:*

var mouse = MouseAndTouch(document, downHandler, upHandler, moveHandler);



function MouseAndTouch(dom, down, up, move) {

-----

--------

   var container = dom;

-----

   *container.addEventListener("mousedown", mouseDownHandler, true);*

}

Where passed argument in JS API MouseAndTouch () document is of type
Document and downHandler, upHandler, moveHandler are JS callback.

   function mouseDownHandler(e) { // JS Callback

      container.removeEventListener("mousedown", mouseDownHandler, true);

      container.addEventListener("mouseup", mouseUpHandler, true);

      ---------------------------------

   }

As per given above code snippet, I want to replace this JS code by C++ code
and want to handle event mechanism inside separated module written in C++
module. As I debug and I saw that api *container.addEventListener("mousedown",
mouseDownHandler, true);  is invoking  Node:: addEventListener(). When any
eventing is done on HTML element.*

*Now I have seen that in JS second argument for addEventListener is
callback (event handler) and corresponding  JS handler is getting executed
when matched  type of event is caught. But when I saw Web Core code to pass
C++ handler(Replaced code of JS handler to in CPP) and trying to pass
app *mouseDownHandler()(Converted
in CPP) in node->*addEventListener() in CPP it is giving type mismatch.
This is giving error because signature of API is *

    virtual bool addEventListener(const AtomicString& eventType, *
PassRefPtr<EventListener>*, bool useCapture);

Please let me know how can we handle event mechanism using
node->addEventListener in CPP(webcore internally).

Bottom of whole discussion is that I don’t want to handle event mechanism
via JS if any event happened on HTML element.

Thanks & Regards,

MK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20130403/0150b1f7/attachment-0001.html>


More information about the webkit-help mailing list