Bug 858526 - Use non-native text offsets in domWinUtils sendQueryContentEvent w/QUERY_CARET_RECT. r=ehsan

This commit is contained in:
Jim Mathies 2013-04-10 09:02:43 -05:00
Родитель f00a0d1d10
Коммит ae248b6cc7
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -701,6 +701,13 @@ nsContentEventHandler::OnQueryCaretRect(nsQueryContentEvent* aEvent)
uint32_t offset;
rv = GetFlatTextOffsetOfRange(mRootContent, mFirstSelectedRange, &offset);
NS_ENSURE_SUCCESS(rv, rv);
// strip out native new lines, we want the non-native offset. The offsets
// handed in here are from selection, caretPositionFromPoint, and editable
// element offset properties. We need to match those or things break.
nsINode* startNode = mFirstSelectedRange->GetStartParent();
if (startNode && startNode->IsNodeOfType(nsINode::eTEXT)) {
offset = ConvertToXPOffset(static_cast<nsIContent*>(startNode), offset);
}
if (offset == aEvent->mInput.mOffset) {
nsRect rect;
nsIFrame* caretFrame = caret->GetGeometry(mSelection, &rect);