Index: third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacNonOverlayAPI.mm |
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacNonOverlayAPI.mm b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacNonOverlayAPI.mm |
index 12770029ac1c643b361fb55689411b3adf01dd8f..700466772f080639cd830d1a1621d74310c1571a 100644 |
--- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacNonOverlayAPI.mm |
+++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacNonOverlayAPI.mm |
@@ -68,41 +68,41 @@ void ScrollbarThemeMacNonOverlayAPI::updateButtonPlacement(ScrollbarButtonsPlace |
// - drawing using WebThemeEngine functions |
// - drawing tickmarks |
// - Skia specific changes |
-bool ScrollbarThemeMacNonOverlayAPI::paint(const ScrollbarThemeClient* scrollbar, GraphicsContext* context, const CullRect& cullRect) |
+bool ScrollbarThemeMacNonOverlayAPI::paint(const ScrollbarThemeClient& scrollbar, GraphicsContext& context, const CullRect& cullRect) |
{ |
- DisplayItem::Type displayItemType = scrollbar->orientation() == HorizontalScrollbar ? DisplayItem::ScrollbarHorizontal : DisplayItem::ScrollbarVertical; |
- if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, displayItemType)) |
+ DisplayItem::Type displayItemType = scrollbar.orientation() == HorizontalScrollbar ? DisplayItem::ScrollbarHorizontal : DisplayItem::ScrollbarVertical; |
+ if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, displayItemType)) |
return true; |
- DrawingRecorder recorder(*context, *scrollbar, displayItemType, scrollbar->frameRect()); |
+ DrawingRecorder recorder(context, scrollbar, displayItemType, scrollbar.frameRect()); |
// Get the tickmarks for the frameview. |
Vector<IntRect> tickmarks; |
- scrollbar->getTickmarks(tickmarks); |
+ scrollbar.getTickmarks(tickmarks); |
HIThemeTrackDrawInfo trackInfo; |
trackInfo.version = 0; |
- trackInfo.kind = scrollbar->controlSize() == RegularScrollbar ? kThemeMediumScrollBar : kThemeSmallScrollBar; |
- trackInfo.bounds = scrollbar->frameRect(); |
+ trackInfo.kind = scrollbar.controlSize() == RegularScrollbar ? kThemeMediumScrollBar : kThemeSmallScrollBar; |
+ trackInfo.bounds = scrollbar.frameRect(); |
trackInfo.min = 0; |
- trackInfo.max = scrollbar->maximum(); |
- trackInfo.value = scrollbar->currentPos(); |
- trackInfo.trackInfo.scrollbar.viewsize = scrollbar->visibleSize(); |
+ trackInfo.max = scrollbar.maximum(); |
+ trackInfo.value = scrollbar.currentPos(); |
+ trackInfo.trackInfo.scrollbar.viewsize = scrollbar.visibleSize(); |
trackInfo.attributes = hasThumb(scrollbar) ? kThemeTrackShowThumb : 0; |
- if (scrollbar->orientation() == HorizontalScrollbar) |
+ if (scrollbar.orientation() == HorizontalScrollbar) |
trackInfo.attributes |= kThemeTrackHorizontal; |
- if (!scrollbar->enabled()) |
+ if (!scrollbar.enabled()) |
trackInfo.enableState = kThemeTrackDisabled; |
else |
- trackInfo.enableState = scrollbar->isScrollableAreaActive() ? kThemeTrackActive : kThemeTrackInactive; |
+ trackInfo.enableState = scrollbar.isScrollableAreaActive() ? kThemeTrackActive : kThemeTrackInactive; |
if (!hasButtons(scrollbar)) |
trackInfo.enableState = kThemeTrackNothingToScroll; |
- trackInfo.trackInfo.scrollbar.pressState = scrollbarPartToHIPressedState(scrollbar->pressedPart()); |
+ trackInfo.trackInfo.scrollbar.pressState = scrollbarPartToHIPressedState(scrollbar.pressedPart()); |
- SkCanvas* canvas = context->canvas(); |
+ SkCanvas* canvas = context.canvas(); |
CGAffineTransform currentCTM = gfx::SkMatrixToCGAffineTransform(canvas->getTotalMatrix()); |
// The Aqua scrollbar is buggy when rotated and scaled. We will just draw into a bitmap if we detect a scale or rotation. |
@@ -110,11 +110,11 @@ bool ScrollbarThemeMacNonOverlayAPI::paint(const ScrollbarThemeClient* scrollbar |
OwnPtr<ImageBuffer> imageBuffer; |
SkCanvas* drawingCanvas; |
if (!canDrawDirectly) { |
- trackInfo.bounds = IntRect(IntPoint(), scrollbar->frameRect().size()); |
+ trackInfo.bounds = IntRect(IntPoint(), scrollbar.frameRect().size()); |
- IntRect bufferRect(scrollbar->frameRect()); |
+ IntRect bufferRect(scrollbar.frameRect()); |
bufferRect.intersect(cullRect.m_rect); |
- bufferRect.move(-scrollbar->frameRect().x(), -scrollbar->frameRect().y()); |
+ bufferRect.move(-scrollbar.frameRect().x(), -scrollbar.frameRect().y()); |
imageBuffer = ImageBuffer::create(bufferRect.size()); |
if (!imageBuffer) |
@@ -128,8 +128,8 @@ bool ScrollbarThemeMacNonOverlayAPI::paint(const ScrollbarThemeClient* scrollbar |
// Draw the track and its thumb. |
gfx::SkiaBitLocker bitLocker( |
drawingCanvas, |
- ThemeMac::inflateRectForAA(scrollbar->frameRect()), |
- canDrawDirectly ? context->deviceScaleFactor() : 1.0f); |
+ ThemeMac::inflateRectForAA(scrollbar.frameRect()), |
+ canDrawDirectly ? context.deviceScaleFactor() : 1.0f); |
CGContextRef cgContext = bitLocker.cgContext(); |
HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); |
@@ -147,8 +147,8 @@ bool ScrollbarThemeMacNonOverlayAPI::paint(const ScrollbarThemeClient* scrollbar |
if (!canDrawDirectly) { |
ASSERT(imageBuffer); |
- if (!context->contextDisabled()) { |
- imageBuffer->draw(context, FloatRect(scrollbar->frameRect().location(), FloatSize(imageBuffer->size())), |
+ if (!context.contextDisabled()) { |
+ imageBuffer->draw(&context, FloatRect(scrollbar.frameRect().location(), FloatSize(imageBuffer->size())), |
nullptr, SkXfermode::kSrcOver_Mode); |
} |
} |
@@ -166,20 +166,20 @@ ScrollbarButtonsPlacement ScrollbarThemeMacNonOverlayAPI::buttonsPlacement() con |
return gButtonPlacement; |
} |
-bool ScrollbarThemeMacNonOverlayAPI::hasButtons(const ScrollbarThemeClient* scrollbar) |
+bool ScrollbarThemeMacNonOverlayAPI::hasButtons(const ScrollbarThemeClient& scrollbar) |
{ |
- return scrollbar->enabled() && buttonsPlacement() != ScrollbarButtonsPlacementNone |
- && (scrollbar->orientation() == HorizontalScrollbar |
- ? scrollbar->width() |
- : scrollbar->height()) >= 2 * (cRealButtonLength[scrollbar->controlSize()] - cButtonHitInset[scrollbar->controlSize()]); |
+ return scrollbar.enabled() && buttonsPlacement() != ScrollbarButtonsPlacementNone |
+ && (scrollbar.orientation() == HorizontalScrollbar |
+ ? scrollbar.width() |
+ : scrollbar.height()) >= 2 * (cRealButtonLength[scrollbar.controlSize()] - cButtonHitInset[scrollbar.controlSize()]); |
} |
-bool ScrollbarThemeMacNonOverlayAPI::hasThumb(const ScrollbarThemeClient* scrollbar) |
+bool ScrollbarThemeMacNonOverlayAPI::hasThumb(const ScrollbarThemeClient& scrollbar) |
{ |
- int minLengthForThumb = 2 * cButtonInset[scrollbar->controlSize()] + cThumbMinLength[scrollbar->controlSize()] + 1; |
- return scrollbar->enabled() && (scrollbar->orientation() == HorizontalScrollbar ? |
- scrollbar->width() : |
- scrollbar->height()) >= minLengthForThumb; |
+ int minLengthForThumb = 2 * cButtonInset[scrollbar.controlSize()] + cThumbMinLength[scrollbar.controlSize()] + 1; |
+ return scrollbar.enabled() && (scrollbar.orientation() == HorizontalScrollbar ? |
+ scrollbar.width() : |
+ scrollbar.height()) >= minLengthForThumb; |
} |
static IntRect buttonRepaintRect(const IntRect& buttonRect, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, bool start) |
@@ -200,7 +200,7 @@ static IntRect buttonRepaintRect(const IntRect& buttonRect, ScrollbarOrientation |
return paintRect; |
} |
-IntRect ScrollbarThemeMacNonOverlayAPI::backButtonRect(const ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting) |
+IntRect ScrollbarThemeMacNonOverlayAPI::backButtonRect(const ScrollbarThemeClient& scrollbar, ScrollbarPart part, bool painting) |
{ |
IntRect result; |
@@ -210,31 +210,31 @@ IntRect ScrollbarThemeMacNonOverlayAPI::backButtonRect(const ScrollbarThemeClien |
if (part == BackButtonEndPart && (buttonsPlacement() == ScrollbarButtonsPlacementNone || buttonsPlacement() == ScrollbarButtonsPlacementDoubleStart || buttonsPlacement() == ScrollbarButtonsPlacementSingle)) |
return result; |
- int thickness = scrollbarThickness(scrollbar->controlSize()); |
+ int thickness = scrollbarThickness(scrollbar.controlSize()); |
bool outerButton = part == BackButtonStartPart && (buttonsPlacement() == ScrollbarButtonsPlacementDoubleStart || buttonsPlacement() == ScrollbarButtonsPlacementDoubleBoth); |
if (outerButton) { |
- if (scrollbar->orientation() == HorizontalScrollbar) |
- result = IntRect(scrollbar->x(), scrollbar->y(), cOuterButtonLength[scrollbar->controlSize()] + (painting ? cOuterButtonOverlap : 0), thickness); |
+ if (scrollbar.orientation() == HorizontalScrollbar) |
+ result = IntRect(scrollbar.x(), scrollbar.y(), cOuterButtonLength[scrollbar.controlSize()] + (painting ? cOuterButtonOverlap : 0), thickness); |
else |
- result = IntRect(scrollbar->x(), scrollbar->y(), thickness, cOuterButtonLength[scrollbar->controlSize()] + (painting ? cOuterButtonOverlap : 0)); |
+ result = IntRect(scrollbar.x(), scrollbar.y(), thickness, cOuterButtonLength[scrollbar.controlSize()] + (painting ? cOuterButtonOverlap : 0)); |
return result; |
} |
// Our repaint rect is slightly larger, since we are a button that is adjacent to the track. |
- if (scrollbar->orientation() == HorizontalScrollbar) { |
- int start = part == BackButtonStartPart ? scrollbar->x() : scrollbar->x() + scrollbar->width() - cOuterButtonLength[scrollbar->controlSize()] - cButtonLength[scrollbar->controlSize()]; |
- result = IntRect(start, scrollbar->y(), cButtonLength[scrollbar->controlSize()], thickness); |
+ if (scrollbar.orientation() == HorizontalScrollbar) { |
+ int start = part == BackButtonStartPart ? scrollbar.x() : scrollbar.x() + scrollbar.width() - cOuterButtonLength[scrollbar.controlSize()] - cButtonLength[scrollbar.controlSize()]; |
+ result = IntRect(start, scrollbar.y(), cButtonLength[scrollbar.controlSize()], thickness); |
} else { |
- int start = part == BackButtonStartPart ? scrollbar->y() : scrollbar->y() + scrollbar->height() - cOuterButtonLength[scrollbar->controlSize()] - cButtonLength[scrollbar->controlSize()]; |
- result = IntRect(scrollbar->x(), start, thickness, cButtonLength[scrollbar->controlSize()]); |
+ int start = part == BackButtonStartPart ? scrollbar.y() : scrollbar.y() + scrollbar.height() - cOuterButtonLength[scrollbar.controlSize()] - cButtonLength[scrollbar.controlSize()]; |
+ result = IntRect(scrollbar.x(), start, thickness, cButtonLength[scrollbar.controlSize()]); |
} |
if (painting) |
- return buttonRepaintRect(result, scrollbar->orientation(), scrollbar->controlSize(), part == BackButtonStartPart); |
+ return buttonRepaintRect(result, scrollbar.orientation(), scrollbar.controlSize(), part == BackButtonStartPart); |
return result; |
} |
-IntRect ScrollbarThemeMacNonOverlayAPI::forwardButtonRect(const ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool painting) |
+IntRect ScrollbarThemeMacNonOverlayAPI::forwardButtonRect(const ScrollbarThemeClient& scrollbar, ScrollbarPart part, bool painting) |
{ |
IntRect result; |
@@ -244,47 +244,47 @@ IntRect ScrollbarThemeMacNonOverlayAPI::forwardButtonRect(const ScrollbarThemeCl |
if (part == ForwardButtonStartPart && (buttonsPlacement() == ScrollbarButtonsPlacementNone || buttonsPlacement() == ScrollbarButtonsPlacementDoubleEnd || buttonsPlacement() == ScrollbarButtonsPlacementSingle)) |
return result; |
- int thickness = scrollbarThickness(scrollbar->controlSize()); |
- int outerButtonLength = cOuterButtonLength[scrollbar->controlSize()]; |
- int buttonLength = cButtonLength[scrollbar->controlSize()]; |
+ int thickness = scrollbarThickness(scrollbar.controlSize()); |
+ int outerButtonLength = cOuterButtonLength[scrollbar.controlSize()]; |
+ int buttonLength = cButtonLength[scrollbar.controlSize()]; |
bool outerButton = part == ForwardButtonEndPart && (buttonsPlacement() == ScrollbarButtonsPlacementDoubleEnd || buttonsPlacement() == ScrollbarButtonsPlacementDoubleBoth); |
if (outerButton) { |
- if (scrollbar->orientation() == HorizontalScrollbar) { |
- result = IntRect(scrollbar->x() + scrollbar->width() - outerButtonLength, scrollbar->y(), outerButtonLength, thickness); |
+ if (scrollbar.orientation() == HorizontalScrollbar) { |
+ result = IntRect(scrollbar.x() + scrollbar.width() - outerButtonLength, scrollbar.y(), outerButtonLength, thickness); |
if (painting) |
result.inflateX(cOuterButtonOverlap); |
} else { |
- result = IntRect(scrollbar->x(), scrollbar->y() + scrollbar->height() - outerButtonLength, thickness, outerButtonLength); |
+ result = IntRect(scrollbar.x(), scrollbar.y() + scrollbar.height() - outerButtonLength, thickness, outerButtonLength); |
if (painting) |
result.inflateY(cOuterButtonOverlap); |
} |
return result; |
} |
- if (scrollbar->orientation() == HorizontalScrollbar) { |
- int start = part == ForwardButtonEndPart ? scrollbar->x() + scrollbar->width() - buttonLength : scrollbar->x() + outerButtonLength; |
- result = IntRect(start, scrollbar->y(), buttonLength, thickness); |
+ if (scrollbar.orientation() == HorizontalScrollbar) { |
+ int start = part == ForwardButtonEndPart ? scrollbar.x() + scrollbar.width() - buttonLength : scrollbar.x() + outerButtonLength; |
+ result = IntRect(start, scrollbar.y(), buttonLength, thickness); |
} else { |
- int start = part == ForwardButtonEndPart ? scrollbar->y() + scrollbar->height() - buttonLength : scrollbar->y() + outerButtonLength; |
- result = IntRect(scrollbar->x(), start, thickness, buttonLength); |
+ int start = part == ForwardButtonEndPart ? scrollbar.y() + scrollbar.height() - buttonLength : scrollbar.y() + outerButtonLength; |
+ result = IntRect(scrollbar.x(), start, thickness, buttonLength); |
} |
if (painting) |
- return buttonRepaintRect(result, scrollbar->orientation(), scrollbar->controlSize(), part == ForwardButtonStartPart); |
+ return buttonRepaintRect(result, scrollbar.orientation(), scrollbar.controlSize(), part == ForwardButtonStartPart); |
return result; |
} |
-IntRect ScrollbarThemeMacNonOverlayAPI::trackRect(const ScrollbarThemeClient* scrollbar, bool painting) |
+IntRect ScrollbarThemeMacNonOverlayAPI::trackRect(const ScrollbarThemeClient& scrollbar, bool painting) |
{ |
if (painting || !hasButtons(scrollbar)) |
- return scrollbar->frameRect(); |
+ return scrollbar.frameRect(); |
IntRect result; |
- int thickness = scrollbarThickness(scrollbar->controlSize()); |
+ int thickness = scrollbarThickness(scrollbar.controlSize()); |
int startWidth = 0; |
int endWidth = 0; |
- int outerButtonLength = cOuterButtonLength[scrollbar->controlSize()]; |
- int buttonLength = cButtonLength[scrollbar->controlSize()]; |
+ int outerButtonLength = cOuterButtonLength[scrollbar.controlSize()]; |
+ int buttonLength = cButtonLength[scrollbar.controlSize()]; |
int doubleButtonLength = outerButtonLength + buttonLength; |
switch (buttonsPlacement()) { |
case ScrollbarButtonsPlacementSingle: |
@@ -306,14 +306,14 @@ IntRect ScrollbarThemeMacNonOverlayAPI::trackRect(const ScrollbarThemeClient* sc |
} |
int totalWidth = startWidth + endWidth; |
- if (scrollbar->orientation() == HorizontalScrollbar) |
- return IntRect(scrollbar->x() + startWidth, scrollbar->y(), scrollbar->width() - totalWidth, thickness); |
- return IntRect(scrollbar->x(), scrollbar->y() + startWidth, thickness, scrollbar->height() - totalWidth); |
+ if (scrollbar.orientation() == HorizontalScrollbar) |
+ return IntRect(scrollbar.x() + startWidth, scrollbar.y(), scrollbar.width() - totalWidth, thickness); |
+ return IntRect(scrollbar.x(), scrollbar.y() + startWidth, thickness, scrollbar.height() - totalWidth); |
} |
-int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(const ScrollbarThemeClient* scrollbar) |
+int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(const ScrollbarThemeClient& scrollbar) |
{ |
- return cThumbMinLength[scrollbar->controlSize()]; |
+ return cThumbMinLength[scrollbar.controlSize()]; |
} |
} |