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

RESOLVED FIXED in Firefox 58

Status

()

RESOLVED FIXED
2 years ago
6 months ago

People

(Reporter: Ehsan, Assigned: Ehsan)

Tracking

unspecified
mozilla58
Points:
---

Firefox Tracking Flags

(firefox58 fixed)

Details

Attachments

(1 attachment)

Comment hidden (empty)
(Assignee)

Updated

2 years ago
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+

Comment 3

2 years ago
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/259952e0c0b0
Avoid using nsINode::GetChildAt() in HTMLEditor::GetSelectedElement(); r=masayuki

Comment 4

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/259952e0c0b0
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox58: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Assignee: nobody → ehsan
You need to log in before you can comment on or make changes to this bug.