2008-11-03 Pierre-Olivier Latour <pol@apple.com>
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Nov 2008 02:32:44 +0000 (02:32 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Nov 2008 02:32:44 +0000 (02:32 +0000)
        Reviewed by Dan Bernstein.

        Fixed the override of the "AppleScrollBarVariant" system setting to also work with HIToolbox.

        https://bugs.webkit.org/show_bug.cgi?id=22054

        * DumpRenderTree/mac/DumpRenderTree.mm:
        (setDefaultsToConsistentValuesForTesting):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@38082 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm

index 705abfd..683724c 100644 (file)
@@ -1,3 +1,14 @@
+2008-11-03  Pierre-Olivier Latour  <pol@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Fixed the override of the "AppleScrollBarVariant" system setting to also work with HIToolbox.
+
+        https://bugs.webkit.org/show_bug.cgi?id=22054
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (setDefaultsToConsistentValuesForTesting):
+
 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
 
         Not reviewed.
index c7e4e16..203c6b2 100644 (file)
@@ -47,6 +47,7 @@
 #import "UIDelegate.h"
 #import "WorkQueue.h"
 #import "WorkQueueItem.h"
+#import <Carbon/Carbon.h>
 #import <CoreFoundation/CoreFoundation.h>
 #import <WebKit/DOMElementPrivate.h>
 #import <WebKit/DOMExtensions.h>
@@ -310,7 +311,6 @@ static void setDefaultsToConsistentValuesForTesting()
     static const int BlueTintedAppearance = 1;
 
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    [defaults setObject:@"DoubleMax" forKey:@"AppleScrollBarVariant"];
     [defaults setInteger:4 forKey:@"AppleAntiAliasingThreshold"]; // smallest font size to CG should perform antialiasing on
     [defaults setInteger:NoFontSmoothing forKey:@"AppleFontSmoothing"];
     [defaults setInteger:BlueTintedAppearance forKey:@"AppleAquaColorVariant"];
@@ -318,6 +318,15 @@ static void setDefaultsToConsistentValuesForTesting()
     [defaults setObject:@"0.500000 0.500000 0.500000" forKey:@"AppleOtherHighlightColor"];
     [defaults setObject:[NSArray arrayWithObject:@"en"] forKey:@"AppleLanguages"];
 
+    // Scrollbars are drawn either using AppKit (which uses NSUserDefaults) or using HIToolbox (which uses CFPreferences / kCFPreferencesAnyApplication / kCFPreferencesCurrentUser / kCFPreferencesAnyHost)
+    [defaults setObject:@"DoubleMax" forKey:@"AppleScrollBarVariant"];
+    RetainPtr<CFTypeRef> initialValue = CFPreferencesCopyValue(CFSTR("AppleScrollBarVariant"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+    CFPreferencesSetValue(CFSTR("AppleScrollBarVariant"), CFSTR("DoubleMax"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+    ThemeScrollBarArrowStyle style;
+    GetThemeScrollBarArrowStyle(&style); // Force HIToolbox to read from CFPreferences
+    if (initialValue)
+        CFPreferencesSetValue(CFSTR("AppleScrollBarVariant"), initialValue.get(), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
     NSString *libraryPath = [@"~/Library/Application Support/DumpRenderTree" stringByExpandingTildeInPath];
     [defaults setObject:[libraryPath stringByAppendingPathComponent:@"Databases"] forKey:WebDatabaseDirectoryDefaultsKey];