Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (190622 => 190623)
--- trunk/Source/WebCore/platform/mac/ThemeMac.mm 2015-10-06 17:21:22 UTC (rev 190622)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm 2015-10-06 17:28:02 UTC (rev 190623)
@@ -664,30 +664,38 @@
const float buttonFocusRectOutlineWidth = 3.0f;
-bool ThemeMac::drawCellOrFocusRingWithViewIntoContext(NSCell* cell, GraphicsContext& context, const FloatRect& inflatedRect, NSView* view, bool drawButtonCell, bool drawFocusRing, bool useImageBuffer, float deviceScaleFactor)
+static inline bool drawCellOrFocusRingIntoRectWithView(NSCell *cell, NSRect rect, NSView *view, bool drawButtonCell, bool drawFocusRing)
{
+ if (drawButtonCell) {
+ if ([cell isKindOfClass:[NSSliderCell class]]) {
+ // For slider cells, draw only the knob.
+ [(NSSliderCell *)cell drawKnob:rect];
+ } else
+ [cell drawWithFrame:rect inView:view];
+ }
+ if (drawFocusRing)
+ return drawCellFocusRing(cell, rect, view);
+
+ return false;
+}
+
+bool ThemeMac::drawCellOrFocusRingWithViewIntoContext(NSCell *cell, GraphicsContext& context, const FloatRect& rect, NSView *view, bool drawButtonCell, bool drawFocusRing, bool useImageBuffer, float deviceScaleFactor)
+{
ASSERT(drawButtonCell || drawFocusRing);
bool needsRepaint = false;
if (useImageBuffer) {
- NSRect imageBufferDrawRect = NSRect(FloatRect(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth, inflatedRect.width(), inflatedRect.height()));
- std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::createCompatibleBuffer(inflatedRect.size() + 2 * FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth), deviceScaleFactor, ColorSpaceSRGB, context, false);
+ NSRect imageBufferDrawRect = NSRect(FloatRect(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth, rect.width(), rect.height()));
+ auto imageBuffer = ImageBuffer::createCompatibleBuffer(rect.size() + 2 * FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth), deviceScaleFactor, ColorSpaceSRGB, context, false);
{
LocalCurrentGraphicsContext localContext(imageBuffer->context());
- if (drawButtonCell)
- [cell drawWithFrame:imageBufferDrawRect inView:view];
-
- if (drawFocusRing)
- needsRepaint = drawCellFocusRing(cell, imageBufferDrawRect, view);
+ needsRepaint = drawCellOrFocusRingIntoRectWithView(cell, imageBufferDrawRect, view, drawButtonCell, drawFocusRing);
}
- context.drawImageBuffer(imageBuffer.get(), ColorSpaceSRGB, inflatedRect.location() - FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth));
+ context.drawImageBuffer(imageBuffer.get(), ColorSpaceSRGB, rect.location() - FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth));
return needsRepaint;
}
if (drawButtonCell)
- [cell drawWithFrame:NSRect(inflatedRect) inView:view];
+ needsRepaint = drawCellOrFocusRingIntoRectWithView(cell, NSRect(rect), view, drawButtonCell, drawFocusRing);
- if (drawFocusRing)
- needsRepaint = drawCellFocusRing(cell, NSRect(inflatedRect), view);
-
return needsRepaint;
}
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (190622 => 190623)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2015-10-06 17:21:22 UTC (rev 190622)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2015-10-06 17:28:02 UTC (rev 190623)
@@ -1581,7 +1581,11 @@
paintInfo.context().translate(-unzoomedRect.x(), -unzoomedRect.y());
}
- [sliderThumbCell drawKnob:unzoomedRect];
+ bool shouldDrawCell = true;
+ bool shouldDrawFocusRing = false;
+ float deviceScaleFactor = o.document().page()->deviceScaleFactor();
+ bool shouldUseImageBuffer = deviceScaleFactor != 1 || zoomLevel != 1;
+ ThemeMac::drawCellOrFocusRingWithViewIntoContext(sliderThumbCell, paintInfo.context(), unzoomedRect, view, shouldDrawCell, shouldDrawFocusRing, shouldUseImageBuffer, deviceScaleFactor);
[sliderThumbCell setControlView:nil];
return false;