Title: [104647] trunk
Revision
104647
Author
simon.fra...@apple.com
Date
2012-01-10 16:19:50 -0800 (Tue, 10 Jan 2012)

Log Message

Disabled mock scrollbars should draw differently
https://bugs.webkit.org/show_bug.cgi?id=75995

Source/WebCore:

Reviewed by James Robinson.

When the scrollbar is disabled, paint the entire track of
mock scrollbars with a lighter gray, and hide the thumb.

No tests, since mock scrollbars aren't enabled by default on Mac yet.

* platform/mock/ScrollbarThemeMock.cpp:
(WebCore::ScrollbarThemeMock::paintTrackBackground):
(WebCore::ScrollbarThemeMock::paintThumb):

Tools:

Reviewed by James Robinson.

When the scrollbar is disabled, paint the entire track of
mock scrollbars with a lighter gray, and hide the thumb.

* DumpRenderTree/mac/DumpRenderTree.mm:
(-[DRTMockScroller drawKnob]):
(-[DRTMockScroller drawRect:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104646 => 104647)


--- trunk/Source/WebCore/ChangeLog	2012-01-11 00:18:05 UTC (rev 104646)
+++ trunk/Source/WebCore/ChangeLog	2012-01-11 00:19:50 UTC (rev 104647)
@@ -1,3 +1,19 @@
+2012-01-10  Simon Fraser  <simon.fra...@apple.com>
+
+        Disabled mock scrollbars should draw differently
+        https://bugs.webkit.org/show_bug.cgi?id=75995
+
+        Reviewed by James Robinson.
+        
+        When the scrollbar is disabled, paint the entire track of
+        mock scrollbars with a lighter gray, and hide the thumb.
+
+        No tests, since mock scrollbars aren't enabled by default on Mac yet.
+
+        * platform/mock/ScrollbarThemeMock.cpp:
+        (WebCore::ScrollbarThemeMock::paintTrackBackground):
+        (WebCore::ScrollbarThemeMock::paintThumb):
+
 2012-01-10  Tony Chang  <t...@chromium.org>
 
         Need to handle absolutely positioned elements inside flexboxes

Modified: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp (104646 => 104647)


--- trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp	2012-01-11 00:18:05 UTC (rev 104646)
+++ trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp	2012-01-11 00:19:50 UTC (rev 104647)
@@ -42,14 +42,15 @@
     return cScrollbarThickness[controlSize];
 }
 
-void ScrollbarThemeMock::paintTrackBackground(GraphicsContext* context, Scrollbar*, const IntRect& trackRect)
+void ScrollbarThemeMock::paintTrackBackground(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& trackRect)
 {
-    context->fillRect(trackRect, Color::lightGray, ColorSpaceDeviceRGB);
+    context->fillRect(trackRect, scrollbar->enabled() ? Color::lightGray : Color(0xFFE0E0E0), ColorSpaceDeviceRGB);
 }
 
-void ScrollbarThemeMock::paintThumb(GraphicsContext* context, Scrollbar*, const IntRect& thumbRect)
+void ScrollbarThemeMock::paintThumb(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& thumbRect)
 {
-    context->fillRect(thumbRect, Color::darkGray, ColorSpaceDeviceRGB);
+    if (scrollbar->enabled())
+        context->fillRect(thumbRect, Color::darkGray, ColorSpaceDeviceRGB);
 }
 
 }

Modified: trunk/Tools/ChangeLog (104646 => 104647)


--- trunk/Tools/ChangeLog	2012-01-11 00:18:05 UTC (rev 104646)
+++ trunk/Tools/ChangeLog	2012-01-11 00:19:50 UTC (rev 104647)
@@ -1,3 +1,17 @@
+2012-01-10  Simon Fraser  <simon.fra...@apple.com>
+
+        Disabled mock scrollbars should draw differently
+        https://bugs.webkit.org/show_bug.cgi?id=75995
+
+        Reviewed by James Robinson.
+
+        When the scrollbar is disabled, paint the entire track of
+        mock scrollbars with a lighter gray, and hide the thumb.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (-[DRTMockScroller drawKnob]):
+        (-[DRTMockScroller drawRect:]):
+
 2012-01-10  James Robinson  <jam...@chromium.org>
 
         [chromium] Run webkit_unit_tests as part of webkit-patch build-and-test

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (104646 => 104647)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2012-01-11 00:18:05 UTC (rev 104646)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2012-01-11 00:19:50 UTC (rev 104647)
@@ -469,6 +469,9 @@
 
 - (void)drawKnob
 {
+    if (![self isEnabled])
+        return;
+
     NSRect knobRect = [self rectForPart:NSScrollerKnob];
     
     static NSColor *knobColor = [[NSColor colorWithDeviceRed:0x80 / 255.0 green:0x80 / 255.0 blue:0x80 / 255.0 alpha:1] retain];
@@ -480,8 +483,13 @@
 - (void)drawRect:(NSRect)dirtyRect
 {
     static NSColor *trackColor = [[NSColor colorWithDeviceRed:0xC0 / 255.0 green:0xC0 / 255.0 blue:0xC0 / 255.0 alpha:1] retain];
-    [trackColor set];
+    static NSColor *disabledTrackColor = [[NSColor colorWithDeviceRed:0xE0 / 255.0 green:0xE0 / 255.0 blue:0xE0 / 255.0 alpha:1] retain];
 
+    if ([self isEnabled])
+        [trackColor set];
+    else
+        [disabledTrackColor set];
+
     NSRectFill(dirtyRect);
     
     [self drawKnob];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to