[webkit-help] isOverLink() function in android-webkit

Vivek Satpute vivekonline86 at gmail.com
Thu Feb 4 02:21:37 PST 2010


Hi Ariya,

On Tue, Feb 2, 2010 at 2:45 PM, Ariya Hidayat <ariya.hidayat at gmail.com>wrote:

> > I want to know the logic of isOverLink() that on which basis it returns
> true
> > or false. How it decides that
> > click is over link ? Does it use (x,y)  co-ordinates of clicked area to
> take
> > decision ?
>
> If you bother to check m_hitTestResult, you'll find out that it is an
> instance of HitTestResult, which of course already stores hit test
> result (surprised!). You can set a breakpoint in the HitTestResult
> constructor to see who creates it (there are few places, from event
> handling to selection logic). You can also have a look at
> RenderLayer::hitTest() function.
>
> I looked into RenderLayer::hitTest() function also.  It does few things
given below:

    Node* node = result.innerNode();
    while (node) {
        // for imagemaps, URLElement is the associated area element not the
image itself
        if (node->isLink() && !result.URLElement() &&
!node->hasTagName(imgTag)) {
                printf("VSS: setting URLElement\n");
            result.setURLElement(static_cast<Element*>(node));
        }
        node = node->eventParentNode();
    }

>From above, my understanding is, result.innerNode() has URL and we set it
using result.setURLElement().
And then whenever, we check event.isOverLink() we get TRUE/FALSE if we
clicked on link or does not click on link
respectively. But I am not getting where (x,y) co-ordinates comes into
picture to select particular link.

 I am really not able understand how exactly wekit find out URL from the
clicked region. Please somebody help me out guys..


Thanks,
Vivek

> Then I could not find out function definition of above  get() function
calls.

You give up to early. Hint: m_innerURLElement's type is RefPtr<Element>.
>
>
>
> --
> Ariya Hidayat
> http://www.linkedin.com/in/ariyahidayat
> _______________________________________________
> webkit-help mailing list
> webkit-help at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-help
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100204/68bfde05/attachment.html>


More information about the webkit-help mailing list