Closed
Bug 184718
Opened 22 years ago
Closed 22 years ago
midas needs a command for setting html/css creation type
Categories
(Core :: DOM: Editor, defect)
Core
DOM: Editor
Tracking
()
RESOLVED
FIXED
mozilla1.3beta
People
(Reporter: Brade, Assigned: Brade)
Details
(Whiteboard: midas)
Attachments
(1 file, 2 obsolete files)
|
13.43 KB,
patch
|
Brade
:
review+
sfraser_bugs
:
superreview+
|
Details | Diff | Splinter Review |
Midas needs a command for setting html/css creation type
| Assignee | ||
Updated•22 years ago
|
Status: NEW → ASSIGNED
Whiteboard: midas
| Assignee | ||
Comment 1•22 years ago
|
||
Charley reminds me of these things:
>be sure to implement it as another "nsSetDocumentStateCommand" command if it
>supports setting a state param. and use nsDocumentStateCommand if it simply
>reports state
I would guess that this is setting a state rather than reporting a state.| Assignee | ||
Comment 2•22 years ago
|
||
| Assignee | ||
Comment 3•22 years ago
|
||
Comment on attachment 111794 [details] [diff] [review] one way of handling boolean parameters (in Midas) feedback? comments?
Attachment #111794 -
Flags: superreview?(sfraser)
Attachment #111794 -
Flags: review?(mkaply)
Comment 4•22 years ago
|
||
+ // if this is a boolean value and it's not explicitly false
+ // (e.g. no value) we default to "true"
+ outBooleanValue = convertedParam.Equals("false",
+ nsCaseInsensitiveCStringComparator());
Is this how the IE api works? Should we be more lax, like allowing "yes"?
Comment 5•22 years ago
|
||
I did some testing and found that if you pass a boolean via Javascript (true/false), Mozilla internally goes through the effort of converting it to text, so by the time it gets to us, it already is "true" or "false", so we should document this to take real booleans. I'm wondering if going through all this boolean stuff in nsDocument is necessary. Would it make more sense to DoCommandParams in nsComposerDocumentCommand.cpp just do a GetStringValue instead of a GetBooleanValue and check for "true" or "false"? That would avoid all the overhead of modifying the existing structures and code and things.
Comment 6•22 years ago
|
||
OK, this patch makes very minor changes to nsComposerDocumentCommands to use "true" and "false" instead of booleans for what is passed to readonly and usecss. Looking for feedback.
Comment 7•22 years ago
|
||
Comment on attachment 111794 [details] [diff] [review] one way of handling boolean parameters (in Midas) I'd prefer that we used string compares in the command code instead of converting to boolean, but I understand why we are doing it this way. r=mkaply
Attachment #111794 -
Flags: review?(mkaply) → review+
Comment 8•22 years ago
|
||
Comment on attachment 111794 [details] [diff] [review] one way of handling boolean parameters (in Midas) >Index: src/nsHTMLDocument.cpp >=================================================================== >RCS file: /cvsroot/mozilla/content/html/document/src/nsHTMLDocument.cpp,v >retrieving revision 3.458 >diff -u -6 -r3.458 nsHTMLDocument.cpp >--- src/nsHTMLDocument.cpp 20 Dec 2002 14:53:44 -0000 3.458 >+++ src/nsHTMLDocument.cpp 17 Jan 2003 03:11:28 -0000 >@@ -4157,60 +4157,64 @@ > > struct MidasCommand { > const char* incomingCommandString; > const char* internalCommandString; > const char* internalParamString; > PRBool useNewParam; >+ PRBool convertToBoolean; > }; Using PRPackedBool would save a bunch of global data. > PRBool > nsHTMLDocument::ConvertToMidasInternalCommand(const nsAString & inCommandID, > const nsAString & inParam, > nsACString& outCommandID, >- nsACString& outParam) >+ nsACString& outParam, >+ PRBool& outIsBoolean, >+ PRBool& outBooleanValue) > { > NS_ConvertUCS2toUTF8 convertedCommandID(inCommandID); > PRUint32 i, j; > for (i = 0; i < MidasCommandCount; ++i) { > if (convertedCommandID.Equals(gMidasCommandTable[i].incomingCommandString, > nsCaseInsensitiveCStringComparator())) { > // set outCommandID (what we use internally) I don't really like the logic in this method. Right now, it's: for () { if (found) { do a bunch of stuff; return; } } I'd prefer that the loop contents just do the finding, and you pull the 'success' code out of the loop. It would make things easier to read. Also, I haven't yet seen an answer about whether we should allow values of "yes", "1" etc. to equate with "true".
| Assignee | ||
Updated•22 years ago
|
Target Milestone: --- → mozilla1.3beta
| Assignee | ||
Comment 9•22 years ago
|
||
Attachment #111794 -
Attachment is obsolete: true
Attachment #111873 -
Attachment is obsolete: true
| Assignee | ||
Updated•22 years ago
|
Attachment #112220 -
Flags: superreview?(sfraser)
| Assignee | ||
Updated•22 years ago
|
Attachment #111794 -
Flags: superreview?(sfraser) → superreview-
Updated•22 years ago
|
Attachment #112220 -
Flags: superreview?(sfraser) → superreview+
| Assignee | ||
Comment 10•22 years ago
|
||
Comment on attachment 112220 [details] [diff] [review] updated diff per sfraser's comments carry forward r=mkaply from previous patch
Attachment #112220 -
Flags: review+
| Assignee | ||
Comment 11•22 years ago
|
||
fixed
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•