Re: [csswg-drafts] [css-gcpm-3] string-set with counter(page), when is value resolved? (#4740)

The above changes to the definitions seem to match the behaviour of prince's "page" counter, without breaking any of our other tests. It's impossible to match the behaviour of Prince in one corrner, and everyone-but-Prince in the other corner, but  this comes a lot closer. 

Here's another example to test:
```html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <style>
  @page {
     margin: 36px;
     @top-center {
         content: string(b);
     }
  }
  body {
     string-set: b "Value=" counter(b) ", Page=" counter(page);
     counter-reset: b 1;
  }
  div {
      break-before: page;
      counter-increment: b;
  }
  </style>
 </head>
 <body>
  The top of this page is "Value=1, Page=1"
  <div id="div1">
   The top of this page is:
   <ul>
    <li>"Value=1, Page=1" if counters are copied to a string by value.</li>
    <li>"Value=2, Page=2" if counters are copied to a string by reference.</li>
    <li>"Value=1, Page=2" if the page counter is copied by reference and others by value</li>
   </ul>
  </div>
 </body>
</html>
```
Prince currently gives "Value=1, Page=2", because "page" counters are magic in Prince. I expect all other renderers will give "Value=1, Page=1". With this proposed change, the output would be "Value=2, Page=2".

The difference will be the case where a string is set to a counter, then the counter is changed but the string is left unchanged, and finally the string is displayed in the margin. I cannot imagine a situation where this behaviour (an unchanging string in the margins, while the counter it depends upon is changing) would be required.

Another option is to add a parameter to `string-set` which determines whether a counter is copied to the string by value or by reference. But I think that's unnecessarily complicated.

-- 
GitHub Notification of comment by faceless2
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4740#issuecomment-633277094 using your GitHub account

Received on Sunday, 24 May 2020 18:54:52 UTC