Partial fix for bug 141900 (Text entry fields in forms excruciatingly slow.)
mozilla/content/base/public/nsISelectionController.idl
mozilla/content/base/src/nsSelection.cpp
mozilla/editor/composer/src/nsEditorShell.cpp
mozilla/editor/idl/nsIPlaintextEditor.idl
mozilla/editor/libeditor/base/nsEditor.cpp
mozilla/editor/libeditor/base/nsEditor.h
mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp
mozilla/editor/libeditor/html/nsHTMLEditor.cpp
mozilla/editor/libeditor/text/nsEditorEventListeners.cpp
mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp
mozilla/editor/libeditor/text/nsPlaintextEditor.cpp
mozilla/editor/txtsvc/src/nsTextServicesDocument.cpp
mozilla/editor/ui/dialogs/content/EdTableProps.js
mozilla/embedding/components/find/src/nsWebBrowserFind.cpp
mozilla/extensions/xmlterm/base/mozXMLTermSession.cpp
mozilla/layout/base/public/nsIFrameSelection.h
mozilla/layout/html/base/src/nsPresShell.cpp
mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp
mozilla/mailnews/compose/src/nsMsgCompose.cpp
mozilla/xpfe/browser/resources/content/viewPartialSource.js
- Added aIsSynchronous arg to the ScrollSelectionIntoView()
method of nsISelectionController and nsIFrameSelection.
Updated all callers to pass new arg.
- Modified selection to post a plevent to call which does the
call to ScrollIntoView() in the async ScrollIntoView() case.
- Edits in text widgets now use asynchronous reflow, paint,
and scroll processing full time.
- Removed redundant ScrollSelectionIntoView() calls in the
editor event listeners.
- Editor IME code now forced to flush reflows and paints before
getting caret coordinates.
r=jfrancis@netscape.com sr=waterson@netscape.com
git-svn-id: svn://10.0.0.236/trunk@123236 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1886,8 +1886,9 @@ NS_IMETHODIMP
|
||||
nsPlaintextEditor::SetCompositionString(const nsAString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply)
|
||||
{
|
||||
NS_ASSERTION(aTextRangeList, "null ptr");
|
||||
if(nsnull == aTextRangeList)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (nsnull == aTextRangeList)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsICaret> caretP;
|
||||
|
||||
// workaround for windows ime bug 23558: we get every ime event twice.
|
||||
@@ -1905,6 +1906,36 @@ nsPlaintextEditor::SetCompositionString(const nsAString& aCompositionString, nsI
|
||||
|
||||
mIMETextRangeList = aTextRangeList;
|
||||
|
||||
if (!mPresShellWeak)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
||||
if (!ps)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
// XXX_kin: BEGIN HACK! HACK! HACK!
|
||||
// XXX_kin:
|
||||
// XXX_kin: This is lame! The IME stuff needs caret coordinates
|
||||
// XXX_kin: synchronously, but the editor could be using async
|
||||
// XXX_kin: updates (reflows and paints) for performance reasons.
|
||||
// XXX_kin: In order to give IME what it needs, we have to temporarily
|
||||
// XXX_kin: switch to sync updating during this call so that the
|
||||
// XXX_kin: nsAutoPlaceHolderBatch can force sync reflows, paints,
|
||||
// XXX_kin: and selection scrolling, so that we get back accurate
|
||||
// XXX_kin: caret coordinates.
|
||||
|
||||
PRUint32 flags = 0;
|
||||
PRBool restoreFlags = PR_FALSE;
|
||||
|
||||
if (NS_SUCCEEDED(GetFlags(&flags)) &&
|
||||
(flags & nsIPlaintextEditor::eEditorUseAsyncUpdatesMask))
|
||||
{
|
||||
if (NS_SUCCEEDED(SetFlags(flags & (~nsIPlaintextEditor::eEditorUseAsyncUpdatesMask))))
|
||||
restoreFlags = PR_TRUE;
|
||||
}
|
||||
|
||||
// XXX_kin: END HACK! HACK! HACK!
|
||||
|
||||
// we need the nsAutoPlaceHolderBatch destructor called before hitting
|
||||
// GetCaretCoordinates so the states in Frame system sync with content
|
||||
// therefore, we put the nsAutoPlaceHolderBatch into a inner block
|
||||
@@ -1915,11 +1946,6 @@ nsPlaintextEditor::SetCompositionString(const nsAString& aCompositionString, nsI
|
||||
|
||||
mIMEBufferLength = aCompositionString.Length();
|
||||
|
||||
if (!mPresShellWeak)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
||||
if (!ps)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
ps->GetCaret(getter_AddRefs(caretP));
|
||||
caretP->SetCaretDOMSelection(selection);
|
||||
|
||||
@@ -1930,6 +1956,15 @@ nsPlaintextEditor::SetCompositionString(const nsAString& aCompositionString, nsI
|
||||
}
|
||||
}
|
||||
|
||||
// XXX_kin: BEGIN HACK! HACK! HACK!
|
||||
// XXX_kin:
|
||||
// XXX_kin: Restore the previous set of flags!
|
||||
|
||||
if (restoreFlags)
|
||||
SetFlags(flags);
|
||||
|
||||
// XXX_kin: END HACK! HACK! HACK!
|
||||
|
||||
result = caretP->GetCaretCoordinates(nsICaret::eIMECoordinates, selection,
|
||||
&(aReply->mCursorPosition), &(aReply->mCursorIsCollapsed));
|
||||
NS_ASSERTION(NS_SUCCEEDED(result), "cannot get caret position");
|
||||
|
||||
Reference in New Issue
Block a user