Closed
Bug 1423835
Opened 8 years ago
Closed 8 years ago
Clean up EditorDOMPointBase
Categories
(Core :: DOM: Editor, enhancement)
Tracking
()
RESOLVED
FIXED
mozilla59
| Tracking | Status | |
|---|---|---|
| firefox59 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(3 files)
EditorDOMPointBase should have a method, SetToEndOf() which automatically initializes with mParent->Length().
And its Container() should be renamed to GetContainer() because it may return nullptr.
And GetChildAtOffset() should be renamed to GetChild() because different from RangeBoundary, EditorDOMPointBase may store only child node.
| Assignee | ||
Comment 1•8 years ago
|
||
| Assignee | ||
Comment 2•8 years ago
|
||
| Assignee | ||
Comment 3•8 years ago
|
||
| Assignee | ||
Comment 4•8 years ago
|
||
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Comment 8•8 years ago
|
||
| mozreview-review | ||
Comment on attachment 8935689 [details]
Bug 1423835 - part 1: Add EditorDOMPointBase::SetToEndOf() to initialize the instance at end of container node
https://reviewboard.mozilla.org/r/206590/#review212642
Attachment #8935689 -
Flags: review?(m_kato) → review+
Comment 9•8 years ago
|
||
| mozreview-review | ||
Comment on attachment 8935690 [details]
Bug 1423835 - part 2: Rename EditorDOMPointBase::Container() to EditorDOMPointBase::GetContainer() and add some useful methods to access its container
https://reviewboard.mozilla.org/r/206592/#review212646
::: editor/libeditor/HTMLEditRules.cpp:6862
(Diff revision 1)
> EditorRawDOMPoint pointToInsertBR;
> if (doesCRCreateNewP &&
> - atStartOfSelection.Container() == &aParentDivOrP) {
> + atStartOfSelection.GetContainer() == &aParentDivOrP) {
> // We are at the edges of the block, so, we don't need to create new <br>.
> brNode = nullptr;
> - } else if (EditorBase::IsTextNode(atStartOfSelection.Container())) {
> + } else if (EditorBase::IsTextNode(atStartOfSelection.GetContainer())) {
atStartOfSelection.IsInTextNode?
::: editor/libeditor/HTMLEditRules.cpp:8074
(Diff revision 1)
> - return CreateMozBR(*point.Container(), point.Offset());
> + return CreateMozBR(*point.GetContainer(), point.Offset());
> }
> }
>
> // are we in a text node?
> - if (EditorBase::IsTextNode(point.Container())) {
> + if (EditorBase::IsTextNode(point.GetContainer())) {
point.IsInTextNode?
::: editor/libeditor/HTMLEditorDataTransfer.cpp:372
(Diff revision 1)
>
> // Remember if we are in a link.
> - bool bStartedInLink = IsInLink(pointToInsert.Container()->AsDOMNode());
> + bool bStartedInLink = IsInLink(pointToInsert.GetContainerAsDOMNode());
>
> // Are we in a text node? If so, split it.
> - if (IsTextNode(pointToInsert.Container())) {
> + if (IsTextNode(pointToInsert.GetContainer())) {
pointToInsert.IsInTextNode?
::: editor/libeditor/TextEditor.cpp:587
(Diff revision 1)
>
> // node might be anonymous DIV, so we find better text node
> EditorRawDOMPoint insertionPoint =
> FindBetterInsertionPoint(atStartOfSelection);
>
> - if (IsTextNode(insertionPoint.Container())) {
> + if (IsTextNode(insertionPoint.GetContainer())) {
insertionPoint.IsInTextNode?
::: editor/libeditor/TextEditor.cpp:766
(Diff revision 1)
> return NS_ERROR_FAILURE;
> }
> MOZ_ASSERT(pointToInsert.IsSetAndValid());
>
> // don't put text in places that can't have it
> - if (!IsTextNode(pointToInsert.Container()) &&
> + if (!IsTextNode(pointToInsert.GetContainer()) &&
pointToInsert.IsInTextNode?
::: editor/libeditor/WSRunObject.cpp:1329
(Diff revision 1)
> // Nothing to delete
> return NS_OK;
> }
>
> - if (aStartPoint.Container() == aEndPoint.Container() &&
> - aStartPoint.Container()->GetAsText()) {
> + if (aStartPoint.GetContainer() == aEndPoint.GetContainer() &&
> + aStartPoint.GetContainerAsText()) {
aStartPoint.IsInTextNode?
Attachment #8935690 -
Flags: review?(m_kato) → review+
Comment 10•8 years ago
|
||
| mozreview-review | ||
Comment on attachment 8935691 [details]
Bug 1423835 - part 3: Rename EditorDOMPointBase::GetChildAtOffset() to EditorDOMPointBase::GetChild()
https://reviewboard.mozilla.org/r/206594/#review212648
Attachment #8935691 -
Flags: review?(m_kato) → review+
| Assignee | ||
Comment 11•8 years ago
|
||
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Comment 15•8 years ago
|
||
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/1427b2fca8d7
part 1: Add EditorDOMPointBase::SetToEndOf() to initialize the instance at end of container node r=m_kato
https://hg.mozilla.org/integration/autoland/rev/c41a81c80769
part 2: Rename EditorDOMPointBase::Container() to EditorDOMPointBase::GetContainer() and add some useful methods to access its container r=m_kato
https://hg.mozilla.org/integration/autoland/rev/92403ed2a488
part 3: Rename EditorDOMPointBase::GetChildAtOffset() to EditorDOMPointBase::GetChild() r=m_kato
Comment 16•8 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/1427b2fca8d7
https://hg.mozilla.org/mozilla-central/rev/c41a81c80769
https://hg.mozilla.org/mozilla-central/rev/92403ed2a488
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox59:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in
before you can comment on or make changes to this bug.
Description
•