Bug 1295354 part.1 ContentEventHandler::GetLastFrameInRangeForTextRect() shouldn't set nextNodeOfRangeEnd to the start node of aRange because the start node should always be in the range r=smaug

nextNodeOfRangeEnd is used for excluding unnecessary node for computing text rect.  When aRange ends at start of a text node, the frames which are created for the text node shouldn't be used.  However, if the end node of aRange is same as the start node of aRange, the node is not outside of aRange.

This could occur when it's called with empty range or there are some empty text nodes.

MozReview-Commit-ID: C1yCN5WrULe

--HG--
extra : rebase_source : 35d5b8feecd351bef29fe4af79a0f6f5bdad8bec
This commit is contained in:
Masayuki Nakano 2016-08-16 14:37:40 +09:00
Родитель 0ce8616941
Коммит 0283c8daef
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -1553,7 +1553,11 @@ ContentEventHandler::GetLastFrameInRangeForTextRect(nsRange* aRange)
// include the last frame when its content isn't really in aRange. // include the last frame when its content isn't really in aRange.
nsINode* nextNodeOfRangeEnd = nullptr; nsINode* nextNodeOfRangeEnd = nullptr;
if (endNode->IsNodeOfType(nsINode::eTEXT)) { if (endNode->IsNodeOfType(nsINode::eTEXT)) {
if (!endOffset) { // Don't set nextNodeOfRangeEnd to the start node of aRange because if
// endNode is same as start node of the range, the text node shouldn't be
// next of range end even if the offset is 0. This could occur with empty
// text node.
if (!endOffset && aRange->GetStartParent() != endNode) {
nextNodeOfRangeEnd = endNode; nextNodeOfRangeEnd = endNode;
} }
} else if (endOffset < endNode->GetChildCount()) { } else if (endOffset < endNode->GetChildCount()) {