W3C home > Mailing lists > Public > www-svg@w3.org > December 2011

Re: Text metrics with display:none

From: Jeremie Patonnier <jeremie.patonnier@gmail.com>
Date: Sun, 11 Dec 2011 22:29:41 +0100
Message-ID: <CAEi838nuVzf88bSov99EZsTUgNCr=wsObRggkN0fT7X525nuAg@mail.gmail.com>
To: David Dailey <ddailey@zoominternet.net>
Cc: Cameron McCormack <cam@mcc.id.au>, Brian Birtles <bbirtles@mozilla.com>, www-svg <www-svg@w3.org>
2011/12/11 David Dailey <ddailey@zoominternet.net>

> so when I start finding parts of the spec that tell me I cannot measure
> things unless they are visible, it makes me nervous.
>

There is no reason to be worried. HTML has the same issue, that's why CSS
makes a big difference between display:none and visibility:hidden

display:none remove the elements completely and they have no effect on the
layout (therefor, it make sens to not count characters that are not
displayed that way)

The CSS spec is quite clear, display:none is a very strong way to hide an
element : http://www.w3.org/TR/CSS21/visuren.html#display-prop

On the other hand, visiblity:hidden just hide an element but this element
still affect the layout, it's just not shown by itself. So in this case, it
make sens to be able to count any character that is hidden this way. See
http://www.w3.org/TR/CSS21/visufx.html#visibility

Web designers are used to the diffrence between those to properties and it
is really easy to use those two property to "hide and count" precisely what
is expected :

   - display to count every thing that is visible but avoid everything
   which is invisible
   - visibility to count everything, including hidden objects

And if they must count characters without having them influencing the
layout... well... HTML authors are often used to mix visibility:hidden with
overflow:hidden and width:0px and height:0px (I guess it should be possible
to do something similar with SVG)

In a more general way, I think there is something missing with all web
technologies : A way to predict how a DOM tree will affect a layout before
it affect it. I know this is not trivial at all to implement such a feature
(especially with HTML where everything is relatively positioned... but with
SVG, it could be easier) but I will love to have such a tool to control my
layout ♡

Regards
-- 
Jeremie
.............................
Web : http://jeremie.patonnier.net
Twitter : @JeremiePat <http://twitter.com/JeremiePat>
Received on Monday, 12 December 2011 00:30:47 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:50 GMT