WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
160628
Simplify valueToUSVString
https://bugs.webkit.org/show_bug.cgi?id=160628
Summary
Simplify valueToUSVString
Darin Adler
Reported
2016-08-05 21:18:50 PDT
Simplify valueToUSVString
Attachments
Patch
(3.75 KB, patch)
2016-08-05 21:27 PDT
,
Darin Adler
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Darin Adler
Comment 1
2016-08-05 21:27:05 PDT
Created
attachment 285479
[details]
Patch
Darin Adler
Comment 2
2016-08-05 21:29:28 PDT
Note that the String::find function calls its function on each code unit, not each code point, so it can't be used to find unpaired surrogates. Instead it was finding all surrogates.
Darin Adler
Comment 3
2016-08-05 21:33:48 PDT
Comment on
attachment 285479
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=285479&action=review
> Source/WebCore/bindings/js/JSDOMBinding.cpp:141 > + bool foundUnpairedSurrogate = false; > + for (auto codePoint : view.codePoints()) { > + if (U_IS_SURROGATE(codePoint)) { > + foundUnpairedSurrogate = true; > + break; > + } > + } > + if (!foundUnpairedSurrogate) > + return string;
Or I could write a StringView::contains that takes a function that takes a UChar32 and have it iterate code points to remove this loop from this function. To do that I would presumably rename CharacterMatchFunction to CodeUnitMatchFunction and then add a CodePointMatchFunction type. But function pointers are inefficient. I wonder if there is a simple way to write a version that will inline the lambda that is passed in. (Strangely I noticed we have both CharacterMatchFunction in StringView.h and CharacterMatchFunctionPtr in StringImpl.h. We also have a function named stripWhiteSpace that strips arbitrary code units and simplifyWhiteSpace that "simplifies" arbitrary code units. Needs some cleanup I think.)
WebKit Commit Bot
Comment 4
2016-08-06 11:20:37 PDT
Comment on
attachment 285479
[details]
Patch Clearing flags on attachment: 285479 Committed
r204228
: <
http://trac.webkit.org/changeset/204228
>
WebKit Commit Bot
Comment 5
2016-08-06 11:20:43 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug