[webkit-changes] [WebKit/WebKit] 4b6eae: Remove String::stripWhiteSpace()

Anne van Kesteren noreply at github.com
Wed May 24 03:14:30 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4b6eaec45e978ed59f9161c88f8e978ad7fba925
      https://github.com/WebKit/WebKit/commit/4b6eaec45e978ed59f9161c88f8e978ad7fba925
  Author: Anne van Kesteren <annevk at annevk.nl>
  Date:   2023-05-24 (Wed, 24 May 2023)

  Changed paths:
    M Source/WTF/wtf/text/StringImpl.cpp
    M Source/WTF/wtf/text/StringImpl.h
    M Source/WTF/wtf/text/WTFString.cpp
    M Source/WTF/wtf/text/WTFString.h
    M Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp
    M Source/WebCore/accessibility/AccessibilityNodeObject.cpp
    M Source/WebCore/css/parser/CSSParserImpl.cpp
    M Source/WebCore/dom/ImageOverlay.cpp
    M Source/WebCore/dom/ScriptElement.cpp
    M Source/WebCore/editing/TextManipulationController.cpp
    M Source/WebCore/editing/TypingCommand.cpp
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/html/HTMLOptGroupElement.cpp
    M Source/WebCore/html/ValidatedFormListedElement.cpp
    M Source/WebCore/inspector/InspectorStyleSheet.cpp
    M Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp
    M Source/WebCore/platform/LocalizedStrings.cpp
    M Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
    M Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp
    M Source/WebCore/platform/gtk/SelectionData.cpp
    M Source/WebCore/platform/ios/DragImageIOS.mm
    M Source/WebCore/platform/mac/PasteboardMac.mm
    M Source/WebCore/platform/mac/PasteboardWriter.mm
    M Source/WebCore/platform/network/MIMEHeader.cpp
    M Source/WebCore/platform/network/ParsedContentType.cpp
    M Source/WebCore/platform/network/curl/CookieUtil.cpp
    M Source/WebCore/platform/network/curl/CurlMultipartHandle.cpp
    M Source/WebCore/platform/network/curl/CurlRequest.cpp
    M Source/WebCore/platform/network/curl/ResourceResponseCurl.cpp
    M Source/WebCore/platform/text/PlatformLocale.cpp
    M Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp
    M Source/WebCore/rendering/RenderMenuList.cpp
    M Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp
    M Source/WebCore/svg/properties/SVGPropertyTraits.h
    M Source/WebCore/xml/XPathGrammar.cpp
    M Source/WebCore/xml/XPathGrammar.y
    M Source/WebKit/UIProcess/API/glib/WebKitOptionMenuItemPrivate.h
    M Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm
    M Tools/TestWebKitAPI/Tests/WebCore/DisplayListRecorderTests.cpp

  Log Message:
  -----------
  Remove String::stripWhiteSpace()
https://bugs.webkit.org/show_bug.cgi?id=257191
rdar://109703510

Reviewed by Darin Adler.

The name is too generic as there are many flavors of whitespace and it
used a deprecated whitespace variant to boot.

This changes deprecatedIsSpaceOrNewline, its inverse, and
isUnicodeWhitespace to use UChar. This is more compatible with the
various templates and White_Space does not go beyond U+3000 (and if it
ever did go beyond UChar we'd have to change the callers somehow anyway
to account for that).

This change exports StringImpl::stripLeadingAndTrailingCharacters() so
it can be used by XPathGrammar.cpp.

This change updates XPathGrammar.y with some changes that were made to
XPathGrammar.cpp directly. Unfortunately I was not able to backport all
changes. https://bugs.webkit.org/show_bug.cgi?id=257189 tracks
completing that work.

* Source/WTF/wtf/text/StringImpl.cpp:
(WTF::StringImpl::stripWhiteSpace): Deleted.
* Source/WTF/wtf/text/StringImpl.h:
(WTF::deprecatedIsSpaceOrNewline):
(WTF::isUnicodeWhitespace):
(WTF::deprecatedIsNotSpaceOrNewline):

Make it more clear that isUnicodeWhitespace is not deprecated by
separating it out.

* Source/WTF/wtf/text/WTFString.cpp:
(WTF::String::stripWhiteSpace const): Deleted.
* Source/WTF/wtf/text/WTFString.h:
* Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp:
(WebCore::ApplicationManifestParser::parseGenericString):
* Source/WebCore/accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::computeAccessibilityIsIgnored const):
(WebCore::AccessibilityNodeObject::textUnderElement const):

Use isAllSpecialCharacters instead as that's more efficient.

* Source/WebCore/css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeSupportsRule):
* Source/WebCore/dom/ImageOverlay.cpp:
(WebCore::ImageOverlay::updateSubtree):

Use StringViews for efficiency.

* Source/WebCore/dom/ScriptElement.cpp:
(WebCore::ScriptElement::determineScriptType const):
* Source/WebCore/editing/TextManipulationController.cpp:
(WebCore::areEqualIgnoringLeadingAndTrailingWhitespaces):

Inline this comparison for now as there's only one and use StringView
for efficiency.

* Source/WebCore/editing/TypingCommand.cpp:
(WebCore::TypingCommand::markMisspellingsAfterTyping):
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaSessionTitle const):
* Source/WebCore/html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::groupLabelText const):
* Source/WebCore/html/ValidatedFormListedElement.cpp:
(WebCore::ValidatedFormListedElement::updateVisibleValidationMessage):
* Source/WebCore/inspector/InspectorStyleSheet.cpp:
(WebCore::selectorsFromSource):
* Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::checkMediaType):

Use StringView for efficiency and add a FIXME for additional possible
cleanup.

* Source/WebCore/platform/LocalizedStrings.cpp:
(WebCore::truncatedStringForMenuItem):
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::isMediaDiskCacheDisabled):

Add a FIXME to indicate this could probably be improved.

* Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
(WebCore::SourceBufferPrivateGStreamer::platformMaximumBufferSize const):
* Source/WebCore/platform/gtk/SelectionData.cpp:
(WebCore::SelectionData::setURIList):
* Source/WebCore/platform/ios/DragImageIOS.mm:
(WebCore::createDragImageForLink):
* Source/WebCore/platform/mac/PasteboardMac.mm:
(WebCore::writeURLForTypes):
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
* Source/WebCore/platform/mac/PasteboardWriter.mm:
(WebCore::createPasteboardWriter):

Add a FIXME to indicate this could probably be improved.

* Source/WebCore/platform/network/MIMEHeader.cpp:
(WebCore::retrieveKeyValuePairs):
(WebCore::MIMEHeader::parseHeader):
* Source/WebCore/platform/network/ParsedContentType.cpp:
(WebCore::ParsedContentType::setContentType):
* Source/WebCore/platform/network/curl/CookieUtil.cpp:
(WebCore::CookieUtil::parseCookieAttributes):
(WebCore::CookieUtil::parseCookieHeader):
* Source/WebCore/platform/network/curl/CurlMultipartHandle.cpp:
(WebCore::CurlMultipartHandle::extractBoundary):
* Source/WebCore/platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::didReceiveDebugInfo):
* Source/WebCore/platform/network/curl/ResourceResponseCurl.cpp:
(WebCore::ResourceResponse::appendHTTPHeaderField):
* Source/WebCore/platform/text/PlatformLocale.cpp:
(WebCore::Locale::convertFromLocalizedNumber):
* Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::extractMarkupFromCFHTML):
(WebCore::fragmentFromCFHTML):
* Source/WebCore/rendering/RenderMenuList.cpp:
(RenderMenuList::setTextFromOption):
* Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp:
(WebCore::SVGAnimationColorFunction::calculateDistance const):
* Source/WebCore/svg/properties/SVGPropertyTraits.h:
(WebCore::SVGPropertyTraits<Color>::fromString):
(WebCore::SVGPropertyTraits<Color>::parse):
* Source/WebCore/xml/XPathGrammar.cpp:
* Source/WebCore/xml/XPathGrammar.y:
* Source/WebKit/UIProcess/API/glib/WebKitOptionMenuItemPrivate.h:
(_WebKitOptionMenuItem::_WebKitOptionMenuItem):
* Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
(WebKit::WebPopupMenuProxyGtk::createPopupMenu):
* Source/WebKit/WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
(WebKit::WebContextMenuClient::searchWithGoogle):
* Source/WebKit/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
(WebKit::WebContextMenuClient::searchWithGoogle):
* Tools/TestWebKitAPI/Tests/WebCore/DisplayListRecorderTests.cpp:

Canonical link: https://commits.webkit.org/264468@main




More information about the webkit-changes mailing list