Closed
Bug 1406215
Opened 7 years ago
Closed 7 years ago
Remove the usage of nsINode::GetChildAt() from nsTextServicesDocument::GetCollapsedSelection()
Categories
(Core :: DOM: Editor, enhancement)
Core
DOM: Editor
Tracking
()
RESOLVED
FIXED
mozilla58
Tracking | Status | |
---|---|---|
firefox58 | --- | fixed |
People
(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)
References
Details
Attachments
(2 files)
1.20 KB,
patch
|
masayuki
:
review+
|
Details | Diff | Splinter Review |
1.28 KB,
patch
|
masayuki
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•7 years ago
|
||
This offset is obtained from a Range, so it doesn't need to be
validated.
Attachment #8915782 -
Flags: review?(masayuki)
Assignee | ||
Comment 2•7 years ago
|
||
Attachment #8915783 -
Flags: review?(masayuki)
Updated•7 years ago
|
Attachment #8915782 -
Flags: review?(masayuki) → review+
Comment 3•7 years ago
|
||
Comment on attachment 8915783 [details] [diff] [review]
Part 2: Remove the usage of nsINode::GetChildAt() from nsTextServicesDocument::GetCollapsedSelection()
>@@ -2384,23 +2384,20 @@ nsTextServicesDocument::GetCollapsedSelection(nsITextServicesDocument::TSDBlockS
> nsIContent* saveNode;
> if (parent->HasChildren()) {
> // XXX: We need to make sure that all of parent's
> // children are in the text block.
>
> // If the parent has children, position the iterator
> // on the child that is to the left of the offset.
>
>- uint32_t childIndex = offset;
>-
>- if (childIndex > 0) {
>- childIndex -= 1;
Current implementation does not try to retrieve previous child if the offset is 0.
>+ nsIContent* content = range->GetChildAtStartOffset();
>+ if (content) {
>+ content = content->GetPreviousSibling();
> }
So, looks like that you need to check:
if (content && parent->GetFirstChild() != content) {
content = content->GetPreviousSibling();
}
If I misunderstood, ignore this review. Otherwise, fix it before landing.
Attachment #8915783 -
Flags: review?(masayuki) → review+
Assignee | ||
Comment 4•7 years ago
|
||
Good catch. You're right!
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/756a3fa73513
Part 1: Remove a useless bounds check for a selection range offset; r=masayuki
https://hg.mozilla.org/integration/mozilla-inbound/rev/3edd962139b6
Part 2: Remove the usage of nsINode::GetChildAt() from nsTextServicesDocument::GetCollapsedSelection(); r=masayuki
Comment 6•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/756a3fa73513
https://hg.mozilla.org/mozilla-central/rev/3edd962139b6
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox58:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in
before you can comment on or make changes to this bug.
Description
•