Reviewed by John
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Sep 2004 23:27:41 +0000 (23:27 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Sep 2004 23:27:41 +0000 (23:27 +0000)
        Fix for this bug:

        <rdar://problem/3814660> REGRESSION (8A200-8A259): Select All has no effect on livepage.apple.com

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::updateSelection): Move the selection start and end to rendered positions
        before passing off to the RenderCanvas for drawing.
        * layout-tests/editing/selection/select-all-004-expected.txt: Added.
        * layout-tests/editing/selection/select-all-004.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7680 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/editing/selection/select-all-004-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/select-all-004.html [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23
WebCore/khtml/xml/dom_docimpl.cpp

diff --git a/LayoutTests/editing/selection/select-all-004-expected.txt b/LayoutTests/editing/selection/select-all-004-expected.txt
new file mode 100644 (file)
index 0000000..5fcffc5
--- /dev/null
@@ -0,0 +1,25 @@
+layer at (0,0) size 812x585
+  RenderCanvas at (0,0) size 800x585
+layer at (0,0) size 812x585
+  RenderBlock {HTML} at (0,0) size 800x585
+    RenderBody {BODY} at (64,64) size 748x457 [border: (50px solid #FF0000)]
+      RenderBlock {DIV} at (74,74) size 600x0
+      RenderBlock (anonymous) at (74,74) size 600x48
+        RenderText {TEXT} at (0,10) size 54x48
+          text run at (0,10) width 54: "Hello"
+      RenderTable {TABLE} at (74,122) size 6x6
+        RenderTableSection {TBODY} at (0,0) size 0x6
+          RenderTableRow {TR} at (0,0) size 0x0
+            RenderTableCell {TD} at (2,2) size 2x2 [r=0 c=0 rs=1 cs=1]
+      RenderBlock (anonymous) at (74,128) size 600x48
+        RenderBR {BR} at (0,10) size 0x28
+        RenderText {TEXT} at (0,0) size 0x0
+        RenderText {TEXT} at (0,0) size 0x0
+        RenderText {TEXT} at (0,0) size 0x0
+selection is RANGE:
+start:      position 1 of child 2 {TEXT} of root {BODY}
+upstream:   position 0 of child 2 {TEXT} of root {BODY}
+downstream: position 1 of child 2 {TEXT} of root {BODY}
+end:        position 0 of child 4 {TEXT} of root {BODY}
+upstream:   position 0 of child 4 {TEXT} of root {BODY}
+downstream: position 0 of child 5 {BR} of root {BODY}
diff --git a/LayoutTests/editing/selection/select-all-004.html b/LayoutTests/editing/selection/select-all-004.html
new file mode 100644 (file)
index 0000000..a052643
--- /dev/null
@@ -0,0 +1,36 @@
+<html> 
+<head>
+
+<style>
+.editing { 
+    border: solid red 50px;
+    font-size: 24px; 
+    line-height: 48px; 
+    padding: 24px; 
+    margin: 64px;
+    width: 600px; 
+}
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+    selectAllCommand();    
+}
+
+</script>
+
+<title>Editing Test</title> 
+</head> 
+<body contenteditable id="root" class="editing">
+<div id="test"></div>
+Hello
+<table><tr><td></td></tr></table>
+<br>
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
index 2d25ef0ce811e60709216101603788b5e8a190e1..e4b4f6550dae9e76a037800a03b73896d5316d06 100644 (file)
@@ -1,3 +1,17 @@
+2004-09-24  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by John
+
+        Fix for this bug:
+        
+        <rdar://problem/3814660> REGRESSION (8A200-8A259): Select All has no effect on livepage.apple.com
+
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::updateSelection): Move the selection start and end to rendered positions
+        before passing off to the RenderCanvas for drawing.
+        * layout-tests/editing/selection/select-all-004-expected.txt: Added.
+        * layout-tests/editing/selection/select-all-004.html: Added.
+
 2004-09-24  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Maciej.
index 43331fec1710f1731709225d9b6abb7be5d66257..d5ab6e504722fde4ff3b43cbd2218664cb82f598 100644 (file)
@@ -1270,8 +1270,8 @@ void DocumentImpl::updateSelection()
         canvas->clearSelection();
     }
     else {
-        Position startPos(s.start());
-        Position endPos(s.end());
+        Position startPos = Position(s.start()).closestRenderedPosition(UPSTREAM);
+        Position endPos = Position(s.end()).closestRenderedPosition(DOWNSTREAM);
         if (startPos.isNotNull() && endPos.isNotNull()) {
             RenderObject *startRenderer = startPos.node()->renderer();
             RenderObject *endRenderer = endPos.node()->renderer();