[epiphany/mcatanzaro/thumbnail-background-position] Rewrite Ephy.Overview.Item.thumbnailPath()



commit 95e9c1f9b6461056e2fdefe60a422e09113e82d9
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Aug 6 13:00:37 2019 -0500

    Rewrite Ephy.Overview.Item.thumbnailPath()
    
    The original implementation works, but it seems fragile and I have no
    idea why this approach was chosen. This simpler implementation seems to
    work.

 embed/ephy-web-view.c                                | 13 ++++++++++++-
 embed/web-process-extension/resources/js/overview.js | 13 +++----------
 2 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 39f2efdde..0f3b4da23 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -704,12 +704,14 @@ update_navigation_flags (WebKitWebView *view)
 static void
 ephy_web_view_freeze_history (EphyWebView *view)
 {
+g_warning("%s", __FUNCTION__);
   view->history_frozen = TRUE;
 }
 
 static void
 ephy_web_view_thaw_history (EphyWebView *view)
 {
+g_warning("%s", __FUNCTION__);
   view->history_frozen = FALSE;
 }
 
@@ -758,15 +760,21 @@ history_service_query_urls_cb (EphyHistoryService *service,
   const char *url = webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view));
 
   if (!success)
+{
+g_warning ("Oh no, history service query failed");
     goto out;
+}
 
   /* Have we already started a new load? */
   if (g_strcmp0 (url, view->pending_snapshot_uri) != 0)
+{
+g_warning ("Oh no, url=%s doesn't match pending snapshot URL %s, we must have started a new load?", url, 
view->pending_snapshot_uri);
     goto out;
+}
 
   for (GList *l = urls; l; l = g_list_next (l)) {
     EphyHistoryURL *history_url = l->data;
-
+g_warning("Top search result: %s", history_url->url);
     /* Take snapshot if this URL is one of the top history results. */
     if (strcmp (history_url->url, view->pending_snapshot_uri) == 0) {
       take_snapshot (view);
@@ -786,6 +794,8 @@ maybe_take_snapshot (EphyWebView *view)
   EphyHistoryService *service;
   EphyHistoryQuery *query;
 
+g_warning ("%s", __FUNCTION__);
+
   view->snapshot_timeout_id = 0;
 
   if (view->error_page != EPHY_WEB_VIEW_ERROR_PAGE_NONE)
@@ -1985,6 +1995,7 @@ load_changed_cb (WebKitWebView   *web_view,
       break;
     }
     case WEBKIT_LOAD_FINISHED:
+g_warning ("LOAD_FINISHED!");
       ephy_web_view_set_loading_message (view, NULL);
 
       /* Ensure we load the icon for this web view, if available. */
diff --git a/embed/web-process-extension/resources/js/overview.js 
b/embed/web-process-extension/resources/js/overview.js
index df65a6272..46f1bcd32 100644
--- a/embed/web-process-extension/resources/js/overview.js
+++ b/embed/web-process-extension/resources/js/overview.js
@@ -221,18 +221,11 @@ Ephy.Overview.Item = class OverviewItem
 
     thumbnailPath()
     {
-        let style = this._thumbnail.style;
-        if (style.isPropertyImplicit('background'))
+        let backgroundImage = this._thumbnail.style.backgroundImage;
+        if (!backgroundImage || !background.startsWith('url("file://'))
             return null;
 
-        let background = style.getPropertyValue('background');
-        if (!background)
-            return null;
-
-        if (background.startsWith('url("file://'))
-            return background.replace('url("file://', '').replace('"); background-size: 100%', '');
-
-        return null;
+        return background.replace('url("file://', '');
     }
 
     setThumbnailPath(path)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]