[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

bdakin at apple.com bdakin at apple.com
Sun Feb 20 23:29:06 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit f76bd26bd24eaaa47f91f4df5b8747d4c7758b35
Author: bdakin at apple.com <bdakin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 20 23:18:35 2011 +0000

    Fix for <rdar://problem/8890255>
    
    Reviewed by Geoffrey Garen.
    
    Source/WebCore:
    
    Allow WebKitSystemInterface to draw scrollbars
    when appropriate.
    * WebCore.exp.in:
    * platform/mac/ScrollbarThemeMac.mm:
    (WebCore::scrollbarMap):
    (+[ScrollbarPrefsObserver appearancePrefsChanged:]):
    (WebCore::ScrollbarThemeMac::registerScrollbar):
    (WebCore::ScrollbarThemeMac::unregisterScrollbar):
    (WebCore::ScrollbarThemeMac::paint):
    * platform/mac/WebCoreSystemInterface.h:
    * platform/mac/WebCoreSystemInterface.mm:
    
    Source/WebKit/mac:
    
    Allow WebKitSystemInterface to draw scrollbars
    when appropriate.
    * WebCoreSupport/WebSystemInterface.mm:
    (InitWebCoreSystemInterface):
    
    Source/WebKit2:
    
    Allow WebKitSystemInterface to draw scrollbars
    when appropriate.
    * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
    (InitWebCoreSystemInterface):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76292 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index a8d9203..5f9829d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-20  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        Fix for <rdar://problem/8890255>
+
+        Allow WebKitSystemInterface to draw scrollbars 
+        when appropriate.
+        * WebCore.exp.in:
+        * platform/mac/ScrollbarThemeMac.mm:
+        (WebCore::scrollbarMap):
+        (+[ScrollbarPrefsObserver appearancePrefsChanged:]):
+        (WebCore::ScrollbarThemeMac::registerScrollbar):
+        (WebCore::ScrollbarThemeMac::unregisterScrollbar):
+        (WebCore::ScrollbarThemeMac::paint):
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+
 2011-01-20  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Dave Hyatt.
diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in
index fcb8a00..efa8615 100644
--- a/Source/WebCore/WebCore.exp.in
+++ b/Source/WebCore/WebCore.exp.in
@@ -1288,6 +1288,8 @@ _wkSignalCFReadStreamHasBytes
 _wkCreateCTTypesetterWithUniCharProviderAndOptions
 _wkIOSurfaceContextCreate
 _wkIOSurfaceContextCreateImage
+_wkMakeScrollbarPainter
+_wkScrollbarPainterPaint
 #endif
 
 #if ENABLE(3D_RENDERING)
diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
index 3266b8f..d27a3c6 100644
--- a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
+++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
@@ -27,18 +27,39 @@
 #include "ScrollbarThemeMac.h"
 
 #include "ImageBuffer.h"
+#include "LocalCurrentGraphicsContext.h"
 #include "PlatformMouseEvent.h"
 #include "ScrollView.h"
+#include "WebCoreSystemInterface.h"
 #include <Carbon/Carbon.h>
+#include <wtf/HashMap.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/UnusedParam.h>
 
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#define USE_WK_SCROLLBAR_PAINTER
+#endif
+
 // FIXME: There are repainting problems due to Aqua scroll bar buttons' visual overflow.
 
 using namespace std;
 using namespace WebCore;
 
-static HashSet<Scrollbar*>* gScrollbars;
+namespace WebCore {
+
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+typedef HashMap<Scrollbar*, RetainPtr<WKScrollbarPainterRef> > ScrollbarPainterMap;
+#else
+typedef HashSet<Scrollbar*> ScrollbarPainterMap;
+#endif
+
+static ScrollbarPainterMap* scrollbarMap()
+{
+    static ScrollbarPainterMap* map = new ScrollbarPainterMap;
+    return map;
+}
+    
+}
 
 @interface ScrollbarPrefsObserver : NSObject
 {
@@ -58,12 +79,17 @@ static HashSet<Scrollbar*>* gScrollbars;
     UNUSED_PARAM(unusedNotification);
 
     static_cast<ScrollbarThemeMac*>(ScrollbarTheme::nativeTheme())->preferencesChanged();
-    if (!gScrollbars)
+    if (scrollbarMap()->isEmpty())
         return;
-    HashSet<Scrollbar*>::iterator end = gScrollbars->end();
-    for (HashSet<Scrollbar*>::iterator it = gScrollbars->begin(); it != end; ++it) {
+    ScrollbarPainterMap::iterator end = scrollbarMap()->end();
+    for (ScrollbarPainterMap::iterator it = scrollbarMap()->begin(); it != end; ++it) {
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+        it->first->styleChanged();
+        it->first->invalidate();
+#else
         (*it)->styleChanged();
         (*it)->invalidate();
+#endif
     }
 }
 
@@ -122,18 +148,18 @@ static void updateArrowPlacement()
 
 void ScrollbarThemeMac::registerScrollbar(Scrollbar* scrollbar)
 {
-    if (!gScrollbars)
-        gScrollbars = new HashSet<Scrollbar*>;
-    gScrollbars->add(scrollbar);
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+    WKScrollbarPainterRef scrollbarPainter = wkMakeScrollbarPainter(scrollbar->controlSize(),
+        scrollbar->orientation() == HorizontalScrollbar);
+    scrollbarMap()->add(scrollbar, scrollbarPainter);
+#else
+    scrollbarMap()->add(scrollbar);
+#endif
 }
 
 void ScrollbarThemeMac::unregisterScrollbar(Scrollbar* scrollbar)
 {
-    gScrollbars->remove(scrollbar);
-    if (gScrollbars->isEmpty()) {
-        delete gScrollbars;
-        gScrollbars = 0;
-    }
+    scrollbarMap()->remove(scrollbar);
 }
 
 ScrollbarThemeMac::ScrollbarThemeMac()
@@ -361,6 +387,20 @@ static int scrollbarPartToHIPressedState(ScrollbarPart part)
 
 bool ScrollbarThemeMac::paint(Scrollbar* scrollbar, GraphicsContext* context, const IntRect& damageRect)
 {
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+    context->save();
+    context->clip(damageRect);
+    context->translate(scrollbar->frameRect().x(), scrollbar->frameRect().y());
+    LocalCurrentGraphicsContext localContext(context);
+    wkScrollbarPainterPaint(scrollbarMap()->get(scrollbar).get(),
+                            scrollbar->enabled(),
+                            scrollbar->currentPos() / scrollbar->maximum(),
+                            static_cast<CGFloat>(scrollbar->visibleSize()) / scrollbar->totalSize(),
+                            scrollbar->frameRect());
+    context->restore();
+    return true;
+#endif
+
     HIThemeTrackDrawInfo trackInfo;
     trackInfo.version = 0;
     trackInfo.kind = scrollbar->controlSize() == RegularScrollbar ? kThemeMediumScrollBar : kThemeSmallScrollBar;
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
index 0c78c23..045864a 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
@@ -186,6 +186,10 @@ extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(cons
 
 extern CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
 extern CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
+
+typedef struct __WKScrollbarPainter *WKScrollbarPainterRef;
+extern WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
+extern void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
 #endif
 
 }
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
index df3c77c..047827f 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
@@ -125,4 +125,7 @@ CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniCh
 
 CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
 CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
+
+WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
+void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
 #endif
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index 4f0d2ef..da6e1e3 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,14 @@
+2011-01-20  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        Fix for <rdar://problem/8890255>
+
+        Allow WebKitSystemInterface to draw scrollbars 
+        when appropriate.
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2011-01-19  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
index e1c1058..70767ee 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
@@ -123,6 +123,8 @@ void InitWebCoreSystemInterface(void)
     INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
     INIT(IOSurfaceContextCreate);
     INIT(IOSurfaceContextCreateImage);
+    INIT(MakeScrollbarPainter);
+    INIT(ScrollbarPainterPaint);
 #endif
 
     didInit = true;
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 5339117..703bf66 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,14 @@
+2011-01-20  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        Fix for <rdar://problem/8890255>
+
+        Allow WebKitSystemInterface to draw scrollbars 
+        when appropriate.
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2011-01-20  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Dave Hyatt.
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
index 90b9a64..f81b627 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
@@ -93,6 +93,8 @@ void InitWebCoreSystemInterface(void)
 
 #if !defined(BUILDING_ON_SNOW_LEOPARD)
         INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
+        INIT(MakeScrollbarPainter);
+        INIT(ScrollbarPainterPaint);
 #else
         INIT(GetHyphenationLocationBeforeIndex);
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list