Reviewed by Hyatt.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Apr 2007 23:42:52 +0000 (23:42 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Apr 2007 23:42:52 +0000 (23:42 +0000)
        <rdar://problem/5084400> [DOMRange lineBoxRects] returns an empty array when the DOM nodes have just been created

        Don't call selectionRect with a -1 end position, instead use the text length.

        * rendering/RenderText.cpp:
        (WebCore::RenderText::addLineBoxRects):

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

WebCore/ChangeLog
WebCore/rendering/RenderText.cpp

index a5d89ef..14d6af1 100644 (file)
@@ -1,3 +1,14 @@
+2007-04-23  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Hyatt.
+
+        <rdar://problem/5084400> [DOMRange lineBoxRects] returns an empty array when the DOM nodes have just been created
+
+        Don't call selectionRect with a -1 end position, instead use the text length.
+
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::addLineBoxRects):
+
 2007-04-23  Adele Peterson  <adele@apple.com>
 
         Fixed and reviewed by Darin, Adele, and Oliver.
index acb6e15..f946d0f 100644 (file)
@@ -184,7 +184,8 @@ void RenderText::addLineBoxRects(Vector<IntRect>& rects, unsigned start, unsigne
         if (start <= box->start() && box->end() <= end)
             rects.append(IntRect(x + box->xPos(), y + box->yPos(), box->width(), box->height()));
         else {
-            IntRect r = box->selectionRect(x, y, start, end);
+            unsigned realEnd = (end == UINT_MAX ? box->len() : end);
+            IntRect r = box->selectionRect(x, y, start, realEnd);
             if (!r.isEmpty()) {
                 // change the height and y position because selectionRect uses selection-specific values
                 r.setHeight(box->height());