Re: How get nsIView from a nsGenericElement
Smaug <[email protected]> Mon, 26 Apr 2010 18:59:12 +0300
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
On 4/26/10 6:43 PM, hap497 wrote: > On Apr 25, 8:00 pm, Boris Zbarsky<[email protected]> wrote: >> On 4/25/10 9:32 PM, hap497 wrote: >> >>> If I have a pointer to nsGenericElement, how can I get a nsIView of >>> the element? >> >> Just based on the element, you can't. There may not be a view, or there >> may be more than one. >> >> What are you actually trying to do? >> >> -Boris > > I am trying to emulate an user click event on html element like > anchor. So I am trying to call nsPresShell's HandleEvent method > HandleEvent(nsIView* aView, nsGUIEvent* aEvent, > nsEventStatus* aEventStatus); > http://mxr.mozilla.org/mozilla1.9.1/source/layout/base/nsPresShell.cpp#908 > > Since my input is an nsGenericElement (an anchor), I need to get a > nsIView to call this HandleEvent. > > Thank you. Could you perhaps use trunk or 1.9.2 builds? nsDOMWindowUtils::DispatchDOMEventViaPresShell might be useful for you. It doesn't dispatch the event using PresShell::HandleEvent but PresShell::HandleEventWithTarget. -Olli