Title: [161397] trunk/Source/WebCore
- Revision
- 161397
- Author
- [email protected]
- Date
- 2014-01-06 20:45:57 -0800 (Mon, 06 Jan 2014)
Log Message
<https://webkit.org/b/126559> Be more correct in dealing with NSControlSize
Reviewed by Ryosuke Niwa.
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::scrollbarControlSizeToNSControlSize): Helper function to map from ScrollbarControlSize
to NSControlSize.
(WebCore::ScrollbarThemeMac::registerScrollbar): Use the helper rather than casting.
(WebCore::ScrollbarThemeMac::scrollbarThickness): Use the helper.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::progressBarRectForBounds): Update the type of the local to NSControlSize.
(WebCore::RenderThemeMac::paintProgressBar): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (161396 => 161397)
--- trunk/Source/WebCore/ChangeLog 2014-01-07 04:00:31 UTC (rev 161396)
+++ trunk/Source/WebCore/ChangeLog 2014-01-07 04:45:57 UTC (rev 161397)
@@ -1,3 +1,18 @@
+2014-01-06 Mark Rowe <[email protected]>
+
+ <https://webkit.org/b/126559> Be more correct in dealing with NSControlSize
+
+ Reviewed by Ryosuke Niwa.
+
+ * platform/mac/ScrollbarThemeMac.mm:
+ (WebCore::scrollbarControlSizeToNSControlSize): Helper function to map from ScrollbarControlSize
+ to NSControlSize.
+ (WebCore::ScrollbarThemeMac::registerScrollbar): Use the helper rather than casting.
+ (WebCore::ScrollbarThemeMac::scrollbarThickness): Use the helper.
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::progressBarRectForBounds): Update the type of the local to NSControlSize.
+ (WebCore::RenderThemeMac::paintProgressBar): Ditto.
+
2014-01-06 Brent Fulgham <[email protected]>
[WebGL] Be safer about toggling OpenGL state by using a scoped object to control setting lifetime.
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (161396 => 161397)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2014-01-07 04:00:31 UTC (rev 161396)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2014-01-07 04:45:57 UTC (rev 161397)
@@ -156,10 +156,23 @@
}
}
+static NSControlSize scrollbarControlSizeToNSControlSize(ScrollbarControlSize controlSize)
+{
+ switch (controlSize) {
+ case RegularScrollbar:
+ return NSRegularControlSize;
+ case SmallScrollbar:
+ return NSSmallControlSize;
+ }
+
+ ASSERT_NOT_REACHED();
+ return NSRegularControlSize;
+}
+
void ScrollbarThemeMac::registerScrollbar(ScrollbarThemeClient* scrollbar)
{
bool isHorizontal = scrollbar->orientation() == HorizontalScrollbar;
- ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:(NSControlSize)scrollbar->controlSize() horizontal:isHorizontal replacingScrollerImp:nil];
+ ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(scrollbar->controlSize()) horizontal:isHorizontal replacingScrollerImp:nil];
scrollbarMap()->add(scrollbar, scrollbarPainter);
updateEnabledState(scrollbar);
updateScrollbarOverlayStyle(scrollbar);
@@ -223,7 +236,7 @@
int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:controlSize horizontal:NO replacingScrollerImp:nil];
+ ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(controlSize) horizontal:NO replacingScrollerImp:nil];
if (supportsExpandedScrollbars())
[scrollbarPainter setExpanded:YES];
return [scrollbarPainter trackBoxWidth];
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (161396 => 161397)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2014-01-07 04:00:31 UTC (rev 161396)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2014-01-07 04:45:57 UTC (rev 161397)
@@ -991,7 +991,7 @@
return bounds;
float zoomLevel = renderObject->style().effectiveZoom();
- int controlSize = controlSizeForFont(&renderObject->style());
+ NSControlSize controlSize = controlSizeForFont(&renderObject->style());
IntSize size = progressBarSizes()[controlSize];
size.setHeight(size.height() * zoomLevel);
size.setWidth(bounds.width());
@@ -1029,7 +1029,7 @@
return true;
IntRect inflatedRect = progressBarRectForBounds(renderObject, rect);
- int controlSize = controlSizeForFont(&renderObject->style());
+ NSControlSize controlSize = controlSizeForFont(&renderObject->style());
RenderProgress* renderProgress = toRenderProgress(renderObject);
HIThemeTrackDrawInfo trackInfo;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes