<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 3, 2013 at 2:43 AM, Albert Astals Cid <span dir="ltr"><<a href="mailto:aacid@kde.org" target="_blank">aacid@kde.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">El Dilluns, 3 de juny de 2013, a les 01:52:04, Jaydeep Solanki va escriure:<br>
<div class="im">> Hi,<br>
> While working on getting text bounds work I discovered that<br>
> QWebFrame::hitTestContent(QPoint()) hits the outermost element, inside body.<br>
><br>
> Consider the below HTML,<br>
><br>
> <section><br>
> <p id="p1">some text...</p><br>
> <div>...</div><br>
> <p id="p2">some other text..</p><br>
> </section><br>
><br>
> Now we have two QPoints;<br>
> QPoint pt1 => which points somewhere within p1<br>
> QPoint pt2 => which points somewhere within p2<br>
><br>
> var ht1 = QWebFrame::hitTestContent(pt1);<br>
> var ht2 = QWebFrame::hitTestContent(pt2);<br>
<br>
</div>Why are you using hitTestContent to get the data? Isn't there something<br>
better? What's your plan? call hitTestContent for all the points or?<br></blockquote><div>Yes, I agree traversing the DOM is a better idea.<br><br></div><div>I googled a bit & found that we cannot get the bounding rect of text from webkit (<a href="http://comments.gmane.org/gmane.os.opendarwin.webkit.qt/1130">source</a>), but we can get the bounding box of the HTML element. I don't get it, why it isn't possible, because in QWebView when we select any text, it gets highlighted, which is basically filling color in the bounding box of the text, which indirectly means that Webview knows the bounding rects.<br>
</div><div>Do I make sense ?<br></div><div>Please comment on this.<br><br></div><div>& if everything fails, QFontMetrics may be of some use. We can get the font metrics, & using it + the bounding box of the HTML element, we can predict the bounding rects.<br>
<br></div><div>Cheers,<br></div><div>Jaydeep<br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
  Albert<br>
<div class="im"><br>
><br>
> Analysing ht1 & ht2 turns out that both of them point to the section<br>
> element, which seems to be a little problem. I'm searching for other ways<br>
> to do it. If you have any idea to get it work, please share.<br>
><br>
> Cheers,<br>
> Jaydeep<br>
</div>_______________________________________________<br>
Okular-devel mailing list<br>
<a href="mailto:Okular-devel@kde.org">Okular-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/okular-devel" target="_blank">https://mail.kde.org/mailman/listinfo/okular-devel</a><br>
</blockquote></div><br></div></div>