W3C home > Mailing lists > Public > www-style@w3.org > March 2015

Re: [css-writing-modes][CSS21] propagation of 'direction' from <body>

From: Simon Pieters <simonp@opera.com>
Date: Thu, 12 Mar 2015 15:33:54 +0100
To: www-style@w3.org, "Greg Whitworth" <gwhit@microsoft.com>, fantasai <fantasai.lists@inkedblade.net>
Message-ID: <op.xvd2qsztidj3kv@simons-mbp>
On Thu, 19 Feb 2015 19:12:03 +0100, fantasai  
<fantasai.lists@inkedblade.net> wrote:

> On 02/18/2015 06:29 AM, Simon Pieters wrote:
>>
>>>    a) Propagating at the HTML layer removes all of the CSS  
>>> complexities,
>>>       making it easier to fix all the bugs and keep them fixed. Only  
>>> one
>>>       lookup needs to happen.
>>
>> Maybe it introduces other bugs instead?
>
> It's a much simpler operation, so while it might introduce other
> bugs, it has less potential for bugginess now and in the future.
> For example, besides the things tested (overflow, scrolling)
> printing is also affected by the root writing mode. It affects
> the direction of pagination, it affects which page is printed
> first (:left or :right), it affects whether :left is equivalent
> to :recto or :verso, etc. It also affects the cascade: whether
> margin-left maps to margin-start depends on the writing mode.
>
> Basically there are many, many interactions in CSS that would
> have to be special-cased, whereas at the HTML layer, it's merely
> a weird exception that <html> copies its 'dir' value from <body>.

Yeah it would be more isolated.

>>>    b) Content that misplaces dir=rtl is handled, and improved because  
>>> now
>>>       the <head> is also RTL.
>>
>> This is not relevant outside test cases.
>
> It affects <title> and its presentation. (Or should.)
>
>>> Wrt compat concerns of only handling dir=rtl and not 'direction: rtl':
>>>
>>>    Greg Whitworth found on a database of 1.3 million pages only 0.03%  
>>> use
>>>    'direction: rtl' at all. The number setting that on <body> is a  
>>> subset
>>>    of all that, and the number setting it on <body> and not <html> and
>>>    relying on that making the root behave as RTL is a subset of *that*.
>>
>> Did that database include external stylesheets?
>
> I don't know.
>
>> In httparchive I get a different figure. Looking for pages that set  
>> direction: rtl or writing-mode: vertical-* on <body>,
>> either in style="", or in a stylesheet:
>>
>> SELECT page, COUNT(*) as num
>> FROM [httparchive:runs.2014_08_15_requests_body]
>> WHERE REGEXP_MATCH(LOWER(body),  
>> r'<body\s[^>]*style\s*=\s*["\'][^"\']*(direction\s*:\s*rtl|writing-mode\s*:\s*vertical)')
>> OR REGEXP_MATCH(LOWER(body),  
>> r'body\s*\{[^}]*(direction\s*:\s*rtl|writing-mode\s*:\s*vertical-)')
>> GROUP BY page
>> ORDER BY num desc;
>>
>> 4222 pages out of 130k pages; ~3.25%. This is much higher than <body  
>> dir=rtl> (~0.25%). (The sets might be overlapping, but
>> even if they overlap perfectly it still leaves ~3.00% with only  
>> direction/writing-mode.)
>
> What are the stats for just 'direction'?

Same: 4222 pages.

direction:rtl anywhere, 83,121 pages (~63.94%). This is *way* higher than  
I expected.

SELECT page, COUNT(*) as num
 FROM [httparchive:runs.2014_08_15_requests_body]
WHERE REGEXP_MATCH(LOWER(body), r'direction\s*:\s*rtl')
GROUP BY page
ORDER BY num desc;


dir="rtl" anywhere, 10,120 pages (~7.78%).

SELECT page, COUNT(*) as num
 FROM [httparchive:runs.2014_08_15_requests_body]
WHERE REGEXP_MATCH(LOWER(body), r'\sdir\s*=\s*["\']?rtl')
GROUP BY page
ORDER BY num desc;


Chrome use counter for 'direction' is at ~38% of page views.
https://www.chromestatus.com/metrics/css/timeline/popularity/3

'writing-mode' is ~0.3% of page views.
https://www.chromestatus.com/metrics/css/timeline/popularity/394


I'm not sure what to make of this. I suppose the httparchive dataset has a  
different bias than the data Greg uses. I can see a few options for next  
steps if we want to move this to HTML:

* Someone implements new use-counters/telemetry/etc to gauge the impact.
* Someone tries to implement and ship dir special-casing in HTML and see  
what breaks.

That said, "doing it in HTML" could mean different things. Is it  
implemented in the HTML parser? Or as part of HTML's rendering rules?

-- 
Simon Pieters
Opera Software
Received on Thursday, 12 March 2015 14:34:25 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:30 UTC