Chromium Mac: Use a custom pattern image for rubber banding overhang area
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Aug 2011 22:59:34 +0000 (22:59 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Aug 2011 22:59:34 +0000 (22:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=66707

Patch by Alexei Svitkine <asvitkine@chromium.org> on 2011-08-23
Reviewed by Dimitri Glazkov.

No new tests since its just changing the Chromium-specific overhang pattern.

* platform/chromium/ScrollbarThemeChromiumMac.mm:
(WebCore::ScrollbarThemeChromiumMac::ScrollbarThemeChromiumMac):
(WebCore::ScrollbarThemeChromiumMac::paintOverhangAreas):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm

index 92fb889..41b9119 100644 (file)
@@ -1,3 +1,16 @@
+2011-08-23  Alexei Svitkine  <asvitkine@chromium.org>
+
+        Chromium Mac: Use a custom pattern image for rubber banding overhang area
+        https://bugs.webkit.org/show_bug.cgi?id=66707
+
+        Reviewed by Dimitri Glazkov.
+
+        No new tests since its just changing the Chromium-specific overhang pattern.
+
+        * platform/chromium/ScrollbarThemeChromiumMac.mm:
+        (WebCore::ScrollbarThemeChromiumMac::ScrollbarThemeChromiumMac):
+        (WebCore::ScrollbarThemeChromiumMac::paintOverhangAreas):
+
 2011-08-23  Tatiana Meshkova  <tatiana.meshkova@nokia.com>
 
         Prepare to paint slider thumb separately.
index 4af973d..1466839 100644 (file)
 #include <wtf/UnusedParam.h>
 
 #if USE(SKIA)
-#include "BitmapImageSingleFrameSkia.h"
 #include "PlatformContextSkia.h"
 #include "skia/ext/skia_utils_mac.h"
 #endif
 
 
-// Undocumented Lion method to get the pattern for the over-scroll area.
-@interface NSColor (LionSekretAPI)
-+ (NSImage*)_linenPatternImage;
-@end
-
 
 // FIXME: There are repainting problems due to Aqua scroll bar buttons' visual overflow.
 
@@ -200,24 +194,9 @@ ScrollbarThemeChromiumMac::ScrollbarThemeChromiumMac()
     if (!initialized) {
         initialized = true;
 
-        // Load the linen pattern image used for overhang drawing if available.
-        if ([NSColor respondsToSelector:@selector(_linenPatternImage)]) {
-            NSImage* image = [NSColor _linenPatternImage];
-            if (image) {
-                NSData* tiffData =  [image TIFFRepresentation];
-                if (tiffData) {
-                    CGImageSourceRef imageSource = CGImageSourceCreateWithData((CFDataRef)tiffData, NULL);
-                    CGImageRef cgImage = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL);
-#if USE(SKIA)
-                    SkBitmap bitmap = gfx::CGImageToSkBitmap(cgImage);
-                    RefPtr<Image> patternImage = BitmapImageSingleFrameSkia::create(bitmap, false);
-#else
-                    RefPtr<Image> patternImage = BitmapImage::create(cgImage);
-#endif                    
-                    m_overhangPattern = Pattern::create(patternImage, true, true);
-                }
-            }
-        }
+        // Load the linen pattern image used for overhang drawing.
+        RefPtr<Image> patternImage = Image::loadPlatformResource("overhangPattern");
+        m_overhangPattern = Pattern::create(patternImage, true, true);
 
         [ScrollbarPrefsObserver registerAsObserver];
         preferencesChanged();
@@ -718,11 +697,7 @@ void ScrollbarThemeChromiumMac::paintOverhangAreas(ScrollView* view, GraphicsCon
 
     context->save();
 
-    if (m_overhangPattern.get())
-        context->setFillPattern(m_overhangPattern);
-    else    
-        context->setFillColor(Color::darkGray, ColorSpaceDeviceRGB);
-
+    context->setFillPattern(m_overhangPattern);
     if (hasHorizontalOverhang)
         context->fillRect(intersection(horizontalOverhangRect, dirtyRect));
     if (hasVerticalOverhang)