[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

mihaip at chromium.org mihaip at chromium.org
Fri Jan 21 14:38:52 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 932c7635c5f5084ac551a1475fdada6e466d2885
Author: mihaip at chromium.org <mihaip at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 23 22:23:58 2010 +0000

    2010-12-23  Mihai Parparita  <mihaip at chromium.org>
    
            Reviewed by Kent Tamura.
    
            [Chromium] Add WebThemeEngine for Mac to allow scrollbar rendering to be overridden for the DRT
            https://bugs.webkit.org/show_bug.cgi?id=51507
    
            Adds WebThemeEngine for the Mac (it already has parallel definitions for
            Windows and Linux) so that scrollbar thumb rendering can be overridden
            for the DRT (to be consistent with the NSScroller-based rendering
            used by the Mac port).
    
            No new tests since the functionality is not exposed yet. Eventually will
            result in the Chromium/Mac port being able to use the same pixel
            baselines for layout tests as the Mac port.
    
            * platform/chromium/ChromiumBridge.h:
            * platform/chromium/ScrollbarThemeChromiumMac.mm:
            (WebCore::scrollbarStateToThemeState):
            (WebCore::ScrollbarThemeChromiumMac::paint):
    2010-12-23  Mihai Parparita  <mihaip at chromium.org>
    
            Reviewed by Kent Tamura.
    
            [Chromium] Add WebThemeEngine for Mac to allow scrollbar rendering to be overridden for the DRT
            https://bugs.webkit.org/show_bug.cgi?id=51507
    
            Adds WebThemeEngine for the Mac (it already has parallel definitions for
            Windows and Linux) so that scrollbar thumb rendering can be overridden
            for the DRT (to be consistent with the NSScroller-based rendering
            used by the Mac port).
    
            * public/mac/WebThemeEngine.h: Added.
            (WebKit::WebThemeEngine::paintScrollbarThumb):
            * src/AssertMatchingEnums.cpp:
            * src/ChromiumBridge.cpp:
            (WebCore::ChromiumBridge::paintScrollbarThumb):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74581 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e168e76..cc3fb3a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-12-23  Mihai Parparita  <mihaip at chromium.org>
+
+        Reviewed by Kent Tamura.
+
+        [Chromium] Add WebThemeEngine for Mac to allow scrollbar rendering to be overridden for the DRT
+        https://bugs.webkit.org/show_bug.cgi?id=51507
+        
+        Adds WebThemeEngine for the Mac (it already has parallel definitions for
+        Windows and Linux) so that scrollbar thumb rendering can be overridden
+        for the DRT (to be consistent with the NSScroller-based rendering
+        used by the Mac port).
+
+        No new tests since the functionality is not exposed yet. Eventually will
+        result in the Chromium/Mac port being able to use the same pixel
+        baselines for layout tests as the Mac port.
+
+        * platform/chromium/ChromiumBridge.h:
+        * platform/chromium/ScrollbarThemeChromiumMac.mm:
+        (WebCore::scrollbarStateToThemeState):
+        (WebCore::ScrollbarThemeChromiumMac::paint):
+
 2010-12-23  Darin Adler  <darin at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h
index ab68997..ebe48bd 100644
--- a/WebCore/platform/chromium/ChromiumBridge.h
+++ b/WebCore/platform/chromium/ChromiumBridge.h
@@ -307,6 +307,39 @@ namespace WebCore {
         static IntSize getThemePartSize(ThemePart);
         // Paint the given the given theme part.
         static void paintThemePart(GraphicsContext*, ThemePart, ThemePaintState, const IntRect&, const ThemePaintExtraParams*);
+#elif OS(DARWIN)
+        enum ThemePaintState {
+            StateDisabled,
+            StateInactive,
+            StateActive,
+            StatePressed,
+        };
+
+        enum ThemePaintSize {
+            SizeRegular,
+            SizeSmall,
+        };
+
+        enum ThemePaintScrollbarOrientation {
+            ScrollbarOrientationHorizontal,
+            ScrollbarOrientationVertical,
+        };
+
+        enum ThemePaintScrollbarParent {
+            ScrollbarParentScrollView,
+            ScrollbarParentRenderLayer,
+        };
+
+        struct ThemePaintScrollbarInfo {
+            ThemePaintScrollbarOrientation orientation;
+            ThemePaintScrollbarParent parent;
+            int maxValue;
+            int currentValue;
+            int visibleSize;
+            int totalSize;
+        };
+
+        static void paintScrollbarThumb(GraphicsContext*, ThemePaintState, ThemePaintSize, const IntRect&, const ThemePaintScrollbarInfo&);
 #endif
 
         // Trace Event --------------------------------------------------------
diff --git a/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm b/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm
index b47e998..fad6928 100644
--- a/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm
+++ b/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm
@@ -27,6 +27,14 @@
 #include "config.h"
 #include "ScrollbarThemeChromiumMac.h"
 
+// FIXME: Remove this (always use WebThemeEngine) once the implementation has
+// landed downstream in Chromium.
+#define USE_WEB_THEME_ENGINE_TO_PAINT_THUMB 0
+
+#if USE_WEB_THEME_ENGINE_TO_PAINT_THUMB
+#include "ChromiumBridge.h"
+#include "FrameView.h"
+#endif
 #include "ImageBuffer.h"
 #include "PlatformMouseEvent.h"
 #include "ScrollView.h"
@@ -34,6 +42,7 @@
 #include <wtf/StdLibExtras.h>
 #include <wtf/UnusedParam.h>
 
+
 // FIXME: There are repainting problems due to Aqua scroll bar buttons' visual overflow.
 
 using namespace std;
@@ -366,6 +375,19 @@ static int scrollbarPartToHIPressedState(ScrollbarPart part)
     }
 }
 
+#if USE_WEB_THEME_ENGINE_TO_PAINT_THUMB
+static ChromiumBridge::ThemePaintState scrollbarStateToThemeState(Scrollbar* scrollbar) {
+    if (!scrollbar->enabled())
+        return ChromiumBridge::StateDisabled;
+    if (!scrollbar->client()->isActive())
+        return ChromiumBridge::StateInactive;
+    if (scrollbar->pressedPart() == ThumbPart)
+        return ChromiumBridge::StatePressed;
+
+    return ChromiumBridge::StateActive;
+}
+#endif // USE_WEB_THEME_ENGINE_TO_PAINT_THUMB
+
 bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* context, const IntRect& damageRect)
 {
     HIThemeTrackDrawInfo trackInfo;
@@ -448,8 +470,25 @@ bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* con
     }
 
     if (hasThumb(scrollbar)) {
+#if USE_WEB_THEME_ENGINE_TO_PAINT_THUMB
+        ChromiumBridge::ThemePaintScrollbarInfo scrollbarInfo;
+        scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScrollbar ? ChromiumBridge::ScrollbarOrientationHorizontal : ChromiumBridge::ScrollbarOrientationVertical;
+        scrollbarInfo.parent = scrollbar->parent()->isFrameView() && static_cast<FrameView*>(scrollbar->parent())->isScrollViewScrollbar(scrollbar) ? ChromiumBridge::ScrollbarParentScrollView : ChromiumBridge::ScrollbarParentRenderLayer;
+        scrollbarInfo.maxValue = scrollbar->maximum();
+        scrollbarInfo.currentValue = scrollbar->currentPos();
+        scrollbarInfo.visibleSize = scrollbar->visibleSize();
+        scrollbarInfo.totalSize = scrollbar->totalSize();
+
+        ChromiumBridge::paintScrollbarThumb(
+            drawingContext,
+            scrollbarStateToThemeState(scrollbar),
+            scrollbar->controlSize() == RegularScrollbar ? ChromiumBridge::SizeRegular : ChromiumBridge::SizeSmall,
+            scrollbar->frameRect(),
+            scrollbarInfo);
+#else
         trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack);
         HIThemeDrawTrack(&trackInfo, 0, drawingContext->platformContext(), kHIThemeOrientationNormal);
+#endif
     }
 
     if (!canDrawDirectly)
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index fa01faf..b4a090b 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,21 @@
+2010-12-23  Mihai Parparita  <mihaip at chromium.org>
+
+        Reviewed by Kent Tamura.
+
+        [Chromium] Add WebThemeEngine for Mac to allow scrollbar rendering to be overridden for the DRT
+        https://bugs.webkit.org/show_bug.cgi?id=51507
+        
+        Adds WebThemeEngine for the Mac (it already has parallel definitions for
+        Windows and Linux) so that scrollbar thumb rendering can be overridden
+        for the DRT (to be consistent with the NSScroller-based rendering
+        used by the Mac port).        
+
+        * public/mac/WebThemeEngine.h: Added.
+        (WebKit::WebThemeEngine::paintScrollbarThumb):
+        * src/AssertMatchingEnums.cpp:
+        * src/ChromiumBridge.cpp:
+        (WebCore::ChromiumBridge::paintScrollbarThumb):
+
 2010-12-23  Sam Weinig  <sam at webkit.org>
 
         Fix build.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 3612a08..5ad48cd 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -101,6 +101,7 @@
                 'public/mac/WebInputEventFactory.h',
                 'public/mac/WebSandboxSupport.h',
                 'public/mac/WebScreenInfoFactory.h',
+                'public/mac/WebThemeEngine.h',
                 'public/WebAccessibilityCache.h',
                 'public/WebAccessibilityNotification.h',
                 'public/WebAccessibilityObject.h',
diff --git a/WebKit/chromium/public/mac/WebThemeEngine.h b/WebKit/chromium/public/mac/WebThemeEngine.h
new file mode 100644
index 0000000..8938816
--- /dev/null
+++ b/WebKit/chromium/public/mac/WebThemeEngine.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebThemeEngine_h
+#define WebThemeEngine_h
+
+#include "../WebCanvas.h"
+
+namespace WebKit {
+
+struct WebRect;
+
+class WebThemeEngine {
+public:
+    enum State {
+        StateDisabled,
+        StateInactive,
+        StateActive,
+        StatePressed,
+    };
+
+    enum Size {
+        SizeRegular,
+        SizeSmall,
+    };
+
+    enum ScrollbarOrientation {
+        ScrollbarOrientationHorizontal,
+        ScrollbarOrientationVertical,
+    };
+
+    enum ScrollbarParent {
+        ScrollbarParentScrollView,
+        ScrollbarParentRenderLayer,
+    };
+
+    struct ScrollbarInfo {
+        ScrollbarOrientation orientation;
+        ScrollbarParent parent;
+        int maxValue;
+        int currentValue;
+        int visibleSize;
+        int totalSize;
+    };
+
+    virtual void paintScrollbarThumb(WebCanvas*, State, Size, const WebRect&, const ScrollbarInfo&) {}
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp
index ba9b4e7..936b8db 100644
--- a/WebKit/chromium/src/AssertMatchingEnums.cpp
+++ b/WebKit/chromium/src/AssertMatchingEnums.cpp
@@ -79,6 +79,11 @@
 #include <wtf/Assertions.h>
 #include <wtf/text/StringImpl.h>
 
+#if OS(DARWIN)
+#include "ChromiumBridge.h"
+#include "mac/WebThemeEngine.h"
+#endif
+
 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \
     COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums)
 
@@ -393,3 +398,19 @@ COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorPathExists, FileError::PATH_EXISTS_ERR)
 COMPILE_ASSERT_MATCHING_ENUM(WebGeolocationError::ErrorPermissionDenied, GeolocationError::PermissionDenied);
 COMPILE_ASSERT_MATCHING_ENUM(WebGeolocationError::ErrorPositionUnavailable, GeolocationError::PositionUnavailable);
 #endif
+
+#if OS(DARWIN)
+COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateDisabled, ChromiumBridge::StateDisabled);
+COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateInactive, ChromiumBridge::StateInactive);
+COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateActive, ChromiumBridge::StateActive);
+COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StatePressed, ChromiumBridge::StatePressed);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::SizeRegular, ChromiumBridge::SizeRegular);
+COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::SizeSmall, ChromiumBridge::SizeSmall);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationHorizontal, ChromiumBridge::ScrollbarOrientationHorizontal);
+COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationVertical, ChromiumBridge::ScrollbarOrientationVertical);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentScrollView, ChromiumBridge::ScrollbarParentScrollView);
+COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentRenderLayer, ChromiumBridge::ScrollbarParentRenderLayer);
+#endif
diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp
index e94a04f..4e2714f 100644
--- a/WebKit/chromium/src/ChromiumBridge.cpp
+++ b/WebKit/chromium/src/ChromiumBridge.cpp
@@ -62,6 +62,10 @@
 #include "WebViewImpl.h"
 #include "WebWorkerClientImpl.h"
 
+#if PLATFORM(CG)
+#include <CoreGraphics/CGContext.h>
+#endif
+
 #if OS(WINDOWS)
 #include "WebRect.h"
 #include "win/WebThemeEngine.h"
@@ -73,6 +77,10 @@
 #include "WebFontRenderStyle.h"
 #endif
 
+#if OS(DARWIN)
+#include "mac/WebThemeEngine.h"
+#endif
+
 #if WEBKIT_USING_SKIA
 #include "NativeImageSkia.h"
 #endif
@@ -838,6 +846,28 @@ void ChromiumBridge::paintThemePart(
         gc->platformContext()->canvas(), WebThemePart(part), WebThemeState(state), rect, &webThemeExtraParams);
 }
 
+#elif OS(DARWIN)
+
+void ChromiumBridge::paintScrollbarThumb(
+    GraphicsContext* gc, ThemePaintState state, ThemePaintSize size, const IntRect& rect, const ThemePaintScrollbarInfo& scrollbarInfo)
+{
+    WebThemeEngine::ScrollbarInfo webThemeScrollbarInfo;
+
+    webThemeScrollbarInfo.orientation = static_cast<WebThemeEngine::ScrollbarOrientation>(scrollbarInfo.orientation);
+    webThemeScrollbarInfo.parent = static_cast<WebThemeEngine::ScrollbarParent>(scrollbarInfo.parent);
+    webThemeScrollbarInfo.maxValue = scrollbarInfo.maxValue;
+    webThemeScrollbarInfo.currentValue = scrollbarInfo.currentValue;
+    webThemeScrollbarInfo.visibleSize = scrollbarInfo.visibleSize;
+    webThemeScrollbarInfo.totalSize = scrollbarInfo.totalSize;
+
+    webKitClient()->themeEngine()->paintScrollbarThumb(
+        gc->platformContext(),
+        static_cast<WebThemeEngine::State>(state),
+        static_cast<WebThemeEngine::Size>(size),
+        rect,
+        webThemeScrollbarInfo);
+}
+
 #endif
 
 // Trace Event ----------------------------------------------------------------

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list