[webkit-qt] Bounding box for text

Benjamin Poulain benjamin.poulain at nokia.com
Fri Jan 14 15:12:33 PST 2011


On 01/14/2011 10:49 PM, ext Tarandeep Singh wrote:
> I am trying to get the bounding box for the text shown on html page.
> I used the QWebFrame to iterate over the dom tree and used QWebElement's
> geometry element to get the bounding box of the html tags, however using
> this technique I can't get bounding box of the text as text are not html
> tags.
>
> Can anyone please tell me how to get the bounding box of the text or how
> to accurately calculate it from the bounding box of the parent tag and
> sibling tags. Any reference to code in qt/webkit would be very useful.

It is impossible. I mentioned that before, you can look for the 
explanation in the logs of this list.

In short, the geometry of the text cannot be expressed by the DOM. 
Imagine a huge pile of text with a floating element inside (image in 
text for example).

The DOM gives you a single element for a text. This element can be 
splitted inside the engine for the layout.

cheers,
Benjamin


More information about the webkit-qt mailing list