[webkit-dev] how do i know that i'm clicking on a flash movie?

Shi Yan billconan at gmail.com
Tue Jun 23 13:24:04 PDT 2009


hello guys,

i'm trying to implement a feature with the Qt webkit such that when
the user clicks on a web page, i can know the corresponding html tag
that he/she is clicking. for example, if the user clicks an image, i
should be able to get <img> tag and also the src attribute.

i modified the hitTestContent function in this way:

QWebHitTestResult QWebFrame::hitTestContent(const QPoint &pos) const
{
    if (!d->frame->view() || !d->frame->contentRenderer())
        return QWebHitTestResult();

    HitTestResult result =
d->frame->eventHandler()->hitTestResultAtPoint(d->frame->view()->windowToContents(pos),
/*allowShadowContent*/ false);

	printf("Inner Node Type:%d;\n",result.innerNode()->nodeType());

	std::cout<<"node value:"<<(result.innerNode()->nodeValue().operator
QString()).toStdString()<<std::endl;

	if(result.innerNode()->nodeType()==Node::ELEMENT_NODE)
	{
		Element* oldElement = static_cast<Element*>(result.innerNode());
		std::cout<<(oldElement->tagName().operator
QString()).toStdString()<<std::endl;
	}
	else if(result.innerNode()->nodeType()==Node::TEXT_NODE)
	{
		printf("text node!\n");
	}
    return QWebHitTestResult(new QWebHitTestResultPrivate(result));
}


this code works for text nodes and element nodes. but when i click on
a piece of flash movie, such as a youtube movie, the hitTestContent
isn't called. i don't know can i get the flash information by
clicking. thanks.


More information about the webkit-dev mailing list