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-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>