[Webkit-unassigned] [Bug 238888] New: [css-cascade] makeprop.pl could sort shorthands properties at the end, and ignore them during the cascade

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 6 13:55:01 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=238888

            Bug ID: 238888
           Summary: [css-cascade] makeprop.pl could sort shorthands
                    properties at the end, and ignore them during the
                    cascade
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: obrufau at igalia.com

In bug 238345 I plan to sort deferred properties after normal properties, since they cascade in a special way.
Something similar could be done for shorthands.

StyleBuilder.cpp does something like

    applyProperties(firstCSSProperty, lastHighPriorityProperty);
    applyProperties(firstLowPriorityProperty, lastCSSProperty);

    inline void Builder::applyPropertiesImpl(int firstProperty, int lastProperty)
    {
        for (int id = firstProperty; id <= lastProperty; ++id) {
            CSSPropertyID propertyID = static_cast<CSSPropertyID>(id);
            if (!m_cascade.hasProperty(propertyID))
                continue;

Currently, shorthand properties are mixed among longhands, so they are iterated, but hasProperty() will be false.
Then they are wasting some memory in PropertyCascade.h:

    Property m_properties[numCSSProperties + 2];
    std::bitset<numCSSProperties + 2> m_propertyIsPresent;

So I think CSSPropertyID could be sorted as such:

 1. Special meaning (CSSPropertyInvalid and CSSPropertyCustom)
 2. High priority longhands
 3. Low priority longhands
 4. Deferred longhands
 5. Shorthands

About a 15-20% of the properties seem to be shorthands, so it may be worth trying.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220406/fa68717b/attachment-0001.htm>


More information about the webkit-unassigned mailing list