⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 244583 in webkit


Ignore:
Timestamp:
Apr 24, 2019, 12:53:58 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] MiniBrowser: also set the passed bg-color when receiving arguments
https://bugs.webkit.org/show_bug.cgi?id=197156

Reviewed by Michael Catanzaro.

The background color is only set when MiniBrowser is launched without arguments. This regressed when tabs
support was added.

  • MiniBrowser/gtk/BrowserTab.c:

(browser_tab_set_background_color): Set the passed in color as web view background color.

  • MiniBrowser/gtk/BrowserTab.h:
  • MiniBrowser/gtk/BrowserWindow.c:

(browser_window_init): Initialize backgroundColor.
(browser_window_append_view): Call browser_tab_set_background_color().
(browser_window_set_background_color): Save the passed in color. This function should now be called before tabs
are added.

  • MiniBrowser/gtk/main.c:

(main): Call browser_window_set_background_color() before creating the tabs.

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r244581 r244583  
     12019-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] MiniBrowser: also set the passed bg-color when receiving arguments
     4        https://bugs.webkit.org/show_bug.cgi?id=197156
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        The background color is only set when MiniBrowser is launched without arguments. This regressed when tabs
     9        support was added.
     10
     11        * MiniBrowser/gtk/BrowserTab.c:
     12        (browser_tab_set_background_color): Set the passed in color as web view background color.
     13        * MiniBrowser/gtk/BrowserTab.h:
     14        * MiniBrowser/gtk/BrowserWindow.c:
     15        (browser_window_init): Initialize backgroundColor.
     16        (browser_window_append_view): Call browser_tab_set_background_color().
     17        (browser_window_set_background_color): Save the passed in color. This function should now be called before tabs
     18        are added.
     19        * MiniBrowser/gtk/main.c:
     20        (main): Call browser_window_set_background_color() before creating the tabs.
     21
    1222019-04-23  John Wilander  <wilander@apple.com>
    223
  • trunk/Tools/MiniBrowser/gtk/BrowserTab.c

    r238734 r244583  
    604604    }
    605605}
     606
     607void browser_tab_set_background_color(BrowserTab *tab, GdkRGBA *rgba)
     608{
     609    g_return_if_fail(BROWSER_IS_TAB(tab));
     610    g_return_if_fail(rgba);
     611
     612    GdkRGBA viewRGBA;
     613    webkit_web_view_get_background_color(tab->webView, &viewRGBA);
     614    if (gdk_rgba_equal(rgba, &viewRGBA))
     615        return;
     616
     617    webkit_web_view_set_background_color(tab->webView, rgba);
     618}
  • trunk/Tools/MiniBrowser/gtk/BrowserTab.h

    r203271 r244583  
    5555void browser_tab_enter_fullscreen(BrowserTab*);
    5656void browser_tab_leave_fullscreen(BrowserTab*);
     57void browser_tab_set_background_color(BrowserTab*, GdkRGBA*);
    5758
    5859G_END_DECLS
  • trunk/Tools/MiniBrowser/gtk/BrowserWindow.c

    r234915 r244583  
    6666    guint resetEntryProgressTimeoutId;
    6767    gchar *sessionFile;
     68    GdkRGBA backgroundColor;
    6869};
    6970
     
    918919    windowList = g_list_append(windowList, window);
    919920
     921    window->backgroundColor.red = window->backgroundColor.green = window->backgroundColor.blue = 255;
     922    window->backgroundColor.alpha = 1;
     923
    920924    gtk_window_set_title(GTK_WINDOW(window), defaultWindowTitle);
    921925    gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
     
    11561160
    11571161    GtkWidget *tab = browser_tab_new(webView);
     1162    if (gtk_widget_get_app_paintable(GTK_WIDGET(window)))
     1163        browser_tab_set_background_color(BROWSER_TAB(tab), &window->backgroundColor);
    11581164    browser_tab_add_accelerators(BROWSER_TAB(tab), window->accelGroup);
    11591165    gtk_notebook_append_page(GTK_NOTEBOOK(window->notebook), tab, browser_tab_get_title_widget(BROWSER_TAB(tab)));
     
    12041210    g_return_if_fail(rgba);
    12051211
    1206     WebKitWebView *webView = browser_tab_get_web_view(window->activeTab);
    1207     GdkRGBA viewRGBA;
    1208     webkit_web_view_get_background_color(webView, &viewRGBA);
    1209     if (gdk_rgba_equal(rgba, &viewRGBA))
     1212    g_assert(!window->activeTab);
     1213
     1214    if (gdk_rgba_equal(rgba, &window->backgroundColor))
    12101215        return;
     1216
     1217    window->backgroundColor = *rgba;
    12111218
    12121219    GdkVisual *rgbaVisual = gdk_screen_get_rgba_visual(gtk_window_get_screen(GTK_WINDOW(window)));
     
    12161223    gtk_widget_set_visual(GTK_WIDGET(window), rgbaVisual);
    12171224    gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE);
    1218 
    1219     webkit_web_view_set_background_color(webView, rgba);
    12201225}
    12211226
  • trunk/Tools/MiniBrowser/gtk/main.c

    r241790 r244583  
    590590        gtk_window_parse_geometry(GTK_WINDOW(mainWindow), geometry);
    591591
     592    if (backgroundColor)
     593        browser_window_set_background_color(mainWindow, backgroundColor);
     594
    592595    GtkWidget *firstTab = NULL;
    593596    if (uriArguments) {
     
    606609        firstTab = GTK_WIDGET(webView);
    607610
    608         if (backgroundColor)
    609             browser_window_set_background_color(mainWindow, backgroundColor);
    610 
    611611        if (!editorMode) {
    612612            if (sessionFile)
Note: See TracChangeset for help on using the changeset viewer.