Closed Bug 877601 Opened 11 years ago Closed 11 years ago

Port GTK2 to GTK3 - menu fixes

Categories

(Core :: Widget: Gtk, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: stransky, Assigned: stransky)

References

Details

(Whiteboard: [leave open for remaining patches])

Attachments

(1 file, 1 obsolete file)

+++ This bug was initially created as a clone of Bug #627699 +++

GTK+ 3.0 and GNOME 3 are approaching and we should get Firefox ready for them. This bug is for mapping fixes in menu widgets.
There are two issues in menus, in the recent code. The item sizes (they're so small) and bad rendering of the menu background - there are artifacts after mouse over.
Attached patch menu padding patch (obsolete) (deleted) — Splinter Review
Attachment #767088 - Flags: review?(karlt)
Comment on attachment 767088 [details] [diff] [review]
menu padding patch

Interesting.  horizontal-padding usage was removed sometime after GTK+ 3.6.3.

The only thing that really doesn't look right to me is
moz_gtk_menu_arrow_paint().  I think the rect here is inside something that is
-moz-appearance: menuitem, and so border_width and padding have already been
removed.  Also, we can't really change the arrow size by the scaling here, or
it may draw outside the rect, leaving artifacts.

I'm guessing the relevant markup is
http://hg.mozilla.org/mozilla-central/annotate/3b955f306226/toolkit/content/widgets/menu.xml#l185
http://hg.mozilla.org/mozilla-central/annotate/3b955f306226/toolkit/themes/linux/global/menu.css#l126

I suspect the right approach for the MENUARROW is to implement
GetMinimumWidgetSize() and perhaps change the sizes specified in CSS.

I suggest dealing with arrow changes in a separate patch as they are more
complicated and the rest of the changes are looking good.

>+    if (direction == GTK_TEXT_DIR_RTL) {
>+        x = (rect->width - indicator_size - offset - horizontal_padding);
>+    }
>+    else {
>+        x = (rect->x + offset + horizontal_padding);
>+    }

Remove the unnecessary parentheses, please.

>-    y = rect->y + (rect->height - indicator_size) / 2;

>+    y = (rect->height - indicator_size) / 2;

I expect rect->y is needed here, so no change, I assume.

>     if (wide_separators)
>-        *size = separator_height + border.top;
>+        *size = separator_height + padding.top + border_width*2;
>     else
>-        *size = border.top + border.bottom;
>+        *size = padding.top + padding.bottom + border_width;

Looking at gtk_menu_item_real_get_height, I expect this to always include
padding.top + padding.bottom + border_width * 2.  Then there's
separator_height for wide_separators and 1 for the else.
Attachment #767088 - Flags: review?(karlt) → review-
Attached patch menu padding v.2 (deleted) — Splinter Review
Thanks! There's an updated one, without the the arrow changes.
Attachment #767088 - Attachment is obsolete: true
Attachment #768234 - Flags: review?(karlt)
Whiteboard: [leave open for remaining patches][check linux try build before requesting checkin] → [leave open for remaining patches]
Attachment #768234 - Flags: review?(karlt) → review+
btw. The menu also needs clipping, the selected (active) menuitem background is drawn over the whole popup menu.
Menu seems to be fine now. The clipping will be addressed in Bug 877606.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Blocks: 1034064
No longer blocks: 1034064
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: