Bug 74383

Summary: Upstream PlatformMouseEvent and LocalizedStrings into WebCore/platform/blackberry
Product: WebKit Reporter: Mary Wu <mawu>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: dbates, rakuco, tonikitoo, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 73144    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Mary Wu 2011-12-13 00:03:22 PST
Upstream PlatformMouseEvent and LocalizedString into WebCore/platform/blackberry: 
LocalizedStringsBlackBerry.cpp, PlatformMouseEventBlackBerry.cpp
Comment 1 Mary Wu 2011-12-13 00:31:03 PST
Created attachment 118968 [details]
Patch
Comment 2 Rob Buis 2011-12-13 05:20:58 PST
Comment on attachment 118968 [details]
Patch

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

> Source/WebCore/ChangeLog:10
> +        Rob Buis  <rbuis@rim.com>

I think there were more contributors, for instance I dont think I touched PlatformMouseEvent.

> Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp:72
> +    // however, WebCore wants a '-' (e.g. en_us should read en-us)

Comment should be a sentence.

> Source/WebCore/platform/blackberry/PlatformMouseEventBlackBerry.cpp:36
> +    , m_timestamp(WTF::currentTime())

Is the WTF prefix needed?
Comment 3 Rob Buis 2011-12-13 05:21:58 PST
Comment on attachment 118968 [details]
Patch

Clearing r? flag for now, see my comments.
Comment 4 Mary Wu 2011-12-13 18:02:43 PST
Created attachment 119125 [details]
Patch
Comment 5 Daniel Bates 2011-12-13 18:30:51 PST
Comment on attachment 119125 [details]
Patch

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

> Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp:24
> +

Nit: I suggest that we remove this empty line as I don't feel it improves the readability of this file.

> Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp:68
> +String platformDefaultLanguage()

Would it make sense to re-write this function using WTF::String functions instead of using the std::string routines? That is, can we just convert BlackBerry::Platform::Client::get()->getLocale() to a WTF::String then manipulate it as as such? I suggest taking this approach since the WTF::String functions tend to be a bit more concise and at the end of the day we want to return a WTF::String.

> Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp:71
> +    // getLocale() returns a POSIX lcoale which uses '_' to separate language and country

lcoale => locale.

country => country.

> Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp:72
> +    // however, we use '-' instead of '_' in WebCore (e.g. en_us should read en-us)

however => However

Missing period at the end of this line.
Comment 6 Mary Wu 2011-12-14 00:20:55 PST
Created attachment 119170 [details]
Patch
Comment 7 Mary Wu 2011-12-14 22:44:16 PST
Created attachment 119381 [details]
Patch
Comment 8 Daniel Bates 2011-12-15 19:18:20 PST
Comment on attachment 119381 [details]
Patch

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

Thanks Mary for updating the patch. Notice that most of these these methods build a WTF::String object from a C-string. We should probably leak the WTF::String objects if these methods are called frequently instead of building a WTF::String object on each method call.

> Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp:587
> +}

Do we need to use String::fromUTF8 here? It seems like it would be sufficient to write this as:

return String(", ...");
Comment 9 Daniel Bates 2011-12-15 19:20:13 PST
Comment on attachment 119381 [details]
Patch

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

> Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp:586
> +    return String::fromUTF8(", ...");

I meant to add the "return String(", ...");" remark to this line.
Comment 10 Mary Wu 2011-12-15 23:51:34 PST
(In reply to comment #8)
> (From update of attachment 119381 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=119381&action=review
> 
> Thanks Mary for updating the patch. Notice that most of these these methods build a WTF::String object from a C-string. We should probably leak the WTF::String objects if these methods are called frequently instead of building a WTF::String object on each method call.
> 


yes, thanks for the comments...those are used in file buttons and context menu which we seldom used, and looks other portings didn't leak WTF::String objects either. So I think maybe we could keep it is here for now.
Comment 11 Mary Wu 2011-12-20 19:15:40 PST
Created attachment 120135 [details]
Patch
Comment 12 Daniel Bates 2011-12-20 20:42:57 PST
Comment on attachment 120135 [details]
Patch

Thanks for the updated patch.
Comment 13 WebKit Review Bot 2011-12-20 23:36:44 PST
Comment on attachment 120135 [details]
Patch

Clearing flags on attachment: 120135

Committed r103391: <http://trac.webkit.org/changeset/103391>
Comment 14 WebKit Review Bot 2011-12-20 23:36:49 PST
All reviewed patches have been landed.  Closing bug.