Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » ATF » Get coordinates for text, letters in rendered web page(Question about how to get coordinates or any related position for the textual structures (letter, word) inside the DOM element.)
icon5.gif  Get coordinates for text, letters in rendered web page [message #496671] Tue, 10 November 2009 21:09 Go to next message
ruslanrf  is currently offline ruslanrf Friend
Messages: 14
Registered: November 2009
Junior Member
Hello, Jacek!

Do you know is it possible to get information about rendered text inside DOM Node?
For example it can be word "Word" (some where in the text node) which in HTML represented as
<span ...>W</span>ord
Is it possible to get info about related position between "W" and "ord" to figure out that it is one word?
Re: Get coordinates for text, letters in rendered web page [message #498021 is a reply to message #496671] Fri, 13 November 2009 17:17 Go to previous messageGo to next message
ruslanrf  is currently offline ruslanrf Friend
Messages: 14
Registered: November 2009
Junior Member
Does anyone know, how to get a coordinates and bounding box for particular symbol in node?
Which interface of XPCOM should I use?
Re: Get coordinates for text, letters in rendered web page [message #498258 is a reply to message #498021] Mon, 16 November 2009 08:40 Go to previous messageGo to next message
Jacek Pospychala is currently offline Jacek PospychalaFriend
Messages: 159
Registered: July 2009
Senior Member
hi,
sorry for late response, I was offline for last 5 days. You can see how
ATF gets the DOM node bounding box in
org.eclipse.atf.mozilla.ide.ui.browser.SelectionBox.getEleme ntBounds(nsIDOMElement)

I'd try to get the parent node of text node, e.g. <span> for
"<span>W</span>ord". Next, get the information line wrapping, lines
height and chars width and calculate by hand.
You could also ask on the Mozilla newsgroup, as it doesn't really matter
whether you use XULRunner APIs over JavaXPCOM or from JavaScript/C++.
I find mozilla.dev.platform quite helpful.

ruslanrf wrote:
> Does anyone know, how to get a coordinates and bounding box for
> particular symbol in node?
> Which interface of XPCOM should I use?
Re: Get coordinates for text, letters in rendered web page [message #499331 is a reply to message #498258] Fri, 20 November 2009 20:48 Go to previous messageGo to next message
ruslanrf  is currently offline ruslanrf Friend
Messages: 14
Registered: November 2009
Junior Member
But how to learn width of particular character and how many lines?
I found only one solution to add additional tag for every word in DOM tree to get coordinates for every word, but I would not to change DOM tree and wanted to find another solution.
Re: Get coordinates for text, letters in rendered web page [message #499553 is a reply to message #499331] Mon, 23 November 2009 10:44 Go to previous message
Jacek Pospychala is currently offline Jacek PospychalaFriend
Messages: 159
Registered: July 2009
Senior Member
ruslanrf wrote:
> But how to learn width of particular character and how many lines?
> I found only one solution to add additional tag for every word in DOM
> tree to get coordinates for every word, but I would not to change DOM
> tree and wanted to find another solution.

it would be fun to have this in ATF. I asked on Mozilla group how to
achieve this. Link to follow:
http://groups.google.com/group/mozilla.dev.platform/browse_t hread/thread/7ed4d752a19c3cfa#
Re: Get coordinates for text, letters in rendered web page [message #562071 is a reply to message #496671] Fri, 13 November 2009 17:17 Go to previous message
ruslanrf  is currently offline ruslanrf Friend
Messages: 14
Registered: November 2009
Junior Member
Does anyone know, how to get a coordinates and bounding box for particular symbol in node?
Which interface of XPCOM should I use?
Re: Get coordinates for text, letters in rendered web page [message #562158 is a reply to message #562071] Mon, 16 November 2009 08:40 Go to previous message
Jacek Pospychala is currently offline Jacek PospychalaFriend
Messages: 159
Registered: July 2009
Senior Member
hi,
sorry for late response, I was offline for last 5 days. You can see how
ATF gets the DOM node bounding box in
org.eclipse.atf.mozilla.ide.ui.browser.SelectionBox.getEleme ntBounds(nsIDOMElement)

I'd try to get the parent node of text node, e.g. <span> for
"<span>W</span>ord". Next, get the information line wrapping, lines
height and chars width and calculate by hand.
You could also ask on the Mozilla newsgroup, as it doesn't really matter
whether you use XULRunner APIs over JavaXPCOM or from JavaScript/C++.
I find mozilla.dev.platform quite helpful.

ruslanrf wrote:
> Does anyone know, how to get a coordinates and bounding box for
> particular symbol in node?
> Which interface of XPCOM should I use?
Re: Get coordinates for text, letters in rendered web page [message #562302 is a reply to message #498258] Fri, 20 November 2009 20:48 Go to previous message
ruslanrf  is currently offline ruslanrf Friend
Messages: 14
Registered: November 2009
Junior Member
But how to learn width of particular character and how many lines?
I found only one solution to add additional tag for every word in DOM tree to get coordinates for every word, but I would not to change DOM tree and wanted to find another solution.
Re: Get coordinates for text, letters in rendered web page [message #562376 is a reply to message #562302] Mon, 23 November 2009 10:44 Go to previous message
Jacek Pospychala is currently offline Jacek PospychalaFriend
Messages: 159
Registered: July 2009
Senior Member
ruslanrf wrote:
> But how to learn width of particular character and how many lines?
> I found only one solution to add additional tag for every word in DOM
> tree to get coordinates for every word, but I would not to change DOM
> tree and wanted to find another solution.

it would be fun to have this in ATF. I asked on Mozilla group how to
achieve this. Link to follow:
http://groups.google.com/group/mozilla.dev.platform/browse_t hread/thread/7ed4d752a19c3cfa#
Previous Topic:Add and execute JavaScript code
Next Topic:atf 0.3.0 installation woes
Goto Forum:
  


Current Time: Thu Mar 28 09:20:30 GMT 2024

Powered by FUDForum. Page generated in 0.02532 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top