Closed
Bug 290350
Opened 21 years ago
Closed 21 years ago
[FIXr]Plaintext editor serialization creates unnecessary selection object
Categories
(Core :: DOM: Editor, defect, P2)
Core
DOM: Editor
Tracking
()
RESOLVED
FIXED
mozilla1.8beta2
People
(Reporter: bzbarsky, Assigned: bzbarsky)
Details
(Keywords: perf)
Attachments
(2 files)
|
2.12 KB,
patch
|
sfraser_bugs
:
review+
peterv
:
superreview+
brendan
:
approval1.8b2+
|
Details | Diff | Splinter Review |
|
1.33 KB,
patch
|
sicking
:
review+
peterv
:
superreview+
asa
:
approval1.8b2+
|
Details | Diff | Splinter Review |
I'm guessing that this code was originally written before nsIDocumentEncoder had
a SetRange method... in any case, we no longer need the selection object here.
| Assignee | ||
Updated•21 years ago
|
Priority: -- → P2
Target Milestone: --- → mozilla1.8beta2
| Assignee | ||
Comment 1•21 years ago
|
||
Attachment #180735 -
Flags: superreview?(jst)
Attachment #180735 -
Flags: review?(sfraser_bugs)
Comment 2•21 years ago
|
||
Comment on attachment 180735 [details] [diff] [review]
Proposed patch
Seems reasonable
Attachment #180735 -
Flags: review?(sfraser_bugs) → review+
Comment 3•21 years ago
|
||
Comment on attachment 180735 [details] [diff] [review]
Proposed patch
r=brade (yes, it is old code from before the apis changed)
Updated•21 years ago
|
Attachment #180735 -
Flags: superreview?(jst) → superreview+
| Assignee | ||
Updated•21 years ago
|
Summary: [FIX]Plaintext editor serialization creates unnecessary selection object → [FIXr]Plaintext editor serialization creates unnecessary selection object
| Assignee | ||
Comment 4•21 years ago
|
||
Comment on attachment 180735 [details] [diff] [review]
Proposed patch
Requesting 1.8b2 approval for a bit more unneeded code removal.
Attachment #180735 -
Flags: approval1.8b2?
Comment 5•21 years ago
|
||
Comment on attachment 180735 [details] [diff] [review]
Proposed patch
a=brendan for 1.8b2.
/be
Attachment #180735 -
Flags: approval1.8b2? → approval1.8b2+
| Assignee | ||
Comment 6•21 years ago
|
||
Fixed.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 7•21 years ago
|
||
Are these possible optimizations? Replacing the entire block with
docEncoder->SetNode(rootElement); would bypass the encoder's range code too.
Failing that, I would have thought the inner block could be replaced with
range->SelectNode(rootElement); or range->SelectNodeContents(rootElement);
| Assignee | ||
Comment 8•21 years ago
|
||
> Replacing the entire block with docEncoder->SetNode(rootElement)
That would also serialize rootElement itself, which the current code doesn't do.
> I would have thought the inner block could be replaced with
> range->SelectNode(rootElement)
That has the same problem.
> or range->SelectNodeContents(rootElement);
That _should_ work, yes. I'm not sure it's faster, and it definitely uses more
memory (SelectNodeContents uses GetChildNodes, instead of nsIContent apis), but
it'd make this code shorter, which is probably a good thing...
Simon, Jonas, Peter, thoughts?
Comment 9•21 years ago
|
||
(In reply to comment #8)
>>Replacing the entire block with docEncoder->SetNode(rootElement)
>That would also serialize rootElement itself, which the current code doesn't do.
Ah, I can see that that might emit an extra newline or something.
>SelectNodeContents uses GetChildNodes, instead of nsIContent apis
Is there a bug filed on that?
Comment 10•21 years ago
|
||
I'm fine with either way. As you note the range code is pretty inefficient, so
both ways are not as efficient as they could be :-).
Yeah, I wouldn't worry too much about efficiency. I doubt it'll affect perf much
either way, and we should fix the range code to be better in any event.
| Assignee | ||
Comment 12•21 years ago
|
||
> Is there a bug filed on that?
It's not clear that it's a bug, since the range code needs to handle a wider
range of node types than the editor.
Jonas, Peter, was that a vote in favor of using SelectNodeContents here?
Doesn't matter much to me, but i think it seems like a good idea yes.
| Assignee | ||
Comment 14•21 years ago
|
||
Attachment #181184 -
Flags: superreview?(peterv)
Attachment #181184 -
Flags: review?(bugmail)
Attachment #181184 -
Flags: review?(bugmail) → review+
Updated•21 years ago
|
Attachment #181184 -
Flags: superreview?(peterv) → superreview+
| Assignee | ||
Comment 15•21 years ago
|
||
Comment on attachment 181184 [details] [diff] [review]
Use selectNodeContents
Requesting 1.8b2 approval for a tiny bit more code removal.
Attachment #181184 -
Flags: approval1.8b2?
Comment 16•21 years ago
|
||
Comment on attachment 181184 [details] [diff] [review]
Use selectNodeContents
a=asa
Attachment #181184 -
Flags: approval1.8b2? → approval1.8b2+
| Assignee | ||
Comment 17•21 years ago
|
||
Checked that second patch in.
You need to log in
before you can comment on or make changes to this bug.
Description
•