void ScrollbarThemeOverlay::paintThumb(GraphicsContext& context, const ScrollbarThemeClient& scrollbar, const IntRect& rect) { if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayItem::ScrollbarThumb)) return; DrawingRecorder recorder(context, scrollbar, DisplayItem::ScrollbarThumb, rect); IntRect thumbRect = rect; if (scrollbar.orientation() == HorizontalScrollbar) { thumbRect.setHeight(thumbRect.height() - m_scrollbarMargin); } else { thumbRect.setWidth(thumbRect.width() - m_scrollbarMargin); if (scrollbar.isLeftSideVerticalScrollbar()) thumbRect.setX(thumbRect.x() + m_scrollbarMargin); } if (m_useSolidColor) { context.fillRect(thumbRect, m_color); return; } WebThemeEngine::State state = WebThemeEngine::StateNormal; if (scrollbar.pressedPart() == ThumbPart) state = WebThemeEngine::StatePressed; else if (scrollbar.hoveredPart() == ThumbPart) state = WebThemeEngine::StateHover; WebCanvas* canvas = context.canvas(); WebThemeEngine::Part part = WebThemeEngine::PartScrollbarHorizontalThumb; if (scrollbar.orientation() == VerticalScrollbar) part = WebThemeEngine::PartScrollbarVerticalThumb; Platform::current()->themeEngine()->paint(canvas, part, state, WebRect(rect), 0); }
void ScrollbarThemeAura::paintThumb(GraphicsContext& gc, const ScrollbarThemeClient& scrollbar, const IntRect& rect) { if (DrawingRecorder::useCachedDrawingIfPossible(gc, scrollbar, DisplayItem::ScrollbarThumb)) return; DrawingRecorder recorder(gc, scrollbar, DisplayItem::ScrollbarThumb, rect); WebThemeEngine::State state; WebCanvas* canvas = gc.canvas(); if (scrollbar.pressedPart() == ThumbPart) state = WebThemeEngine::StatePressed; else if (scrollbar.hoveredPart() == ThumbPart) state = WebThemeEngine::StateHover; else state = WebThemeEngine::StateNormal; Platform::current()->themeEngine()->paint(canvas, scrollbar.orientation() == HorizontalScrollbar ? WebThemeEngine::PartScrollbarHorizontalThumb : WebThemeEngine::PartScrollbarVerticalThumb, state, WebRect(rect), 0); }