diff options
Diffstat (limited to 'Source/WebCore/rendering/RenderText.cpp')
-rw-r--r-- | Source/WebCore/rendering/RenderText.cpp | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp index e660875..b35820a 100644 --- a/Source/WebCore/rendering/RenderText.cpp +++ b/Source/WebCore/rendering/RenderText.cpp @@ -177,7 +177,7 @@ void RenderText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl } } -void RenderText::destroy() +void RenderText::removeAndDestroyTextBoxes() { if (!documentBeingDestroyed()) { if (firstTextBox()) { @@ -192,6 +192,11 @@ void RenderText::destroy() parent()->dirtyLinesFromChangedChild(this); } deleteTextBoxes(); +} + +void RenderText::destroy() +{ + removeAndDestroyTextBoxes(); RenderObject::destroy(); } @@ -268,7 +273,7 @@ PassRefPtr<StringImpl> RenderText::originalText() const void RenderText::absoluteRects(Vector<IntRect>& rects, int tx, int ty) { for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) - rects.append(IntRect(tx + box->x(), ty + box->y(), box->logicalWidth(), box->logicalHeight())); + rects.append(enclosingIntRect(FloatRect(tx + box->x(), ty + box->y(), box->width(), box->height()))); } void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, unsigned end, bool useSelectionHeight) @@ -1300,15 +1305,38 @@ IntRect RenderText::linesBoundingBox() const return result; } -IntRect RenderText::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) +IntRect RenderText::linesVisualOverflowBoundingBox() const { - RenderObject* cb = containingBlock(); - // The containing block may be an ancestor of repaintContainer, but we need to do a repaintContainer-relative repaint. - if (repaintContainer && repaintContainer != cb) { - if (!cb->isDescendantOf(repaintContainer)) - return repaintContainer->clippedOverflowRectForRepaint(repaintContainer); + if (!firstTextBox()) + return IntRect(); + + // Return the width of the minimal left side and the maximal right side. + int logicalLeftSide = numeric_limits<int>::max(); + int logicalRightSide = numeric_limits<int>::min(); + for (InlineTextBox* curr = firstTextBox(); curr; curr = curr->nextTextBox()) { + logicalLeftSide = min(logicalLeftSide, curr->logicalLeftVisualOverflow()); + logicalRightSide = max(logicalRightSide, curr->logicalRightVisualOverflow()); } - return cb->clippedOverflowRectForRepaint(repaintContainer); + + int logicalTop = firstTextBox()->logicalTopVisualOverflow(); + int logicalWidth = logicalRightSide - logicalLeftSide; + int logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - logicalTop; + + IntRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); + if (!style()->isHorizontalWritingMode()) + rect = rect.transposedRect(); + return rect; +} + +IntRect RenderText::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) +{ + bool repaintContainerSkipped; + RenderObject* container = this->container(repaintContainer, &repaintContainerSkipped); + // The container may be an ancestor of repaintContainer, but we need to do a repaintContainer-relative repaint. + if (repaintContainerSkipped) + return repaintContainer->clippedOverflowRectForRepaint(repaintContainer); + + return container->clippedOverflowRectForRepaint(repaintContainer); } IntRect RenderText::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent) |