| Differences between
and this patch
- a/Source/WebCore/ChangeLog +58 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2022-03-24  Oriol Brufau  <obrufau@igalia.com>
2
3
        [css] Turn -webkit-text-orientation into a legacy shorthand
4
        https://bugs.webkit.org/show_bug.cgi?id=238356
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        `-webkit-text-orientation` and `text-orientation` were both implemented
9
        as longhands, just with a `related-property` flag so that declaration
10
        blocks with both of them would use the one appearing last.
11
12
        However, the logic for `related-property` wasn't always working well.
13
        In bug 238350 I plan to merge it with shouldApplyPropertyInParseOrder(),
14
        which has the same purpose and works better. But it's not suitable for
15
        high priority properties like `text-orientation`.
16
17
        So this patch turns `-webkit-text-orientation` into a shorthand that
18
        expands into `text-orientation`.
19
20
        `-webkit-text-orientation` continues accepting the legacy value
21
        `sideways-right`, which is now mapped into `sideways` at parse time.
22
        Previously this happened at computed-value time, but it implied that
23
        serializing `text-decoration` could yield an invalid value.
24
25
        * css/CSSPrimitiveValueMappings.h:
26
        (WebCore::CSSPrimitiveValue::operator TextOrientation const):
27
        Remove mapping of `sideways-right` into `sideways`, this is now
28
        done at parse time. Also remove mapping of `vertical-right` into `mixed`
29
        since `vertical-right` is a remnant of the past which has not been
30
        considered valid syntax for years.
31
32
        * css/CSSProperties.json:
33
        Turn `-webkit-text-orientation` into a shorthand of `text-orientation`.
34
        Remove their `related-property` flags and a remnant of `vertical-right`.
35
36
        * css/StyleProperties.cpp:
37
        (WebCore::StyleProperties::getPropertyValue const):
38
        Add code for serializing the `-webkit-text-orientation` shorthand.
39
40
        * css/parser/CSSParserFastPaths.cpp:
41
        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
42
        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
43
        Remove `-webkit-text-orientation` from code which is only relevant for
44
        longhands.
45
46
        * css/parser/CSSPropertyParser.cpp:
47
        (WebCore::CSSPropertyParser::consumeLegacyTextOrientation):
48
        (WebCore::CSSPropertyParser::parseShorthand):
49
        Add parsing logic for `-webkit-text-orientation` as a shorthand.
50
51
        * css/parser/CSSPropertyParser.h:
52
        Add parsing logic for `-webkit-text-orientation` as a shorthand.
53
54
        * style/StyleBuilderCustom.h:
55
        (WebCore::Style::BuilderCustom::applyValueWebkitTextOrientation): Deleted.
56
        Remove `-webkit-text-orientation` from code which is only relevant for
57
        longhands.
58
1
2022-03-23  Youenn Fablet  <youenn@apple.com>
59
2022-03-23  Youenn Fablet  <youenn@apple.com>
2
60
3
        VideoFrame does not need to inherit from MediaSample
61
        VideoFrame does not need to inherit from MediaSample
- a/Source/WebCore/css/CSSPrimitiveValueMappings.h -4 lines
Lines 3304-3313 template<> inline CSSPrimitiveValue::operator TextOrientation() const a/Source/WebCore/css/CSSPrimitiveValueMappings.h_sec1
3304
    switch (m_value.valueID) {
3304
    switch (m_value.valueID) {
3305
    case CSSValueSideways:
3305
    case CSSValueSideways:
3306
        return TextOrientation::Sideways;
3306
        return TextOrientation::Sideways;
3307
    case CSSValueSidewaysRight:
3308
        return TextOrientation::Sideways;
3309
    case CSSValueVerticalRight:
3310
        return TextOrientation::Mixed;
3311
    case CSSValueMixed:
3307
    case CSSValueMixed:
3312
        return TextOrientation::Mixed;
3308
        return TextOrientation::Mixed;
3313
    case CSSValueUpright:
3309
    case CSSValueUpright:
- a/Source/WebCore/css/CSSProperties.json -10 / +4 lines
Lines 142-149 a/Source/WebCore/css/CSSProperties.json_sec1
142
        "in CSS cascading order.",
142
        "in CSS cascading order.",
143
        "",
143
        "",
144
        "* related-property:",
144
        "* related-property:",
145
        "Indicates the prefixed or unprefixed version of the same property,",
145
        "Indicates the prefixed or unprefixed version of the same property.",
146
        "e.g. -webkit-text-orientation has a related property text-orientation",
147
        "When parsing high priority CSS properties with both prefixed and unprefixed",
146
        "When parsing high priority CSS properties with both prefixed and unprefixed",
148
        "versions, this flig will help the parser to mark all related properties ",
147
        "versions, this flig will help the parser to mark all related properties ",
149
        "as seen when one is seen. This could enforce the 'last-one-wins' rule.",
148
        "as seen when one is seen. This could enforce the 'last-one-wins' rule.",
Lines 690-696 a/Source/WebCore/css/CSSProperties.json_sec2
690
            ],
689
            ],
691
            "codegen-properties": {
690
            "codegen-properties": {
692
                "custom": "Value",
691
                "custom": "Value",
693
                "related-property": "-webkit-text-orientation",
694
                "high-priority": true
692
                "high-priority": true
695
            },
693
            },
696
            "specification": {
694
            "specification": {
Lines 706-715 a/Source/WebCore/css/CSSProperties.json_sec3
706
                    "value": "sideways-right",
704
                    "value": "sideways-right",
707
                    "status": "deprecated"
705
                    "status": "deprecated"
708
                },
706
                },
709
                {
710
                    "value": "vertical-right",
711
                    "status": "non-standard"
712
                },
713
                "mixed",
707
                "mixed",
714
                "upright"
708
                "upright"
715
            ],
709
            ],
Lines 717-725 a/Source/WebCore/css/CSSProperties.json_sec4
717
                "aliases": [
711
                "aliases": [
718
                    "-epub-text-orientation"
712
                    "-epub-text-orientation"
719
                ],
713
                ],
720
                "related-property": "text-orientation",
714
                "longhands": [
721
                "custom": "Value",
715
                    "text-orientation"
722
                "high-priority": true
716
                ]
723
            },
717
            },
724
            "specification": {
718
            "specification": {
725
                "category": "css-writing-modes",
719
                "category": "css-writing-modes",
- a/Source/WebCore/css/StyleProperties.cpp +2 lines
Lines 349-354 String StyleProperties::getPropertyValue(CSSPropertyID propertyID) const a/Source/WebCore/css/StyleProperties.cpp_sec1
349
        return get2Values(scrollPaddingBlockShorthand());
349
        return get2Values(scrollPaddingBlockShorthand());
350
    case CSSPropertyScrollPaddingInline:
350
    case CSSPropertyScrollPaddingInline:
351
        return get2Values(scrollPaddingInlineShorthand());
351
        return get2Values(scrollPaddingInlineShorthand());
352
    case CSSPropertyWebkitTextOrientation:
353
        return getPropertyValue(CSSPropertyTextOrientation);
352
    default:
354
    default:
353
        return String();
355
        return String();
354
    }
356
    }
- a/Source/WebCore/css/parser/CSSParserFastPaths.cpp -3 / +1 lines
Lines 735-743 bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId a/Source/WebCore/css/parser/CSSParserFastPaths.cpp_sec1
735
        // auto | none | inter-word | distribute
735
        // auto | none | inter-word | distribute
736
        return valueID == CSSValueInterWord || valueID == CSSValueDistribute || valueID == CSSValueAuto || valueID == CSSValueNone;
736
        return valueID == CSSValueInterWord || valueID == CSSValueDistribute || valueID == CSSValueAuto || valueID == CSSValueNone;
737
#endif
737
#endif
738
    case CSSPropertyWebkitTextOrientation: // mixed | upright | sideways | sideways-right
739
        return valueID == CSSValueMixed || valueID == CSSValueUpright || valueID == CSSValueSideways || valueID == CSSValueSidewaysRight;
740
    case CSSPropertyTextOrientation:
738
    case CSSPropertyTextOrientation:
739
        // mixed | upright | sideways
741
        return valueID == CSSValueMixed || valueID == CSSValueUpright || valueID == CSSValueSideways;
740
        return valueID == CSSValueMixed || valueID == CSSValueUpright || valueID == CSSValueSideways;
742
    case CSSPropertyTextOverflow: // clip | ellipsis
741
    case CSSPropertyTextOverflow: // clip | ellipsis
743
        return valueID == CSSValueClip || valueID == CSSValueEllipsis;
742
        return valueID == CSSValueClip || valueID == CSSValueEllipsis;
Lines 989-995 bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId) a/Source/WebCore/css/parser/CSSParserFastPaths.cpp_sec2
989
    case CSSPropertyWebkitTextCombine:
988
    case CSSPropertyWebkitTextCombine:
990
    case CSSPropertyTextCombineUpright:
989
    case CSSPropertyTextCombineUpright:
991
    case CSSPropertyTextDecorationStyle:
990
    case CSSPropertyTextDecorationStyle:
992
    case CSSPropertyWebkitTextOrientation:
993
    case CSSPropertyWebkitTextSecurity:
991
    case CSSPropertyWebkitTextSecurity:
994
    case CSSPropertyWebkitTextZoom:
992
    case CSSPropertyWebkitTextZoom:
995
    case CSSPropertyWebkitTransformStyle:
993
    case CSSPropertyWebkitTransformStyle:
- a/Source/WebCore/css/parser/CSSPropertyParser.cpp +21 lines
Lines 5642-5647 bool CSSPropertyParser::consumeLegacyBreakProperty(CSSPropertyID property, bool a/Source/WebCore/css/parser/CSSPropertyParser.cpp_sec1
5642
    return true;
5642
    return true;
5643
}
5643
}
5644
5644
5645
bool CSSPropertyParser::consumeLegacyTextOrientation(bool important)
5646
{
5647
    // -webkit-text-orientation is a legacy shorthand for text-orientation.
5648
    // The only difference is that it accepts 'sideways-right', which is mapped into 'sideways'.
5649
    RefPtr<CSSPrimitiveValue> keyword;
5650
    auto valueID = m_range.peek().id();
5651
    if (valueID == CSSValueSidewaysRight) {
5652
        keyword = CSSValuePool::singleton().createIdentifierValue(CSSValueSideways);
5653
        consumeIdentRaw(m_range);
5654
    } else if (CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyTextOrientation, valueID, m_context))
5655
        keyword = consumeIdent(m_range);
5656
    else
5657
        return false;
5658
    if (!keyword || !m_range.atEnd())
5659
        return false;
5660
    addProperty(CSSPropertyTextOrientation, CSSPropertyWebkitTextOrientation, keyword.releaseNonNull(), important);
5661
    return true;
5662
}
5663
5645
static bool consumeBackgroundPosition(CSSParserTokenRange& range, const CSSParserContext& context, CSSPropertyID property, RefPtr<CSSValue>& resultX, RefPtr<CSSValue>& resultY)
5664
static bool consumeBackgroundPosition(CSSParserTokenRange& range, const CSSParserContext& context, CSSPropertyID property, RefPtr<CSSValue>& resultX, RefPtr<CSSValue>& resultY)
5646
{
5665
{
5647
    do {
5666
    do {
Lines 6450-6455 bool CSSPropertyParser::parseShorthand(CSSPropertyID property, bool important) a/Source/WebCore/css/parser/CSSPropertyParser.cpp_sec2
6450
    case CSSPropertyWebkitColumnBreakBefore:
6469
    case CSSPropertyWebkitColumnBreakBefore:
6451
    case CSSPropertyWebkitColumnBreakInside:
6470
    case CSSPropertyWebkitColumnBreakInside:
6452
        return consumeLegacyBreakProperty(property, important);
6471
        return consumeLegacyBreakProperty(property, important);
6472
    case CSSPropertyWebkitTextOrientation:
6473
        return consumeLegacyTextOrientation(important);
6453
    case CSSPropertyMaskPosition:
6474
    case CSSPropertyMaskPosition:
6454
    case CSSPropertyWebkitMaskPosition:
6475
    case CSSPropertyWebkitMaskPosition:
6455
    case CSSPropertyBackgroundPosition: {
6476
    case CSSPropertyBackgroundPosition: {
- a/Source/WebCore/css/parser/CSSPropertyParser.h +1 lines
Lines 117-122 private: a/Source/WebCore/css/parser/CSSPropertyParser.h_sec1
117
    bool consumeFlex(bool important);
117
    bool consumeFlex(bool important);
118
118
119
    bool consumeLegacyBreakProperty(CSSPropertyID, bool important);
119
    bool consumeLegacyBreakProperty(CSSPropertyID, bool important);
120
    bool consumeLegacyTextOrientation(bool important);
120
121
121
    bool consumeTransformOrigin(bool important);
122
    bool consumeTransformOrigin(bool important);
122
    bool consumePerspectiveOrigin(bool important);
123
    bool consumePerspectiveOrigin(bool important);
- a/Source/WebCore/style/StyleBuilderCustom.h -6 lines
Lines 148-154 public: a/Source/WebCore/style/StyleBuilderCustom.h_sec1
148
    static void applyInitialTextAlign(BuilderState&);
148
    static void applyInitialTextAlign(BuilderState&);
149
    static void applyValueTextAlign(BuilderState&, CSSValue&);
149
    static void applyValueTextAlign(BuilderState&, CSSValue&);
150
    static void applyValueWebkitLocale(BuilderState&, CSSValue&);
150
    static void applyValueWebkitLocale(BuilderState&, CSSValue&);
151
    static void applyValueWebkitTextOrientation(BuilderState&, CSSValue&);
152
    static void applyValueTextOrientation(BuilderState&, CSSValue&);
151
    static void applyValueTextOrientation(BuilderState&, CSSValue&);
153
#if ENABLE(TEXT_AUTOSIZING)
152
#if ENABLE(TEXT_AUTOSIZING)
154
    static void applyValueWebkitTextSizeAdjust(BuilderState&, CSSValue&);
153
    static void applyValueWebkitTextSizeAdjust(BuilderState&, CSSValue&);
Lines 890-900 inline void BuilderCustom::applyValueWritingMode(BuilderState& builderState, CSS a/Source/WebCore/style/StyleBuilderCustom.h_sec2
890
    builderState.style().setHasExplicitlySetWritingMode(true);
889
    builderState.style().setHasExplicitlySetWritingMode(true);
891
}
890
}
892
891
893
inline void BuilderCustom::applyValueWebkitTextOrientation(BuilderState& builderState, CSSValue& value)
894
{
895
    builderState.setTextOrientation(downcast<CSSPrimitiveValue>(value));
896
}
897
898
inline void BuilderCustom::applyValueTextOrientation(BuilderState& builderState, CSSValue& value)
892
inline void BuilderCustom::applyValueTextOrientation(BuilderState& builderState, CSSValue& value)
899
{
893
{
900
    builderState.setTextOrientation(downcast<CSSPrimitiveValue>(value));
894
    builderState.setTextOrientation(downcast<CSSPrimitiveValue>(value));

Return to Bug 238356