Fixed: <rdar://problem/4030404> selection granularity should be set when extending selection via JS
Reviewed by kocienda.
* khtml/ecma/kjs_window.cpp:
(SelectionFunc::tryCall): set the granularity on the part. This will allow us to write smart paste layout tests.
* layout-tests/editing/pasteboard/smart-paste-001-expected.txt: Added.
* layout-tests/editing/pasteboard/smart-paste-001.html: Added.
* layout-tests/editing/pasteboard/smart-paste-002-expected.txt: Added.
* layout-tests/editing/pasteboard/smart-paste-002.html: Added.
* layout-tests/editing/pasteboard/smart-paste-003-expected.txt: Added.
* layout-tests/editing/pasteboard/smart-paste-003.html: Added.
* layout-tests/editing/pasteboard/smart-paste-004-expected.txt: Added.
* layout-tests/editing/pasteboard/smart-paste-004.html: Added.
* layout-tests/editing/pasteboard/smart-paste-005-expected.txt: Added.
* layout-tests/editing/pasteboard/smart-paste-005.html: Added.
* layout-tests/editing/pasteboard/smart-paste-006-expected.txt: Added.
* layout-tests/editing/pasteboard/smart-paste-006.html: Added.
* layout-tests/editing/pasteboard/smart-paste-007-expected.txt: Added.
* layout-tests/editing/pasteboard/smart-paste-007.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@8727 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/editing/pasteboard/smart-paste-001-expected.txt b/LayoutTests/editing/pasteboard/smart-paste-001-expected.txt
new file mode 100644
index 0000000..2833857
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-001-expected.txt
@@ -0,0 +1,32 @@
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x212 [border: (2px solid #0000FF)]
+ RenderBlock {DIV} at (14,14) size 756x56
+ RenderText {TEXT} at (0,0) size 67x28
+ text run at (0,0) width 67: "Tests: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 564x28
+ text run at (0,28) width 564: "Smart paste when pasting after a word at the end of a line."
+ RenderBlock {DIV} at (14,86) size 756x112
+ RenderText {TEXT} at (0,0) size 189x28
+ text run at (0,0) width 189: "Expected Results: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 720x56
+ text run at (0,28) width 720: "A space should be added between the preexisting word and the word that's"
+ text run at (0,56) width 297: "pasted. It should like this this: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,84) size 74x28
+ text run at (0,84) width 74: "test test"
+ RenderBlock {DIV} at (0,236) size 784x32
+ RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
+ RenderText {TEXT} at (2,2) size 40x28
+ text run at (2,2) width 40: "test "
+ RenderText {TEXT} at (42,2) size 34x28
+ text run at (42,2) width 34: "test"
+selection is CARET:
+start: position 4 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+upstream: position 4 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+downstream: position 4 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
diff --git a/LayoutTests/editing/pasteboard/smart-paste-001.html b/LayoutTests/editing/pasteboard/smart-paste-001.html
new file mode 100644
index 0000000..86a9e47
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-001.html
@@ -0,0 +1,62 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ font-size: 24px;
+}
+.explanation {
+ border: 2px solid blue;
+ padding: 12px;
+ font-size: 24px;
+ margin-bottom: 24px;
+}
+.scenario { margin-bottom: 16px;}
+.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
+.expected-results:first-line { font-weight: bold }
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ extendSelectionForwardByWordCommand();
+ copyCommand();
+ moveSelectionForwardByCharacterCommand();
+ pasteCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+
+<div class="explanation">
+<div class="scenario">
+Tests:
+<br>
+Smart paste when pasting after a word at the end of a line.
+</div>
+<div class="expected-results">
+Expected Results:
+<br>
+A space should be added between the preexisting word and the word that's pasted. It should like this this:
+<BR>
+test test
+</div>
+</div>
+
+<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
+<div id="test" class="editing">
+test
+</div>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/LayoutTests/editing/pasteboard/smart-paste-002-expected.txt b/LayoutTests/editing/pasteboard/smart-paste-002-expected.txt
new file mode 100644
index 0000000..58edc9e
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-002-expected.txt
@@ -0,0 +1,32 @@
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x212 [border: (2px solid #0000FF)]
+ RenderBlock {DIV} at (14,14) size 756x56
+ RenderText {TEXT} at (0,0) size 67x28
+ text run at (0,0) width 67: "Tests: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 643x28
+ text run at (0,28) width 643: "Smart paste when pasting at the beginning of a line before a word."
+ RenderBlock {DIV} at (14,86) size 756x112
+ RenderText {TEXT} at (0,0) size 189x28
+ text run at (0,0) width 189: "Expected Results: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 743x56
+ text run at (0,28) width 743: "A space should be added after the pasted word before the preexising word. It"
+ text run at (0,56) width 202: "should like this this: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,84) size 74x28
+ text run at (0,84) width 74: "test test"
+ RenderBlock {DIV} at (0,236) size 784x32
+ RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
+ RenderText {TEXT} at (2,2) size 34x28
+ text run at (2,2) width 34: "test"
+ RenderText {TEXT} at (36,2) size 40x28
+ text run at (36,2) width 40: " test"
+selection is CARET:
+start: position 4 of child 1 {TEXT} of child 1 {DIV} of root {DIV}
+upstream: position 4 of child 1 {TEXT} of child 1 {DIV} of root {DIV}
+downstream: position 0 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
diff --git a/LayoutTests/editing/pasteboard/smart-paste-002.html b/LayoutTests/editing/pasteboard/smart-paste-002.html
new file mode 100644
index 0000000..e401f1e
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-002.html
@@ -0,0 +1,62 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ font-size: 24px;
+}
+.explanation {
+ border: 2px solid blue;
+ padding: 12px;
+ font-size: 24px;
+ margin-bottom: 24px;
+}
+.scenario { margin-bottom: 16px;}
+.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
+.expected-results:first-line { font-weight: bold }
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ extendSelectionForwardByWordCommand();
+ copyCommand();
+ moveSelectionBackwardByWordCommand();
+ pasteCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+
+<div class="explanation">
+<div class="scenario">
+Tests:
+<br>
+Smart paste when pasting at the beginning of a line before a word.
+</div>
+<div class="expected-results">
+Expected Results:
+<br>
+A space should be added after the pasted word before the preexising word. It should like this this:
+<BR>
+test test
+</div>
+</div>
+
+<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
+<div id="test" class="editing">
+test
+</div>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/LayoutTests/editing/pasteboard/smart-paste-003-expected.txt b/LayoutTests/editing/pasteboard/smart-paste-003-expected.txt
new file mode 100644
index 0000000..a237d3b
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-003-expected.txt
@@ -0,0 +1,35 @@
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x240 [border: (2px solid #0000FF)]
+ RenderBlock {DIV} at (14,14) size 756x56
+ RenderText {TEXT} at (0,0) size 67x28
+ text run at (0,0) width 67: "Tests: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 738x28
+ text run at (0,28) width 738: "Smart paste when pasting after a word and before a space and another word."
+ RenderBlock {DIV} at (14,86) size 756x140
+ RenderText {TEXT} at (0,0) size 189x28
+ text run at (0,0) width 189: "Expected Results: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 720x84
+ text run at (0,28) width 720: "A space should be added between the preexisting word and the word that's"
+ text run at (0,56) width 717: "pasted. No space should be added after the pasted word. It should like this"
+ text run at (0,84) width 48: "this: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,112) size 114x28
+ text run at (0,112) width 114: "test test test"
+ RenderBlock {DIV} at (0,264) size 784x32
+ RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
+ RenderText {TEXT} at (2,2) size 34x28
+ text run at (2,2) width 34: "test"
+ RenderText {TEXT} at (36,2) size 40x28
+ text run at (36,2) width 40: " test"
+ RenderText {TEXT} at (76,2) size 40x28
+ text run at (76,2) width 40: " test"
+selection is CARET:
+start: position 5 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+upstream: position 5 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+downstream: position 0 of child 3 {TEXT} of child 1 {DIV} of root {DIV}
diff --git a/LayoutTests/editing/pasteboard/smart-paste-003.html b/LayoutTests/editing/pasteboard/smart-paste-003.html
new file mode 100644
index 0000000..ae68d76
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-003.html
@@ -0,0 +1,62 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ font-size: 24px;
+}
+.explanation {
+ border: 2px solid blue;
+ padding: 12px;
+ font-size: 24px;
+ margin-bottom: 24px;
+}
+.scenario { margin-bottom: 16px;}
+.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
+.expected-results:first-line { font-weight: bold }
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ extendSelectionForwardByWordCommand();
+ copyCommand();
+ moveSelectionForwardByCharacterCommand();
+ pasteCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+
+<div class="explanation">
+<div class="scenario">
+Tests:
+<br>
+Smart paste when pasting after a word and before a space and another word.
+</div>
+<div class="expected-results">
+Expected Results:
+<br>
+A space should be added between the preexisting word and the word that's pasted. No space should be added after the pasted word. It should like this this:
+<BR>
+test test test
+</div>
+</div>
+
+<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
+<div id="test" class="editing">
+test test
+</div>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/LayoutTests/editing/pasteboard/smart-paste-004-expected.txt b/LayoutTests/editing/pasteboard/smart-paste-004-expected.txt
new file mode 100644
index 0000000..8506420
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-004-expected.txt
@@ -0,0 +1,35 @@
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x212 [border: (2px solid #0000FF)]
+ RenderBlock {DIV} at (14,14) size 756x56
+ RenderText {TEXT} at (0,0) size 67x28
+ text run at (0,0) width 67: "Tests: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 680x28
+ text run at (0,28) width 680: "Smart paste when pasting after word and a space before another word."
+ RenderBlock {DIV} at (14,86) size 756x112
+ RenderText {TEXT} at (0,0) size 189x28
+ text run at (0,0) width 189: "Expected Results: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 724x56
+ text run at (0,28) width 724: "A space should be added after the pasted word before the other preexisting"
+ text run at (0,56) width 61: "word. "
+ text run at (61,56) width 223: "It should like this this: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,84) size 114x28
+ text run at (0,84) width 114: "test test test"
+ RenderBlock {DIV} at (0,236) size 784x32
+ RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
+ RenderText {TEXT} at (2,2) size 40x28
+ text run at (2,2) width 40: "test "
+ RenderText {TEXT} at (42,2) size 40x28
+ text run at (42,2) width 40: "test "
+ RenderText {TEXT} at (82,2) size 34x28
+ text run at (82,2) width 34: "test"
+selection is CARET:
+start: position 5 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+upstream: position 5 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+downstream: position 0 of child 3 {TEXT} of child 1 {DIV} of root {DIV}
diff --git a/LayoutTests/editing/pasteboard/smart-paste-004.html b/LayoutTests/editing/pasteboard/smart-paste-004.html
new file mode 100644
index 0000000..3c2257a
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-004.html
@@ -0,0 +1,63 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ font-size: 24px;
+}
+.explanation {
+ border: 2px solid blue;
+ padding: 12px;
+ font-size: 24px;
+ margin-bottom: 24px;
+}
+.scenario { margin-bottom: 16px;}
+.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
+.expected-results:first-line { font-weight: bold }
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ extendSelectionForwardByWordCommand();
+ copyCommand();
+ moveSelectionForwardByCharacterCommand();
+ moveSelectionForwardByCharacterCommand();
+ pasteCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+
+<div class="explanation">
+<div class="scenario">
+Tests:
+<br>
+Smart paste when pasting after word and a space before another word.
+</div>
+<div class="expected-results">
+Expected Results:
+<br>
+A space should be added after the pasted word before the other preexisting word. It should like this this:
+<BR>
+test test test
+</div>
+</div>
+
+<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
+<div id="test" class="editing">
+test test
+</div>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/LayoutTests/editing/pasteboard/smart-paste-005-expected.txt b/LayoutTests/editing/pasteboard/smart-paste-005-expected.txt
new file mode 100644
index 0000000..8be6806
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-005-expected.txt
@@ -0,0 +1,34 @@
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x212 [border: (2px solid #0000FF)]
+ RenderBlock {DIV} at (14,14) size 756x56
+ RenderText {TEXT} at (0,0) size 67x28
+ text run at (0,0) width 67: "Tests: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 487x28
+ text run at (0,28) width 487: "Smart paste when pasting in the middle of a word."
+ RenderBlock {DIV} at (14,86) size 756x112
+ RenderText {TEXT} at (0,0) size 189x28
+ text run at (0,0) width 189: "Expected Results: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 738x56
+ text run at (0,28) width 738: "Spaces should be added before and after the pasted word. It should look like"
+ text run at (0,56) width 48: "this: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,84) size 80x28
+ text run at (0,84) width 80: "te test st"
+ RenderBlock {DIV} at (0,236) size 784x32
+ RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
+ RenderText {TEXT} at (2,2) size 18x28
+ text run at (2,2) width 18: "te"
+ RenderText {TEXT} at (20,2) size 46x28
+ text run at (20,2) width 46: " test "
+ RenderText {TEXT} at (66,2) size 16x28
+ text run at (66,2) width 16: "st"
+selection is CARET:
+start: position 6 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+upstream: position 6 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+downstream: position 0 of child 3 {TEXT} of child 1 {DIV} of root {DIV}
diff --git a/LayoutTests/editing/pasteboard/smart-paste-005.html b/LayoutTests/editing/pasteboard/smart-paste-005.html
new file mode 100644
index 0000000..17d1c15
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-005.html
@@ -0,0 +1,64 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ font-size: 24px;
+}
+.explanation {
+ border: 2px solid blue;
+ padding: 12px;
+ font-size: 24px;
+ margin-bottom: 24px;
+}
+.scenario { margin-bottom: 16px;}
+.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
+.expected-results:first-line { font-weight: bold }
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ extendSelectionForwardByWordCommand();
+ copyCommand();
+ moveSelectionBackwardByWordCommand();
+ moveSelectionForwardByCharacterCommand();
+ moveSelectionForwardByCharacterCommand();
+ pasteCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+
+<div class="explanation">
+<div class="scenario">
+Tests:
+<br>
+Smart paste when pasting in the middle of a word.
+</div>
+<div class="expected-results">
+Expected Results:
+<br>
+Spaces should be added before and after the pasted word. It should look like this:
+<BR>
+te test st
+</div>
+</div>
+
+<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
+<div id="test" class="editing">
+test
+</div>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/LayoutTests/editing/pasteboard/smart-paste-006-expected.txt b/LayoutTests/editing/pasteboard/smart-paste-006-expected.txt
new file mode 100644
index 0000000..343adc3
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-006-expected.txt
@@ -0,0 +1,34 @@
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x212 [border: (2px solid #0000FF)]
+ RenderBlock {DIV} at (14,14) size 756x56
+ RenderText {TEXT} at (0,0) size 67x28
+ text run at (0,0) width 67: "Tests: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 640x28
+ text run at (0,28) width 640: "Smart paste when pasting between smart paste exempt characters."
+ RenderBlock {DIV} at (14,86) size 756x112
+ RenderText {TEXT} at (0,0) size 189x28
+ text run at (0,0) width 189: "Expected Results: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 754x56
+ text run at (0,28) width 754: "No spaces should be added before or after the pasted word. It should look like"
+ text run at (0,56) width 48: "this: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,84) size 50x28
+ text run at (0,84) width 50: "-test-"
+ RenderBlock {DIV} at (0,236) size 784x32
+ RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
+ RenderText {TEXT} at (2,2) size 8x28
+ text run at (2,2) width 8: "-"
+ RenderText {TEXT} at (10,2) size 34x28
+ text run at (10,2) width 34: "test"
+ RenderText {TEXT} at (44,2) size 8x28
+ text run at (44,2) width 8: "-"
+selection is CARET:
+start: position 4 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+upstream: position 4 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+downstream: position 0 of child 3 {TEXT} of child 1 {DIV} of root {DIV}
diff --git a/LayoutTests/editing/pasteboard/smart-paste-006.html b/LayoutTests/editing/pasteboard/smart-paste-006.html
new file mode 100644
index 0000000..c4da4ad
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-006.html
@@ -0,0 +1,64 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ font-size: 24px;
+}
+.explanation {
+ border: 2px solid blue;
+ padding: 12px;
+ font-size: 24px;
+ margin-bottom: 24px;
+}
+.scenario { margin-bottom: 16px;}
+.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
+.expected-results:first-line { font-weight: bold }
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ extendSelectionForwardByWordCommand();
+ cutCommand();
+ typeCharacterCommand('-');
+ typeCharacterCommand('-');
+ moveSelectionBackwardByCharacterCommand();
+ pasteCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+
+<div class="explanation">
+<div class="scenario">
+Tests:
+<br>
+Smart paste when pasting between smart paste exempt characters.
+</div>
+<div class="expected-results">
+Expected Results:
+<br>
+No spaces should be added before or after the pasted word. It should look like this:
+<BR>
+-test-
+</div>
+</div>
+
+<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
+<div id="test" class="editing">
+test
+</div>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/LayoutTests/editing/pasteboard/smart-paste-007-expected.txt b/LayoutTests/editing/pasteboard/smart-paste-007-expected.txt
new file mode 100644
index 0000000..2e2ee2e
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-007-expected.txt
@@ -0,0 +1,34 @@
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x212 [border: (2px solid #0000FF)]
+ RenderBlock {DIV} at (14,14) size 756x56
+ RenderText {TEXT} at (0,0) size 67x28
+ text run at (0,0) width 67: "Tests: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 460x28
+ text run at (0,28) width 460: "Smart paste when pasting between two periods."
+ RenderBlock {DIV} at (14,86) size 756x112
+ RenderText {TEXT} at (0,0) size 189x28
+ text run at (0,0) width 189: "Expected Results: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 744x56
+ text run at (0,28) width 744: "A space should be added before, but not after the pasted word. It should look"
+ text run at (0,56) width 91: "like this: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,84) size 52x28
+ text run at (0,84) width 52: ". test."
+ RenderBlock {DIV} at (0,236) size 784x32
+ RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
+ RenderText {TEXT} at (2,2) size 6x28
+ text run at (2,2) width 6: "."
+ RenderText {TEXT} at (8,2) size 40x28
+ text run at (8,2) width 40: " test"
+ RenderText {TEXT} at (48,2) size 6x28
+ text run at (48,2) width 6: "."
+selection is CARET:
+start: position 5 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+upstream: position 5 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
+downstream: position 0 of child 3 {TEXT} of child 1 {DIV} of root {DIV}
diff --git a/LayoutTests/editing/pasteboard/smart-paste-007.html b/LayoutTests/editing/pasteboard/smart-paste-007.html
new file mode 100644
index 0000000..bcc85d5
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/smart-paste-007.html
@@ -0,0 +1,64 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ font-size: 24px;
+}
+.explanation {
+ border: 2px solid blue;
+ padding: 12px;
+ font-size: 24px;
+ margin-bottom: 24px;
+}
+.scenario { margin-bottom: 16px;}
+.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
+.expected-results:first-line { font-weight: bold }
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ extendSelectionForwardByWordCommand();
+ cutCommand();
+ typeCharacterCommand('.');
+ typeCharacterCommand('.');
+ moveSelectionBackwardByCharacterCommand();
+ pasteCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+
+<div class="explanation">
+<div class="scenario">
+Tests:
+<br>
+Smart paste when pasting between two periods.
+</div>
+<div class="expected-results">
+Expected Results:
+<br>
+A space should be added before, but not after the pasted word. It should look like this:
+<BR>
+. test.
+</div>
+</div>
+
+<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
+<div id="test" class="editing">
+test
+</div>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>