[webkit-dev] Changing minimum font size
sullivan at apple.com
Mon Aug 22 08:52:37 PDT 2005
On Aug 21, 2005, at 3:55 PM, Steve Palmer wrote:
> I asked this on the cocoa-dev alias but got no response. Hopefully
> this is a more appropriate list?
> I'm trying to get my head around web preferences. Based on my
> reading of the API documentation, this should work to change the
> minimum font size used by a webview that already has text:
> WebPreferences * webPrefs = [myWebView preferences];
> [webPrefs setMinimumFontSize:12];
> [myWebView setPreferences:webPrefs];
> However the existing webview text isn't changed. Any suggestions
> what I'm missing?
> - Steve
The third line above isn't necessary; there's no need to set the
preferences back to the same WebPreferences* object.
The other two lines seem correct. It's not clear why this wouldn't be
working in your case. You should be able to debug this if you build
WebKit from the open-source repository (see webkit.opendarwin.org).
Here's what should happen:
Setting the minimum font size runs this code:
[self _setIntegerValue: size forKey:
_setIntegerValue should store the new value, and call [self
_postPreferencesChangesNotification]. Note that _setIntegerValue will
do nothing if the new value matches the old (but that shouldn't be
your case, since the initial value of minimumFontSize should be 0,
which represents no minimum.
_postPreferencesChangedNotification should send a
WebView should observe the _postPreferencesChangedNotification and
call [self _updateWebCoreSettingsFromPreferences: preferences].
_updateWebCoreSettingsFromPreferences then calls [_private->settings
setMinimumFontSize:[preferences minimumFontSize]] to make the new
value known to WebCore.
-[WebCoreSettings setMinimumFontSize:] then stores the value and
calls [self _updateAllViews], which schedules a redraw that should
use the new settings.
So one of these steps must be failing in your case for some reason.
You should be able to figure out which one with a little debugging.
I hope this helps,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev