зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1359345
- HTMLEditor::IsVisBreak() should be renamed to HTMLEditor::IsVisibleBRElement(). r=masayuki
MozReview-Commit-ID: 2KqRauu10QE --HG-- extra : rebase_source : 36a42d6c7d13d1eb9ba570fc0e99fcd2570e6f9b
This commit is contained in:
Родитель
d39094ce7a
Коммит
256e9a6424
|
@ -2090,7 +2090,7 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
visNode->IsHTMLElement(nsGkAtoms::hr)) {
|
||||
// Short circuit for invisible breaks. delete them and recurse.
|
||||
if (visNode->IsHTMLElement(nsGkAtoms::br) &&
|
||||
(!mHTMLEditor || !mHTMLEditor->IsVisBreak(visNode))) {
|
||||
(!mHTMLEditor || !mHTMLEditor->IsVisibleBRElement(visNode))) {
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
rv = mHTMLEditor->DeleteNode(visNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -2493,7 +2493,7 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
} else {
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
join = content->IsHTMLElement(nsGkAtoms::br) &&
|
||||
!mHTMLEditor->IsVisBreak(somenode);
|
||||
!mHTMLEditor->IsVisibleBRElement(somenode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2671,7 +2671,7 @@ HTMLEditRules::GetGoodSelPointForNode(nsINode& aNode,
|
|||
ret.offset = ret.node ? ret.node->IndexOf(&aNode) : -1;
|
||||
NS_ENSURE_TRUE(mHTMLEditor, EditorDOMPoint());
|
||||
if ((!aNode.IsHTMLElement(nsGkAtoms::br) ||
|
||||
mHTMLEditor->IsVisBreak(&aNode)) && isPreviousAction) {
|
||||
mHTMLEditor->IsVisibleBRElement(&aNode)) && isPreviousAction) {
|
||||
ret.offset++;
|
||||
}
|
||||
return ret;
|
||||
|
@ -5222,7 +5222,7 @@ HTMLEditRules::ExpandSelectionForDeletion(Selection& aSelection)
|
|||
wsObj.NextVisibleNode(selEndNode, selEndOffset, address_of(unused),
|
||||
&visOffset, &wsType);
|
||||
if (wsType == WSType::br) {
|
||||
if (mHTMLEditor->IsVisBreak(wsObj.mEndReasonNode)) {
|
||||
if (mHTMLEditor->IsVisibleBRElement(wsObj.mEndReasonNode)) {
|
||||
break;
|
||||
}
|
||||
if (!firstBRParent) {
|
||||
|
@ -5531,7 +5531,7 @@ HTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere,
|
|||
htmlEditor->GetPriorHTMLNode(node, offset, true);
|
||||
|
||||
while (priorNode && priorNode->GetParentNode() &&
|
||||
!htmlEditor->IsVisBreak(priorNode) &&
|
||||
!htmlEditor->IsVisibleBRElement(priorNode) &&
|
||||
!IsBlockNode(*priorNode)) {
|
||||
offset = priorNode->GetParentNode()->IndexOf(priorNode);
|
||||
node = priorNode->GetParentNode();
|
||||
|
@ -5598,7 +5598,7 @@ HTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere,
|
|||
while (nextNode && !IsBlockNode(*nextNode) && nextNode->GetParentNode()) {
|
||||
offset = 1 + nextNode->GetParentNode()->IndexOf(nextNode);
|
||||
node = nextNode->GetParentNode();
|
||||
if (htmlEditor->IsVisBreak(nextNode)) {
|
||||
if (htmlEditor->IsVisibleBRElement(nextNode)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6490,7 +6490,8 @@ HTMLEditRules::ReturnInParagraph(Selection* aSelection,
|
|||
// is there a BR prior to it?
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
sibling = mHTMLEditor->GetPriorHTMLSibling(node);
|
||||
if (!sibling || !mHTMLEditor || !mHTMLEditor->IsVisBreak(sibling) ||
|
||||
if (!sibling || !mHTMLEditor ||
|
||||
!mHTMLEditor->IsVisibleBRElement(sibling) ||
|
||||
TextEditUtils::HasMozAttr(GetAsDOMNode(sibling))) {
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
newBRneeded = true;
|
||||
|
@ -6500,7 +6501,8 @@ HTMLEditRules::ReturnInParagraph(Selection* aSelection,
|
|||
// is there a BR after to it?
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
sibling = mHTMLEditor->GetNextHTMLSibling(node);
|
||||
if (!sibling || !mHTMLEditor || !mHTMLEditor->IsVisBreak(sibling) ||
|
||||
if (!sibling || !mHTMLEditor ||
|
||||
!mHTMLEditor->IsVisibleBRElement(sibling) ||
|
||||
TextEditUtils::HasMozAttr(GetAsDOMNode(sibling))) {
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
newBRneeded = true;
|
||||
|
@ -6528,13 +6530,13 @@ HTMLEditRules::ReturnInParagraph(Selection* aSelection,
|
|||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nearNode = mHTMLEditor->GetPriorHTMLNode(node, aOffset);
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
if (!nearNode || !mHTMLEditor->IsVisBreak(nearNode) ||
|
||||
if (!nearNode || !mHTMLEditor->IsVisibleBRElement(nearNode) ||
|
||||
TextEditUtils::HasMozAttr(GetAsDOMNode(nearNode))) {
|
||||
// is there a BR after it?
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nearNode = mHTMLEditor->GetNextHTMLNode(node, aOffset);
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
if (!nearNode || !mHTMLEditor->IsVisBreak(nearNode) ||
|
||||
if (!nearNode || !mHTMLEditor->IsVisibleBRElement(nearNode) ||
|
||||
TextEditUtils::HasMozAttr(GetAsDOMNode(nearNode))) {
|
||||
newBRneeded = true;
|
||||
parent = node;
|
||||
|
@ -6602,7 +6604,7 @@ HTMLEditRules::SplitParagraph(nsIDOMNode *aPara,
|
|||
}
|
||||
// get rid of the break, if it is visible (otherwise it may be needed to prevent an empty p)
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
if (mHTMLEditor->IsVisBreak(aBRNode)) {
|
||||
if (mHTMLEditor->IsVisibleBRElement(aBRNode)) {
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
rv = mHTMLEditor->DeleteNode(aBRNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -7597,7 +7599,7 @@ HTMLEditRules::AdjustSelection(Selection* aSelection,
|
|||
if (block && block == nearBlock) {
|
||||
if (nearNode && TextEditUtils::IsBreak(nearNode)) {
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
if (!mHTMLEditor->IsVisBreak(nearNode)) {
|
||||
if (!mHTMLEditor->IsVisibleBRElement(nearNode)) {
|
||||
// need to insert special moz BR. Why? Because if we don't
|
||||
// the user will see no new line for the break. Also, things
|
||||
// like table cells won't grow in height.
|
||||
|
|
|
@ -928,7 +928,7 @@ HTMLEditor::IsPrevCharInNodeWhitespace(nsIContent* aContent,
|
|||
}
|
||||
|
||||
bool
|
||||
HTMLEditor::IsVisBreak(nsINode* aNode)
|
||||
HTMLEditor::IsVisibleBRElement(nsINode* aNode)
|
||||
{
|
||||
MOZ_ASSERT(aNode);
|
||||
if (!TextEditUtils::IsBreak(aNode)) {
|
||||
|
|
|
@ -674,7 +674,7 @@ protected:
|
|||
/**
|
||||
* Small utility routine to test if a break node is visible to user.
|
||||
*/
|
||||
bool IsVisBreak(nsINode* aNode);
|
||||
bool IsVisibleBRElement(nsINode* aNode);
|
||||
|
||||
/**
|
||||
* Utility routine to possibly adjust the insertion position when
|
||||
|
|
|
@ -370,7 +370,7 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
WSRunObject wsObj(this, parentNode, offsetOfNewNode);
|
||||
if (wsObj.mEndReasonNode &&
|
||||
TextEditUtils::IsBreak(wsObj.mEndReasonNode) &&
|
||||
!IsVisBreak(wsObj.mEndReasonNode)) {
|
||||
!IsVisibleBRElement(wsObj.mEndReasonNode)) {
|
||||
rv = DeleteNode(wsObj.mEndReasonNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
// PriorVisibleNode does not make that determination for breaks.
|
||||
// It also may not return the break in visNode. We have to pull it
|
||||
// out of the WSRunObject's state.
|
||||
if (!IsVisBreak(wsRunObj.mStartReasonNode)) {
|
||||
if (!IsVisibleBRElement(wsRunObj.mStartReasonNode)) {
|
||||
// don't leave selection past an invisible break;
|
||||
// reset {selNode,selOffset} to point before break
|
||||
selNode = GetNodeLocation(GetAsDOMNode(wsRunObj.mStartReasonNode), &selOffset);
|
||||
|
|
Загрузка…
Ссылка в новой задаче