Reviewed by John.
Fix two problems with editing around empty list items:
1) Arrowing up or down to an empty list item skipped the list item
2) Deleting the content of a list item made it so you could never get the cursor inside the empty item
Added tests:
* selection/move-by-line-002.html
* deleting/delete-listitem-002.html
* khtml/editing/composite_edit_command.cpp:
(WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
- special check for empty list item because list marker assures non-zero height()
* khtml/xml/dom_position.cpp:
(DOM::Position::inRenderedContent):
- fix check wrt BRs because text box is not required
* rendering/bidi.cpp:
(khtml::RenderBlock::constructLine):
- make sure that br by itself in a list item gets a text-style box
(khtml::RenderBlock::findNextLineBreak):
- make sure that br by itself in a list item gets a box at all
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@12455 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index c9abf18..4b9fcac 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -780,7 +780,10 @@
InlineFlowBox* parentBox = 0;
for (BidiRun* r = sFirstBidiRun; r; r = r->nextRun) {
// Create a box for our object.
- r->box = r->obj->createInlineBox(r->obj->isPositioned(), false, sBidiRunCount == 1);
+ bool isOnlyRun = (sBidiRunCount == 1);
+ if (sBidiRunCount == 2 && !r->obj->isListMarker())
+ isOnlyRun = ((style()->direction() == RTL) ? sLastBidiRun : sFirstBidiRun)->obj->isListMarker();
+ r->box = r->obj->createInlineBox(r->obj->isPositioned(), false, isOnlyRun);
if (r->box) {
// If we have no parent box yet, or if the run is not simply a sibling,
// then we need to construct inline boxes as necessary to properly enclose the
@@ -2094,7 +2097,7 @@
// Optimize for a common case. If we can't find whitespace after the list
// item, then this is all moot. -dwh
RenderObject* next = bidiNext(start.block, o, bidi);
- if (style()->collapseWhiteSpace() && next && next->isText() && static_cast<RenderText*>(next)->stringLength() > 0) {
+ if (style()->collapseWhiteSpace() && next && !next->isBR() && next->isText() && static_cast<RenderText*>(next)->stringLength() > 0) {
RenderText *nextText = static_cast<RenderText*>(next);
QChar nextChar = nextText->text()[0];