Title: [94947] trunk
- Revision
- 94947
- Author
- commit-qu...@webkit.org
- Date
- 2011-09-12 00:14:38 -0700 (Mon, 12 Sep 2011)
Log Message
Characters beyond U+10000 should be deleted by one pressing delete key.
https://bugs.webkit.org/show_bug.cgi?id=40351
Patch by Shinya Kawanaka <shin...@google.com> on 2011-09-12
Reviewed by Kent Tamura.
Source/WebCore:
If a character is the trail part of unicode surrogate pair, the lead part of it
should also be deleted. Also, If in MacOSX, the deletion should honor Mac's behavior.
Test: editing/deleting/delete-surrogatepair.html
* rendering/RenderText.cpp:
(WebCore::RenderText::previousOffsetForBackwardDeletion):
Added if-macro to support chromium on mac, and added trail part check for unicode character.
LayoutTests:
Added deletion tests.
* editing/deleting/delete-surrogatepair-expected.txt: Added.
* editing/deleting/delete-surrogatepair.html: Added.
Modified Paths
Added Paths
Property Changed
Diff
Modified: trunk/LayoutTests/ChangeLog (94946 => 94947)
--- trunk/LayoutTests/ChangeLog 2011-09-12 05:46:44 UTC (rev 94946)
+++ trunk/LayoutTests/ChangeLog 2011-09-12 07:14:38 UTC (rev 94947)
@@ -1,3 +1,15 @@
+2011-09-12 Shinya Kawanaka <shin...@google.com>
+
+ Characters beyond U+10000 should be deleted by one pressing delete key.
+ https://bugs.webkit.org/show_bug.cgi?id=40351
+
+ Reviewed by Kent Tamura.
+
+ Added deletion tests.
+
+ * editing/deleting/delete-surrogatepair-expected.txt: Added.
+ * editing/deleting/delete-surrogatepair.html: Added.
+
2011-09-11 Kentaro Hara <hara...@google.com>
Implement a ProgressEvent constructor for V8
Property changes on: trunk/LayoutTests/ChangeLog
___________________________________________________________________
Deleted: svn:executable
Added: trunk/LayoutTests/editing/deleting/delete-surrogatepair-expected.txt (0 => 94947)
--- trunk/LayoutTests/editing/deleting/delete-surrogatepair-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/deleting/delete-surrogatepair-expected.txt 2011-09-12 07:14:38 UTC (rev 94947)
@@ -0,0 +1,13 @@
+This test makes sure that a surrogate-pair character is deleted by one pressing delete key
+
+hoghoge
+hogehoge
+𠀾
+a
+a
+𠀾
+𠀾a
+aa
+a𠀾
+a𠀾a
+a𠀾a
Added: trunk/LayoutTests/editing/deleting/delete-surrogatepair.html (0 => 94947)
--- trunk/LayoutTests/editing/deleting/delete-surrogatepair.html (rev 0)
+++ trunk/LayoutTests/editing/deleting/delete-surrogatepair.html 2011-09-12 07:14:38 UTC (rev 94947)
@@ -0,0 +1,51 @@
+<html>
+<head>
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+<script src=""
+<title>Delete Backward</title>
+</head>
+
+<body>
+
+<p>This test makes sure that a surrogate-pair character is deleted by one pressing delete key</p>
+<div contenteditable id="root0" class="editing">hogehoge</div>
+<div contenteditable id="root1" class="editing">𠀾hogehoge</div>
+<div contenteditable id="root2" class="editing">a𠀾</div>
+<div contenteditable id="root3" class="editing">a𠀾</div>
+<div contenteditable id="root4" class="editing">𠀾a</div>
+<div contenteditable id="root5" class="editing">𠀾a</div>
+<div contenteditable id="root6" class="editing">a𠀾a</div>
+<div contenteditable id="root7" class="editing">a𠀾a</div>
+<div contenteditable id="root8" class="editing">a𠀾a</div>
+<div contenteditable id="root9" class="editing">a𠀾𠀾a</div>
+<div contenteditable id="root10" class="editing">a𠀾𠀾a</div>
+
+<script>
+if (window.layoutTestController) {
+ var pos = [4, 1, 1, 2, 1, 2, 1, 2, 3, 2, 3];
+ for (var i = 0; i < 11; ++i) {
+ var div = document.getElementById("root" + i);
+
+ div.focus();
+ for (var j = 0; j < pos[i]; ++j)
+ layoutTestController.execCommand("MoveForward");
+
+ layoutTestController.execCommand("DeleteBackward");
+ }
+
+ layoutTestController.dumpAsText();
+} else {
+ document.write("This test requires layoutTestController.<br>");
+ document.write("When doing manually, try to delete the above strings by hitting backspace key.");
+}
+
+</script>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (94946 => 94947)
--- trunk/Source/WebCore/ChangeLog 2011-09-12 05:46:44 UTC (rev 94946)
+++ trunk/Source/WebCore/ChangeLog 2011-09-12 07:14:38 UTC (rev 94947)
@@ -1,3 +1,19 @@
+2011-09-12 Shinya Kawanaka <shin...@google.com>
+
+ Characters beyond U+10000 should be deleted by one pressing delete key.
+ https://bugs.webkit.org/show_bug.cgi?id=40351
+
+ Reviewed by Kent Tamura.
+
+ If a character is the trail part of unicode surrogate pair, the lead part of it
+ should also be deleted. Also, If in MacOSX, the deletion should honor Mac's behavior.
+
+ Test: editing/deleting/delete-surrogatepair.html
+
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::previousOffsetForBackwardDeletion):
+ Added if-macro to support chromium on mac, and added trail part check for unicode character.
+
2011-09-11 Kentaro Hara <hara...@google.com>
Implement a ProgressEvent constructor for V8
Property changes on: trunk/Source/WebCore/ChangeLog
___________________________________________________________________
Deleted: svn:executable
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (94946 => 94947)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2011-09-12 05:46:44 UTC (rev 94946)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2011-09-12 07:14:38 UTC (rev 94947)
@@ -1626,7 +1626,7 @@
return result;
}
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(CHROMIUM) && OS(MAC_OS_X)
#define HANGUL_CHOSEONG_START (0x1100)
#define HANGUL_CHOSEONG_END (0x115F)
@@ -1668,7 +1668,7 @@
int RenderText::previousOffsetForBackwardDeletion(int current) const
{
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(CHROMIUM) && OS(MAC_OS_X)
ASSERT(m_text);
StringImpl& text = *m_text.impl();
UChar32 character;
@@ -1756,7 +1756,11 @@
return current;
#else
// Platforms other than Mac delete by one code point.
- return current - 1;
+ if (U16_IS_TRAIL(m_text[--current]))
+ --current;
+ if (current < 0)
+ current = 0;
+ return current;
#endif
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes