summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RootInlineBox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/rendering/RootInlineBox.cpp')
-rw-r--r--WebCore/rendering/RootInlineBox.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp
index e98d20e..6d42aa7 100644
--- a/WebCore/rendering/RootInlineBox.cpp
+++ b/WebCore/rendering/RootInlineBox.cpp
@@ -187,7 +187,7 @@ void RootInlineBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty)
bool RootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty)
{
- if (m_hasEllipsisBox && object()->style()->visibility() == VISIBLE) {
+ if (m_hasEllipsisBox && visibleToHitTesting()) {
if (ellipsisBox()->nodeAtPoint(request, result, x, y, tx, ty)) {
object()->updateHitTestResult(result, IntPoint(x - tx, y - ty));
return true;
@@ -240,18 +240,28 @@ GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBl
lastBox->xPos() + lastBox->width(), selTop, selHeight,
rootBlock, blockX, blockY, tx, ty, paintInfo));
+ // When dealing with bidi text, a non-contiguous selection region is possible.
+ // e.g. The logical text aaaAAAbbb (capitals denote RTL text and non-capitals LTR) is layed out
+ // visually as 3 text runs |aaa|bbb|AAA| if we select 4 characters from the start of the text the
+ // selection will look like (underline denotes selection):
+ // |aaa|bbb|AAA|
+ // ___ _
+ // We can see that the |bbb| run is not part of the selection while the runs around it are.
if (firstBox && firstBox != lastBox) {
// Now fill in any gaps on the line that occurred between two selected elements.
int lastX = firstBox->xPos() + firstBox->width();
+ bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject::SelectionNone;
for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLeafChild()) {
if (box->selectionState() != RenderObject::SelectionNone) {
- result.uniteCenter(block()->fillHorizontalSelectionGap(box->parent()->object(),
- lastX + tx, selTop + ty,
- box->xPos() - lastX, selHeight, paintInfo));
+ if (isPreviousBoxSelected) // Selection may be non-contiguous, see comment above.
+ result.uniteCenter(block()->fillHorizontalSelectionGap(box->parent()->object(),
+ lastX + tx, selTop + ty,
+ box->xPos() - lastX, selHeight, paintInfo));
lastX = box->xPos() + box->width();
}
if (box == lastBox)
break;
+ isPreviousBoxSelected = box->selectionState() != RenderObject::SelectionNone;
}
}
@@ -332,7 +342,7 @@ RenderBlock* RootInlineBox::block() const
return static_cast<RenderBlock*>(m_object);
}
-bool isEditableLeaf(InlineBox* leaf)
+static bool isEditableLeaf(InlineBox* leaf)
{
return leaf && leaf->object() && leaf->object()->element() && leaf->object()->element()->isContentEditable();
}