<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jun 8, 2013 at 9:28 PM, 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 Divendres, 7 de juny de 2013, a les 23:35:41, Jaydeep Solanki va escriure:<br>
<div class="im">> Will it be a good idea to look for something in QtWebkit source that can<br>
> get us bounding rects ?<br>
<br>
</div>Makes sense, there is *something* in there that can select text, so there is<br>
information of where the text is.<br>
<br></blockquote><div>Working on it. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Cheers,<br>
  Albert<br>
<div class="im"><br>
><br>
> Cheers,<br>
> Jaydeep<br>
><br>
> On Fri, Jun 7, 2013 at 3:41 AM, Jaydeep Solanki <<a href="mailto:jaydp17@gmail.com">jaydp17@gmail.com</a>> wrote:<br>
> > But it will give the bounding rect of the HTML element, not the text. We<br>
> > can use the box of the HTML element to predict the bounding box of text<br>
> > with the help of font metrics, but it will fail in situations with an<br>
> > image<br>
> > or a floating element between text.<br>
</div>> > Example: image <<a href="http://s11.postimg.org/5ysz1z79v/wrapp_all_arround.png" target="_blank">http://s11.postimg.org/5ysz1z79v/wrapp_all_arround.png</a>><br>
<div class="HOEnZb"><div class="h5">> ><br>
> > Cheers,<br>
> > Jaydeep<br>
> ><br>
> > On Fri, Jun 7, 2013 at 2:41 AM, Albert Astals Cid <<a href="mailto:aacid@kde.org">aacid@kde.org</a>> wrote:<br>
> >> El Dimarts, 4 de juny de 2013, a les 20:00:51, Jaydeep Solanki va<br>
> >><br>
> >> escriure:<br>
> >> > On Mon, Jun 3, 2013 at 2:43 AM, Albert Astals Cid <<a href="mailto:aacid@kde.org">aacid@kde.org</a>><br>
> >><br>
> >> wrote:<br>
> >> > > El Dilluns, 3 de juny de 2013, a les 01:52:04, Jaydeep Solanki va<br>
> >><br>
> >> escriure:<br>
> >> > > > Hi,<br>
> >> > > > While working on getting text bounds work I discovered that<br>
> >> > > > QWebFrame::hitTestContent(QPoint()) hits the outermost element,<br>
> >><br>
> >> inside<br>
> >><br>
> >> > > 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>
> >> > > Why are you using hitTestContent to get the data? Isn't there<br>
> >><br>
> >> something<br>
> >><br>
> >> > > better? What's your plan? call hitTestContent for all the points or?<br>
> >> ><br>
> >> > Yes, I agree traversing the DOM is a better idea.<br>
> >> ><br>
> >> > I googled a bit & found that we cannot get the bounding rect of text<br>
> >><br>
> >> from<br>
> >><br>
> >> > webkit<br>
> >> > (source<<a href="http://comments.gmane.org/gmane.os.opendarwin.webkit.qt/1130" target="_blank">http://comments.gmane.org/gmane.os.opendarwin.webkit.qt/1130</a>>),<br>
> >><br>
> >> but<br>
> >><br>
> >> > we can get the bounding box of the HTML element. I don't get it, why it<br>
> >> > isn't possible, because in QWebView when we select any text, it gets<br>
> >> > highlighted, which is basically filling color in the bounding box of<br>
> >> > the<br>
> >> > text, which indirectly means that Webview knows the bounding rects. Do<br>
> >> > I<br>
> >> > make sense ?<br>
> >> > Please comment on this.<br>
> >><br>
> >> What about the suggestion in that very same url of using qwebelement?<br>
> >><br>
> >> Cheers,<br>
> >><br>
> >>   Albert<br>
> >><br>
> >> > & if everything fails, QFontMetrics may be of some use. We can get the<br>
> >><br>
> >> font<br>
> >><br>
> >> > metrics, & using it + the bounding box of the HTML element, we can<br>
> >><br>
> >> predict<br>
> >><br>
> >> > the bounding rects.<br>
> >> ><br>
> >> > Cheers,<br>
> >> > Jaydeep<br>
> >> ><br>
> >> > > Cheers,<br>
> >> > ><br>
> >> > >   Albert<br>
> >> > ><br>
> >> > > > Analysing ht1 & ht2 turns out that both of them point to the<br>
> >> > > > section<br>
> >> > > > element, which seems to be a little problem. I'm searching for<br>
> >> > > > other<br>
> >> > > > ways<br>
> >> > > > to do it. If you have any idea to get it work, please share.<br>
> >> > > ><br>
> >> > > > Cheers,<br>
> >> > > > Jaydeep<br>
> >> > ><br>
> >> > > _______________________________________________<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>
> >><br>
> >> _______________________________________________<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>
_______________________________________________<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>
</div></div></blockquote></div><br></div></div>