Title: [276205] trunk/Source/WebCore
Revision
276205
Author
[email protected]
Date
2021-04-17 13:16:22 -0700 (Sat, 17 Apr 2021)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (276204 => 276205)


--- trunk/Source/WebCore/ChangeLog	2021-04-17 20:07:30 UTC (rev 276204)
+++ trunk/Source/WebCore/ChangeLog	2021-04-17 20:16:22 UTC (rev 276205)
@@ -1,3 +1,22 @@
+2021-04-17  Basuke Suzuki  <[email protected]>
+
+        [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):
+
 2021-04-17  Sam Weinig  <[email protected]>
 
         Move RuntimeEnabledFeatures to Settings (Part 1)

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (276204 => 276205)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2021-04-17 20:07:30 UTC (rev 276204)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2021-04-17 20:16:22 UTC (rev 276205)
@@ -542,7 +542,7 @@
 
 template<> Length CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData) const
 {
-    return Length(clampTo<float>(computeLengthDouble(conversionData), minValueForCssLength, maxValueForCssLength), LengthType::Fixed);
+    return Length(clampTo<double>(computeLengthDouble(conversionData), minValueForCssLength, maxValueForCssLength), LengthType::Fixed);
 }
 
 template<> short CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData) const

Modified: trunk/Source/WebCore/style/StyleBuilderConverter.h (276204 => 276205)


--- trunk/Source/WebCore/style/StyleBuilderConverter.h	2021-04-17 20:07:30 UTC (rev 276204)
+++ trunk/Source/WebCore/style/StyleBuilderConverter.h	2021-04-17 20:16:22 UTC (rev 276205)
@@ -1212,7 +1212,7 @@
     else if (primitiveValue.isLength())
         wordSpacing = primitiveValue.computeLength<Length>(csstoLengthConversionDataWithTextZoomFactor(builderState));
     else if (primitiveValue.isPercentage())
-        wordSpacing = Length(clampTo<float>(primitiveValue.doubleValue(), minValueForCssLength, maxValueForCssLength), LengthType::Percent);
+        wordSpacing = Length(clampTo<double>(primitiveValue.doubleValue(), minValueForCssLength, maxValueForCssLength), LengthType::Percent);
     else if (primitiveValue.isNumber())
         wordSpacing = Length(primitiveValue.doubleValue(), LengthType::Fixed);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to