Unreviewed, rolling out r93645.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Aug 2011 01:00:07 +0000 (01:00 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Aug 2011 01:00:07 +0000 (01:00 +0000)
http://trac.webkit.org/changeset/93645
https://bugs.webkit.org/show_bug.cgi?id=66828

Broke webkit_unit_tests on chromium mac (Requested by jamesr
on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2011-08-23

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

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

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

index bbc2646..fe569ea 100644 (file)
@@ -1,3 +1,16 @@
+2011-08-23  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r93645.
+        http://trac.webkit.org/changeset/93645
+        https://bugs.webkit.org/show_bug.cgi?id=66828
+
+        Broke webkit_unit_tests on chromium mac (Requested by jamesr
+        on #webkit).
+
+        * platform/chromium/ScrollbarThemeChromiumMac.mm:
+        (WebCore::ScrollbarThemeChromiumMac::ScrollbarThemeChromiumMac):
+        (WebCore::ScrollbarThemeChromiumMac::paintOverhangAreas):
+
 2011-08-23  Beth Dakin  <bdakin@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=66244
index 1466839..4af973d 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.
 
@@ -194,9 +200,24 @@ ScrollbarThemeChromiumMac::ScrollbarThemeChromiumMac()
     if (!initialized) {
         initialized = true;
 
-        // Load the linen pattern image used for overhang drawing.
-        RefPtr<Image> patternImage = Image::loadPlatformResource("overhangPattern");
-        m_overhangPattern = Pattern::create(patternImage, true, 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);
+                }
+            }
+        }
 
         [ScrollbarPrefsObserver registerAsObserver];
         preferencesChanged();
@@ -697,7 +718,11 @@ void ScrollbarThemeChromiumMac::paintOverhangAreas(ScrollView* view, GraphicsCon
 
     context->save();
 
-    context->setFillPattern(m_overhangPattern);
+    if (m_overhangPattern.get())
+        context->setFillPattern(m_overhangPattern);
+    else    
+        context->setFillColor(Color::darkGray, ColorSpaceDeviceRGB);
+
     if (hasHorizontalOverhang)
         context->fillRect(intersection(horizontalOverhangRect, dirtyRect));
     if (hasVerticalOverhang)