Re: Clickable area for hyperlinks

On Thu, Jun 14, 2012 at 9:58 AM, Simon Sapin <simon.sapin@kozea.fr> wrote:
> Le 14/06/2012 18:34, Boris Zbarsky a écrit :
>> That will Just Work due to click events bubbling, no?  As in, the event
>> _target_  in this case will be the image, not the <a>.  But the event
>> will then bubble up to the <a>.
>
> In a browser yes, I guess. For producing PDFs in WeasyPrint I need to find a
> rectangle, though multiple rectangles would work too. (In PDF objects they
> would multiple links that happen to have the same target/href)

In that case, take a rectangle that's as wide as the <a> and as tall
as the <a>'s line-height, then add similar rectangles for the <a>'s
children.  If you can have an irregular shape, just union all of them;
if you need a single rectangle, take the bounding box (though
recognize that this might be bad in some degenerate circumstances).

The "actionable area" is just the element's own geometry, based on its
display type and the relevant properties.   That's well-defined by the
layout mode it's in.  As Boris says, event bubbling handles the case
when children extend outside of the <a>'s geometry.

~TJ

Received on Thursday, 14 June 2012 17:05:36 UTC