Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate markers for list items #1232

Closed
larsbergstrom opened this issue Nov 13, 2013 · 6 comments
Closed

Generate markers for list items #1232

larsbergstrom opened this issue Nov 13, 2013 · 6 comments

Comments

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Nov 13, 2013

We have code that will generate them as blocks, but we need to generate the markers per the spec:
http://www.w3.org/TR/CSS21/generate.html#lists

There is also a css-display draft spec that has a clearer explanation. Per @SimonSapin, we should not expose the CSS properties but should use this draft as ideas for the implementation:
http://dev.w3.org/csswg/css-counter-styles/

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Nov 13, 2013

css-counter-style is relatively stable, so there is no problem implementing it. What I meant is that the functionality for custom @counter-style rules may not be urgent to add. But even if we don’t want to bother with Level 3 functionality, it’s better to use the new spec’s algorithm to implement Level 2’s functionality. (That said, once we have that, @counter-style is not that hard.)

Also, for layout, it may be worth not having any custom code but implement the list marker with a ::marker pseudo-element as in http://dev.w3.org/csswg/css-lists/ , that is inline for list-style-position: inside and abspos for outside.

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Jan 8, 2014

@aydinkim I saw on IRC that you were looking into this. I’ll expand a bit on the above:

I recommend only implementing the CSS 2.1-level set of features for now, but doing so using the Level 3 specifications which give much more detailed and precise algorithms. In CSS terms:

  • counter-reset
  • counter-increment
  • list-style-type
  • list-style-image
  • list-style-position
  • list-style

There are three fairly separate tasks.

  • Add CSS counters.

  • CSS Counter Styles Level 3 describes how to turn the integer value of a counter into a string representation using various styles. Don’t bother (yet) with custom styles, just use the algorithms there to implement the 10 2.1-level values of list-style-type (e.g. what to do in lower-latin after z?)

  • Finally, generate a marker pseudo-element on list items based on the list-style-* proprties, as described in the rest of CSS Lists Level 3 (We don’t need to support ::marker in CSS syntax yet.)

    A fist approximation of list-style-position: outside could be to give the marker this style:

    position: absolute;
    right: 100%;  /* Have the right edge of the marker flush with the left edge of the list item */
    margin-right: 0.5em; /* Maybe? */

    … and have the list item be the marker’s containing block (instead of the nearest positioned ancestor)

    Note the absence of top or bottom. The vertical position is given by the static position, as for normal elements with position: absolute.

    This blocks lists on absolute positioning, but Acid2 needs absolute positioning anyway. (Does it need the lists?)

Once you have all that, the <ul>, <ol> and <li> elements don’t need any Rust code and are implemented in the user-agent CSS stylesheet.

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Jan 9, 2014

@recrack Sorry I missed your IRC message. I don’t see a problem with modifying the user-agent stylesheet. Please send a pull request with what you want to be reviewed specifically.

@metajack
Copy link
Contributor

@metajack metajack commented Jan 17, 2014

This is needed for #1366.

mentor: @larsbergstrom

@aydinkim, @recrack, and @karim76 are working on this.

@aydinkim
Copy link

@aydinkim aydinkim commented Jan 17, 2014

@mbrubeck
Copy link
Contributor

@mbrubeck mbrubeck commented May 20, 2016

Basic support was implemented in #5067. More specific issues can be filed for any remaining features.

@mbrubeck mbrubeck closed this May 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.