Bug 161885 - Fix post-landing review comments after r205787
Summary: Fix post-landing review comments after r205787
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks: 161669
  Show dependency treegraph
 
Reported: 2016-09-12 16:44 PDT by Chris Dumez
Modified: 2016-09-12 19:15 PDT (History)
2 users (show)

See Also:


Attachments
Patch (12.77 KB, patch)
2016-09-12 16:48 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (12.03 KB, patch)
2016-09-12 18:42 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-09-12 16:44:38 PDT
Fix post-landing review comments after r205787.
Comment 2 Chris Dumez 2016-09-12 16:48:36 PDT
Created attachment 288639 [details]
Patch
Comment 3 Darin Adler 2016-09-12 18:16:42 PDT
Comment on attachment 288639 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=288639&action=review

Looks good.

> Source/WTF/wtf/text/StringBuilder.cpp:309
> +#if USE(CF)

Other classes use a separate source file for the CF stuff. But I suppose it’s too much to ask to add a StringBuilderCF.cpp just for this.

> Source/WTF/wtf/text/StringBuilder.cpp:314
> +    if (auto* characters = CFStringGetCStringPtr(string, kCFStringEncodingASCII)) {

Why not kCFStringEncodingISOLatin1? It seems a little strange that this code is so different from the code in StringCF.cpp.

> Source/WTF/wtf/text/StringBuilder.h:110
> +#if USE(CF)
> +    WTF_EXPORT_PRIVATE void append(CFStringRef);
> +#ifdef __OBJC__
> +    void append(NSString *string) { append((__bridge CFStringRef)string); }
> +#endif
> +#endif

In the past I have often written these as separate if statements just to avoid hard-to-read nesting.

#if USE(CF)
    WTF_EXPORT_PRIVATE void append(CFStringRef);
#endif
#if USE(CF) && defined(__OBJC__)
    void append(NSString *string) { append((__bridge CFStringRef)string); }
#endif

I think that’s slightly better.

> Source/WebCore/html/parser/HTMLParserIdioms.cpp:366
> -    Optional<unsigned> number = parseHTMLNonNegativeInteger(StringView(numberStart, position - numberStart));
> +    Optional<unsigned> number = parseHTMLNonNegativeInteger({ numberStart, static_cast<unsigned>(position - numberStart) });

Darn, that cast to unsigned we need here makes it not quite as great as I had hoped.
Comment 4 Chris Dumez 2016-09-12 18:42:11 PDT
Created attachment 288654 [details]
Patch
Comment 5 WebKit Commit Bot 2016-09-12 19:14:56 PDT
Comment on attachment 288654 [details]
Patch

Clearing flags on attachment: 288654

Committed r205847: <http://trac.webkit.org/changeset/205847>
Comment 6 WebKit Commit Bot 2016-09-12 19:15:02 PDT
All reviewed patches have been landed.  Closing bug.