summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp')
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp43
1 files changed, 20 insertions, 23 deletions
diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp
index 085224721fe..9e0f01a30bc 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp
+++ b/chromium/third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp
@@ -170,27 +170,25 @@ bool RenderLineBoxList::rangeIntersectsRect(RenderBoxModelObject* renderer, Layo
return true;
}
-bool RenderLineBoxList::anyLineIntersectsRect(RenderBoxModelObject* renderer, const LayoutRect& rect, const LayoutPoint& offset, LayoutUnit outlineSize) const
+bool RenderLineBoxList::anyLineIntersectsRect(RenderBoxModelObject* renderer, const LayoutRect& rect, const LayoutPoint& offset) const
{
// We can check the first box and last box and avoid painting/hit testing if we don't
// intersect. This is a quick short-circuit that we can take to avoid walking any lines.
// FIXME: This check is flawed in the following extremely obscure way:
// if some line in the middle has a huge overflow, it might actually extend below the last line.
- RootInlineBox* firstRootBox = firstLineBox()->root();
- RootInlineBox* lastRootBox = lastLineBox()->root();
- LayoutUnit firstLineTop = firstLineBox()->logicalTopVisualOverflow(firstRootBox->lineTop());
- LayoutUnit lastLineBottom = lastLineBox()->logicalBottomVisualOverflow(lastRootBox->lineBottom());
- LayoutUnit logicalTop = firstLineTop - outlineSize;
- LayoutUnit logicalBottom = outlineSize + lastLineBottom;
-
- return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, offset);
+ RootInlineBox& firstRootBox = firstLineBox()->root();
+ RootInlineBox& lastRootBox = lastLineBox()->root();
+ LayoutUnit firstLineTop = firstLineBox()->logicalTopVisualOverflow(firstRootBox.lineTop());
+ LayoutUnit lastLineBottom = lastLineBox()->logicalBottomVisualOverflow(lastRootBox.lineBottom());
+
+ return rangeIntersectsRect(renderer, firstLineTop, lastLineBottom, rect, offset);
}
bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const
{
- RootInlineBox* root = box->root();
- LayoutUnit logicalTop = min<LayoutUnit>(box->logicalTopVisualOverflow(root->lineTop()), root->selectionTop()) - renderer->maximalOutlineSize(paintInfo.phase);
- LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root->lineBottom()) + renderer->maximalOutlineSize(paintInfo.phase);
+ RootInlineBox& root = box->root();
+ LayoutUnit logicalTop = min<LayoutUnit>(box->logicalTopVisualOverflow(root.lineTop()), root.selectionTop());
+ LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root.lineBottom());
return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.rect, offset);
}
@@ -209,8 +207,7 @@ void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn
if (!firstLineBox())
return;
- LayoutUnit outlineSize = renderer->maximalOutlineSize(paintInfo.phase);
- if (!anyLineIntersectsRect(renderer, paintInfo.rect, paintOffset, outlineSize))
+ if (!anyLineIntersectsRect(renderer, paintInfo.rect, paintOffset))
return;
PaintInfo info(paintInfo);
@@ -222,8 +219,8 @@ void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn
// based off positions of our first line box or our last line box.
for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
if (lineIntersectsDirtyRect(renderer, curr, info, paintOffset)) {
- RootInlineBox* root = curr->root();
- curr->paint(info, paintOffset, root->lineTop(), root->lineBottom());
+ RootInlineBox& root = curr->root();
+ curr->paint(info, paintOffset, root.lineTop(), root.lineBottom());
}
}
@@ -260,9 +257,9 @@ bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq
// them further. Note that boxes can easily overlap, so we can't make any assumptions
// based off positions of our first line box or our last line box.
for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) {
- RootInlineBox* root = curr->root();
- if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root->lineTop()), curr->logicalBottomVisualOverflow(root->lineBottom()), rect, accumulatedOffset)) {
- bool inside = curr->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, root->lineTop(), root->lineBottom());
+ RootInlineBox& root = curr->root();
+ if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root.lineTop()), curr->logicalBottomVisualOverflow(root.lineBottom()), rect, accumulatedOffset)) {
+ bool inside = curr->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, root.lineTop(), root.lineBottom());
if (inside) {
renderer->updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
return true;
@@ -304,15 +301,15 @@ void RenderLineBoxList::dirtyLinesFromChangedChild(RenderObject* container, Rend
if (curr->isReplaced()) {
InlineBox* wrapper = toRenderBox(curr)->inlineBoxWrapper();
if (wrapper)
- box = wrapper->root();
+ box = &wrapper->root();
} else if (curr->isText()) {
InlineTextBox* textBox = toRenderText(curr)->lastTextBox();
if (textBox)
- box = textBox->root();
+ box = &textBox->root();
} else if (curr->isRenderInline()) {
InlineBox* lastSiblingBox = toRenderInline(curr)->lastLineBoxIncludingCulling();
if (lastSiblingBox)
- box = lastSiblingBox->root();
+ box = &lastSiblingBox->root();
}
if (box)
@@ -331,7 +328,7 @@ void RenderLineBoxList::dirtyLinesFromChangedChild(RenderObject* container, Rend
}
return;
}
- box = firstBox->root();
+ box = &firstBox->root();
}
// If we found a line box, then dirty it.