本文整理汇总了C++中webcore::Settings::setJavaScriptEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ Settings::setJavaScriptEnabled方法的具体用法?C++ Settings::setJavaScriptEnabled怎么用?C++ Settings::setJavaScriptEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::Settings
的用法示例。
在下文中一共展示了Settings::setJavaScriptEnabled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position,
const wxSize& size, long style, const wxString& name)
{
if ( (style & wxBORDER_MASK) == 0)
style |= wxBORDER_NONE;
if (!wxWindow::Create(parent, id, position, size, style, name))
return false;
WTF::initializeThreading();
// This is necessary because we are using SharedTimerWin.cpp on Windows,
// due to a problem with exceptions getting eaten when using the callback
// approach to timers (which wx itself uses).
#if __WXMSW__
WebCore::Page::setInstanceHandle(wxGetInstance());
#endif
// this helps reduce flicker on platforms like MSW
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
m_impl = new WebViewPrivate();
WebCore::InitializeLoggingChannelsIfNecessary();
WebCore::HTMLFrameOwnerElement* parentFrame = 0;
WebCore::EditorClientWx* editorClient = new WebCore::EditorClientWx();
m_impl->page = new WebCore::Page(new WebCore::ChromeClientWx(this), new WebCore::ContextMenuClientWx(), editorClient, new WebCore::DragClientWx(), new WebCore::InspectorClientWx(), 0, 0);
editorClient->setPage(m_impl->page);
m_mainFrame = new wxWebFrame(this);
// Default settings - we should have wxWebViewSettings class for this
// eventually
WebCore::Settings* settings = m_impl->page->settings();
settings->setLoadsImagesAutomatically(true);
settings->setDefaultFixedFontSize(13);
settings->setDefaultFontSize(16);
settings->setSerifFontFamily("Times New Roman");
settings->setFixedFontFamily("Courier New");
settings->setSansSerifFontFamily("Arial");
settings->setStandardFontFamily("Times New Roman");
settings->setJavaScriptEnabled(true);
#if ENABLE(DATABASE)
settings->setDatabasesEnabled(true);
#endif
m_isInitialized = true;
return true;
}
示例2: EditorClientES
WebViewES::WebViewES()
{
HTMLFrameOwnerElement* parentFrame = 0;
EditorClientES* editorClient = new EditorClientES();
page = new Page(new ChromeClientES(), new ContextMenuClientES(), editorClient, new DragClientES(), new InspectorClientES(), NULL);
mainFrame = new WebFrameES(this);
// Default settings - we should have WebViewESSettings class for this
// eventually
WebCore::Settings* settings = page->settings();
settings->setLoadsImagesAutomatically(true);
settings->setDefaultFixedFontSize(13);
settings->setDefaultFontSize(16);
settings->setSerifFontFamily("Times New Roman");
settings->setFixedFontFamily("Courier New");
settings->setSansSerifFontFamily("Arial");
settings->setStandardFontFamily("Times New Roman");
settings->setJavaScriptEnabled(true);
}
示例3: 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::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::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);
//.........这里部分代码省略.........
示例4: Sync
static void Sync(JNIEnv* env, jobject obj, jint frame)
{
WebCore::Frame* pFrame = (WebCore::Frame*)frame;
ALOG_ASSERT(pFrame, "%s must take a valid frame pointer!", __FUNCTION__);
WebCore::Settings* s = pFrame->settings();
if (!s)
return;
WebCore::CachedResourceLoader* cachedResourceLoader = pFrame->document()->cachedResourceLoader();
#ifdef ANDROID_LAYOUT
jobject layout = env->GetObjectField(obj, gFieldIds->mLayoutAlgorithm);
WebCore::Settings::LayoutAlgorithm l = (WebCore::Settings::LayoutAlgorithm)
env->CallIntMethod(layout, gFieldIds->mOrdinal);
if (s->layoutAlgorithm() != l) {
s->setLayoutAlgorithm(l);
if (pFrame->document()) {
pFrame->document()->styleSelectorChanged(WebCore::RecalcStyleImmediately);
if (pFrame->document()->renderer()) {
recursiveCleanupForFullLayout(pFrame->document()->renderer());
ALOG_ASSERT(pFrame->view(), "No view for this frame when trying to relayout");
pFrame->view()->layout();
// FIXME: This call used to scroll the page to put the focus into view.
// It worked on the WebViewCore, but now scrolling is done outside of the
// WebViewCore, on the UI side, so there needs to be a new way to do this.
//pFrame->makeFocusVisible();
}
}
}
#endif
jint textSize = env->GetIntField(obj, gFieldIds->mTextSize);
float zoomFactor = textSize / 100.0f;
if (pFrame->textZoomFactor() != zoomFactor)
pFrame->setTextZoomFactor(zoomFactor);
jstring str = (jstring)env->GetObjectField(obj, gFieldIds->mStandardFontFamily);
s->setStandardFontFamily(jstringToWtfString(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mFixedFontFamily);
s->setFixedFontFamily(jstringToWtfString(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mSansSerifFontFamily);
s->setSansSerifFontFamily(jstringToWtfString(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mSerifFontFamily);
s->setSerifFontFamily(jstringToWtfString(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mCursiveFontFamily);
s->setCursiveFontFamily(jstringToWtfString(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mFantasyFontFamily);
s->setFantasyFontFamily(jstringToWtfString(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mDefaultTextEncoding);
s->setDefaultTextEncodingName(jstringToWtfString(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mUserAgent);
WebFrame::getWebFrame(pFrame)->setUserAgent(jstringToWtfString(env, str));
WebViewCore::getWebViewCore(pFrame->view())->setWebRequestContextUserAgent();
jint cacheMode = env->GetIntField(obj, gFieldIds->mOverrideCacheMode);
WebViewCore::getWebViewCore(pFrame->view())->setWebRequestContextCacheMode(cacheMode);
str = (jstring)env->GetObjectField(obj, gFieldIds->mAcceptLanguage);
WebRequestContext::setAcceptLanguage(jstringToWtfString(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)
cachedResourceLoader->setAutoLoadImages(true);
flag = env->GetBooleanField(obj, gFieldIds->mMediaPreloadEnabled);
s->setMediaPreloadEnabled(flag);
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
flag = env->GetBooleanField(obj, gFieldIds->mBlockNetworkImage);
s->setBlockNetworkImage(flag);
if(!flag)
cachedResourceLoader->setBlockNetworkImage(false);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mBlockNetworkLoads);
WebFrame* webFrame = WebFrame::getWebFrame(pFrame);
webFrame->setBlockNetworkLoads(flag);
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptEnabled);
s->setJavaScriptEnabled(flag);
flag = env->GetBooleanField(obj, gFieldIds->mAllowUniversalAccessFromFileURLs);
s->setAllowUniversalAccessFromFileURLs(flag);
//.........这里部分代码省略.........
示例5: Sync
static void Sync(JNIEnv* env, jobject obj, jint frame)
{
WebCore::Frame* pFrame = (WebCore::Frame*)frame;
LOG_ASSERT(pFrame, "%s must take a valid frame pointer!", __FUNCTION__);
WebCore::Settings* s = pFrame->settings();
if (!s)
return;
WebCore::DocLoader* docLoader = pFrame->document()->docLoader();
#ifdef ANDROID_LAYOUT
jobject layout = env->GetObjectField(obj, gFieldIds->mLayoutAlgorithm);
WebCore::Settings::LayoutAlgorithm l = (WebCore::Settings::LayoutAlgorithm)
env->CallIntMethod(layout, gFieldIds->mOrdinal);
if (s->layoutAlgorithm() != l) {
s->setLayoutAlgorithm(l);
if (pFrame->document()) {
pFrame->document()->updateStyleSelector();
if (pFrame->document()->renderer()) {
recursiveCleanupForFullLayout(pFrame->document()->renderer());
LOG_ASSERT(pFrame->view(), "No view for this frame when trying to relayout");
pFrame->view()->layout();
// FIXME: This call used to scroll the page to put the focus into view.
// It worked on the WebViewCore, but now scrolling is done outside of the
// WebViewCore, on the UI side, so there needs to be a new way to do this.
//pFrame->makeFocusVisible();
}
}
}
#endif
jobject textSize = env->GetObjectField(obj, gFieldIds->mTextSize);
float zoomFactor = env->GetIntField(textSize, gFieldIds->mTextSizeValue) / 100.0f;
if (pFrame->zoomFactor() != zoomFactor)
pFrame->setZoomFactor(zoomFactor, /*isTextOnly*/true);
jstring str = (jstring)env->GetObjectField(obj, gFieldIds->mStandardFontFamily);
s->setStandardFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mFixedFontFamily);
s->setFixedFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mSansSerifFontFamily);
s->setSansSerifFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mSerifFontFamily);
s->setSerifFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mCursiveFontFamily);
s->setCursiveFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mFantasyFontFamily);
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);
// 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) {
//.........这里部分代码省略.........
示例6: 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);
//.........这里部分代码省略.........
示例7: Sync
//.........这里部分代码省略.........
WebViewCore::getWebViewCore(pFrame->view())->setWebRequestContextCacheMode(cacheMode);
str = (jstring)env->CallObjectMethod(obj, gFieldIds->mGetAcceptLanguage);//4.2 Merge
WebRequestContext::setAcceptLanguage(jstringToWtfString(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)
cachedResourceLoader->setAutoLoadImages(true);
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
flag = env->GetBooleanField(obj, gFieldIds->mBlockNetworkImage);
s->setBlockNetworkImage(flag);
if(!flag)
cachedResourceLoader->setBlockNetworkImage(false);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mBlockNetworkLoads);
WebFrame* webFrame = WebFrame::getWebFrame(pFrame);
webFrame->setBlockNetworkLoads(flag);
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptEnabled);
s->setJavaScriptEnabled(flag);
// SERI - WebGL >>
#if ENABLE(WEBGL)
flag = env->GetBooleanField(obj, gFieldIds->mWebGLEnabled);
s->setWebGLEnabled(flag);
#endif
// SERI - WebGL <<
flag = env->GetBooleanField(obj, gFieldIds->mAllowUniversalAccessFromFileURLs);
s->setAllowUniversalAccessFromFileURLs(flag);
flag = env->GetBooleanField(obj, gFieldIds->mAllowFileAccessFromFileURLs);
s->setAllowFileAccessFromFileURLs(flag);
// Hyperlink auditing (the ping attribute) has similar privacy
// considerations as does the running of JavaScript, so to keep the UI
// simpler, we leverage the same setting.
s->setHyperlinkAuditingEnabled(flag);
// 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)
// We only enable AppCache if it's been enabled with a call to
// setAppCacheEnabled() and if a valid path has been supplied to
示例8: Sync
static void Sync(JNIEnv* env, jobject obj, jint frame)
{
WebCore::Frame* pFrame = (WebCore::Frame*)frame;
LOG_ASSERT(pFrame, "%s must take a valid frame pointer!", __FUNCTION__);
WebCore::Settings* s = pFrame->settings();
if (!s)
return;
WebCore::DocLoader* docLoader = pFrame->document()->docLoader();
#ifdef ANDROID_LAYOUT
jobject layout = env->GetObjectField(obj, gFieldIds->mLayoutAlgorithm);
WebCore::Settings::LayoutAlgorithm l = (WebCore::Settings::LayoutAlgorithm)
env->CallIntMethod(layout, gFieldIds->mOrdinal);
if (s->layoutAlgorithm() != l) {
s->setLayoutAlgorithm(l);
if (pFrame->document()) {
pFrame->document()->updateStyleSelector();
if (pFrame->document()->renderer()) {
recursiveCleanupForFullLayout(pFrame->document()->renderer());
LOG_ASSERT(pFrame->view(), "No view for this frame when trying to relayout");
pFrame->view()->layout();
// FIXME: This call used to scroll the page to put the focus into view.
// It worked on the WebViewCore, but now scrolling is done outside of the
// WebViewCore, on the UI side, so there needs to be a new way to do this.
//pFrame->makeFocusVisible();
}
}
}
#endif
jobject textSize = env->GetObjectField(obj, gFieldIds->mTextSize);
float zoomFactor = env->GetIntField(textSize, gFieldIds->mTextSizeValue) / 100.0f;
if (pFrame->zoomFactor() != zoomFactor)
pFrame->setZoomFactor(zoomFactor, /*isTextOnly*/true);
jstring str = (jstring)env->GetObjectField(obj, gFieldIds->mStandardFontFamily);
s->setStandardFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mFixedFontFamily);
s->setFixedFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mSansSerifFontFamily);
s->setSansSerifFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mSerifFontFamily);
s->setSerifFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mCursiveFontFamily);
s->setCursiveFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mFantasyFontFamily);
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);
//.........这里部分代码省略.........
示例9: 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)
//.........这里部分代码省略.........