Title: [155053] branches/safari-537-branch

Diff

Modified: branches/safari-537-branch/LayoutTests/ChangeLog (155052 => 155053)


--- branches/safari-537-branch/LayoutTests/ChangeLog	2013-09-04 18:35:53 UTC (rev 155052)
+++ branches/safari-537-branch/LayoutTests/ChangeLog	2013-09-04 18:44:39 UTC (rev 155053)
@@ -1,3 +1,19 @@
+2013-09-04  Lucas Forschler  <[email protected]>
+
+        Merge r155014
+
+    2013-09-03  Enrica Casucci  <[email protected]>
+
+            Can't select Katakana word by double-clicking.
+            <rdar://problem/14654926>
+
+            Reviewed by Alexey Proskuryakov and Ryosuke Niwa.
+
+            Added new test for this scenario.
+
+            * editing/selection/doubleclick-japanese-text-expected.txt: Added.
+            * editing/selection/doubleclick-japanese-text.html: Added.
+
 2013-09-02  Lucas Forschler  <[email protected]>
 
     	Merge r154785

Copied: branches/safari-537-branch/LayoutTests/editing/selection/doubleclick-japanese-text-expected.txt (from rev 155014, trunk/LayoutTests/editing/selection/doubleclick-japanese-text-expected.txt) (0 => 155053)


--- branches/safari-537-branch/LayoutTests/editing/selection/doubleclick-japanese-text-expected.txt	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/editing/selection/doubleclick-japanese-text-expected.txt	2013-09-04 18:44:39 UTC (rev 155053)
@@ -0,0 +1,10 @@
+This tests that double-clicking on Japanese text.
+
+例えばオーストラリア
+Passed for offset 55
+Passed for offset 70
+Passed for offset 85
+Passed for offset 100
+Passed for offset 115
+Passed for offset 130
+

Copied: branches/safari-537-branch/LayoutTests/editing/selection/doubleclick-japanese-text.html (from rev 155014, trunk/LayoutTests/editing/selection/doubleclick-japanese-text.html) (0 => 155053)


--- branches/safari-537-branch/LayoutTests/editing/selection/doubleclick-japanese-text.html	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/editing/selection/doubleclick-japanese-text.html	2013-09-04 18:44:39 UTC (rev 155053)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script>
+if (window.testRunner)
+     testRunner.dumpAsText();
+
+function getPositionOfNode(id)
+{
+    var n = document.getElementById(id);
+    var pos = {x: 0, y: 0};
+
+    while (n) {
+        pos.x += n.offsetLeft + n.clientLeft;
+        pos.y += n.offsetTop + n.clientTop;
+        n = n.offsetParent;
+    }
+    return pos;
+}
+
+function doubleClickNode(id, offset)
+{
+    var pos = getPositionOfNode(id);
+    eventSender.mouseMoveTo(pos.x + offset, pos.y + 2);
+    eventSender.mouseDown();
+    eventSender.leapForward(1);
+    eventSender.mouseUp();
+    eventSender.leapForward(100);
+    eventSender.mouseDown();
+    eventSender.leapForward(1);
+    eventSender.mouseUp();
+}
+
+function doTest(testId, offset, expectedText)
+{
+    // Simulate a double click.
+    doubleClickNode(testId, offset);
+
+    // Get the text of the current selection.
+    var sel = window.getSelection();
+    var actualText = sel.getRangeAt(0).toString();
+
+    if (expectedText == actualText) {
+        log("Passed for offset " + offset);
+    } else {
+        log("Failed for offset " + offset);
+        log("  Expected: " + expectedText);
+        log("  Actual: " + actualText);
+    }
+
+}
+
+function runTests()
+{
+    if (window.testRunner) {
+        doTest("test1", 55, "オーストラリア");
+        doTest("test1", 70, "オーストラリア");
+        doTest("test1", 85, "オーストラリア");
+        doTest("test1", 100, "オーストラリア");
+        doTest("test1", 115, "オーストラリア");
+        doTest("test1", 130, "オーストラリア");
+    }
+}
+
+function log(msg)
+{
+    var l = document.getElementById('log');
+    l.appendChild(document.createTextNode(msg));
+    l.appendChild(document.createElement('br'));
+}
+
+</script>
+</head>
+<body _onload_="runTests()">
+<p>
+This tests that double-clicking on Japanese text.
+</p>
+
+<div>
+<span id=test1>例えばオーストラリア</span>
+</div>
+
+<pre id=log>
+</pre>
+
+</body>
+</html>

Modified: branches/safari-537-branch/Source/WTF/ChangeLog (155052 => 155053)


--- branches/safari-537-branch/Source/WTF/ChangeLog	2013-09-04 18:35:53 UTC (rev 155052)
+++ branches/safari-537-branch/Source/WTF/ChangeLog	2013-09-04 18:44:39 UTC (rev 155053)
@@ -1,3 +1,22 @@
+2013-09-04  Lucas Forschler  <[email protected]>
+
+        Merge r155014
+
+    2013-09-03  Enrica Casucci  <[email protected]>
+
+            Can't select Katakana word by double-clicking.
+            <rdar://problem/14654926>
+
+            Reviewed by Alexey Proskuryakov and Ryosuke Niwa.
+
+            For some languages, like Japanese we need
+            to use more context for word breaking.
+            I've renamed the function to better reflect its use
+            and remove the unused hasLineBreakingPropertyComplexContextOrIdeographic.
+
+            * wtf/unicode/icu/UnicodeIcu.h:
+            (WTF::Unicode::requiresComplexContextForWordBreaking):
+
 2013-08-05  Lucas Forschler  <[email protected]>
 
         Merge r153455

Modified: branches/safari-537-branch/Source/WTF/wtf/unicode/icu/UnicodeIcu.h (155052 => 155053)


--- branches/safari-537-branch/Source/WTF/wtf/unicode/icu/UnicodeIcu.h	2013-09-04 18:35:53 UTC (rev 155052)
+++ branches/safari-537-branch/Source/WTF/wtf/unicode/icu/UnicodeIcu.h	2013-09-04 18:44:39 UTC (rev 155053)
@@ -188,9 +188,12 @@
     return !!u_ispunct(c);
 }
 
-inline bool hasLineBreakingPropertyComplexContext(UChar32 c)
+#define WK_LB_CONDITIONAL_JAPANESE_STARTER 37
+
+inline bool requiresComplexContextForWordBreaking(UChar32 c)
 {
-    return u_getIntPropertyValue(c, UCHAR_LINE_BREAK) == U_LB_COMPLEX_CONTEXT;
+    int32_t prop = u_getIntPropertyValue(c, UCHAR_LINE_BREAK);
+    return prop == U_LB_COMPLEX_CONTEXT || prop == WK_LB_CONDITIONAL_JAPANESE_STARTER || prop == U_LB_IDEOGRAPHIC;
 }
 
 inline UChar32 mirroredChar(UChar32 c)

Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (155052 => 155053)


--- branches/safari-537-branch/Source/WebCore/ChangeLog	2013-09-04 18:35:53 UTC (rev 155052)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog	2013-09-04 18:44:39 UTC (rev 155053)
@@ -1,3 +1,22 @@
+2013-09-04  Lucas Forschler  <[email protected]>
+
+        Merge r155014
+
+    2013-09-03  Enrica Casucci  <[email protected]>
+
+            Can't select Katakana word by double-clicking.
+            <rdar://problem/14654926>
+
+            Reviewed by Alexey Proskuryakov and Ryosuke Niwa.
+
+            For some languages, like Japanese we need
+            to use more context for word breaking.
+
+            New test: editing/selection/doubleclick-japanese-text.html
+
+            * platform/text/TextBoundaries.h:
+            (WebCore::requiresContextForWordBoundary):
+
 2013-09-02  Lucas Forschler  <[email protected]>
 
         Merge r154785

Modified: branches/safari-537-branch/Source/WebCore/platform/text/TextBoundaries.h (155052 => 155053)


--- branches/safari-537-branch/Source/WebCore/platform/text/TextBoundaries.h	2013-09-04 18:35:53 UTC (rev 155052)
+++ branches/safari-537-branch/Source/WebCore/platform/text/TextBoundaries.h	2013-09-04 18:44:39 UTC (rev 155053)
@@ -30,9 +30,12 @@
 
 namespace WebCore {
 
+    // FIXME: this function won't be needed together with the function
+    // it calls when https://bugs.webkit.org/show_bug.cgi?id=120656
+    // will be fixed.
     inline bool requiresContextForWordBoundary(UChar32 ch)
     {
-        return WTF::Unicode::hasLineBreakingPropertyComplexContext(ch);
+        return WTF::Unicode::requiresComplexContextForWordBreaking(ch);
     }
 
     int endOfFirstWordBoundaryContext(const UChar* characters, int length);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to