Re: [webkit-help] Howto Calculate x, y points for GraphicsContext::drawFocusRing()

2010-02-12 Thread Vivek Satpute
Hi Ariya,

On Thu, Feb 11, 2010 at 11:19 PM, Ariya Hidayat ariya.hida...@gmail.comwrote:

  Actually, I want to increase active area of links, in such a way that
 event
  if I clicked below the link,
  (i.e. not exactly over the link) the nearer link should get selected and
  gets loaded. Right now, I have to click exactly over the link.

 I guess this is the reason you asked the endless hit test questions in
 the separate thread?

Yes, you are right.. :-)
Actually I was going step by step and trying to understand the things. But
then I
fell into a very confusing state that I could not even think on it. And
finally I posted
my objective. I would have to do this very early.. I wasted too much time.

 If only you would have told us your objective
 before...

 There are tons of ways to do that. Two I can think of:

 (1) Find all links in the page and calculate the distance to your
 click position. Pick the nearest one (or whatever algorithm you use).

 How to find all the links on a webpage ?

 (2) Probe in the vicinity of your click position for any presence of
 others links. An example I show in
 http://labs.trolltech.com/blogs/2009/06/06/qwebview-snap-scrolling/
 does the same, albeit for any type of elements instead of only links.

 Thanks for this but could you please point out me to the exact location
where you are
achieving this in snapping code ? And the snapping code seems to be use Qt
APIs, so
is it possible to implement my objective inside webkit code by modifying few
things in
hitTest or some other similar function ?

Regards,
Vivek



 Regards,

 --
 Ariya Hidayat
 http://www.linkedin.com/in/ariyahidayat
 ___
 webkit-help mailing list
 webkit-help@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-help

___
webkit-help mailing list
webkit-help@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help


Re: [webkit-help] Howto Calculate x, y points for GraphicsContext::drawFocusRing()

2010-02-11 Thread Ariya Hidayat
 Actually, I want to increase active area of links, in such a way that event
 if I clicked below the link,
 (i.e. not exactly over the link) the nearer link should get selected and
 gets loaded. Right now, I have to click exactly over the link.

I guess this is the reason you asked the endless hit test questions in
the separate thread? If only you would have told us your objective
before...

There are tons of ways to do that. Two I can think of:

(1) Find all links in the page and calculate the distance to your
click position. Pick the nearest one (or whatever algorithm you use).

(2) Probe in the vicinity of your click position for any presence of
others links. An example I show in
http://labs.trolltech.com/blogs/2009/06/06/qwebview-snap-scrolling/
does the same, albeit for any type of elements instead of only links.



Regards,

-- 
Ariya Hidayat
http://www.linkedin.com/in/ariyahidayat
___
webkit-help mailing list
webkit-help@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help


Re: [webkit-help] Howto Calculate x, y points for GraphicsContext::drawFocusRing()

2010-02-10 Thread zaheer ahmad
On Wed, Feb 10, 2010 at 5:44 PM, Vivek Satpute vivekonlin...@gmail.comwrote:

 Hi,

 I started GtkLauncher program and it has loaded a webpage which have many
 links to other webpages. If I click on any link, then webkit calls
 RenderInline::addFocusRingRects() function before calling
 GraphicsContext::drawFocusRing().

 If I am not making any mistake, RenderInline::addFocusRingRects() functions
 decides the
 (rect_x, rect_y, width, height) parameters to draw a dotted rectangle
 around the link.

 My question is, If I have link News on webpage. So, if I click on
 character i.e. N, e, w or s
 of link News, my clicked point (x, y) changes. That (x, y) I get in
 webkit_web_view_button_press_event()
 in variable *GdkEventButton* event*. Even if clicked location (x, y)
 changes, the (rect_x, rect_y) point
 of Rectangle (which is to be drawn over link) always remains same for same
 link News.

 So, how this is achieved in webkit? How webkit decides (rec_x, rect_y)
 co-ordinate of Rectangle (to be drawn
 around link) from clicked co-ordinated (x, y) in *GdkEventButton* event ?
 *

It is determined by hit test you can check this mail
http://marc.info/?l=webkit-devm=122202397417406 for details

 *

 *Actually, I want to increase active area of links, in such a way that
 event if I clicked below the link,
 (i.e. not exactly over the link) the nearer link should get selected and
 gets loaded. Right now, I have
 to click exactly over the link.

In this case there can be multiple choices since you are not looking for a
precise match and i think you would have to traverse all the nodes and get
that information based on their distance..something similar to tab
navigation - https://bugs.webkit.org/show_bug.cgi?id=18662 (pls correct me
if there is a better way)


 *
 *Thanks in advance,
 Vivek

 Thanks
Zaheer

 ___
 webkit-help mailing list
 webkit-help@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-help


___
webkit-help mailing list
webkit-help@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help


Re: [webkit-help] Howto Calculate x, y points for GraphicsContext::drawFocusRing()

2010-02-10 Thread Vivek Satpute
Hi Zaheer,

On Wed, Feb 10, 2010 at 10:38 AM, zaheer ahmad zaheer@gmail.com wrote:

 On Wed, Feb 10, 2010 at 5:44 PM, Vivek Satpute vivekonlin...@gmail.comwrote:

 Hi,

 I started GtkLauncher program and it has loaded a webpage which have many
 links to other webpages. If I click on any link, then webkit calls
 RenderInline::addFocusRingRects() function before calling
 GraphicsContext::drawFocusRing().

 If I am not making any mistake, RenderInline::addFocusRingRects()
 functions decides the
 (rect_x, rect_y, width, height) parameters to draw a dotted rectangle
 around the link.

 My question is, If I have link News on webpage. So, if I click on
 character i.e. N, e, w or s
 of link News, my clicked point (x, y) changes. That (x, y) I get in
 webkit_web_view_button_press_event()
 in variable *GdkEventButton* event*. Even if clicked location (x, y)
 changes, the (rect_x, rect_y) point
 of Rectangle (which is to be drawn over link) always remains same for same
 link News.

 So, how this is achieved in webkit? How webkit decides (rec_x, rect_y)
 co-ordinate of Rectangle (to be drawn
 around link) from clicked co-ordinated (x, y) in *GdkEventButton* event ?
 *

 It is determined by hit test you can check this mail
 http://marc.info/?l=webkit-devm=122202397417406 for details

 *

 *Actually, I want to increase active area of links, in such a way that
 event if I clicked below the link,
 (i.e. not exactly over the link) the nearer link should get selected and
 gets loaded. Right now, I have
 to click exactly over the link.

 In this case there can be multiple choices since you are not looking for a
 precise match and i think you would have to traverse all the nodes and get
 that information based on their distance..something similar to tab
 navigation - https://bugs.webkit.org/show_bug.cgi?id=18662 (pls correct me
 if there is a better way)

Could you please elaborate on this point ? I did not get you. How and which
nodes I should traverse ? and If I am not making any mistake, on single
click I will get only one link-node If its there, otherwise it will be
something other than links.

Thanks,
Vivek



 *
 *Thanks in advance,
 Vivek

 Thanks
 Zaheer

 ___
 webkit-help mailing list
 webkit-help@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-help



___
webkit-help mailing list
webkit-help@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help