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

Changeset 246491 in webkit


Ignore:
Timestamp:
Jun 16, 2019, 6:59:28 PM (7 years ago)
Author:
Darin Adler
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".

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246471 r246491  
     12019-06-16  Darin Adler  <darin@apple.com>
     2
     3        Convert some uses of fixed width and fixed precision floating point formatting to use shortest instead
     4        https://bugs.webkit.org/show_bug.cgi?id=198896
     5
     6        Reviewed by Sam Weinig.
     7
     8        * fast/loader/stateobjects/pushstate-frequency-expected.txt:
     9        * fast/loader/stateobjects/pushstate-frequency-iframe-expected.txt:
     10        * fast/loader/stateobjects/replacestate-frequency-expected.txt:
     11        * fast/loader/stateobjects/replacestate-frequency-iframe-expected.txt:
     12        Updated to expect cleaner output without ".000000".
     13
    1142019-06-15  Simon Fraser  <simon.fraser@apple.com>
    215
  • trunk/LayoutTests/fast/loader/stateobjects/pushstate-frequency-expected.txt

    r219663 r246491  
    100100Successfully added item: 98
    101101Successfully added item: 99
    102 SecurityError: Attempt to use history.pushState() more than 100 times per 30.000000 seconds
     102SecurityError: Attempt to use history.pushState() more than 100 times per 30 seconds
    103103Test complete
    104104
  • trunk/LayoutTests/fast/loader/stateobjects/pushstate-frequency-iframe-expected.txt

    r231450 r246491  
    108108Successfully added item: 23
    109109Successfully added item: 24
    110 Expected exception: SecurityError: Attempt to use history.pushState() more than 100 times per 30.000000 seconds
     110Expected exception: SecurityError: Attempt to use history.pushState() more than 100 times per 30 seconds
    111111
  • trunk/LayoutTests/fast/loader/stateobjects/replacestate-frequency-expected.txt

    r219663 r246491  
    100100Successfully added item: 98
    101101Successfully added item: 99
    102 SecurityError: Attempt to use history.replaceState() more than 100 times per 30.000000 seconds
     102SecurityError: Attempt to use history.replaceState() more than 100 times per 30 seconds
    103103Test complete
    104104
  • trunk/LayoutTests/fast/loader/stateobjects/replacestate-frequency-iframe-expected.txt

    r231450 r246491  
    107107Successfully added item: 23
    108108Successfully added item: 24
    109 Expected exception: SecurityError: Attempt to use history.replaceState() more than 100 times per 30.000000 seconds
     109Expected exception: SecurityError: Attempt to use history.replaceState() more than 100 times per 30 seconds
    110110
  • trunk/Source/WebCore/ChangeLog

    r246490 r246491  
     12019-06-16  Darin Adler  <darin@apple.com>
     2
     3        Convert some uses of fixed width and fixed precision floating point formatting to use shortest instead
     4        https://bugs.webkit.org/show_bug.cgi?id=198896
     5
     6        Reviewed by Sam Weinig.
     7
     8        * Modules/indexeddb/IDBKeyData.cpp:
     9        (WebCore::IDBKeyData::loggingString const): Removed unneeded use of
     10        FormattedNumber::fixedWidth to override the default shortest-form formatting.
     11        * page/History.cpp:
     12        (WebCore::History::stateObjectAdded): Ditto.
     13
     14        * page/PrintContext.cpp:
     15        (WebCore::PrintContext::pageProperty): Use String::number instead of
     16        String::numberToStringFixedPrecision. Also removed some uses of
     17        FormattedNumber::fixedPrecision.
     18        * platform/graphics/FloatPolygon.cpp:
     19        (WebCore::FloatPolygonEdge::debugString const): Ditto.
     20
    1212019-06-16  Darin Adler  <darin@apple.com>
    222
  • trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp

    r240892 r246491  
    365365        break;
    366366    case IndexedDB::KeyType::Date:
    367         return makeString("<date> - ", FormattedNumber::fixedWidth(WTF::get<double>(m_value), 6));
    368     case IndexedDB::KeyType::Number:
    369         return makeString("<number> - ", FormattedNumber::fixedWidth(WTF::get<double>(m_value), 6));
     367        return makeString("<date> - ", WTF::get<double>(m_value));
     368    case IndexedDB::KeyType::Number:
     369        return makeString("<number> - ", WTF::get<double>(m_value));
    370370    case IndexedDB::KeyType::Max:
    371371        return "<maximum>"_s;
  • trunk/Source/WebCore/page/History.cpp

    r243887 r246491  
    227227    if (mainHistory.m_currentStateObjectTimeSpanObjectsAdded >= perStateObjectTimeSpanLimit) {
    228228        if (stateObjectType == StateObjectType::Replace)
    229             return Exception { SecurityError, makeString("Attempt to use history.replaceState() more than ", perStateObjectTimeSpanLimit, " times per ", FormattedNumber::fixedWidth(stateObjectTimeSpan.seconds(), 6), " seconds") };
    230         return Exception { SecurityError, makeString("Attempt to use history.pushState() more than ", perStateObjectTimeSpanLimit, " times per ", FormattedNumber::fixedWidth(stateObjectTimeSpan.seconds(), 6), " seconds") };
     229            return Exception { SecurityError, makeString("Attempt to use history.replaceState() more than ", perStateObjectTimeSpanLimit, " times per ", stateObjectTimeSpan.seconds(), " seconds") };
     230        return Exception { SecurityError, makeString("Attempt to use history.pushState() more than ", perStateObjectTimeSpanLimit, " times per ", stateObjectTimeSpan.seconds(), " seconds") };
    231231    }
    232232
  • trunk/Source/WebCore/page/PrintContext.cpp

    r245823 r246491  
    358358        if (style->marginLeft().isAuto())
    359359            return "auto"_s;
    360         return String::numberToStringFixedPrecision(style->marginLeft().value());
     360        return String::number(style->marginLeft().value());
    361361    }
    362362    if (!strcmp(propertyName, "line-height"))
    363         return String::numberToStringFixedPrecision(style->lineHeight().value());
     363        return String::number(style->lineHeight().value());
    364364    if (!strcmp(propertyName, "font-size"))
    365365        return String::number(style->fontDescription().computedPixelSize());
     
    367367        return style->fontDescription().firstFamily();
    368368    if (!strcmp(propertyName, "size"))
    369         return makeString(FormattedNumber::fixedPrecision(style->pageSize().width.value()), ' ', FormattedNumber::fixedPrecision(style->pageSize().height.value()));
     369        return makeString(style->pageSize().width.value(), ' ', style->pageSize().height.value());
    370370
    371371    return makeString("pageProperty() unimplemented for: ", propertyName);
  • trunk/Source/WebCore/platform/graphics/FloatPolygon.cpp

    r241751 r246491  
    260260String FloatPolygonEdge::debugString() const
    261261{
    262     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()), ')');
     262    return makeString("0x", hex(reinterpret_cast<uintptr_t>(this)), " (", vertex1().x(), ',', vertex1().y(), ' ', vertex2().x(), ',', vertex2().y(), ')');
    263263}
    264264
Note: See TracChangeset for help on using the changeset viewer.