Use explicitly static method call for GetStartNodeAndOffset and GetEndNodeAndOffset

RESOLVED FIXED in Firefox 53

Status

()

defect
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: m_kato, Assigned: m_kato)

Tracking

Trunk
mozilla53
Points:
---

Firefox Tracking Flags

(firefox53 fixed)

Details

Attachments

(1 attachment)

HTMLEditRules and TextEditRules uses 'mHTMLEditor->GetStartNodeAndOffset' to call EditorBase::GetStartNodeAndOffset of static method.  We should use explicitly static method call as EditorBase::GetStartNodeAndOffset.
Assignee: nobody → m_kato
Comment on attachment 8821066 [details]
Bug 1325300 - Use explicitly static method call for GetStartNodeAndOffset and GetEndNodeAndOffset.

https://reviewboard.mozilla.org/r/100448/#review101008

::: editor/libeditor/HTMLEditRules.cpp
(Diff revision 1)
> -    NS_ENSURE_STATE(mHTMLEditor);
>      nsresult rv =
> -      mHTMLEditor->GetStartNodeAndOffset(aSelection,
> +      EditorBase::GetStartNodeAndOffset(aSelection,
> -                                         getter_AddRefs(node), &offset);
> +                                        getter_AddRefs(node), &offset);
>      NS_ENSURE_SUCCESS(rv, rv);
>      nsCOMPtr<Element> block = mHTMLEditor->GetBlock(*node);

Before here, you need to check if mHTMLEditor is nullptr.

::: editor/libeditor/TextEditRules.cpp
(Diff revision 1)
> -  NS_ENSURE_STATE(mTextEditor);
>    nsresult rv =
> -    mTextEditor->GetStartNodeAndOffset(aSelection,
> +    EditorBase::GetStartNodeAndOffset(aSelection,
> -                                       getter_AddRefs(startNode), &startOffset);
> +                                      getter_AddRefs(startNode), &startOffset);
>    NS_ENSURE_SUCCESS(rv, rv);
>    NS_ENSURE_TRUE(startNode, NS_ERROR_FAILURE);
>  
>    // delete empty text nodes at selection
>    if (mTextEditor->IsTextNode(startNode)) {

I think that removing this mTextEditor check is wrong, it should be moved before the if statement.
Attachment #8821066 - Flags: review?(masayuki) → review+
Pushed by m_kato@ga2.so-net.ne.jp:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d83cea57d22f
Use explicitly static method call for GetStartNodeAndOffset and GetEndNodeAndOffset. r=masayuki
https://hg.mozilla.org/mozilla-central/rev/d83cea57d22f
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.