void ScrollbarThemeChromiumWin::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect) { bool horz = scrollbar->orientation() == HorizontalScrollbar; // Draw the thumb (the box you drag in the scroll bar to scroll). PlatformSupport::paintScrollbarThumb( gc, horz ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT, getThemeState(scrollbar, ThumbPart), getClassicThemeState(scrollbar, ThumbPart), rect); // Draw the gripper (the three little lines on the thumb). PlatformSupport::paintScrollbarThumb( gc, horz ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT, getThemeState(scrollbar, ThumbPart), getClassicThemeState(scrollbar, ThumbPart), rect); }
void ScrollbarThemeWin::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart partType) { bool horz = scrollbar->orientation() == HorizontalScrollbar; int partId; if (partType == BackTrackPart) partId = horz ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT; else partId = horz ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; IntRect alignRect = trackRect(scrollbar, false); WebKit::WebCanvas* canvas = gc->canvas(); // Draw the track area before/after the thumb on the scroll bar. WebKit::Platform::current()->themeEngine()->paintScrollbarTrack(canvas, partId, getThemeState(scrollbar, partType), getClassicThemeState(scrollbar, partType), WebKit::WebRect(rect), WebKit::WebRect(alignRect)); }
void ScrollbarThemeChromiumWin::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart partType) { bool horz = scrollbar->orientation() == HorizontalScrollbar; int partId; if (partType == BackTrackPart) partId = horz ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT; else partId = horz ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; IntRect alignRect = trackRect(scrollbar, false); // Draw the track area before/after the thumb on the scroll bar. PlatformSupport::paintScrollbarTrack( gc, partId, getThemeState(scrollbar, partType), getClassicThemeState(scrollbar, partType), rect, alignRect); }
void ScrollbarThemeChromiumWin::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect) { bool horz = scrollbar->orientation() == HorizontalScrollbar; WebKit::WebCanvas* canvas = gc->platformContext()->canvas(); // Draw the thumb (the box you drag in the scroll bar to scroll). WebKit::Platform::current()->themeEngine()->paintScrollbarThumb(canvas, horz ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT, getThemeState(scrollbar, ThumbPart), getClassicThemeState(scrollbar, ThumbPart), WebKit::WebRect(rect)); // Draw the gripper (the three little lines on the thumb). WebKit::Platform::current()->themeEngine()->paintScrollbarThumb(canvas, horz ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT, getThemeState(scrollbar, ThumbPart), getClassicThemeState(scrollbar, ThumbPart), WebKit::WebRect(rect)); }
// paint in the coordinate space of our parent's content area void PlatformScrollbar::paint(GraphicsContext* gc, const IntRect& damageRect) { #if PLATFORM(WIN_OS) if (gc->paintingDisabled()) return; // Don't paint anything if the scrollbar doesn't intersect the damage rect. if (!frameGeometry().intersects(damageRect)) return; gc->save(); gc->translate(x(), y()); layout(); HDC hdc = gc->platformContext()->canvas()->beginPlatformPaint(); const bool horz = orientation() == HorizontalScrollbar; const PlatformContextSkia* const skia = gc->platformContext(); const gfx::NativeTheme* const nativeTheme = skia->nativeTheme(); gfx::PlatformCanvasWin* const canvas = skia->canvas(); // Draw the up/left arrow of the scroll bar. RECT rect = gfx::SkIRectToRECT(m_segmentRects[Arrow1]); nativeTheme->PaintScrollbarArrow(hdc, getThemeArrowState(Arrow1), (horz ? DFCS_SCROLLLEFT : DFCS_SCROLLUP) | getClassicThemeState(Arrow1), &rect); if (m_segmentRects[Track].x() != -1) { // The scroll bar is too small to draw the thumb. Just draw a // single track between the arrows. rect = gfx::SkIRectToRECT(m_segmentRects[Track]); nativeTheme->PaintScrollbarTrack(hdc, horz ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT, getThemeState(Track), getClassicThemeState(Track), &rect, &rect, canvas); DrawTickmarks(gc); } else { // Draw the track area before the thumb on the scroll bar. rect = gfx::SkIRectToRECT(m_segmentRects[BeforeThumb]); nativeTheme->PaintScrollbarTrack(hdc, horz ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT, getThemeState(BeforeThumb), getClassicThemeState(BeforeThumb), &rect, &rect, canvas); // Draw the track area after the thumb on the scroll bar. rect = gfx::SkIRectToRECT(m_segmentRects[BeforeThumb]); RECT rect_after = gfx::SkIRectToRECT(m_segmentRects[AfterThumb]); nativeTheme->PaintScrollbarTrack(hdc, horz ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT, getThemeState(AfterThumb), getClassicThemeState(AfterThumb), &rect_after, &rect, canvas); // Draw the tick-marks on the scroll bar, if any tick-marks // exist. Note: The thumb will be drawn on top of the tick-marks, // which is desired. DrawTickmarks(gc); // Draw the thumb (the box you drag in the scroll bar to scroll). rect = gfx::SkIRectToRECT(m_segmentRects[Thumb]); nativeTheme->PaintScrollbarThumb(hdc, horz ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT, getThemeState(Thumb), getClassicThemeState(Thumb), &rect); // Draw the gripper (the three little lines on the thumb). rect = gfx::SkIRectToRECT(m_segmentRects[Thumb]); nativeTheme->PaintScrollbarThumb(hdc, horz ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT, getThemeState(Thumb), getClassicThemeState(Thumb), &rect); } // Draw the down/right arrow of the scroll bar. rect = gfx::SkIRectToRECT(m_segmentRects[Arrow2]); nativeTheme->PaintScrollbarArrow(hdc, getThemeArrowState(Arrow2), (horz ? DFCS_SCROLLRIGHT : DFCS_SCROLLDOWN) | getClassicThemeState(Arrow2), &rect); gc->platformContext()->canvas()->endPlatformPaint(); gc->restore(); #endif }