<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[278669] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/278669">278669</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2021-06-09 13:46:24 -0700 (Wed, 09 Jun 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Avoid some calls to StringView::toString() / StringView::toStringWithoutCopying()
https://bugs.webkit.org/show_bug.cgi?id=226803

Reviewed by Darin Adler.

Source/WebCore:

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontVariationTag):
* page/FrameView.cpp:
(WebCore::FrameView::scrollToFragmentInternal):
* platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::lastHyphenLocation):
* rendering/RenderTreeAsText.cpp:
(WebCore::writeDebugInfo):

Source/WTF:

Add support to TextStream for printing a StringView directly, without having to convert
it to a String first.

* wtf/text/TextStream.cpp:
(WTF::TextStream::operator<<):
* wtf/text/TextStream.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfURLcpp">trunk/Source/WTF/wtf/URL.cpp</a></li>
<li><a href="#trunkSourceWTFwtfURLParsercpp">trunk/Source/WTF/wtf/URLParser.cpp</a></li>
<li><a href="#trunkSourceWTFwtfURLParserh">trunk/Source/WTF/wtf/URLParser.h</a></li>
<li><a href="#trunkSourceWTFwtftextStringViewcpp">trunk/Source/WTF/wtf/text/StringView.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextStringViewh">trunk/Source/WTF/wtf/text/StringView.h</a></li>
<li><a href="#trunkSourceWTFwtftextTextStreamcpp">trunk/Source/WTF/wtf/text/TextStream.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextTextStreamh">trunk/Source/WTF/wtf/text/TextStream.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulescacheDOMCacheEnginecpp">trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchBodyConsumercpp">trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParsercpp">trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParserHelperscpp">trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp</a></li>
<li><a href="#trunkSourceWebCoredomScriptElementcpp">trunk/Source/WebCore/dom/ScriptElement.cpp</a></li>
<li><a href="#trunkSourceWebCoredomStyledElementcpp">trunk/Source/WebCore/dom/StyledElement.cpp</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopecpp">trunk/Source/WebCore/dom/TreeScope.cpp</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopeh">trunk/Source/WebCore/dom/TreeScope.h</a></li>
<li><a href="#trunkSourceWebCoreeditingcocoaDataDetectionmm">trunk/Source/WebCore/editing/cocoa/DataDetection.mm</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</a></li>
<li><a href="#trunkSourceWebCorepageSecurityOrigincpp">trunk/Source/WebCore/page/SecurityOrigin.cpp</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicycpp">trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp</a></li>
<li><a href="#trunkSourceWebCorepagecspContentSecurityPolicyh">trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h</a></li>
<li><a href="#trunkSourceWebCoreplatformLegacySchemeRegistrycpp">trunk/Source/WebCore/platform/LegacySchemeRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaSourceBufferParserWebMcpp">trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkParsedContentTypecpp">trunk/Source/WebCore/platform/network/ParsedContentType.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformtexthyphenHyphenationLibHyphencpp">trunk/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTreeAsTextcpp">trunk/Source/WebCore/rendering/RenderTreeAsText.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGSVGElementcpp">trunk/Source/WebCore/svg/SVGSVGElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGSVGElementh">trunk/Source/WebCore/svg/SVGSVGElement.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGViewSpeccpp">trunk/Source/WebCore/svg/SVGViewSpec.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGViewSpech">trunk/Source/WebCore/svg/SVGViewSpec.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebViewConfigurationmm">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WTF/ChangeLog  2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2021-06-09  Chris Dumez  <cdumez@apple.com>
+
+        Avoid some calls to StringView::toString() / StringView::toStringWithoutCopying()
+        https://bugs.webkit.org/show_bug.cgi?id=226803
+
+        Reviewed by Darin Adler.
+
+        Add support to TextStream for printing a StringView directly, without having to convert
+        it to a String first.
+
+        * wtf/text/TextStream.cpp:
+        (WTF::TextStream::operator<<):
+        * wtf/text/TextStream.h:
+
</ins><span class="cx"> 2021-06-09  Alicia Boya GarcĂ­a  <aboya@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [WTF][GStreamer] Add RAII lockers for 3rd party locks
</span></span></pre></div>
<a id="trunkSourceWTFwtfURLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/URL.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/URL.cpp     2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WTF/wtf/URL.cpp        2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -378,7 +378,7 @@
</span><span class="cx"> {
</span><span class="cx">     // Firefox and IE remove everything after the first ':'.
</span><span class="cx">     auto newProtocolPrefix = newProtocol.substring(0, newProtocol.find(':'));
</span><del>-    auto newProtocolCanonicalized = URLParser::maybeCanonicalizeScheme(newProtocolPrefix.toStringWithoutCopying());
</del><ins>+    auto newProtocolCanonicalized = URLParser::maybeCanonicalizeScheme(newProtocolPrefix);
</ins><span class="cx">     if (!newProtocolCanonicalized)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -529,9 +529,10 @@
</span><span class="cx">     ));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static String percentEncodeCharacters(const String& input, bool(*shouldEncode)(UChar))
</del><ins>+template<typename StringType>
+static String percentEncodeCharacters(const StringType& input, bool(*shouldEncode)(UChar))
</ins><span class="cx"> {
</span><del>-    auto encode = [shouldEncode] (const String& input) {
</del><ins>+    auto encode = [shouldEncode] (const StringType& input) {
</ins><span class="cx">         CString utf8 = input.utf8();
</span><span class="cx">         auto* data = utf8.data();
</span><span class="cx">         StringBuilder builder;
</span><span class="lines">@@ -552,7 +553,10 @@
</span><span class="cx">         if (UNLIKELY(shouldEncode(input[i])))
</span><span class="cx">             return encode(input);
</span><span class="cx">     }
</span><del>-    return input;
</del><ins>+    if constexpr (std::is_same_v<StringType, StringView>)
+        return input.toString();
+    else
+        return input;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void URL::parse(const String& string)
</span><span class="lines">@@ -584,7 +588,7 @@
</span><span class="cx">         parse(makeString(
</span><span class="cx">             StringView(m_string).left(m_userStart),
</span><span class="cx">             slashSlashNeeded ? "//" : "",
</span><del>-            percentEncodeCharacters(newUser.toStringWithoutCopying(), URLParser::isInUserInfoEncodeSet),
</del><ins>+            percentEncodeCharacters(newUser, URLParser::isInUserInfoEncodeSet),
</ins><span class="cx">             needSeparator ? "@" : "",
</span><span class="cx">             StringView(m_string).substring(end)
</span><span class="cx">         ));
</span><span class="lines">@@ -606,7 +610,7 @@
</span><span class="cx">         parse(makeString(
</span><span class="cx">             StringView(m_string).left(m_userEnd),
</span><span class="cx">             needLeadingSlashes ? "//:" : ":",
</span><del>-            percentEncodeCharacters(newPassword.toStringWithoutCopying(), URLParser::isInUserInfoEncodeSet),
</del><ins>+            percentEncodeCharacters(newPassword, URLParser::isInUserInfoEncodeSet),
</ins><span class="cx">             '@',
</span><span class="cx">             StringView(m_string).substring(credentialsEnd())
</span><span class="cx">         ));
</span><span class="lines">@@ -670,7 +674,7 @@
</span><span class="cx">     auto questionMarkOrNumberSignOrNonASCII = [] (UChar character) {
</span><span class="cx">         return character == '?' || character == '#' || !isASCII(character);
</span><span class="cx">     };
</span><del>-    return percentEncodeCharacters(path.toStringWithoutCopying(), questionMarkOrNumberSignOrNonASCII);
</del><ins>+    return percentEncodeCharacters(path, questionMarkOrNumberSignOrNonASCII);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void URL::setPath(StringView path)
</span></span></pre></div>
<a id="trunkSourceWTFwtfURLParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/URLParser.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/URLParser.cpp       2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WTF/wtf/URLParser.cpp  2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -698,7 +698,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::optional<String> URLParser::maybeCanonicalizeScheme(const String& scheme)
</del><ins>+std::optional<String> URLParser::maybeCanonicalizeScheme(StringView scheme)
</ins><span class="cx"> {
</span><span class="cx">     if (scheme.isEmpty())
</span><span class="cx">         return std::nullopt;
</span></span></pre></div>
<a id="trunkSourceWTFwtfURLParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/URLParser.h (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/URLParser.h 2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WTF/wtf/URLParser.h    2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     WTF_EXPORT_PRIVATE static String serialize(const URLEncodedForm&);
</span><span class="cx"> 
</span><span class="cx">     WTF_EXPORT_PRIVATE static bool isSpecialScheme(const String& scheme);
</span><del>-    WTF_EXPORT_PRIVATE static std::optional<String> maybeCanonicalizeScheme(const String& scheme);
</del><ins>+    WTF_EXPORT_PRIVATE static std::optional<String> maybeCanonicalizeScheme(StringView scheme);
</ins><span class="cx"> 
</span><span class="cx">     static const UIDNA& internationalDomainNameTranscoder();
</span><span class="cx">     static bool isInUserInfoEncodeSet(UChar);
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringView.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringView.cpp 2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WTF/wtf/text/StringView.cpp    2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -247,6 +247,30 @@
</span><span class="cx">     return convertASCIICase<ASCIICase::Upper>(static_cast<const UChar*>(m_characters), m_length);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template<typename CharacterType>
+static AtomString convertASCIILowercaseAtom(const CharacterType* input, unsigned length)
+{
+    for (unsigned i = 0; i < length; ++i) {
+        if (UNLIKELY(isASCIIUpper(input[i]))) {
+            CharacterType* characters;
+            auto result = String::createUninitialized(length, characters);
+            StringImpl::copyCharacters(characters, input, i);
+            for (; i < length; ++i)
+                characters[i] = toASCIILower(input[i]);
+            return result;
+        }
+    }
+    // Fast path when the StringView is already all lowercase.
+    return AtomString(input, length);
+}
+
+AtomString StringView::convertToASCIILowercaseAtom() const
+{
+    if (m_is8Bit)
+        return convertASCIILowercaseAtom(characters8(), m_length);
+    return convertASCIILowercaseAtom(characters16(), m_length);
+}
+
</ins><span class="cx"> template<typename DestinationCharacterType, typename SourceCharacterType>
</span><span class="cx"> void getCharactersWithASCIICaseInternal(StringView::CaseConvertType type, DestinationCharacterType* destination, const SourceCharacterType* source, unsigned length)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringView.h (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringView.h   2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WTF/wtf/text/StringView.h      2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -148,6 +148,7 @@
</span><span class="cx"> 
</span><span class="cx">     WTF_EXPORT_PRIVATE String convertToASCIILowercase() const;
</span><span class="cx">     WTF_EXPORT_PRIVATE String convertToASCIIUppercase() const;
</span><ins>+    WTF_EXPORT_PRIVATE AtomString convertToASCIILowercaseAtom() const;
</ins><span class="cx"> 
</span><span class="cx">     bool contains(UChar) const;
</span><span class="cx">     bool contains(CodeUnitMatchFunction) const;
</span></span></pre></div>
<a id="trunkSourceWTFwtftextTextStreamcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/TextStream.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/TextStream.cpp 2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WTF/wtf/text/TextStream.cpp    2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -118,6 +118,12 @@
</span><span class="cx">     return *this << buffer;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TextStream& TextStream::operator<<(const AtomString& string)
+{
+    m_text.append(string);
+    return *this;
+}
+
</ins><span class="cx"> TextStream& TextStream::operator<<(const String& string)
</span><span class="cx"> {
</span><span class="cx">     m_text.append(string);
</span><span class="lines">@@ -124,6 +130,12 @@
</span><span class="cx">     return *this;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TextStream& TextStream::operator<<(StringView string)
+{
+    m_text.append(string);
+    return *this;
+}
+
</ins><span class="cx"> TextStream& TextStream::operator<<(const FormatNumberRespectingIntegers& numberToFormat)
</span><span class="cx"> {
</span><span class="cx">     if (hasFractions(numberToFormat.value)) {
</span></span></pre></div>
<a id="trunkSourceWTFwtftextTextStreamh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/TextStream.h (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/TextStream.h   2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WTF/wtf/text/TextStream.h      2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -70,7 +70,9 @@
</span><span class="cx">     WTF_EXPORT_PRIVATE TextStream& operator<<(double);
</span><span class="cx">     WTF_EXPORT_PRIVATE TextStream& operator<<(const char*);
</span><span class="cx">     WTF_EXPORT_PRIVATE TextStream& operator<<(const void*);
</span><ins>+    WTF_EXPORT_PRIVATE TextStream& operator<<(const AtomString&);
</ins><span class="cx">     WTF_EXPORT_PRIVATE TextStream& operator<<(const String&);
</span><ins>+    WTF_EXPORT_PRIVATE TextStream& operator<<(StringView);
</ins><span class="cx">     // Deprecated. Use the NumberRespectingIntegers FormattingFlag instead.
</span><span class="cx">     WTF_EXPORT_PRIVATE TextStream& operator<<(const FormatNumberRespectingIntegers&);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/ChangeLog      2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2021-06-09  Chris Dumez  <cdumez@apple.com>
+
+        Avoid some calls to StringView::toString() / StringView::toStringWithoutCopying()
+        https://bugs.webkit.org/show_bug.cgi?id=226803
+
+        Reviewed by Darin Adler.
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeFontVariationTag):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollToFragmentInternal):
+        * platform/text/hyphen/HyphenationLibHyphen.cpp:
+        (WebCore::lastHyphenLocation):
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::writeDebugInfo):
+
</ins><span class="cx"> 2021-06-09  Tyler Wilcock  <twilco.o@protonmail.com>
</span><span class="cx"> 
</span><span class="cx">         [css-counter-styles] Mark counter-style descriptors as "descriptor-only"
</span></span></pre></div>
<a id="trunkSourceWebCoreModulescacheDOMCacheEnginecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp    2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp       2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx">             isVarying = true;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        auto name = nameView.toString();
</del><ins>+        auto name = nameView.toStringWithoutCopying();
</ins><span class="cx">         isVarying = cachedRequest.httpHeaderField(name) != request.httpHeaderField(name);
</span><span class="cx">     });
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchBodyConsumercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp 2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp    2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -98,9 +98,7 @@
</span><span class="cx">         if (parameterName.length()
</span><span class="cx">             && isValidHTTPToken(parameterName)
</span><span class="cx">             && parameterValue.isAllSpecialCharacters<isHTTPQuotedStringTokenCodePoint>()) {
</span><del>-            String nameString = parameterName.toString();
-            if (!parameters.contains(nameString))
-                parameters.set(nameString, parameterValue.toString());
</del><ins>+            parameters.ensure(parameterName.toString(), [&] { return parameterValue.toString(); });
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return parameters;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp    2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -1004,7 +1004,7 @@
</span><span class="cx">     if (!equalIgnoringFragmentIdentifier(documentURL, linkURL))
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    auto linkedNode = m_renderer->document().findAnchor(fragmentIdentifier.toStringWithoutCopying());
</del><ins>+    auto linkedNode = m_renderer->document().findAnchor(fragmentIdentifier);
</ins><span class="cx">     if (!linkedNode)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp    2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp       2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -536,7 +536,7 @@
</span><span class="cx">     if (range.peek().type() != StringToken)
</span><span class="cx">         return nullptr;
</span><span class="cx">     
</span><del>-    auto string = range.consumeIncludingWhitespace().value().toString();
</del><ins>+    auto string = range.consumeIncludingWhitespace().value();
</ins><span class="cx">     
</span><span class="cx">     FontTag tag;
</span><span class="cx">     if (string.length() != tag.size())
</span><span class="lines">@@ -2303,9 +2303,11 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     
</span><span class="cx">     CSSParserToken token = args.consumeIncludingWhitespace();
</span><del>-    auto attrName = token.value().toAtomString();
</del><ins>+    AtomString attrName;
</ins><span class="cx">     if (context.isHTMLDocument)
</span><del>-        attrName = attrName.convertToASCIILowercase();
</del><ins>+        attrName = token.value().convertToASCIILowercaseAtom();
+    else
+        attrName = token.value().toAtomString();
</ins><span class="cx"> 
</span><span class="cx">     if (!args.atEnd())
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -3329,16 +3331,13 @@
</span><span class="cx">     return isGridTrackFixedSized(*minPrimitiveValue) || isGridTrackFixedSized(*maxPrimitiveValue);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNames)
</del><ins>+static Vector<String> parseGridTemplateAreasColumnNames(StringView gridRowNames)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!gridRowNames.isEmpty());
</span><span class="cx">     Vector<String> columnNames;
</span><del>-    // Using StringImpl to avoid checks and indirection in every call to String::operator[].
-    StringImpl& text = *gridRowNames.impl();
-
</del><span class="cx">     StringBuilder areaName;
</span><del>-    for (unsigned i = 0; i < text.length(); ++i) {
-        if (isCSSSpace(text[i])) {
</del><ins>+    for (auto character : gridRowNames.codeUnits()) {
+        if (isCSSSpace(character)) {
</ins><span class="cx">             if (!areaName.isEmpty()) {
</span><span class="cx">                 columnNames.append(areaName.toString());
</span><span class="cx">                 areaName.clear();
</span><span class="lines">@@ -3345,7 +3344,7 @@
</span><span class="cx">             }
</span><span class="cx">             continue;
</span><span class="cx">         }
</span><del>-        if (text[i] == '.') {
</del><ins>+        if (character == '.') {
</ins><span class="cx">             if (areaName == ".")
</span><span class="cx">                 continue;
</span><span class="cx">             if (!areaName.isEmpty()) {
</span><span class="lines">@@ -3353,7 +3352,7 @@
</span><span class="cx">                 areaName.clear();
</span><span class="cx">             }
</span><span class="cx">         } else {
</span><del>-            if (!isNameCodePoint(text[i]))
</del><ins>+            if (!isNameCodePoint(character))
</ins><span class="cx">                 return Vector<String>();
</span><span class="cx">             if (areaName == ".") {
</span><span class="cx">                 columnNames.append(areaName.toString());
</span><span class="lines">@@ -3361,7 +3360,7 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        areaName.append(text[i]);
</del><ins>+        areaName.append(character);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!areaName.isEmpty())
</span><span class="lines">@@ -3370,7 +3369,7 @@
</span><span class="cx">     return columnNames;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool parseGridTemplateAreasRow(const String& gridRowNames, NamedGridAreaMap& gridAreaMap, const size_t rowCount, size_t& columnCount)
</del><ins>+static bool parseGridTemplateAreasRow(StringView gridRowNames, NamedGridAreaMap& gridAreaMap, const size_t rowCount, size_t& columnCount)
</ins><span class="cx"> {
</span><span class="cx">     if (gridRowNames.isAllSpecialCharacters<isCSSSpace>())
</span><span class="cx">         return false;
</span><span class="lines">@@ -3595,7 +3594,7 @@
</span><span class="cx">     size_t columnCount = 0;
</span><span class="cx"> 
</span><span class="cx">     while (range.peek().type() == StringToken) {
</span><del>-        if (!parseGridTemplateAreasRow(range.consumeIncludingWhitespace().value().toString(), gridAreaMap, rowCount, columnCount))
</del><ins>+        if (!parseGridTemplateAreasRow(range.consumeIncludingWhitespace().value(), gridAreaMap, rowCount, columnCount))
</ins><span class="cx">             return nullptr;
</span><span class="cx">         ++rowCount;
</span><span class="cx">     }
</span><span class="lines">@@ -5611,7 +5610,7 @@
</span><span class="cx">             templateRows->append(lineNames.releaseNonNull());
</span><span class="cx"> 
</span><span class="cx">         // Handle a template-area's row.
</span><del>-        if (m_range.peek().type() != StringToken || !parseGridTemplateAreasRow(m_range.consumeIncludingWhitespace().value().toString(), gridAreaMap, rowCount, columnCount))
</del><ins>+        if (m_range.peek().type() != StringToken || !parseGridTemplateAreasRow(m_range.consumeIncludingWhitespace().value(), gridAreaMap, rowCount, columnCount))
</ins><span class="cx">             return false;
</span><span class="cx">         ++rowCount;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParserHelperscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp     2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp        2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -2442,9 +2442,11 @@
</span><span class="cx">     else {
</span><span class="cx">         if (!acceptQuirkyColors)
</span><span class="cx">             return std::nullopt;
</span><del>-        if (token.type() == IdentToken)
-            string = token.value().toString(); // e.g. FF0000
-        else if (token.type() == NumberToken || token.type() == DimensionToken) {
</del><ins>+        if (token.type() == IdentToken) {
+            view = token.value(); // e.g. FF0000
+            if (view.length() != 3 && view.length() != 6)
+                return std::nullopt;
+        } else if (token.type() == NumberToken || token.type() == DimensionToken) {
</ins><span class="cx">             if (token.numericValueType() != IntegerValueType)
</span><span class="cx">                 return std::nullopt;
</span><span class="cx">             auto numericValue = token.numericValue();
</span><span class="lines">@@ -2457,10 +2459,12 @@
</span><span class="cx">                 string = makeString(integerValue, token.value()); // e.g. 0001FF
</span><span class="cx">             if (string.length() < 6)
</span><span class="cx">                 string = makeString(&"000000"[string.length()], string);
</span><del>-        }
-        if (string.length() != 3 && string.length() != 6)
</del><ins>+
+            if (string.length() != 3 && string.length() != 6)
+                return std::nullopt;
+            view = string;
+        } else
</ins><span class="cx">             return std::nullopt;
</span><del>-        view = string;
</del><span class="cx">     }
</span><span class="cx">     auto result = CSSParser::parseHexColor(view);
</span><span class="cx">     if (!result)
</span><span class="lines">@@ -3559,7 +3563,7 @@
</span><span class="cx">     if (identMatches<CSSValueDecimal, CSSValueDisc, CSSValueNone>(nameToken.id()))
</span><span class="cx">         return AtomString();
</span><span class="cx">     auto name = nameToken.value();
</span><del>-    return isPredefinedCounterStyle(nameToken.id()) ? name.convertToASCIILowercase() : name.toString();
</del><ins>+    return isPredefinedCounterStyle(nameToken.id()) ? name.convertToASCIILowercaseAtom() : name.toAtomString();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::optional<CSSValueID> consumeFontVariantCSS21Raw(CSSParserTokenRange& range)
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptElement.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptElement.cpp       2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/dom/ScriptElement.cpp  2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -368,7 +368,7 @@
</span><span class="cx">     ASSERT(m_element.document().contentSecurityPolicy());
</span><span class="cx">     const auto& contentSecurityPolicy = *m_element.document().contentSecurityPolicy();
</span><span class="cx">     bool hasKnownNonce = contentSecurityPolicy.allowScriptWithNonce(nonce, m_element.isInUserAgentShadowTree());
</span><del>-    if (!contentSecurityPolicy.allowInlineScript(m_element.document().url().string(), m_startLineNumber, sourceCode.source().toStringWithoutCopying(), hasKnownNonce))
</del><ins>+    if (!contentSecurityPolicy.allowInlineScript(m_element.document().url().string(), m_startLineNumber, sourceCode.source(), hasKnownNonce))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     m_loadableScript = WTFMove(script);
</span><span class="lines">@@ -389,7 +389,7 @@
</span><span class="cx">         ASSERT(m_element.document().contentSecurityPolicy());
</span><span class="cx">         const ContentSecurityPolicy& contentSecurityPolicy = *m_element.document().contentSecurityPolicy();
</span><span class="cx">         bool hasKnownNonce = contentSecurityPolicy.allowScriptWithNonce(m_element.attributeWithoutSynchronization(HTMLNames::nonceAttr), m_element.isInUserAgentShadowTree());
</span><del>-        if (!contentSecurityPolicy.allowInlineScript(m_element.document().url().string(), m_startLineNumber, sourceCode.source().toStringWithoutCopying(), hasKnownNonce))
</del><ins>+        if (!contentSecurityPolicy.allowInlineScript(m_element.document().url().string(), m_startLineNumber, sourceCode.source(), hasKnownNonce))
</ins><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomStyledElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/StyledElement.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/StyledElement.cpp       2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/dom/StyledElement.cpp  2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx">     if (document().scriptableDocumentParser() && !document().isInDocumentWrite())
</span><span class="cx">         startLineNumber = document().scriptableDocumentParser()->textPosition().m_line;
</span><span class="cx"> 
</span><del>-    if (reason == ModifiedByCloning || document().contentSecurityPolicy()->allowInlineStyle(document().url().string(), startLineNumber, String(), isInUserAgentShadowTree()))
</del><ins>+    if (reason == ModifiedByCloning || document().contentSecurityPolicy()->allowInlineStyle(document().url().string(), startLineNumber, { }, isInUserAgentShadowTree()))
</ins><span class="cx">         setInlineStyleFromString(newStyleString);
</span><span class="cx"> 
</span><span class="cx">     elementData()->setStyleAttributeIsDirty(false);
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.cpp   2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/dom/TreeScope.cpp      2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -443,7 +443,7 @@
</span><span class="cx"> 
</span><span class="cx"> // FIXME: Would be nice to change this to take a StringView, since that's what callers have
</span><span class="cx"> // and there is no particular advantage to already having a String.
</span><del>-Element* TreeScope::findAnchor(const String& name)
</del><ins>+Element* TreeScope::findAnchor(StringView name)
</ins><span class="cx"> {
</span><span class="cx">     if (name.isEmpty())
</span><span class="cx">         return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.h (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.h     2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/dom/TreeScope.h        2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">     // for an anchor with the given name. ID matching is always case sensitive, but
</span><span class="cx">     // Anchor name matching is case sensitive in strict mode and not case sensitive in
</span><span class="cx">     // quirks mode for historical compatibility reasons.
</span><del>-    Element* findAnchor(const String& name);
</del><ins>+    Element* findAnchor(StringView name);
</ins><span class="cx"> 
</span><span class="cx">     ContainerNode& rootNode() const { return m_rootNode; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingcocoaDataDetectionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm      2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -168,7 +168,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool DataDetection::canBePresentedByDataDetectors(const URL& url)
</span><span class="cx"> {
</span><del>-    return [PAL::softLink_DataDetectorsCore_DDURLTapAndHoldSchemes() containsObject:(NSString *)url.protocol().toStringWithoutCopying().convertToASCIILowercase()];
</del><ins>+    return [PAL::softLink_DataDetectorsCore_DDURLTapAndHoldSchemes() containsObject:(NSString *)url.protocol().convertToASCIILowercase()];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool DataDetection::isDataDetectorLink(Element& element)
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp  2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/page/FrameView.cpp     2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -2209,7 +2209,7 @@
</span><span class="cx"> bool FrameView::scrollToFragment(const URL& url)
</span><span class="cx"> {
</span><span class="cx">     auto fragmentIdentifier = url.fragmentIdentifier();
</span><del>-    if (scrollToFragmentInternal(fragmentIdentifier.toString()))
</del><ins>+    if (scrollToFragmentInternal(fragmentIdentifier))
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     if (scrollToFragmentInternal(decodeURLEscapeSequences(fragmentIdentifier)))
</span><span class="lines">@@ -2219,7 +2219,7 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FrameView::scrollToFragmentInternal(const String& fragmentIdentifier)
</del><ins>+bool FrameView::scrollToFragmentInternal(StringView fragmentIdentifier)
</ins><span class="cx"> {
</span><span class="cx">     // If our URL has no ref, then we have no place we need to jump to.
</span><span class="cx">     if (fragmentIdentifier.isNull())
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.h    2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/page/FrameView.h       2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -809,7 +809,7 @@
</span><span class="cx"> 
</span><span class="cx">     void updateWidgetPositionsTimerFired();
</span><span class="cx"> 
</span><del>-    bool scrollToFragmentInternal(const String&);
</del><ins>+    bool scrollToFragmentInternal(StringView);
</ins><span class="cx">     void scrollToAnchor();
</span><span class="cx">     void scrollPositionChanged(const ScrollPosition& oldPosition, const ScrollPosition& newPosition);
</span><span class="cx">     void scrollableAreaSetChanged();
</span></span></pre></div>
<a id="trunkSourceWebCorepageSecurityOrigincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/SecurityOrigin.cpp     2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp        2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -153,7 +153,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy (Editor's Draft, 17 November 2016)
</span><del>-static bool shouldTreatAsPotentiallyTrustworthy(const String& protocol, const String& host)
</del><ins>+static bool shouldTreatAsPotentiallyTrustworthy(const String& protocol, StringView host)
</ins><span class="cx"> {
</span><span class="cx">     if (LegacySchemeRegistry::shouldTreatURLSchemeAsSecure(protocol))
</span><span class="cx">         return true;
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp  2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp     2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -322,7 +322,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<typename Predicate>
</span><del>-ContentSecurityPolicy::HashInEnforcedAndReportOnlyPoliciesPair ContentSecurityPolicy::findHashOfContentInPolicies(Predicate&& predicate, const String& content, OptionSet<ContentSecurityPolicyHashAlgorithm> algorithms) const
</del><ins>+ContentSecurityPolicy::HashInEnforcedAndReportOnlyPoliciesPair ContentSecurityPolicy::findHashOfContentInPolicies(Predicate&& predicate, StringView content, OptionSet<ContentSecurityPolicyHashAlgorithm> algorithms) const
</ins><span class="cx"> {
</span><span class="cx">     if (algorithms.isEmpty() || content.isEmpty())
</span><span class="cx">         return { false, false };
</span><span class="lines">@@ -404,7 +404,7 @@
</span><span class="cx">     return allPoliciesWithDispositionAllow(ContentSecurityPolicy::Disposition::Enforce, &ContentSecurityPolicyDirectiveList::violatedDirectiveForStyleNonce, strippedNonce);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& scriptContent, bool overrideContentSecurityPolicy) const
</del><ins>+bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, StringView scriptContent, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><span class="cx">     if (overrideContentSecurityPolicy)
</span><span class="cx">         return true;
</span><span class="lines">@@ -427,7 +427,7 @@
</span><span class="cx">     return foundHashInEnforcedPolicies || allPoliciesWithDispositionAllow(ContentSecurityPolicy::Disposition::Enforce, handleViolatedDirective, &ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeInlineScript);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& styleContent, bool overrideContentSecurityPolicy) const
</del><ins>+bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, StringView styleContent, bool overrideContentSecurityPolicy) const
</ins><span class="cx"> {
</span><span class="cx">     if (overrideContentSecurityPolicy)
</span><span class="cx">         return true;
</span></span></pre></div>
<a id="trunkSourceWebCorepagecspContentSecurityPolicyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h    2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h       2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -91,8 +91,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy = false) const;
</span><span class="cx">     bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy = false) const;
</span><del>-    bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& scriptContent, bool overrideContentSecurityPolicy = false) const;
-    bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& styleContent, bool overrideContentSecurityPolicy = false) const;
</del><ins>+    bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, StringView scriptContent, bool overrideContentSecurityPolicy = false) const;
+    bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, StringView styleContent, bool overrideContentSecurityPolicy = false) const;
</ins><span class="cx"> 
</span><span class="cx">     bool allowEval(JSC::JSGlobalObject*, bool overrideContentSecurityPolicy = false) const;
</span><span class="cx"> 
</span><span class="lines">@@ -206,7 +206,7 @@
</span><span class="cx">     bool allowResourceFromSource(const URL&, RedirectResponseReceived, const char*, ResourcePredicate) const;
</span><span class="cx"> 
</span><span class="cx">     using HashInEnforcedAndReportOnlyPoliciesPair = std::pair<bool, bool>;
</span><del>-    template<typename Predicate> HashInEnforcedAndReportOnlyPoliciesPair findHashOfContentInPolicies(Predicate&&, const String& content, OptionSet<ContentSecurityPolicyHashAlgorithm>) const WARN_UNUSED_RETURN;
</del><ins>+    template<typename Predicate> HashInEnforcedAndReportOnlyPoliciesPair findHashOfContentInPolicies(Predicate&&, StringView content, OptionSet<ContentSecurityPolicyHashAlgorithm>) const WARN_UNUSED_RETURN;
</ins><span class="cx"> 
</span><span class="cx">     void reportViolation(const String& effectiveViolatedDirective, const ContentSecurityPolicyDirective& violatedDirective, const URL& blockedURL, const String& consoleMessage, JSC::JSGlobalObject*) const;
</span><span class="cx">     void reportViolation(const String& effectiveViolatedDirective, const String& violatedDirective, const ContentSecurityPolicyDirectiveList&, const URL& blockedURL, const String& consoleMessage, JSC::JSGlobalObject* = nullptr) const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformLegacySchemeRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/LegacySchemeRegistry.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/LegacySchemeRegistry.cpp   2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/platform/LegacySchemeRegistry.cpp      2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -253,7 +253,7 @@
</span><span class="cx"> bool LegacySchemeRegistry::schemeIsHandledBySchemeHandler(StringView scheme)
</span><span class="cx"> {
</span><span class="cx">     Locker locker { schemeRegistryLock };
</span><del>-    return schemesHandledBySchemeHandler().contains(scheme.toString());
</del><ins>+    return schemesHandledBySchemeHandler().contains(scheme.toStringWithoutCopying());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static URLSchemesMap& schemesAllowingDatabaseAccessInPrivateBrowsing()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaSourceBufferParserWebMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp  2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp     2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -446,7 +446,7 @@
</span><span class="cx"> 
</span><span class="cx">         auto slashLocation = codecID.find('/');
</span><span class="cx">         auto length = slashLocation == notFound ? codecID.length() - 2 : slashLocation - 2;
</span><del>-        m_codec = AtomString { codecID.substring(2, length).convertToASCIILowercase() };
</del><ins>+        m_codec = codecID.substring(2, length).convertToASCIILowercaseAtom();
</ins><span class="cx">         return *m_codec;
</span><span class="cx">     }
</span><span class="cx">     bool isVideo() const final { return m_track.track_type.is_present() && m_track.track_type.value() == TrackType::kVideo; }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkParsedContentTypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ParsedContentType.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ParsedContentType.cpp      2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/platform/network/ParsedContentType.cpp 2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx"> static bool containsNonTokenCharacters(StringView input, Mode mode)
</span><span class="cx"> {
</span><span class="cx">     if (mode == Mode::MimeSniff)
</span><del>-        return !isValidHTTPToken(input.toStringWithoutCopying());
</del><ins>+        return !isValidHTTPToken(input);
</ins><span class="cx">     for (unsigned index = 0; index < input.length(); ++index) {
</span><span class="cx">         if (!isTokenCharacter(input[index]))
</span><span class="cx">             return true;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtexthyphenHyphenationLibHyphencpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp       2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp  2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -278,7 +278,7 @@
</span><span class="cx">     // which stores either UTF-16 or Latin1 data. This is unfortunate for performance
</span><span class="cx">     // reasons and we should consider switching to a more flexible hyphenation library
</span><span class="cx">     // if it is available.
</span><del>-    CString utf8StringCopy = string.toStringWithoutCopying().utf8();
</del><ins>+    CString utf8StringCopy = string.utf8();
</ins><span class="cx"> 
</span><span class="cx">     // WebCore often passes strings like " wordtohyphenate" to the platform layer. Since
</span><span class="cx">     // libhyphen isn't advanced enough to deal with leading spaces (presumably CoreFoundation
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTreeAsTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp      2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -471,7 +471,7 @@
</span><span class="cx">     if (behavior.contains(RenderAsTextFlag::ShowIDAndClass)) {
</span><span class="cx">         if (Element* element = is<Element>(object.node()) ? downcast<Element>(object.node()) : nullptr) {
</span><span class="cx">             if (element->hasID())
</span><del>-                ts << " id=\"" + element->getIdAttribute() + "\"";
</del><ins>+                ts << " id=\"" << element->getIdAttribute() << "\"";
</ins><span class="cx"> 
</span><span class="cx">             if (element->hasClass()) {
</span><span class="cx">                 ts << " class=\"";
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGSVGElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGSVGElement.cpp       2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp  2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -546,7 +546,7 @@
</span><span class="cx">     return transform;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGViewElement* SVGSVGElement::findViewAnchor(const String& fragmentIdentifier) const
</del><ins>+SVGViewElement* SVGSVGElement::findViewAnchor(StringView fragmentIdentifier) const
</ins><span class="cx"> {
</span><span class="cx">     auto* anchorElement = document().findAnchor(fragmentIdentifier);
</span><span class="cx">     return is<SVGViewElement>(anchorElement) ? downcast<SVGViewElement>(anchorElement): nullptr;
</span><span class="lines">@@ -558,7 +558,7 @@
</span><span class="cx">     return is<SVGSVGElement>(viewportElement) ? downcast<SVGSVGElement>(viewportElement) : nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGSVGElement* SVGSVGElement::findRootAnchor(const String& fragmentIdentifier) const
</del><ins>+SVGSVGElement* SVGSVGElement::findRootAnchor(StringView fragmentIdentifier) const
</ins><span class="cx"> {
</span><span class="cx">     if (auto* viewElement = findViewAnchor(fragmentIdentifier))
</span><span class="cx">         return findRootAnchor(viewElement);
</span><span class="lines">@@ -565,7 +565,7 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SVGSVGElement::scrollToFragment(const String& fragmentIdentifier)
</del><ins>+bool SVGSVGElement::scrollToFragment(StringView fragmentIdentifier)
</ins><span class="cx"> {
</span><span class="cx">     auto renderer = this->renderer();
</span><span class="cx">     auto view = m_viewSpec;
</span><span class="lines">@@ -616,7 +616,7 @@
</span><span class="cx">             rootElement->inheritViewAttributes(*viewElement);
</span><span class="cx">             if (auto* renderer = rootElement->renderer())
</span><span class="cx">                 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
</span><del>-            m_currentViewFragmentIdentifier = fragmentIdentifier;
</del><ins>+            m_currentViewFragmentIdentifier = fragmentIdentifier.toString();
</ins><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGSVGElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGSVGElement.h (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGSVGElement.h 2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/svg/SVGSVGElement.h    2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -84,7 +84,7 @@
</span><span class="cx"> public:
</span><span class="cx">     static Ref<SVGSVGElement> create(const QualifiedName&, Document&);
</span><span class="cx">     static Ref<SVGSVGElement> create(Document&);
</span><del>-    bool scrollToFragment(const String& fragmentIdentifier);
</del><ins>+    bool scrollToFragment(StringView fragmentIdentifier);
</ins><span class="cx">     void resetScrollAnchor();
</span><span class="cx"> 
</span><span class="cx">     using SVGGraphicsElement::ref;
</span><span class="lines">@@ -141,9 +141,9 @@
</span><span class="cx">     RefPtr<Frame> frameForCurrentScale() const;
</span><span class="cx">     Ref<NodeList> collectIntersectionOrEnclosureList(SVGRect&, SVGElement*, bool (*checkFunction)(SVGElement&, SVGRect&));
</span><span class="cx"> 
</span><del>-    SVGViewElement* findViewAnchor(const String& fragmentIdentifier) const;
</del><ins>+    SVGViewElement* findViewAnchor(StringView fragmentIdentifier) const;
</ins><span class="cx">     SVGSVGElement* findRootAnchor(const SVGViewElement*) const;
</span><del>-    SVGSVGElement* findRootAnchor(const String&) const;
</del><ins>+    SVGSVGElement* findRootAnchor(StringView) const;
</ins><span class="cx"> 
</span><span class="cx">     bool m_useCurrentView { false };
</span><span class="cx">     Ref<SMILTimeContainer> m_timeContainer;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGViewSpeccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGViewSpec.cpp (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGViewSpec.cpp 2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/svg/SVGViewSpec.cpp    2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> template<typename CharacterType> static constexpr CharacterType zoomAndPanSpec[] = {'z', 'o', 'o', 'm', 'A', 'n', 'd', 'P', 'a', 'n'};
</span><span class="cx"> template<typename CharacterType> static constexpr CharacterType viewTargetSpec[] =  {'v', 'i', 'e', 'w', 'T', 'a', 'r', 'g', 'e', 't'};
</span><span class="cx"> 
</span><del>-bool SVGViewSpec::parseViewSpec(const StringView& string)
</del><ins>+bool SVGViewSpec::parseViewSpec(StringView string)
</ins><span class="cx"> {
</span><span class="cx">     return readCharactersForParsing(string, [&](auto buffer) -> bool {
</span><span class="cx">         using CharacterType = typename decltype(buffer)::CharacterType;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGViewSpech"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGViewSpec.h (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGViewSpec.h   2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebCore/svg/SVGViewSpec.h      2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx">         return adoptRef(*new SVGViewSpec(contextElement));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool parseViewSpec(const StringView&);
</del><ins>+    bool parseViewSpec(StringView);
</ins><span class="cx">     void reset();
</span><span class="cx">     void resetContextElement() { m_contextElement = nullptr; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebViewConfigurationmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (278668 => 278669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm        2021-06-09 19:53:39 UTC (rev 278668)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm   2021-06-09 20:46:24 UTC (rev 278669)
</span><span class="lines">@@ -565,7 +565,7 @@
</span><span class="cx">     if ([WKWebView handlesURLScheme:urlScheme])
</span><span class="cx">         [NSException raise:NSInvalidArgumentException format:@"'%@' is a URL scheme that WKWebView handles natively", urlScheme];
</span><span class="cx"> 
</span><del>-    auto canonicalScheme = WTF::URLParser::maybeCanonicalizeScheme(urlScheme);
</del><ins>+    auto canonicalScheme = WTF::URLParser::maybeCanonicalizeScheme(String(urlScheme));
</ins><span class="cx">     if (!canonicalScheme)
</span><span class="cx">         [NSException raise:NSInvalidArgumentException format:@"'%@' is not a valid URL scheme", urlScheme];
</span><span class="cx"> 
</span><span class="lines">@@ -577,7 +577,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (id <WKURLSchemeHandler>)urlSchemeHandlerForURLScheme:(NSString *)urlScheme
</span><span class="cx"> {
</span><del>-    auto canonicalScheme = WTF::URLParser::maybeCanonicalizeScheme(urlScheme);
</del><ins>+    auto canonicalScheme = WTF::URLParser::maybeCanonicalizeScheme(String(urlScheme));
</ins><span class="cx">     if (!canonicalScheme)
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>