| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (!scrollbar.enabled()) | 96 if (!scrollbar.enabled()) |
| 97 trackInfo.enableState = kThemeTrackDisabled; | 97 trackInfo.enableState = kThemeTrackDisabled; |
| 98 else | 98 else |
| 99 trackInfo.enableState = scrollbar.isScrollableAreaActive() ? kThemeTrack
Active : kThemeTrackInactive; | 99 trackInfo.enableState = scrollbar.isScrollableAreaActive() ? kThemeTrack
Active : kThemeTrackInactive; |
| 100 | 100 |
| 101 if (!hasButtons(scrollbar)) | 101 if (!hasButtons(scrollbar)) |
| 102 trackInfo.enableState = kThemeTrackNothingToScroll; | 102 trackInfo.enableState = kThemeTrackNothingToScroll; |
| 103 trackInfo.trackInfo.scrollbar.pressState = scrollbarPartToHIPressedState(scr
ollbar.pressedPart()); | 103 trackInfo.trackInfo.scrollbar.pressState = scrollbarPartToHIPressedState(scr
ollbar.pressedPart()); |
| 104 | 104 |
| 105 SkCanvas* canvas = context.canvas(); | 105 SkCanvas* canvas = context.canvas(); |
| 106 CGAffineTransform currentCTM = gfx::SkMatrixToCGAffineTransform(canvas->getT
otalMatrix()); | 106 CGAffineTransform currentCTM = skia::SkMatrixToCGAffineTransform(canvas->get
TotalMatrix()); |
| 107 | 107 |
| 108 // The Aqua scrollbar is buggy when rotated and scaled. We will just draw i
nto a bitmap if we detect a scale or rotation. | 108 // The Aqua scrollbar is buggy when rotated and scaled. We will just draw i
nto a bitmap if we detect a scale or rotation. |
| 109 bool canDrawDirectly = currentCTM.a == 1.0f && currentCTM.b == 0.0f && curre
ntCTM.c == 0.0f && (currentCTM.d == 1.0f || currentCTM.d == -1.0f); | 109 bool canDrawDirectly = currentCTM.a == 1.0f && currentCTM.b == 0.0f && curre
ntCTM.c == 0.0f && (currentCTM.d == 1.0f || currentCTM.d == -1.0f); |
| 110 OwnPtr<ImageBuffer> imageBuffer; | 110 OwnPtr<ImageBuffer> imageBuffer; |
| 111 SkCanvas* drawingCanvas; | 111 SkCanvas* drawingCanvas; |
| 112 if (!canDrawDirectly) { | 112 if (!canDrawDirectly) { |
| 113 trackInfo.bounds = IntRect(IntPoint(), scrollbar.frameRect().size()); | 113 trackInfo.bounds = IntRect(IntPoint(), scrollbar.frameRect().size()); |
| 114 | 114 |
| 115 IntRect bufferRect(scrollbar.frameRect()); | 115 IntRect bufferRect(scrollbar.frameRect()); |
| 116 bufferRect.intersect(cullRect.m_rect); | 116 bufferRect.intersect(cullRect.m_rect); |
| 117 bufferRect.move(-scrollbar.frameRect().x(), -scrollbar.frameRect().y()); | 117 bufferRect.move(-scrollbar.frameRect().x(), -scrollbar.frameRect().y()); |
| 118 | 118 |
| 119 imageBuffer = ImageBuffer::create(bufferRect.size()); | 119 imageBuffer = ImageBuffer::create(bufferRect.size()); |
| 120 if (!imageBuffer) | 120 if (!imageBuffer) |
| 121 return true; | 121 return true; |
| 122 | 122 |
| 123 drawingCanvas = imageBuffer->canvas(); | 123 drawingCanvas = imageBuffer->canvas(); |
| 124 } else { | 124 } else { |
| 125 drawingCanvas = canvas; | 125 drawingCanvas = canvas; |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Draw the track and its thumb. | 128 // Draw the track and its thumb. |
| 129 gfx::SkiaBitLocker bitLocker( | 129 skia::SkiaBitLocker bitLocker( |
| 130 drawingCanvas, | 130 drawingCanvas, |
| 131 ThemeMac::inflateRectForAA(scrollbar.frameRect()), | 131 ThemeMac::inflateRectForAA(scrollbar.frameRect()), |
| 132 canDrawDirectly ? context.deviceScaleFactor() : 1.0f); | 132 canDrawDirectly ? context.deviceScaleFactor() : 1.0f); |
| 133 CGContextRef cgContext = bitLocker.cgContext(); | 133 CGContextRef cgContext = bitLocker.cgContext(); |
| 134 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); | 134 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); |
| 135 | 135 |
| 136 IntRect tickmarkTrackRect = trackRect(scrollbar, false); | 136 IntRect tickmarkTrackRect = trackRect(scrollbar, false); |
| 137 if (!canDrawDirectly) { | 137 if (!canDrawDirectly) { |
| 138 tickmarkTrackRect.setX(0); | 138 tickmarkTrackRect.setX(0); |
| 139 tickmarkTrackRect.setY(0); | 139 tickmarkTrackRect.setY(0); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 return IntRect(scrollbar.x() + startWidth, scrollbar.y(), scrollbar.widt
h() - totalWidth, thickness); | 310 return IntRect(scrollbar.x() + startWidth, scrollbar.y(), scrollbar.widt
h() - totalWidth, thickness); |
| 311 return IntRect(scrollbar.x(), scrollbar.y() + startWidth, thickness, scrollb
ar.height() - totalWidth); | 311 return IntRect(scrollbar.x(), scrollbar.y() + startWidth, thickness, scrollb
ar.height() - totalWidth); |
| 312 } | 312 } |
| 313 | 313 |
| 314 int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(const ScrollbarThemeClien
t& scrollbar) | 314 int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(const ScrollbarThemeClien
t& scrollbar) |
| 315 { | 315 { |
| 316 return cThumbMinLength[scrollbar.controlSize()]; | 316 return cThumbMinLength[scrollbar.controlSize()]; |
| 317 } | 317 } |
| 318 | 318 |
| 319 } | 319 } |
| OLD | NEW |