Closed Bug 1405039 Opened 7 years ago Closed 7 years ago

Avoid using nsINode::GetChildAt() in HTMLEditor::GetSelectedElement()

Categories

(Core :: DOM: Editor, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file)

No description provided.
Blocks: 651120
Comment on attachment 8914405 [details] [diff] [review] Avoid using nsINode::GetChildAt() in HTMLEditor::GetSelectedElement() >+nsIContent* >+Selection::GetChildAtFocusOffset() >+{ >+ if (!mAnchorFocusRange) >+ return nullptr; Put {}. >@@ -2374,26 +2374,20 @@ HTMLEditor::GetSelectedElement(const nsAString& aTagName, > } > > if (!bNodeFound) { > if (isLinkTag) { > // Link tag is a special case - we return the anchor node > // found for any selection that is totally within a link, > // included a collapsed selection (just a caret in a link) > nsCOMPtr<nsINode> anchorNode = selection->GetAnchorNode(); >- int32_t anchorOffset = -1; >- if (anchorNode) { >- anchorOffset = selection->AnchorOffset(); >- } >+ nsIContent* anchorChild = selection->GetChildAtAnchorOffset(); > > nsCOMPtr<nsINode> focusNode = selection->GetFocusNode(); >- int32_t focusOffset = -1; >- if (focusNode) { >- focusOffset = selection->FocusOffset(); >- } >+ nsIContent* focusChild = selection->GetChildAtAnchorOffset(); GetChildAtFocusOffset()?
Attachment #8914405 - Flags: review?(masayuki) → review+
Pushed by eakhgari@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/259952e0c0b0 Avoid using nsINode::GetChildAt() in HTMLEditor::GetSelectedElement(); r=masayuki
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Assignee: nobody → ehsan
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: