-
andersca@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=126644 Reviewed by Antti Koivisto. Source/WebCore: Use a StringView in TextCheckerClient::checkTextOfParagraph to avoid upconverting strings unnecessarily. * editing/TextCheckingHelper.cpp: (WebCore::checkTextOfParagraph): Pass a StringView to TextCheckerClient::checkTextOfParagraph. * loader/EmptyClients.h: Update for TextCheckerClient changes. * platform/text/TextCheckerClient.h: Change TextCheckerClient::checkTextOfParagraph to take a StringView. Source/WebKit/efl: Update to match WebCore changes. * WebCoreSupport/EditorClientEfl.h: (WebCore::EditorClientEfl::checkTextOfParagraph): Source/WebKit/mac: * WebCoreSupport/WebEditorClient.h: * WebCoreSupport/WebEditorClient.mm: (WebEditorClient::checkTextOfParagraph): Update to match the new signature. (nsStringWithoutCopying): New function that creates an NSString that references StringView data without copying the data. (If this function proves to be useful elsewhere, it could potentially be added to StringView). Source/WebKit2: Use a StringView and remove a FIXME. * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::checkTextOfParagraph): * WebProcess/WebCoreSupport/WebEditorClient.h: Source/WTF: Add a new StringView class which is an immutable reference to either an 8-bit or a 16-bit string. This makes it easier to pass substrings around without having to either copy string data or upconvert and use UChar pointers. The StringView class is very loosely based on the std::string_view class which is proposed for a future version of C++, see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3609.html for more details. * GNUmakefile.list.am: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Forward.h: * wtf/text/StringView.h: Added. (WTF::StringView::StringView): (WTF::StringView::empty): (WTF::StringView::characters8): (WTF::StringView::characters16): (WTF::StringView::isEmpty): (WTF::StringView::length): (WTF::StringView::is8Bit): (WTF::StringView::substring): (WTF::StringView::toString): (WTF::StringView::toStringWithoutCopying): (WTF::StringView::encodedCharacters): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161518 268f45cc-cd09-0410-ab3c-d52691b4dbfc
a2cf5704