Closed Bug 83335 Opened 23 years ago Closed 23 years ago

hrule align attribute defaults to left not center

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.3

People

(Reporter: Brade, Assigned: cmanske)

References

Details

Attachments

(4 files)

The hrule align attribute is always written out.  We shouldn't write it out if 
it's the default value (center).
easy.
Status: NEW → ASSIGNED
Hardware: Macintosh → All
Target Milestone: --- → mozilla0.9.2
To simplify, I'm going to fix all simple HLine problems with this bug.
This is another simple problem:
Start Composer
Insert a Horizontal Line from H.Line toolbar button.
Double click on it to edit properties. You can set the alignmen via radio
button. Set "Center"
Click on Advanced Edit button and change alignment to "right". Click OK.
When you return to H.Line dialog, both "Center" and "Right" are checked.
Simple fix -- just clear all 3 buttons before getting current align state.
*** Bug 83483 has been marked as a duplicate of this bug. ***
Note that patch also fixes other places where we were writing the "align"
attribute as "center" when we don't need to.
Whiteboard: FIX IN HAND need r=, sr=
* why did you remove the ';' from the end of this line in ComposerCommands.js:
  hLine.setAttribute("align", "right")
* in nsHTMLEditor.cpp, I don't understand why you removed that line and not the 
others; maybe add a comment in there so someone doesn't add it back in?
* I don't understand why we need to set all of the radio buttons' checked to 
false.  Do we need to do that anywhere else?
* why change the code that sets checked to true?
* can we remove all or most of the dumps in this file?
* why did you remove the ';' from the end of this line in ComposerCommands.js:
  hLine.setAttribute("align", "right")
An accident! Fixed.

* in nsHTMLEditor.cpp, I don't understand why you removed that line and not the
others; maybe add a comment in there so someone doesn't add it back in?

We set attributes (not many now) that we really want, but
as you observed, it isn't necessary to set "center" for HLine, since it's default.

* I don't understand why we need to set all of the radio buttons' checked to
false.  Do we need to do that anywhere else?
I wondered about that too. The only other example I could find using radio
buttons for an element props dialog that accessed Advanced Edit was in Image
dialog, and setting checks is done correctly there. This seems to be only
example with 3 radio buttons.

* why change the code that sets checked to true?
Diff is confusing. Changed to was use "center" as default

* can we remove all or most of the dumps in this file?
Sure. Done.

Changes look good to me ... sr=kin@netscape.com

Not required:

Would it be better to do the following instead of clearing the checked values 
first then checking which is set?

    dialog.centerAlign.checked = (align == "center");
    dialog.rightAlign.checked  = (align == "right");
    dialog.leftAlign.checked   = (align == "left");

Whiteboard: FIX IN HAND need r=, sr= → FIX IN HAND need r=
Kin's suggestion was good, but must also check null:
  dialog.centerAlign.checked = (align == "center" || !align);
  dialog.rightAlign.checked  = (align == "right");
  dialog.leftAlign.checked   = (align == "left");

This is the new version.

sr=kin
r=sfraser
Whiteboard: FIX IN HAND need r= → FIX IN HAND
Blocks: 83989
a= asa@mozilla.org for checkin to the trunk.
(on behalf of drivers)
Whiteboard: FIX IN HAND → fixed, reviewed, a=asa
checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Keywords: patch, review
Resolution: --- → FIXED
Whiteboard: fixed, reviewed, a=asa → fixed
updated summary to reflect the remaining issue from this bug, when insert an 
hrule, the default align value being set is left, the default should be center, 
and should be written out for correctness. See section 15.3
Status: RESOLVED → REOPENED
OS: Mac System 9.x → All
Resolution: FIXED → ---
Summary: hrule align attribute problems → hrule align attribute defaults to left not center
Severity: normal → minor
Priority: -- → P3
Target Milestone: mozilla0.9.2 → mozilla0.9.3
trivial to fix, one line correction, and the horizontal rule will insert correctly

reviewed and approved
Keywords: nsBranch
Whiteboard: fixed
The point of the orginal bug was to *not* explicitly write the 'center'
attribute in the <hrule> tag. I don't think there's a bug here.
The default value is saved in preferences, so if you ever used align = "left"
and clicked on the "Use as default" button in the H.Line properties dialog, the
pref would be saved and used as new default. If no "align" attribute
is set, layout will default to center. So insert a new H.Line, click on "center"
radio button, then click on "Use as default" to clear the pref.
The next line you insert should have no "align" set on the <hrule>, and should
display centered. Close the app and restart, then insert a new line in Composer
to see if you are still getting the default "center" behavior.
Status: REOPENED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → INVALID
reopen bug for different resolution
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
original bug reported is fixed
Status: REOPENED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → FIXED
Okay two issues here that I see now after inserting an H. Line:

1) H. Line default = Left. 
2) after changing alignment to Center when you look at the source, we don't
write out the alignment for Center.

If the above are correct, then I am marking this VERIFIED-FIXED.

otherwise REOPEN.
Status: RESOLVED → VERIFIED
Are you sure the H.Line default is "left"? Did you delete your prefs first?
The default should be to not put any "align" value, thus layout will center
it.
I"m seeing an alignment value of "left".

What do you mean by delete my prefs? my prefs.js file?
Yes, delete prefs.js
Leaving this bug as closed out...

Charley recommends filing a new bug on the default align = left issue.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: