Closed Bug 1415509 Opened 5 years ago Closed 5 years ago

Make insert text related methods of editor use EditorRawDOMPoint

Categories

(Core :: DOM: Editor, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(3 files)

Comment on attachment 8926825 [details]
Bug 1415509 - part 1: EditorBase::FindBetterInsertionPoint() should take an EditorRawDOMPoint argument for input and return EditorRawDOMPoint for the result

https://reviewboard.mozilla.org/r/198072/#review203604
Attachment #8926825 - Flags: review?(m_kato) → review+
Comment on attachment 8926826 [details]
Bug 1415509 - part 2: EditorBase::InsertTextImpl() should take |const EditorRawDOMPoint&| argument as input and |EditorRawDOMPoint*| as out argument instead of a set of container, child and offset of the child in the container as in/out argument

https://reviewboard.mozilla.org/r/198074/#review203626

::: editor/libeditor/HTMLEditRules.cpp:1538
(Diff revision 1)
> -    if (curNode) {
> -      aSelection->Collapse(curNode, curOffset);
> +
> +  if (currentPoint.IsSet()) {
> +    ErrorResult error;
> +    aSelection->Collapse(currentPoint.AsRaw(), error);
> +    if (error.Failed()) {
> +      NS_WARNING("Failed to collapse at current point");

Is error.SuppressException() unnecessary for assertion?
Attachment #8926826 - Flags: review?(m_kato) → review+
Comment on attachment 8926826 [details]
Bug 1415509 - part 2: EditorBase::InsertTextImpl() should take |const EditorRawDOMPoint&| argument as input and |EditorRawDOMPoint*| as out argument instead of a set of container, child and offset of the child in the container as in/out argument

https://reviewboard.mozilla.org/r/198074/#review203626

> Is error.SuppressException() unnecessary for assertion?

Oh, good catch!
Comment on attachment 8926827 [details]
Bug 1415509 - part 3: WSRunObject::InsertText() should take |const EditorRawDOMPoint&| as input argument and |EditorRawDOMPoint*| as out argument instead of a set of container, child and offset of the child in the container as in/out argument

https://reviewboard.mozilla.org/r/198076/#review203634
Attachment #8926827 - Flags: review?(m_kato) → review+
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/e3d5220206fc
part 1: EditorBase::FindBetterInsertionPoint() should take an EditorRawDOMPoint argument for input and return EditorRawDOMPoint for the result r=m_kato
https://hg.mozilla.org/integration/autoland/rev/c6844ea5e019
part 2: EditorBase::InsertTextImpl() should take |const EditorRawDOMPoint&| argument as input and |EditorRawDOMPoint*| as out argument instead of a set of container, child and offset of the child in the container as in/out argument r=m_kato
https://hg.mozilla.org/integration/autoland/rev/799b7dee5ebf
part 3: WSRunObject::InsertText() should take |const EditorRawDOMPoint&| as input argument and |EditorRawDOMPoint*| as out argument instead of a set of container, child and offset of the child in the container as in/out argument r=m_kato
Depends on: 1421561
You need to log in before you can comment on or make changes to this bug.