[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:28:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit abe30deaefce215e82cebe1d5312d25c7c662c62
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jul 26 23:11:55 2010 +0000

    2010-07-26  Shimeng (Simon) Wang  <swang at google.com>
    
            Reviewed by Darin Adler.
    
            Add android specific expected test results for auto hyphenation
            tests.
    
            * platform/android: Added.
            * platform/android/fast: Added.
            * platform/android/fast/text: Added.
            * platform/android/fast/text/hyphenate-character-expected.txt: Added.
            * platform/android/fast/text/hyphens-expected.txt: Added.
    2010-07-26  Shimeng (Simon) Wang  <swang at google.com>
    
            Reviewed by Darin Adler.
    
            Add auto hyphenation support for Android.
            https://bugs.webkit.org/show_bug.cgi?id=42800
    
            * platform/text/android/HyphenationAndroid.cpp: Added.
            (WebCore::loadHyphenationDictionary):
            (WebCore::lastHyphenLocation):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64087 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index de47738..c93d156 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-07-26  Shimeng (Simon) Wang  <swang at google.com>
+
+        Reviewed by Darin Adler.
+
+        Add android specific expected test results for auto hyphenation
+        tests.
+
+        * platform/android: Added.
+        * platform/android/fast: Added.
+        * platform/android/fast/text: Added.
+        * platform/android/fast/text/hyphenate-character-expected.txt: Added.
+        * platform/android/fast/text/hyphens-expected.txt: Added.
+
 2010-07-26  Darin Adler  <darin at apple.com>
 
         Reviewed by Eric Carlson.
diff --git a/LayoutTests/platform/android/fast/text/hyphenate-character-expected.txt b/LayoutTests/platform/android/fast/text/hyphenate-character-expected.txt
new file mode 100644
index 0000000..1ed68b7
--- /dev/null
+++ b/LayoutTests/platform/android/fast/text/hyphenate-character-expected.txt
@@ -0,0 +1,118 @@
+layer at (0,0) size 356x1211
+  RenderView at (0,0) size 313x483
+layer at (0,0) size 356x1211
+  RenderBlock {HTML} at (0,0) size 313x483
+    RenderBody {BODY} at (8,8) size 297x467
+      RenderBlock (floating) {DIV} at (4,0) size 344x296
+        RenderBlock {P} at (0,16) size 344x19
+          RenderText {#text} at (0,0) size 227x19
+            text run at (0,0) width 227: "The initial value (should be like "
+          RenderInline {TT} at (0,0) size 32x15
+            RenderText {#text} at (227,4) size 32x15
+              text run at (227,4) width 32: "auto"
+          RenderText {#text} at (259,0) size 5x19
+            text run at (259,0) width 5: ")"
+        RenderBlock {DIV} at (0,51) size 344x245 [border: (3px solid #000000)]
+          RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+          RenderText {#text} at (7,7) size 330x231
+            text run at (7,7) width 245: "The chief difficulty Alice"
+            text run at (7,28) width 245: "found at first was in manag"
+            text run at (7,49) width 79: "ing her "
+            text run at (86,49) width 166: "flamingo: she suc"
+            text run at (7,70) width 245: "ceeded in getting its body"
+            text run at (7,91) width 147: "tucked away, "
+            text run at (154,91) width 98: "comfortably"
+            text run at (7,112) width 330: "enough, under her arm, with its legs"
+            text run at (7,133) width 125: "hanging down, "
+            text run at (132,133) width 205: "but generally, just as she"
+            text run at (7,154) width 298: "had got its neck nicely straightened "
+            text run at (305,154) width 32: "out,"
+            text run at (7,175) width 330: "and was going to give the hedgehog a"
+            text run at (7,196) width 186: "blow with its head, it "
+            text run at (193,196) width 144: "would twist itself"
+            text run at (7,217) width 260: "round and look up in her face\x{2026}"
+      RenderBlock (floating) {DIV} at (4,296) size 344x296
+        RenderBlock {P} at (0,16) size 344x19
+          RenderText {#text} at (0,0) size 91x19
+            text run at (0,0) width 91: "The default ("
+          RenderInline {TT} at (0,0) size 198x15
+            RenderText {#text} at (91,4) size 198x15
+              text run at (91,4) width 198: "hyphenate-character: auto"
+          RenderText {#text} at (289,0) size 5x19
+            text run at (289,0) width 5: ")"
+        RenderBlock {DIV} at (0,51) size 344x245 [border: (3px solid #000000)]
+          RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+          RenderText {#text} at (7,7) size 330x231
+            text run at (7,7) width 245: "The chief difficulty Alice"
+            text run at (7,28) width 245: "found at first was in manag"
+            text run at (7,49) width 79: "ing her "
+            text run at (86,49) width 166: "flamingo: she suc"
+            text run at (7,70) width 245: "ceeded in getting its body"
+            text run at (7,91) width 147: "tucked away, "
+            text run at (154,91) width 98: "comfortably"
+            text run at (7,112) width 330: "enough, under her arm, with its legs"
+            text run at (7,133) width 125: "hanging down, "
+            text run at (132,133) width 205: "but generally, just as she"
+            text run at (7,154) width 298: "had got its neck nicely straightened "
+            text run at (305,154) width 32: "out,"
+            text run at (7,175) width 330: "and was going to give the hedgehog a"
+            text run at (7,196) width 186: "blow with its head, it "
+            text run at (193,196) width 144: "would twist itself"
+            text run at (7,217) width 260: "round and look up in her face\x{2026}"
+      RenderBlock (floating) {DIV} at (4,592) size 344x296
+        RenderBlock {P} at (0,16) size 344x19
+          RenderText {#text} at (0,0) size 51x19
+            text run at (0,0) width 51: "Bullet ("
+          RenderInline {TT} at (0,0) size 221x15
+            RenderText {#text} at (51,4) size 221x15
+              text run at (51,4) width 221: "hyphenate-character: \"\\2022\""
+          RenderText {#text} at (272,0) size 5x19
+            text run at (272,0) width 5: ")"
+        RenderBlock {DIV} at (0,51) size 344x245 [border: (3px solid #000000)]
+          RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+          RenderText {#text} at (7,7) size 330x231
+            text run at (7,7) width 245: "The chief difficulty Alice"
+            text run at (7,28) width 245: "found at first was in manag"
+            text run at (7,49) width 78: "ing her "
+            text run at (85,49) width 167: "flamingo: she suc"
+            text run at (7,70) width 245: "ceeded in getting its body"
+            text run at (7,91) width 147: "tucked away, "
+            text run at (154,91) width 98: "comfortably"
+            text run at (7,112) width 330: "enough, under her arm, with its legs"
+            text run at (7,133) width 125: "hanging down, "
+            text run at (132,133) width 205: "but generally, just as she"
+            text run at (7,154) width 298: "had got its neck nicely straightened "
+            text run at (305,154) width 32: "out,"
+            text run at (7,175) width 330: "and was going to give the hedgehog a"
+            text run at (7,196) width 186: "blow with its head, it "
+            text run at (193,196) width 144: "would twist itself"
+            text run at (7,217) width 260: "round and look up in her face\x{2026}"
+      RenderBlock (floating) {DIV} at (4,888) size 344x315
+        RenderBlock {P} at (0,16) size 344x38
+          RenderText {#text} at (0,0) size 156x19
+            text run at (0,0) width 156: "Middle dot and tilde ("
+          RenderInline {TT} at (0,0) size 314x34
+            RenderText {#text} at (156,4) size 314x34
+              text run at (156,4) width 158: "hyphenate-character:"
+              text run at (0,23) width 47: "\"\\B7~\""
+          RenderText {#text} at (47,19) size 5x19
+            text run at (47,19) width 5: ")"
+        RenderBlock {DIV} at (0,70) size 344x245 [border: (3px solid #000000)]
+          RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+          RenderText {#text} at (7,7) size 330x231
+            text run at (7,7) width 245: "The chief difficulty Alice"
+            text run at (7,28) width 245: "found at first was in manag"
+            text run at (7,49) width 74: "ing her "
+            text run at (81,49) width 171: "flamingo: she suc"
+            text run at (7,70) width 245: "ceeded in getting its body"
+            text run at (7,91) width 147: "tucked away, "
+            text run at (154,91) width 98: "comfortably"
+            text run at (7,112) width 330: "enough, under her arm, with its legs"
+            text run at (7,133) width 125: "hanging down, "
+            text run at (132,133) width 205: "but generally, just as she"
+            text run at (7,154) width 298: "had got its neck nicely straightened "
+            text run at (305,154) width 32: "out,"
+            text run at (7,175) width 330: "and was going to give the hedgehog a"
+            text run at (7,196) width 186: "blow with its head, it "
+            text run at (193,196) width 144: "would twist itself"
+            text run at (7,217) width 260: "round and look up in her face\x{2026}"
diff --git a/LayoutTests/platform/android/fast/text/hyphens-expected.txt b/LayoutTests/platform/android/fast/text/hyphens-expected.txt
new file mode 100644
index 0000000..e68f861
--- /dev/null
+++ b/LayoutTests/platform/android/fast/text/hyphens-expected.txt
@@ -0,0 +1,115 @@
+layer at (0,0) size 356x1213
+  RenderView at (0,0) size 313x483
+layer at (0,0) size 356x1213
+  RenderBlock {HTML} at (0,0) size 313x483
+    RenderBody {BODY} at (8,8) size 297x467
+      RenderBlock (floating) {DIV} at (4,0) size 344x296
+        RenderBlock {P} at (0,16) size 344x19
+          RenderInline {TT} at (0,0) size 118x15
+            RenderText {#text} at (0,4) size 118x15
+              text run at (0,4) width 118: "hyphens: manual"
+          RenderText {#text} at (118,0) size 157x19
+            text run at (118,0) width 157: " without soft hyphens"
+        RenderBlock {DIV} at (0,51) size 344x245 [border: (3px solid #000000)]
+          RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+          RenderText {#text} at (7,7) size 330x231
+            text run at (7,7) width 245: "The chief difficulty Alice"
+            text run at (7,28) width 245: "found at first was in"
+            text run at (7,49) width 128: "managing her "
+            text run at (135,49) width 117: "flamingo: she"
+            text run at (7,70) width 245: "succeeded in getting its body"
+            text run at (7,91) width 147: "tucked away, "
+            text run at (154,91) width 98: "comfortably"
+            text run at (7,112) width 330: "enough, under her arm, with its legs"
+            text run at (7,133) width 125: "hanging down, "
+            text run at (132,133) width 205: "but generally, just as she"
+            text run at (7,154) width 298: "had got its neck nicely straightened "
+            text run at (305,154) width 32: "out,"
+            text run at (7,175) width 330: "and was going to give the hedgehog a"
+            text run at (7,196) width 186: "blow with its head, it "
+            text run at (193,196) width 144: "would twist itself"
+            text run at (7,217) width 260: "round and look up in her face\x{2026}"
+      RenderBlock (floating) {DIV} at (4,296) size 344x317
+        RenderBlock {P} at (0,16) size 344x19
+          RenderInline {TT} at (0,0) size 103x15
+            RenderText {#text} at (0,4) size 103x15
+              text run at (0,4) width 103: "hyphens: none"
+          RenderText {#text} at (103,0) size 133x19
+            text run at (103,0) width 133: " with soft hyphens"
+        RenderBlock {DIV} at (0,51) size 344x266 [border: (3px solid #000000)]
+          RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+          RenderText {#text} at (7,7) size 330x252
+            text run at (7,7) width 245: "The chief difficulty Alice"
+            text run at (7,28) width 245: "found at first was in"
+            text run at (7,49) width 128: "managing her "
+            text run at (135,49) width 117: "flamingo: she"
+            text run at (7,70) width 141: "succeeded in get"
+            text run at (148,70) width 104: "ting its body"
+            text run at (7,91) width 181: "tucked away, com"
+            text run at (188,91) width 64: "fortably"
+            text run at (7,112) width 330: "enough, under her arm, with its legs"
+            text run at (7,133) width 125: "hanging down, "
+            text run at (132,133) width 205: "but generally, just as she"
+            text run at (7,154) width 289: "had got its neck nicely straight"
+            text run at (296,154) width 41: "ened"
+            text run at (7,175) width 330: "out, and was going to give the"
+            text run at (7,196) width 50: "hedge"
+            text run at (57,196) width 280: "hog a blow with its head, it"
+            text run at (7,217) width 330: "would twist itself round and look up in"
+            text run at (7,238) width 81: "her face\x{2026}"
+      RenderBlock (floating) {DIV} at (4,613) size 344x296
+        RenderBlock {P} at (0,16) size 344x19
+          RenderInline {TT} at (0,0) size 118x15
+            RenderText {#text} at (0,4) size 118x15
+              text run at (0,4) width 118: "hyphens: manual"
+          RenderText {#text} at (118,0) size 133x19
+            text run at (118,0) width 133: " with soft hyphens"
+        RenderBlock {DIV} at (0,51) size 344x245 [border: (3px solid #000000)]
+          RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+          RenderText {#text} at (7,7) size 330x231
+            text run at (7,7) width 245: "The chief difficulty Alice"
+            text run at (7,28) width 245: "found at first was in"
+            text run at (7,49) width 128: "managing her "
+            text run at (135,49) width 117: "flamingo: she"
+            text run at (7,70) width 141: "succeeded in get"
+            text run at (148,70) width 104: "ting its body"
+            text run at (7,91) width 146: "tucked away, "
+            text run at (153,91) width 35: "com"
+            text run at (188,91) width 64: "fortably"
+            text run at (7,112) width 330: "enough, under her arm, with its legs"
+            text run at (7,133) width 125: "hanging down, "
+            text run at (132,133) width 205: "but generally, just as she"
+            text run at (7,154) width 251: "had got its neck nicely straight"
+            text run at (258,154) width 47: "ened "
+            text run at (305,154) width 32: "out,"
+            text run at (7,175) width 281: "and was going to give the hedge"
+            text run at (288,175) width 49: "hog a"
+            text run at (7,196) width 186: "blow with its head, it "
+            text run at (193,196) width 144: "would twist itself"
+            text run at (7,217) width 260: "round and look up in her face\x{2026}"
+      RenderBlock (floating) {DIV} at (4,909) size 344x296
+        RenderBlock {P} at (0,16) size 344x19
+          RenderInline {TT} at (0,0) size 103x15
+            RenderText {#text} at (0,4) size 103x15
+              text run at (0,4) width 103: "hyphens: auto"
+          RenderText {#text} at (103,0) size 157x19
+            text run at (103,0) width 157: " without soft hyphens"
+        RenderBlock {DIV} at (0,51) size 344x245 [border: (3px solid #000000)]
+          RenderBlock (floating) {DIV} at (262,7) size 75x90 [bgcolor=#F0F8FF]
+          RenderText {#text} at (7,7) size 330x231
+            text run at (7,7) width 245: "The chief difficulty Alice"
+            text run at (7,28) width 245: "found at first was in manag"
+            text run at (7,49) width 79: "ing her "
+            text run at (86,49) width 166: "flamingo: she suc"
+            text run at (7,70) width 245: "ceeded in getting its body"
+            text run at (7,91) width 147: "tucked away, "
+            text run at (154,91) width 98: "comfortably"
+            text run at (7,112) width 330: "enough, under her arm, with its legs"
+            text run at (7,133) width 125: "hanging down, "
+            text run at (132,133) width 205: "but generally, just as she"
+            text run at (7,154) width 298: "had got its neck nicely straightened "
+            text run at (305,154) width 32: "out,"
+            text run at (7,175) width 330: "and was going to give the hedgehog a"
+            text run at (7,196) width 186: "blow with its head, it "
+            text run at (193,196) width 144: "would twist itself"
+            text run at (7,217) width 260: "round and look up in her face\x{2026}"
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c888f54..a8fdf53 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-26  Shimeng (Simon) Wang  <swang at google.com>
+
+        Reviewed by Darin Adler.
+
+        Add auto hyphenation support for Android.
+        https://bugs.webkit.org/show_bug.cgi?id=42800
+
+        * platform/text/android/HyphenationAndroid.cpp: Added.
+        (WebCore::loadHyphenationDictionary):
+        (WebCore::lastHyphenLocation):
+
 2010-07-26  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Anders Carlsson.
diff --git a/WebCore/platform/text/android/HyphenationAndroid.cpp b/WebCore/platform/text/android/HyphenationAndroid.cpp
new file mode 100644
index 0000000..00ebd46
--- /dev/null
+++ b/WebCore/platform/text/android/HyphenationAndroid.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Hyphenation.h"
+
+// For external hyphenation library.
+#include "hyphen.h"
+#include <utils/AssetManager.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+extern android::AssetManager* globalAssetManager();
+
+using namespace WTF;
+
+namespace WebCore {
+
+static HyphenDict* loadHyphenationDictionary()
+{
+    android::AssetManager* am = globalAssetManager();
+    // Only support English for now.
+    android::Asset* a = am->open("webkit/hyph_en_US.dic",
+        android::Asset::ACCESS_BUFFER);
+    if (!a) {
+        // Asset webkit/hyph_en_US.dic not found!
+        return 0;
+    }
+    const CString dictContents = String(static_cast<const char*>(a->getBuffer(false)),
+        a->getLength()).utf8();
+    HyphenDict* dict = hnj_hyphen_load_from_buffer(dictContents.data(),
+        dictContents.length());
+    delete a;
+
+    return dict;
+}
+
+size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex)
+{
+    static const size_t minWordLen = 5;
+    static const size_t maxWordLen = 100;
+    if (beforeIndex <= 0 || length < minWordLen || length > maxWordLen)
+        return 0;
+
+    static HyphenDict* dict = loadHyphenationDictionary();
+    if (!dict)
+        return 0;
+
+    char word[maxWordLen];
+    for (size_t i = 0; i < length; ++i) {
+        const UChar ch = characters[i];
+        // Only English for now.
+        // To really make it language aware, we need something like language
+        // detection or rely on the langAttr in the html element.  Though
+        // seems right now the langAttr is not used or quite implemented in
+        // webkit.
+        if (!isASCIIAlpha(ch))
+            return 0;
+        word[i] = ch;
+    }
+
+    static const int extraBuffer = 5;
+    char hyphens[maxWordLen + extraBuffer];
+    if (!hnj_hyphen_hyphenate(dict, word, length, hyphens)) {
+        for (size_t i = beforeIndex - 1; i > 0; --i) {
+            if (hyphens[i] & 1)
+                return i + 1;
+        }
+    }
+
+    return 0;
+}
+
+} // namespace WebCore

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list