WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-150550-20151220123621.patch (text/plain), 29.69 KB, created by
Michael Catanzaro
on 2015-12-20 10:36:59 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Michael Catanzaro
Created:
2015-12-20 10:36:59 PST
Size:
29.69 KB
patch
obsolete
>Subversion Revision: 194316 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0161d888ecb3cc98f1c606356da987cc2f08a8dd..a881f3c574019d7d8830cb1a37a382d16bf657bd 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,45 @@ >+2015-12-20 Michael Catanzaro <mcatanzaro@igalia.com> >+ >+ [GTK] Everything broken in GTK+ 3.19 >+ https://bugs.webkit.org/show_bug.cgi?id=150550 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Port RenderThemeGtk and ScrollbarThemeGtk to use CSS nodes. This makes it possible to render >+ stuff with modern GTK+. >+ >+ No new tests. We already have tons of tests for this functionality, but we're running them >+ with GTK+ 3.16, so they cannot have detected this breakage. These fixes require unreleased >+ GTK+, and GTK+ rendering is currently in a state of flux; once things settle down, we can >+ consider upgrading the GTK+ used for our layout tests. >+ >+ * platform/gtk/GRefPtrGtk.cpp: >+ (WTF::refGPtr): >+ (WTF::derefGPtr): >+ * platform/gtk/GRefPtrGtk.h: >+ * platform/gtk/ScrollbarThemeGtk.cpp: >+ (WebCore::createScrollbarStyleContext): >+ (WebCore::ScrollbarThemeGtk::updateThemeProperties): >+ (WebCore::ScrollbarThemeGtk::paintTrackBackground): >+ (WebCore::ScrollbarThemeGtk::paintScrollbarBackground): >+ (WebCore::ScrollbarThemeGtk::paintThumb): >+ (WebCore::ScrollbarThemeGtk::paintButton): >+ (WebCore::ScrollbarStyleContext::ScrollbarStyleContext): Deleted. >+ (WebCore::ScrollbarStyleContext::~ScrollbarStyleContext): Deleted. >+ (WebCore::ScrollbarStyleContext::context): Deleted. >+ (WebCore::gtkScrollbarStyleContext): Deleted. >+ (WebCore::ScrollbarThemeGtk::themeChanged): Deleted. >+ * rendering/RenderThemeGtk.cpp: >+ (WebCore::createStyleContext): >+ (WebCore::setToggleSize): >+ (WebCore::paintToggle): >+ (WebCore::RenderThemeGtk::paintMenuList): >+ (WebCore::RenderThemeGtk::paintSliderTrack): >+ (WebCore::RenderThemeGtk::paintSliderThumb): >+ (WebCore::RenderThemeGtk::paintProgressBar): >+ (WebCore::paintSpinArrowButton): >+ (WebCore::styleColor): >+ > 2015-12-18 Antti Koivisto <antti@apple.com> > > Cache redirects as separate entries >diff --git a/Source/WebCore/platform/gtk/GRefPtrGtk.cpp b/Source/WebCore/platform/gtk/GRefPtrGtk.cpp >index 3c28eb73aec60bb3d2526c1fb1fa5379cb5f34a1..7b4d69250a501ac4de2d3e51137a788000945357 100644 >--- a/Source/WebCore/platform/gtk/GRefPtrGtk.cpp >+++ b/Source/WebCore/platform/gtk/GRefPtrGtk.cpp >@@ -72,6 +72,22 @@ template <> void derefGPtr(GdkCursor* ptr) > if (ptr) > gdk_cursor_unref(ptr); > } >+ >+#else >+ >+template <> GtkWidgetPath* refGPtr(GtkWidgetPath* ptr) >+{ >+ if (ptr) >+ gtk_widget_path_ref(ptr); >+ return ptr; >+} >+ >+template <> void derefGPtr(GtkWidgetPath* ptr) >+{ >+ if (ptr) >+ gtk_widget_path_unref(ptr); >+} >+ > #endif > > } >diff --git a/Source/WebCore/platform/gtk/GRefPtrGtk.h b/Source/WebCore/platform/gtk/GRefPtrGtk.h >index 8f0426db51ed6887e24ea39c132b4778ffb862a9..c737e3d91fc67b611b038cd58c2314e03770a7a4 100644 >--- a/Source/WebCore/platform/gtk/GRefPtrGtk.h >+++ b/Source/WebCore/platform/gtk/GRefPtrGtk.h >@@ -23,6 +23,7 @@ > > #include <wtf/glib/GRefPtr.h> > >+typedef struct _GtkWidgetPath GtkWidgetPath; > typedef struct _SecretValue SecretValue; > > namespace WTF { >@@ -38,6 +39,9 @@ template <> void derefGPtr(SecretValue* ptr); > #ifdef GTK_API_VERSION_2 > template <> GdkCursor* refGPtr(GdkCursor* ptr); > template <> void derefGPtr(GdkCursor* ptr); >+#else >+template <> GtkWidgetPath* refGPtr(GtkWidgetPath* ptr); >+template <> void derefGPtr(GtkWidgetPath* ptr); > #endif > > } >diff --git a/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp b/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp >index efaab3011cd1a322b17cdd0171f44eb4cc315ed5..3ed0b83ecdb9a47d59ad1f473b8d3316fd720974 100644 >--- a/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp >+++ b/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp >@@ -163,33 +163,16 @@ IntRect ScrollbarThemeGtk::trackRect(Scrollbar& scrollbar, bool) > } > > #ifndef GTK_API_VERSION_2 >-class ScrollbarStyleContext { >- WTF_MAKE_NONCOPYABLE(ScrollbarStyleContext); WTF_MAKE_FAST_ALLOCATED; >-public: >- ScrollbarStyleContext() >- : m_context(adoptGRef(gtk_style_context_new())) >- { >- GtkWidgetPath* path = gtk_widget_path_new(); >- gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR); >- gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_SCROLLBAR); >- gtk_style_context_set_path(m_context.get(), path); >- gtk_widget_path_free(path); >- } >- >- ~ScrollbarStyleContext() >- { >- } > >- GtkStyleContext* context() const { return m_context.get(); } >- >-private: >- GRefPtr<GtkStyleContext> m_context; >-}; >- >-static GtkStyleContext* gtkScrollbarStyleContext() >+GRefPtr<GtkStyleContext> createScrollbarStyleContext() > { >- static NeverDestroyed<ScrollbarStyleContext> styleContext; >- return styleContext.get().context(); >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR); >+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_SCROLLBAR); >+ >+ GRefPtr<GtkStyleContext> context = gtk_style_context_new(); >+ gtk_style_context_set_path(context.get(), path.get()); >+ return context; > } > > ScrollbarThemeGtk::ScrollbarThemeGtk() >@@ -199,14 +182,13 @@ ScrollbarThemeGtk::ScrollbarThemeGtk() > > void ScrollbarThemeGtk::themeChanged() > { >- gtk_style_context_invalidate(gtkScrollbarStyleContext()); > updateThemeProperties(); > } > > void ScrollbarThemeGtk::updateThemeProperties() > { > gtk_style_context_get_style( >- gtkScrollbarStyleContext(), >+ createScrollbarStyleContext().get(), > "min-slider-length", &m_minThumbLength, > "slider-width", &m_thumbFatness, > "trough-border", &m_troughBorderWidth, >@@ -296,62 +278,98 @@ void ScrollbarThemeGtk::paintTrackBackground(GraphicsContext& context, Scrollbar > if (m_troughUnderSteppers) > fullScrollbarRect = IntRect(scrollbar.x(), scrollbar.y(), scrollbar.width(), scrollbar.height()); > >- GtkStyleContext* styleContext = gtkScrollbarStyleContext(); >- gtk_style_context_save(styleContext); >+ GRefPtr<GtkStyleContext> styleContext = createScrollbarStyleContext(); >+#if GTK_CHECK_VERSION(3, 19, 1) >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); > >- applyScrollbarStyleContextClasses(styleContext, scrollbar.orientation()); >- gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_TROUGH); >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "scrollbar"); > >- adjustRectAccordingToMargin(styleContext, static_cast<GtkStateFlags>(0), fullScrollbarRect); >- gtk_render_background(styleContext, context.platformContext()->cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height()); >- gtk_render_frame(styleContext, context.platformContext()->cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height()); >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "trough"); > >- gtk_style_context_restore(styleContext); >+ gtk_style_context_set_path(styleContext.get(), path.get()); >+#endif >+ >+ applyScrollbarStyleContextClasses(styleContext.get(), scrollbar.orientation()); >+ gtk_style_context_add_class(styleContext.get(), GTK_STYLE_CLASS_TROUGH); >+ >+ adjustRectAccordingToMargin(styleContext.get(), static_cast<GtkStateFlags>(0), fullScrollbarRect); >+ gtk_render_background(styleContext.get(), context.platformContext()->cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height()); >+ gtk_render_frame(styleContext.get(), context.platformContext()->cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height()); > } > > void ScrollbarThemeGtk::paintScrollbarBackground(GraphicsContext& context, Scrollbar& scrollbar) > { >- GtkStyleContext* styleContext = gtkScrollbarStyleContext(); >- gtk_style_context_save(styleContext); >+ GRefPtr<GtkStyleContext> styleContext = createScrollbarStyleContext(); >+#if GTK_CHECK_VERSION(3, 19, 1) >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); > >- applyScrollbarStyleContextClasses(styleContext, scrollbar.orientation()); >- gtk_style_context_add_class(styleContext, "scrolled-window"); >- gtk_render_frame(styleContext, context.platformContext()->cr(), scrollbar.x(), scrollbar.y(), scrollbar.width(), scrollbar.height()); >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "scrollbar"); >+ >+ gtk_style_context_set_path(styleContext.get(), path.get()); >+#endif > >- gtk_style_context_restore(styleContext); >+ applyScrollbarStyleContextClasses(styleContext.get(), scrollbar.orientation()); >+ gtk_style_context_add_class(styleContext.get(), "scrolled-window"); >+ gtk_render_frame(styleContext.get(), context.platformContext()->cr(), scrollbar.x(), scrollbar.y(), scrollbar.width(), scrollbar.height()); > } > > void ScrollbarThemeGtk::paintThumb(GraphicsContext& context, Scrollbar& scrollbar, const IntRect& rect) > { >- GtkStyleContext* styleContext = gtkScrollbarStyleContext(); >- gtk_style_context_save(styleContext); >+ GRefPtr<GtkStyleContext> styleContext = createScrollbarStyleContext(); >+#if GTK_CHECK_VERSION(3, 19, 1) >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "scrollbar"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "trough"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 2, "slider"); >+ >+ gtk_style_context_set_path(styleContext.get(), path.get()); >+#endif > > ScrollbarOrientation orientation = scrollbar.orientation(); >- applyScrollbarStyleContextClasses(styleContext, orientation); >- gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_SLIDER); >+ applyScrollbarStyleContextClasses(styleContext.get(), orientation); >+ gtk_style_context_add_class(styleContext.get(), GTK_STYLE_CLASS_SLIDER); > > guint flags = 0; > if (scrollbar.pressedPart() == ThumbPart) > flags |= GTK_STATE_FLAG_ACTIVE; > if (scrollbar.hoveredPart() == ThumbPart) > flags |= GTK_STATE_FLAG_PRELIGHT; >- gtk_style_context_set_state(styleContext, static_cast<GtkStateFlags>(flags)); >+ gtk_style_context_set_state(styleContext.get(), static_cast<GtkStateFlags>(flags)); > > IntRect thumbRect(rect); >- adjustRectAccordingToMargin(styleContext, static_cast<GtkStateFlags>(flags), thumbRect); >- gtk_render_slider(styleContext, context.platformContext()->cr(), thumbRect.x(), thumbRect.y(), thumbRect.width(), thumbRect.height(), >+ adjustRectAccordingToMargin(styleContext.get(), static_cast<GtkStateFlags>(flags), thumbRect); >+ gtk_render_slider(styleContext.get(), context.platformContext()->cr(), thumbRect.x(), thumbRect.y(), thumbRect.width(), thumbRect.height(), > orientation == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL); >- >- gtk_style_context_restore(styleContext); > } > > void ScrollbarThemeGtk::paintButton(GraphicsContext& context, Scrollbar& scrollbar, const IntRect& rect, ScrollbarPart part) > { >- GtkStyleContext* styleContext = gtkScrollbarStyleContext(); >- gtk_style_context_save(styleContext); >+ GRefPtr<GtkStyleContext> styleContext = createScrollbarStyleContext(); >+#if GTK_CHECK_VERSION(3, 19, 1) >+ // FIXME: With Adwaita, the style context is requesting the primary backward and forward steppers. >+ // But this is a bug: Adwaita explicitly disables those steppers. Why are we getting them? >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "scrollbar"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCROLLBAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "button"); >+ >+ gtk_style_context_set_path(styleContext.get(), path.get()); >+#endif > > ScrollbarOrientation orientation = scrollbar.orientation(); >- applyScrollbarStyleContextClasses(styleContext, orientation); >+ applyScrollbarStyleContextClasses(styleContext.get(), orientation); > > guint flags = 0; > if ((BackButtonStartPart == part && scrollbar.currentPos()) >@@ -364,14 +382,14 @@ void ScrollbarThemeGtk::paintButton(GraphicsContext& context, Scrollbar& scrollb > flags |= GTK_STATE_FLAG_PRELIGHT; > } else > flags |= GTK_STATE_FLAG_INSENSITIVE; >- gtk_style_context_set_state(styleContext, static_cast<GtkStateFlags>(flags)); >+ gtk_style_context_set_state(styleContext.get(), static_cast<GtkStateFlags>(flags)); > >- gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_BUTTON); >- gtk_render_background(styleContext, context.platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height()); >- gtk_render_frame(styleContext, context.platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height()); >+ gtk_style_context_add_class(styleContext.get(), GTK_STYLE_CLASS_BUTTON); >+ gtk_render_background(styleContext.get(), context.platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height()); >+ gtk_render_frame(styleContext.get(), context.platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height()); > > gfloat arrowScaling; >- gtk_style_context_get_style(styleContext, "arrow-scaling", &arrowScaling, nullptr); >+ gtk_style_context_get_style(styleContext.get(), "arrow-scaling", &arrowScaling, nullptr); > > double arrowSize = std::min(rect.width(), rect.height()) * arrowScaling; > FloatPoint arrowPoint( >@@ -380,7 +398,7 @@ void ScrollbarThemeGtk::paintButton(GraphicsContext& context, Scrollbar& scrollb > > if (flags & GTK_STATE_FLAG_ACTIVE) { > gint arrowDisplacementX, arrowDisplacementY; >- gtk_style_context_get_style(styleContext, "arrow-displacement-x", &arrowDisplacementX, "arrow-displacement-y", &arrowDisplacementY, nullptr); >+ gtk_style_context_get_style(styleContext.get(), "arrow-displacement-x", &arrowDisplacementX, "arrow-displacement-y", &arrowDisplacementY, nullptr); > arrowPoint.move(arrowDisplacementX, arrowDisplacementY); > } > >@@ -390,9 +408,7 @@ void ScrollbarThemeGtk::paintButton(GraphicsContext& context, Scrollbar& scrollb > else > angle = (part == ForwardButtonEndPart || part == ForwardButtonStartPart) ? G_PI / 2 : 3 * (G_PI / 2); > >- gtk_render_arrow(styleContext, context.platformContext()->cr(), angle, arrowPoint.x(), arrowPoint.y(), arrowSize); >- >- gtk_style_context_restore(styleContext); >+ gtk_render_arrow(styleContext.get(), context.platformContext()->cr(), angle, arrowPoint.x(), arrowPoint.y(), arrowSize); > } > > bool ScrollbarThemeGtk::paint(Scrollbar& scrollbar, GraphicsContext& graphicsContext, const IntRect& damageRect) >diff --git a/Source/WebCore/rendering/RenderThemeGtk.cpp b/Source/WebCore/rendering/RenderThemeGtk.cpp >index 828f277cb922c0c53d894a959ea48c0faa66a1fc..3f9fa0e4cfc31ca9e531016e650737e0584be9aa 100644 >--- a/Source/WebCore/rendering/RenderThemeGtk.cpp >+++ b/Source/WebCore/rendering/RenderThemeGtk.cpp >@@ -152,34 +152,54 @@ static GRefPtr<GtkStyleContext> createStyleContext(GType widgetType) > initialized = true; > } > >- GtkWidgetPath* path = gtk_widget_path_new(); >- gtk_widget_path_append_type(path, widgetType); >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ gtk_widget_path_append_type(path.get(), widgetType); > > if (widgetType == GTK_TYPE_ENTRY) >- gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_ENTRY); >+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_ENTRY); > else if (widgetType == GTK_TYPE_ARROW) >- gtk_widget_path_iter_add_class(path, 0, "arrow"); >+ gtk_widget_path_iter_add_class(path.get(), 0, "arrow"); > else if (widgetType == GTK_TYPE_BUTTON) { >- gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_BUTTON); >- gtk_widget_path_iter_add_class(path, 0, "text-button"); >+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_BUTTON); >+ gtk_widget_path_iter_add_class(path.get(), 0, "text-button"); > } else if (widgetType == GTK_TYPE_SCALE) >- gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_SCALE); >+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_SCALE); > else if (widgetType == GTK_TYPE_SEPARATOR) >- gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_SEPARATOR); >+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_SEPARATOR); > else if (widgetType == GTK_TYPE_PROGRESS_BAR) >- gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_PROGRESSBAR); >+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_PROGRESSBAR); > else if (widgetType == GTK_TYPE_SPIN_BUTTON) >- gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_SPINBUTTON); >+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_SPINBUTTON); > else if (widgetType == GTK_TYPE_TREE_VIEW) >- gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_VIEW); >+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_VIEW); >+#if !GTK_CHECK_VERSION(3, 19, 1) > else if (widgetType == GTK_TYPE_CHECK_BUTTON) >- gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_CHECK); >+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_CHECK); > else if (widgetType == GTK_TYPE_RADIO_BUTTON) >- gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_RADIO); >+ gtk_widget_path_iter_add_class(path.get(), 0, GTK_STYLE_CLASS_RADIO); >+#endif >+ >+#if GTK_CHECK_VERSION(3, 19, 1) >+ if (widgetType == GTK_TYPE_ENTRY) >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "entry"); >+ else if (widgetType == GTK_TYPE_ARROW) >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "button"); // Note: not a typo. >+ else if (widgetType == GTK_TYPE_BUTTON) >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "button"); >+ else if (widgetType == GTK_TYPE_SCALE) >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "scale"); >+ else if (widgetType == GTK_TYPE_SEPARATOR) >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "separator"); >+ else if (widgetType == GTK_TYPE_PROGRESS_BAR) >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "progressbar"); >+ else if (widgetType == GTK_TYPE_SPIN_BUTTON) >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "spinbutton"); >+ else if (widgetType == GTK_TYPE_TREE_VIEW) >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "treeview"); >+#endif > > GRefPtr<GtkStyleContext> context = adoptGRef(gtk_style_context_new()); >- gtk_style_context_set_path(context.get(), path); >- gtk_widget_path_free(path); >+ gtk_style_context_set_path(context.get(), path.get()); > > return context; > } >@@ -452,9 +472,7 @@ static void setToggleSize(GType widgetType, RenderStyle& style) > if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto()) > return; > >- // Other ports hard-code this to 13 which is also the default value defined by GTK+. >- // GTK+ users tend to demand the native look. >- // It could be made a configuration option values other than 13 actually break site compatibility. >+ // Other ports hard-code this to 13. GTK+ users tend to demand the native look. > gint indicatorSize; > gtk_style_context_get_style(context.get(), "indicator-size", &indicatorSize, nullptr); > >@@ -468,6 +486,37 @@ static void setToggleSize(GType widgetType, RenderStyle& style) > static void paintToggle(const RenderThemeGtk* theme, GType widgetType, const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& fullRect) > { > GRefPtr<GtkStyleContext> context = createStyleContext(widgetType); >+#if GTK_CHECK_VERSION(3, 19, 1) >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ >+ if (widgetType == GTK_TYPE_CHECK_BUTTON) { >+ if (theme->isChecked(renderObject) || theme->isIndeterminate(renderObject)) { >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "checkbutton"); >+ } else { >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "button"); >+ gtk_widget_path_iter_add_class(path.get(), 0, "check"); >+ } >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_CHECK_BUTTON); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "check"); >+ } else if (widgetType == GTK_TYPE_RADIO_BUTTON) { >+ if (theme->isChecked(renderObject) || theme->isIndeterminate(renderObject)) { >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "radiobutton"); >+ } else { >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "button"); >+ gtk_widget_path_iter_add_class(path.get(), 0, "radio"); >+ } >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_RADIO_BUTTON); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "radio"); >+ } >+ >+ gtk_style_context_set_path(context.get(), path.get()); >+#endif > > // Some themes do not render large toggle buttons properly, so we simply > // shrink the rectangle back down to the default size and then center it >@@ -487,7 +536,12 @@ static void paintToggle(const RenderThemeGtk* theme, GType widgetType, const Ren > } > > gtk_style_context_set_direction(context.get(), static_cast<GtkTextDirection>(gtkTextDirection(renderObject.style().direction()))); >+ >+#if GTK_CHECK_VERSION(3, 19, 1) >+ gtk_style_context_add_class(context.get(), "toggle"); >+#else > gtk_style_context_add_class(context.get(), widgetType == GTK_TYPE_CHECK_BUTTON ? GTK_STYLE_CLASS_CHECK : GTK_STYLE_CLASS_RADIO); >+#endif > > guint flags = 0; > if (!theme->isEnabled(renderObject)) >@@ -779,6 +833,17 @@ bool RenderThemeGtk::paintMenuList(const RenderObject& renderObject, const Paint > > // Paint the separator if needed. > GRefPtr<GtkStyleContext> separatorStyleContext = createStyleContext(GTK_TYPE_COMBO_BOX); >+#if GTK_CHECK_VERSION(3, 19, 1) >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_COMBO_BOX); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "combobox"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SEPARATOR); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "separator"); >+ >+ gtk_style_context_set_path(separatorStyleContext.get(), path.get()); >+#endif > > gtk_style_context_set_direction(separatorStyleContext.get(), direction); > gtk_style_context_add_class(separatorStyleContext.get(), "separator"); >@@ -1054,6 +1119,17 @@ bool RenderThemeGtk::paintSliderTrack(const RenderObject& renderObject, const Pa > ASSERT_UNUSED(part, part == SliderHorizontalPart || part == SliderVerticalPart || part == MediaVolumeSliderPart); > > GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_SCALE); >+#if GTK_CHECK_VERSION(3, 19, 1) >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "scale"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "trough"); >+ >+ gtk_style_context_set_path(context.get(), path.get()); >+#endif > > gtk_style_context_set_direction(context.get(), gtkTextDirection(renderObject.style().direction())); > applySliderStyleContextClasses(context.get(), part); >@@ -1082,6 +1158,21 @@ bool RenderThemeGtk::paintSliderThumb(const RenderObject& renderObject, const Pa > ASSERT(part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart || part == MediaVolumeSliderThumbPart); > > GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_SCALE); >+#if GTK_CHECK_VERSION(3, 19, 1) >+ // FIXME: The entire slider is too wide, stretching the thumb into an oval rather than a circle. >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "scale"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "trough"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SCALE); >+ gtk_widget_path_iter_set_object_name(path.get(), 2, "slider"); >+ >+ gtk_style_context_set_path(context.get(), path.get()); >+#endif > > gtk_style_context_set_direction(context.get(), gtkTextDirection(renderObject.style().direction())); > applySliderStyleContextClasses(context.get(), part); >@@ -1127,14 +1218,44 @@ bool RenderThemeGtk::paintProgressBar(const RenderObject& renderObject, const Pa > return true; > > GRefPtr<GtkStyleContext> context = createStyleContext(GTK_TYPE_PROGRESS_BAR); >- gtk_style_context_save(context.get()); >+#if GTK_CHECK_VERSION(3, 19, 1) >+ // FIXME: The progress is rendered but the background is not. >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "progressbar"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "trough"); >+ >+ gtk_style_context_set_path(context.get(), path.get()); >+#endif > > gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_TROUGH); > > gtk_render_background(context.get(), paintInfo.context().platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height()); > gtk_render_frame(context.get(), paintInfo.context().platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height()); > >- gtk_style_context_restore(context.get()); >+ context = createStyleContext(GTK_TYPE_PROGRESS_BAR); >+#if GTK_CHECK_VERSION(3, 19, 1) >+ path = adoptGRef(gtk_widget_path_new()); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "progressbar"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "trough"); >+ >+ // TODO: Add the style classes .left, .right, .top or .bottom when the >+ // progress 'touches' the corresponding end of the GtkProgressBar. >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_PROGRESS_BAR); >+ gtk_widget_path_iter_set_object_name(path.get(), 2, "progress"); >+ >+ if (!downcast<RenderProgress>(renderObject).isDeterminate()) >+ gtk_widget_path_iter_add_class(path.get(), 2, "pulse"); >+ >+ gtk_style_context_set_path(context.get(), path.get()); >+#endif > > gtk_style_context_add_class(context.get(), GTK_STYLE_CLASS_PROGRESSBAR); > gtk_style_context_set_state(context.get(), static_cast<GtkStateFlags>(0)); >@@ -1190,6 +1311,19 @@ static void paintSpinArrowButton(RenderTheme* theme, GtkStyleContext* context, c > gtk_style_context_save(context); > gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON); > >+#if GTK_CHECK_VERSION(3, 19, 1) >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SPIN_BUTTON); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "spinbutton"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_SPIN_BUTTON); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "button"); >+ gtk_widget_path_iter_add_class(path.get(), 1, arrowType == GTK_ARROW_UP ? "up" : "down"); >+ >+ gtk_style_context_set_path(context, path.get()); >+#endif >+ > GtkTextDirection direction = gtk_style_context_get_direction(context); > guint state = static_cast<guint>(gtk_style_context_get_state(context)); > if (!(state & GTK_STATE_FLAG_INSENSITIVE)) { >@@ -1289,16 +1423,28 @@ enum StyleColorType { StyleColorBackground, StyleColorForeground }; > > static Color styleColor(GType widgetType, GtkStateFlags state, StyleColorType colorType) > { >- > GRefPtr<GtkStyleContext> context = createStyleContext(widgetType); >- // Recent GTK+ versions (> 3.14) require to explicitly set the state before getting the color. >+#if GTK_CHECK_VERSION(3, 19, 1) >+ if (widgetType == GTK_TYPE_ENTRY) { >+ GRefPtr<GtkWidgetPath> path = adoptGRef(gtk_widget_path_new()); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_ENTRY); >+ gtk_widget_path_iter_set_object_name(path.get(), 0, "entry"); >+ >+ gtk_widget_path_append_type(path.get(), GTK_TYPE_ENTRY); >+ gtk_widget_path_iter_set_object_name(path.get(), 1, "selection"); >+ >+ gtk_style_context_set_path(context.get(), path.get()); >+ } >+#endif >+ > gtk_style_context_set_state(context.get(), state); > > GdkRGBA gdkRGBAColor; > if (colorType == StyleColorBackground) >- gtk_style_context_get_background_color(context.get(), gtk_style_context_get_state(context.get()), &gdkRGBAColor); >+ gtk_style_context_get_background_color(context.get(), state, &gdkRGBAColor); > else >- gtk_style_context_get_color(context.get(), gtk_style_context_get_state(context.get()), &gdkRGBAColor); >+ gtk_style_context_get_color(context.get(), state, &gdkRGBAColor); > return gdkRGBAColor; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 150550
:
265953
|
267721
|
267726
|
267775