Bug 137352

Summary: Back TextRun with a StringView
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, dino, jonlee, koivisto, simon.fraser, thorton, zalan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch koivisto: review+

Description Myles C. Maxfield 2014-10-02 11:42:30 PDT
Back TextRun with a StringView
Comment 1 Myles C. Maxfield 2014-10-02 11:44:28 PDT
Created attachment 239124 [details]
Patch
Comment 2 Antti Koivisto 2014-10-02 12:25:47 PDT
Comment on attachment 239124 [details]
Patch

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

> Source/WebCore/platform/graphics/TextRun.h:219
> +    StringView m_data;

m_data is not very descriptive. Just m_string perhaps?
Comment 3 Antti Koivisto 2014-10-02 12:29:15 PDT
Comment on attachment 239124 [details]
Patch

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

>> Source/WebCore/platform/graphics/TextRun.h:219
>> +    StringView m_data;
> 
> m_data is not very descriptive. Just m_string perhaps?

Or m_text.
Comment 4 Antti Koivisto 2014-10-02 12:31:20 PDT
Comment on attachment 239124 [details]
Patch

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

> Source/WebCore/platform/graphics/TextRun.h:160
> +    String string() const { return m_data.toString(); }

This should be called text() to match setText.

> Source/WebCore/platform/graphics/TextRun.h:193
> +    StringView stringView() const { return m_data; }

I don't see any clients to this accessor. Is it needed? If not, please remove it.

>>> Source/WebCore/platform/graphics/TextRun.h:219
>>> +    StringView m_data;
>> 
>> m_data is not very descriptive. Just m_string perhaps?
> 
> Or m_text.

Or m_text.
Comment 5 Antti Koivisto 2014-10-02 12:36:38 PDT
Comment on attachment 239124 [details]
Patch

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

>> Source/WebCore/platform/graphics/TextRun.h:160
>> +    String string() const { return m_data.toString(); }
> 
> This should be called text() to match setText.

Hmm, I guess the name is ok for something that constructs a String. It would be better to have an accessor called text() that returns a StringView and leave it to the callers to construct a String if they really need it.
Comment 6 Myles C. Maxfield 2014-10-02 13:24:29 PDT
Comment on attachment 239124 [details]
Patch

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

>>> Source/WebCore/platform/graphics/TextRun.h:160
>>> +    String string() const { return m_data.toString(); }
>> 
>> This should be called text() to match setText.
> 
> Hmm, I guess the name is ok for something that constructs a String. It would be better to have an accessor called text() that returns a StringView and leave it to the callers to construct a String if they really need it.

I've kept this and renamed stringView() to text(). Done.

>> Source/WebCore/platform/graphics/TextRun.h:193
>> +    StringView stringView() const { return m_data; }
> 
> I don't see any clients to this accessor. Is it needed? If not, please remove it.

Done.

>>>> Source/WebCore/platform/graphics/TextRun.h:219
>>>> +    StringView m_data;
>>> 
>>> m_data is not very descriptive. Just m_string perhaps?
>> 
>> Or m_text.
> 
> Or m_text.

Done.
Comment 7 Myles C. Maxfield 2014-10-02 13:55:01 PDT
http://trac.webkit.org/changeset/174228