Chromium: Fix scrollbar tickmark drawing on Mountain Lion
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 06:14:59 +0000 (06:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 06:14:59 +0000 (06:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83844

Patch by Sailesh Agrawal <sail@chromium.org> on 2012-04-12
Reviewed by James Robinson.

On Mountain Lion overlay scrollbars have a new expanded mode. In expanded mode the scrolllbar is slightly wider which causes the tickmarks to look incorrect. Fix was to explicitly enter expanded mode to get the correct look.
Screenshots:
broken: http://i.imgur.com/PDKYH.png
fixed: http://i.imgur.com/utp0Y.png

* platform/chromium/ScrollbarThemeChromiumMac.mm:
(WebCore::ScrollbarThemeChromiumMac::paint): Called setExpanded if API is available.
* platform/mac/NSScrollerImpDetails.h: Exposed the isExpanded: API.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114088 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm
Source/WebCore/platform/mac/NSScrollerImpDetails.h

index 7f17a76..0b368a1 100644 (file)
@@ -1,3 +1,19 @@
+2012-04-12  Sailesh Agrawal  <sail@chromium.org>
+
+        Chromium: Fix scrollbar tickmark drawing on Mountain Lion
+        https://bugs.webkit.org/show_bug.cgi?id=83844
+
+        Reviewed by James Robinson.
+
+        On Mountain Lion overlay scrollbars have a new expanded mode. In expanded mode the scrolllbar is slightly wider which causes the tickmarks to look incorrect. Fix was to explicitly enter expanded mode to get the correct look.
+        Screenshots:
+        broken: http://i.imgur.com/PDKYH.png
+        fixed: http://i.imgur.com/utp0Y.png
+
+        * platform/chromium/ScrollbarThemeChromiumMac.mm:
+        (WebCore::ScrollbarThemeChromiumMac::paint): Called setExpanded if API is available.
+        * platform/mac/NSScrollerImpDetails.h: Exposed the isExpanded: API.
+
 2012-04-12  Kent Tamura  <tkent@chromium.org>
 
         LocalizedDateICU should ignore timezones
index d02b421..acfbc1d 100644 (file)
@@ -129,6 +129,7 @@ bool ScrollbarThemeChromiumMac::paint(ScrollbarThemeClient* scrollbar, GraphicsC
 
         CGFloat oldKnobAlpha = 0;
         CGFloat oldTrackAlpha = 0;
+        BOOL oldIsExpanded = NO;
         bool hasTickmarks = tickmarks.size() > 0 && scrollbar->orientation() == VerticalScrollbar;
         ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar);
         if (hasTickmarks) {
@@ -136,6 +137,10 @@ bool ScrollbarThemeChromiumMac::paint(ScrollbarThemeClient* scrollbar, GraphicsC
             [scrollbarPainter setKnobAlpha:1.0];
             oldTrackAlpha = [scrollbarPainter trackAlpha];
             [scrollbarPainter setTrackAlpha:1.0];
+            if ([scrollbarPainter respondsToSelector:@selector(setExpanded:)]) {
+              oldIsExpanded = [scrollbarPainter isExpanded];
+              [scrollbarPainter setExpanded:YES];
+            }
         }
 
         GraphicsContextStateSaver stateSaver(*context);
@@ -168,6 +173,8 @@ bool ScrollbarThemeChromiumMac::paint(ScrollbarThemeClient* scrollbar, GraphicsC
         if (hasTickmarks) {
             [scrollbarPainter setKnobAlpha:oldKnobAlpha];
             [scrollbarPainter setTrackAlpha:oldTrackAlpha];
+            if ([scrollbarPainter respondsToSelector:@selector(setExpanded:)])
+              [scrollbarPainter setExpanded:oldIsExpanded];
         }
 
         return true;
index f06800c..c6a235f 100644 (file)
@@ -62,6 +62,7 @@ typedef NSInteger NSScrollerKnobStyle;
 - (void)setKnobProportion:(CGFloat)proportion;
 - (void)setKnobStyle:(NSScrollerKnobStyle)knobStyle;
 - (void)setExpanded:(BOOL)expanded;
+- (BOOL)isExpanded;
 - (void)setDelegate:(id)delegate;
 - (void)setUiStateTransitionProgress:(CGFloat)uiStateTransitionProgress;
 - (BOOL)isHorizontal;