Fix some minor problems in the StringImpl header
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Nov 2017 02:44:45 +0000 (02:44 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Nov 2017 02:44:45 +0000 (02:44 +0000)
commit14057ad8f8377eb57c5a9017279b6b11b84cebf5
tree6dbefed205c1993a17eead7981bce7d68cf373bc
parent8e519072dba3b9d5a5944baeb3a5b6e8c5a85bd5
Fix some minor problems in the StringImpl header
https://bugs.webkit.org/show_bug.cgi?id=160630

Reviewed by Brent Fulgham.

Source/JavaScriptCore:

* inspector/ContentSearchUtilities.cpp: Removed a lot of unneeded explicit
Yarr namespacing since we use "using namespace" in this file.

Source/WebCore:

* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::text): Use stripLeadingAndTrailingHTMLSpaces
instead of stripWhiteSpace(isHTMLSpace).
(WebCore::HTMLOptionElement::value): Ditto.
(WebCore::HTMLOptionElement::label): Ditto.
(WebCore::HTMLOptionElement::displayLabel): Ditto.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument): Use stripLeadingAndTrailingHTMLSpaces
instead of calling the general purpose one and passing isHTMLSpace.
* platform/network/HTTPParsers.h:
(WebCore::stripLeadingAndTrailingHTTPSpaces): Updated to use the
new name, stripLeadingAndTrailingCharacters.

Source/WTF:

* wtf/text/AtomicString.h: Update since CharacterMatchFunctionPtr is now
CodeUnitMatchFunction.

* wtf/text/StringCommon.h: Added CodeUnitMatchFunction, which replaces
CharacterMatchFunctionPtr.

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::stripMatchedCharacters): Changed template argument name
to CodeUnitPredicate to help make it clear this works on code units, not
code points.
(WTF::UCharPredicate): Deleted.
(WTF::SpaceOrNewlinePredicate): Deleted.
(WTF::StringImpl::stripWhiteSpace): Removed unneeded use of predicate class to
turn a function into a functor; functions already work fine as functors without
a class wrapping them.
(WTF::StringImpl::stripLeadingAndTrailingCharacters): Ditto. Also renamed
from stripWhiteSpace, since it strips arbitrary characters.
(WTF::StringImpl::removeCharacters): Fixed various minor style issues and
updated to new type name.
(WTF::StringImpl::simplifyMatchedCharactersToSpace): Ditto.
(WTF::StringImpl::simplifyWhiteSpace): More of the same.
(WTF::StringImpl::find): Ditto.

* wtf/text/StringImpl.h: Removed unneeded include of uchar.h, since it's
included by StringCommon.h. Removed =CharacterMatchFunctionPtr and
IsWhiteSpaceFunctionPtr, both replaced by CodeUnitMatchFunction. Fixed
a mistake recently introduced in isSpaceOrNewline, which was unnecessarily,
inefficiently using ICU for non-ASCII Latin-1 characters.

* wtf/text/StringView.h: Use CodeUnitMatchFunction instead of CharacterMatchFunction.

* wtf/text/WTFString.cpp:
(WTF::String::stripLeadingAndTrailingCharacters): Updated function name and type.
(WTF::String::simplifyWhiteSpace): Updated type.
(WTF::String::removeCharacters): Updated type.
* wtf/text/WTFString.h: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225144 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/text/AtomicString.h
Source/WTF/wtf/text/StringCommon.h
Source/WTF/wtf/text/StringImpl.cpp
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/StringView.h
Source/WTF/wtf/text/WTFString.cpp
Source/WTF/wtf/text/WTFString.h
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLOptionElement.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/platform/network/HTTPParsers.h