Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 33b130ec17ce2cc298ac28ac3a693e14a271d863
      
https://github.com/WebKit/WebKit/commit/33b130ec17ce2cc298ac28ac3a693e14a271d863
  Author: Sam Weinig <[email protected]>
  Date:   2025-10-02 (Thu, 02 Oct 2025)

  Changed paths:
    M Source/WebCore/SaferCPPExpectations/UncheckedCallArgsCheckerExpectations
    M Source/WebCore/css/values/CSSValueConcepts.h
    M Source/WebCore/layout/formattingContexts/FormattingGeometry.cpp
    M Source/WebCore/layout/formattingContexts/block/BlockMarginCollapse.cpp
    M Source/WebCore/rendering/AutoTableLayout.cpp
    M Source/WebCore/rendering/GridLayoutFunctions.cpp
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBlockFlow.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderImage.cpp
    M Source/WebCore/rendering/RenderMarquee.cpp
    M Source/WebCore/rendering/RenderTable.cpp
    M Source/WebCore/rendering/RenderTableSection.cpp
    M Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm
    M Source/WebCore/rendering/style/BorderData.cpp
    M Source/WebCore/rendering/style/BorderData.h
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/rendering/style/RenderStyleInlines.h
    M Source/WebCore/rendering/svg/RenderSVGEllipse.cpp
    M Source/WebCore/rendering/svg/RenderSVGPath.cpp
    M Source/WebCore/rendering/svg/RenderSVGRect.cpp
    M Source/WebCore/rendering/svg/RenderSVGShape.cpp
    M Source/WebCore/rendering/svg/SVGTextBoxPainter.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGEllipse.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRect.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp
    M Source/WebCore/style/StyleExtractorCustom.h
    M Source/WebCore/style/values/StyleValueTypes.h
    M Source/WebCore/style/values/backgrounds/StyleBackgroundSize.h
    M Source/WebCore/style/values/backgrounds/StyleFillLayers.h
    M Source/WebCore/style/values/fill-stroke/StyleStrokeWidth.h
    M Source/WebCore/style/values/primitives/StyleLengthWrapper+Blending.h
    M Source/WebCore/style/values/primitives/StyleLengthWrapper.h
    M Source/WebCore/style/values/primitives/StyleLengthWrapperData.h
    M Source/WebCore/style/values/primitives/StylePrimitiveNumeric.h
    M 
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Blending.h
    M 
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Evaluation.h
    M Source/WebCore/style/values/svg/StyleSVGStrokeDasharray.h
    M Source/WebCore/style/values/svg/StyleSVGStrokeDashoffset.h
    M Source/WebCore/style/values/transforms/StyleTransformFunction.cpp
    M Source/WebCore/style/values/transforms/StyleTranslate.h
    M 
Source/WebCore/style/values/transforms/functions/StyleTranslateTransformFunction.h

  Log Message:
  -----------
  [Style] Replace isZero/isNegative/isPositive functions inherited from 
WebCore::Length
https://bugs.webkit.org/show_bug.cgi?id=299972

Reviewed by Darin Adler.

`Style::LengthPercentage<>` and `Style::LengthWrapperBase<>` inherited (to help
things continue to work without too much churn) the isZero/isNegative/isPositive
functions from `WebCore::Length` and along with them their quirky behavior with
calc and keywords.

For a type that includes a Length, Percentage, Calc, and Keywords, the
functions have the following behavior:

- isZero:
    Length        !value
    Percentage    !value
    Calc          false
    Keyword       true (due to keywords having a value equal to 0)

- isPositive:
    Length        value > 0
    Percentage    value > 0
    Calc          true
    Keyword       false (due to keywords having a value equal to 0)

- isNegative:
    Length        value < 0
    Percentage    value < 0
    Calc          false
    Keyword       false (due to keywords having a value equal to 0)

This change replaces these functions with a set that hopefully have
more clear semantics:

The "known" value functions, `isKnownZero`, `isKnownPositive` and
`isKnownNegative`, will perform their comparison for Length and
Percentage values, but will return `false` for anything else (e.g. calc
or keywords).

The "possibly" value functions, `isPossiblyZero`, `isPossiblyPositive` and
`isPossiblyNegative`, will perform their comparison for Length and
Percentage values, but will return `true` for anything else (e.g. calc
or keywords).

In addition, the functions are constrained only to types where the types
numeric range makes the comparison meaningful. This means that a type
like `LengthPercentage<CSS::Nonnegative>`, the `isKnownNegative` and
`isPossiblyNegative` functions will unavailable and produce a compile
error if used. This allowed the removal of a number of useless calls.

* Source/WebCore/css/values/CSSValueConcepts.h:
* Source/WebCore/layout/formattingContexts/FormattingGeometry.cpp:
* Source/WebCore/layout/formattingContexts/block/BlockMarginCollapse.cpp:
* Source/WebCore/rendering/AutoTableLayout.cpp:
* Source/WebCore/rendering/GridLayoutFunctions.cpp:
* Source/WebCore/rendering/RenderBlock.cpp:
* Source/WebCore/rendering/RenderBlockFlow.cpp:
* Source/WebCore/rendering/RenderBox.cpp:
* Source/WebCore/rendering/RenderElement.cpp:
* Source/WebCore/rendering/RenderImage.cpp:
* Source/WebCore/rendering/RenderMarquee.cpp:
* Source/WebCore/rendering/RenderTable.cpp:
* Source/WebCore/rendering/RenderTableSection.cpp:
* Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm:
* Source/WebCore/rendering/style/BorderData.cpp:
* Source/WebCore/rendering/style/BorderData.h:
* Source/WebCore/rendering/style/RenderStyle.cpp:
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
* Source/WebCore/style/StyleExtractorCustom.h:
* Source/WebCore/style/values/StyleValueTypes.h:
* Source/WebCore/style/values/backgrounds/StyleBackgroundSize.h:
* Source/WebCore/style/values/backgrounds/StyleFillLayers.h:
* Source/WebCore/style/values/box/StyleMargin.h:
* Source/WebCore/style/values/fill-stroke/StyleStrokeWidth.cpp:
* Source/WebCore/style/values/fill-stroke/StyleStrokeWidth.h:
* Source/WebCore/style/values/primitives/StyleLengthWrapper+Blending.h:
* Source/WebCore/style/values/primitives/StyleLengthWrapper.h:
* Source/WebCore/style/values/primitives/StyleLengthWrapperData.h:
* Source/WebCore/style/values/primitives/StylePrimitiveNumeric.h:
* Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Blending.h:
* 
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Evaluation.h:
* Source/WebCore/style/values/svg/StyleSVGStrokeDasharray.h:
* Source/WebCore/style/values/svg/StyleSVGStrokeDashoffset.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to