Reviewed by John
[WebKit-https.git] / WebCore / khtml / xml / dom_docimpl.cpp
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();