diff options
-rw-r--r-- | webkit/SConscript.port | 3 | ||||
-rw-r--r-- | webkit/build/WebCore/SConscript | 1 | ||||
-rw-r--r-- | webkit/build/port/port.vcproj | 4 | ||||
-rw-r--r-- | webkit/port/platform/chromium/ScrollbarThemeChromium.cpp | 155 | ||||
-rw-r--r-- | webkit/port/platform/chromium/ScrollbarThemeChromium.h (renamed from webkit/port/platform/chromium/ScrollbarThemeChromiumWin.h) | 22 | ||||
-rw-r--r-- | webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp | 130 | ||||
-rw-r--r-- | webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp | 134 |
7 files changed, 318 insertions, 131 deletions
diff --git a/webkit/SConscript.port b/webkit/SConscript.port index adb199f..8260d3d 100644 --- a/webkit/SConscript.port +++ b/webkit/SConscript.port @@ -70,6 +70,7 @@ input_files = [ '$PORT_DIR/platform/chromium/TextBoundariesChromium.cpp', '$PORT_DIR/platform/chromium/TextBreakIteratorInternalICUChromium.cpp', '$PORT_DIR/platform/chromium/WidgetChromium.cpp', + '$PORT_DIR/platform/chromium/ScrollbarThemeChromium.cpp', '$PORT_DIR/platform/graphics/AffineTransformSkia.cpp', '$PORT_DIR/platform/graphics/ColorSkia.cpp', @@ -128,6 +129,7 @@ if env['PLATFORM'] == 'posix': input_files.extend([ '$PORT_DIR/platform/chromium/IconLinux.cpp', '$PORT_DIR/platform/chromium/ScreenLinux.cpp', + '$PORT_DIR/platform/chromium/ScrollbarThemeChromiumLinux.cpp', '$PORT_DIR/platform/graphics/chromium/GlyphPageTreeNodeLinux.cpp', '$PORT_DIR/platform/graphics/skia/GdkSkia.cc', ]) @@ -141,6 +143,7 @@ if env['PLATFORM'] == 'darwin': '$PORT_DIR/platform/chromium/DragDataChromium.cpp', '$PORT_DIR/platform/chromium/PopupMenuChromium.cpp', '$PORT_DIR/platform/chromium/WidgetChromium.cpp', + '$PORT_DIR/platform/chromium/ScrollbarThemeChromium.cpp', '$PORT_DIR/platform/graphics/FontCustomPlatformData.cpp', '$PORT_DIR/platform/graphics/ImageSkia.cpp', ] diff --git a/webkit/build/WebCore/SConscript b/webkit/build/WebCore/SConscript index bff3591..daf2607 100644 --- a/webkit/build/WebCore/SConscript +++ b/webkit/build/WebCore/SConscript @@ -817,7 +817,6 @@ if env['PLATFORM'] in ('darwin'): if env['PLATFORM'] == 'posix': input_files.extend([ '$WEBCORE_DIR/platform/posix/FileSystemPOSIX.cpp', - '$WEBCORE_DIR/platform/gtk/ScrollbarThemeGtk.cpp', ]) # Precompiled headers only work under MSVC in scons. diff --git a/webkit/build/port/port.vcproj b/webkit/build/port/port.vcproj index 395eb0e..e272395 100644 --- a/webkit/build/port/port.vcproj +++ b/webkit/build/port/port.vcproj @@ -803,6 +803,10 @@ > </File> <File + RelativePath="..\..\port\platform\chromium\ScrollbarThemeChromium.cpp" + > + </File> + <File RelativePath="..\..\port\platform\chromium\ScrollbarThemeChromiumWin.cpp" > </File> diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp b/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp new file mode 100644 index 0000000..c0e3c5d --- /dev/null +++ b/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2008 Apple 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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. + */ + +#include "config.h" +#include "ScrollbarThemeChromium.h" + +#include "PlatformMouseEvent.h" +#include "Scrollbar.h" +#include "ScrollbarThemeComposite.h" +#include "webkit/glue/webkit_glue.h" + +// ----------------------------------------------------------------------------- +// This file contains scrollbar theme code that is cross platform. Additional +// members of ScrollbarThemeChromium can be found in the platform specific files +// ----------------------------------------------------------------------------- + +namespace WebCore { + +ScrollbarTheme* ScrollbarTheme::nativeTheme() +{ + static ScrollbarThemeChromium theme; + return &theme; +} + +ScrollbarThemeChromium::ScrollbarThemeChromium() +{ +} + +ScrollbarThemeChromium::~ScrollbarThemeChromium() +{ +} + +void ScrollbarThemeChromium::themeChanged() +{ +} + +bool ScrollbarThemeChromium::hasThumb(Scrollbar* scrollbar) +{ + // This method is just called as a paint-time optimization to see if + // painting the thumb can be skipped. We don't have to be exact here. + return thumbLength(scrollbar) > 0; +} + +IntRect ScrollbarThemeChromium::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) +{ + // Windows and Linux just have single arrows. + if (part == BackButtonEndPart) + return IntRect(); + + IntSize size = buttonSize(scrollbar); + return IntRect(scrollbar->x(), scrollbar->y(), size.width(), size.height()); +} + +IntRect ScrollbarThemeChromium::forwardButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) +{ + // Windows and Linux just have single arrows. + if (part == ForwardButtonStartPart) + return IntRect(); + + IntSize size = buttonSize(scrollbar); + int x, y; + if (scrollbar->orientation() == HorizontalScrollbar) { + x = scrollbar->x() + scrollbar->width() - size.width(); + y = scrollbar->y(); + } else { + x = scrollbar->x(); + y = scrollbar->y() + scrollbar->height() - size.height(); + } + return IntRect(x, y, size.width(), size.height()); +} + +IntRect ScrollbarThemeChromium::trackRect(Scrollbar* scrollbar, bool) +{ + IntSize bs = buttonSize(scrollbar); + int thickness = scrollbarThickness(); + if (scrollbar->orientation() == HorizontalScrollbar) { + if (scrollbar->width() < 2 * thickness) + return IntRect(); + return IntRect(scrollbar->x() + bs.width(), scrollbar->y(), scrollbar->width() - 2 * bs.width(), thickness); + } + if (scrollbar->height() < 2 * thickness) + return IntRect(); + return IntRect(scrollbar->x(), scrollbar->y() + bs.height(), thickness, scrollbar->height() - 2 * bs.height()); +} + +void ScrollbarThemeChromium::paintTrackBackground(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect) +{ + // Just assume a forward track part. We only paint the track as a single piece when there is no thumb. + if (!hasThumb(scrollbar)) + paintTrackPiece(context, scrollbar, rect, ForwardTrackPart); +} + +void ScrollbarThemeChromium::paintScrollCorner(ScrollView* view, GraphicsContext* context, const IntRect& cornerRect) +{ + // ScrollbarThemeComposite::paintScrollCorner incorrectly assumes that the + // ScrollView is a FrameView (see FramelessScrollView), so we cannot let + // that code run. For FrameView's this is correct since we don't do custom + // scrollbar corner rendering, which ScrollbarThemeComposite supports. + ScrollbarTheme::paintScrollCorner(view, context, cornerRect); +} + +bool ScrollbarThemeChromium::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt) +{ + return evt.shiftKey() && evt.button() == LeftButton; +} + +IntSize ScrollbarThemeChromium::buttonSize(Scrollbar* scrollbar) +{ + // Our desired rect is essentially thickness by thickness. + + // Our actual rect will shrink to half the available space when we have < 2 + // times thickness pixels left. This allows the scrollbar to scale down + // and function even at tiny sizes. + + // In layout test mode, we force the button "girth" (i.e., the length of + // the button along the axis of the scrollbar) to be a fixed size. + // FIXME: This is retarded! scrollbarThickness is already fixed in layout + // test mode so that should be enough to result in repeatable results, but + // preserving this hack avoids having to rebaseline pixel tests. + const int kLayoutTestModeGirth = 17; + + int thickness = scrollbarThickness(); + int girth = webkit_glue::IsLayoutTestMode() ? kLayoutTestModeGirth : thickness; + if (scrollbar->orientation() == HorizontalScrollbar) { + int width = scrollbar->width() < 2 * girth ? scrollbar->width() / 2 : girth; + return IntSize(width, thickness); + } + + int height = scrollbar->height() < 2 * girth ? scrollbar->height() / 2 : girth; + return IntSize(thickness, height); +} + +} // namespace WebCore diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.h b/webkit/port/platform/chromium/ScrollbarThemeChromium.h index 5f694da..f75b052 100644 --- a/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.h +++ b/webkit/port/platform/chromium/ScrollbarThemeChromium.h @@ -20,20 +20,29 @@ * 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. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ScrollbarThemeChromiumWin_h -#define ScrollbarThemeChromiumWin_h +#ifndef ScrollbarThemeChromium_h +#define ScrollbarThemeChromium_h #include "ScrollbarThemeComposite.h" namespace WebCore { -class ScrollbarThemeChromiumWin : public ScrollbarThemeComposite { +class PlatformMouseEvent; + +// ----------------------------------------------------------------------------- +// This class contains the Chromium scrollbar implementations for Windows and +// Linux. All of the symbols here in must be defined somewhere in the code and +// we manage the platform specific parts by linking in different, platform +// specific, files. Methods that we shared across platforms are implemented in +// ScrollbarThemeChromium.cpp +// ----------------------------------------------------------------------------- +class ScrollbarThemeChromium : public ScrollbarThemeComposite { public: - ScrollbarThemeChromiumWin(); - virtual ~ScrollbarThemeChromiumWin(); + ScrollbarThemeChromium(); + virtual ~ScrollbarThemeChromium(); virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar); @@ -59,6 +68,7 @@ protected: private: IntSize buttonSize(Scrollbar*); + int getThemeState(Scrollbar*, ScrollbarPart) const; int getThemeArrowState(Scrollbar*, ScrollbarPart) const; int getClassicThemeState(Scrollbar*, ScrollbarPart) const; diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp b/webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp new file mode 100644 index 0000000..1dcf4b2 --- /dev/null +++ b/webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp @@ -0,0 +1,130 @@ +// Copyright (c) 2008, 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. + +#include "config.h" +#include "ScrollbarThemeChromium.h" + +#include "NotImplemented.h" +#include "PlatformContextSkia.h" +#include "PlatformMouseEvent.h" +#include "Scrollbar.h" + +#include "gtkdrawing.h" +#include "GdkSkia.h" +#include <gtk/gtk.h> + + +namespace WebCore { + +int ScrollbarThemeChromium::scrollbarThickness(ScrollbarControlSize controlSize) +{ + static int size = 0; + if (!size) { + MozGtkScrollbarMetrics metrics; + moz_gtk_get_scrollbar_metrics(&metrics); + size = metrics.slider_width; + } + return size; +} + +bool ScrollbarThemeChromium::invalidateOnMouseEnterExit() +{ + notImplemented(); + return false; +} + +// ----------------------------------------------------------------------------- +// Given an uninitialised widget state object, set the members such that it's +// sane for drawing scrollbars +// ----------------------------------------------------------------------------- +static void initMozState(GtkWidgetState* mozState) +{ + mozState->active = true; + mozState->focused = false; + mozState->inHover = false; + mozState->disabled = false; + mozState->isDefault = false; + mozState->canDefault = false; + mozState->depressed = false; +} + +// ----------------------------------------------------------------------------- +// Paint a GTK widget +// gc: context to draw onto +// rect: the area of the widget +// widget_type: the type of widget to draw +// flags: widget dependent flags (e.g. direction of scrollbar arrows etc) +// ----------------------------------------------------------------------------- +static void paintScrollbarWidget(GraphicsContext* gc, const IntRect& rect, + GtkThemeWidgetType widget_type, gint flags) +{ + PlatformContextSkia* pcs = gc->platformContext(); + + GdkRectangle sbrect; + sbrect.x = rect.x(); + sbrect.y = rect.y(); + sbrect.width = rect.width(); + sbrect.height = rect.height(); + + GtkWidgetState mozState; + initMozState(&mozState); + + moz_gtk_widget_paint(widget_type, pcs->gdk_skia(), &sbrect, &sbrect, &mozState, + flags, GTK_TEXT_DIR_LTR); +} + +void ScrollbarThemeChromium::paintTrackPiece(GraphicsContext* gc, Scrollbar* scrollbar, + const IntRect& rect, ScrollbarPart partType) +{ + const bool horz = scrollbar->orientation() == HorizontalScrollbar; + const GtkThemeWidgetType track_type = + horz ? MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL : MOZ_GTK_SCROLLBAR_TRACK_VERTICAL; + paintScrollbarWidget(gc, rect, track_type, 0); + + return; +} + +void ScrollbarThemeChromium::paintButton(GraphicsContext* gc, Scrollbar* scrollbar, + const IntRect& rect, ScrollbarPart part) +{ + const bool horz = scrollbar->orientation() == HorizontalScrollbar; + gint flags = horz ? 0 : MOZ_GTK_STEPPER_VERTICAL; + flags |= ForwardButtonEndPart == part ? MOZ_GTK_STEPPER_DOWN : 0; + paintScrollbarWidget(gc, rect, MOZ_GTK_SCROLLBAR_BUTTON, flags); +} + +void ScrollbarThemeChromium::paintThumb(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect) +{ + const bool horz = scrollbar->orientation() == HorizontalScrollbar; + const GtkThemeWidgetType thumb_type = + horz ? MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL : MOZ_GTK_SCROLLBAR_THUMB_VERTICAL; + paintScrollbarWidget(gc, rect, thumb_type, 0); +} + +} // namespace WebCore diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp b/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp index c19bcca..0246501 100644 --- a/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp +++ b/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp @@ -20,11 +20,11 @@ * 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. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" -#include "ScrollbarThemeChromiumWin.h" +#include "ScrollbarThemeChromium.h" #include <windows.h> #include <vsstyle.h> @@ -60,21 +60,7 @@ static RECT toRECT(const IntRect& input) return output; } -ScrollbarTheme* ScrollbarTheme::nativeTheme() -{ - static ScrollbarThemeChromiumWin theme; - return &theme; -} - -ScrollbarThemeChromiumWin::ScrollbarThemeChromiumWin() -{ -} - -ScrollbarThemeChromiumWin::~ScrollbarThemeChromiumWin() -{ -} - -int ScrollbarThemeChromiumWin::scrollbarThickness(ScrollbarControlSize controlSize) +int ScrollbarThemeChromium::scrollbarThickness(ScrollbarControlSize controlSize) { static int thickness; if (!thickness) { @@ -85,72 +71,12 @@ int ScrollbarThemeChromiumWin::scrollbarThickness(ScrollbarControlSize controlSi return thickness; } -void ScrollbarThemeChromiumWin::themeChanged() -{ -} - -bool ScrollbarThemeChromiumWin::invalidateOnMouseEnterExit() +bool ScrollbarThemeChromium::invalidateOnMouseEnterExit() { return runningVista(); } -bool ScrollbarThemeChromiumWin::hasThumb(Scrollbar* scrollbar) -{ - // This method is just called as a paint-time optimization to see if - // painting the thumb can be skipped. We don't have to be exact here. - return thumbLength(scrollbar) > 0; -} - -IntRect ScrollbarThemeChromiumWin::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) -{ - // Windows just has single arrows. - if (part == BackButtonEndPart) - return IntRect(); - - IntSize size = buttonSize(scrollbar); - return IntRect(scrollbar->x(), scrollbar->y(), size.width(), size.height()); -} - -IntRect ScrollbarThemeChromiumWin::forwardButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) -{ - // Windows just has single arrows. - if (part == ForwardButtonStartPart) - return IntRect(); - - IntSize size = buttonSize(scrollbar); - int x, y; - if (scrollbar->orientation() == HorizontalScrollbar) { - x = scrollbar->x() + scrollbar->width() - size.width(); - y = scrollbar->y(); - } else { - x = scrollbar->x(); - y = scrollbar->y() + scrollbar->height() - size.height(); - } - return IntRect(x, y, size.width(), size.height()); -} - -IntRect ScrollbarThemeChromiumWin::trackRect(Scrollbar* scrollbar, bool) -{ - IntSize bs = buttonSize(scrollbar); - int thickness = scrollbarThickness(); - if (scrollbar->orientation() == HorizontalScrollbar) { - if (scrollbar->width() < 2 * thickness) - return IntRect(); - return IntRect(scrollbar->x() + bs.width(), scrollbar->y(), scrollbar->width() - 2 * bs.width(), thickness); - } - if (scrollbar->height() < 2 * thickness) - return IntRect(); - return IntRect(scrollbar->x(), scrollbar->y() + bs.height(), thickness, scrollbar->height() - 2 * bs.height()); -} - -void ScrollbarThemeChromiumWin::paintTrackBackground(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect) -{ - // Just assume a forward track part. We only paint the track as a single piece when there is no thumb. - if (!hasThumb(scrollbar)) - paintTrackPiece(context, scrollbar, rect, ForwardTrackPart); -} - -void ScrollbarThemeChromiumWin::paintTrackPiece(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart partType) +void ScrollbarThemeChromium::paintTrackPiece(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart partType) { bool horz = scrollbar->orientation() == HorizontalScrollbar; @@ -181,7 +107,7 @@ void ScrollbarThemeChromiumWin::paintTrackPiece(GraphicsContext* gc, Scrollbar* canvas->endPlatformPaint(); } -void ScrollbarThemeChromiumWin::paintButton(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part) +void ScrollbarThemeChromium::paintButton(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part) { bool horz = scrollbar->orientation() == HorizontalScrollbar; @@ -207,7 +133,7 @@ void ScrollbarThemeChromiumWin::paintButton(GraphicsContext* gc, Scrollbar* scro canvas->endPlatformPaint(); } -void ScrollbarThemeChromiumWin::paintThumb(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect) +void ScrollbarThemeChromium::paintThumb(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect) { bool horz = scrollbar->orientation() == HorizontalScrollbar; @@ -235,47 +161,7 @@ void ScrollbarThemeChromiumWin::paintThumb(GraphicsContext* gc, Scrollbar* scrol canvas->endPlatformPaint(); } -void ScrollbarThemeChromiumWin::paintScrollCorner(ScrollView* view, GraphicsContext* context, const IntRect& cornerRect) -{ - // ScrollbarThemeComposite::paintScrollCorner incorrectly assumes that the - // ScrollView is a FrameView (see FramelessScrollView), so we cannot let - // that code run. For FrameView's this is correct since we don't do custom - // scrollbar corner rendering, which ScrollbarThemeComposite supports. - ScrollbarTheme::paintScrollCorner(view, context, cornerRect); -} - -bool ScrollbarThemeChromiumWin::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt) -{ - return evt.shiftKey() && evt.button() == LeftButton; -} - -IntSize ScrollbarThemeChromiumWin::buttonSize(Scrollbar* scrollbar) -{ - // Our desired rect is essentially thickness by thickness. - - // Our actual rect will shrink to half the available space when we have < 2 - // times thickness pixels left. This allows the scrollbar to scale down - // and function even at tiny sizes. - - // In layout test mode, we force the button "girth" (i.e., the length of - // the button along the axis of the scrollbar) to be a fixed size. - // FIXME: This is retarded! scrollbarThickness is already fixed in layout - // test mode so that should be enough to result in repeatable results, but - // preserving this hack avoids having to rebaseline pixel tests. - const int kLayoutTestModeGirth = 17; - - int thickness = scrollbarThickness(); - int girth = ChromiumBridge::layoutTestMode() ? kLayoutTestModeGirth : thickness; - if (scrollbar->orientation() == HorizontalScrollbar) { - int width = scrollbar->width() < 2 * girth ? scrollbar->width() / 2 : girth; - return IntSize(width, thickness); - } - - int height = scrollbar->height() < 2 * girth ? scrollbar->height() / 2 : girth; - return IntSize(thickness, height); -} - -int ScrollbarThemeChromiumWin::getThemeState(Scrollbar* scrollbar, ScrollbarPart part) const +int ScrollbarThemeChromium::getThemeState(Scrollbar* scrollbar, ScrollbarPart part) const { // When dragging the thumb, draw thumb pressed and other segments normal // regardless of where the cursor actually is. See also four places in @@ -294,7 +180,7 @@ int ScrollbarThemeChromiumWin::getThemeState(Scrollbar* scrollbar, ScrollbarPart return (scrollbar->pressedPart() == part) ? SCRBS_PRESSED : SCRBS_NORMAL; } -int ScrollbarThemeChromiumWin::getThemeArrowState(Scrollbar* scrollbar, ScrollbarPart part) const +int ScrollbarThemeChromium::getThemeArrowState(Scrollbar* scrollbar, ScrollbarPart part) const { // We could take advantage of knowing the values in the state enum to write // some simpler code, but treating the state enum as a black box seems @@ -344,7 +230,7 @@ int ScrollbarThemeChromiumWin::getThemeArrowState(Scrollbar* scrollbar, Scrollba return (scrollbar->pressedPart() == part) ? ABS_DOWNPRESSED : ABS_DOWNNORMAL; } -int ScrollbarThemeChromiumWin::getClassicThemeState(Scrollbar* scrollbar, ScrollbarPart part) const +int ScrollbarThemeChromium::getClassicThemeState(Scrollbar* scrollbar, ScrollbarPart part) const { // When dragging the thumb, draw the buttons normal even when hovered. if (scrollbar->pressedPart() == ThumbPart) |