Changeset 29728 in webkit


Ignore:
Timestamp:
Jan 22, 2008 8:01:09 PM (16 years ago)
Author:
mitz@apple.com
Message:

Reviewed by Adele Peterson.

The regression test for this is fast/css/css2-system-color.html which
is currently disabled.

  • rendering/RenderThemeMac.mm: (WebCore::menuBackgroundColor): Added. Uses HIThemeDrawMenuBackground to draw the menu item background into a bitmap graphics context and returns the color of the pixel at (0, 0). (WebCore::RenderThemeMac::systemColor): Changed to call menuBackgroundColor for the CSS2 menu color.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r29727 r29728  
     12008-01-22  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Adele Peterson.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=16905
     6          <rdar://problem/5692407> REGRESSION (3.0.4-TOT): "menu" pseudocolor is badly chosen
     7
     8        The regression test for this is fast/css/css2-system-color.html which
     9        is currently disabled.
     10
     11        * rendering/RenderThemeMac.mm:
     12        (WebCore::menuBackgroundColor): Added. Uses HIThemeDrawMenuBackground
     13        to draw the menu item background into a bitmap graphics context and
     14        returns the color of the pixel at (0, 0).
     15        (WebCore::RenderThemeMac::systemColor): Changed to call
     16        menuBackgroundColor for the CSS2 menu color.
     17
    1182008-01-22  Darin Adler  <darin@apple.com>
    219
  • trunk/WebCore/rendering/RenderThemeMac.mm

    r29510 r29728  
    3838#import "SharedBuffer.h"
    3939#import "WebCoreSystemInterface.h"
     40#import <Carbon/Carbon.h>
    4041#import <Cocoa/Cocoa.h>
    4142#import <wtf/RetainPtr.h>
     
    241242}
    242243
     244static RGBA32 menuBackgroundColor()
     245{
     246    NSBitmapImageRep *offscreenRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
     247                                                                             pixelsWide:1
     248                                                                             pixelsHigh:1
     249                                                                          bitsPerSample:8
     250                                                                        samplesPerPixel:4
     251                                                                               hasAlpha:YES
     252                                                                               isPlanar:NO
     253                                                                         colorSpaceName:NSCalibratedRGBColorSpace
     254                                                                            bytesPerRow:4
     255                                                                           bitsPerPixel:32];
     256
     257    CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext graphicsContextWithBitmapImageRep:offscreenRep] graphicsPort]);
     258    CGRect rect = CGRectMake(0, 0, 1, 1);
     259    HIThemeMenuDrawInfo drawInfo;
     260    drawInfo.version =  0;
     261    drawInfo.menuType = kThemeMenuTypePopUp;
     262    HIThemeDrawMenuBackground(&rect, &drawInfo, context, kHIThemeOrientationInverted);
     263
     264    NSUInteger pixel[4];
     265    [offscreenRep getPixel:pixel atX:0 y:0];
     266
     267    [offscreenRep release];
     268
     269    return makeRGB(pixel[0], pixel[1], pixel[2]);
     270}
     271
    243272void RenderThemeMac::platformColorsDidChange()
    244273{
     
    309338            break;
    310339        case CSS_VAL_MENU:
    311             color = convertNSColorToColor([NSColor selectedMenuItemColor]);
     340            color = menuBackgroundColor();
    312341            break;
    313342        case CSS_VAL_MENUTEXT:
Note: See TracChangeset for help on using the changeset viewer.