Closed Bug 309041 Opened 19 years ago Closed 19 years ago

Changing the proportional font does not update the default font until options are re-opened

Categories

(Firefox :: Settings UI, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 2 alpha1

People

(Reporter: mossop, Assigned: mossop)

Details

(Keywords: fixed1.8.1)

Attachments

(1 file, 6 obsolete files)

This occurs when the options are not using instantapply.

1. Open options to the content pane.
2. Note the default font setting.
3. Click advanced.
4. Change the proportional font option.
5. Click ok.

The default font will be unchanged in the main options. Clicking ok then
re-opening options will change the default font correctly. In an instantapply
setup the default font does change correctly.
Status: NEW → ASSIGNED
Attached patch Patch (obsolete) — Splinter Review
The problem is that when child dialogs are accepted in non-instantapply, they
store their settings in a set of preference elements in the prefpane that opens
them. This patch adjusts the font options in the content pane to use the
correct id's for the preference elements it uses so they correspond with the
ones used by the child dialog. Although not strictly necessary it also places
all the font prefs into the extra preferences element that the child dialog
will create anyway.

This has the added effect that changing the font settings then opening the
advanced will show the changes in the advanced dialog.
Attachment #196559 - Flags: review?(mconnor)
An alternative to this patch would be to make some changes to the prefwindow
binding. Child prefwindows could be made to automatically find a corresponding
preference element in the parent dialog an use that for storage, only resorting
to creating its own with a special id when necessary.

This should fix this situation, possibly other similar situations that I havent
seen, and would also work correctly if two different child dialogs both use the
same pref.
Attachment #196559 - Flags: review?(mconnor)
When looking for saved state for a child prefwindow, this attempts to find any
preference element on the parent window with the right name.

When saving state the same search is performed and only if no element is found
is a new element created.
Attachment #196559 - Attachment is obsolete: true
Attached patch Same patch with typo fix (obsolete) — Splinter Review
Fixed a minor typo
Attachment #196575 - Attachment is obsolete: true
Attachment #196576 - Flags: review?(mconnor)
Comment on attachment 196576 [details] [diff] [review]
Same patch with typo fix

Since this changes the behaviour of the binding a little it might be nice to
get it in for 1.5, don't think its a blocker though.
Attachment #196576 - Flags: review?(mconnor) → review?(bugs.mano)
Attached patch No longer set preference id (obsolete) — Splinter Review
There is no longer any need to set an id on the generated preference element
for the child state.
Attachment #196576 - Attachment is obsolete: true
Attachment #198210 - Flags: review?(bugs.mano)
Attachment #196576 - Flags: review?(bugs.mano)
Comment on attachment 198210 [details] [diff] [review]
No longer set preference id

>Index: toolkit/content/widgets/preferences.xml
>===================================================================

>+          var preference = null;
>+          var pprefs = pdoc.getElementsByTagName("preference");
>+          for (var i = 0; i < pprefs.length; ++i) {
>+            if (pprefs[i].name == this.name) {
>+              preference = pprefs[i];
>+              break;
>+            }
>+          }

...

>+                  var preference = null;
>+                  var pprefs = pdoc.getElementsByTagName("preference");
>+                  for (var k = 0; k < pprefs.length; ++k) {
>+                    if (pprefs[k].name == preferences[j].name) {
>+                      preference = pprefs[k];
>+                      break;
>+                    }
>+                  }

As discussed on IRC, make those two loops address the common case a bit better.

>                   if (!preference) {
>-                    var preference = pdoc.createElement("preference");
>+                    preference = pdoc.createElement("preference");
>                     childPrefs.appendChild(preference);
>-                    preference.id       = prefID;

You've to make sure updateElements, disabled and tabIndex don't fail/warn in
the case where there's no id.
Attachment #198210 - Flags: review?(bugs.mano) → review-
Attached patch Improved patch (obsolete) — Splinter Review
Addressed Mano's comments.
Attachment #198210 - Attachment is obsolete: true
Attachment #198678 - Flags: review?(bugs.mano)
Attached patch patch (obsolete) — Splinter Review
Addressed comments from IRC.
Removed break statement.
Wrapped the longer lines.
Attachment #198678 - Attachment is obsolete: true
Attachment #198686 - Flags: review?(bugs.mano)
Attachment #198678 - Flags: review?(bugs.mano)
Comment on attachment 198686 [details] [diff] [review]
patch

>-          this._setValue(lastStatePref ? lastStatePref.value 
>-                                       : this.valueFromPreferences, false);
>+
>+          // Try to find a preference element in the parent window with the same
>+          // name as this one.

how about "a preference element for the same preference"?

>+              if (parentPrefs[l].localName == "preference") {
>+                preference = parentPrefs[l];
>+              }
>+            }

remove single line brackets.

>               for (var i = 0; i < panes.length; ++i) {
>                 var preferences = panes[i].preferences;
>                 for (var j = 0; j < preferences.length; ++j) {
>-                  var prefID = window.location.href + "#" + preferences[j].id;
>-                  var preference = pdoc.getElementById(prefID);
>+                

remove the whitespace in this line.


r=mano with these changes.
Attachment #198686 - Flags: review?(bugs.mano) → review+
Attached patch Final patchSplinter Review
Patch addressing Mano's comments.
Attachment #198686 - Attachment is obsolete: true
Attachment #198793 - Flags: review?(bugs.mano)
Comment on attachment 198793 [details] [diff] [review]
Final patch

r=mano.
Attachment #198793 - Flags: review?(bugs.mano) → review+
Checking in toolkit/content/widgets/preferences.xml;
/cvsroot/mozilla/toolkit/content/widgets/preferences.xml,v  <--  preferences.xml
new revision: 1.42; previous revision: 1.41
done
Fixed on trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Flags: blocking1.8rc1?
Attachment #198793 - Flags: approval1.8rc1?
Comment on attachment 198793 [details] [diff] [review]
Final patch

too late for non-critical changes.
Attachment #198793 - Flags: approval1.8rc1? → approval1.8rc1-
Flags: blocking1.8rc1? → blocking1.8rc1-
Flags: blocking-aviary2?
Attachment #198793 - Flags: approval1.8.1+
Flags: blocking-firefox2? → blocking-firefox2+
Checked in on the 1.8 branch for Firefox 2.
mozilla/toolkit/content/widgets/preferences.xml; new revision: 1.31.2.9;
Keywords: fixed1.8.1
Target Milestone: --- → Firefox 2
Target Milestone: Firefox 2 → Firefox 2 alpha1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: