summaryrefslogtreecommitdiffstats
path: root/webkit/port/platform/chromium/RenderThemeGtk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/port/platform/chromium/RenderThemeGtk.cpp')
-rw-r--r--webkit/port/platform/chromium/RenderThemeGtk.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/webkit/port/platform/chromium/RenderThemeGtk.cpp b/webkit/port/platform/chromium/RenderThemeGtk.cpp
index e05e9c5..98af73c 100644
--- a/webkit/port/platform/chromium/RenderThemeGtk.cpp
+++ b/webkit/port/platform/chromium/RenderThemeGtk.cpp
@@ -159,35 +159,33 @@ static bool paintMozWidget(RenderTheme* theme, GtkThemeWidgetType type, RenderOb
break;
}
- AffineTransform ctm = i.context->getCTM();
-
- IntPoint pos = ctm.mapPoint(rect.location());
- GdkRectangle gdkRect;
- gdkRect.x = pos.x();
- gdkRect.y = pos.y();
- gdkRect.width = rect.width();
- gdkRect.height = rect.height();
- GtkTextDirection direction = gtkTextDirection(o->style()->direction());
-
PlatformContextSkia* pcs = i.context->platformContext();
SkCanvas* canvas = pcs->canvas();
if (!canvas)
return false;
- const SkIRect clip_region = canvas->getTotalClip().getBounds();
+ GdkRectangle gdkRect;
+ gdkRect.x = rect.x();
+ gdkRect.y = rect.y();
+ gdkRect.width = rect.width();
+ gdkRect.height = rect.height();
+ // getTotalClip returns the currently set clip region in device coordinates,
+ // so we have to apply the current transform (actually we only support translations)
+ // to get the page coordinates that our gtk widget rendering expects.
+ // We invert it because we want to map from device coordinates to page coordinates.
+ const SkIRect clip_region = canvas->getTotalClip().getBounds();
+ AffineTransform ctm = i.context->getCTM().inverse();
+ IntPoint pos = ctm.mapPoint(IntPoint(SkScalarRound(clip_region.fLeft), SkScalarRound(clip_region.fTop)));
GdkRectangle gdkClipRect;
- gdkClipRect.x = clip_region.fLeft;
- gdkClipRect.y = clip_region.fTop;
- gdkClipRect.width = clip_region.width();
- gdkClipRect.height = clip_region.height();
-
- gdk_rectangle_intersect(&gdkRect, &gdkClipRect, &gdkClipRect);
+ gdkClipRect.x = pos.x();
+ gdkClipRect.y = pos.y();
+ gdkClipRect.width = SkScalarRound(clip_region.width());
+ gdkClipRect.height = SkScalarRound(clip_region.height());
- const gint r =
- moz_gtk_widget_paint(type, pcs->gdk_skia(), &gdkRect, &gdkClipRect, &mozState, flags, direction) != MOZ_GTK_SUCCESS;
+ GtkTextDirection direction = gtkTextDirection(o->style()->direction());
- return r;
+ return moz_gtk_widget_paint(type, pcs->gdk_skia(), &gdkRect, &gdkClipRect, &mozState, flags, direction) != MOZ_GTK_SUCCESS;
}
static void setButtonPadding(RenderStyle* style)