Bug 757771 part 2 - Change various callers to use nsTypedSelection; r=ehsan

This commit is contained in:
Aryeh Gregor 2012-06-05 11:10:26 +03:00
Родитель 29b2ea5b20
Коммит c7fb4c0759
4 изменённых файлов: 19 добавлений и 21 удалений

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

@ -1237,7 +1237,7 @@ nsHTMLEditRules::WillInsert(nsISelection *aSelection, bool *aCancel)
nsresult
nsHTMLEditRules::WillInsertText(nsEditor::OperationID aAction,
nsISelection *aSelection,
nsTypedSelection* aSelection,
bool *aCancel,
bool *aHandled,
const nsAString *inString,
@ -1463,7 +1463,7 @@ nsHTMLEditRules::WillLoadHTML(nsISelection *aSelection, bool *aCancel)
}
nsresult
nsHTMLEditRules::WillInsertBreak(nsISelection* aSelection,
nsHTMLEditRules::WillInsertBreak(nsTypedSelection* aSelection,
bool* aCancel, bool* aHandled)
{
if (!aSelection || !aCancel || !aHandled) {
@ -1779,7 +1779,7 @@ nsHTMLEditRules::SplitMailCites(nsISelection *aSelection, bool aPlaintext, bool
nsresult
nsHTMLEditRules::WillDeleteSelection(nsISelection* aSelection,
nsHTMLEditRules::WillDeleteSelection(nsTypedSelection* aSelection,
nsIEditor::EDirection aAction,
nsIEditor::EStripWrappers aStripWrappers,
bool* aCancel,
@ -1980,8 +1980,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection* aSelection,
NS_ENSURE_SUCCESS(res, res);
bool interLineIsRight;
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(aSelection));
res = selPriv->GetInterlinePosition(&interLineIsRight);
res = aSelection->GetInterlinePosition(&interLineIsRight);
NS_ENSURE_SUCCESS(res, res);
if (startNode == selNode &&
@ -1997,7 +1996,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection* aSelection,
// by setting the interline position to left.
++selOffset;
res = aSelection->Collapse(selNode, selOffset);
selPriv->SetInterlinePosition(false);
aSelection->SetInterlinePosition(false);
mDidExplicitlySetInterline = true;
*aHandled = true;
@ -2350,8 +2349,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection* aSelection,
// else blocks not same type, or not siblings. Delete everything except
// table elements.
nsCOMPtr<nsIEnumerator> enumerator;
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(aSelection));
res = selPriv->GetEnumerator(getter_AddRefs(enumerator));
res = aSelection->GetEnumerator(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(enumerator, NS_ERROR_UNEXPECTED);

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

@ -108,18 +108,19 @@ protected:
// nsHTMLEditRules implementation methods
nsresult WillInsert(nsISelection *aSelection, bool *aCancel);
nsresult WillInsertText( nsEditor::OperationID aAction,
nsISelection *aSelection,
nsTypedSelection* aSelection,
bool *aCancel,
bool *aHandled,
const nsAString *inString,
nsAString *outString,
PRInt32 aMaxLength);
nsresult WillLoadHTML(nsISelection *aSelection, bool *aCancel);
nsresult WillInsertBreak(nsISelection *aSelection, bool *aCancel, bool *aHandled);
nsresult WillInsertBreak(nsTypedSelection* aSelection,
bool* aCancel, bool* aHandled);
nsresult StandardBreakImpl(nsIDOMNode *aNode, PRInt32 aOffset, nsISelection *aSelection);
nsresult DidInsertBreak(nsISelection *aSelection, nsresult aResult);
nsresult SplitMailCites(nsISelection *aSelection, bool aPlaintext, bool *aHandled);
nsresult WillDeleteSelection(nsISelection* aSelection,
nsresult WillDeleteSelection(nsTypedSelection* aSelection,
nsIEditor::EDirection aAction,
nsIEditor::EStripWrappers aStripWrappers,
bool* aCancel, bool* aHandled);

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

@ -333,7 +333,7 @@ nsTextEditRules::DidInsert(nsISelection *aSelection, nsresult aResult)
}
nsresult
nsTextEditRules::WillInsertBreak(nsISelection *aSelection,
nsTextEditRules::WillInsertBreak(nsTypedSelection* aSelection,
bool *aCancel,
bool *aHandled,
PRInt32 aMaxLength)
@ -540,7 +540,7 @@ nsTextEditRules::HandleNewLines(nsString &aString,
nsresult
nsTextEditRules::WillInsertText(nsEditor::OperationID aAction,
nsISelection *aSelection,
nsTypedSelection* aSelection,
bool *aCancel,
bool *aHandled,
const nsAString *inString,
@ -697,8 +697,7 @@ nsTextEditRules::WillInsertText(nsEditor::OperationID aAction,
// in which case make the caret attach to the next line.
bool endsWithLF =
!outString->IsEmpty() && outString->Last() == nsCRT::LF;
nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(aSelection));
selPrivate->SetInterlinePosition(endsWithLF);
aSelection->SetInterlinePosition(endsWithLF);
aSelection->Collapse(curNode, curOffset);
}
@ -755,7 +754,7 @@ nsTextEditRules::DidRemoveTextProperty(nsISelection *aSelection, nsresult aResul
}
nsresult
nsTextEditRules::WillDeleteSelection(nsISelection *aSelection,
nsTextEditRules::WillDeleteSelection(nsTypedSelection* aSelection,
nsIEditor::EDirection aCollapsedAction,
bool *aCancel,
bool *aHandled)
@ -1140,7 +1139,7 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsISelection *aSelection)
nsresult
nsTextEditRules::TruncateInsertionIfNeeded(nsISelection *aSelection,
nsTextEditRules::TruncateInsertionIfNeeded(nsTypedSelection* aSelection,
const nsAString *aInString,
nsAString *aOutString,
PRInt32 aMaxLength,

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

@ -91,7 +91,7 @@ protected:
// nsTextEditRules implementation methods
nsresult WillInsertText( nsEditor::OperationID aAction,
nsISelection *aSelection,
nsTypedSelection* aSelection,
bool *aCancel,
bool *aHandled,
const nsAString *inString,
@ -100,14 +100,14 @@ protected:
nsresult DidInsertText(nsISelection *aSelection, nsresult aResult);
nsresult GetTopEnclosingPre(nsIDOMNode *aNode, nsIDOMNode** aOutPreNode);
nsresult WillInsertBreak(nsISelection *aSelection, bool *aCancel,
nsresult WillInsertBreak(nsTypedSelection* aSelection, bool* aCancel,
bool *aHandled, PRInt32 aMaxLength);
nsresult DidInsertBreak(nsISelection *aSelection, nsresult aResult);
nsresult WillInsert(nsISelection *aSelection, bool *aCancel);
nsresult DidInsert(nsISelection *aSelection, nsresult aResult);
nsresult WillDeleteSelection(nsISelection *aSelection,
nsresult WillDeleteSelection(nsTypedSelection* aSelection,
nsIEditor::EDirection aCollapsedAction,
bool *aCancel,
bool *aHandled);
@ -156,7 +156,7 @@ protected:
/** returns a truncated insertion string if insertion would place us
over aMaxLength */
nsresult TruncateInsertionIfNeeded(nsISelection *aSelection,
nsresult TruncateInsertionIfNeeded(nsTypedSelection* aSelection,
const nsAString *aInString,
nsAString *aOutString,
PRInt32 aMaxLength,