Title: [277738] trunk
Revision
277738
Author
[email protected]
Date
2021-05-19 11:17:57 -0700 (Wed, 19 May 2021)

Log Message

Calculated width percent loses the floating point and cause line wrap
https://bugs.webkit.org/show_bug.cgi?id=225962

Reviewed by Antti Koivisto.

Source/WebCore:

Length::nonNanCalculatedValue unexpectedly floors non-integral values.

Test: fast/inline/unexpected-line-wrap-with-calc.html

* platform/Length.cpp:
(WebCore::Length::nonNanCalculatedValue const):
* platform/Length.h:

LayoutTests:

* fast/inline/unexpected-line-wrap-with-calc-expected.html: Added.
* fast/inline/unexpected-line-wrap-with-calc.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (277737 => 277738)


--- trunk/LayoutTests/ChangeLog	2021-05-19 18:10:57 UTC (rev 277737)
+++ trunk/LayoutTests/ChangeLog	2021-05-19 18:17:57 UTC (rev 277738)
@@ -1,3 +1,13 @@
+2021-05-19  Alan Bujtas  <[email protected]>
+
+        Calculated width percent loses the floating point and cause line wrap
+        https://bugs.webkit.org/show_bug.cgi?id=225962
+
+        Reviewed by Antti Koivisto.
+
+        * fast/inline/unexpected-line-wrap-with-calc-expected.html: Added.
+        * fast/inline/unexpected-line-wrap-with-calc.html: Added.
+
 2021-05-19  Jer Noble  <[email protected]>
 
         [Mac] MSE-based video pauses when put in background; PiP context menu disabled

Added: trunk/LayoutTests/fast/inline/unexpected-line-wrap-with-calc-expected.html (0 => 277738)


--- trunk/LayoutTests/fast/inline/unexpected-line-wrap-with-calc-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/unexpected-line-wrap-with-calc-expected.html	2021-05-19 18:17:57 UTC (rev 277738)
@@ -0,0 +1 @@
+<div style="position: absolute; top: 8px; background-color: green; color: green">single line</div>

Added: trunk/LayoutTests/fast/inline/unexpected-line-wrap-with-calc.html (0 => 277738)


--- trunk/LayoutTests/fast/inline/unexpected-line-wrap-with-calc.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/unexpected-line-wrap-with-calc.html	2021-05-19 18:17:57 UTC (rev 277738)
@@ -0,0 +1,3 @@
+<div style="display: flex;"><div><div style="width: calc(100% + 0px); background-color: red; color: red">single line</div></div></div>
+<div style="position: absolute; top: 8px; background-color: green; color: green">single line</div>
+<!-- PASS if no red -->

Modified: trunk/Source/WebCore/ChangeLog (277737 => 277738)


--- trunk/Source/WebCore/ChangeLog	2021-05-19 18:10:57 UTC (rev 277737)
+++ trunk/Source/WebCore/ChangeLog	2021-05-19 18:17:57 UTC (rev 277738)
@@ -1,3 +1,18 @@
+2021-05-19  Alan Bujtas  <[email protected]>
+
+        Calculated width percent loses the floating point and cause line wrap
+        https://bugs.webkit.org/show_bug.cgi?id=225962
+
+        Reviewed by Antti Koivisto.
+
+        Length::nonNanCalculatedValue unexpectedly floors non-integral values.
+
+        Test: fast/inline/unexpected-line-wrap-with-calc.html
+
+        * platform/Length.cpp:
+        (WebCore::Length::nonNanCalculatedValue const):
+        * platform/Length.h:
+
 2021-05-19  Chris Dumez  <[email protected]>
 
         [Hardening] CARingBuffer should validate the storage size before adopting it

Modified: trunk/Source/WebCore/platform/Length.cpp (277737 => 277738)


--- trunk/Source/WebCore/platform/Length.cpp	2021-05-19 18:10:57 UTC (rev 277737)
+++ trunk/Source/WebCore/platform/Length.cpp	2021-05-19 18:17:57 UTC (rev 277738)
@@ -265,7 +265,7 @@
     calculationValues().deref(m_calculationValueHandle);
 }
 
-float Length::nonNanCalculatedValue(int maxValue) const
+float Length::nonNanCalculatedValue(float maxValue) const
 {
     ASSERT(isCalculated());
     float result = calculationValue().evaluate(maxValue);

Modified: trunk/Source/WebCore/platform/Length.h (277737 => 277738)


--- trunk/Source/WebCore/platform/Length.h	2021-05-19 18:10:57 UTC (rev 277737)
+++ trunk/Source/WebCore/platform/Length.h	2021-05-19 18:17:57 UTC (rev 277738)
@@ -117,7 +117,7 @@
     bool isSpecified() const;
     bool isSpecifiedOrIntrinsic() const;
 
-    float nonNanCalculatedValue(int maxValue) const;
+    float nonNanCalculatedValue(float maxValue) const;
 
 private:
     bool isLegacyIntrinsic() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to