We already take ints when setting the translation, so it can't
currently take any other values. Additionally, I was seeing large
costs in int -> double -> int for the rects in
gtk_snapshot_clips_rect(), as all callers really are ints (widget
allocations) and the clip region is int-based.
This change completely cleared a 2% rectangle_init_from_graphene from
the profile and is likely to have nice performance effects elsewhere
too.
Change get_render_node to return nodes that are sized to the clip
area and expect to be placed at the clip position; change
gtk_container_propagate_render_node to place child render nodes
accordingly, and change gtk_css_gadget_get_render_node to return
nodes that are sized accordingly as well.
Instead of using the background as the gadget's node, we add a
non-drawing node that can be used to apply offsets; all other nodes are
children of the "box" node.
...and implement it for GtkCssGadget and GtkCssCustomGadget.
This allows us to decide on a per-object basis if a custom
gadget needs a render node for content or not.
Give all nodes the same detail about the owner widget.
This reveals that every GtkCssCustomGadget gets a
DrawGadgetContents node, even if their draw_func is NULL.
We may want to come up with a better solution for that.
When creating the GskRenderNodes for the gadgets we should not translate
the coordinates inside the Cairo context, but we should tweak the
coordinates of the anchor point.
This is still not enough to get an appropriate rendering, as the result
is still slightly offset to the left.
It does not make sense to pass a for_size into the size allocation
machinery that is smaller than the min-size in that direction.
Warn if it happens, so we can track it down when it occurs.
The way we were adjusting baselines if min-height forces
a size increase was not quite working as intended. Redo
it in a simpler way: just split up the excess and count
half of it for above the baseline and half below.
This fixes button labels in dialogs appearing too low.
When size_allocate is overridden in widgets, but draw is not,
we can end up drawing a gadget that has not been given a size.
Warn about this, and limp along by drawing the gadget over the
full allocation of its owner widget.
https://bugzilla.gnome.org/show_bug.cgi?id=762614
We were forcing the size to be at least min-height, but we left the
baselines as they were, which had the effect of making text e.g
in entries 'stick to the top'.
With this change, we adjust the baseline to keep the ratio of
baseline to height unchanged.
Margins can be negative, and if we are not careful, then
content+padding+margin can end up with negative dimensions,
which can upset pixman and others. This commit ensures
that a gadget will not request or draw boxes with negative
dimensions, and get_border_allocation and get_content_allocation
will not return boxes with negative dimensions.
This fixes a crash in the paned separator drawing code that
can be reproduced by setting separator padding to 0.
https://bugzilla.gnome.org/show_bug.cgi?id=759657
As GtkCssNode has the visibility concept, it makes sense to mirror it in
gadgets.
Do what visibility does in widgets: Hidden gadgets can't be drawn or
allocated and request a 0x0 size.
Note that just like widgets, gadget visibility must not be changed in
size request, allocate or draw handlers.
GtkWidget::child-visible has no equivalent yet, code will have to
emulate that manually.