⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276205 in webkit


Ignore:
Timestamp:
Apr 17, 2021, 1:16:22 PM (5 years ago)
Author:
basuke.suzuki@sony.com
Message:

[clang 11] Remove warning when converting WebCore::maxValueForCssLength from int to float
https://bugs.webkit.org/show_bug.cgi?id=224714

Reviewed by Chris Dumez.

On clang 11, the conversion from const int WebCore::maxValueForCssLength (= 33554429) to
float generates conversion warning:

warning: implicit conversion from 'const int' to 'float' changes value from 33554429 to 33554428

Changing the target type from float to double works for this. Length constructor accept double
so that there's no drawback with this change.

No test because it's compiler behavior.

  • style/StyleBuilderConverter.h:

(WebCore::Style::BuilderConverter::convertWordSpacing):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r276204 r276205  
     12021-04-17  Basuke Suzuki  <basuke.suzuki@sony.com>
     2
     3        [clang 11] Remove warning when converting WebCore::maxValueForCssLength from int to float
     4        https://bugs.webkit.org/show_bug.cgi?id=224714
     5
     6        Reviewed by Chris Dumez.
     7
     8        On clang 11, the conversion from const int WebCore::maxValueForCssLength (= 33554429) to
     9        float generates conversion warning:
     10        > warning: implicit conversion from 'const int' to 'float' changes value from 33554429 to 33554428
     11
     12        Changing the target type from float to double works for this. Length constructor accept double
     13        so that there's no drawback with this change.
     14
     15        No test because it's compiler behavior.
     16
     17        * style/StyleBuilderConverter.h:
     18        (WebCore::Style::BuilderConverter::convertWordSpacing):
     19
    1202021-04-17  Sam Weinig  <weinig@apple.com>
    221
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r276002 r276205  
    543543template<> Length CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData) const
    544544{
    545     return Length(clampTo<float>(computeLengthDouble(conversionData), minValueForCssLength, maxValueForCssLength), LengthType::Fixed);
     545    return Length(clampTo<double>(computeLengthDouble(conversionData), minValueForCssLength, maxValueForCssLength), LengthType::Fixed);
    546546}
    547547
  • trunk/Source/WebCore/style/StyleBuilderConverter.h

    r275273 r276205  
    12131213        wordSpacing = primitiveValue.computeLength<Length>(csstoLengthConversionDataWithTextZoomFactor(builderState));
    12141214    else if (primitiveValue.isPercentage())
    1215         wordSpacing = Length(clampTo<float>(primitiveValue.doubleValue(), minValueForCssLength, maxValueForCssLength), LengthType::Percent);
     1215        wordSpacing = Length(clampTo<double>(primitiveValue.doubleValue(), minValueForCssLength, maxValueForCssLength), LengthType::Percent);
    12161216    else if (primitiveValue.isNumber())
    12171217        wordSpacing = Length(primitiveValue.doubleValue(), LengthType::Fixed);
Note: See TracChangeset for help on using the changeset viewer.