Re: [CSS21][CSS3 Text] Re: Treating carriage return as white space in layout

On 08/03/2010 06:51 AM, Henri Sivonen wrote:
 > On Aug 2, 2010, at 23:23, fantasai wrote:
 >
 >> "treated as whitespace" is vague. Different kinds of whitespace are treated
 >> differently.
 >
 > My exact requirements are vague. I know that I need CR to behave in a
 > whitespace-ish way, but I'm not confident about the details.
 >  ...
 >>> For white-space-collapse: preserve-breaks;, I'm not totally confident what's
 >>> best, but I've been persuaded that Opera 10.60's behavior (CR is a break but
 >>> it coalesces with LF when appearing in a CRLF pair) is the thing I should
 >>> be wanting.
 >>
 >> So you want CRLF normalization to happen at the CSS level in addition to the
 >> source markup level for text appearing in the DOM,
 >
 > Yes.
 >
 >> but not for text in generated content?
 >
 > I didn't intend to express an opinion about generated content. I don't know
 > how exactly code reuse works in implementation between DOM-appearing content
 > and generated content, but I don't want to introduce any difficulties in
 > that area.

Below is proposed text for treating CR as a line breaking character
in the white space processing rules. This is Take II.

Part I: Add newline normalization to CSS rules.

   In this paragraph:

     # Newlines in the source can be represented by a carriage
     # return (U+000D), a linefeed (U+000A) or both (U+000D U+000A),
     # or by some other mechanism that identifies the beginning
     # and end of document segments, such as the SGML RECORD-START
     # and RECORD-END tokens. The CSS 'white-space' processing
     # model assumes all newlines have been normalized to line feeds.

   Append to the last sentence

     | UAs that recognize other newline representations must apply
     | the white space processing rules as if this normalization
     | has taken place. If no newline rules are specified for the
     | document language, each carriage return (U+000D) and CRLF
     | sequence (U+000D U+000A) in the document text is treated as
     | single line feed character.

   In the white space processing rules step 1:
     # Each tab (U+0009), carriage return (U+000D), or space (U+0020)
     # character surrounding a linefeed (U+000A) character is removed
     # if 'white-space' is set to 'normal', 'nowrap', or 'pre-line'.
   remove the mention of carriage returns.

Part II: Specify handling of carriage returns in generated content.

   Append to the new paragraph text above:

   Option A: "Generated content is not affected by newline normalization."
   Option B: "This default normalization rule also applies to generated content."
   Option C: "The generalization of newlines in generated content is undefined."

   (Option C seems rather silly. I put it there for completeness.)

~fantasai

Received on Wednesday, 15 September 2010 07:59:13 UTC