Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 07aea488888970b456e3b225643c4c99da2b3648
      
https://github.com/WebKit/WebKit/commit/07aea488888970b456e3b225643c4c99da2b3648
  Author: Oriol Brufau <[email protected]>
  Date:   2022-11-09 (Wed, 09 Nov 2022)

  Changed paths:
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/process-css-properties.py

  Log Message:
  -----------
  Automatically get shorthands in StyleProperties::asTextInternal()
https://bugs.webkit.org/show_bug.cgi?id=247688

Reviewed by Darin Adler.

StyleProperties::asTextInternal() tries to serialize declarations using
shorthands when possible. The list of shorthand candidates for each
longhand was written manually. This was a big and fragile bunch of code
that was missing various shorthands; other shorthands were only mapped
to some of their longhands but not others, causing bugs.

This patch takes advantage of matchingShorthandsForLonghand() to find
the list of shorthand candidates automatically. Note that the returned
vectors now use a different order, as described in CSSOM. I think this
shouldn't affect the previous callers of matchingShorthandsForLonghand().

To avoid the risk of breaking something, the shorthands that were not
previously used are now explicitly excluded. So this should just be a
refactoring without side-effects, hence no tests.

The change will make it simpler to fix existing bugs in follow-ups.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::shouldAvoidShorthandForLonghand):
Avoid some shorthands to preserve existing behavior.

(WebCore::StyleProperties::asTextInternal const):
The refactoring happens here.

* Source/WebCore/css/process-css-properties.py:
(GenerationContext):
Reorder vectors returned by matchingShorthandsForLonghand().

Canonical link: https://commits.webkit.org/256511@main


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to