bug 1319650 draw tab gap with tabpanel style context r=stransky+263117
☠☠ backed out by 78e5f82eb83a ☠ ☠
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 29 Nov 2016 18:50:20 +1300
changeset 325045 dceea26b46aecc0920f44128cde85539107b4dd0
parent 325044 70d7c15347151bb94b8bb3b28a21ff8d234fdcfa
child 325046 402535c480347e46f743ba6b96d25298bdf07651
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersstransky
bugs1319650, 263117
milestone53.0a1
bug 1319650 draw tab gap with tabpanel style context r=stransky+263117 This is more consistent with moz_gtk_tabpanels_paint() and avoids modifying the tab style context. MozReview-Commit-ID: HpKSVrpvO9b
widget/gtk/gtk3drawing.cpp
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -1510,18 +1510,18 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
              *           :    ^       bmargin          :  ^
              *           :    | (-negative margin,     :  |
              *  bottom   :    v  passed in flags)      :  |       gap_height
              *    of  -> :.............................:  |    (the size of the
              * the tab   .       part of the gap       .  |  tabpanel top border)
              *           .      outside of the tab     .  v
              * ----------------------------------------------
              *
-             * To draw the gap, we use gtk_paint_box_gap(), see comment in
-             * moz_gtk_tabpanels_paint(). This box_gap is made 3 * gap_height tall,
+             * To draw the gap, we use gtk_render_frame_gap(), see comment in
+             * moz_gtk_tabpanels_paint(). This gap is made 3 * gap_height tall,
              * which should suffice to ensure that the only visible border is the
              * pierced one.  If the tab is in the middle, we make the box_gap begin
              * a bit to the left of the tab and end a bit to the right, adjusting
              * the gap position so it still is under the tab, because we want the
              * rendering of a gap in the middle of a tabpanel.  This is the role of
              * the gints gap_{l,r}_offset. On the contrary, if the tab is the
              * first, we align the start border of the box_gap with the start
              * border of the tab (left if LTR, right if RTL), by setting the
@@ -1540,67 +1540,66 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
             gap_loffset = gap_roffset = 20; /* should be enough */
             if (flags & MOZ_GTK_TAB_FIRST) {
                 if (direction == GTK_TEXT_DIR_RTL)
                     gap_roffset = initial_gap;
                 else
                     gap_loffset = initial_gap;
             }
 
+            GtkStyleContext* panelStyle =
+                ClaimStyleContext(MOZ_GTK_TABPANELS, direction);
+
             if (isBottomTab) {
                 /* Draw the tab on bottom */
                 focusRect.y += gap_voffset;
                 focusRect.height -= gap_voffset;
 
                 gtk_render_extension(style, cr,
                                      tabRect.x, tabRect.y + gap_voffset, tabRect.width,
                                      tabRect.height - gap_voffset, GTK_POS_TOP);
 
-                gtk_style_context_remove_region(style, GTK_STYLE_REGION_TAB);
-
                 backRect.y += (gap_voffset - gap_height);
                 backRect.height = gap_height;
 
                 /* Draw the gap; erase with background color before painting in
                  * case theme does not */
-                gtk_render_background(style, cr, backRect.x, backRect.y,
+                gtk_render_background(panelStyle, cr, backRect.x, backRect.y,
                                      backRect.width, backRect.height);
                 cairo_save(cr);
                 cairo_rectangle(cr, backRect.x, backRect.y, backRect.width, backRect.height);
                 cairo_clip(cr);
 
-                gtk_render_frame_gap(style, cr,
+                gtk_render_frame_gap(panelStyle, cr,
                                      tabRect.x - gap_loffset,
                                      tabRect.y + gap_voffset - 3 * gap_height,
                                      tabRect.width + gap_loffset + gap_roffset,
                                      3 * gap_height, GTK_POS_BOTTOM,
                                      gap_loffset, gap_loffset + tabRect.width);
                 cairo_restore(cr);
             } else {
                 /* Draw the tab on top */
                 focusRect.height -= gap_voffset;
                 gtk_render_extension(style, cr,
                                      tabRect.x, tabRect.y, tabRect.width,
                                      tabRect.height - gap_voffset, GTK_POS_BOTTOM);
 
-                gtk_style_context_remove_region(style, GTK_STYLE_REGION_TAB);
-
                 backRect.y += (tabRect.height - gap_voffset);
                 backRect.height = gap_height;
 
                 /* Draw the gap; erase with background color before painting in
                  * case theme does not */
-                gtk_render_background(style, cr, backRect.x, backRect.y,
+                gtk_render_background(panelStyle, cr, backRect.x, backRect.y,
                                       backRect.width, backRect.height);
 
                 cairo_save(cr);
                 cairo_rectangle(cr, backRect.x, backRect.y, backRect.width, backRect.height);
                 cairo_clip(cr);
 
-                gtk_render_frame_gap(style, cr,
+                gtk_render_frame_gap(panelStyle, cr,
                                      tabRect.x - gap_loffset,
                                      tabRect.y + tabRect.height - gap_voffset,
                                      tabRect.width + gap_loffset + gap_roffset,
                                      3 * gap_height, GTK_POS_TOP,
                                      gap_loffset, gap_loffset + tabRect.width);
                 cairo_restore(cr);
             }
         }