summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/renderer_main_platform_delegate_mac.mm
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 00:43:01 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 00:43:01 +0000
commitd0cf101981b2a8465b7ffc539ed2a4885a08230e (patch)
tree2495cab53bf80e63dd7d3b8ff6422fecca41494d /chrome/renderer/renderer_main_platform_delegate_mac.mm
parent13869ddf1b7851b4e3a92b7f8f25c606ca5a3536 (diff)
downloadchromium_src-d0cf101981b2a8465b7ffc539ed2a4885a08230e.zip
chromium_src-d0cf101981b2a8465b7ffc539ed2a4885a08230e.tar.gz
chromium_src-d0cf101981b2a8465b7ffc539ed2a4885a08230e.tar.bz2
Hook up full-page zoom menu items and fix that zoomed controls don't draw.
BUG=crbug.com/11325 TEST=Open a page with controls, zoom in or out and check that they scale nicely. Also, check that the "mouse down" and "clicked" states appear correctly. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15259 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/renderer_main_platform_delegate_mac.mm')
-rw-r--r--chrome/renderer/renderer_main_platform_delegate_mac.mm37
1 files changed, 36 insertions, 1 deletions
diff --git a/chrome/renderer/renderer_main_platform_delegate_mac.mm b/chrome/renderer/renderer_main_platform_delegate_mac.mm
index 6754ec3..92f7242 100644
--- a/chrome/renderer/renderer_main_platform_delegate_mac.mm
+++ b/chrome/renderer/renderer_main_platform_delegate_mac.mm
@@ -8,6 +8,7 @@
#import <Foundation/Foundation.h>
#import <ApplicationServices/ApplicationServices.h>
+#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
extern "C" {
#include <sandbox.h>
@@ -38,7 +39,8 @@ RendererMainPlatformDelegate::~RendererMainPlatformDelegate() {
void SandboxWarmup() {
base::ScopedNSAutoreleasePool scoped_pool;
- { // CGColorSpaceCreateWithName(), CGBitmapContextCreate() - 10.5.6
+ { // CGColorSpaceCreateWithName(), CGBitmapContextCreate(),
+ // scaled CoreUI controls - 10.5.6
CGColorSpaceRef rgb_colorspace =
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
@@ -48,6 +50,39 @@ void SandboxWarmup() {
rgb_colorspace,
kCGImageAlphaPremultipliedFirst |
kCGBitmapByteOrder32Host);
+
+ // Draw scaled controls - http://crbug.com/11325 . The scaled CoreUI
+ // controls seem to be cached somewhere, so if you change this and
+ // everything still seems to work, it's possible that you broke something
+ // and just didn't notice it yet. See bug for details.
+ CGContextScaleCTM(tmp, 1.1, 1.1); // Anything != 1.0 will do.
+ HIThemeButtonDrawInfo btnInfo = {0};
+ CGRect rect = CGRectMake(0, 0, 1, 1);
+
+ ThemeButtonKind buttonKinds[] = {
+ kThemePushButton,
+ kThemeCheckBox,
+ kThemeRadioButton
+ };
+
+ ThemeDrawState buttonStates[] = {
+ kThemeStateInactive,
+ kThemeStateActive,
+ kThemeStatePressed
+ };
+
+ for (size_t i = 0; i < arraysize(buttonKinds); ++i) {
+ btnInfo.kind = buttonKinds[i];
+ for (size_t j = 0; j < arraysize(buttonKinds); ++j) {
+ btnInfo.state = buttonStates[j];
+ HIThemeDrawButton(&rect,
+ &btnInfo,
+ tmp,
+ kHIThemeOrientationNormal,
+ NULL);
+ }
+ }
+
CGColorSpaceRelease(rgb_colorspace);
CGContextRelease(tmp);
}