summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
blob: af639f196395fe2b9f22c93aeb0654e7853e4443 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
/*
    Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
    Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)

    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.
*/

// The documentation in this file was imported from QtWebKit and is thus constrained
// by its LGPL license. Documentation written from scratch for new methods should be
// placed inline in the code as usual.

/*!
    \class QWebEngineSettings
    \since 4.4
    \brief The QWebEngineSettings class provides an object to store the settings used
    by QWebEnginePage.

    \inmodule QtWebEngine

    Each QWebEnginePage object has its own QWebEngineSettings object, which configures the
    settings for that page. If a setting is not configured, then it is looked
    up in the global settings object, which can be accessed using
    globalSettings().

    QWebEngineSettings allows configuration of browser properties, such as font sizes and
    families, the location of a custom style sheet, and generic attributes like
    JavaScript and plugins. Individual attributes are set using the setAttribute()
    function. The \l{QWebEngineSettings::WebAttribute}{WebAttribute} enum further describes
    each attribute.

    QWebEngineSettings also configures global properties such as the web page memory
    cache, icon database, local database storage and offline
    applications storage.

    \section1 Enabling Plugins

    Support for browser plugins can enabled by setting the
    \l{QWebEngineSettings::PluginsEnabled}{PluginsEnabled} attribute. For many applications,
    this attribute is enabled for all pages by setting it on the
    \l{globalSettings()}{global settings object}. Qt WebKit will always ignore this setting
    when processing Qt plugins. The decision to allow a Qt plugin is made by the client
    in its reimplementation of QWebEnginePage::createPlugin().

    \section1 Web Application Support

    WebKit provides support for features specified in \l{HTML 5} that improve the
    performance and capabilities of Web applications. These include client-side
    (offline) storage and the use of a Web application cache.

    Client-side (offline) storage is an improvement over the use of cookies to
    store persistent data in Web applications. Applications can configure and
    enable the use of an offline storage database by calling the
    setOfflineStoragePath() with an appropriate file path, and can limit the quota
    for each application by calling setOfflineStorageDefaultQuota().

    \sa QWebEnginePage::settings(), QWebEngineView::settings(), {WebEngine Tab Browser Example}
*/

/*!
    \fn QWebEngineSettings* QWebEngineSettings::globalSettings()
    Returns the global settings object.

    Any setting changed on the default object is automatically applied to all
    QWebEnginePage instances where the particular setting is not overridden already.
*/

/*!
    \enum QWebEngineSettings::FontFamily

    This enum describes the generic font families defined by CSS 2.
    For more information see the
    \l{http://www.w3.org/TR/REC-CSS2/fonts.html#generic-font-families}{CSS standard}.

    \value StandardFont
    \value FixedFont
    \value SerifFont
    \value SansSerifFont
    \value CursiveFont
    \value FantasyFont
*/

/*!
    \enum QWebEngineSettings::FontSize

    This enum describes the font sizes configurable through QWebEngineSettings.

    \value MinimumFontSize The hard minimum font size.
    \value MinimumLogicalFontSize The minimum logical font size that is applied
        when zooming out with QWebEnginePage::setTextSizeMultiplier().
    \value DefaultFontSize The default font size for regular text.
    \value DefaultFixedFontSize The default font size for fixed-pitch text.
*/

/*!
    \enum QWebEngineSettings::ThirdPartyCookiePolicy

    This enum describes the policies configurable for accepting and sending
    third-party cookies. These are cookies that are set or retrieved when fetching
    a resource that is stored for a different registry-controlled domain from the page containing it.

    \value AlwaysAllowThirdPartyCookies Allow third-party resources to set and retrieve cookies.
    \value AlwaysBlockThirdPartyCookies Never allow third-party resources to set and retrieve cookies.
    \value AllowThirdPartyWithExistingCookies If the cookie jar already contains cookies
        from a third-party, allow it to set and retrieve new and existing cookies.

    \since QtWebKit 2,3
*/

/*!
    \enum QWebEngineSettings::WebGraphic

    This enums describes the standard graphical elements used in webpages.

    \value MissingImageGraphic The replacement graphic shown when an image could not be loaded.
    \value MissingPluginGraphic The replacement graphic shown when a plugin could not be loaded.
    \value DefaultFrameIconGraphic The default icon for QWebEnginePage::icon().
    \value TextAreaSizeGripCornerGraphic The graphic shown for the size grip of text areas.
    \value DeleteButtonGraphic The graphic shown for the WebKit-Editing-Delete-Button in Deletion UI.
    \value InputSpeechButtonGraphic The graphic shown in input fields that support speech recognition.
    \value SearchCancelButtonGraphic The graphic shown for clearing the text in a search field.
    \value SearchCancelButtonPressedGraphic The graphic shown when SearchCancelButtonGraphic is pressed.
*/

/*!
    \enum QWebEngineSettings::WebAttribute

    This enum describes various attributes that are configurable through QWebEngineSettings.

    \value AutoLoadImages Specifies whether images are automatically loaded in
        web pages. This is enabled by default.
    \value DnsPrefetchEnabled Specifies whether Qt WebKit will try to pre-fetch DNS entries to
        speed up browsing. This only works as a global attribute. Only for Qt 4.6 and later. This is disabled by default.
    \value JavascriptEnabled Enables or disables the running of JavaScript
        programs. This is enabled by default
    \value JavaEnabled Enables or disables Java applets.
        Currently Java applets are not supported.
    \value PluginsEnabled Enables or disables plugins in Web pages (e.g. using NPAPI). Qt plugins
        with a mimetype such as "application/x-qt-plugin" are not affected by this setting. This is disabled by default.
    \value PrivateBrowsingEnabled Private browsing prevents WebKit from
        recording visited pages in the history and storing web page icons. This is disabled by default.
    \value JavascriptCanOpenWindows Specifies whether JavaScript programs
        can open new windows. This is disabled by default.
    \value JavascriptCanCloseWindows Specifies whether JavaScript programs
        can close windows. This is disabled by default.
    \value JavascriptCanAccessClipboard Specifies whether JavaScript programs
        can read or write to the clipboard. This is disabled by default.
    \value DeveloperExtrasEnabled Enables extra tools for Web developers.
        Currently this enables the "Inspect" element in the context menu as
        well as the use of QWebEngineInspector which controls the web inspector
        for web site debugging. This is disabled by default.
    \value SpatialNavigationEnabled Enables or disables the Spatial Navigation
        feature, which consists in the ability to navigate between focusable
        elements in a Web page, such as hyperlinks and form controls, by using
        Left, Right, Up and Down arrow keys. For example, if a user presses the
        Right key, heuristics determine whether there is an element he might be
        trying to reach towards the right and which element he probably wants.
        This is disabled by default.
    \value LinksIncludedInFocusChain Specifies whether hyperlinks should be
        included in the keyboard focus chain. This is enabled by default.
    \value ZoomTextOnly Specifies whether the zoom factor on a frame applies
        only to the text or to all content. This is disabled by default.
    \value PrintElementBackgrounds Specifies whether the background color and images
        are also drawn when the page is printed. This is enabled by default.
    \value OfflineStorageDatabaseEnabled Specifies whether support for the HTML 5
        offline storage feature is enabled or not. This is disabled by default.
    \value OfflineWebApplicationCacheEnabled Specifies whether support for the HTML 5
        web application cache feature is enabled or not. This is disabled by default.
    \value LocalStorageEnabled Specifies whether support for the HTML 5
        local storage feature is enabled or not. This is disabled by default.
        (This value was introduced in 4.6.)
    \value LocalStorageDatabaseEnabled \e{This enum value is deprecated.} Use
        QWebEngineSettings::LocalStorageEnabled instead.
    \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are
        allowed to access remote urls. This is disabled by default. For more information
        about security origins and local vs. remote content see QWebEngineSecurityOrigin.
        (This value was introduced in 4.6.)
    \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are
        allowed to access other local urls. This is enabled by default. For more information
        about security origins and local vs. remote content see QWebEngineSecurityOrigin.
    \value XSSAuditingEnabled Specifies whether load requests should be monitored for cross-site
        scripting attempts. Suspicious scripts will be blocked and reported in the inspector's
        JavaScript console. Enabling this feature might have an impact on performance
        and it is disabled by default.
    \value AcceleratedCompositingEnabled This feature, when used in conjunction with
        QGraphicsWebView, accelerates animations of web content. CSS animations of the transform and
        opacity properties will be rendered by composing the cached content of the animated elements.
        This is enabled by default.
    \value TiledBackingStoreEnabled This setting enables the tiled backing store feature
        for a QGraphicsWebView. With the tiled backing store enabled, the web page contents in and around
        the current visible area is speculatively cached to bitmap tiles. The tiles are automatically kept
        in sync with the web page as it changes. Enabling tiling can significantly speed up painting heavy
        operations like scrolling. Enabling the feature increases memory consumption. It does not work well
        with contents using CSS fixed positioning (see also \l{QGraphicsWebView::}{resizesToContents} property).
        \l{QGraphicsWebView::}{tiledBackingStoreFrozen} property allows application to temporarily
        freeze the contents of the backing store. This is disabled by default.
    \value FrameFlatteningEnabled With this setting each subframe is expanded to its contents.
        On touch devices, it is desired to not have any scrollable sub parts of the page
        as it results in a confusing user experience, with scrolling sometimes scrolling sub parts
        and at other times scrolling the page itself. For this reason iframes and framesets are
        barely usable on touch devices. This will flatten all the frames to become one scrollable page.
        This is disabled by default.
    \value SiteSpecificQuirksEnabled This setting enables WebKit's workaround for broken sites. It is
        enabled by default.
    \value CSSGridLayoutEnabled This setting enables support for the CSS 3 Grid Layout module. This
        CSS module is currently only a draft and support for it is disabled by default.
    \value ScrollAnimatorEnabled This setting enables animated scrolling. It is disabled by default.
    \value CaretBrowsingEnabled This setting enables caret browsing. It is disabled by default.
    \value NotificationsEnabled Specifies whether support for the HTML 5 web notifications is enabled
        or not. This is enabled by default.
*/

/*!
    \fn void QWebEngineSettings::setFontSize(FontSize type, int size)
    Sets the font size for \a type to \a size.
*/

/*!
    \fn int QWebEngineSettings::fontSize(FontSize type) const
    Returns the default font size for \a type.
*/

/*!
    \fn void QWebEngineSettings::resetFontSize(FontSize type)
    Resets the font size for \a type to the size specified in the global
    settings object.

    This function has no effect on the global QWebEngineSettings instance.
*/

/*!
    \fn void QWebEngineSettings::setUserStyleSheetUrl(const QUrl& location)
    Specifies the location of a user stylesheet to load with every web page.

    The \a location must be either a path on the local filesystem, or a data URL
    with UTF-8 and Base64 encoded data, such as:

    "data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow=="

    \note If the base64 data is not valid, the style will not be applied.

    \sa userStyleSheetUrl()
*/

/*!
    \fn QUrl QWebEngineSettings::userStyleSheetUrl() const
    Returns the location of the user stylesheet.

    \sa setUserStyleSheetUrl()
*/

/*!
    \fn void QWebEngineSettings::setDefaultTextEncoding(const QString& encoding)
    \since 4.6
    Specifies the default text encoding system.

    The \a encoding, must be a string describing an encoding such as "utf-8",
    "iso-8859-1", etc. If left empty a default value will be used. For a more
    extensive list of encoding names see \l{QTextCodec}

    \sa defaultTextEncoding()
*/

/*!
    \fn QString QWebEngineSettings::defaultTextEncoding() const
    \since 4.6
    Returns the default text encoding.

    \sa setDefaultTextEncoding()
*/

/*!
    \fn void QWebEngineSettings::setIconDatabasePath(const QString& path)
    Sets the path of the icon database to \a path. The icon database is used
    to store "favicons" associated with web sites.

    \a path must point to an existing directory.

    Setting an empty path disables the icon database.

    \sa iconDatabasePath(), clearIconDatabase()
*/

/*!
    \fn QString QWebEngineSettings::iconDatabasePath()
    Returns the path of the icon database or an empty string if the icon
    database is disabled.

    \sa setIconDatabasePath(), clearIconDatabase()
*/

/*!
    \fn void QWebEngineSettings::clearIconDatabase()
    Clears the icon database.
*/

/*!
    \fn QIcon QWebEngineSettings::iconForUrl(const QUrl& url)
    Returns the web site's icon for \a url.

    If the web site does not specify an icon \b OR if the icon is not in the
    database, a null QIcon is returned.

    \note The returned icon's size is arbitrary.

    \sa setIconDatabasePath()
*/

/*!
    \fn void QWebEngineSettings::setWebGraphic(WebGraphic type, const QPixmap& graphic)
    Sets \a graphic to be drawn when Qt WebKit needs to draw an image of the
    given \a type.

    For example, when an image cannot be loaded, the pixmap specified by
    \l{QWebEngineSettings::WebGraphic}{MissingImageGraphic} is drawn instead.

    \sa webGraphic()
*/

/*!
    \fn QPixmap QWebEngineSettings::webGraphic(WebGraphic type)
    Returns a previously set pixmap used to draw replacement graphics of the
    specified \a type.

    \sa setWebGraphic()
*/

/*!
    \fn void QWebEngineSettings::clearMemoryCaches()
    Frees up as much memory as possible by calling the JavaScript garbage collector and cleaning all memory caches such
    as page, object and font cache.

    \since 4.6
 */

/*!
    \fn void QWebEngineSettings::setMaximumPagesInCache(int pages)
    Sets the maximum number of pages to hold in the memory page cache to \a pages.

    The Page Cache allows for a nicer user experience when navigating forth or back
    to pages in the forward/back history, by pausing and resuming up to \a pages.

    For more information about the feature, please refer to:

    http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
*/

/*!
    \fn int QWebEngineSettings::maximumPagesInCache()
    Returns the maximum number of web pages that are kept in the memory cache.
*/

/*!
    \fn void QWebEngineSettings::setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheMaxDead, int totalCapacity)
   Specifies the capacities for the memory cache for dead objects such as
   stylesheets or scripts.

   The \a cacheMinDeadCapacity specifies the \e minimum number of bytes that
   dead objects should consume when the cache is under pressure.

   \a cacheMaxDead is the \e maximum number of bytes that dead objects should
   consume when the cache is \b not under pressure.

   \a totalCapacity specifies the \e maximum number of bytes that the cache
   should consume \b overall.

   The cache is enabled by default. Calling setObjectCacheCapacities(0, 0, 0)
   will disable the cache. Calling it with one non-zero enables it again.
*/

/*!
    \fn void QWebEngineSettings::setThirdPartyCookiePolicy(ThirdPartyCookiePolicy policy)
    Sets the third-party cookie policy, the default is AlwaysAllowThirdPartyCookies.
*/

/*!
    \fn QWebEngineSettings::ThirdPartyCookiePolicy QWebEngineSettings::thirdPartyCookiePolicy() const
    Returns the third-party cookie policy.
*/

/*!
    \fn void QWebEngineSettings::setCSSMediaType(const QString& type)
    Sets the CSS media type to \a type.

    Setting this will override the normal value of the CSS media property.

    \note Setting the value to null QString will restore the default value.
*/

/*!
    \fn QString QWebEngineSettings::cssMediaType() const
    Returns the current CSS media type.

    \note It will only return the value set through setCSSMediaType and not the one used internally.
*/

/*!
    \fn void QWebEngineSettings::setFontFamily(FontFamily which, const QString& family)
    Sets the actual font family to \a family for the specified generic family,
    \a which.
*/

/*!
    \fn QString QWebEngineSettings::fontFamily(FontFamily which) const
    Returns the actual font family for the specified generic font family,
    \a which.
*/

/*!
    \fn void QWebEngineSettings::resetFontFamily(FontFamily which)
    Resets the actual font family specified by \a which to the one set
    in the global QWebEngineSettings instance.

    This function has no effect on the global QWebEngineSettings instance.
*/

/*!
    \fn void QWebEngineSettings::setAttribute(WebAttribute attribute, bool on)

    Enables or disables the specified \a attribute feature depending on the
    value of \a on.
*/

/*!
    \fn bool QWebEngineSettings::testAttribute(WebAttribute attribute) const

    Returns true if \a attribute is enabled; otherwise returns false.
*/

/*!
    \fn void QWebEngineSettings::resetAttribute(WebAttribute attribute)

    Resets the setting of \a attribute to the value specified in the
    global QWebEngineSettings instance.

    This function has no effect on the global QWebEngineSettings instance.

    \sa globalSettings()
*/

/*!
    \fn void QWebEngineSettings::setOfflineStoragePath(const QString& path)
    \since 4.5

    Sets \a path as the save location for HTML5 client-side database storage data.

    \a path must point to an existing directory.

    Setting an empty path disables the feature.

    Support for client-side databases can enabled by setting the
    \l{QWebEngineSettings::OfflineStorageDatabaseEnabled}{OfflineStorageDatabaseEnabled} attribute.

    \sa offlineStoragePath()
*/

/*!
    \fn QString QWebEngineSettings::offlineStoragePath()
    \since 4.5

    Returns the path of the HTML5 client-side database storage or an empty string if the
    feature is disabled.

    \sa setOfflineStoragePath()
*/

/*!
    \fn void QWebEngineSettings::setOfflineStorageDefaultQuota(qint64 maximumSize)
    \since 4.5

    Sets the value of the default quota for new offline storage databases
    to \a maximumSize.
*/

/*!
    \fn qint64 QWebEngineSettings::offlineStorageDefaultQuota()
    \since 4.5

    Returns the value of the default quota for new offline storage databases.
*/

/*!
    \fn void QWebEngineSettings::setOfflineWebApplicationCachePath(const QString& path)
    \since 4.6

    Sets the path for HTML5 offline web application cache storage to \a path.

    An application cache acts like an HTTP cache in some sense. For documents
    that use the application cache via JavaScript, the loader engine will
    first ask the application cache for the contents, before hitting the
    network.

    The feature is described in details at:
    http://dev.w3.org/html5/spec/Overview.html#appcache

    \a path must point to an existing directory.

    Setting an empty path disables the feature.

    Support for offline web application cache storage can enabled by setting the
    \l{QWebEngineSettings::OfflineWebApplicationCacheEnabled}{OfflineWebApplicationCacheEnabled} attribute.

    \sa offlineWebApplicationCachePath()
*/

/*!
    \fn QString QWebEngineSettings::offlineWebApplicationCachePath()
    \since 4.6

    Returns the path of the HTML5 offline web application cache storage
    or an empty string if the feature is disabled.

    \sa setOfflineWebApplicationCachePath()
*/

/*!
    \fn void QWebEngineSettings::setOfflineWebApplicationCacheQuota(qint64 maximumSize)
    \since 4.6

    Sets the value of the quota for the offline web application cache
    to \a maximumSize.
*/

/*!
    \fn qint64 QWebEngineSettings::offlineWebApplicationCacheQuota()
    \since 4.6

    Returns the value of the quota for the offline web application cache.
*/

/*!
    \fn void QWebEngineSettings::setLocalStoragePath(const QString& path)
    \since 4.6

    Sets the path for HTML5 local storage to \a path.

    For more information on HTML5 local storage see the
    \l{http://www.w3.org/TR/webstorage/#the-localstorage-attribute}{Web Storage standard}.

    Support for local storage can enabled by setting the
    \l{QWebEngineSettings::LocalStorageEnabled}{LocalStorageEnabled} attribute.

    \sa localStoragePath()
*/

/*!
    \fn QString QWebEngineSettings::localStoragePath() const
    \since 4.6

    Returns the path for HTML5 local storage.

    \sa setLocalStoragePath()
*/

/*!
    \fn void QWebEngineSettings::enablePersistentStorage(const QString& path)
    \since 4.6

    Enables WebKit data persistence and sets the path to \a path.
    If \a path is empty, the user-specific data location specified by
    \l{QDesktopServices::DataLocation}{DataLocation} will be used instead.

    This method will simultaneously set and enable the iconDatabasePath(),
    localStoragePath(), offlineStoragePath() and offlineWebApplicationCachePath().

    \sa localStoragePath()
*/