I assumed from reading the documentation that the third line was apparently needed because the second line merely sets a property and doesn't fire off any notification and hence I saw no way that the webview would be refreshed with the new preferences. Unfortunately my assumption was wrong since looking at the WebKit source shows that if the new preferences pointer is identical to the old one, it does nothing. Based on that, my next approach was this: if (![NSApp enableMinimumFontSize]) [myWebView setPreferences:defaultWebPrefs]; else { WebPreferences * webPrefs = [[WebPreferences alloc] init]; [webPrefs setMinimumFontSize:[NSApp minimumFontSize]]; [myWebView setPreferences:webPrefs]; [webPrefs release]; } to toggle setting the minimum font size on or off. This worked fine - except that the webview text font increased to 16pt from the original 12pt and wouldn't budge thenafter. After some thought, I realised that the HTML being rendered didn't include any explicit font size in the stylesheet and thus it was picking up the default from the newly allocated WebPreference. However the default font size in webPrefs was different from that in defaultWebPrefs. I've no idea why but adding the following lines: [webPrefs setDefaultFontSize:[defaultWebPrefs defaultFontSize]]; [webPrefs setDefaultFixedFontSize:[defaultWebPrefs defaultFixedFontSize]]; after the alloc solved the problem. A better approach would appear to copy the entire contents of defaultWebPrefs into webPrefs after the alloc and before setting the minimum font size as that would ensure fidelity between the preferences. Thanks for the pointer, John! - Steve On Aug 22, 2005, at 8:52am, John Sullivan wrote:
|
_______________________________________________ webkit-dev mailing list [email protected] http://www.opendarwin.org/mailman/listinfo/webkit-dev
