⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webkitwebsettings.cpp

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (C) 2008 Christian Dywan <christian@imendio.com> * Copyright (C) 2008 Nuanti Ltd. * Copyright (C) 2008 Collabora Ltd. * Copyright (C) 2008 Holger Hans Peter Freyther * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB.  If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */#include "config.h"#include "webkitwebsettings.h"#include "webkitprivate.h"#include "FileSystem.h"#include "PluginDatabase.h"/** * SECTION:webkitwebsettings * @short_description: Control the behaviour of a #WebKitWebView * * #WebKitWebSettings can be applied to a #WebKitWebView to control * the to be used text encoding, color, font sizes, printing mode, * script support, loading of images and various other things. * * <informalexample><programlisting> * /<!-- -->* Create a new websettings and disable java script *<!-- -->/ * WebKitWebSettings *settings = webkit_web_settings_new (); * g_object_set (G_OBJECT(settings), "enable-scripts", FALSE, NULL); * * /<!-- -->* Apply the result *<!-- -->/ * webkit_web_view_set_settings (WEBKIT_WEB_VIEW(my_webview), settings); * </programlisting></informalexample> */using namespace WebCore;extern "C" {G_DEFINE_TYPE(WebKitWebSettings, webkit_web_settings, G_TYPE_OBJECT)struct _WebKitWebSettingsPrivate {    gchar* default_encoding;    gchar* cursive_font_family;    gchar* default_font_family;    gchar* fantasy_font_family;    gchar* monospace_font_family;    gchar* sans_serif_font_family;    gchar* serif_font_family;    guint default_font_size;    guint default_monospace_font_size;    guint minimum_font_size;    guint minimum_logical_font_size;    gboolean enforce_96_dpi;    gboolean auto_load_images;    gboolean auto_shrink_images;    gboolean print_backgrounds;    gboolean enable_scripts;    gboolean enable_plugins;    gboolean resizable_text_areas;    gchar* user_stylesheet_uri;    gfloat zoom_step;    gboolean enable_developer_extras;};#define WEBKIT_WEB_SETTINGS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SETTINGS, WebKitWebSettingsPrivate))enum {    PROP_0,    PROP_DEFAULT_ENCODING,    PROP_CURSIVE_FONT_FAMILY,    PROP_DEFAULT_FONT_FAMILY,    PROP_FANTASY_FONT_FAMILY,    PROP_MONOSPACE_FONT_FAMILY,    PROP_SANS_SERIF_FONT_FAMILY,    PROP_SERIF_FONT_FAMILY,    PROP_DEFAULT_FONT_SIZE,    PROP_DEFAULT_MONOSPACE_FONT_SIZE,    PROP_MINIMUM_FONT_SIZE,    PROP_MINIMUM_LOGICAL_FONT_SIZE,    PROP_ENFORCE_96_DPI,    PROP_AUTO_LOAD_IMAGES,    PROP_AUTO_SHRINK_IMAGES,    PROP_PRINT_BACKGROUNDS,    PROP_ENABLE_SCRIPTS,    PROP_ENABLE_PLUGINS,    PROP_RESIZABLE_TEXT_AREAS,    PROP_USER_STYLESHEET_URI,    PROP_ZOOM_STEP,    PROP_ENABLE_DEVELOPER_EXTRAS};static void webkit_web_settings_finalize(GObject* object);static void webkit_web_settings_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec);static void webkit_web_settings_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec);static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass){    GObjectClass* gobject_class = G_OBJECT_CLASS(klass);    gobject_class->finalize = webkit_web_settings_finalize;    gobject_class->set_property = webkit_web_settings_set_property;    gobject_class->get_property = webkit_web_settings_get_property;    GParamFlags flags = (GParamFlags)(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT);    g_object_class_install_property(gobject_class,                                    PROP_DEFAULT_ENCODING,                                    g_param_spec_string(                                    "default-encoding",                                    "Default Encoding",                                    "The default encoding used to display text.",                                    "iso-8859-1",                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_CURSIVE_FONT_FAMILY,                                    g_param_spec_string(                                    "cursive-font-family",                                    "Cursive Font Family",                                    "The default Cursive font family used to display text.",                                    "serif",                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_DEFAULT_FONT_FAMILY,                                    g_param_spec_string(                                    "default-font-family",                                    "Default Font Family",                                    "The default font family used to display text.",                                    "sans-serif",                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_FANTASY_FONT_FAMILY,                                    g_param_spec_string(                                    "fantasy-font-family",                                    "Fantasy Font Family",                                    "The default Fantasy font family used to display text.",                                    "serif",                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_MONOSPACE_FONT_FAMILY,                                    g_param_spec_string(                                    "monospace-font-family",                                    "Monospace Font Family",                                    "The default font family used to display monospace text.",                                    "monospace",                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_SANS_SERIF_FONT_FAMILY,                                    g_param_spec_string(                                    "sans-serif-font-family",                                    "Sans Serif Font Family",                                    "The default Sans Serif font family used to display text.",                                    "sans-serif",                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_SERIF_FONT_FAMILY,                                    g_param_spec_string(                                    "serif-font-family",                                    "Serif Font Family",                                    "The default Serif font family used to display text.",                                    "serif",                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_DEFAULT_FONT_SIZE,                                    g_param_spec_int(                                    "default-font-size",                                    "Default Font Size",                                    "The default font size used to display text.",                                    5, G_MAXINT, 12,                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_DEFAULT_MONOSPACE_FONT_SIZE,                                    g_param_spec_int(                                    "default-monospace-font-size",                                    "Default Monospace Font Size",                                    "The default font size used to display monospace text.",                                    5, G_MAXINT, 10,                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_MINIMUM_FONT_SIZE,                                    g_param_spec_int(                                    "minimum-font-size",                                    "Minimum Font Size",                                    "The minimum font size used to display text.",                                    1, G_MAXINT, 5,                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_MINIMUM_LOGICAL_FONT_SIZE,                                    g_param_spec_int(                                    "minimum-logical-font-size",                                    "Minimum Logical Font Size",                                    "The minimum logical font size used to display text.",                                    1, G_MAXINT, 5,                                    flags));    /**    * WebKitWebSettings:enforce-96-dpi:    *    * Enforce a resolution of 96 DPI. This is meant for compatibility    * with web pages which cope badly with different screen resolutions    * and for automated testing.    * Web browsers and applications that typically display arbitrary    * content from the web should provide a preference for this.    *    * Since: 1.0.3    */    g_object_class_install_property(gobject_class,                                    PROP_ENFORCE_96_DPI,                                    g_param_spec_boolean(                                    "enforce-96-dpi",                                    "Enforce 96 DPI",                                    "Enforce a resolution of 96 DPI",                                    FALSE,                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_AUTO_LOAD_IMAGES,                                    g_param_spec_boolean(                                    "auto-load-images",                                    "Auto Load Images",                                    "Load images automatically.",                                    TRUE,                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_AUTO_SHRINK_IMAGES,                                    g_param_spec_boolean(                                    "auto-shrink-images",                                    "Auto Shrink Images",                                    "Automatically shrink standalone images to fit.",                                    TRUE,                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_PRINT_BACKGROUNDS,                                    g_param_spec_boolean(                                    "print-backgrounds",                                    "Print Backgrounds",                                    "Whether background images should be printed.",                                    TRUE,                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_ENABLE_SCRIPTS,                                    g_param_spec_boolean(                                    "enable-scripts",                                    "Enable Scripts",                                    "Enable embedded scripting languages.",                                    TRUE,                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_ENABLE_PLUGINS,                                    g_param_spec_boolean(                                    "enable-plugins",                                    "Enable Plugins",                                    "Enable embedded plugin objects.",                                    TRUE,                                    flags));    g_object_class_install_property(gobject_class,                                    PROP_RESIZABLE_TEXT_AREAS,                                    g_param_spec_boolean(                                    "resizable-text-areas",                                    "Resizable Text Areas",                                    "Whether text areas are resizable.",                                    TRUE,                                    flags));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -