| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 void ScrollbarThemeMacOverlayAPI::paintTrackBackground(GraphicsContext& context,
const ScrollbarThemeClient& scrollbar, const IntRect& rect) { | 141 void ScrollbarThemeMacOverlayAPI::paintTrackBackground(GraphicsContext& context,
const ScrollbarThemeClient& scrollbar, const IntRect& rect) { |
| 142 if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayI
tem::ScrollbarTrackBackground)) | 142 if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayI
tem::ScrollbarTrackBackground)) |
| 143 return; | 143 return; |
| 144 | 144 |
| 145 DrawingRecorder recorder(context, scrollbar, DisplayItem::ScrollbarTrackBack
ground, rect); | 145 DrawingRecorder recorder(context, scrollbar, DisplayItem::ScrollbarTrackBack
ground, rect); |
| 146 | 146 |
| 147 ASSERT(isOverlayAPIAvailable()); | 147 ASSERT(isOverlayAPIAvailable()); |
| 148 | 148 |
| 149 GraphicsContextStateSaver stateSaver(context); | 149 GraphicsContextStateSaver stateSaver(context); |
| 150 context.translate(rect.x(), rect.y()); | 150 context.translate(rect.x(), rect.y()); |
| 151 LocalCurrentGraphicsContext localContext(&context, IntRect(IntPoint(), rect.
size())); | 151 LocalCurrentGraphicsContext localContext(context, IntRect(IntPoint(), rect.s
ize())); |
| 152 | 152 |
| 153 CGRect frameRect = scrollbar.frameRect(); | 153 CGRect frameRect = scrollbar.frameRect(); |
| 154 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); | 154 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); |
| 155 [scrollbarPainter setEnabled:scrollbar.enabled()]; | 155 [scrollbarPainter setEnabled:scrollbar.enabled()]; |
| 156 [scrollbarPainter setBoundsSize: NSSizeFromCGSize(frameRect.size)]; | 156 [scrollbarPainter setBoundsSize: NSSizeFromCGSize(frameRect.size)]; |
| 157 NSRect trackRect = NSMakeRect(0, 0, frameRect.size.width, frameRect.size.hei
ght); | 157 NSRect trackRect = NSMakeRect(0, 0, frameRect.size.width, frameRect.size.hei
ght); |
| 158 [scrollbarPainter drawKnobSlotInRect:trackRect highlight:NO]; | 158 [scrollbarPainter drawKnobSlotInRect:trackRect highlight:NO]; |
| 159 } | 159 } |
| 160 | 160 |
| 161 void ScrollbarThemeMacOverlayAPI::paintThumb(GraphicsContext& context, const Scr
ollbarThemeClient& scrollbar, const IntRect& rect) { | 161 void ScrollbarThemeMacOverlayAPI::paintThumb(GraphicsContext& context, const Scr
ollbarThemeClient& scrollbar, const IntRect& rect) { |
| 162 if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayI
tem::ScrollbarThumb)) | 162 if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayI
tem::ScrollbarThumb)) |
| 163 return; | 163 return; |
| 164 | 164 |
| 165 // Expand dirty rect to allow for scroll thumb anti-aliasing in minimum thum
b size case. | 165 // Expand dirty rect to allow for scroll thumb anti-aliasing in minimum thum
b size case. |
| 166 IntRect dirtyRect = IntRect(rect); | 166 IntRect dirtyRect = IntRect(rect); |
| 167 dirtyRect.inflate(1); | 167 dirtyRect.inflate(1); |
| 168 DrawingRecorder recorder(context, scrollbar, DisplayItem::ScrollbarThumb, di
rtyRect); | 168 DrawingRecorder recorder(context, scrollbar, DisplayItem::ScrollbarThumb, di
rtyRect); |
| 169 | 169 |
| 170 ASSERT(isOverlayAPIAvailable()); | 170 ASSERT(isOverlayAPIAvailable()); |
| 171 | 171 |
| 172 GraphicsContextStateSaver stateSaver(context); | 172 GraphicsContextStateSaver stateSaver(context); |
| 173 context.translate(rect.x(), rect.y()); | 173 context.translate(rect.x(), rect.y()); |
| 174 LocalCurrentGraphicsContext localContext(&context, IntRect(IntPoint(), rect.
size())); | 174 LocalCurrentGraphicsContext localContext(context, IntRect(IntPoint(), rect.s
ize())); |
| 175 | 175 |
| 176 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); | 176 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); |
| 177 [scrollbarPainter setEnabled:scrollbar.enabled()]; | 177 [scrollbarPainter setEnabled:scrollbar.enabled()]; |
| 178 [scrollbarPainter setBoundsSize:NSSizeFromCGSize(rect.size())]; | 178 [scrollbarPainter setBoundsSize:NSSizeFromCGSize(rect.size())]; |
| 179 [scrollbarPainter setDoubleValue:0]; | 179 [scrollbarPainter setDoubleValue:0]; |
| 180 [scrollbarPainter setKnobProportion:1]; | 180 [scrollbarPainter setKnobProportion:1]; |
| 181 | 181 |
| 182 CGFloat oldKnobAlpha = [scrollbarPainter knobAlpha]; | 182 CGFloat oldKnobAlpha = [scrollbarPainter knobAlpha]; |
| 183 [scrollbarPainter setKnobAlpha:1]; | 183 [scrollbarPainter setKnobAlpha:1]; |
| 184 | 184 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 [painterForScrollbar(scrollbar) setEnabled:scrollbar.enabled()]; | 270 [painterForScrollbar(scrollbar) setEnabled:scrollbar.enabled()]; |
| 271 } | 271 } |
| 272 | 272 |
| 273 float ScrollbarThemeMacOverlayAPI::thumbOpacity(const ScrollbarThemeClient& scro
llbar) const { | 273 float ScrollbarThemeMacOverlayAPI::thumbOpacity(const ScrollbarThemeClient& scro
llbar) const { |
| 274 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); | 274 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); |
| 275 return [scrollbarPainter knobAlpha]; | 275 return [scrollbarPainter knobAlpha]; |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace blink | 278 } // namespace blink |
| 279 | 279 |
| OLD | NEW |