Changeset 12930 in webkit
- Timestamp:
- Feb 21, 2006 4:55:26 PM (18 years ago)
- Location:
- trunk/WebKit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/ChangeLog
r12926 r12930 1 1 2006-02-21 Kevin Decker <kdecker@apple.com> 2 2 3 Reviewed by Timo O.4 5 Moved these (already private) methods into the private WebPreferences header.6 Slightly better style than sprinkling the code withcategories.7 3 Reviewed by Darin. 4 5 Backed out my previous check in. Since these methods are internal to WebKit (and not private) 6 it's perfectly OK for them to remain as categories. 7 * ChangeLog: 8 8 * WebView/WebPreferences.m: 9 (-[WebPreferences _integerValueForKey:]): Moved to WebPreferences (WebPrivate).10 (-[WebPreferences _ floatValueForKey:]): Ditto.11 (-[WebPreferences _ boolValueForKey:]): Ditto.12 (-[WebPreferences _set BoolValue:forKey:]): Ditto.13 (-[WebPreferences _ setFloatValue:forKey:]): Ditto.14 (-[WebPreferences _set IntegerValue:forKey:]): Ditto.15 * WebView/WebPreferencesPrivate.h: Added the above methods.9 (-[WebPreferences _integerValueForKey:]): 10 (-[WebPreferences _setIntegerValue:forKey:]): 11 (-[WebPreferences _floatValueForKey:]): 12 (-[WebPreferences _setFloatValue:forKey:]): 13 (-[WebPreferences _boolValueForKey:]): 14 (-[WebPreferences _setBoolValue:forKey:]): 15 * WebView/WebPreferencesPrivate.h: 16 16 17 17 2006-02-20 Darin Adler <darin@apple.com> -
trunk/WebKit/WebView/WebPreferences.m
r12926 r12930 67 67 + (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key; 68 68 + (NSString *)_IBCreatorID; 69 @end 70 71 @interface WebPreferences (WebForwardDeclarations) 72 // This pseudo-category is needed so these methods can be used from within other category implementations 73 // without being in the public header file. 74 - (BOOL)_boolValueForKey:(NSString *)key; 75 - (void)_setBoolValue:(BOOL)value forKey:(NSString *)key; 76 - (int)_integerValueForKey:(NSString *)key; 77 - (void)_setIntegerValue:(int)value forKey:(NSString *)key; 78 - (float)_floatValueForKey:(NSString *)key; 79 - (void)_setFloatValue:(float)value forKey:(NSString *)key; 69 80 @end 70 81 … … 269 280 } 270 281 271 - (NSString *)standardFontFamily272 {273 return [self _stringValueForKey: WebKitStandardFontPreferenceKey];274 }275 276 - (void)setStandardFontFamily:(NSString *)family277 {278 [self _setStringValue: family forKey: WebKitStandardFontPreferenceKey];279 }280 281 - (NSString *)fixedFontFamily282 {283 return [self _stringValueForKey: WebKitFixedFontPreferenceKey];284 }285 286 - (void)setFixedFontFamily:(NSString *)family287 {288 [self _setStringValue: family forKey: WebKitFixedFontPreferenceKey];289 }290 291 - (NSString *)serifFontFamily292 {293 return [self _stringValueForKey: WebKitSerifFontPreferenceKey];294 }295 296 - (void)setSerifFontFamily:(NSString *)family297 {298 [self _setStringValue: family forKey: WebKitSerifFontPreferenceKey];299 }300 301 - (NSString *)sansSerifFontFamily302 {303 return [self _stringValueForKey: WebKitSansSerifFontPreferenceKey];304 }305 306 - (void)setSansSerifFontFamily:(NSString *)family307 {308 [self _setStringValue: family forKey: WebKitSansSerifFontPreferenceKey];309 }310 311 - (NSString *)cursiveFontFamily312 {313 return [self _stringValueForKey: WebKitCursiveFontPreferenceKey];314 }315 316 - (void)setCursiveFontFamily:(NSString *)family317 {318 [self _setStringValue: family forKey: WebKitCursiveFontPreferenceKey];319 }320 321 - (NSString *)fantasyFontFamily322 {323 return [self _stringValueForKey: WebKitFantasyFontPreferenceKey];324 }325 326 - (void)setFantasyFontFamily:(NSString *)family327 {328 [self _setStringValue: family forKey: WebKitFantasyFontPreferenceKey];329 }330 331 - (int)defaultFontSize332 {333 return [self _integerValueForKey: WebKitDefaultFontSizePreferenceKey];334 }335 336 - (void)setDefaultFontSize:(int)size337 {338 [self _setIntegerValue: size forKey: WebKitDefaultFontSizePreferenceKey];339 }340 341 - (int)defaultFixedFontSize342 {343 return [self _integerValueForKey: WebKitDefaultFixedFontSizePreferenceKey];344 }345 346 - (void)setDefaultFixedFontSize:(int)size347 {348 [self _setIntegerValue: size forKey: WebKitDefaultFixedFontSizePreferenceKey];349 }350 351 - (int)minimumFontSize352 {353 return [self _integerValueForKey: WebKitMinimumFontSizePreferenceKey];354 }355 356 - (void)setMinimumFontSize:(int)size357 {358 [self _setIntegerValue: size forKey: WebKitMinimumFontSizePreferenceKey];359 }360 361 - (int)minimumLogicalFontSize362 {363 return [self _integerValueForKey: WebKitMinimumLogicalFontSizePreferenceKey];364 }365 366 - (void)setMinimumLogicalFontSize:(int)size367 {368 [self _setIntegerValue: size forKey: WebKitMinimumLogicalFontSizePreferenceKey];369 }370 371 - (NSString *)defaultTextEncodingName372 {373 return [self _stringValueForKey: WebKitDefaultTextEncodingNamePreferenceKey];374 }375 376 - (void)setDefaultTextEncodingName:(NSString *)encoding377 {378 [self _setStringValue: encoding forKey: WebKitDefaultTextEncodingNamePreferenceKey];379 }380 381 - (BOOL)userStyleSheetEnabled382 {383 return [self _boolValueForKey: WebKitUserStyleSheetEnabledPreferenceKey];384 }385 386 - (void)setUserStyleSheetEnabled:(BOOL)flag387 {388 [self _setBoolValue: flag forKey: WebKitUserStyleSheetEnabledPreferenceKey];389 }390 391 - (NSURL *)userStyleSheetLocation392 {393 NSString *locationString = [self _stringValueForKey: WebKitUserStyleSheetLocationPreferenceKey];394 395 if ([locationString _webkit_looksLikeAbsoluteURL]) {396 return [NSURL _web_URLWithDataAsString:locationString];397 } else {398 locationString = [locationString stringByExpandingTildeInPath];399 return [NSURL fileURLWithPath:locationString];400 }401 }402 403 - (void)setUserStyleSheetLocation:(NSURL *)URL404 {405 NSString *locationString;406 407 if ([URL isFileURL]) {408 locationString = [[URL path] _web_stringByAbbreviatingWithTildeInPath];409 } else {410 locationString = [URL _web_originalDataAsString];411 }412 413 [self _setStringValue:locationString forKey: WebKitUserStyleSheetLocationPreferenceKey];414 }415 416 - (BOOL)shouldPrintBackgrounds417 {418 return [self _boolValueForKey: WebKitShouldPrintBackgroundsPreferenceKey];419 }420 421 - (void)setShouldPrintBackgrounds:(BOOL)flag422 {423 [self _setBoolValue: flag forKey: WebKitShouldPrintBackgroundsPreferenceKey];424 }425 426 - (BOOL)isJavaEnabled427 {428 return [self _boolValueForKey: WebKitJavaEnabledPreferenceKey];429 }430 431 - (void)setJavaEnabled:(BOOL)flag432 {433 [self _setBoolValue: flag forKey: WebKitJavaEnabledPreferenceKey];434 }435 436 - (BOOL)isJavaScriptEnabled437 {438 return [self _boolValueForKey: WebKitJavaScriptEnabledPreferenceKey];439 }440 441 - (void)setJavaScriptEnabled:(BOOL)flag442 {443 [self _setBoolValue: flag forKey: WebKitJavaScriptEnabledPreferenceKey];444 }445 446 - (BOOL)javaScriptCanOpenWindowsAutomatically447 {448 return [self _boolValueForKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];449 }450 451 - (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)flag452 {453 [self _setBoolValue: flag forKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];454 }455 456 - (BOOL)arePlugInsEnabled457 {458 return [self _boolValueForKey: WebKitPluginsEnabledPreferenceKey];459 }460 461 - (void)setPlugInsEnabled:(BOOL)flag462 {463 [self _setBoolValue: flag forKey: WebKitPluginsEnabledPreferenceKey];464 }465 466 - (BOOL)allowsAnimatedImages467 {468 return [self _boolValueForKey: WebKitAllowAnimatedImagesPreferenceKey];469 }470 471 - (void)setAllowsAnimatedImages:(BOOL)flag;472 {473 [self _setBoolValue: flag forKey: WebKitAllowAnimatedImagesPreferenceKey];474 }475 476 - (BOOL)allowsAnimatedImageLooping477 {478 return [self _boolValueForKey: WebKitAllowAnimatedImageLoopingPreferenceKey];479 }480 481 - (void)setAllowsAnimatedImageLooping: (BOOL)flag482 {483 [self _setBoolValue: flag forKey: WebKitAllowAnimatedImageLoopingPreferenceKey];484 }485 486 - (void)setLoadsImagesAutomatically: (BOOL)flag487 {488 [self _setBoolValue: flag forKey: WebKitDisplayImagesKey];489 }490 491 - (BOOL)loadsImagesAutomatically492 {493 return [self _boolValueForKey: WebKitDisplayImagesKey];494 }495 496 - (void)setAutosaves:(BOOL)flag;497 {498 _private->autosaves = flag;499 }500 501 - (BOOL)autosaves502 {503 return _private->autosaves;504 }505 506 - (void)setTabsToLinks:(BOOL)flag507 {508 [self _setBoolValue: flag forKey: WebKitTabToLinksPreferenceKey];509 }510 511 - (BOOL)tabsToLinks512 {513 return [self _boolValueForKey:WebKitTabToLinksPreferenceKey];514 }515 516 - (void)setPrivateBrowsingEnabled:(BOOL)flag517 {518 [self _setBoolValue:flag forKey:WebKitPrivateBrowsingEnabledPreferenceKey];519 }520 521 - (BOOL)privateBrowsingEnabled522 {523 return [self _boolValueForKey:WebKitPrivateBrowsingEnabledPreferenceKey];524 }525 526 @end527 528 @implementation WebPreferences (WebPrivate)529 530 282 - (int)_integerValueForKey:(NSString *)key 531 283 { … … 534 286 } 535 287 288 - (void)_setIntegerValue:(int)value forKey:(NSString *)key 289 { 290 if ([self _integerValueForKey:key] == value) 291 return; 292 NSString *_key = KEY(key); 293 [_private->values _webkit_setInt:value forKey:_key]; 294 if (_private->autosaves) 295 [[NSUserDefaults standardUserDefaults] setInteger:value forKey:_key]; 296 [self _postPreferencesChangesNotification]; 297 } 298 536 299 - (float)_floatValueForKey:(NSString *)key 537 300 { … … 540 303 } 541 304 305 - (void)_setFloatValue:(float)value forKey:(NSString *)key 306 { 307 if ([self _floatValueForKey:key] == value) 308 return; 309 NSString *_key = KEY(key); 310 [_private->values _webkit_setFloat:value forKey:_key]; 311 if (_private->autosaves) 312 [[NSUserDefaults standardUserDefaults] setFloat:value forKey:_key]; 313 [self _postPreferencesChangesNotification]; 314 } 542 315 543 316 - (BOOL)_boolValueForKey:(NSString *)key … … 557 330 } 558 331 559 - (void)_setFloatValue:(float)value forKey:(NSString *)key 560 { 561 if ([self _floatValueForKey:key] == value) 562 return; 563 NSString *_key = KEY(key); 564 [_private->values _webkit_setFloat:value forKey:_key]; 565 if (_private->autosaves) 566 [[NSUserDefaults standardUserDefaults] setFloat:value forKey:_key]; 567 [self _postPreferencesChangesNotification]; 568 } 569 570 - (void)_setIntegerValue:(int)value forKey:(NSString *)key 571 { 572 if ([self _integerValueForKey:key] == value) 573 return; 574 NSString *_key = KEY(key); 575 [_private->values _webkit_setInt:value forKey:_key]; 576 if (_private->autosaves) 577 [[NSUserDefaults standardUserDefaults] setInteger:value forKey:_key]; 578 [self _postPreferencesChangesNotification]; 579 } 332 - (NSString *)standardFontFamily 333 { 334 return [self _stringValueForKey: WebKitStandardFontPreferenceKey]; 335 } 336 337 - (void)setStandardFontFamily:(NSString *)family 338 { 339 [self _setStringValue: family forKey: WebKitStandardFontPreferenceKey]; 340 } 341 342 - (NSString *)fixedFontFamily 343 { 344 return [self _stringValueForKey: WebKitFixedFontPreferenceKey]; 345 } 346 347 - (void)setFixedFontFamily:(NSString *)family 348 { 349 [self _setStringValue: family forKey: WebKitFixedFontPreferenceKey]; 350 } 351 352 - (NSString *)serifFontFamily 353 { 354 return [self _stringValueForKey: WebKitSerifFontPreferenceKey]; 355 } 356 357 - (void)setSerifFontFamily:(NSString *)family 358 { 359 [self _setStringValue: family forKey: WebKitSerifFontPreferenceKey]; 360 } 361 362 - (NSString *)sansSerifFontFamily 363 { 364 return [self _stringValueForKey: WebKitSansSerifFontPreferenceKey]; 365 } 366 367 - (void)setSansSerifFontFamily:(NSString *)family 368 { 369 [self _setStringValue: family forKey: WebKitSansSerifFontPreferenceKey]; 370 } 371 372 - (NSString *)cursiveFontFamily 373 { 374 return [self _stringValueForKey: WebKitCursiveFontPreferenceKey]; 375 } 376 377 - (void)setCursiveFontFamily:(NSString *)family 378 { 379 [self _setStringValue: family forKey: WebKitCursiveFontPreferenceKey]; 380 } 381 382 - (NSString *)fantasyFontFamily 383 { 384 return [self _stringValueForKey: WebKitFantasyFontPreferenceKey]; 385 } 386 387 - (void)setFantasyFontFamily:(NSString *)family 388 { 389 [self _setStringValue: family forKey: WebKitFantasyFontPreferenceKey]; 390 } 391 392 - (int)defaultFontSize 393 { 394 return [self _integerValueForKey: WebKitDefaultFontSizePreferenceKey]; 395 } 396 397 - (void)setDefaultFontSize:(int)size 398 { 399 [self _setIntegerValue: size forKey: WebKitDefaultFontSizePreferenceKey]; 400 } 401 402 - (int)defaultFixedFontSize 403 { 404 return [self _integerValueForKey: WebKitDefaultFixedFontSizePreferenceKey]; 405 } 406 407 - (void)setDefaultFixedFontSize:(int)size 408 { 409 [self _setIntegerValue: size forKey: WebKitDefaultFixedFontSizePreferenceKey]; 410 } 411 412 - (int)minimumFontSize 413 { 414 return [self _integerValueForKey: WebKitMinimumFontSizePreferenceKey]; 415 } 416 417 - (void)setMinimumFontSize:(int)size 418 { 419 [self _setIntegerValue: size forKey: WebKitMinimumFontSizePreferenceKey]; 420 } 421 422 - (int)minimumLogicalFontSize 423 { 424 return [self _integerValueForKey: WebKitMinimumLogicalFontSizePreferenceKey]; 425 } 426 427 - (void)setMinimumLogicalFontSize:(int)size 428 { 429 [self _setIntegerValue: size forKey: WebKitMinimumLogicalFontSizePreferenceKey]; 430 } 431 432 - (NSString *)defaultTextEncodingName 433 { 434 return [self _stringValueForKey: WebKitDefaultTextEncodingNamePreferenceKey]; 435 } 436 437 - (void)setDefaultTextEncodingName:(NSString *)encoding 438 { 439 [self _setStringValue: encoding forKey: WebKitDefaultTextEncodingNamePreferenceKey]; 440 } 441 442 - (BOOL)userStyleSheetEnabled 443 { 444 return [self _boolValueForKey: WebKitUserStyleSheetEnabledPreferenceKey]; 445 } 446 447 - (void)setUserStyleSheetEnabled:(BOOL)flag 448 { 449 [self _setBoolValue: flag forKey: WebKitUserStyleSheetEnabledPreferenceKey]; 450 } 451 452 - (NSURL *)userStyleSheetLocation 453 { 454 NSString *locationString = [self _stringValueForKey: WebKitUserStyleSheetLocationPreferenceKey]; 455 456 if ([locationString _webkit_looksLikeAbsoluteURL]) { 457 return [NSURL _web_URLWithDataAsString:locationString]; 458 } else { 459 locationString = [locationString stringByExpandingTildeInPath]; 460 return [NSURL fileURLWithPath:locationString]; 461 } 462 } 463 464 - (void)setUserStyleSheetLocation:(NSURL *)URL 465 { 466 NSString *locationString; 467 468 if ([URL isFileURL]) { 469 locationString = [[URL path] _web_stringByAbbreviatingWithTildeInPath]; 470 } else { 471 locationString = [URL _web_originalDataAsString]; 472 } 473 474 [self _setStringValue:locationString forKey: WebKitUserStyleSheetLocationPreferenceKey]; 475 } 476 477 - (BOOL)shouldPrintBackgrounds 478 { 479 return [self _boolValueForKey: WebKitShouldPrintBackgroundsPreferenceKey]; 480 } 481 482 - (void)setShouldPrintBackgrounds:(BOOL)flag 483 { 484 [self _setBoolValue: flag forKey: WebKitShouldPrintBackgroundsPreferenceKey]; 485 } 486 487 - (BOOL)isJavaEnabled 488 { 489 return [self _boolValueForKey: WebKitJavaEnabledPreferenceKey]; 490 } 491 492 - (void)setJavaEnabled:(BOOL)flag 493 { 494 [self _setBoolValue: flag forKey: WebKitJavaEnabledPreferenceKey]; 495 } 496 497 - (BOOL)isJavaScriptEnabled 498 { 499 return [self _boolValueForKey: WebKitJavaScriptEnabledPreferenceKey]; 500 } 501 502 - (void)setJavaScriptEnabled:(BOOL)flag 503 { 504 [self _setBoolValue: flag forKey: WebKitJavaScriptEnabledPreferenceKey]; 505 } 506 507 - (BOOL)javaScriptCanOpenWindowsAutomatically 508 { 509 return [self _boolValueForKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey]; 510 } 511 512 - (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)flag 513 { 514 [self _setBoolValue: flag forKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey]; 515 } 516 517 - (BOOL)arePlugInsEnabled 518 { 519 return [self _boolValueForKey: WebKitPluginsEnabledPreferenceKey]; 520 } 521 522 - (void)setPlugInsEnabled:(BOOL)flag 523 { 524 [self _setBoolValue: flag forKey: WebKitPluginsEnabledPreferenceKey]; 525 } 526 527 - (BOOL)allowsAnimatedImages 528 { 529 return [self _boolValueForKey: WebKitAllowAnimatedImagesPreferenceKey]; 530 } 531 532 - (void)setAllowsAnimatedImages:(BOOL)flag; 533 { 534 [self _setBoolValue: flag forKey: WebKitAllowAnimatedImagesPreferenceKey]; 535 } 536 537 - (BOOL)allowsAnimatedImageLooping 538 { 539 return [self _boolValueForKey: WebKitAllowAnimatedImageLoopingPreferenceKey]; 540 } 541 542 - (void)setAllowsAnimatedImageLooping: (BOOL)flag 543 { 544 [self _setBoolValue: flag forKey: WebKitAllowAnimatedImageLoopingPreferenceKey]; 545 } 546 547 - (void)setLoadsImagesAutomatically: (BOOL)flag 548 { 549 [self _setBoolValue: flag forKey: WebKitDisplayImagesKey]; 550 } 551 552 - (BOOL)loadsImagesAutomatically 553 { 554 return [self _boolValueForKey: WebKitDisplayImagesKey]; 555 } 556 557 - (void)setAutosaves:(BOOL)flag; 558 { 559 _private->autosaves = flag; 560 } 561 562 - (BOOL)autosaves 563 { 564 return _private->autosaves; 565 } 566 567 - (void)setTabsToLinks:(BOOL)flag 568 { 569 [self _setBoolValue: flag forKey: WebKitTabToLinksPreferenceKey]; 570 } 571 572 - (BOOL)tabsToLinks 573 { 574 return [self _boolValueForKey:WebKitTabToLinksPreferenceKey]; 575 } 576 577 - (void)setPrivateBrowsingEnabled:(BOOL)flag 578 { 579 [self _setBoolValue:flag forKey:WebKitPrivateBrowsingEnabledPreferenceKey]; 580 } 581 582 - (BOOL)privateBrowsingEnabled 583 { 584 return [self _boolValueForKey:WebKitPrivateBrowsingEnabledPreferenceKey]; 585 } 586 587 @end 588 589 @implementation WebPreferences (WebPrivate) 580 590 581 591 - (BOOL)respectStandardStyleKeyEquivalents -
trunk/WebKit/WebView/WebPreferencesPrivate.h
r12926 r12930 63 63 64 64 // Other private methods 65 - (BOOL)_boolValueForKey:(NSString *)key;66 - (void)_setBoolValue:(BOOL)value forKey:(NSString *)key;67 - (int)_integerValueForKey:(NSString *)key;68 - (void)_setIntegerValue:(int)value forKey:(NSString *)key;69 - (float)_floatValueForKey:(NSString *)key;70 - (void)_setFloatValue:(float)value forKey:(NSString *)key;71 72 65 - (size_t)_pageCacheSize; 73 66 - (size_t)_objectCacheSize;
Note: See TracChangeset
for help on using the changeset viewer.