зеркало из https://github.com/mozilla/gecko-dev.git
Undefine caret bidi level during reflow instead of on text entry. Bug 664087, r=roc
This commit is contained in:
Родитель
15cb6ce863
Коммит
41b695192a
|
@ -389,26 +389,6 @@ nsHTMLEditRules::AfterEdit(PRInt32 action, nsIEditor::EDirection aDirection)
|
|||
// free up selectionState range item
|
||||
(mHTMLEditor->mRangeUpdater).DropRangeItem(&mRangeItem);
|
||||
|
||||
/* After inserting text the cursor Bidi level must be set to the level of the inserted text.
|
||||
* This is difficult, because we cannot know what the level is until after the Bidi algorithm
|
||||
* is applied to the whole paragraph.
|
||||
*
|
||||
* So we set the cursor Bidi level to UNDEFINED here, and the caret code will set it correctly later
|
||||
*/
|
||||
if (action == nsEditor::kOpInsertText
|
||||
|| action == nsEditor::kOpInsertIMEText) {
|
||||
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
nsCOMPtr<nsISelectionPrivate> privateSelection(do_QueryInterface(selection));
|
||||
nsRefPtr<nsFrameSelection> frameSelection;
|
||||
privateSelection->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (frameSelection) {
|
||||
frameSelection->UndefineCaretBidiLevel();
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the contenteditable count to its previous value
|
||||
if (mRestoreContentEditableCount) {
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
|
|
|
@ -231,22 +231,6 @@ nsTextEditRules::AfterEdit(PRInt32 action, nsIEditor::EDirection aDirection)
|
|||
|
||||
// collapse the selection to the trailing BR if it's at the end of our text node
|
||||
CollapseSelectionToTrailingBRIfNeeded(selection);
|
||||
|
||||
/* After inserting text the cursor Bidi level must be set to the level of the inserted text.
|
||||
* This is difficult, because we cannot know what the level is until after the Bidi algorithm
|
||||
* is applied to the whole paragraph.
|
||||
*
|
||||
* So we set the cursor Bidi level to UNDEFINED here, and the caret code will set it correctly later
|
||||
*/
|
||||
if (action == nsEditor::kOpInsertText
|
||||
|| action == nsEditor::kOpInsertIMEText) {
|
||||
nsCOMPtr<nsISelectionPrivate> privateSelection(do_QueryInterface(selection));
|
||||
nsRefPtr<nsFrameSelection> frameSelection;
|
||||
privateSelection->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (frameSelection) {
|
||||
frameSelection->UndefineCaretBidiLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -7637,6 +7637,19 @@ nsTextFrame::AdjustOffsetsForBidi(PRInt32 aStart, PRInt32 aEnd)
|
|||
|
||||
mContentOffset = aStart;
|
||||
SetLength(aEnd - aStart, nsnull, 0);
|
||||
|
||||
/**
|
||||
* After inserting text the caret Bidi level must be set to the level of the
|
||||
* inserted text.This is difficult, because we cannot know what the level is
|
||||
* until after the Bidi algorithm is applied to the whole paragraph.
|
||||
*
|
||||
* So we set the caret Bidi level to UNDEFINED here, and the caret code will
|
||||
* set it correctly later
|
||||
*/
|
||||
nsRefPtr<nsFrameSelection> frameSelection = GetFrameSelection();
|
||||
if (frameSelection) {
|
||||
frameSelection->UndefineCaretBidiLevel();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче