summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/rendering/RenderText.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-06-02 12:07:03 +0100
committerBen Murdoch <benm@google.com>2011-06-10 10:47:21 +0100
commit2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch)
treee4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/rendering/RenderText.cpp
parent87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff)
downloadexternal_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/rendering/RenderText.cpp')
-rw-r--r--Source/WebCore/rendering/RenderText.cpp46
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)