Changeset 30687 in webkit


Ignore:
Timestamp:
Feb 29, 2008 4:29:22 PM (16 years ago)
Author:
pewtermoose@webkit.org
Message:

2008-02-29 Brent Fulgham <bfulgham@gmail.com>
JavaScriptCore:

http://bugs.webkit.org/show_bug.cgi?id=17483
Implement scrollbars on Windows (Cairo)

Reviewed by Adam Roben.

  • wtf/Platform.h:

WebCore:

http://bugs.webkit.org/show_bug.cgi?id=17483
Implement scrollbars on Windows (Cairo)

Reviewed by Adam Roben.

  • platform/win/PlatfromScrollBarWin.cpp: Duplicate implementation from PlatformScrollBarWinSafari.cpp, then modify to use the native Windows theme engine. Use SOFT_LINK. Use platform 'GetSystemMetrics' call to decide size of scrollbars and buttons.
Location:
trunk
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r30679 r30687  
     12008-02-29  Brent Fulgham  <bfulgham@gmail.com>
     2
     3        http://bugs.webkit.org/show_bug.cgi?id=17483
     4        Implement scrollbars on Windows (Cairo)
     5
     6        Reviewed by Adam Roben.
     7
     8        * wtf/Platform.h:
     9
    1102008-02-29  Adam Roben  <aroben@apple.com>
    211
  • trunk/JavaScriptCore/wtf/Platform.h

    r29663 r30687  
    113113#endif
    114114
     115#if PLATFORM(WIN)&& PLATFORM(CG)
     116#define WTF_USE_SAFARI_THEME 1
     117#endif
    115118
    116119#ifdef __S60__
  • trunk/WebCore/ChangeLog

    r30680 r30687  
     12008-02-29  Brent Fulgham  <bfulgham@gmail.com>
     2
     3        http://bugs.webkit.org/show_bug.cgi?id=17483
     4        Implement scrollbars on Windows (Cairo)
     5
     6        Reviewed by Adam Roben.
     7
     8        * platform/win/PlatfromScrollBarWin.cpp: Duplicate implementation
     9          from PlatformScrollBarWinSafari.cpp, then modify to use the
     10          native Windows theme engine.  Use SOFT_LINK.  Use platform
     11          'GetSystemMetrics' call to decide size of scrollbars and buttons.
     12
    1132008-02-29  Adam Roben  <aroben@apple.com>
    214
  • trunk/WebCore/platform/win/PlatformScrollBarWin.cpp

    r30685 r30687  
    11/*
    22 * Copyright (C) 2007 Apple Inc.  All rights reserved.
     3 * Copyright (C) 2008 Brent Fulgham
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2627#include "config.h"
    2728
    28 #ifdef USE_SAFARI_THEME
    29 
    3029#include "PlatformScrollBar.h"
    3130
     
    3837#include "SoftLinking.h"
    3938
    40 #include <CoreGraphics/CoreGraphics.h>
    41 #include <SafariTheme/SafariTheme.h>
    42 
    43 // FIXME: There are repainting problems due to Aqua scroll bar buttons' visual overflow.
     39#include <windows.h>
     40#include "RenderThemeWin.h"
     41
     42// Generic state constants
     43#define TS_NORMAL    1
     44#define TS_HOVER     2
     45#define TS_ACTIVE    3
     46#define TS_DISABLED  4
     47#define TS_FOCUSED   5
     48
     49#define ABS_UPNORMAL 1
     50#define ABS_DOWNNORMAL 5
     51#define ABS_LEFTNORMAL 9
     52#define ABS_RIGHTNORMAL 13
     53
     54static const unsigned SP_ABS_HOT_MODIFIER = 1;
     55static const unsigned SP_ABS_PRESSED_MODIFIER = 2;
     56static const unsigned SP_ABS_DISABLE_MODIFIER = 3;
     57
     58// Scrollbar constants
     59#define SP_BUTTON 1
     60#define SP_THUMBHOR 2
     61#define SP_THUMBVERT 3
     62#define SP_TRACKSTARTHOR 4
     63#define SP_TRACKENDHOR 5
     64#define SP_TRACKSTARTVERT 6
     65#define SP_TRACKENDVERT 7
     66#define SP_GRIPPERHOR 8
     67#define SP_GRIPPERVERT 9
    4468
    4569using namespace std;
     
    4771namespace WebCore {
    4872
    49 using namespace SafariTheme;
    50 
    5173// FIXME: We should get these numbers from SafariTheme
    52 static int cHorizontalWidth[] = { 15, 11 };
    53 static int cHorizontalHeight[] = { 15, 11 };
    54 static int cVerticalWidth[] = { 15, 11 };
    55 static int cVerticalHeight[] = { 15, 11 };
    56 static int cRealButtonLength[] = { 28, 21 };
    57 static int cButtonInset[] = { 14, 11 };
    58 static int cButtonHitInset[] = { 3, 2 };
     74static int cHorizontalWidth;
     75static int cHorizontalHeight;
     76static int cVerticalWidth;
     77static int cVerticalHeight;
     78static int cHorizontalButtonWidth;
     79static int cVerticalButtonHeight;
     80static int cRealButtonLength = 28;
     81static int cButtonInset = 14;
     82static int cButtonHitInset = 3;
    5983// cRealButtonLength - cButtonInset
    60 static int cButtonLength[] = { 14, 10 };
    61 static int cThumbWidth[] = { 15, 11 };
    62 static int cThumbHeight[] = { 15, 11 };
    63 static int cThumbMinLength[] = { 26, 20 };
    64 
    65 #if !defined(NDEBUG) && defined(USE_DEBUG_SAFARI_THEME)
    66 SOFT_LINK_DEBUG_LIBRARY(SafariTheme)
    67 #else
    68 SOFT_LINK_LIBRARY(SafariTheme)
    69 #endif
    70 
    71 SOFT_LINK(SafariTheme, paintThemePart, void, __stdcall, (ThemePart part, CGContextRef context, const CGRect& rect, NSControlSize size, ThemeControlState state), (part, context, rect, size, state))
     84static int cThumbWidth;
     85static int cThumbHeight;
     86static int cThumbMinLength = 26;
     87
     88static HANDLE cScrollBarTheme = 0;
     89
     90// FIXME:  Refactor the soft-linking code so that it can be shared with RenderThemeWin
     91SOFT_LINK_LIBRARY(uxtheme)
     92SOFT_LINK(uxtheme, OpenThemeData, HANDLE, WINAPI, (HWND hwnd, LPCWSTR pszClassList), (hwnd, pszClassList))
     93SOFT_LINK(uxtheme, CloseThemeData, HRESULT, WINAPI, (HANDLE hTheme), (hTheme))
     94SOFT_LINK(uxtheme, DrawThemeBackground, HRESULT, WINAPI, (HANDLE hTheme, HDC hdc, int iPartId, int iStateId, const RECT* pRect, const RECT* pClipRect), (hTheme, hdc, iPartId, iStateId, pRect, pClipRect))
     95SOFT_LINK(uxtheme, DrawThemeEdge, HRESULT, WINAPI, (HANDLE hTheme, HDC hdc, int iPartId, int iStateId, const RECT* pRect, unsigned uEdge, unsigned uFlags, const RECT* pClipRect), (hTheme, hdc, iPartId, iStateId, pRect, uEdge, uFlags, pClipRect))
     96SOFT_LINK(uxtheme, GetThemeContentRect, HRESULT, WINAPI, (HANDLE hTheme, HDC hdc, int iPartId, int iStateId, const RECT* pRect, const RECT* pContentRect), (hTheme, hdc, iPartId, iStateId, pRect, pContentRect))
     97SOFT_LINK(uxtheme, GetThemePartSize, HRESULT, WINAPI, (HANDLE hTheme, HDC hdc, int iPartId, int iStateId, RECT* pRect, int ts, SIZE* psz), (hTheme, hdc, iPartId, iStateId, pRect, ts, psz))
     98SOFT_LINK(uxtheme, GetThemeSysFont, HRESULT, WINAPI, (HANDLE hTheme, int iFontId, OUT LOGFONT* pFont), (hTheme, iFontId, pFont))
     99SOFT_LINK(uxtheme, GetThemeColor, HRESULT, WINAPI, (HANDLE hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, OUT COLORREF* pColor), (hTheme, hdc, iPartId, iStateId, iPropId, pColor))
     100
     101static void checkAndInitScrollbarTheme()
     102{
     103    if (uxthemeLibrary() && !cScrollBarTheme)
     104        cScrollBarTheme = OpenThemeData(0, L"Scrollbar");
     105}
     106
     107// May need to add stuff to these later, so keep the graphics context retrieval/release in some helpers.
     108static HDC prepareForDrawing(GraphicsContext* g, const IntRect& r)
     109{
     110    return g->getWindowsContext(r);
     111}
     112 
     113static void doneDrawing(GraphicsContext* g, HDC hdc, const IntRect& r)
     114{
     115    g->releaseWindowsContext(hdc, r);
     116}
     117// End Copied from RenderThemeWin
    72118
    73119const double cInitialTimerDelay = 0.25;
     
    75121
    76122PlatformScrollbar::PlatformScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size)
    77     : Scrollbar(client, orientation, size), m_hoveredPart(NoPart), m_pressedPart(NoPart), m_pressedPos(0),
    78       m_scrollTimer(this, &PlatformScrollbar::autoscrollTimerFired),
    79       m_overlapsResizer(false)
     123    : Scrollbar(client, orientation, size)
     124    , m_hoveredPart(NoPart)
     125    , m_pressedPart(NoPart)
     126    , m_pressedPos(0)
     127    , m_scrollTimer(this, &PlatformScrollbar::autoscrollTimerFired)
     128    , m_overlapsResizer(false)
    80129{
    81130    // Obtain the correct scrollbar sizes from the system.
    82     if (!cHorizontalWidth) {
    83         // FIXME: Get metics from SafariTheme
     131    // FIXME:  We should update these on a WM_SETTINGSCHANGE, too.
     132    if (!cHorizontalHeight) {
     133       cHorizontalHeight = ::GetSystemMetrics(SM_CYHSCROLL);
     134       cHorizontalWidth = ::GetSystemMetrics(SM_CXHSCROLL);
     135       cVerticalHeight = ::GetSystemMetrics(SM_CYVSCROLL);
     136       cVerticalWidth = ::GetSystemMetrics(SM_CXVSCROLL);
     137       cThumbWidth = ::GetSystemMetrics(SM_CXHTHUMB);
     138       cThumbHeight = ::GetSystemMetrics(SM_CYVTHUMB);
     139       cHorizontalButtonWidth = ::GetSystemMetrics(SM_CYVSCROLL);
     140       cVerticalButtonHeight = ::GetSystemMetrics(SM_CXHSCROLL);
    84141    }
    85142
    86143    if (orientation == VerticalScrollbar)
    87         setFrameGeometry(IntRect(0, 0, cVerticalWidth[controlSize()], cVerticalHeight[controlSize()]));
     144        setFrameGeometry(IntRect(0, 0, cVerticalWidth, cVerticalHeight));
    88145    else
    89         setFrameGeometry(IntRect(0, 0, cHorizontalWidth[controlSize()], cHorizontalHeight[controlSize()]));
     146        setFrameGeometry(IntRect(0, 0, cHorizontalWidth, cHorizontalHeight));
    90147}
    91148
     
    107164static IntRect trackRepaintRect(const IntRect& trackRect, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
    108165{
     166    const int cButtonLength = (orientation == VerticalScrollbar) ? cVerticalButtonHeight : cHorizontalButtonWidth;
     167
    109168    IntRect paintRect(trackRect);
    110169    if (orientation == HorizontalScrollbar)
    111         paintRect.inflateX(cButtonLength[controlSize]);
     170        paintRect.inflateX(cButtonLength);
    112171    else
    113         paintRect.inflateY(cButtonLength[controlSize]);
     172        paintRect.inflateY(cButtonLength);
    114173
    115174    return paintRect;
     
    120179    IntRect paintRect(buttonRect);
    121180    if (orientation == HorizontalScrollbar) {
    122         paintRect.setWidth(cRealButtonLength[controlSize]);
     181        paintRect.setWidth(cRealButtonLength);
    123182        if (!start)
    124             paintRect.setX(buttonRect.x() - (cRealButtonLength[controlSize] - buttonRect.width()));
     183            paintRect.setX(buttonRect.x() - (cRealButtonLength - buttonRect.width()));
    125184    } else {
    126         paintRect.setHeight(cRealButtonLength[controlSize]);
     185        paintRect.setHeight(cRealButtonLength);
    127186        if (!start)
    128             paintRect.setY(buttonRect.y() - (cRealButtonLength[controlSize] - buttonRect.height()));
     187            paintRect.setY(buttonRect.y() - (cRealButtonLength - buttonRect.height()));
    129188    }
    130189
     
    258317bool PlatformScrollbar::hasButtons() const
    259318{
    260     return isEnabled() && (m_orientation == HorizontalScrollbar ? width() : height()) >= 2 * (cRealButtonLength[controlSize()] - cButtonHitInset[controlSize()]);
     319    return isEnabled() && (m_orientation == HorizontalScrollbar ? width() : height()) >= 2 * (cRealButtonLength - cButtonHitInset);
    261320}
    262321
    263322bool PlatformScrollbar::hasThumb() const
    264323{
    265     return isEnabled() && (m_orientation == HorizontalScrollbar ? width() : height()) >= 2 * cButtonInset[controlSize()] + cThumbMinLength[controlSize()] + 1;
     324    return isEnabled() && (m_orientation == HorizontalScrollbar ? width() : height()) >= 2 * cButtonInset + cThumbMinLength + 1;
    266325}
    267326
    268327IntRect PlatformScrollbar::backButtonRect() const
     328{
     329    // Our actual rect will shrink to half the available space when
     330    // we have < 34 pixels left.  This allows the scrollbar
     331    // to scale down and function even at tiny sizes.
     332    if (m_orientation == HorizontalScrollbar)
     333        return IntRect(x(), y(), cHorizontalButtonWidth, cHorizontalHeight);
     334    return IntRect(x(), y(), cVerticalWidth, cVerticalButtonHeight);
     335}
     336
     337IntRect PlatformScrollbar::forwardButtonRect() const
    269338{
    270339    // Our desired rect is essentially 17x17.
     
    274343    // to scale down and function even at tiny sizes.
    275344    if (m_orientation == HorizontalScrollbar)
    276         return IntRect(x(), y(), cButtonLength[controlSize()], cHorizontalHeight[controlSize()]);
    277     return IntRect(x(), y(), cVerticalWidth[controlSize()], cButtonLength[controlSize()]);
    278 }
    279 
    280 IntRect PlatformScrollbar::forwardButtonRect() const
    281 {
    282     // Our desired rect is essentially 17x17.
    283    
    284     // Our actual rect will shrink to half the available space when
    285     // we have < 34 pixels left.  This allows the scrollbar
    286     // to scale down and function even at tiny sizes.
    287 
    288     if (m_orientation == HorizontalScrollbar)
    289         return IntRect(x() + width() - cButtonLength[controlSize()], y(), cButtonLength[controlSize()], cHorizontalHeight[controlSize()]);
    290     return IntRect(x(), y() + height() - cButtonLength[controlSize()], cVerticalWidth[controlSize()], cButtonLength[controlSize()]);
     345        return IntRect(x() + width() - cHorizontalButtonWidth, y(), cHorizontalButtonWidth, cHorizontalHeight);
     346    return IntRect(x(), y() + height() - cVerticalButtonHeight, cVerticalWidth, cVerticalButtonHeight);
    291347}
    292348
     
    295351    if (m_orientation == HorizontalScrollbar) {
    296352        if (!hasButtons())
    297             return IntRect(x(), y(), width(), cHorizontalHeight[controlSize()]);
    298         return IntRect(x() + cButtonLength[controlSize()], y(), width() - 2 * cButtonLength[controlSize()], cHorizontalHeight[controlSize()]);
     353            return IntRect(x(), y(), width(), cHorizontalHeight);
     354        return IntRect(x() + cHorizontalButtonWidth, y(), width() - 2 * cHorizontalButtonWidth, cHorizontalHeight);
    299355    }
    300356
    301357    if (!hasButtons())
    302         return IntRect(x(), y(), cVerticalWidth[controlSize()], height());
    303     return IntRect(x(), y() + cButtonLength[controlSize()], cVerticalWidth[controlSize()], height() - 2 * cButtonLength[controlSize()]);
     358        return IntRect(x(), y(), cVerticalWidth, height());
     359    return IntRect(x(), y() + cVerticalButtonHeight, cVerticalWidth, height() - 2 * cVerticalButtonHeight);
    304360}
    305361
     
    309365    splitTrack(trackRect(), beforeThumbRect, thumbRect, afterThumbRect);
    310366    return thumbRect;
     367}
     368
     369IntRect PlatformScrollbar::gripperRect(const IntRect& thumbRect) const
     370{
     371    return IntRect();
    311372}
    312373
     
    317378    int thumbPos = thumbPosition();
    318379    if (m_orientation == HorizontalScrollbar) {
    319         thumbRect = IntRect(trackRect.x() + thumbPos, trackRect.y() + (trackRect.height() - cThumbHeight[controlSize()]) / 2, thumbLength(), cThumbHeight[controlSize()]);
     380        thumbRect = IntRect(trackRect.x() + thumbPos, trackRect.y() + (trackRect.height() - cThumbHeight) / 2, thumbLength(), cThumbHeight);
    320381        beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), thumbPos, trackRect.height());
    321382        afterThumbRect = IntRect(thumbRect.x() + thumbRect.width(), trackRect.y(), trackRect.right() - thumbRect.right(), trackRect.height());
    322383    } else {
    323         thumbRect = IntRect(trackRect.x() + (trackRect.width() - cThumbWidth[controlSize()]) / 2, trackRect.y() + thumbPos, cThumbWidth[controlSize()], thumbLength());
     384        thumbRect = IntRect(trackRect.x() + (trackRect.width() - cThumbWidth) / 2, trackRect.y() + thumbPos, cThumbWidth, thumbLength());
    324385        beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), trackRect.width(), thumbPos);
    325386        afterThumbRect = IntRect(trackRect.x(), thumbRect.y() + thumbRect.height(), trackRect.width(), trackRect.bottom() - thumbRect.bottom());
     
    342403    int trackLen = trackLength();
    343404    int length = proportion * trackLen;
    344     int minLength = cThumbMinLength[controlSize()];
     405    int minLength = cThumbMinLength;
    345406    length = max(length, minLength);
    346407    if (length > trackLen)
     
    356417void PlatformScrollbar::paintButton(GraphicsContext* context, const IntRect& rect, bool start, const IntRect& damageRect) const
    357418{
    358     if (!SafariThemeLibrary())
    359         return;
    360 
    361419    IntRect paintRect = buttonRepaintRect(rect, m_orientation, controlSize(), start);
    362420   
     
    364422        return;
    365423
    366     ThemePart part;
    367     ThemeControlState state = 0;
    368     if (m_client->isActive())
    369         state |= ActiveState;
    370     if (m_orientation == HorizontalScrollbar)
    371         part = start ? ScrollLeftArrowPart : ScrollRightArrowPart;
     424    unsigned part = 0;
     425    unsigned state = 0;
     426    unsigned classicPart = 0;
     427    unsigned classicState = 0;
     428
     429    if (m_orientation == HorizontalScrollbar) {
     430       state = start ? ABS_LEFTNORMAL : ABS_RIGHTNORMAL;
     431       classicPart = start ? DFCS_SCROLLLEFT : DFCS_SCROLLRIGHT;
     432    } else {
     433       state = start ? ABS_UPNORMAL : ABS_DOWNNORMAL;
     434       classicPart = start ? DFCS_SCROLLUP : DFCS_SCROLLDOWN;
     435    }
     436
     437    if (!isEnabled()) {
     438        state += SP_ABS_DISABLE_MODIFIER;
     439        classicState |= DFCS_INACTIVE;
     440    } else if ((m_pressedPart == BackButtonPart && start)
     441            || (m_pressedPart == ForwardButtonPart && !start)) {
     442        state += SP_ABS_PRESSED_MODIFIER;
     443        classicState |= DFCS_PUSHED | DFCS_FLAT;
     444    } else if (m_client->isActive()) {
     445       state += SP_ABS_HOT_MODIFIER;
     446       classicState |= DFCS_HOT;
     447    }
     448
     449    HDC hdc = prepareForDrawing(context, rect);
     450    RECT widgetRect = rect;
     451    checkAndInitScrollbarTheme();
     452
     453    if (cScrollBarTheme)
     454        DrawThemeBackground(cScrollBarTheme, hdc, SP_BUTTON, state, &widgetRect, NULL);
    372455    else
    373         part = start ? ScrollUpArrowPart : ScrollDownArrowPart;
    374 
    375     if (isEnabled())
    376         state |= EnabledState;
    377     if ((m_pressedPart == BackButtonPart && start)
    378         || (m_pressedPart == ForwardButtonPart && !start))
    379         state |= PressedState;
    380 
    381     paintThemePart(part, context->platformContext(), paintRect, controlSize() == SmallScrollbar ? NSSmallControlSize : NSRegularControlSize, state);
     456        DrawFrameControl(hdc, &widgetRect, classicPart, classicState);
     457
     458    doneDrawing(context, hdc, rect);
    382459}
    383460
    384461void PlatformScrollbar::paintTrack(GraphicsContext* context, const IntRect& rect, bool start, const IntRect& damageRect) const
    385462{
    386     if (!SafariThemeLibrary())
    387         return;
    388 
    389463    IntRect paintRect = hasButtons() ? trackRepaintRect(rect, m_orientation, controlSize()) : rect;
    390464   
     
    392466        return;
    393467
    394     ThemePart part = m_orientation == HorizontalScrollbar ? HScrollTrackPart : VScrollTrackPart;
    395     ThemeControlState state = 0;
     468    unsigned part = 0;
     469    unsigned classicPart = DFC_SCROLL;
     470    if (m_orientation == HorizontalScrollbar)
     471       part = start ? SP_TRACKSTARTHOR : SP_TRACKENDHOR;
     472    else
     473       part = start ? SP_TRACKSTARTVERT : SP_TRACKENDVERT;
     474
     475    unsigned state = TS_DISABLED;
     476    unsigned classicState = DFCS_MONO;
    396477    if (m_client->isActive())
    397         state |= ActiveState;
     478        state |= TS_ACTIVE;
     479    else
     480       classicState |= DFCS_INACTIVE;
     481
    398482    if (hasButtons())
    399         state |= EnabledState;
    400 
    401     paintThemePart(part, context->platformContext(), paintRect, controlSize() == SmallScrollbar ? NSSmallControlSize : NSRegularControlSize, state);
     483        state |= TS_NORMAL;
     484
     485    HDC hdc = prepareForDrawing(context, rect);
     486    RECT widgetRect = rect;
     487    checkAndInitScrollbarTheme();
     488
     489    if (cScrollBarTheme)
     490        DrawThemeBackground(cScrollBarTheme, hdc, part, state, &widgetRect, NULL);
     491    else
     492        DrawFrameControl(hdc, &widgetRect, DFC_SCROLL, classicState);
     493
     494    doneDrawing(context, hdc, rect);
    402495}
    403496
    404497void PlatformScrollbar::paintThumb(GraphicsContext* context, const IntRect& rect, const IntRect& damageRect) const
    405498{
    406     if (!SafariThemeLibrary())
    407         return;
    408 
    409499    if (!damageRect.intersects(rect))
    410500        return;
    411501
    412     ThemePart part = m_orientation == HorizontalScrollbar ? HScrollThumbPart : VScrollThumbPart;
    413     ThemeControlState state = 0;
     502    unsigned part = (m_orientation == HorizontalScrollbar) ? SP_THUMBHOR : SP_THUMBVERT;
     503    unsigned state = 0;
     504
     505    if (!isEnabled())
     506        state += SP_ABS_DISABLE_MODIFIER;
     507    else if (m_client->isActive())
     508       state += SP_ABS_HOT_MODIFIER;
     509
     510    HDC hdc = prepareForDrawing(context, rect);
     511    RECT widgetRect = rect;
     512    checkAndInitScrollbarTheme();
     513
     514    if (cScrollBarTheme) {
     515        DrawThemeBackground(cScrollBarTheme, hdc, part, state, &widgetRect, NULL);
     516        paintGripper(hdc, widgetRect);
     517    } else {
     518        HGDIOBJ hSaveBrush = SelectObject(hdc, GetSysColorBrush(COLOR_BTNFACE));
     519        DrawEdge(hdc, &widgetRect, EDGE_RAISED, BF_RECT);
     520        SelectObject(hdc,hSaveBrush);
     521    }
     522
     523    doneDrawing(context, hdc, rect);
     524}
     525
     526void PlatformScrollbar::paintGripper(HDC hdc, const IntRect& rect) const
     527{
     528    unsigned part = (m_orientation == HorizontalScrollbar) ? SP_GRIPPERHOR : SP_GRIPPERVERT;
     529    unsigned state = 0;
     530
    414531    if (m_client->isActive())
    415         state |= ActiveState;
    416     if (isEnabled())
    417         state |= EnabledState;
    418 
    419     paintThemePart(part, context->platformContext(), rect, controlSize() == SmallScrollbar ? NSSmallControlSize : NSRegularControlSize, state);
     532        state |= TS_ACTIVE;
     533
     534    RECT widgetRect = rect;
     535    checkAndInitScrollbarTheme();
     536
     537    if (cScrollBarTheme)
     538        DrawThemeBackground(cScrollBarTheme, hdc, part, state, &widgetRect, NULL);
    420539}
    421540
     
    449568        return ForwardTrackPart;
    450569    }
     570
    451571    return NoPart;
    452572}
     
    477597            m_pressedPos += thumbPosition() - thumbPos;
    478598        }
    479        
     599
    480600        return true;
    481601    }
     
    626746int PlatformScrollbar::horizontalScrollbarHeight(ScrollbarControlSize controlSize)
    627747{
    628     return cHorizontalWidth[controlSize];
     748    return cHorizontalWidth;
    629749}
    630750
    631751int PlatformScrollbar::verticalScrollbarWidth(ScrollbarControlSize controlSize)
    632752{
    633     return cVerticalHeight[controlSize];
     753    return cVerticalHeight;
    634754}
    635755
     
    637757{
    638758    IntRect clipRect(0, 0, width(), height());
     759
    639760    clipRect = convertToContainingWindow(clipRect);
    640761    if (m_client)
    641762        clipRect.intersect(m_client->windowClipRect());
     763
    642764    return clipRect;
    643765}
    644766
    645 void PlatformScrollbar::paintGripper(HDC hdc, const IntRect& rect) const
    646 {
    647 }
    648 
    649 IntRect PlatformScrollbar::gripperRect(const IntRect& thumbRect) const
    650 {
    651     return IntRect();
    652 }
    653 
    654767void PlatformScrollbar::themeChanged()
    655768{
     
    658771}
    659772
    660 #endif // defined(USE_SAFARI_THEME)
Note: See TracChangeset for help on using the changeset viewer.