From b41a88d23f50585b32c0b7bd05e8ccb919641d19 Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Thu, 11 Dec 2008 01:57:42 +0000 Subject: Clip the scrollbars on linux. And rebaseline the image on a layout test that now passes. Review URL: http://codereview.chromium.org/13728 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6770 0039d316-1c4b-4281-b951-d872f2087c98 --- .../LayoutTests/fast/clip/014-expected.checksum | 1 + .../LayoutTests/fast/clip/014-expected.png | Bin 0 -> 6090 bytes webkit/port/platform/chromium/RenderThemeGtk.cpp | 4 ++-- .../chromium/ScrollbarThemeChromiumLinux.cpp | 25 +++++++++++++++------ .../layout_tests/test_lists/tests_fixable.txt | 8 ++----- 5 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 webkit/data/layout_tests/platform/chromium-linux/LayoutTests/fast/clip/014-expected.checksum create mode 100644 webkit/data/layout_tests/platform/chromium-linux/LayoutTests/fast/clip/014-expected.png diff --git a/webkit/data/layout_tests/platform/chromium-linux/LayoutTests/fast/clip/014-expected.checksum b/webkit/data/layout_tests/platform/chromium-linux/LayoutTests/fast/clip/014-expected.checksum new file mode 100644 index 0000000..df4f896 --- /dev/null +++ b/webkit/data/layout_tests/platform/chromium-linux/LayoutTests/fast/clip/014-expected.checksum @@ -0,0 +1 @@ +96b3b1d344dde8aebe92b33af3a62c1d \ No newline at end of file diff --git a/webkit/data/layout_tests/platform/chromium-linux/LayoutTests/fast/clip/014-expected.png b/webkit/data/layout_tests/platform/chromium-linux/LayoutTests/fast/clip/014-expected.png new file mode 100644 index 0000000..7d6dc31 Binary files /dev/null and b/webkit/data/layout_tests/platform/chromium-linux/LayoutTests/fast/clip/014-expected.png differ diff --git a/webkit/port/platform/chromium/RenderThemeGtk.cpp b/webkit/port/platform/chromium/RenderThemeGtk.cpp index c9f00ed..a28fa64 100644 --- a/webkit/port/platform/chromium/RenderThemeGtk.cpp +++ b/webkit/port/platform/chromium/RenderThemeGtk.cpp @@ -191,8 +191,8 @@ static bool paintMozWidget(RenderTheme* theme, GtkThemeWidgetType type, RenderOb GdkRectangle gdkClipRect; gdkClipRect.x = pos.x(); gdkClipRect.y = pos.y(); - gdkClipRect.width = SkScalarRound(clip_region.width()); - gdkClipRect.height = SkScalarRound(clip_region.height()); + gdkClipRect.width = clip_region.width(); + gdkClipRect.height = clip_region.height(); // moz_gtk_widget_paint will paint outside the bounds of gdkRect unless we further restrict |gdkClipRect|. gdk_rectangle_intersect(&gdkRect, &gdkClipRect, &gdkClipRect); diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp b/webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp index 54480f7..d7acec1 100644 --- a/webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp +++ b/webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp @@ -30,6 +30,7 @@ #include "config.h" #include "ScrollbarThemeChromium.h" +#include "AffineTransform.h" #include "NotImplemented.h" #include "PlatformContextSkia.h" #include "PlatformMouseEvent.h" @@ -82,23 +83,33 @@ static void initMozState(GtkWidgetState* mozState) // 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) +// +// See paintMozWiget in RenderThemeGtk.cpp for an explanation of the clipping. // ----------------------------------------------------------------------------- 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(); + GdkRectangle gdkRect = { rect.x(), rect.y(), rect.width(), rect.height() }; + + const SkIRect clip_region = pcs->canvas()->getTotalClip().getBounds(); + AffineTransform ctm = gc->getCTM().inverse(); + IntPoint pos = ctm.mapPoint( + IntPoint(SkScalarRound(clip_region.fLeft), SkScalarRound(clip_region.fTop))); + GdkRectangle gdkClipRect; + gdkClipRect.x = pos.x(); + gdkClipRect.y = pos.y(); + gdkClipRect.width = clip_region.width(); + gdkClipRect.height = clip_region.height(); + + gdk_rectangle_intersect(&gdkRect, &gdkClipRect, &gdkClipRect); GtkWidgetState mozState; initMozState(&mozState); - moz_gtk_widget_paint(widget_type, pcs->gdk_skia(), &sbrect, &sbrect, &mozState, - flags, GTK_TEXT_DIR_LTR); + moz_gtk_widget_paint(widget_type, pcs->gdk_skia(), &gdkRect, &gdkClipRect, + &mozState, flags, GTK_TEXT_DIR_LTR); } void ScrollbarThemeChromium::paintTrackPiece(GraphicsContext* gc, Scrollbar* scrollbar, diff --git a/webkit/tools/layout_tests/test_lists/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/tests_fixable.txt index af12a64..fdeb09f 100644 --- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt +++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt @@ -1059,9 +1059,8 @@ LINUX MAC : pending/plugins/destroy-stream-twice.html = TIMEOUT LINUX MAC : pending/plugins/iframe-shims.html = FAIL // Depends on event_sending_controller fixes. -LINUX MAC : pending/fast/events/special-key-events-in-input-text.html = FAIL -LINUX MAC : LayoutTests/fast/forms/search-event-delay.html = TIMEOUT PASS - +MAC : pending/fast/events/special-key-events-in-input-text.html = FAIL +MAC : LayoutTests/fast/forms/search-event-delay.html = TIMEOUT PASS // NEW FOR MERGE 36102:37604 @@ -2002,9 +2001,6 @@ LayoutTests/wml/variable-reference-valid.html = FAIL // evanm sent a reduction of this problem to agl. LINUX : LayoutTests/fast/block/margin-collapse/055.html = FAIL -// Linux pixeltest failure: We aren't clipping the scrollbar -LINUX : LayoutTests/fast/clip/014.html = FAIL - // Windows pixeltest failure: alpha=0.5 red does not come out blended. // Linux pixeltest failure: alpha=0.5 red (1,0,0) atop yellow (1,1,0) is // coming out with with a slightly-less-than-100% red channel. -- cgit v1.1