LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2007 01:10:15 +0000 (01:10 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2007 01:10:15 +0000 (01:10 +0000)
        Reviewed by darin

        <rdar://problem/5131716>
        Clicking just before a ToDo doesn't put the caret before the ToDo

        * editing/selection/5131716-1-expected.checksum: Added.
        * editing/selection/5131716-1-expected.png: Added.
        * editing/selection/5131716-1-expected.txt: Added.
        * editing/selection/5131716-1.html: Added.
        * editing/selection/5131716-2-expected.checksum: Added.
        * editing/selection/5131716-2-expected.png: Added.
        * editing/selection/5131716-2-expected.txt: Added.
        * editing/selection/5131716-2.html: Added.
        * editing/selection/5131716-3-expected.checksum: Added.
        * editing/selection/5131716-3-expected.png: Added.
        * editing/selection/5131716-3-expected.txt: Added.
        * editing/selection/5131716-3.html: Added.
        * editing/selection/5131716-4-expected.checksum: Added.
        * editing/selection/5131716-4-expected.png: Added.
        * editing/selection/5131716-4-expected.txt: Added.
        * editing/selection/5131716-4.html: Added.

WebCore:

        Reviewed by darin

        <rdar://problem/5131716>
        Clicking just before a ToDo doesn't put the caret before the ToDo

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::positionForCoordinates):
        Consider clicks inside the blocks padding, instead of
        incorrectly sending them to the position before the block.

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

19 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/selection/5131716-1-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/5131716-1-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/5131716-1-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/5131716-1.html [new file with mode: 0644]
LayoutTests/editing/selection/5131716-2-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/5131716-2-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/5131716-2-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/5131716-2.html [new file with mode: 0644]
LayoutTests/editing/selection/5131716-3-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/5131716-3-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/5131716-3-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/5131716-3.html [new file with mode: 0644]
LayoutTests/editing/selection/5131716-4-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/5131716-4-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/5131716-4-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/5131716-4.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderBlock.cpp

index 8585446..bf54397 100644 (file)
@@ -1,3 +1,27 @@
+2007-04-12  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by darin
+        
+        <rdar://problem/5131716> 
+        Clicking just before a ToDo doesn't put the caret before the ToDo
+        
+        * editing/selection/5131716-1-expected.checksum: Added.
+        * editing/selection/5131716-1-expected.png: Added.
+        * editing/selection/5131716-1-expected.txt: Added.
+        * editing/selection/5131716-1.html: Added.
+        * editing/selection/5131716-2-expected.checksum: Added.
+        * editing/selection/5131716-2-expected.png: Added.
+        * editing/selection/5131716-2-expected.txt: Added.
+        * editing/selection/5131716-2.html: Added.
+        * editing/selection/5131716-3-expected.checksum: Added.
+        * editing/selection/5131716-3-expected.png: Added.
+        * editing/selection/5131716-3-expected.txt: Added.
+        * editing/selection/5131716-3.html: Added.
+        * editing/selection/5131716-4-expected.checksum: Added.
+        * editing/selection/5131716-4-expected.png: Added.
+        * editing/selection/5131716-4-expected.txt: Added.
+        * editing/selection/5131716-4.html: Added.
+
 2007-04-11  Mitz Pettel  <mitz@webkit.org>
 
         Reviewed by Dave Hyatt.
diff --git a/LayoutTests/editing/selection/5131716-1-expected.checksum b/LayoutTests/editing/selection/5131716-1-expected.checksum
new file mode 100644 (file)
index 0000000..7054a3b
--- /dev/null
@@ -0,0 +1 @@
+5f71661f9acaff4b07b678fdcb2b964e
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/5131716-1-expected.png b/LayoutTests/editing/selection/5131716-1-expected.png
new file mode 100644 (file)
index 0000000..7fc747c
Binary files /dev/null and b/LayoutTests/editing/selection/5131716-1-expected.png differ
diff --git a/LayoutTests/editing/selection/5131716-1-expected.txt b/LayoutTests/editing/selection/5131716-1-expected.txt
new file mode 100644 (file)
index 0000000..856d3e6
--- /dev/null
@@ -0,0 +1,27 @@
+layer at (0,0) size 800x600
+  RenderView 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 {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 724x36
+          text run at (0,0) width 446: "This tests clicking to place a caret in the padding of an editable region. "
+          text run at (446,0) width 278: "The eventSender clicks to the left of the first"
+          text run at (0,18) width 650: "paragraph in the left padding of the editable region and the caret should be at the start of that paragraph."
+      RenderBlock {DIV} at (0,52) size 784x116 [border: (1px solid #000000)]
+        RenderBlock {DIV} at (26,26) size 732x18
+          RenderText {#text} at (0,0) size 99x18
+            text run at (0,0) width 99: "Paragraph One."
+        RenderTable {TABLE} at (26,44) size 93x28 [border: (1px solid #BBBBBB)]
+          RenderTableSection {TBODY} at (1,1) size 91x26
+            RenderTableRow {TR} at (0,2) size 91x22 [border: (1px solid #BBBBBB)]
+              RenderTableCell {TD} at (2,2) size 8x22 [border: (1px solid #BBBBBB)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 4x18
+                  text run at (2,2) width 4: " "
+              RenderTableCell {TD} at (12,2) size 77x22 [border: (1px solid #BBBBBB)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 73x18
+                  text run at (2,2) width 73: "ToDo One."
+        RenderBlock {DIV} at (26,72) size 732x18
+          RenderText {#text} at (0,0) size 102x18
+            text run at (0,0) width 102: "Paragraph Two."
+caret: position 0 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/5131716-1.html b/LayoutTests/editing/selection/5131716-1.html
new file mode 100644 (file)
index 0000000..f4e75f3
--- /dev/null
@@ -0,0 +1,26 @@
+<style>
+td, tr {
+    border: 1px solid #bbb;
+}
+</style>
+
+<body>
+<p>This tests clicking to place a caret in the padding of an editable region.  The eventSender clicks to the left of the first paragraph in the left padding of the editable region and the caret should be at the start of that paragraph.</p>
+<div style="border: 1px solid black; padding: 25px;" contenteditable="true">
+<div id="p1">Paragraph One.</div>
+<table id="t1" contenteditable="false" style="border: 1px solid #bbb;"><tr><td>&nbsp;</td><td contenteditable="true">ToDo One.</td></tr></table>
+<div id="p2">Paragraph Two.</div>
+</div>
+
+<script>
+if (window.layoutTestController) {
+    var o = document.getElementById("p1");
+    x = o.offsetParent.offsetLeft + o.offsetLeft - 10;
+    y = o.offsetParent.offsetTop + o.offsetTop + o.offsetHeight / 2;
+    
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+</script>
+</body>
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/5131716-2-expected.checksum b/LayoutTests/editing/selection/5131716-2-expected.checksum
new file mode 100644 (file)
index 0000000..341b4e3
--- /dev/null
@@ -0,0 +1 @@
+90f6a4947182588a78aac91c99f942e4
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/5131716-2-expected.png b/LayoutTests/editing/selection/5131716-2-expected.png
new file mode 100644 (file)
index 0000000..379bf99
Binary files /dev/null and b/LayoutTests/editing/selection/5131716-2-expected.png differ
diff --git a/LayoutTests/editing/selection/5131716-2-expected.txt b/LayoutTests/editing/selection/5131716-2-expected.txt
new file mode 100644 (file)
index 0000000..98aabf0
--- /dev/null
@@ -0,0 +1,27 @@
+layer at (0,0) size 800x600
+  RenderView 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 {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 777x36
+          text run at (0,0) width 446: "This tests clicking to place a caret in the padding of an editable region. "
+          text run at (446,0) width 331: "The eventSender clicks to the left of the ToDo in the"
+          text run at (0,18) width 504: "left padding of the editable region and the caret should be just before that ToDo."
+      RenderBlock {DIV} at (0,52) size 784x116 [border: (1px solid #000000)]
+        RenderBlock {DIV} at (26,26) size 732x18
+          RenderText {#text} at (0,0) size 99x18
+            text run at (0,0) width 99: "Paragraph One."
+        RenderTable {TABLE} at (26,44) size 93x28 [border: (1px solid #BBBBBB)]
+          RenderTableSection {TBODY} at (1,1) size 91x26
+            RenderTableRow {TR} at (0,2) size 91x22 [border: (1px solid #BBBBBB)]
+              RenderTableCell {TD} at (2,2) size 8x22 [border: (1px solid #BBBBBB)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 4x18
+                  text run at (2,2) width 4: " "
+              RenderTableCell {TD} at (12,2) size 77x22 [border: (1px solid #BBBBBB)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 73x18
+                  text run at (2,2) width 73: "ToDo One."
+        RenderBlock {DIV} at (26,72) size 732x18
+          RenderText {#text} at (0,0) size 102x18
+            text run at (0,0) width 102: "Paragraph Two."
+caret: position 0 of child 3 {TABLE} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/5131716-2.html b/LayoutTests/editing/selection/5131716-2.html
new file mode 100644 (file)
index 0000000..0adec5b
--- /dev/null
@@ -0,0 +1,26 @@
+<style>
+td, tr {
+    border: 1px solid #bbb;
+}
+</style>
+
+<body>
+<p>This tests clicking to place a caret in the padding of an editable region.  The eventSender clicks to the left of the ToDo in the left padding of the editable region and the caret should be just before that ToDo.</p>
+<div style="border: 1px solid black; padding: 25px;" contenteditable="true">
+<div id="p1">Paragraph One.</div>
+<table id="t1" contenteditable="false" style="border: 1px solid #bbb;"><tr><td>&nbsp;</td><td contenteditable="true">ToDo One.</td></tr></table>
+<div id="p2">Paragraph Two.</div>
+</div>
+
+<script>
+if (window.layoutTestController) {
+    var o = document.getElementById("t1");
+    x = o.offsetParent.offsetLeft + o.offsetLeft - 10;
+    y = o.offsetParent.offsetTop + o.offsetTop + o.offsetHeight / 2;
+    
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+</script>
+</body>
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/5131716-3-expected.checksum b/LayoutTests/editing/selection/5131716-3-expected.checksum
new file mode 100644 (file)
index 0000000..8f4ade2
--- /dev/null
@@ -0,0 +1 @@
+0b9c790f722a7d17c4c9f0f9e08d8acd
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/5131716-3-expected.png b/LayoutTests/editing/selection/5131716-3-expected.png
new file mode 100644 (file)
index 0000000..825c9b0
Binary files /dev/null and b/LayoutTests/editing/selection/5131716-3-expected.png differ
diff --git a/LayoutTests/editing/selection/5131716-3-expected.txt b/LayoutTests/editing/selection/5131716-3-expected.txt
new file mode 100644 (file)
index 0000000..bdb4c26
--- /dev/null
@@ -0,0 +1,27 @@
+layer at (0,0) size 800x600
+  RenderView 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 {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 774x36
+          text run at (0,0) width 446: "This tests clicking to place a caret in the padding of an editable region. "
+          text run at (446,0) width 328: "The eventSender clicks in the left padding to the left"
+          text run at (0,18) width 468: "of the third paragraph and the caret should be at the start of that paragraph."
+      RenderBlock {DIV} at (0,52) size 784x116 [border: (1px solid #000000)]
+        RenderBlock {DIV} at (26,26) size 732x18
+          RenderText {#text} at (0,0) size 99x18
+            text run at (0,0) width 99: "Paragraph One."
+        RenderTable {TABLE} at (26,44) size 93x28 [border: (1px solid #BBBBBB)]
+          RenderTableSection {TBODY} at (1,1) size 91x26
+            RenderTableRow {TR} at (0,2) size 91x22 [border: (1px solid #BBBBBB)]
+              RenderTableCell {TD} at (2,2) size 8x22 [border: (1px solid #BBBBBB)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 4x18
+                  text run at (2,2) width 4: " "
+              RenderTableCell {TD} at (12,2) size 77x22 [border: (1px solid #BBBBBB)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 73x18
+                  text run at (2,2) width 73: "ToDo One."
+        RenderBlock {DIV} at (26,72) size 732x18
+          RenderText {#text} at (0,0) size 102x18
+            text run at (0,0) width 102: "Paragraph Two."
+caret: position 0 of child 0 {#text} of child 5 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/5131716-3.html b/LayoutTests/editing/selection/5131716-3.html
new file mode 100644 (file)
index 0000000..0abb84f
--- /dev/null
@@ -0,0 +1,26 @@
+<style>
+td, tr {
+    border: 1px solid #bbb;
+}
+</style>
+
+<body>
+<p>This tests clicking to place a caret in the padding of an editable region.  The eventSender clicks in the left padding to the left of the third paragraph and the caret should be at the start of that paragraph.</p>
+<div style="border: 1px solid black; padding: 25px;" contenteditable="true">
+<div id="p1">Paragraph One.</div>
+<table id="t1" contenteditable="false" style="border: 1px solid #bbb;"><tr><td>&nbsp;</td><td contenteditable="true">ToDo One.</td></tr></table>
+<div id="p2">Paragraph Two.</div>
+</div>
+
+<script>
+if (window.layoutTestController) {
+    var o = document.getElementById("p2");
+    x = o.offsetParent.offsetLeft + o.offsetLeft - 10;
+    y = o.offsetParent.offsetTop + o.offsetTop + o.offsetHeight / 2;
+    
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+</script>
+</body>
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/5131716-4-expected.checksum b/LayoutTests/editing/selection/5131716-4-expected.checksum
new file mode 100644 (file)
index 0000000..a413046
--- /dev/null
@@ -0,0 +1 @@
+ce5b2445bfeb350cb9db03e841ac2107
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/5131716-4-expected.png b/LayoutTests/editing/selection/5131716-4-expected.png
new file mode 100644 (file)
index 0000000..4343059
Binary files /dev/null and b/LayoutTests/editing/selection/5131716-4-expected.png differ
diff --git a/LayoutTests/editing/selection/5131716-4-expected.txt b/LayoutTests/editing/selection/5131716-4-expected.txt
new file mode 100644 (file)
index 0000000..7893407
--- /dev/null
@@ -0,0 +1,27 @@
+layer at (0,0) size 800x600
+  RenderView 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 {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 775x36
+          text run at (0,0) width 446: "This tests clicking to place a caret in the padding of an editable region. "
+          text run at (446,0) width 329: "The eventSender clicks in the bottom padding of the"
+          text run at (0,18) width 444: "editable region and the caret should be placed at the end of that region."
+      RenderBlock {DIV} at (0,52) size 784x116 [border: (1px solid #000000)]
+        RenderBlock {DIV} at (26,26) size 732x18
+          RenderText {#text} at (0,0) size 99x18
+            text run at (0,0) width 99: "Paragraph One."
+        RenderTable {TABLE} at (26,44) size 93x28 [border: (1px solid #BBBBBB)]
+          RenderTableSection {TBODY} at (1,1) size 91x26
+            RenderTableRow {TR} at (0,2) size 91x22 [border: (1px solid #BBBBBB)]
+              RenderTableCell {TD} at (2,2) size 8x22 [border: (1px solid #BBBBBB)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 4x18
+                  text run at (2,2) width 4: " "
+              RenderTableCell {TD} at (12,2) size 77x22 [border: (1px solid #BBBBBB)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 73x18
+                  text run at (2,2) width 73: "ToDo One."
+        RenderBlock {DIV} at (26,72) size 732x18
+          RenderText {#text} at (0,0) size 102x18
+            text run at (0,0) width 102: "Paragraph Two."
+caret: position 14 of child 0 {#text} of child 5 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/5131716-4.html b/LayoutTests/editing/selection/5131716-4.html
new file mode 100644 (file)
index 0000000..efe3ce6
--- /dev/null
@@ -0,0 +1,26 @@
+<style>
+td, tr {
+    border: 1px solid #bbb;
+}
+</style>
+
+<body>
+<p>This tests clicking to place a caret in the padding of an editable region.  The eventSender clicks in the bottom padding of the editable region and the caret should be placed at the end of that region.</p>
+<div style="border: 1px solid black; padding: 25px;" contenteditable="true">
+<div id="p1">Paragraph One.</div>
+<table id="t1" contenteditable="false" style="border: 1px solid #bbb;"><tr><td>&nbsp;</td><td contenteditable="true">ToDo One.</td></tr></table>
+<div id="p2">Paragraph Two.</div>
+</div>
+
+<script>
+if (window.layoutTestController) {
+    var o = document.getElementById("p2");
+    x = o.offsetParent.offsetLeft + o.offsetLeft + o.offsetWidth / 2;
+    y = o.offsetParent.offsetTop + o.offsetTop + o.offsetHeight + 10;
+    
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+</script>
+</body>
\ No newline at end of file
index da833f7..ba83888 100644 (file)
@@ -1,3 +1,15 @@
+2007-04-12  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by darin
+        
+        <rdar://problem/5131716> 
+        Clicking just before a ToDo doesn't put the caret before the ToDo
+        
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::positionForCoordinates):
+        Consider clicks inside the blocks padding, instead of
+        incorrectly sending them to the position before the block.
+
 2007-04-12  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Anders
index 3cd18a1..6412f0b 100644 (file)
@@ -2847,11 +2847,11 @@ VisiblePosition RenderBlock::positionForCoordinates(int x, int y)
     if (isTable())
         return RenderFlow::positionForCoordinates(x, y); 
 
-    int top = borderTop() + paddingTop();
-    int bottom = top + contentHeight() + borderTopExtra() + borderBottomExtra();
+    int top = borderTop();
+    int bottom = top + borderTopExtra() + paddingTop() + contentHeight() + paddingBottom() + borderBottomExtra();
 
-    int left = borderLeft() + paddingLeft();
-    int right = left + contentWidth();
+    int left = borderLeft();
+    int right = left + paddingLeft() + contentWidth() + paddingRight();
 
     Node* n = element();