Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7e186a333e75c2d40722b5e6796f0926a833517d
      
https://github.com/WebKit/WebKit/commit/7e186a333e75c2d40722b5e6796f0926a833517d
  Author: Simon Fraser <simon.fra...@apple.com>
  Date:   2024-09-01 (Sun, 01 Sep 2024)

  Changed paths:
    M Source/WebCore/animation/CSSPropertyAnimation.cpp
    M Source/WebCore/css/CSSPrimitiveValue.cpp
    M Source/WebCore/css/CSSPrimitiveValue.h
    M Source/WebCore/style/StyleBuilderConverter.h

  Log Message:
  -----------
  Length CSSPrimitiveValue::resolveAsLength() casts to double then Length casts 
to float
https://bugs.webkit.org/show_bug.cgi?id=278969
rdar://135082837

Reviewed by Sam Weinig.

236687@main added a `clampTo<double>()` in `CSSPrimitiveValue::computeLength()` 
in order
to avoid a compiler warning about int-to-float conversion of 
`maxValueForCssLength`. However,
Length stores a float internally, and its constructor does a static_cast<float> 
of the argument.
So let's just convert directly to floats.

`minValueForCssLength` and `maxValueForCssLength` become floats, and callers of 
the Length
constructor that takes a float now use `clampTo<float()`.

`maxValueForCssLength` can't be losslessly converted to a float; ideally we'd 
round down to
the next representable float (rather than to the nearest), but that can't be 
done at compile
time unless we just hardcode the float value, so stay with static_cast<float> 
for now.

* Source/WebCore/animation/CSSPropertyAnimation.cpp:
* Source/WebCore/css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::resolveAsLength const):
* Source/WebCore/css/CSSPrimitiveValue.h:
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertTextDecorationThickness):
(WebCore::Style::BuilderConverter::convertTextLengthOrNormal):
(WebCore::Style::BuilderConverter::convertLineHeight):

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



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

Reply via email to