| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 updateEnabledState(scrollbar); | 78 updateEnabledState(scrollbar); |
| 79 updateScrollbarOverlayStyle(scrollbar); | 79 updateScrollbarOverlayStyle(scrollbar); |
| 80 } | 80 } |
| 81 | 81 |
| 82 ScrollbarPainter ScrollbarThemeMacOverlayAPI::painterForScrollbar(ScrollbarTheme
Client* scrollbar) | 82 ScrollbarPainter ScrollbarThemeMacOverlayAPI::painterForScrollbar(ScrollbarTheme
Client* scrollbar) |
| 83 { | 83 { |
| 84 return scrollbarPainterMap()->get(scrollbar).get(); | 84 return scrollbarPainterMap()->get(scrollbar).get(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void ScrollbarThemeMacOverlayAPI::paintTrackBackground(GraphicsContext* context,
ScrollbarThemeClient* scrollbar, const IntRect& rect) { | 87 void ScrollbarThemeMacOverlayAPI::paintTrackBackground(GraphicsContext* context,
ScrollbarThemeClient* scrollbar, const IntRect& rect) { |
| 88 ASSERT(isOverlayAPIAvailable()); | 88 ASSERT(isScrollbarOverlayAPIAvailable()); |
| 89 | 89 |
| 90 GraphicsContextStateSaver stateSaver(*context); | 90 GraphicsContextStateSaver stateSaver(*context); |
| 91 context->translate(rect.x(), rect.y()); | 91 context->translate(rect.x(), rect.y()); |
| 92 LocalCurrentGraphicsContext localContext(context); | 92 LocalCurrentGraphicsContext localContext(context); |
| 93 | 93 |
| 94 CGRect frameRect = scrollbar->frameRect(); | 94 CGRect frameRect = scrollbar->frameRect(); |
| 95 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); | 95 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); |
| 96 [scrollbarPainter setEnabled:scrollbar->enabled()]; | 96 [scrollbarPainter setEnabled:scrollbar->enabled()]; |
| 97 [scrollbarPainter setBoundsSize: NSSizeFromCGSize(frameRect.size)]; | 97 [scrollbarPainter setBoundsSize: NSSizeFromCGSize(frameRect.size)]; |
| 98 | 98 |
| 99 NSRect trackRect = NSMakeRect(0, 0, frameRect.size.width, frameRect.size.hei
ght); | 99 NSRect trackRect = NSMakeRect(0, 0, frameRect.size.width, frameRect.size.hei
ght); |
| 100 [scrollbarPainter drawKnobSlotInRect:trackRect highlight:NO]; | 100 [scrollbarPainter drawKnobSlotInRect:trackRect highlight:NO]; |
| 101 } | 101 } |
| 102 | 102 |
| 103 void ScrollbarThemeMacOverlayAPI::paintThumb(GraphicsContext* context, Scrollbar
ThemeClient* scrollbar, const IntRect& rect) { | 103 void ScrollbarThemeMacOverlayAPI::paintThumb(GraphicsContext* context, Scrollbar
ThemeClient* scrollbar, const IntRect& rect) { |
| 104 ASSERT(isOverlayAPIAvailable()); | 104 ASSERT(isScrollbarOverlayAPIAvailable()); |
| 105 | 105 |
| 106 GraphicsContextStateSaver stateSaver(*context); | 106 GraphicsContextStateSaver stateSaver(*context); |
| 107 context->translate(rect.x(), rect.y()); | 107 context->translate(rect.x(), rect.y()); |
| 108 LocalCurrentGraphicsContext localContext(context); | 108 LocalCurrentGraphicsContext localContext(context); |
| 109 | 109 |
| 110 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); | 110 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); |
| 111 [scrollbarPainter setEnabled:scrollbar->enabled()]; | 111 [scrollbarPainter setEnabled:scrollbar->enabled()]; |
| 112 [scrollbarPainter setBoundsSize:NSSizeFromCGSize(rect.size())]; | 112 [scrollbarPainter setBoundsSize:NSSizeFromCGSize(rect.size())]; |
| 113 [scrollbarPainter setDoubleValue:0]; | 113 [scrollbarPainter setDoubleValue:0]; |
| 114 [scrollbarPainter setKnobProportion:1]; | 114 [scrollbarPainter setKnobProportion:1]; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 { | 186 { |
| 187 return [painterForScrollbar(scrollbar) knobMinLength]; | 187 return [painterForScrollbar(scrollbar) knobMinLength]; |
| 188 } | 188 } |
| 189 | 189 |
| 190 void ScrollbarThemeMacOverlayAPI::updateEnabledState(ScrollbarThemeClient* scrol
lbar) | 190 void ScrollbarThemeMacOverlayAPI::updateEnabledState(ScrollbarThemeClient* scrol
lbar) |
| 191 { | 191 { |
| 192 [painterForScrollbar(scrollbar) setEnabled:scrollbar->enabled()]; | 192 [painterForScrollbar(scrollbar) setEnabled:scrollbar->enabled()]; |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace WebCore | 195 } // namespace WebCore |
| OLD | NEW |