Commit d2164870 authored by hyatt's avatar hyatt

Make the selectionRect() method of RenderText better by reusing...

        Make the selectionRect() method of RenderText better by reusing computeAbsoluteRepaintRect.  This enables
        the method to be multi-column aware and also to understand when the selection is clipped out by overflow.

        Reviewed by bdash

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



git-svn-id: svn://svn.chromium.org/blink/trunk@18735 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 2bca5337
2007-01-10 David Hyatt <hyatt@apple.com>
Make the selectionRect() method of RenderText better by reusing computeAbsoluteRepaintRect. This enables
the method to be multi-column aware and also to understand when the selection is clipped out by overflow.
Reviewed by bdash
* rendering/RenderText.cpp:
(WebCore::RenderText::selectionRect):
2007-01-10 David Hyatt <hyatt@apple.com> 2007-01-10 David Hyatt <hyatt@apple.com>
Make the absolutePosition method multi-column aware. Note that there is now a real problem with the Make the absolutePosition method multi-column aware. Note that there is now a real problem with the
......
...@@ -1039,13 +1039,21 @@ IntRect RenderText::selectionRect() ...@@ -1039,13 +1039,21 @@ IntRect RenderText::selectionRect()
if (startPos == endPos) if (startPos == endPos)
return rect; return rect;
int absx, absy;
cb->absolutePositionForContent(absx, absy);
RenderLayer* layer = cb->layer();
if (layer)
layer->subtractScrollOffset(absx, absy);
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
rect.unite(box->selectionRect(absx, absy, startPos, endPos)); rect.unite(box->selectionRect(0, 0, startPos, endPos));
if (cb->hasColumns())
cb->adjustRectForColumns(rect);
if (cb->hasOverflowClip()) {
int x = rect.x();
int y = rect.y();
IntRect boxRect(0, 0, cb->layer()->width(), cb->layer()->height());
cb->layer()->subtractScrollOffset(x, y);
IntRect repaintRect(x, y, rect.width(), rect.height());
rect = intersection(repaintRect, boxRect);
}
cb->computeAbsoluteRepaintRect(rect);
return rect; return rect;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment