[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:57:17 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 5ce11413d78d0735f4d7656f76749a4dedef9d2b
Author: bdakin at apple.com <bdakin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 27 04:08:49 2011 +0000

    Fix for <rdar://problem/8895140> Adopt WKScrollbar metrics
    when using WKScrollbars.
    
    Reviewed by Darin Adler.
    
    Source/WebCore:
    
    New WebKitSystemInterface Functionality.
    * WebCore.exp.in:
    * platform/mac/WebCoreSystemInterface.h:
    * platform/mac/WebCoreSystemInterface.mm:
    
    Some of the terrible static arrays are now only needed in the
    old non-WK code, so they are if-def'd now.
    * platform/mac/ScrollbarThemeMac.mm:
    
    Just patching this function in a better way than I did
    before.
    (WebCore::updateArrowPlacement):
    
    Call into WK for the right values.
    (WebCore::ScrollbarThemeMac::scrollbarThickness):
    (WebCore::ScrollbarThemeMac::hasThumb):
    (WebCore::ScrollbarThemeMac::minimumThumbLength):
    
    Return false if there are no buttons.
    (WebCore::ScrollbarThemeMac::hasButtons):
    
    Return an empty IntRect if there are not buttons.
    (WebCore::buttonRepaintRect):
    
    Source/WebKit/mac:
    
    * WebCoreSupport/WebSystemInterface.mm:
    (InitWebCoreSystemInterface):
    
    Source/WebKit2:
    
    * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
    (InitWebCoreSystemInterface):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76754 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 49b4af4..94b2d34 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2011-01-26  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix for <rdar://problem/8895140> Adopt WKScrollbar metrics 
+        when using WKScrollbars.
+
+        New WebKitSystemInterface Functionality.
+        * WebCore.exp.in:
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+
+        Some of the terrible static arrays are now only needed in the 
+        old non-WK code, so they are if-def'd now.
+        * platform/mac/ScrollbarThemeMac.mm:
+        
+        Just patching this function in a better way than I did
+        before.
+        (WebCore::updateArrowPlacement):
+        
+        Call into WK for the right values.
+        (WebCore::ScrollbarThemeMac::scrollbarThickness):
+        (WebCore::ScrollbarThemeMac::hasThumb):
+        (WebCore::ScrollbarThemeMac::minimumThumbLength):
+        
+        Return false if there are no buttons.
+        (WebCore::ScrollbarThemeMac::hasButtons):
+
+        Return an empty IntRect if there are not buttons.
+        (WebCore::buttonRepaintRect):
+
 2011-01-26  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Maciej Stachowiak.
diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in
index db5feb2..a4a2628 100644
--- a/Source/WebCore/WebCore.exp.in
+++ b/Source/WebCore/WebCore.exp.in
@@ -1293,6 +1293,9 @@ _wkIOSurfaceContextCreate
 _wkIOSurfaceContextCreateImage
 _wkMakeScrollbarPainter
 _wkScrollbarPainterPaint
+_wkScrollbarThickness
+_wkScrollbarMinimumThumbLength
+_wkScrollbarMinimumTotalLengthNeededForThumb
 #endif
 
 #if ENABLE(3D_RENDERING)
diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
index 032d9f3..48ef52b 100644
--- a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
+++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
@@ -117,13 +117,15 @@ ScrollbarTheme* ScrollbarTheme::nativeTheme()
 }
 
 // FIXME: Get these numbers from CoreUI.
-static int cScrollbarThickness[] = { 15, 11 };
 static int cRealButtonLength[] = { 28, 21 };
-static int cButtonInset[] = { 14, 11 };
 static int cButtonHitInset[] = { 3, 2 };
 // cRealButtonLength - cButtonInset
 static int cButtonLength[] = { 14, 10 };
+#if !defined(USE_WK_SCROLLBAR_PAINTER)
+static int cScrollbarThickness[] = { 15, 11 };
+static int cButtonInset[] = { 14, 11 };
 static int cThumbMinLength[] = { 26, 20 };
+#endif
 
 static int cOuterButtonLength[] = { 16, 14 }; // The outer button in a double button pair is a bit bigger.
 static int cOuterButtonOverlap = 2;
@@ -131,13 +133,15 @@ static int cOuterButtonOverlap = 2;
 static float gInitialButtonDelay = 0.5f;
 static float gAutoscrollButtonDelay = 0.05f;
 static bool gJumpOnTrackClick = false;
+
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+static ScrollbarButtonsPlacement gButtonPlacement = ScrollbarButtonsNone;
+#else
 static ScrollbarButtonsPlacement gButtonPlacement = ScrollbarButtonsDoubleEnd;
+#endif
 
 static void updateArrowPlacement()
 {
-#if defined(USE_WK_SCROLLBAR_PAINTER)
-    gButtonPlacement = ScrollbarButtonsNone;
-#else
     NSString *buttonPlacement = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleScrollBarVariant"];
     if ([buttonPlacement isEqualToString:@"Single"])
         gButtonPlacement = ScrollbarButtonsSingle;
@@ -145,9 +149,13 @@ static void updateArrowPlacement()
         gButtonPlacement = ScrollbarButtonsDoubleStart;
     else if ([buttonPlacement isEqualToString:@"DoubleBoth"])
         gButtonPlacement = ScrollbarButtonsDoubleBoth;
-    else
-        gButtonPlacement = ScrollbarButtonsDoubleEnd; // The default is ScrollbarButtonsDoubleEnd.
+    else {
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+        gButtonPlacement = ScrollbarButtonsNone;
+#else
+        gButtonPlacement = ScrollbarButtonsDoubleEnd;
 #endif
+    }
 }
 
 void ScrollbarThemeMac::registerScrollbar(Scrollbar* scrollbar)
@@ -192,7 +200,11 @@ void ScrollbarThemeMac::preferencesChanged()
 
 int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize)
 {
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+    return wkScrollbarThickness(controlSize);
+#else
     return cScrollbarThickness[controlSize];
+#endif
 }
 
 bool ScrollbarThemeMac::usesOverlayScrollbars() const
@@ -218,20 +230,29 @@ ScrollbarButtonsPlacement ScrollbarThemeMac::buttonsPlacement() const
 
 bool ScrollbarThemeMac::hasButtons(Scrollbar* scrollbar)
 {
-    return scrollbar->enabled() && (scrollbar->orientation() == HorizontalScrollbar ? 
-             scrollbar->width() : 
-             scrollbar->height()) >= 2 * (cRealButtonLength[scrollbar->controlSize()] - cButtonHitInset[scrollbar->controlSize()]);
+    return scrollbar->enabled() && gButtonPlacement != ScrollbarButtonsNone
+             && (scrollbar->orientation() == HorizontalScrollbar
+             ? scrollbar->width()
+             : scrollbar->height()) >= 2 * (cRealButtonLength[scrollbar->controlSize()] - cButtonHitInset[scrollbar->controlSize()]);
 }
 
 bool ScrollbarThemeMac::hasThumb(Scrollbar* scrollbar)
 {
+    int minLengthForThumb;
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+    minLengthForThumb = wkScrollbarMinimumTotalLengthNeededForThumb(scrollbarMap()->get(scrollbar).get());
+#else
+    minLengthForThumb = 2 * cButtonInset[scrollbar->controlSize()] + cThumbMinLength[scrollbar->controlSize()] + 1;
+#endif
     return scrollbar->enabled() && (scrollbar->orientation() == HorizontalScrollbar ? 
              scrollbar->width() : 
-             scrollbar->height()) >= 2 * cButtonInset[scrollbar->controlSize()] + cThumbMinLength[scrollbar->controlSize()] + 1;
+             scrollbar->height()) >= minLengthForThumb;
 }
 
 static IntRect buttonRepaintRect(const IntRect& buttonRect, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, bool start)
 {
+    ASSERT(gButtonPlacement != ScrollbarButtonsNone);
+
     IntRect paintRect(buttonRect);
     if (orientation == HorizontalScrollbar) {
         paintRect.setWidth(cRealButtonLength[controlSize]);
@@ -359,7 +380,11 @@ IntRect ScrollbarThemeMac::trackRect(Scrollbar* scrollbar, bool painting)
 
 int ScrollbarThemeMac::minimumThumbLength(Scrollbar* scrollbar)
 {
+#if defined(USE_WK_SCROLLBAR_PAINTER)
+    return wkScrollbarMinimumThumbLength(scrollbarMap()->get(scrollbar).get());
+#else
     return cThumbMinLength[scrollbar->controlSize()];
+#endif
 }
 
 bool ScrollbarThemeMac::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt)
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
index 045864a..4e5f9ce 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
@@ -190,6 +190,9 @@ 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);
+extern int (*wkScrollbarThickness)(int controlSize);
+extern int (*wkScrollbarMinimumThumbLength)(WKScrollbarPainterRef);
+extern int (*wkScrollbarMinimumTotalLengthNeededForThumb)(WKScrollbarPainterRef);
 #endif
 
 }
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
index 047827f..08a5023 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
@@ -128,4 +128,7 @@ CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
 
 WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
 void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
+int (*wkScrollbarThickness)(int controlSize);
+int (*wkScrollbarMinimumThumbLength)(WKScrollbarPainterRef);
+int (*wkScrollbarMinimumTotalLengthNeededForThumb)(WKScrollbarPainterRef);
 #endif
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index 1f4e3c4..2831e56 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-26  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix for <rdar://problem/8895140> Adopt WKScrollbar metrics 
+        when using WKScrollbars.
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2011-01-25  Darin Adler  <darin at apple.com>
 
         Reviewed by Anders Carlsson.
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
index 70767ee..483d6d6 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
@@ -125,6 +125,9 @@ void InitWebCoreSystemInterface(void)
     INIT(IOSurfaceContextCreateImage);
     INIT(MakeScrollbarPainter);
     INIT(ScrollbarPainterPaint);
+    INIT(ScrollbarThickness);
+    INIT(ScrollbarMinimumThumbLength);
+    INIT(ScrollbarMinimumTotalLengthNeededForThumb);
 #endif
 
     didInit = true;
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 5473a23..5f61189 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-26  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix for <rdar://problem/8895140> Adopt WKScrollbar metrics 
+        when using WKScrollbars.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2011-01-26  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Maciej Stachowiak.
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
index f81b627..3d8bae7 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
@@ -95,6 +95,9 @@ void InitWebCoreSystemInterface(void)
         INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
         INIT(MakeScrollbarPainter);
         INIT(ScrollbarPainterPaint);
+        INIT(ScrollbarThickness);
+        INIT(ScrollbarMinimumThumbLength);
+        INIT(ScrollbarMinimumTotalLengthNeededForThumb);
 #else
         INIT(GetHyphenationLocationBeforeIndex);
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list