зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1387143 part 8. Remove nsISelectionPrivate::Get/SetInterlinePosition. r=mats
This commit is contained in:
Родитель
abdd178705
Коммит
2abc41a969
|
@ -493,17 +493,6 @@ Selection::ToStringWithFormat(const nsAString& aFormatType, uint32_t aFlags,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Selection::SetInterlinePosition(bool aHintRight)
|
||||
{
|
||||
ErrorResult result;
|
||||
SetInterlinePosition(aHintRight, result);
|
||||
if (result.Failed()) {
|
||||
return result.StealNSResult();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
Selection::SetInterlinePosition(bool aHintRight, ErrorResult& aRv)
|
||||
{
|
||||
|
@ -514,17 +503,6 @@ Selection::SetInterlinePosition(bool aHintRight, ErrorResult& aRv)
|
|||
mFrameSelection->SetHint(aHintRight ? CARET_ASSOCIATE_AFTER : CARET_ASSOCIATE_BEFORE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Selection::GetInterlinePosition(bool* aHintRight)
|
||||
{
|
||||
ErrorResult result;
|
||||
*aHintRight = GetInterlinePosition(result);
|
||||
if (result.Failed()) {
|
||||
return result.StealNSResult();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
Selection::GetInterlinePosition(ErrorResult& aRv)
|
||||
{
|
||||
|
@ -2339,7 +2317,7 @@ Selection::AddRangeInternal(nsRange& aRange, nsIDocument* aDocument,
|
|||
|
||||
// Make sure the caret appears on the next line, if at a newline
|
||||
if (mSelectionType == SelectionType::eNormal) {
|
||||
SetInterlinePosition(true);
|
||||
SetInterlinePosition(true, IgnoreErrors());
|
||||
}
|
||||
|
||||
RefPtr<nsPresContext> presContext = GetPresContext();
|
||||
|
|
|
@ -31,7 +31,6 @@ native ScrollAxis(nsIPresShell::ScrollAxis);
|
|||
[uuid(0c9f4f74-ee7e-4fe9-be6b-0ba856368178)]
|
||||
interface nsISelectionPrivate : nsISupports
|
||||
{
|
||||
attribute boolean interlinePosition;
|
||||
[noscript] attribute nsIContent ancestorLimiter;
|
||||
|
||||
DOMString toStringWithFormat(in string formatType, in unsigned long flags, in int32_t wrapColumn);
|
||||
|
|
|
@ -79,6 +79,10 @@ partial interface Selection {
|
|||
// Additional chrome-only methods from nsISelectionPrivate
|
||||
interface nsISelectionListener;
|
||||
partial interface Selection {
|
||||
/**
|
||||
* A true value means "selection after newline"; false means "selection before
|
||||
* newline" when a selection is positioned "between lines".
|
||||
*/
|
||||
[ChromeOnly,Throws]
|
||||
attribute boolean interlinePosition;
|
||||
|
||||
|
|
|
@ -1537,7 +1537,7 @@ HTMLEditRules::WillInsertText(EditAction aAction,
|
|||
// After this block, pointToInsert is updated by AutoTrackDOMPoint.
|
||||
}
|
||||
|
||||
aSelection->SetInterlinePosition(false);
|
||||
aSelection->SetInterlinePosition(false, IgnoreErrors());
|
||||
|
||||
if (currentPoint.IsSet()) {
|
||||
ErrorResult error;
|
||||
|
@ -1930,7 +1930,7 @@ HTMLEditRules::InsertBRElement(Selection& aSelection,
|
|||
// XXX brElementIsAfterBlock and brElementIsBeforeBlock were set before
|
||||
// modifying the DOM tree. So, now, the <br> element may not be
|
||||
// between blocks.
|
||||
aSelection.SetInterlinePosition(true);
|
||||
aSelection.SetInterlinePosition(true, IgnoreErrors());
|
||||
EditorRawDOMPoint point(brElement);
|
||||
ErrorResult error;
|
||||
aSelection.Collapse(point, error);
|
||||
|
@ -1977,7 +1977,8 @@ HTMLEditRules::InsertBRElement(Selection& aSelection,
|
|||
// node. Then we stick to the left to avoid an uber caret.
|
||||
nsIContent* nextSiblingOfBRElement = brElement->GetNextSibling();
|
||||
aSelection.SetInterlinePosition(!(nextSiblingOfBRElement &&
|
||||
IsBlockNode(*nextSiblingOfBRElement)));
|
||||
IsBlockNode(*nextSiblingOfBRElement)),
|
||||
IgnoreErrors());
|
||||
ErrorResult error;
|
||||
aSelection.Collapse(afterBRElement, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
|
@ -2100,7 +2101,7 @@ HTMLEditRules::SplitMailCites(Selection* aSelection,
|
|||
// Want selection before the break, and on same line.
|
||||
EditorDOMPoint atBrNode(brElement);
|
||||
Unused << atBrNode.Offset(); // Needs offset after collapsing the selection.
|
||||
aSelection->SetInterlinePosition(true);
|
||||
aSelection->SetInterlinePosition(true, IgnoreErrors());
|
||||
ErrorResult error;
|
||||
aSelection->Collapse(atBrNode, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
|
@ -2436,9 +2437,11 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
selNode = visNode->GetParentNode();
|
||||
selOffset = selNode ? selNode->ComputeIndexOf(visNode) : -1;
|
||||
|
||||
bool interLineIsRight;
|
||||
rv = aSelection->GetInterlinePosition(&interLineIsRight);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
ErrorResult err;
|
||||
bool interLineIsRight = aSelection->GetInterlinePosition(err);
|
||||
if (NS_WARN_IF(err.Failed())) {
|
||||
return err.StealNSResult();
|
||||
}
|
||||
|
||||
if (startNode == selNode && startOffset - 1 == selOffset &&
|
||||
!interLineIsRight) {
|
||||
|
@ -2450,7 +2453,7 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
// by setting the interline position to left.
|
||||
++selOffset;
|
||||
aSelection->Collapse(selNode, selOffset);
|
||||
aSelection->SetInterlinePosition(false);
|
||||
aSelection->SetInterlinePosition(false, IgnoreErrors());
|
||||
mDidExplicitlySetInterline = true;
|
||||
*aHandled = true;
|
||||
|
||||
|
@ -8443,7 +8446,7 @@ HTMLEditRules::CheckInterlinePosition(Selection& aSelection)
|
|||
nsCOMPtr<nsIContent> node =
|
||||
htmlEditor->GetPreviousEditableHTMLNodeInBlock(atStartOfSelection);
|
||||
if (node && node->IsHTMLElement(nsGkAtoms::br)) {
|
||||
aSelection.SetInterlinePosition(true);
|
||||
aSelection.SetInterlinePosition(true, IgnoreErrors());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8454,7 +8457,7 @@ HTMLEditRules::CheckInterlinePosition(Selection& aSelection)
|
|||
node = nullptr;
|
||||
}
|
||||
if (node && IsBlockNode(*node)) {
|
||||
aSelection.SetInterlinePosition(true);
|
||||
aSelection.SetInterlinePosition(true, IgnoreErrors());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8465,7 +8468,7 @@ HTMLEditRules::CheckInterlinePosition(Selection& aSelection)
|
|||
node = nullptr;
|
||||
}
|
||||
if (node && IsBlockNode(*node)) {
|
||||
aSelection.SetInterlinePosition(false);
|
||||
aSelection.SetInterlinePosition(false, IgnoreErrors());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8564,7 +8567,7 @@ HTMLEditRules::AdjustSelection(Selection* aSelection,
|
|||
}
|
||||
point.Set(brElement);
|
||||
// selection stays *before* moz-br, sticking to it
|
||||
aSelection->SetInterlinePosition(true);
|
||||
aSelection->SetInterlinePosition(true, IgnoreErrors());
|
||||
ErrorResult error;
|
||||
aSelection->Collapse(point, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
|
@ -8576,7 +8579,7 @@ HTMLEditRules::AdjustSelection(Selection* aSelection,
|
|||
if (nextNode && TextEditUtils::IsMozBR(nextNode)) {
|
||||
// selection between br and mozbr. make it stick to mozbr
|
||||
// so that it will be on blank line.
|
||||
aSelection->SetInterlinePosition(true);
|
||||
aSelection->SetInterlinePosition(true, IgnoreErrors());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -801,7 +801,7 @@ TextEditRules::WillInsertText(EditAction aAction,
|
|||
// in which case make the caret attach to the next line.
|
||||
bool endsWithLF =
|
||||
!outString->IsEmpty() && outString->Last() == nsCRT::LF;
|
||||
aSelection->SetInterlinePosition(endsWithLF);
|
||||
aSelection->SetInterlinePosition(endsWithLF, IgnoreErrors());
|
||||
|
||||
MOZ_ASSERT(!pointAfterStringInserted.GetChild(),
|
||||
"After inserting text into a text node, pointAfterStringInserted."
|
||||
|
@ -1114,7 +1114,9 @@ TextEditRules::DidDeleteSelection(Selection* aSelection,
|
|||
}
|
||||
// We prevent the caret from sticking on the left of prior BR
|
||||
// (i.e. the end of previous line) after this deletion. Bug 92124
|
||||
return aSelection->SetInterlinePosition(true);
|
||||
ErrorResult err;
|
||||
aSelection->SetInterlinePosition(true, err);
|
||||
return err.StealNSResult();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -501,7 +501,7 @@ TextEditor::InsertBrElementWithTransaction(
|
|||
case eNone:
|
||||
break;
|
||||
case eNext: {
|
||||
aSelection.SetInterlinePosition(true);
|
||||
aSelection.SetInterlinePosition(true, IgnoreErrors());
|
||||
// Collapse selection after the <br> node.
|
||||
EditorRawDOMPoint afterBRElement(newBRElement);
|
||||
if (afterBRElement.IsSet()) {
|
||||
|
@ -518,7 +518,7 @@ TextEditor::InsertBrElementWithTransaction(
|
|||
break;
|
||||
}
|
||||
case ePrevious: {
|
||||
aSelection.SetInterlinePosition(true);
|
||||
aSelection.SetInterlinePosition(true, IgnoreErrors());
|
||||
// Collapse selection at the <br> node.
|
||||
EditorRawDOMPoint atBRElement(newBRElement);
|
||||
if (atBRElement.IsSet()) {
|
||||
|
@ -1064,7 +1064,7 @@ TextEditor::InsertParagraphSeparatorAsAction()
|
|||
// content on the "right". We want the caret to stick to whatever is
|
||||
// past the break. This is because the break is on the same line we
|
||||
// were on, but the next content will be on the following line.
|
||||
selection->SetInterlinePosition(true);
|
||||
selection->SetInterlinePosition(true, IgnoreErrors());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче