Closed Bug 330525 Opened 18 years ago Closed 18 years ago

Can get at enums from nsIDocumentEncoder.idl

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: neil, Assigned: sgautherie)

References

()

Details

(Whiteboard: [good first bug])

Attachments

(2 files, 2 obsolete files)

The comment in editorUtilities.js is no longer correct.
Note that the constants were actually inlined (with comments) in bug 88208.
Whiteboard: [good first bug]
Assignee: mozeditor → gautheri
Status: NEW → ASSIGNED
Keywords: helpwanted
Target Milestone: --- → mozilla1.9alpha
Neil emailed me
{{
Basically this file

http://lxr.mozilla.org/seamonkey/source/content/base/public/nsIDocumentEncoder.idl

has recently been created, so that JavaScript can now get at the values using (for example) Components.interfaces.nsIDocumentEncoder.OutputWrap rather than writing in the value 32. Originally when the editor code was written all the values were declared as const (but using literal decimal values, while the new file uses shift operators to automatically calculate powers of 2) near line 60 of editorUtilities.js and then the named constants were used. For some reason those constants were removed and replaced by the actual values (but I can't find the patch in the bug mentioned). Obviously we don't want to use the full names everywhere but we can simply declare some constants so we can just use short names (i.e. OutputWrap). Fortunately the original constant names were commented so it should be straightforward to build up a list of the necessary shorthand constants and thus replace the commented constants with the short names.
}}
Attached patch (Av1) </editor/*.js> (obsolete) — Splinter Review
[Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.9a1) Gecko/20060324 SeaMonkey/1.5a] (nightly) (W98SE)

These are the Core </editor> files;
I leave Daniel's Nvu </composer> files for a later patch [or should I leave them alone ?].
Attachment #216216 - Flags: superreview?(neil)
Attachment #216216 - Flags: review?(neil)
Neil: (nits)
I'm not too sure why you split the |if| clause at line 156 in v1.4 of <EdButtonProps.js>...
Comment on attachment 216216 [details] [diff] [review]
(Av1) </editor/*.js>

You were confused by some incorrect comments but in fact the output flags should always be combined with the | (or |=) operator.
Attachment #216216 - Flags: superreview?(neil)
Attachment #216216 - Flags: review?(neil)
Attachment #216216 - Flags: review-
(In reply to comment #2)
>I leave Daniel's Nvu </composer> files for a later patch [or should I leave
>them alone ?].
Best wait as hopefully he will update mozilla/composer from the latest Nvu.
Attached patch (Av2) </editor/*.js> (obsolete) — Splinter Review
Av1, with comment 4 suggestion(s).

(Right: '&' to test, '|' to add :->)
Attachment #216216 - Attachment is obsolete: true
Attachment #216237 - Flags: superreview?
Attachment #216237 - Flags: review?
Attachment #216237 - Flags: superreview?(neil)
Attachment #216237 - Flags: superreview?
Attachment #216237 - Flags: review?(neil)
Attachment #216237 - Flags: review?
Comment on attachment 216237 [details] [diff] [review]
(Av2) </editor/*.js>

I spotted a (256 = Output encoded entities) in ComposerCommands.js and there are also a few uncommented numbers in EditorCommandsDebug.js which look as if they should be converted to use the new constants.

>+    selection = editor.outputToString("text/html", kOutputFormatted | kOutputSelectionOnly | OutputWrap);
kOutputWrap, surely?
Attachment #216237 - Flags: superreview?(neil)
Attachment #216237 - Flags: superreview-
Attachment #216237 - Flags: review?(neil)
Attachment #216237 - Flags: review-
Av3, with comment 7 suggestion(s).

(For Av2, I had searched LXR only for the const from the idl file;
For Av3, I searched MXR for |flags |=, outputToString, toStringWithFormat|.)

NB: In <EditorCommandsDebug.js>, I wonder if/why the two values at lines 103+ should really be the same for 'text/plain' and 'text/html' !?
Attachment #216237 - Attachment is obsolete: true
Attachment #216477 - Flags: superreview?(neil)
Attachment #216477 - Flags: review?(neil)
(In reply to comment #8)
>NB: In <EditorCommandsDebug.js>, I wonder if/why the two values at lines 103+
>should really be the same for 'text/plain' and 'text/html' !?
I don't see what's wrong with them using the same flags with different formats.
(In reply to comment #9)
> (In reply to comment #8)
> >NB: In <EditorCommandsDebug.js>, I wonder if/why the two values at lines 103+
> >should really be the same for 'text/plain' and 'text/html' !?
> I don't see what's wrong with them using the same flags with different formats.

I don't say that there is anything wrong.
I simply wondered what the point was, and if some 'kOutputEncodeW3CEntities' or whatever would be helpful ... in case the current situation was some kind of copy and paste leftover...
If you say that this is intended, fine with me.
Comment on attachment 216477 [details] [diff] [review]
(Av3) </editor/*.js>
[Checked in: Comment 12]

glazou also said "YES-YES-YES !!!" over IRC without even looking at the patch ;-)
Attachment #216477 - Flags: superreview?(neil)
Attachment #216477 - Flags: superreview+
Attachment #216477 - Flags: review?(neil)
Attachment #216477 - Flags: review+
Fix checked in, thanks :-)
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Attachment #216477 - Attachment description: (Av3) </editor/*.js> → (Av3) </editor/*.js> [Checked in: Comment 12]
Attachment #216477 - Attachment is obsolete: true
(See comment 3)
Attachment #216666 - Flags: superreview?(neil)
Attachment #216666 - Flags: review?(neil)
Comment on attachment 216666 [details] [diff] [review]
(Bv1) <EdButtonProps.js> nit

Removing review requests due to severe bit rot. Please file a new bug for this remaining issue.
Attachment #216666 - Flags: superreview?(neil)
Attachment #216666 - Flags: review?(neil)
Attachment #216477 - Attachment is obsolete: false
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: