* khtml/xml/dom_position.cpp:
(DOM::Position::downstream): Fix a bug in downstream that prevented a call with DoNotStayInBlock
specified from obeying that directive. The old code would stop at an outer block boundary in
the case where that block had a block as its first child. The correct behavior is to drill into
that inner block (and continue on drilling down, if possible), to find the correct position.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8083
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2004-11-29 Ken Kocienda <kocienda@apple.com>
+
+ Reviewed by Harrison
+
+ * khtml/xml/dom_position.cpp:
+ (DOM::Position::downstream): Fix a bug in downstream that prevented a call with DoNotStayInBlock
+ specified from obeying that directive. The old code would stop at an outer block boundary in
+ the case where that block had a block as its first child. The correct behavior is to drill into
+ that inner block (and continue on drilling down, if possible), to find the correct position.
+
2004-11-29 Ken Kocienda <kocienda@apple.com>
Reviewed by Harrison
if (renderer->style()->visibility() != VISIBLE)
continue;
- if ((currentNode != startNode && renderer->isBlockFlow()) || renderer->isReplaced() || renderer->isBR()) {
+ if (currentNode != startNode && renderer->isBlockFlow()) {
+ if (it.current().offset() == 0) {
+ NodeImpl *node = currentNode;
+ while (NodeImpl *firstChild = node->firstChild()) {
+ if (node->renderer()->style()->visibility() == VISIBLE && node->renderer()->isBlockFlow())
+ node = firstChild;
+ }
+ return Position(node, 0);
+ }
+ else
+ continue;
+ }
+
+ if (renderer->isReplaced() || renderer->isBR()) {
if (it.current().offset() <= renderer->caretMinOffset())
return Position(currentNode, renderer->caretMinOffset());
else