RESOLVED INVALID 50004
[GTK] Need 'webview-cache-model' property in WebKitWebSettings
https://bugs.webkit.org/show_bug.cgi?id=50004
Summary [GTK] Need 'webview-cache-model' property in WebKitWebSettings
Joone Hur
Reported 2010-11-23 22:16:22 PST
Currently, WebKitGtk+ offers the following functions to set the webview cache model, - webkit_get_cache_model() - webkit_set_cache_mode() They are not relevant to any gobjects, so these functions seem to be exceptional. I think we had better add a new property(webview-cache-model) to WebKitWebSettings and use the didPerformFirstNavigation callback to set the cache model instead of using the above functions directly. This is an example of the didPerformFirstNavigation callback. void FrameLoaderClient::didPerformFirstNavigation() const { WebKitWebSettings* settings = webkit_web_view_get_settings(getViewFromFrame(m_frame)); WebKitCacheModel cacheModel; g_object_get(settings, "webview-cache-model", &cacheModel, NULL); webViewSetCacheModel(cacheModel); } Mac and Windows port also set the cache model like this.
Attachments
Proposed patch (9.22 KB, patch)
2010-11-24 00:03 PST, Joone Hur
xan.lopez: review-
Proposed Patch2 (9.27 KB, patch)
2010-12-07 05:01 PST, Joone Hur
no flags
Proposed Patch3 (9.26 KB, patch)
2010-12-07 05:18 PST, Joone Hur
joone: review-
Joone Hur
Comment 1 2010-11-24 00:03:49 PST
Created attachment 74727 [details] Proposed patch
Xan Lopez
Comment 2 2010-11-24 03:42:27 PST
Seems there's two different tasks here. One is doing things on the first navigation method, and the other would be deprecating the methods and adding the setting. I believe they should be addressed separately. FWIW, I'm not so sure that the benefit of the setting is enough to deprecate the existing functions; they might be in the webkitwebview.cpp file but they do not have an object in their API (we could create webkitglobals.cpp and move them there with the default_session getter).
Xan Lopez
Comment 3 2010-11-24 03:49:07 PST
It also seems the cache instance and settings are completely global, so I'm not sure of why would you want to constantly set the same value on first navigation?
Xan Lopez
Comment 4 2010-11-24 03:49:39 PST
Comment on attachment 74727 [details] Proposed patch r- mostly because I think this can be done in two steps.
Joone Hur
Comment 5 2010-11-24 06:12:37 PST
(In reply to comment #2) > Seems there's two different tasks here. One is doing things on the first navigation method, and the other would be deprecating the methods and adding the setting. I believe they should be addressed separately. Okay, I will divide the patch into two. > FWIW, I'm not so sure that the benefit of the setting is enough to deprecate the existing functions; they might be in the webkitwebview.cpp file but they do not have an object in their API (we could create webkitglobals.cpp and move them there with the default_session getter). It seems not neat that the webkit_get/set_cache_model functions are introduced at the same level with other gobjects in the reference manual. Also, if the user want to set WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER, the webkit_set_cache model function should be called twice.
Xan Lopez
Comment 6 2010-11-24 07:58:35 PST
(In reply to comment #5) > It seems not neat that the webkit_get/set_cache_model functions are introduced at the same level with other gobjects in the reference manual. This could be solved by just moving the functions to a new webkitglobals.cpp fil. I agree it's ugly. > Also, if the user want to set WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER, the webkit_set_cache model function should be called twice. I don't understand this; why do you have to call it twice?
Joone Hur
Comment 7 2010-11-24 17:11:42 PST
> > Also, if the users want to set WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER, the webkit_set_cache_model function should be called twice. > > I don't understand this; why do you have to call it twice? I mean that we don't need to call it twice in that case. Currently, the cache model is set to WEBKIT_CACHE_MODEL_WEB_BROWSER in webkit_init(), so if we want to set WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER, we have to call webkit_set_cache_model function again. However, if we can set the cache-model in the settings, we just call webkit_set_cache_model() once after getting the cache-model property in didPerformFirstNavigation() because the users can change the cache model through the settings before calling webkit_set_cache_model().
Joone Hur
Comment 8 2010-11-25 19:58:06 PST
(In reply to comment #5) > (In reply to comment #2) > > Seems there's two different tasks here. One is doing things on the first navigation method, and the other would be deprecating the methods and adding the setting. I believe they should be addressed separately. > Okay, I will divide the patch into two. I tried to divide this patch into about the first navigation method and deprecating the methods, but it seems impossible to divide it, because we can't access the settings when webkit_init is called. Therefore, I think didPerformFirstNavigation() is the best place to set the cache_model, because we can give a chance for the users to change the settings before calling webkit_set_cache_model().
Martin Robinson
Comment 9 2010-12-01 08:07:33 PST
Comment on attachment 74727 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=74727&action=review I think this is a good change. I see an issue with this patch though. The Mac port sets the cache model in didPerformFirstNavigation only if it's autodetected. Otherwise it sets the model as soon as the preferences change. We should replicate that behavior. > WebKit/gtk/webkit/webkitprivate.h:311 > + void webViewSetCacheModel(WebKitCacheModel model); > + This only seems to be used in webkitwebview.cpp, so it should be static and private to that file. > WebKit/gtk/webkit/webkitwebview.cpp:4863 > + * Deprecated: Use WebKitWebSettings:webview-cache-model property instead. Should be "Use the"
Joone Hur
Comment 10 2010-12-02 18:23:01 PST
I have filed a new bug #50430 to divide the issue into two such as setting the cache model in didPerformFirstNavigation and introducing the webview-cache-model property, as suggested by Xan.
Joone Hur
Comment 11 2010-12-07 05:01:53 PST
Created attachment 75800 [details] Proposed Patch2 The new webview-cache-model property can coexist with the current cache-model APIs,so we should recommend the user agents to use the new property instead of the cache-model APIs if this patch lands.
Joone Hur
Comment 12 2010-12-07 05:06:01 PST
Comment on attachment 75800 [details] Proposed Patch2 it has a style problem
Joone Hur
Comment 13 2010-12-07 05:18:33 PST
Created attachment 75803 [details] Proposed Patch3 I have submitted the patch again...
WebKit Review Bot
Comment 14 2010-12-07 08:44:57 PST
Attachment 75803 [details] did not pass style-queue: Failed to run "[u'git', u'reset', u'--hard', u'refs/remotes/trunk']" exit_code: 128 error: Could not write new index file. fatal: Could not reset index file to revision 'refs/remotes/trunk'. If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 15 2010-12-07 09:46:05 PST
Attachment 75803 [details] did not pass style-queue: Failed to run "[u'git', u'reset', u'--hard', u'refs/remotes/trunk']" exit_code: 128 error: Could not write new index file. fatal: Could not reset index file to revision 'refs/remotes/trunk'. If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 16 2010-12-07 10:47:15 PST
Attachment 75803 [details] did not pass style-queue: Failed to run "[u'git', u'reset', u'--hard', u'refs/remotes/trunk']" exit_code: 128 error: Could not write new index file. fatal: Could not reset index file to revision 'refs/remotes/trunk'. If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 17 2010-12-07 11:48:16 PST
Attachment 75803 [details] did not pass style-queue: Failed to run "[u'git', u'reset', u'--hard', u'refs/remotes/trunk']" exit_code: 128 error: Could not write new index file. fatal: Could not reset index file to revision 'refs/remotes/trunk'. If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 18 2010-12-07 21:33:51 PST
Attachment 75803 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/update-webkit']" exit_code: 2 Updating OpenSource Incomplete data: Delta source ended unexpectedly at /usr/lib/git-core/git-svn line 5061 Died at WebKitTools/Scripts/update-webkit line 132. If any of these errors are false positives, please file a bug against check-webkit-style.
Martin Robinson
Comment 19 2014-04-08 18:41:45 PDT
The GTK+ port of WebKit1 has been removed.
Note You need to log in before you can comment on or make changes to this bug.