Title: [89073] trunk/Source/WebCore
Revision
89073
Author
[email protected]
Date
2011-06-16 15:08:11 -0700 (Thu, 16 Jun 2011)

Log Message

2011-06-16  Sailesh Agrawal  <[email protected]>

        Reviewed by Mihai Parparita.

        [Chromium] Draw search tickmarks on overlay scrollbars
        https://bugs.webkit.org/show_bug.cgi?id=62783

        This change adds search tickmark support for overlay scrollbars. Tickmarks are only drawn when the scroll track is visible.

        * platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.h:Split the scrollbar drawing code into a track and knob version.
        * platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.mm:
        (wkScrollbarPainterPaint):
        (wkScrollbarPainterPaintTrack):
        (wkScrollbarPainterPaintKnob):
        * platform/chromium/ScrollbarThemeChromiumMac.h:
        * platform/chromium/ScrollbarThemeChromiumMac.mm:Factor out the paint tickmark code and call it from the overlay scrollbar drawing code.
        (WebCore::ScrollbarThemeChromiumMac::paint):
        (WebCore::ScrollbarThemeChromiumMac::paintTickmarks):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89072 => 89073)


--- trunk/Source/WebCore/ChangeLog	2011-06-16 22:08:04 UTC (rev 89072)
+++ trunk/Source/WebCore/ChangeLog	2011-06-16 22:08:11 UTC (rev 89073)
@@ -1,3 +1,22 @@
+2011-06-16  Sailesh Agrawal  <[email protected]>
+
+        Reviewed by Mihai Parparita.
+
+        [Chromium] Draw search tickmarks on overlay scrollbars
+        https://bugs.webkit.org/show_bug.cgi?id=62783
+
+        This change adds search tickmark support for overlay scrollbars. Tickmarks are only drawn when the scroll track is visible.
+
+        * platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.h:Split the scrollbar drawing code into a track and knob version.
+        * platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.mm:
+        (wkScrollbarPainterPaint):
+        (wkScrollbarPainterPaintTrack):
+        (wkScrollbarPainterPaintKnob):
+        * platform/chromium/ScrollbarThemeChromiumMac.h:
+        * platform/chromium/ScrollbarThemeChromiumMac.mm:Factor out the paint tickmark code and call it from the overlay scrollbar drawing code.
+        (WebCore::ScrollbarThemeChromiumMac::paint):
+        (WebCore::ScrollbarThemeChromiumMac::paintTickmarks):
+
 2011-06-16  Geoffrey Garen  <[email protected]>
 
         Reviewed by Oliver Hunt.

Modified: trunk/Source/WebCore/platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.h (89072 => 89073)


--- trunk/Source/WebCore/platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.h	2011-06-16 22:08:04 UTC (rev 89072)
+++ trunk/Source/WebCore/platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.h	2011-06-16 22:08:11 UTC (rev 89073)
@@ -57,6 +57,8 @@
 CGFloat wkScrollbarPainterKnobAlpha(WKScrollbarPainterRef);
 void wkScrollbarPainterSetOverlayState(WKScrollbarPainterRef, int overlayScrollerState);
 void wkScrollbarPainterPaint(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, NSRect frameRect);
+void wkScrollbarPainterPaintTrack(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, NSRect frameRect);
+void wkScrollbarPainterPaintKnob(WKScrollbarPainterRef);
 int wkScrollbarMinimumThumbLength(WKScrollbarPainterRef);
 void wkScrollbarPainterSetDelegate(WKScrollbarPainterRef, id scrollbarPainterDelegate);
 CGFloat wkScrollbarPainterTrackAlpha(WKScrollbarPainterRef);

Modified: trunk/Source/WebCore/platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.mm (89072 => 89073)


--- trunk/Source/WebCore/platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.mm	2011-06-16 22:08:04 UTC (rev 89072)
+++ trunk/Source/WebCore/platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.mm	2011-06-16 22:08:11 UTC (rev 89073)
@@ -152,6 +152,12 @@
 
 void wkScrollbarPainterPaint(WKScrollbarPainterRef painter, bool enabled, double value, CGFloat proportion, NSRect frameRect)
 {
+    wkScrollbarPainterPaintTrack(painter, enabled, value, proportion, frameRect);
+    wkScrollbarPainterPaintKnob(painter);
+}
+
+void wkScrollbarPainterPaintTrack(WKScrollbarPainterRef painter, bool enabled, double value, CGFloat proportion, NSRect frameRect)
+{
     [painter setEnabled:enabled];
     [painter setBoundsSize:frameRect.size];
     [painter setDoubleValue:value];
@@ -164,6 +170,10 @@
     frameRect.origin = NSZeroPoint;
 
     [painter drawKnobSlotInRect:frameRect highlight:NO];
+}
+
+void wkScrollbarPainterPaintKnob(WKScrollbarPainterRef painter)
+{
     [painter drawKnob];
 }
 

Modified: trunk/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.h (89072 => 89073)


--- trunk/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.h	2011-06-16 22:08:04 UTC (rev 89072)
+++ trunk/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.h	2011-06-16 22:08:11 UTC (rev 89073)
@@ -71,6 +71,8 @@
     virtual bool shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent&);
     virtual bool shouldDragDocumentInsteadOfThumb(Scrollbar*, const PlatformMouseEvent&);
 
+    void paintTickmarks(Scrollbar*, GraphicsContext* drawingContext, bool canDrawDirectly, float alpha);
+
 public:
     void preferencesChanged();
 };

Modified: trunk/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm (89072 => 89073)


--- trunk/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm	2011-06-16 22:08:04 UTC (rev 89072)
+++ trunk/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm	2011-06-16 22:08:11 UTC (rev 89073)
@@ -479,11 +479,16 @@
         context->clip(damageRect);
         context->translate(scrollbar->frameRect().x(), scrollbar->frameRect().y());
         LocalCurrentGraphicsContext localContext(context);
-        wkScrollbarPainterPaint(scrollbarMap()->get(scrollbar).get(),
-                                scrollbar->enabled(),
-                                value,
-                                (static_cast<CGFloat>(scrollbar->visibleSize()) - overhang) / scrollbar->totalSize(),
-                                scrollbar->frameRect());
+        WKScrollbarPainterRef scrollbarPainter = scrollbarMap()->get(scrollbar).get();
+        wkScrollbarPainterPaintTrack(scrollbarPainter,
+                                     scrollbar->enabled(),
+                                     value,
+                                     (static_cast<CGFloat>(scrollbar->visibleSize()) - overhang) / scrollbar->totalSize(),
+                                     scrollbar->frameRect());
+        CGFloat trackAlpha = wkScrollbarPainterTrackAlpha(scrollbarPainter);
+        if (trackAlpha >= 0.0)
+            paintTickmarks(scrollbar, context, false, trackAlpha);
+        wkScrollbarPainterPaintKnob(scrollbarPainter);
 
         scrollAnimator->setIsDrawingIntoLayer(false);
         return true;
@@ -544,13 +549,40 @@
 #endif
     HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal);
 
+    paintTickmarks(scrollbar, drawingContext, canDrawDirectly, 1.0);
+
+    if (hasThumb(scrollbar)) {
+        PlatformBridge::ThemePaintScrollbarInfo scrollbarInfo;
+        scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScrollbar ? PlatformBridge::ScrollbarOrientationHorizontal : PlatformBridge::ScrollbarOrientationVertical;
+        scrollbarInfo.parent = scrollbar->parent() && scrollbar->parent()->isFrameView() && static_cast<FrameView*>(scrollbar->parent())->isScrollViewScrollbar(scrollbar) ? PlatformBridge::ScrollbarParentScrollView : PlatformBridge::ScrollbarParentRenderLayer;
+        scrollbarInfo.maxValue = scrollbar->maximum();
+        scrollbarInfo.currentValue = scrollbar->currentPos();
+        scrollbarInfo.visibleSize = scrollbar->visibleSize();
+        scrollbarInfo.totalSize = scrollbar->totalSize();
+
+        PlatformBridge::paintScrollbarThumb(
+            drawingContext,
+            scrollbarStateToThemeState(scrollbar),
+            scrollbar->controlSize() == RegularScrollbar ? PlatformBridge::SizeRegular : PlatformBridge::SizeSmall,
+            scrollbar->frameRect(),
+            scrollbarInfo);
+    }
+
+    if (!canDrawDirectly)
+        context->drawImageBuffer(imageBuffer.get(), ColorSpaceDeviceRGB, scrollbar->frameRect().location());
+
+    return true;
+}
+
+void ScrollbarThemeChromiumMac::paintTickmarks(Scrollbar* scrollbar, GraphicsContext* drawingContext, bool canDrawDirectly, float alpha) {
     Vector<IntRect> tickmarks;
     scrollbar->scrollableArea()->getTickmarks(tickmarks);
     if (scrollbar->orientation() == VerticalScrollbar && tickmarks.size()) {
         drawingContext->save();
         drawingContext->setShouldAntialias(false);
-        drawingContext->setStrokeColor(Color(0xCC, 0xAA, 0x00, 0xFF), ColorSpaceDeviceRGB);
-        drawingContext->setFillColor(Color(0xFF, 0xDD, 0x00, 0xFF), ColorSpaceDeviceRGB);
+        int alphaInt = 0xFF * alpha;
+        drawingContext->setStrokeColor(Color(0xCC, 0xAA, 0x00, alphaInt), ColorSpaceDeviceRGB);
+        drawingContext->setFillColor(Color(0xFF, 0xDD, 0x00, alphaInt), ColorSpaceDeviceRGB);
 
         IntRect thumbArea = trackRect(scrollbar, false);
         if (!canDrawDirectly) {
@@ -578,28 +610,6 @@
 
         drawingContext->restore();
     }
-
-    if (hasThumb(scrollbar)) {
-        PlatformBridge::ThemePaintScrollbarInfo scrollbarInfo;
-        scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScrollbar ? PlatformBridge::ScrollbarOrientationHorizontal : PlatformBridge::ScrollbarOrientationVertical;
-        scrollbarInfo.parent = scrollbar->parent() && scrollbar->parent()->isFrameView() && static_cast<FrameView*>(scrollbar->parent())->isScrollViewScrollbar(scrollbar) ? PlatformBridge::ScrollbarParentScrollView : PlatformBridge::ScrollbarParentRenderLayer;
-        scrollbarInfo.maxValue = scrollbar->maximum();
-        scrollbarInfo.currentValue = scrollbar->currentPos();
-        scrollbarInfo.visibleSize = scrollbar->visibleSize();
-        scrollbarInfo.totalSize = scrollbar->totalSize();
-
-        PlatformBridge::paintScrollbarThumb(
-            drawingContext,
-            scrollbarStateToThemeState(scrollbar),
-            scrollbar->controlSize() == RegularScrollbar ? PlatformBridge::SizeRegular : PlatformBridge::SizeSmall,
-            scrollbar->frameRect(),
-            scrollbarInfo);
-    }
-
-    if (!canDrawDirectly)
-        context->drawImageBuffer(imageBuffer.get(), ColorSpaceDeviceRGB, scrollbar->frameRect().location());
-
-    return true;
 }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to