W3C home > Mailing lists > Public > www-style@w3.org > September 2012

[CSS21] Shrink-to-fit width algorithm and hyphen as a line break opportunity

From: Gérard Talbot <www-style@gtalbot.org>
Date: Thu, 20 Sep 2012 22:34:14 -0400
Message-ID: <1c6cc62fe5a5fcdf303a1e8ec1bcb091.squirrel@ed-sh-cp3.entirelydigital.com>
To: "Public W3C www-style mailing list" <www-style@w3.org>
Hello,


"
Calculation of the shrink-to-fit width is similar to calculating the width
of a table cell using the automatic table layout algorithm. Roughly:
calculate the preferred width by formatting the content without breaking
lines other than where explicit line breaks occur, and also calculate the
preferred minimum width, e.g., by trying all possible line breaks. CSS 2.1
does not define the exact algorithm. Thirdly, calculate the available
width: this is found by solving for 'width' after setting 'left' (in case
1) or 'right' (in case 3) to 0.

Then the shrink-to-fit width is: min(max(preferred minimum width,
available width), preferred width).
"
CSS2.1, section 10.3.7 Absolutely positioned, non-replaced elements
http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width

Q1: Shouldn't an hyphen inside a string normally represent a possible line
break opportunity?

Q2: Besides a blank space, what else should represent or be considered as
a normal line break opportunity?

Q3: "CSS 2.1 does not define the exact algorithm." I wonder why. Will CSS
3 provide an exact algorithm? This is more about my curiosity than a
formal question.


Test
----
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/shrink-to-fit-width-hyphenated-words.html


Test results
------------
  Konqueror 4.9.1 displays:
  abcde-fghi-jkl
  (computed width: 443px and computed height: 75px)

  Firefox 15.0.1 displays:
  abcde-
  fghi-jkl
  (computed width: 227px and computed height: 154px)

  IE10, Opera 12.02 and Chrome 21.0.1180.89 display:
  abcde-
  fghi-
  jkl
  (computed width: 216px and computed height: 225px-228px)


  IE8 and IE9 display:
  abcde
  -fghi-
  jkl
  which seems like a bug.


I think IE10, Opera 12.02 and Chrome 21.0.1180.89 are rendering the test
correctly. Am I wrong on this?

Gérard
-- 
CSS 2.1 Test suite RC6, March 23rd 2011
http://test.csswg.org/suites/css2.1/20110323/html4/toc.html

Contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/

Web authors' contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/web-authors-contributions-css21-testsuite.html
Received on Friday, 21 September 2012 02:34:38 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:00 GMT