Title: [246491] trunk
Revision
246491
Author
[email protected]
Date
2019-06-16 18:59:28 -0700 (Sun, 16 Jun 2019)

Log Message

Convert some uses of fixed width and fixed precision floating point formatting to use shortest instead
https://bugs.webkit.org/show_bug.cgi?id=198896

Reviewed by Sam Weinig.

Source/WebCore:

* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::loggingString const): Removed unneeded use of
FormattedNumber::fixedWidth to override the default shortest-form formatting.
* page/History.cpp:
(WebCore::History::stateObjectAdded): Ditto.

* page/PrintContext.cpp:
(WebCore::PrintContext::pageProperty): Use String::number instead of
String::numberToStringFixedPrecision. Also removed some uses of
FormattedNumber::fixedPrecision.
* platform/graphics/FloatPolygon.cpp:
(WebCore::FloatPolygonEdge::debugString const): Ditto.

LayoutTests:

* fast/loader/stateobjects/pushstate-frequency-expected.txt:
* fast/loader/stateobjects/pushstate-frequency-iframe-expected.txt:
* fast/loader/stateobjects/replacestate-frequency-expected.txt:
* fast/loader/stateobjects/replacestate-frequency-iframe-expected.txt:
Updated to expect cleaner output without ".000000".

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246490 => 246491)


--- trunk/LayoutTests/ChangeLog	2019-06-17 01:48:13 UTC (rev 246490)
+++ trunk/LayoutTests/ChangeLog	2019-06-17 01:59:28 UTC (rev 246491)
@@ -1,3 +1,16 @@
+2019-06-16  Darin Adler  <[email protected]>
+
+        Convert some uses of fixed width and fixed precision floating point formatting to use shortest instead
+        https://bugs.webkit.org/show_bug.cgi?id=198896
+
+        Reviewed by Sam Weinig.
+
+        * fast/loader/stateobjects/pushstate-frequency-expected.txt:
+        * fast/loader/stateobjects/pushstate-frequency-iframe-expected.txt:
+        * fast/loader/stateobjects/replacestate-frequency-expected.txt:
+        * fast/loader/stateobjects/replacestate-frequency-iframe-expected.txt:
+        Updated to expect cleaner output without ".000000".
+
 2019-06-15  Simon Fraser  <[email protected]>
 
         Make layerTreeAsText() output a bit less verbose

Modified: trunk/LayoutTests/fast/loader/stateobjects/pushstate-frequency-expected.txt (246490 => 246491)


--- trunk/LayoutTests/fast/loader/stateobjects/pushstate-frequency-expected.txt	2019-06-17 01:48:13 UTC (rev 246490)
+++ trunk/LayoutTests/fast/loader/stateobjects/pushstate-frequency-expected.txt	2019-06-17 01:59:28 UTC (rev 246491)
@@ -99,6 +99,6 @@
 Successfully added item: 97
 Successfully added item: 98
 Successfully added item: 99
-SecurityError: Attempt to use history.pushState() more than 100 times per 30.000000 seconds
+SecurityError: Attempt to use history.pushState() more than 100 times per 30 seconds
 Test complete
 

Modified: trunk/LayoutTests/fast/loader/stateobjects/pushstate-frequency-iframe-expected.txt (246490 => 246491)


--- trunk/LayoutTests/fast/loader/stateobjects/pushstate-frequency-iframe-expected.txt	2019-06-17 01:48:13 UTC (rev 246490)
+++ trunk/LayoutTests/fast/loader/stateobjects/pushstate-frequency-iframe-expected.txt	2019-06-17 01:59:28 UTC (rev 246491)
@@ -107,5 +107,5 @@
 Successfully added item: 22
 Successfully added item: 23
 Successfully added item: 24
-Expected exception: SecurityError: Attempt to use history.pushState() more than 100 times per 30.000000 seconds
+Expected exception: SecurityError: Attempt to use history.pushState() more than 100 times per 30 seconds
 

Modified: trunk/LayoutTests/fast/loader/stateobjects/replacestate-frequency-expected.txt (246490 => 246491)


--- trunk/LayoutTests/fast/loader/stateobjects/replacestate-frequency-expected.txt	2019-06-17 01:48:13 UTC (rev 246490)
+++ trunk/LayoutTests/fast/loader/stateobjects/replacestate-frequency-expected.txt	2019-06-17 01:59:28 UTC (rev 246491)
@@ -99,6 +99,6 @@
 Successfully added item: 97
 Successfully added item: 98
 Successfully added item: 99
-SecurityError: Attempt to use history.replaceState() more than 100 times per 30.000000 seconds
+SecurityError: Attempt to use history.replaceState() more than 100 times per 30 seconds
 Test complete
 

Modified: trunk/LayoutTests/fast/loader/stateobjects/replacestate-frequency-iframe-expected.txt (246490 => 246491)


--- trunk/LayoutTests/fast/loader/stateobjects/replacestate-frequency-iframe-expected.txt	2019-06-17 01:48:13 UTC (rev 246490)
+++ trunk/LayoutTests/fast/loader/stateobjects/replacestate-frequency-iframe-expected.txt	2019-06-17 01:59:28 UTC (rev 246491)
@@ -106,5 +106,5 @@
 Successfully added item: 22
 Successfully added item: 23
 Successfully added item: 24
-Expected exception: SecurityError: Attempt to use history.replaceState() more than 100 times per 30.000000 seconds
+Expected exception: SecurityError: Attempt to use history.replaceState() more than 100 times per 30 seconds
 

Modified: trunk/Source/WebCore/ChangeLog (246490 => 246491)


--- trunk/Source/WebCore/ChangeLog	2019-06-17 01:48:13 UTC (rev 246490)
+++ trunk/Source/WebCore/ChangeLog	2019-06-17 01:59:28 UTC (rev 246491)
@@ -1,5 +1,25 @@
 2019-06-16  Darin Adler  <[email protected]>
 
+        Convert some uses of fixed width and fixed precision floating point formatting to use shortest instead
+        https://bugs.webkit.org/show_bug.cgi?id=198896
+
+        Reviewed by Sam Weinig.
+
+        * Modules/indexeddb/IDBKeyData.cpp:
+        (WebCore::IDBKeyData::loggingString const): Removed unneeded use of
+        FormattedNumber::fixedWidth to override the default shortest-form formatting.
+        * page/History.cpp:
+        (WebCore::History::stateObjectAdded): Ditto.
+
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::pageProperty): Use String::number instead of
+        String::numberToStringFixedPrecision. Also removed some uses of
+        FormattedNumber::fixedPrecision.
+        * platform/graphics/FloatPolygon.cpp:
+        (WebCore::FloatPolygonEdge::debugString const): Ditto.
+
+2019-06-16  Darin Adler  <[email protected]>
+
         Rename AtomicString to AtomString
         https://bugs.webkit.org/show_bug.cgi?id=195276
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp (246490 => 246491)


--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp	2019-06-17 01:48:13 UTC (rev 246490)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp	2019-06-17 01:59:28 UTC (rev 246491)
@@ -364,9 +364,9 @@
         result = "<string> - " + WTF::get<String>(m_value);
         break;
     case IndexedDB::KeyType::Date:
-        return makeString("<date> - ", FormattedNumber::fixedWidth(WTF::get<double>(m_value), 6));
+        return makeString("<date> - ", WTF::get<double>(m_value));
     case IndexedDB::KeyType::Number:
-        return makeString("<number> - ", FormattedNumber::fixedWidth(WTF::get<double>(m_value), 6));
+        return makeString("<number> - ", WTF::get<double>(m_value));
     case IndexedDB::KeyType::Max:
         return "<maximum>"_s;
     case IndexedDB::KeyType::Min:

Modified: trunk/Source/WebCore/page/History.cpp (246490 => 246491)


--- trunk/Source/WebCore/page/History.cpp	2019-06-17 01:48:13 UTC (rev 246490)
+++ trunk/Source/WebCore/page/History.cpp	2019-06-17 01:59:28 UTC (rev 246491)
@@ -226,8 +226,8 @@
     
     if (mainHistory.m_currentStateObjectTimeSpanObjectsAdded >= perStateObjectTimeSpanLimit) {
         if (stateObjectType == StateObjectType::Replace)
-            return Exception { SecurityError, makeString("Attempt to use history.replaceState() more than ", perStateObjectTimeSpanLimit, " times per ", FormattedNumber::fixedWidth(stateObjectTimeSpan.seconds(), 6), " seconds") };
-        return Exception { SecurityError, makeString("Attempt to use history.pushState() more than ", perStateObjectTimeSpanLimit, " times per ", FormattedNumber::fixedWidth(stateObjectTimeSpan.seconds(), 6), " seconds") };
+            return Exception { SecurityError, makeString("Attempt to use history.replaceState() more than ", perStateObjectTimeSpanLimit, " times per ", stateObjectTimeSpan.seconds(), " seconds") };
+        return Exception { SecurityError, makeString("Attempt to use history.pushState() more than ", perStateObjectTimeSpanLimit, " times per ", stateObjectTimeSpan.seconds(), " seconds") };
     }
 
     Checked<unsigned> titleSize = title.length();

Modified: trunk/Source/WebCore/page/PrintContext.cpp (246490 => 246491)


--- trunk/Source/WebCore/page/PrintContext.cpp	2019-06-17 01:48:13 UTC (rev 246490)
+++ trunk/Source/WebCore/page/PrintContext.cpp	2019-06-17 01:59:28 UTC (rev 246491)
@@ -357,16 +357,16 @@
     if (!strcmp(propertyName, "margin-left")) {
         if (style->marginLeft().isAuto())
             return "auto"_s;
-        return String::numberToStringFixedPrecision(style->marginLeft().value());
+        return String::number(style->marginLeft().value());
     }
     if (!strcmp(propertyName, "line-height"))
-        return String::numberToStringFixedPrecision(style->lineHeight().value());
+        return String::number(style->lineHeight().value());
     if (!strcmp(propertyName, "font-size"))
         return String::number(style->fontDescription().computedPixelSize());
     if (!strcmp(propertyName, "font-family"))
         return style->fontDescription().firstFamily();
     if (!strcmp(propertyName, "size"))
-        return makeString(FormattedNumber::fixedPrecision(style->pageSize().width.value()), ' ', FormattedNumber::fixedPrecision(style->pageSize().height.value()));
+        return makeString(style->pageSize().width.value(), ' ', style->pageSize().height.value());
 
     return makeString("pageProperty() unimplemented for: ", propertyName);
 }

Modified: trunk/Source/WebCore/platform/graphics/FloatPolygon.cpp (246490 => 246491)


--- trunk/Source/WebCore/platform/graphics/FloatPolygon.cpp	2019-06-17 01:48:13 UTC (rev 246490)
+++ trunk/Source/WebCore/platform/graphics/FloatPolygon.cpp	2019-06-17 01:59:28 UTC (rev 246491)
@@ -259,7 +259,7 @@
 
 String FloatPolygonEdge::debugString() const
 {
-    return makeString("0x", hex(reinterpret_cast<uintptr_t>(this)), " (", FormattedNumber::fixedPrecision(vertex1().x()), ',', FormattedNumber::fixedPrecision(vertex1().y()), ' ', FormattedNumber::fixedPrecision(vertex2().x()), ',', FormattedNumber::fixedPrecision(vertex2().y()), ')');
+    return makeString("0x", hex(reinterpret_cast<uintptr_t>(this)), " (", vertex1().x(), ',', vertex1().y(), ' ', vertex2().x(), ',', vertex2().y(), ')');
 }
 
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to