Add support for the ::color-swatch pseudo-element#212
Conversation
Loirooriol
left a comment
There was a problem hiding this comment.
Looks good with nits
2afb8da to
c179f93
Compare
|
This comment seems wrong now: Line 673 in ece4971 |
|
Fwiw we may end up in a situation where these new pseudo elements only match (for author styles at least) when the element is in specific appearance modes. Such as |
Signed-off-by: stevennovaryo <[email protected]>
c179f93 to
14f9974
Compare
Thanks for the catch! It is definitely wrong with the new changes. |
Thanks for the heads up! With the development of Servo, these will definitely be necessary in the near future. Possibly extending the structs in the future. |
…-swatch` (#37427) Implement internal pseudo element, which would be resolved as a "Implemented Pseudo Element" within style computation. This is an concrete element that would has a primary style after the style computation, but could match and style resolved like an pseudo element. Therefore, it would have a different behavior compared to how does `pseudo`s that `ServoLayoutNode` had. Where they would not have a concrete element behind it. Note that, due to the nature of these pseudo elements residing inside a UA widget, these pseudo elements would therefore not be accessible in JavaScript by default. This kind of element is required in order to implement the [form control pseudo element](https://drafts.csswg.org/css-forms-1/#pseudo-elements) like `::placeholder`, `::color-swatch`, `::field-text`, etc. See [this docs](https://hackmd.io/@ChaKweTiau/BJ3zRdLQlg) for more details of the implementation. Then, the implemented pseudo element is utilized to implement style matching for input `type=text`. Servo's side of: servo/stylo#212 Testing: No WPT regression. --------- Signed-off-by: stevennovaryo <[email protected]>
Define
::color-swatchpseudo element https://drafts.csswg.org/css-forms-1/#color-swatch-pseudo. It represents the element that display the chosen color value of Inputtype=color. Particularly,::color-swatchis a pseudo element with a concrete DOM element behind it, and it is defined as lazy pseudo element.The pseudo element would be public because of no additional requirement specified (e.g. property restriction) and the element is defined in Servo.
Stylo's companion of servo/servo#37427
This is a reopened PR of #208 due to the new upstream.