本文整理汇总了C++中webcore::Settings::setJavaScriptCanOpenWindowsAutomatically方法的典型用法代码示例。如果您正苦于以下问题:C++ Settings::setJavaScriptCanOpenWindowsAutomatically方法的具体用法?C++ Settings::setJavaScriptCanOpenWindowsAutomatically怎么用?C++ Settings::setJavaScriptCanOpenWindowsAutomatically使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::Settings
的用法示例。
在下文中一共展示了Settings::setJavaScriptCanOpenWindowsAutomatically方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
//.........这里部分代码省略.........
global->attributes.value(QWebSettings::WebGLEnabled));
settings->setWebGLEnabled(value);
#if ENABLE(CSS_SHADERS)
// For now, enable CSS shaders when WebGL is enabled.
settings->setCSSCustomFilterEnabled(value);
#endif
#if USE(ACCELERATED_COMPOSITING)
settings->setAcceleratedCompositingForCanvasEnabled(value);
#endif
#endif
#if ENABLE(WEB_AUDIO)
value = attributes.value(QWebSettings::WebAudioEnabled, global->attributes.value(QWebSettings::WebAudioEnabled));
WebCore::RuntimeEnabledFeatures::setWebAudioEnabled(value);
#endif
value = attributes.value(QWebSettings::CSSRegionsEnabled,
global->attributes.value(QWebSettings::CSSRegionsEnabled));
WebCore::RuntimeEnabledFeatures::setCSSRegionsEnabled(value);
value = attributes.value(QWebSettings::CSSCompositingEnabled,
global->attributes.value(QWebSettings::CSSCompositingEnabled));
WebCore::RuntimeEnabledFeatures::setCSSCompositingEnabled(value);
value = attributes.value(QWebSettings::CSSGridLayoutEnabled,
global->attributes.value(QWebSettings::CSSGridLayoutEnabled));
settings->setCSSGridLayoutEnabled(value);
value = attributes.value(QWebSettings::HyperlinkAuditingEnabled,
global->attributes.value(QWebSettings::HyperlinkAuditingEnabled));
settings->setHyperlinkAuditingEnabled(value);
value = attributes.value(QWebSettings::JavascriptCanOpenWindows,
global->attributes.value(QWebSettings::JavascriptCanOpenWindows));
settings->setJavaScriptCanOpenWindowsAutomatically(value);
value = attributes.value(QWebSettings::JavascriptCanCloseWindows,
global->attributes.value(QWebSettings::JavascriptCanCloseWindows));
settings->setAllowScriptsToCloseWindows(value);
value = attributes.value(QWebSettings::JavaEnabled,
global->attributes.value(QWebSettings::JavaEnabled));
settings->setJavaEnabled(value);
value = attributes.value(QWebSettings::PluginsEnabled,
global->attributes.value(QWebSettings::PluginsEnabled));
settings->setPluginsEnabled(value);
value = attributes.value(QWebSettings::PrivateBrowsingEnabled,
global->attributes.value(QWebSettings::PrivateBrowsingEnabled));
settings->setPrivateBrowsingEnabled(value);
value = attributes.value(QWebSettings::SpatialNavigationEnabled,
global->attributes.value(QWebSettings::SpatialNavigationEnabled));
settings->setSpatialNavigationEnabled(value);
value = attributes.value(QWebSettings::JavascriptCanAccessClipboard,
global->attributes.value(QWebSettings::JavascriptCanAccessClipboard));
settings->setDOMPasteAllowed(value);
settings->setJavaScriptCanAccessClipboard(value);
value = attributes.value(QWebSettings::DeveloperExtrasEnabled,
global->attributes.value(QWebSettings::DeveloperExtrasEnabled));
settings->setDeveloperExtrasEnabled(value);
value = attributes.value(QWebSettings::FrameFlatteningEnabled,
global->attributes.value(QWebSettings::FrameFlatteningEnabled));
示例2: apply
void QWebSettingsPrivate::apply()
{
if (settings) {
settings->setTextAreasAreResizable(true);
QWebSettingsPrivate* global = QWebSettings::globalSettings()->d;
QString family = fontFamilies.value(QWebSettings::StandardFont,
global->fontFamilies.value(QWebSettings::StandardFont));
settings->setStandardFontFamily(family);
family = fontFamilies.value(QWebSettings::FixedFont,
global->fontFamilies.value(QWebSettings::FixedFont));
settings->setFixedFontFamily(family);
family = fontFamilies.value(QWebSettings::SerifFont,
global->fontFamilies.value(QWebSettings::SerifFont));
settings->setSerifFontFamily(family);
family = fontFamilies.value(QWebSettings::SansSerifFont,
global->fontFamilies.value(QWebSettings::SansSerifFont));
settings->setSansSerifFontFamily(family);
family = fontFamilies.value(QWebSettings::CursiveFont,
global->fontFamilies.value(QWebSettings::CursiveFont));
settings->setCursiveFontFamily(family);
family = fontFamilies.value(QWebSettings::FantasyFont,
global->fontFamilies.value(QWebSettings::FantasyFont));
settings->setFantasyFontFamily(family);
int size = fontSizes.value(QWebSettings::MinimumFontSize,
global->fontSizes.value(QWebSettings::MinimumFontSize));
settings->setMinimumFontSize(size);
size = fontSizes.value(QWebSettings::MinimumLogicalFontSize,
global->fontSizes.value(QWebSettings::MinimumLogicalFontSize));
settings->setMinimumLogicalFontSize(size);
size = fontSizes.value(QWebSettings::DefaultFontSize,
global->fontSizes.value(QWebSettings::DefaultFontSize));
settings->setDefaultFontSize(size);
size = fontSizes.value(QWebSettings::DefaultFixedFontSize,
global->fontSizes.value(QWebSettings::DefaultFixedFontSize));
settings->setDefaultFixedFontSize(size);
bool value = attributes.value(QWebSettings::AutoLoadImages,
global->attributes.value(QWebSettings::AutoLoadImages));
settings->setLoadsImagesAutomatically(value);
value = attributes.value(QWebSettings::DnsPrefetchEnabled,
global->attributes.value(QWebSettings::DnsPrefetchEnabled));
settings->setDNSPrefetchingEnabled(value);
value = attributes.value(QWebSettings::JavascriptEnabled,
global->attributes.value(QWebSettings::JavascriptEnabled));
settings->setScriptEnabled(value);
#if USE(ACCELERATED_COMPOSITING)
value = attributes.value(QWebSettings::AcceleratedCompositingEnabled,
global->attributes.value(QWebSettings::AcceleratedCompositingEnabled));
settings->setAcceleratedCompositingEnabled(value);
settings->setAcceleratedCompositingFor3DTransformsEnabled(value);
settings->setAcceleratedCompositingForAnimationEnabled(value);
#if USE(TEXTURE_MAPPER)
settings->setAcceleratedCompositingForVideoEnabled(false);
settings->setAcceleratedCompositingForPluginsEnabled(false);
#endif
#endif
#if ENABLE(WEBGL)
value = attributes.value(QWebSettings::WebGLEnabled,
global->attributes.value(QWebSettings::WebGLEnabled));
settings->setWebGLEnabled(value);
#if USE(ACCELERATED_COMPOSITING)
settings->setAcceleratedCompositingForCanvasEnabled(value);
#endif
#endif
value = attributes.value(QWebSettings::HyperlinkAuditingEnabled,
global->attributes.value(QWebSettings::HyperlinkAuditingEnabled));
settings->setHyperlinkAuditingEnabled(value);
value = attributes.value(QWebSettings::JavascriptCanOpenWindows,
global->attributes.value(QWebSettings::JavascriptCanOpenWindows));
settings->setJavaScriptCanOpenWindowsAutomatically(value);
value = attributes.value(QWebSettings::JavascriptCanCloseWindows,
global->attributes.value(QWebSettings::JavascriptCanCloseWindows));
settings->setAllowScriptsToCloseWindows(value);
value = attributes.value(QWebSettings::JavaEnabled,
global->attributes.value(QWebSettings::JavaEnabled));
settings->setJavaEnabled(value);
value = attributes.value(QWebSettings::PluginsEnabled,
global->attributes.value(QWebSettings::PluginsEnabled));
settings->setPluginsEnabled(value);
//.........这里部分代码省略.........
示例3: Sync
//.........这里部分代码省略.........
// ON = 0
// ON_DEMAND = 1
// OFF = 2
jobject pluginState = env->GetObjectField(obj, gFieldIds->mPluginState);
int state = env->CallIntMethod(pluginState, gFieldIds->mOrdinal);
s->setPluginsEnabled(state < 2);
#ifdef ANDROID_PLUGINS
s->setPluginsOnDemand(state == 1);
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
s->setOfflineWebApplicationCacheEnabled(flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mAppCachePath);
if (str) {
WebCore::String path = to_string(env, str);
if (path.length() && WebCore::cacheStorage().cacheDirectory().isNull()) {
WebCore::cacheStorage().setCacheDirectory(path);
// This database is created on the first load. If the file
// doesn't exist, we create it and set its permissions. The
// filename must match that in ApplicationCacheStorage.cpp.
String filename = pathByAppendingComponent(path, "ApplicationCache.db");
int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, permissionFlags660);
if (fd >= 0)
close(fd);
}
}
jlong maxsize = env->GetIntField(obj, gFieldIds->mAppCacheMaxSize);
WebCore::cacheStorage().setMaximumSize(maxsize);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptCanOpenWindowsAutomatically);
s->setJavaScriptCanOpenWindowsAutomatically(flag);
#ifdef ANDROID_LAYOUT
flag = env->GetBooleanField(obj, gFieldIds->mUseWideViewport);
s->setUseWideViewport(flag);
#endif
#ifdef ANDROID_MULTIPLE_WINDOWS
flag = env->GetBooleanField(obj, gFieldIds->mSupportMultipleWindows);
s->setSupportMultipleWindows(flag);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mShrinksStandaloneImagesToFit);
s->setShrinksStandaloneImagesToFit(flag);
#if ENABLE(DATABASE)
flag = env->GetBooleanField(obj, gFieldIds->mDatabaseEnabled);
s->setDatabasesEnabled(flag);
flag = env->GetBooleanField(obj, gFieldIds->mDatabasePathHasBeenSet);
if (flag) {
// If the user has set the database path, sync it to the DatabaseTracker.
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
if (str) {
String path = to_string(env, str);
WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(path);
// This database is created when the first HTML5 Database object is
// instantiated. If the file doesn't exist, we create it and set its
// permissions. The filename must match that in
// DatabaseTracker.cpp.
String filename = SQLiteFileSystem::appendDatabaseFileNameToPath(path, "Databases.db");
int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, permissionFlags660);
if (fd >= 0)
close(fd);
}
示例4: Sync
//.........这里部分代码省略.........
// WebCore asserts that the path is only set once. Since the path is
// shared between WebViews, we can't do the required checks to guard
// against this in the Java WebSettings.
bool isPathValid = false;
if (cacheStorage().cacheDirectory().isNull()) {
str = static_cast<jstring>(env->GetObjectField(obj, gFieldIds->mAppCachePath));
// Check for non-null string as an optimization, as this is the common case.
if (str) {
String path = jstringToWtfString(env, str);
ALOG_ASSERT(!path.empty(), "Java side should never send empty string for AppCache path");
// This database is created on the first load. If the file
// doesn't exist, we create it and set its permissions. The
// filename must match that in ApplicationCacheStorage.cpp.
String filename = pathByAppendingComponent(path, "ApplicationCache.db");
int fd = open(filename.utf8().data(), O_CREAT, permissionFlags660);
if (fd >= 0) {
close(fd);
cacheStorage().setCacheDirectory(path);
isPathValid = true;
}
}
} else
isPathValid = true;
flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
s->setOfflineWebApplicationCacheEnabled(flag && isPathValid);
jlong maxsize = env->GetLongField(obj, gFieldIds->mAppCacheMaxSize);
cacheStorage().setMaximumSize(maxsize);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptCanOpenWindowsAutomatically);
s->setJavaScriptCanOpenWindowsAutomatically(flag);
#ifdef ANDROID_LAYOUT
flag = env->GetBooleanField(obj, gFieldIds->mUseWideViewport);
s->setUseWideViewport(flag);
#endif
#ifdef ANDROID_MULTIPLE_WINDOWS
flag = env->GetBooleanField(obj, gFieldIds->mSupportMultipleWindows);
s->setSupportMultipleWindows(flag);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mShrinksStandaloneImagesToFit);
s->setShrinksStandaloneImagesToFit(flag);
jlong maxImage = env->GetLongField(obj, gFieldIds->mMaximumDecodedImageSize);
// Since in ImageSourceAndroid.cpp, the image will always not exceed
// MAX_SIZE_BEFORE_SUBSAMPLE, there's no need to pass the max value to
// WebCore, which checks (image_width * image_height * 4) as an
// estimation against the max value, which is done in CachedImage.cpp.
// And there're cases where the decoded image size will not
// exceed the max, but the WebCore estimation will. So the following
// code is commented out to fix those cases.
// if (maxImage == 0)
// maxImage = computeMaxBitmapSizeForCache();
s->setMaximumDecodedImageSize(maxImage);
flag = env->GetBooleanField(obj, gFieldIds->mPrivateBrowsingEnabled);
s->setPrivateBrowsingEnabled(flag);
flag = env->GetBooleanField(obj, gFieldIds->mSyntheticLinksEnabled);
s->setDefaultFormatDetection(flag);
s->setFormatDetectionAddress(flag);
s->setFormatDetectionEmail(flag);
s->setFormatDetectionTelephone(flag);
示例5: apply
void QWebSettingsPrivate::apply()
{
if (settings) {
settings->setTextAreasAreResizable(true);
QWebSettingsPrivate *global = QWebSettings::globalSettings()->d;
QString family = fontFamilies.value(QWebSettings::StandardFont,
global->fontFamilies.value(QWebSettings::StandardFont));
settings->setStandardFontFamily(family);
family = fontFamilies.value(QWebSettings::FixedFont,
global->fontFamilies.value(QWebSettings::FixedFont));
settings->setFixedFontFamily(family);
family = fontFamilies.value(QWebSettings::SerifFont,
global->fontFamilies.value(QWebSettings::SerifFont));
settings->setSerifFontFamily(family);
family = fontFamilies.value(QWebSettings::SansSerifFont,
global->fontFamilies.value(QWebSettings::SansSerifFont));
settings->setSansSerifFontFamily(family);
family = fontFamilies.value(QWebSettings::CursiveFont,
global->fontFamilies.value(QWebSettings::CursiveFont));
settings->setCursiveFontFamily(family);
family = fontFamilies.value(QWebSettings::FantasyFont,
global->fontFamilies.value(QWebSettings::FantasyFont));
settings->setFantasyFontFamily(family);
int size = fontSizes.value(QWebSettings::MinimumFontSize,
global->fontSizes.value(QWebSettings::MinimumFontSize));
settings->setMinimumFontSize(size);
size = fontSizes.value(QWebSettings::MinimumLogicalFontSize,
global->fontSizes.value(QWebSettings::MinimumLogicalFontSize));
settings->setMinimumLogicalFontSize(size);
size = fontSizes.value(QWebSettings::DefaultFontSize,
global->fontSizes.value(QWebSettings::DefaultFontSize));
settings->setDefaultFontSize(size);
size = fontSizes.value(QWebSettings::DefaultFixedFontSize,
global->fontSizes.value(QWebSettings::DefaultFixedFontSize));
settings->setDefaultFixedFontSize(size);
bool value = attributes.value(QWebSettings::AutoLoadImages,
global->attributes.value(QWebSettings::AutoLoadImages));
settings->setLoadsImagesAutomatically(value);
value = attributes.value(QWebSettings::JavascriptEnabled,
global->attributes.value(QWebSettings::JavascriptEnabled));
settings->setJavaScriptEnabled(value);
value = attributes.value(QWebSettings::JavascriptCanOpenWindows,
global->attributes.value(QWebSettings::JavascriptCanOpenWindows));
settings->setJavaScriptCanOpenWindowsAutomatically(value);
value = attributes.value(QWebSettings::JavaEnabled,
global->attributes.value(QWebSettings::JavaEnabled));
settings->setJavaEnabled(value);
value = attributes.value(QWebSettings::PluginsEnabled,
global->attributes.value(QWebSettings::PluginsEnabled));
settings->setPluginsEnabled(value);
value = attributes.value(QWebSettings::PrivateBrowsingEnabled,
global->attributes.value(QWebSettings::PrivateBrowsingEnabled));
settings->setPrivateBrowsingEnabled(value);
value = attributes.value(QWebSettings::JavascriptCanAccessClipboard,
global->attributes.value(QWebSettings::JavascriptCanAccessClipboard));
settings->setDOMPasteAllowed(value);
value = attributes.value(QWebSettings::DeveloperExtrasEnabled,
global->attributes.value(QWebSettings::DeveloperExtrasEnabled));
settings->setDeveloperExtrasEnabled(value);
QUrl location = !userStyleSheetLocation.isEmpty() ? userStyleSheetLocation : global->userStyleSheetLocation;
settings->setUserStyleSheetLocation(WebCore::KURL(location));
QString encoding = !defaultTextEncoding.isEmpty() ? defaultTextEncoding: global->defaultTextEncoding;
settings->setDefaultTextEncodingName(encoding);
QString localStoragePath = !localStorageDatabasePath.isEmpty() ? localStorageDatabasePath : global->localStorageDatabasePath;
settings->setLocalStorageDatabasePath(localStoragePath);
value = attributes.value(QWebSettings::ZoomTextOnly,
global->attributes.value(QWebSettings::ZoomTextOnly));
settings->setZoomsTextOnly(value);
value = attributes.value(QWebSettings::PrintElementBackgrounds,
global->attributes.value(QWebSettings::PrintElementBackgrounds));
settings->setShouldPrintBackgrounds(value);
value = attributes.value(QWebSettings::OfflineStorageDatabaseEnabled,
global->attributes.value(QWebSettings::OfflineStorageDatabaseEnabled));
settings->setDatabasesEnabled(value);
//.........这里部分代码省略.........
示例6: Sync
//.........这里部分代码省略.........
// WebCore asserts that the path is only set once. Since the path is
// shared between WebViews, we can't do the required checks to guard
// against this in the Java WebSettings.
bool isPathValid = false;
if (cacheStorage().cacheDirectory().isNull()) {
str = static_cast<jstring>(env->GetObjectField(obj, gFieldIds->mAppCachePath));
// Check for non-null string as an optimization, as this is the common case.
if (str) {
String path = jstringToWtfString(env, str);
ALOG_ASSERT(!path.empty(), "Java side should never send empty string for AppCache path");
// This database is created on the first load. If the file
// doesn't exist, we create it and set its permissions. The
// filename must match that in ApplicationCacheStorage.cpp.
String filename = pathByAppendingComponent(path, "ApplicationCache.db");
int fd = open(filename.utf8().data(), O_CREAT, permissionFlags660);
if (fd >= 0) {
close(fd);
cacheStorage().setCacheDirectory(path);
isPathValid = true;
}
}
} else
isPathValid = true;
flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
s->setOfflineWebApplicationCacheEnabled(flag && isPathValid);
jlong maxsize = env->GetLongField(obj, gFieldIds->mAppCacheMaxSize);
cacheStorage().setMaximumSize(maxsize);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptCanOpenWindowsAutomatically);
s->setJavaScriptCanOpenWindowsAutomatically(flag);
#ifdef ANDROID_LAYOUT
flag = env->GetBooleanField(obj, gFieldIds->mUseWideViewport);
s->setUseWideViewport(flag);
#endif
#ifdef ANDROID_MULTIPLE_WINDOWS
flag = env->GetBooleanField(obj, gFieldIds->mSupportMultipleWindows);
s->setSupportMultipleWindows(flag);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mShrinksStandaloneImagesToFit);
s->setShrinksStandaloneImagesToFit(flag);
jlong maxImage = env->GetLongField(obj, gFieldIds->mMaximumDecodedImageSize);
// Since in ImageSourceAndroid.cpp, the image will always not exceed
// MAX_SIZE_BEFORE_SUBSAMPLE, there's no need to pass the max value to
// WebCore, which checks (image_width * image_height * 4) as an
// estimation against the max value, which is done in CachedImage.cpp.
// And there're cases where the decoded image size will not
// exceed the max, but the WebCore estimation will. So the following
// code is commented out to fix those cases.
// if (maxImage == 0)
// maxImage = computeMaxBitmapSizeForCache();
s->setMaximumDecodedImageSize(maxImage);
flag = env->GetBooleanField(obj, gFieldIds->mPrivateBrowsingEnabled);
s->setPrivateBrowsingEnabled(flag);
flag = env->GetBooleanField(obj, gFieldIds->mSyntheticLinksEnabled);
s->setDefaultFormatDetection(flag);
s->setFormatDetectionAddress(flag);
s->setFormatDetectionEmail(flag);
s->setFormatDetectionTelephone(flag);
示例7: Sync
//.........这里部分代码省略.........
s->setFantasyFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mDefaultTextEncoding);
s->setDefaultTextEncodingName(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mUserAgent);
WebFrame::getWebFrame(pFrame)->setUserAgent(to_string(env, str));
jint size = env->GetIntField(obj, gFieldIds->mMinimumFontSize);
s->setMinimumFontSize(size);
size = env->GetIntField(obj, gFieldIds->mMinimumLogicalFontSize);
s->setMinimumLogicalFontSize(size);
size = env->GetIntField(obj, gFieldIds->mDefaultFontSize);
s->setDefaultFontSize(size);
size = env->GetIntField(obj, gFieldIds->mDefaultFixedFontSize);
s->setDefaultFixedFontSize(size);
jboolean flag = env->GetBooleanField(obj, gFieldIds->mLoadsImagesAutomatically);
s->setLoadsImagesAutomatically(flag);
if (flag)
docLoader->setAutoLoadImages(true);
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
flag = env->GetBooleanField(obj, gFieldIds->mBlockNetworkImage);
s->setBlockNetworkImage(flag);
if(!flag)
docLoader->setBlockNetworkImage(false);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptEnabled);
s->setJavaScriptEnabled(flag);
flag = env->GetBooleanField(obj, gFieldIds->mPluginsEnabled);
s->setPluginsEnabled(flag);
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
s->setOfflineWebApplicationCacheEnabled(flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mAppCachePath);
if (str) {
WebCore::String path = to_string(env, str);
if (path.length() && WebCore::cacheStorage().cacheDirectory().isNull()) {
WebCore::cacheStorage().setCacheDirectory(path);
}
}
jlong maxsize = env->GetIntField(obj, gFieldIds->mAppCacheMaxSize);
WebCore::cacheStorage().setMaximumSize(maxsize);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptCanOpenWindowsAutomatically);
s->setJavaScriptCanOpenWindowsAutomatically(flag);
#ifdef ANDROID_LAYOUT
flag = env->GetBooleanField(obj, gFieldIds->mUseWideViewport);
s->setUseWideViewport(flag);
#endif
#ifdef ANDROID_MULTIPLE_WINDOWS
flag = env->GetBooleanField(obj, gFieldIds->mSupportMultipleWindows);
s->setSupportMultipleWindows(flag);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mShrinksStandaloneImagesToFit);
s->setShrinksStandaloneImagesToFit(flag);
#if ENABLE(DATABASE)
flag = env->GetBooleanField(obj, gFieldIds->mDatabaseEnabled);
s->setDatabasesEnabled(flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
if (str && WebCore::DatabaseTracker::tracker().databaseDirectoryPath().isNull())
WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(to_string(env, str));
#endif
#if ENABLE(DOM_STORAGE)
flag = env->GetBooleanField(obj, gFieldIds->mDomStorageEnabled);
s->setLocalStorageEnabled(flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
if (str) {
WebCore::String localStorageDatabasePath = to_string(env,str);
if (localStorageDatabasePath.length()) {
s->setLocalStorageDatabasePath(localStorageDatabasePath);
}
}
#endif
flag = env->GetBooleanField(obj, gFieldIds->mGeolocationEnabled);
GeolocationPermissions::setAlwaysDeny(!flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mGeolocationDatabasePath);
if (str) {
GeolocationPermissions::setDatabasePath(to_string(env,str));
WebCore::Geolocation::setDatabasePath(to_string(env,str));
}
size = env->GetIntField(obj, gFieldIds->mPageCacheCapacity);
if (size > 0) {
s->setUsesPageCache(true);
WebCore::pageCache()->setCapacity(size);
} else
s->setUsesPageCache(false);
}
示例8: apply
void WebSettingsPrivate::apply(int setting, bool global)
{
if (isGlobal()) {
// Cycle through the page settings and apply the defaults
for (size_t i = 0; i < m_pageSettings.size(); ++i)
m_pageSettings.at(i)->apply(setting, global);
} else {
// Apply the WebCore::Settings to this page's settings
WebCoreSettingsState* webcoreSettingsState = global ? WebSettings::pageGroupSettings(m_webCoreSettingsState->pageGroupName)->d->m_webCoreSettingsState : m_webCoreSettingsState;
WebCore::Settings* settings = getSettings(m_page);
if (setting == AllSettings || setting == IsXSSAuditorEnabled)
settings->setXSSAuditorEnabled(webcoreSettingsState->xssAuditorEnabled);
if (setting == AllSettings || setting == LoadsImagesAutomatically)
settings->setLoadsImagesAutomatically(webcoreSettingsState->loadsImagesAutomatically);
if (setting == AllSettings || setting == ShouldDrawBorderWhileLoadingImages)
settings->setShouldDrawBorderWhileLoadingImages(webcoreSettingsState->shouldDrawBorderWhileLoadingImages);
if (setting == AllSettings || setting == IsJavaScriptEnabled)
settings->setJavaScriptEnabled(webcoreSettingsState->isJavaScriptEnabled);
if (setting == AllSettings || setting == DefaultFixedFontSize)
settings->setDefaultFixedFontSize(webcoreSettingsState->defaultFixedFontSize);
if (setting == AllSettings || setting == DefaultFontSize)
settings->setDefaultFontSize(webcoreSettingsState->defaultFontSize);
if (setting == AllSettings || setting == MinimumFontSize)
settings->setMinimumFontSize(webcoreSettingsState->minimumFontSize);
if (setting == AllSettings || setting == SerifFontFamily)
settings->setSerifFontFamily(webcoreSettingsState->serifFontFamily);
if (setting == AllSettings || setting == FixedFontFamily)
settings->setFixedFontFamily(webcoreSettingsState->fixedFontFamily);
if (setting == AllSettings || setting == SansSerifFontFamily)
settings->setSansSerifFontFamily(webcoreSettingsState->sansSerifFontFamily);
if (setting == AllSettings || setting == StandardFontFamily)
settings->setStandardFontFamily(webcoreSettingsState->standardFontFamily);
if (setting == AllSettings || setting == CanJavaScriptOpenWindowsAutomatically)
settings->setJavaScriptCanOpenWindowsAutomatically(webcoreSettingsState->canJavaScriptOpenWindowsAutomatically);
if (setting == AllSettings || setting == ArePluginsEnabled)
settings->setPluginsEnabled(webcoreSettingsState->arePluginsEnabled);
if (setting == AllSettings || setting == DefaultTextEncodingName)
settings->setDefaultTextEncodingName(webcoreSettingsState->defaultTextEncodingName);
if (setting == AllSettings || setting == UserStyleSheet)
settings->setUserStyleSheetLocation(webcoreSettingsState->userStyleSheet);
if (setting == AllSettings || setting == FirstScheduledLayoutDelay)
settings->setFirstScheduledLayoutDelay(webcoreSettingsState->firstScheduledLayoutDelay);
if (setting == AllSettings || setting == UseWebKitCache)
settings->setUseCache(webcoreSettingsState->useWebKitCache);
#if ENABLE(DATABASE)
if (setting == AllSettings || setting == LocalStoragePath)
settings->setLocalStorageDatabasePath(webcoreSettingsState->localStoragePath);
if (setting == AllSettings || setting == IsDatabasesEnabled) {
WebCore::Database::setIsAvailable(webcoreSettingsState->isDatabasesEnabled);
WebCore::DatabaseSync::setIsAvailable(webcoreSettingsState->isDatabasesEnabled);
}
if (setting == AllSettings || setting == IsLocalStorageEnabled)
settings->setLocalStorageEnabled(webcoreSettingsState->isLocalStorageEnabled);
if (setting == AllSettings || setting == IsOfflineWebApplicationCacheEnabled)
settings->setOfflineWebApplicationCacheEnabled(webcoreSettingsState->isOfflineWebApplicationCacheEnabled);
if (setting == AllSettings || setting == LocalStorageQuota)
getGroupSettings(m_page)->setLocalStorageQuotaBytes(webcoreSettingsState->localStorageQuota);
if (setting == AllSettings || setting == IsFrameFlatteningEnabled)
settings->setFrameFlatteningEnabled(webcoreSettingsState->isFrameFlatteningEnabled);
#endif
// These are *NOT* exposed via the API so just always set them if this
// is global and we're setting all the settings...
if (setting == AllSettings && global) {
settings->setJavaEnabled(webcoreSettingsState->isJavaEnabled);
}
// Apply the Olympia settings to this page's settings
OlympiaSettingsState* olympiaSettingsState = global ? WebSettings::pageGroupSettings(m_webCoreSettingsState->pageGroupName)->d->m_olympiaSettingsState : m_olympiaSettingsState;
if (setting == AllSettings || setting == UserAgentString)
m_olympiaSettingsState->userAgentString = olympiaSettingsState->userAgentString;
if (setting == AllSettings || setting == IsZoomToFitOnLoad)
m_olympiaSettingsState->isZoomToFitOnLoad = olympiaSettingsState->isZoomToFitOnLoad;
if (setting == AllSettings || setting == IsScrollbarsEnabled)
//.........这里部分代码省略.........
示例9: apply
void QWebSettingsPrivate::apply()
{
if (settings) {
settings->setTextAreasAreResizable(true);
QWebSettingsPrivate* global = QWebSettings::globalSettings()->d;
QString family = fontFamilies.value(QWebSettings::StandardFont,
global->fontFamilies.value(QWebSettings::StandardFont));
settings->setStandardFontFamily(family);
family = fontFamilies.value(QWebSettings::FixedFont,
global->fontFamilies.value(QWebSettings::FixedFont));
settings->setFixedFontFamily(family);
family = fontFamilies.value(QWebSettings::SerifFont,
global->fontFamilies.value(QWebSettings::SerifFont));
settings->setSerifFontFamily(family);
family = fontFamilies.value(QWebSettings::SansSerifFont,
global->fontFamilies.value(QWebSettings::SansSerifFont));
settings->setSansSerifFontFamily(family);
family = fontFamilies.value(QWebSettings::CursiveFont,
global->fontFamilies.value(QWebSettings::CursiveFont));
settings->setCursiveFontFamily(family);
family = fontFamilies.value(QWebSettings::FantasyFont,
global->fontFamilies.value(QWebSettings::FantasyFont));
settings->setFantasyFontFamily(family);
int size = fontSizes.value(QWebSettings::MinimumFontSize,
global->fontSizes.value(QWebSettings::MinimumFontSize));
settings->setMinimumFontSize(size);
size = fontSizes.value(QWebSettings::MinimumLogicalFontSize,
global->fontSizes.value(QWebSettings::MinimumLogicalFontSize));
settings->setMinimumLogicalFontSize(size);
size = fontSizes.value(QWebSettings::DefaultFontSize,
global->fontSizes.value(QWebSettings::DefaultFontSize));
settings->setDefaultFontSize(size);
size = fontSizes.value(QWebSettings::DefaultFixedFontSize,
global->fontSizes.value(QWebSettings::DefaultFixedFontSize));
settings->setDefaultFixedFontSize(size);
bool value = attributes.value(QWebSettings::AutoLoadImages,
global->attributes.value(QWebSettings::AutoLoadImages));
settings->setLoadsImagesAutomatically(value);
value = attributes.value(QWebSettings::JavascriptEnabled,
global->attributes.value(QWebSettings::JavascriptEnabled));
settings->setJavaScriptEnabled(value);
#if USE(ACCELERATED_COMPOSITING)
value = attributes.value(QWebSettings::AcceleratedCompositingEnabled,
global->attributes.value(QWebSettings::AcceleratedCompositingEnabled));
settings->setAcceleratedCompositingEnabled(value);
#endif
#if ENABLE(3D_CANVAS)
value = attributes.value(QWebSettings::WebGLEnabled,
global->attributes.value(QWebSettings::WebGLEnabled));
settings->setWebGLEnabled(value);
#endif
value = attributes.value(QWebSettings::JavascriptCanOpenWindows,
global->attributes.value(QWebSettings::JavascriptCanOpenWindows));
settings->setJavaScriptCanOpenWindowsAutomatically(value);
value = attributes.value(QWebSettings::JavaEnabled,
global->attributes.value(QWebSettings::JavaEnabled));
settings->setJavaEnabled(value);
value = attributes.value(QWebSettings::PluginsEnabled,
global->attributes.value(QWebSettings::PluginsEnabled));
settings->setPluginsEnabled(value);
value = attributes.value(QWebSettings::PrivateBrowsingEnabled,
global->attributes.value(QWebSettings::PrivateBrowsingEnabled));
settings->setPrivateBrowsingEnabled(value);
value = attributes.value(QWebSettings::SpatialNavigationEnabled,
global->attributes.value(QWebSettings::SpatialNavigationEnabled));
settings->setSpatialNavigationEnabled(value);
value = attributes.value(QWebSettings::JavascriptCanAccessClipboard,
global->attributes.value(QWebSettings::JavascriptCanAccessClipboard));
settings->setDOMPasteAllowed(value);
settings->setJavaScriptCanAccessClipboard(value);
value = attributes.value(QWebSettings::DeveloperExtrasEnabled,
global->attributes.value(QWebSettings::DeveloperExtrasEnabled));
settings->setDeveloperExtrasEnabled(value);
value = attributes.value(QWebSettings::FrameFlatteningEnabled,
global->attributes.value(QWebSettings::FrameFlatteningEnabled));
settings->setFrameFlatteningEnabled(value);
//.........这里部分代码省略.........