Ignore:
Timestamp:
Sep 10, 2016, 11:08:32 AM (9 years ago)
Author:
Chris Dumez
Message:

parseHTMLInteger() should take a StringView in parameter
https://bugs.webkit.org/show_bug.cgi?id=161669

Reviewed by Ryosuke Niwa.

Source/JavaScriptCore:

  • runtime/DateConversion.cpp:

(JSC::formatDateTime):
Explicitly construct a String from the const WCHAR* on Windows because
it is ambiguous otherwise now that there is a StringBuilder::append()
overload taking an AtomicString in.

Source/WebCore:

parseHTMLInteger() should take a StringView in parameter instead of a
const String&.

  • css/parser/CSSParser.cpp:

(WebCore::CSSParser::parseFontFaceSrcLocal):

  • css/parser/CSSParserValues.h:

(WebCore::CSSParserString::toStringView):
Add toStringView() to avoid unnecessarily constructing a String for
calling StringBuilder::append().

  • html/parser/HTMLParserIdioms.cpp:

(WebCore::parseHTMLInteger):
(WebCore::parseHTMLNonNegativeInteger):
(WebCore::parseHTTPRefreshInternal):

  • html/parser/HTMLParserIdioms.h:

(WebCore::limitToOnlyHTMLNonNegativeNumbersGreaterThanZero):
(WebCore::limitToOnlyHTMLNonNegative):
Take a StringView in parameter instead of a const String&.

  • platform/sql/SQLiteStatement.cpp:

(WebCore::SQLiteStatement::isColumnDeclaredAsBlob):
Avoid unnecessarily constructing a String to call equalLettersIgnoringASCIICase()
by leveraging the StringView constructor taking a 'const char*' in parameter.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::constructTextRun):

  • rendering/RenderBlock.h:

Add constructTextRun() overload taking an AtomicString. It was otherwise ambiguous
because both a String or a StringView could be constructed from an AtomicString.

  • page/CaptionUserPreferencesMediaAF.cpp:

(WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
(WebCore::buildDisplayStringForTrackBase):

  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::mediaControlsStyleSheet):
(WebCore::RenderThemeMac::mediaControlsScript):
Explicitly construct a String from NSString / CFStringRef types as such calls are
now ambiguous.

Source/WTF:

  • wtf/text/StringBuilder.h:

(WTF::StringBuilder::append):
Add StringBuilder::append() overload taking an AtomicString in parameter.
It used to call StringBuilder::append(const String&) implicitly when
passing an AtomicString. However, it is now ambiguous because there
is an overload taking a StringView, and it is now possible to construct
a StringView from an AtomicString.

  • wtf/text/StringView.h:

(WTF::StringView::StringView):

  • Add StringView constructor taking an AtomicString in parameter for convenience. This avoids having to call AtomicString::string() explicitly at call sites.
  • Add StringView constructor taking a 'const char*' in parameter for performance. There are several call sites that were passing a const char* and implicitly constructing an unnecessary String to construct a StringView. This became more obvious because the constructor taking an AtomicString in parameter made such calls ambiguous.

Tools:

Explicitly construct a String from the CFStringRef in order to call
StringBuilder::append(). This is needed now that there is an append()
overload taking an AtomicString in parameter.

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::InjectedBundlePage::dumpDOMAsWebArchive):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/DateConversion.cpp

    r127505 r205787  
    116116            if (timeZoneName[0]) {
    117117                builder.appendLiteral(" (");
     118#if OS(WINDOWS)
     119                builder.append(String(timeZoneName));
     120#else
    118121                builder.append(timeZoneName);
     122#endif
    119123                builder.append(')');
    120124            }
Note: See TracChangeset for help on using the changeset viewer.