After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 715163 - Toolbar style "border-width" is always zero after gtk_widget_realize
Toolbar style "border-width" is always zero after gtk_widget_realize
Status: RESOLVED NOTABUG
Product: gtk+
Classification: Platform
Component: Class: GtkStyleContext
3.11.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 690236
 
 
Reported: 2013-11-25 14:26 UTC by Marco Brito
Modified: 2013-11-26 21:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase for toolbar's border-width. (2.51 KB, text/plain)
2013-11-25 14:30 UTC, Marco Brito
Details

Description Marco Brito 2013-11-25 14:26:25 UTC
From https://bugzilla.gnome.org/show_bug.cgi?id=690236

Calling gtk_widget_realize to get the window allocation size, is resulting in a size allocated as if the toolbar style property "border-width" is always zero.


Tested with a custom gtk.css, only toolbar property appears to be affected.
* {
	border-width: 5px;
	border-color: blue;
}
GtkToolbar {
	border-width: 5px;
	border-top-width: 11px;
}


The style is correct with:

1. After calling gtk_widget_show (window);

2. Calling gtk_style_context_invalidate(gtk_widget_get_style_context (toolbar)); before gtk_widget_realize.

3. Patching gtk/gtkwidget.c:gtk_widget_realize to include
   GtkBitmask *empty;
   empty = _gtk_bitmask_new ();
   _gtk_style_context_validate (gtk_widget_get_style_context (widget),
                                g_get_monotonic_time (),
                                0,
                                empty);
   _gtk_bitmask_free (empty);
Comment 1 Marco Brito 2013-11-25 14:30:35 UTC
Created attachment 261439 [details]
Testcase for toolbar's border-width.

A simples test case that shows this problem.
Comment 2 Benjamin Otte (Company) 2013-11-26 14:30:42 UTC
I think you fail to set "border-style: solid;" in your CSS so the border-style is none and then the CSS spec from http://www.w3.org/TR/CSS2/box.html#border-width-properties kicks in and that one says:

> Computed value: absolute length; '0' if the border style is 'none' or 'hidden'

So I guess this is NOTABUG ?

(And yes, sorry for CSS being so confusing sometimes that it resets your border width).
Comment 3 Marco Brito 2013-11-26 17:05:49 UTC
Yes i confirm, just checked awhile ago by debugging.

border-style is "none", and then by CSS specification is set to zero, as you said.


But there is something strange going around, at the call of:
gtk_widget_realize(top_level_window)    border-style is "none"
gtk_widget_show(top_level_window)       border-style is "outset"


_gtk_css_provider_load_named loads Raleigh as fall-back, i think this is were "outset" is comming from.

Then why at gtk_widget_realize border-style is none? Raleigh is loaded well before that.


I will look a this deeper to understand what is happening.
Comment 4 Benjamin Otte (Company) 2013-11-26 21:12:15 UTC
This happens because for performance reasons GTK does not refresh styles until they are needed for a repaint. In the size request, size allocate and draw functions the border should be correctly set.