Bug 42800

Summary: Upstream Android auto hyphenation implemenation to webkit
Product: WebKit Reporter: sw <swang>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: andreip, ap, commit-queue, mitz, steveblock, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Android   
OS: Android   
Attachments:
Description Flags
Implment auto hyphenation interface for Android.
darin: review+
Implment auto hyphenation interface for Android.
none
Implement auto hyphenation interface for Android.
darin: review+, darin: commit-queue-
Implement auto hyphenation interface for Android.
darin: review+
Implement auto hyphenation interface for Android. none

Description sw 2010-07-21 18:07:09 PDT
Upstream Android auto hyphenation implemenation to webkit
Comment 1 sw 2010-07-22 11:54:11 PDT
Created attachment 62323 [details]
Implment auto hyphenation interface for Android.
Comment 2 Darin Adler 2010-07-22 12:51:03 PDT
Comment on attachment 62323 [details]
Implment auto hyphenation interface for Android.

There's a more elegant way to deal with the single hyphenation dictionary.

    static HyphenDict* dictionary = loadHyphenationDictionary();

Since you're only using it at one call site, you can use this there, and not have a "get" function. For one thing we don’t use "get" in our simple getter function names in WebKit. For another, there's no need for a separate boolean. If you did want a get function, it can be written like this.

    static HyphenDict* hyphenationDictionary()
    {
        static HyphenDict* staticDictionary = loadHyphenationDictionary();
        return staticDictionary;
    }

There's no reason for the boolean and to nest the entire function inside an if statement. It's also possibly more efficient to have the one time code out of line in a separate function.

r=me, though, as is.
Comment 3 sw 2010-07-22 13:44:21 PDT
Thanks Darin for the review approval.  Shall I ask you or Steveblock to land the patch?
Comment 4 Steve Block 2010-07-22 13:53:02 PDT
> Thanks Darin for the review approval.  Shall I ask you or Steveblock to land the patch?
I'm happy to cq+ the patch for you. It would be great if you could address Darin's comments first though.
Comment 5 sw 2010-07-22 13:58:33 PDT
I think his comments is for nice-to-have.  So I think I'll keep it as is now.
Comment 6 mitz 2010-07-22 16:52:16 PDT
Comment on attachment 62323 [details]
Implment auto hyphenation interface for Android.

> +#include "NotImplemented.h"

Is this needed?
Comment 7 sw 2010-07-22 17:09:02 PDT
it's needed for the android logging logw/logd.  thanks.
Comment 8 Steve Block 2010-07-26 02:23:12 PDT
Comment on attachment 62323 [details]
Implment auto hyphenation interface for Android.

(In reply to comment #7)
> it's needed for the android logging logw/logd.  thanks.
I'm not sure that we should rely on NotImplemented.h to provide the logging macros for Android, especially as this is not present upstream. WebCore doesn't typically use debug logging like this, but if it's really required, you should probably include the necessary headers directly.

WebCore/ChangeLog:9
 +          output may be different in Android.
Are you suggesting that we need Android-specific expected results for the layout tests? Is it possible to submit those as part of this patch?
Comment 9 sw 2010-07-26 14:42:32 PDT
Created attachment 62610 [details]
Implment auto hyphenation interface for Android.

hi, Steve/Darin/Mitz,

I address all your comments in the new patch.  I created android platform specific results.

Thanks,
Comment 10 sw 2010-07-26 14:45:34 PDT
Created attachment 62611 [details]
Implement auto hyphenation interface for Android.

fixed a style issue for the LayoutTests/ChangeLog in the latest patch.
Comment 11 WebKit Review Bot 2010-07-26 14:45:59 PDT
Attachment 62610 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
LayoutTests/ChangeLog:6:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Darin Adler 2010-07-26 15:25:23 PDT
Comment on attachment 62611 [details]
Implement auto hyphenation interface for Android.

> +        No new tests. (OOPS!)

You need to remove this, or we can't land it. The only OOPS is on the reviewer line, because the landing script edits that line. Any other OOPS will prevent the patch from landing.

Patch otherwise seems fine. r=me, but you’ll need to submit a new patch if you want the commit-queue to work.
Comment 13 mitz 2010-07-26 15:26:27 PDT
Comment on attachment 62611 [details]
Implement auto hyphenation interface for Android.

> +    if (!hnj_hyphen_hyphenate(dict, word, length, hyphens))
> +        for (size_t i = beforeIndex - 1; i > 0; --i) {
> +            if (hyphens[i] & 1)
> +                return i + 1;
> +        }

There should be braces around the multi-line if block.
Comment 14 sw 2010-07-26 15:29:14 PDT
Created attachment 62621 [details]
Implement auto hyphenation interface for Android.

Thanks Darin for review.  Removed the test OOPS.
Comment 15 sw 2010-07-26 15:34:15 PDT
Created attachment 62622 [details]
Implement auto hyphenation interface for Android.

added braces per Mitz' review.  Thanks Darin and Mitz for reviewing.
Comment 16 WebKit Commit Bot 2010-07-26 16:12:07 PDT
Comment on attachment 62622 [details]
Implement auto hyphenation interface for Android.

Clearing flags on attachment: 62622

Committed r64087: <http://trac.webkit.org/changeset/64087>
Comment 17 WebKit Commit Bot 2010-07-26 16:12:12 PDT
All reviewed patches have been landed.  Closing bug.