diff options
Diffstat (limited to 'webkit/port')
-rw-r--r-- | webkit/port/platform/chromium/RenderThemeGtk.cpp | 38 | ||||
-rw-r--r-- | webkit/port/platform/graphics/skia/GdkSkia.cc | 5 |
2 files changed, 23 insertions, 20 deletions
diff --git a/webkit/port/platform/chromium/RenderThemeGtk.cpp b/webkit/port/platform/chromium/RenderThemeGtk.cpp index d4382bb..7059d0c 100644 --- a/webkit/port/platform/chromium/RenderThemeGtk.cpp +++ b/webkit/port/platform/chromium/RenderThemeGtk.cpp @@ -145,35 +145,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 setToggleSize(RenderStyle* style, ControlPart appearance) diff --git a/webkit/port/platform/graphics/skia/GdkSkia.cc b/webkit/port/platform/graphics/skia/GdkSkia.cc index 4774aaf..3adf710 100644 --- a/webkit/port/platform/graphics/skia/GdkSkia.cc +++ b/webkit/port/platform/graphics/skia/GdkSkia.cc @@ -465,6 +465,11 @@ gdk_skia_ref_cairo_surface(GdkDrawable *drawable) { CAIRO_FORMAT_ARGB32, dev->width(), dev->height(), bm->rowBytes()); } + SkMatrix matrix = skia->canvas->getTotalMatrix(); + int x_shift = SkScalarRound(matrix.getTranslateX()); + int y_shift = SkScalarRound(matrix.getTranslateY()); + cairo_surface_set_device_offset(skia->surface, x_shift, y_shift); + return cairo_surface_reference(skia->surface); } |