RESOLVED FIXED 40139
[GTK] Widgets do not support CSS transformations
https://bugs.webkit.org/show_bug.cgi?id=40139
Summary [GTK] Widgets do not support CSS transformations
Martin Robinson
Reported 2010-06-03 14:04:55 PDT
GTK+ themes require painting onto a GdkDrawable. In the common case this is the GdkPixmap of the widget window. Because this happens at a lower level than the GraphicsContext, nothing except the widget text honors the transformation matrix. One approach to fixing this is to detect situations in which the GraphicsContext has a rotational transformation matrix and, in those cases, render onto an intermediary GdxPixbuf surface and then copy that to the graphics context.
Attachments
Patch for this issue (25.56 KB, patch)
2010-10-14 17:06 PDT, Martin Robinson
no flags
Updated patch for this issue (32.88 KB, patch)
2010-10-18 10:38 PDT, Martin Robinson
no flags
Patch against ToT (reason for build failure) (32.62 KB, patch)
2010-10-18 14:33 PDT, Martin Robinson
no flags
Patch updated with Alex's suggestions (32.55 KB, patch)
2010-10-19 10:44 PDT, Martin Robinson
no flags
Patch fixing scrollbar rendering issue (32.71 KB, patch)
2010-10-29 12:15 PDT, Martin Robinson
no flags
Patch with slightly updated design (61.96 KB, patch)
2010-11-02 22:03 PDT, Martin Robinson
no flags
Updated Patch (33.06 KB, patch)
2010-11-10 11:48 PST, Martin Robinson
no flags
Martin Robinson
Comment 1 2010-10-14 17:06:05 PDT
Created attachment 70805 [details] Patch for this issue
Martin Robinson
Comment 2 2010-10-14 18:17:36 PDT
Comment on attachment 70805 [details] Patch for this issue Clearing flags, as I should have another patch coming which takes this idea a bit further.
Martin Robinson
Comment 3 2010-10-18 10:38:11 PDT
Created attachment 71056 [details] Updated patch for this issue
WebKit Review Bot
Comment 4 2010-10-18 13:21:59 PDT
Martin Robinson
Comment 5 2010-10-18 14:33:02 PDT
Created attachment 71083 [details] Patch against ToT (reason for build failure)
Alejandro G. Castro
Comment 6 2010-10-19 05:22:36 PDT
Comment on attachment 71083 [details] Patch against ToT (reason for build failure) Patch looks like a very good idea :). View in context: https://bugs.webkit.org/attachment.cgi?id=71083&action=review > LayoutTests/ChangeLog:14 > + * platform/gtk/fast/forms/slider-transformed-expected.txt: Added. I think this file is not in the patch. > WebCore/platform/gtk/RenderThemeGtk.cpp:169 > + , m_themeParts(g_new0(GtkThemeParts, 1)) > +#ifdef GTK_API_VERSION_2 > + , m_themePartsHaveRGBAColormap(true) > +#endif > { > - if (!mozGtkRefCount) { > - moz_gtk_init(); > > - // Use the theme parts for the default drawable. > - moz_gtk_use_theme_parts(partsForDrawable(0)); > +#ifdef GTK_API_VERSION_2 > + GdkColormap* colormap = gdk_screen_get_rgba_colormap(gdk_screen_get_default()); > + if (!colormap) { > + m_themePartsHaveRGBAColormap = false; > + colormap = gdk_screen_get_default_colormap(gdk_screen_get_default()); > } > + m_themeParts->colormap = colormap; > +#endif I was wondering if we could move this code and m_theme attributes to the WidgetRenderingContext object or to the gtkxdrawing. In any case we could leave it for future patches. > WebCore/platform/gtk/WidgetRenderingContextGtk2.cpp:149 > + // The origin of the blit is the original target rectangle adjusted for any extra space. > + IntPoint targetOrigin(m_targetRect.x() - m_extraSpace.width(), > + m_targetRect.y() - m_extraSpace.height()); I think we can use IntRect and inflate to simplify this code. > WebCore/platform/gtk/WidgetRenderingContextGtk3.cpp:51 > I needed these modifications to compile WidgetRenderingContextGtk3.cpp: diff --git a/WebCore/platform/gtk/WidgetRenderingContextGtk3.cpp b/WebCore/platform/gtk/WidgetRenderingContextGtk3.cpp index 693c40e..bd826d9 100644 --- a/WebCore/platform/gtk/WidgetRenderingContextGtk3.cpp +++ b/WebCore/platform/gtk/WidgetRenderingContextGtk3.cpp @@ -32,12 +32,12 @@ WidgetRenderingContext::WidgetRenderingContext(GraphicsContext* graphicsContext, : m_graphicsContext(graphicsContext) , m_targetRect(targetRect) , m_paintRect(targetRect) - , m_target(context->platformContext()) , m_hadError(false) + , m_target(graphicsContext->platformContext()) { } -~WidgetRenderingContext::WidgetRenderingContext() +WidgetRenderingContext::~WidgetRenderingContext() { } @@ -47,4 +47,6 @@ bool WidgetRenderingContext::paintMozillaWidget(GtkThemeWidgetType type, GtkWidg return !m_hadError; } +} + #endif // !GTK_API_VERSION_2
Martin Robinson
Comment 7 2010-10-19 10:21:41 PDT
Comment on attachment 71083 [details] Patch against ToT (reason for build failure) View in context: https://bugs.webkit.org/attachment.cgi?id=71083&action=review >> LayoutTests/ChangeLog:14 >> + * platform/gtk/fast/forms/slider-transformed-expected.txt: Added. > > I think this file is not in the patch. It's the third one down on the pretty-diff. :) >> WebCore/platform/gtk/RenderThemeGtk.cpp:169 >> +#endif > > I was wondering if we could move this code and m_theme attributes to the WidgetRenderingContext object or to the gtkxdrawing. In any case we could leave it for future patches. It needs to stay here as long as RenderThemeGtk manages widgets itself. Perhaps if we eventually do away with WidgetRenderingContext (when the style changes land in GTK+ for instance) it might make sense to move it. >> WebCore/platform/gtk/WidgetRenderingContextGtk2.cpp:149 >> + m_targetRect.y() - m_extraSpace.height()); > > I think we can use IntRect and inflate to simplify this code. Hrm. Maybe IntPoint targetOrigin = m_targetRect.topLeft - toPoint(m_extraSpace); >> WebCore/platform/gtk/WidgetRenderingContextGtk3.cpp:51 >> > > I needed these modifications to compile WidgetRenderingContextGtk3.cpp: > > > diff --git a/WebCore/platform/gtk/WidgetRenderingContextGtk3.cpp b/WebCore/platform/gtk/WidgetRenderingContextGtk3.cpp > index 693c40e..bd826d9 100644 > --- a/WebCore/platform/gtk/WidgetRenderingContextGtk3.cpp > +++ b/WebCore/platform/gtk/WidgetRenderingContextGtk3.cpp > @@ -32,12 +32,12 @@ WidgetRenderingContext::WidgetRenderingContext(GraphicsContext* graphicsContext, > : m_graphicsContext(graphicsContext) > , m_targetRect(targetRect) > , m_paintRect(targetRect) > - , m_target(context->platformContext()) > , m_hadError(false) > + , m_target(graphicsContext->platformContext()) > { > } > > -~WidgetRenderingContext::WidgetRenderingContext() > +WidgetRenderingContext::~WidgetRenderingContext() > { > } > > @@ -47,4 +47,6 @@ bool WidgetRenderingContext::paintMozillaWidget(GtkThemeWidgetType type, GtkWidg > return !m_hadError; > } > > +} > + > #endif // !GTK_API_VERSION_2 Thanks. I'll post a new patch with these fixes.
Martin Robinson
Comment 8 2010-10-19 10:44:35 PDT
Created attachment 71183 [details] Patch updated with Alex's suggestions
Martin Robinson
Comment 9 2010-10-29 12:15:03 PDT
Created attachment 72362 [details] Patch fixing scrollbar rendering issue
Martin Robinson
Comment 10 2010-11-02 22:03:18 PDT
Created attachment 72788 [details] Patch with slightly updated design
Martin Robinson
Comment 11 2010-11-10 11:48:45 PST
Created attachment 73519 [details] Updated Patch
Martin Robinson
Comment 12 2010-11-10 11:49:45 PST
Based on Xan's comments I've updated this patch: 1. It no longer includes the next patch in the series. 2. m_themeParts is now an inline array of the RenderThemeGtk objects and not a pointer. 3. Small fix for a CSS rotation issue.
Xan Lopez
Comment 13 2010-11-10 17:47:30 PST
Comment on attachment 73519 [details] Updated Patch r=me
Martin Robinson
Comment 14 2010-11-10 18:30:03 PST
WebKit Review Bot
Comment 15 2010-11-10 19:25:08 PST
http://trac.webkit.org/changeset/71791 might have broken GTK Linux 64-bit Debug
Note You need to log in before you can comment on or make changes to this bug.