Reviewed by levi
<http://bugzilla.opendarwin.org/show_bug.cgi?id=8074>
Caret before/after block tables is too small
<rdar://problem/
4598331>
right arrow out of a table shows cursor in a weird place
Demonstrates 9557:
* editing/input/range-for-empty-document-expected.txt:
Added:
* editing/selection/table-caret-1-expected.checksum: Added.
* editing/selection/table-caret-1-expected.png: Added.
* editing/selection/table-caret-1-expected.txt: Added.
* editing/selection/table-caret-1.html: Added.
* editing/selection/table-caret-2-expected.checksum: Added.
* editing/selection/table-caret-2-expected.png: Added.
* editing/selection/table-caret-2-expected.txt: Added.
* editing/selection/table-caret-2.html: Added.
* editing/selection/table-caret-3-expected.checksum: Added.
* editing/selection/table-caret-3-expected.png: Added.
* editing/selection/table-caret-3-expected.txt: Added.
* editing/selection/table-caret-3.html: Added.
WebCore:
Reviewed by levi
<http://bugzilla.opendarwin.org/show_bug.cgi?id=8074>
Caret before/after block tables is too small
<rdar://problem/
4598331>
right arrow out of a table shows cursor in a weird place
* rendering/RenderBox.cpp:
(WebCore::RenderBox::caretRect): Don't propagate to children,
VisiblePositions inside containers don't refer to children.
Don't use the font height for tables.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14991
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-06-23 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by levi
+
+ <http://bugzilla.opendarwin.org/show_bug.cgi?id=8074>
+ Caret before/after block tables is too small
+ <rdar://problem/4598331>
+ right arrow out of a table shows cursor in a weird place
+
+ Demonstrates 9557:
+ * editing/input/range-for-empty-document-expected.txt:
+ Added:
+ * editing/selection/table-caret-1-expected.checksum: Added.
+ * editing/selection/table-caret-1-expected.png: Added.
+ * editing/selection/table-caret-1-expected.txt: Added.
+ * editing/selection/table-caret-1.html: Added.
+ * editing/selection/table-caret-2-expected.checksum: Added.
+ * editing/selection/table-caret-2-expected.png: Added.
+ * editing/selection/table-caret-2-expected.txt: Added.
+ * editing/selection/table-caret-2.html: Added.
+ * editing/selection/table-caret-3-expected.checksum: Added.
+ * editing/selection/table-caret-3-expected.png: Added.
+ * editing/selection/table-caret-3-expected.txt: Added.
+ * editing/selection/table-caret-3.html: Added.
+
2006-06-22 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Hyatt.
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-(0, 0): 8,574,0,18
+(0, 0): 0,582,0,18
--- /dev/null
+bc9379e0ea88ebbb35817d326d9bf892
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 784x18
+ RenderText {#text} at (0,0) size 381x18
+ text run at (0,0) width 381: "This tests the caret position for the caret before a block table."
+ RenderBlock {DIV} at (0,34) size 784x112
+ RenderBlock (anonymous) at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 21x18
+ text run at (0,0) width 21: "foo"
+ RenderTable {TABLE} at (0,18) size 51x76 [border: (1px solid #999999)]
+ RenderTableSection {TBODY} at (1,1) size 49x74
+ RenderTableRow {TR} at (0,2) size 49x22
+ RenderTableCell {TD} at (2,2) size 45x22 [border: (1px solid #999999)] [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 22x18
+ text run at (2,2) width 22: "this"
+ RenderTableRow {TR} at (0,26) size 49x22
+ RenderTableCell {TD} at (2,26) size 45x22 [border: (1px solid #999999)] [r=1 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 10x18
+ text run at (2,2) width 10: "is"
+ RenderTableRow {TR} at (0,50) size 49x22
+ RenderTableCell {TD} at (2,50) size 45x22 [border: (1px solid #999999)] [r=2 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 41x18
+ text run at (2,2) width 41: "a table"
+ RenderBlock (anonymous) at (0,94) size 784x18
+ RenderText {#text} at (0,0) size 22x18
+ text run at (0,0) width 22: "baz"
+caret: position 0 of child 1 {TABLE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
--- /dev/null
+<style>
+table, td {
+ border: 1px solid #999;
+}
+</style>
+
+<p>This tests the caret position for the caret before a block table.</p>
+
+<div contenteditable="true">foo<table id="test"><tr><td>this</td></tr><tr><td>is</td></tr><tr><td>a table</td></tr></table>baz</div>
+
+<script>
+var s = window.getSelection();
+var e = document.getElementById("test");
+
+s.setPosition(e, 0);
+</script>
\ No newline at end of file
--- /dev/null
+cfd9299efac2ecb61b3cabc3332b3792
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 784x18
+ RenderText {#text} at (0,0) size 369x18
+ text run at (0,0) width 369: "This tests the caret position for the caret after a block table."
+ RenderBlock {DIV} at (0,34) size 784x112
+ RenderBlock (anonymous) at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 21x18
+ text run at (0,0) width 21: "foo"
+ RenderTable {TABLE} at (0,18) size 51x76 [border: (1px solid #999999)]
+ RenderTableSection {TBODY} at (1,1) size 49x74
+ RenderTableRow {TR} at (0,2) size 49x22
+ RenderTableCell {TD} at (2,2) size 45x22 [border: (1px solid #999999)] [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 22x18
+ text run at (2,2) width 22: "this"
+ RenderTableRow {TR} at (0,26) size 49x22
+ RenderTableCell {TD} at (2,26) size 45x22 [border: (1px solid #999999)] [r=1 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 10x18
+ text run at (2,2) width 10: "is"
+ RenderTableRow {TR} at (0,50) size 49x22
+ RenderTableCell {TD} at (2,50) size 45x22 [border: (1px solid #999999)] [r=2 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 41x18
+ text run at (2,2) width 41: "a table"
+ RenderBlock (anonymous) at (0,94) size 784x18
+ RenderText {#text} at (0,0) size 22x18
+ text run at (0,0) width 22: "baz"
+caret: position 1 of child 1 {TABLE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
--- /dev/null
+<style>
+table, td {
+ border: 1px solid #999;
+}
+</style>
+
+<p>This tests the caret position for the caret after a block table.</p>
+
+<div contenteditable="true">foo<table id="test"><tr><td>this</td></tr><tr><td>is</td></tr><tr><td>a table</td></tr></table>baz</div>
+
+<script>
+var s = window.getSelection();
+var e = document.getElementById("test");
+
+s.setPosition(e, e.childNodes.length);
+</script>
\ No newline at end of file
--- /dev/null
+22b1cb5f021c8f7964e5ac84f7fdf4be
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 784x18
+ RenderText {#text} at (0,0) size 377x18
+ text run at (0,0) width 377: "This tests the caret position for the caret after an inline table."
+ RenderBlock {DIV} at (0,34) size 784x80
+ RenderText {#text} at (0,62) size 21x18
+ text run at (0,62) width 21: "foo"
+ RenderTable {TABLE} at (21,0) size 51x76 [border: (1px solid #999999)]
+ RenderTableSection {TBODY} at (1,1) size 49x74
+ RenderTableRow {TR} at (0,2) size 49x22
+ RenderTableCell {TD} at (2,2) size 45x22 [border: (1px solid #999999)] [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 22x18
+ text run at (2,2) width 22: "this"
+ RenderTableRow {TR} at (0,26) size 49x22
+ RenderTableCell {TD} at (2,26) size 45x22 [border: (1px solid #999999)] [r=1 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 10x18
+ text run at (2,2) width 10: "is"
+ RenderTableRow {TR} at (0,50) size 49x22
+ RenderTableCell {TD} at (2,50) size 45x22 [border: (1px solid #999999)] [r=2 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 41x18
+ text run at (2,2) width 41: "a table"
+ RenderText {#text} at (72,62) size 22x18
+ text run at (72,62) width 22: "baz"
+caret: position 1 of child 1 {TABLE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
--- /dev/null
+<style>
+table, td {
+ border: 1px solid #999;
+}
+</style>
+
+<p>This tests the caret position for the caret after an inline table.</p>
+
+<div contenteditable="true">foo<table style="display:inline" id="test"><tr><td>this</td></tr><tr><td>is</td></tr><tr><td>a table</td></tr></table>baz</div>
+
+<script>
+var s = window.getSelection();
+var e = document.getElementById("test");
+
+s.setPosition(e, e.childNodes.length);
+</script>
\ No newline at end of file
+2006-06-23 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by levi
+
+ <http://bugzilla.opendarwin.org/show_bug.cgi?id=8074>
+ Caret before/after block tables is too small
+ <rdar://problem/4598331>
+ right arrow out of a table shows cursor in a weird place
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::caretRect): Don't propagate to children,
+ VisiblePositions inside containers don't refer to children.
+ Don't use the font height for tables.
+
2006-06-23 Brady Eidson <beidson@apple.com>
Reviewed by Kevin.
FAE04190097596C9000540BE /* SVGImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE0418E097596C9000540BE /* SVGImageLoader.h */; };
/* End PBXBuildFile section */
+/* Begin PBXBuildStyle section */
+ D0DAA27B0A4C8EF100703DCF /* Development */ = {
+ isa = PBXBuildStyle;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ };
+ name = Development;
+ };
+ D0DAA27C0A4C8EF100703DCF /* Deployment */ = {
+ isa = PBXBuildStyle;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ };
+ name = Deployment;
+ };
+/* End PBXBuildStyle section */
+
/* Begin PBXContainerItemProxy section */
DD041FF009D9E3250010AF2A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+ buildSettings = {
+ };
+ buildStyles = (
+ D0DAA27B0A4C8EF100703DCF /* Development */,
+ D0DAA27C0A4C8EF100703DCF /* Deployment */,
+ );
hasScannedForEncodings = 1;
knownRegions = (
English,
IntRect RenderBox::caretRect(int offset, EAffinity affinity, int* extraWidthToEndOfLine)
{
- // FIXME: Is it OK to check only first child instead of picking
- // right child based on offset? Is it OK to pass the same offset
- // along to the child instead of offset 0 or whatever?
-
- // propagate it downwards to its children, someone will feel responsible
- if (RenderObject* child = firstChild()) {
- IntRect result = child->caretRect(offset, affinity, extraWidthToEndOfLine);
- if (!result.isEmpty())
- return result;
- }
-
- // if not, use the extents of this box
- // offset 0 means left, offset 1 means right
+ // VisiblePositions at offsets inside containers either a) refer to the positions before/after
+ // those containers (tables and select elements) or b) refer to the position inside an empty block.
+ // They never refer to children.
+ // FIXME: Paint the carets inside empty blocks differently than the carets before/after elements.
+
// FIXME: What about border and padding?
const int caretWidth = 1;
IntRect rect(xPos(), yPos(), caretWidth, m_height);
//
// FIXME: ignoring :first-line, missing good reason to take care of
int fontHeight = style()->font().height();
- if (fontHeight > rect.height() || !isReplaced())
+ if (fontHeight > rect.height() || !isReplaced() && !isTable())
rect.setHeight(fontHeight);
RenderObject* cb = containingBlock();