summaryrefslogtreecommitdiff
path: root/Source/WebKit/win/WebView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/win/WebView.cpp')
-rw-r--r--Source/WebKit/win/WebView.cpp289
1 files changed, 188 insertions, 101 deletions
diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp
index 1b4259062..b28011bec 100644
--- a/Source/WebKit/win/WebView.cpp
+++ b/Source/WebKit/win/WebView.cpp
@@ -64,10 +64,9 @@
#include "resource.h"
#include <JavaScriptCore/APICast.h>
#include <JavaScriptCore/InitializeThreading.h>
+#include <JavaScriptCore/JSCJSValue.h>
#include <JavaScriptCore/JSLock.h>
-#include <JavaScriptCore/JSValue.h>
#include <WebCore/AXObjectCache.h>
-#include <WebCore/AbstractDatabase.h>
#include <WebCore/ApplicationCacheStorage.h>
#include <WebCore/BString.h>
#include <WebCore/BackForwardListImpl.h>
@@ -76,6 +75,7 @@
#include <WebCore/ContextMenu.h>
#include <WebCore/ContextMenuController.h>
#include <WebCore/Cursor.h>
+#include <WebCore/DatabaseManager.h>
#include <WebCore/Document.h>
#include <WebCore/DocumentMarkerController.h>
#include <WebCore/DragController.h>
@@ -100,13 +100,14 @@
#include <WebCore/HTMLMediaElement.h>
#include <WebCore/HTMLNames.h>
#include <WebCore/HWndDC.h>
+#include <WebCore/HistoryController.h>
#include <WebCore/HistoryItem.h>
#include <WebCore/HitTestRequest.h>
#include <WebCore/HitTestResult.h>
+#include <WebCore/InitializeLogging.h>
#include <WebCore/IntRect.h>
#include <WebCore/JSElement.h>
#include <WebCore/KeyboardEvent.h>
-#include <WebCore/Logging.h>
#include <WebCore/MIMETypeRegistry.h>
#include <WebCore/MemoryCache.h>
#include <WebCore/Page.h>
@@ -131,6 +132,7 @@
#include <WebCore/ResourceRequest.h>
#include <WebCore/RuntimeEnabledFeatures.h>
#include <WebCore/SchemeRegistry.h>
+#include <WebCore/ScriptController.h>
#include <WebCore/ScriptValue.h>
#include <WebCore/Scrollbar.h>
#include <WebCore/ScrollbarTheme.h>
@@ -154,7 +156,6 @@
#if USE(CFNETWORK)
#include <CFNetwork/CFURLCachePriv.h>
#include <CFNetwork/CFURLProtocolPriv.h>
-#include <WebCore/CookieStorageCFNet.h>
#include <WebKitSystemInterface/WebKitSystemInterface.h>
#endif
@@ -194,11 +195,20 @@ using JSC::JSLock;
static HMODULE accessibilityLib;
static HashSet<WebView*> pendingDeleteBackingStoreSet;
+static CFStringRef WebKitLocalCacheDefaultsKey = CFSTR("WebKitLocalCache");
+
static String webKitVersionString();
WebView* kit(Page* page)
{
- return page ? static_cast<WebView*>(static_cast<WebChromeClient*>(page->chrome()->client())->webView()) : 0;
+ if (!page)
+ return 0;
+
+ ChromeClient* chromeClient = page->chrome().client();
+ if (chromeClient->isEmptyChromeClient())
+ return 0;
+
+ return static_cast<WebChromeClient*>(chromeClient)->webView();
}
static inline AtomicString toAtomicString(BSTR bstr)
@@ -366,7 +376,6 @@ WebView::WebView()
, m_isBeingDestroyed(false)
, m_paintCount(0)
, m_hasSpellCheckerDocumentTag(false)
- , m_smartInsertDeleteEnabled(false)
, m_didClose(false)
, m_inIMEComposition(0)
, m_toolTipHwnd(0)
@@ -374,7 +383,6 @@ WebView::WebView()
, m_topLevelParent(0)
, m_deleteBackingStoreTimerActive(false)
, m_transparent(false)
- , m_selectTrailingWhitespaceEnabled(false)
, m_lastPanX(0)
, m_lastPanY(0)
, m_xOverpan(0)
@@ -470,10 +478,15 @@ void WebView::setCacheModel(WebCacheModel cacheModel)
if (s_didSetCacheModel && cacheModel == s_cacheModel)
return;
- RetainPtr<CFURLCacheRef> cfurlCache(AdoptCF, CFURLCacheCopySharedURLCache());
- RetainPtr<CFStringRef> cfurlCacheDirectory(AdoptCF, wkCopyFoundationCacheDirectory(0));
- if (!cfurlCacheDirectory)
- cfurlCacheDirectory = WebCore::localUserSpecificStorageDirectory().createCFString();
+ RetainPtr<CFURLCacheRef> cfurlCache = adoptCF(CFURLCacheCopySharedURLCache());
+ RetainPtr<CFStringRef> cfurlCacheDirectory = adoptCF(wkCopyFoundationCacheDirectory(0));
+ if (!cfurlCacheDirectory) {
+ RetainPtr<CFPropertyListRef> preference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));
+ if (preference && (CFStringGetTypeID() == CFGetTypeID(preference.get())))
+ cfurlCacheDirectory = adoptCF(static_cast<CFStringRef>(preference.leakRef()));
+ else
+ cfurlCacheDirectory = WebCore::localUserSpecificStorageDirectory().createCFString();
+ }
// As a fudge factor, use 1000 instead of 1024, in case the reported byte
// count doesn't align exactly to a megabyte boundary.
@@ -717,6 +730,7 @@ HRESULT STDMETHODCALLTYPE WebView::close()
setHostWindow(0);
+ setAccessibilityDelegate(0);
setDownloadDelegate(0);
setEditingDelegate(0);
setFrameLoadDelegate(0);
@@ -1287,7 +1301,7 @@ bool WebView::canHandleRequest(const WebCore::ResourceRequest& request)
return true;
#if USE(CFNETWORK)
- if (CFURLProtocolCanHandleRequest(request.cfURLRequest()))
+ if (CFURLProtocolCanHandleRequest(request.cfURLRequest(UpdateHTTPBody)))
return true;
// FIXME: Mac WebKit calls _representationExistsForURLScheme here
@@ -1335,7 +1349,7 @@ bool WebView::handleContextMenuEvent(WPARAM wParam, LPARAM lParam)
m_page->contextMenuController()->clearContextMenu();
IntPoint documentPoint(m_page->mainFrame()->view()->windowToContents(coords));
- HitTestResult result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(documentPoint, false);
+ HitTestResult result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(documentPoint);
Frame* targetFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController()->focusedOrMainFrame();
targetFrame->view()->setCursor(pointerCursor());
@@ -1370,12 +1384,12 @@ bool WebView::handleContextMenuEvent(WPARAM wParam, LPARAM lParam)
m_uiDelegate->hasCustomMenuImplementation(&hasCustomMenus);
if (hasCustomMenus)
- m_uiDelegate->trackCustomPopupMenu((IWebView*)this, (OLE_HANDLE)(ULONG64)coreMenu->nativeMenu(), &point);
+ m_uiDelegate->trackCustomPopupMenu((IWebView*)this, (OLE_HANDLE)(ULONG64)coreMenu->platformContextMenu(), &point);
else {
// Surprisingly, TPM_RIGHTBUTTON means that items are selectable with either the right OR left mouse button
UINT flags = TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_VERPOSANIMATION | TPM_HORIZONTAL
| TPM_LEFTALIGN | TPM_HORPOSANIMATION;
- ::TrackPopupMenuEx(coreMenu->nativeMenu(), flags, point.x, point.y, m_viewWindow, 0);
+ ::TrackPopupMenuEx(coreMenu->platformContextMenu(), flags, point.x, point.y, m_viewWindow, 0);
}
return true;
@@ -1554,7 +1568,7 @@ bool WebView::gestureNotify(WPARAM wParam, LPARAM lParam)
bool hitScrollbar = false;
POINT gestureBeginPoint = {gn->ptsLocation.x, gn->ptsLocation.y};
- HitTestRequest request(HitTestRequest::ReadOnly);
+ HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowShadowContent);
for (Frame* childFrame = m_page->mainFrame(); childFrame; childFrame = EventHandler::subframeForTargetNode(m_gestureTargetNode.get())) {
FrameView* frameView = childFrame->view();
if (!frameView)
@@ -1813,11 +1827,11 @@ bool WebView::execCommand(WPARAM wParam, LPARAM /*lParam*/)
Frame* frame = m_page->focusController()->focusedOrMainFrame();
switch (LOWORD(wParam)) {
case SelectAll:
- return frame->editor()->command("SelectAll").execute();
+ return frame->editor().command("SelectAll").execute();
case Undo:
- return frame->editor()->command("Undo").execute();
+ return frame->editor().command("Undo").execute();
case Redo:
- return frame->editor()->command("Redo").execute();
+ return frame->editor().command("Redo").execute();
}
return false;
}
@@ -1964,7 +1978,7 @@ bool WebView::handleEditingKeyboardEvent(KeyboardEvent* evt)
if (!keyEvent || keyEvent->isSystemKey()) // do not treat this as text input if it's a system key event
return false;
- Editor::Command command = frame->editor()->command(interpretKeyEvent(evt));
+ Editor::Command command = frame->editor().command(interpretKeyEvent(evt));
if (keyEvent->type() == PlatformEvent::RawKeyDown) {
// WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
@@ -1980,7 +1994,7 @@ bool WebView::handleEditingKeyboardEvent(KeyboardEvent* evt)
if (evt->charCode() < ' ')
return false;
- return frame->editor()->insertText(evt->keyEvent()->text(), evt);
+ return frame->editor().insertText(evt->keyEvent()->text(), evt);
}
bool WebView::keyDown(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown)
@@ -2527,11 +2541,20 @@ HRESULT STDMETHODCALLTYPE WebView::canShowMIMEType(
if (!canShow)
return E_POINTER;
- *canShow = MIMETypeRegistry::isSupportedImageMIMEType(mimeTypeStr) ||
- MIMETypeRegistry::isSupportedNonImageMIMEType(mimeTypeStr) ||
- (m_page && m_page->pluginData() && m_page->pluginData()->supportsMimeType(mimeTypeStr)) ||
- shouldUseEmbeddedView(mimeTypeStr);
-
+ Frame* coreFrame = core(m_mainFrame);
+ bool allowPlugins = coreFrame && coreFrame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin);
+
+ *canShow = MIMETypeRegistry::isSupportedImageMIMEType(mimeTypeStr)
+ || MIMETypeRegistry::isSupportedNonImageMIMEType(mimeTypeStr);
+
+ if (!*canShow && m_page && m_page->pluginData()) {
+ *canShow = (m_page->pluginData()->supportsMimeType(mimeTypeStr, PluginData::AllPlugins) && allowPlugins)
+ || m_page->pluginData()->supportsMimeType(mimeTypeStr, PluginData::OnlyApplicationPlugins);
+ }
+
+ if (!*canShow)
+ *canShow = shouldUseEmbeddedView(mimeTypeStr);
+
return S_OK;
}
@@ -2582,6 +2605,13 @@ static void WebKitSetApplicationCachePathIfNecessary()
return;
String path = localUserSpecificStorageDirectory();
+
+#if USE(CF)
+ RetainPtr<CFPropertyListRef> cacheDirectoryPreference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));
+ if (cacheDirectoryPreference && (CFStringGetTypeID() == CFGetTypeID(cacheDirectoryPreference.get())))
+ path = static_cast<CFStringRef>(cacheDirectoryPreference.get());
+#endif
+
if (!path.isNull())
cacheStorage().setCacheDirectory(path);
@@ -2653,11 +2683,15 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
#if !LOG_DISABLED
initializeLoggingChannelsIfNecessary();
#endif // !LOG_DISABLED
+
+ // Initialize our platform strategies first before invoking the rest
+ // of the initialization code which may depend on the strategies.
+ WebPlatformStrategies::initialize();
+
#if ENABLE(SQL_DATABASE)
WebKitInitializeWebDatabasesIfNecessary();
#endif
WebKitSetApplicationCachePathIfNecessary();
- WebPlatformStrategies::initialize();
Settings::setDefaultMinDOMTimerInterval(0.004);
didOneTimeInitialization = true;
@@ -2778,7 +2812,7 @@ void WebView::setToolTip(const String& toolTip)
info.cbSize = sizeof(info);
info.uFlags = TTF_IDISHWND;
info.uId = reinterpret_cast<UINT_PTR>(m_viewWindow);
- info.lpszText = const_cast<UChar*>(m_toolTip.charactersWithNullTermination());
+ info.lpszText = const_cast<UChar*>(m_toolTip.charactersWithNullTermination().data());
::SendMessage(m_toolTipHwnd, TTM_UPDATETIPTEXT, 0, reinterpret_cast<LPARAM>(&info));
}
@@ -2832,9 +2866,43 @@ void WebView::dispatchDidReceiveIconFromWebFrame(WebFrame* frame)
{
registerForIconNotification(false);
- if (m_frameLoadDelegate)
- // FIXME: <rdar://problem/5491010> - Pass in the right HBITMAP.
- m_frameLoadDelegate->didReceiveIcon(this, 0, frame);
+ if (m_frameLoadDelegate) {
+ String str = frame->url().string();
+
+ IntSize sz(16, 16);
+
+ BitmapInfo bmInfo = BitmapInfo::create(sz);
+
+ HBITMAP hBitmap = 0;
+
+ Image* icon = iconDatabase().synchronousIconForPageURL(str, sz);
+
+ if (icon && icon->width()) {
+ HWndDC dc(0);
+ hBitmap = CreateDIBSection(dc, &bmInfo, DIB_RGB_COLORS, 0, 0, 0);
+ icon->getHBITMAPOfSize(hBitmap, &static_cast<SIZE>(sz));
+ }
+
+ HRESULT hr = m_frameLoadDelegate->didReceiveIcon(this, (OLE_HANDLE)hBitmap, frame);
+ if (hr == E_NOTIMPL)
+ DeleteObject(hBitmap);
+ }
+}
+
+HRESULT WebView::setAccessibilityDelegate(
+ /* [in] */ IAccessibilityDelegate* d)
+{
+ m_accessibilityDelegate = d;
+ return S_OK;
+}
+
+HRESULT WebView::accessibilityDelegate(
+ /* [out][retval] */ IAccessibilityDelegate** d)
+{
+ if (!m_accessibilityDelegate)
+ return E_POINTER;
+
+ return m_accessibilityDelegate.copyRefTo(d);
}
HRESULT STDMETHODCALLTYPE WebView::setUIDelegate(
@@ -3426,7 +3494,7 @@ HRESULT STDMETHODCALLTYPE WebView::updateFocusedAndActiveState()
HRESULT STDMETHODCALLTYPE WebView::executeCoreCommandByName(BSTR name, BSTR value)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->command(toString(name)).execute(toString(value));
+ m_page->focusController()->focusedOrMainFrame()->editor().command(toString(name)).execute(toString(value));
return S_OK;
}
@@ -3600,7 +3668,7 @@ HRESULT STDMETHODCALLTYPE WebView::elementAtPoint(
IntPoint webCorePoint = IntPoint(point->x, point->y);
HitTestResult result = HitTestResult(webCorePoint);
if (frame->contentRenderer())
- result = frame->eventHandler()->hitTestResultAtPoint(webCorePoint, false);
+ result = frame->eventHandler()->hitTestResultAtPoint(webCorePoint);
*elementDictionary = WebElementPropertyBag::createInstance(result);
return S_OK;
}
@@ -3653,7 +3721,7 @@ HRESULT STDMETHODCALLTYPE WebView::selectedText(
if (!focusedFrame)
return E_FAIL;
- String frameSelectedText = focusedFrame->editor()->selectedText();
+ String frameSelectedText = focusedFrame->editor().selectedText();
*text = SysAllocStringLen(frameSelectedText.characters(), frameSelectedText.length());
if (!*text && frameSelectedText.length())
return E_OUTOFMEMORY;
@@ -4079,32 +4147,34 @@ HRESULT STDMETHODCALLTYPE WebView::typingStyle(
HRESULT STDMETHODCALLTYPE WebView::setSmartInsertDeleteEnabled(
/* [in] */ BOOL flag)
{
- m_smartInsertDeleteEnabled = !!flag;
- if (m_smartInsertDeleteEnabled)
- setSelectTrailingWhitespaceEnabled(false);
+ if (m_page->settings()->smartInsertDeleteEnabled() != !!flag) {
+ m_page->settings()->setSmartInsertDeleteEnabled(!!flag);
+ setSelectTrailingWhitespaceEnabled(!flag);
+ }
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::smartInsertDeleteEnabled(
/* [retval][out] */ BOOL* enabled)
{
- *enabled = m_smartInsertDeleteEnabled ? TRUE : FALSE;
+ *enabled = m_page->settings()->smartInsertDeleteEnabled() ? TRUE : FALSE;
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::setSelectTrailingWhitespaceEnabled(
/* [in] */ BOOL flag)
{
- m_selectTrailingWhitespaceEnabled = !!flag;
- if (m_selectTrailingWhitespaceEnabled)
- setSmartInsertDeleteEnabled(false);
+ if (m_page->settings()->selectTrailingWhitespaceEnabled() != !!flag) {
+ m_page->settings()->setSelectTrailingWhitespaceEnabled(!!flag);
+ setSmartInsertDeleteEnabled(!flag);
+ }
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::isSelectTrailingWhitespaceEnabled(
/* [retval][out] */ BOOL* enabled)
{
- *enabled = m_selectTrailingWhitespaceEnabled ? TRUE : FALSE;
+ *enabled = m_page->settings()->selectTrailingWhitespaceEnabled() ? TRUE : FALSE;
return S_OK;
}
@@ -4236,38 +4306,38 @@ HRESULT STDMETHODCALLTYPE WebView::hasSelectedRange(
HRESULT STDMETHODCALLTYPE WebView::cutEnabled(
/* [retval][out] */ BOOL* enabled)
{
- Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
- *enabled = editor->canCut() || editor->canDHTMLCut();
+ Editor& editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ *enabled = editor.canCut() || editor.canDHTMLCut();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::copyEnabled(
/* [retval][out] */ BOOL* enabled)
{
- Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
- *enabled = editor->canCopy() || editor->canDHTMLCopy();
+ Editor& editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ *enabled = editor.canCopy() || editor.canDHTMLCopy();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::pasteEnabled(
/* [retval][out] */ BOOL* enabled)
{
- Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
- *enabled = editor->canPaste() || editor->canDHTMLPaste();
+ Editor& editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ *enabled = editor.canPaste() || editor.canDHTMLPaste();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::deleteEnabled(
/* [retval][out] */ BOOL* enabled)
{
- *enabled = m_page->focusController()->focusedOrMainFrame()->editor()->canDelete();
+ *enabled = m_page->focusController()->focusedOrMainFrame()->editor().canDelete();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::editingEnabled(
/* [retval][out] */ BOOL* enabled)
{
- *enabled = m_page->focusController()->focusedOrMainFrame()->editor()->canEdit();
+ *enabled = m_page->focusController()->focusedOrMainFrame()->editor().canEdit();
return S_OK;
}
@@ -4319,7 +4389,7 @@ HRESULT STDMETHODCALLTYPE WebView::replaceSelectionWithText(
/* [in] */ BSTR text)
{
Position start = m_page->mainFrame()->selection()->selection().start();
- m_page->focusController()->focusedOrMainFrame()->editor()->insertText(toString(text), 0);
+ m_page->focusController()->focusedOrMainFrame()->editor().insertText(toString(text), 0);
m_page->mainFrame()->selection()->setBase(start);
return S_OK;
}
@@ -4340,8 +4410,8 @@ HRESULT STDMETHODCALLTYPE WebView::replaceSelectionWithArchive(
HRESULT STDMETHODCALLTYPE WebView::deleteSelection( void)
{
- Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
- editor->deleteSelectionWithSmartDelete(editor->canSmartCopyOrDelete());
+ Editor& editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ editor.deleteSelectionWithSmartDelete(editor.canSmartCopyOrDelete());
return S_OK;
}
@@ -4363,28 +4433,28 @@ HRESULT STDMETHODCALLTYPE WebView::applyStyle(
HRESULT STDMETHODCALLTYPE WebView::copy(
/* [in] */ IUnknown* /*sender*/)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->command("Copy").execute();
+ m_page->focusController()->focusedOrMainFrame()->editor().command("Copy").execute();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::cut(
/* [in] */ IUnknown* /*sender*/)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->command("Cut").execute();
+ m_page->focusController()->focusedOrMainFrame()->editor().command("Cut").execute();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::paste(
/* [in] */ IUnknown* /*sender*/)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->command("Paste").execute();
+ m_page->focusController()->focusedOrMainFrame()->editor().command("Paste").execute();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::copyURL(
/* [in] */ BSTR url)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(MarshallingHelpers::BSTRToKURL(url), "");
+ m_page->focusController()->focusedOrMainFrame()->editor().copyURL(MarshallingHelpers::BSTRToKURL(url), "");
return S_OK;
}
@@ -4406,7 +4476,7 @@ HRESULT STDMETHODCALLTYPE WebView::pasteFont(
HRESULT STDMETHODCALLTYPE WebView::delete_(
/* [in] */ IUnknown* /*sender*/)
{
- m_page->focusController()->focusedOrMainFrame()->editor()->command("Delete").execute();
+ m_page->focusController()->focusedOrMainFrame()->editor().command("Delete").execute();
return S_OK;
}
@@ -4488,7 +4558,7 @@ HRESULT STDMETHODCALLTYPE WebView::checkSpelling(
return E_FAIL;
}
- core(m_mainFrame)->editor()->advanceToNextMisspelling();
+ core(m_mainFrame)->editor().advanceToNextMisspelling();
return S_OK;
}
@@ -4507,7 +4577,7 @@ HRESULT STDMETHODCALLTYPE WebView::showGuessPanel(
m_editingDelegate->showSpellingUI(FALSE);
}
- core(m_mainFrame)->editor()->advanceToNextMisspelling(true);
+ core(m_mainFrame)->editor().advanceToNextMisspelling(true);
m_editingDelegate->showSpellingUI(TRUE);
return S_OK;
}
@@ -4674,9 +4744,20 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
return hr;
RuntimeEnabledFeatures::setCSSRegionsEnabled(!!enabled);
+ hr = preferences->areSeamlessIFramesEnabled(&enabled);
+ if (FAILED(hr))
+ return hr;
+ RuntimeEnabledFeatures::setSeamlessIFramesEnabled(!!enabled);
+
hr = preferences->privateBrowsingEnabled(&enabled);
if (FAILED(hr))
return hr;
+#if PLATFORM(WIN) || USE(CFNETWORK)
+ if (enabled)
+ WebFrameNetworkingContext::ensurePrivateBrowsingSession();
+ else
+ WebFrameNetworkingContext::destroyPrivateBrowsingSession();
+#endif
settings->setPrivateBrowsingEnabled(!!enabled);
hr = preferences->sansSerifFontFamily(&str);
@@ -4710,7 +4791,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
if (FAILED(hr))
return hr;
- RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(kCFAllocatorDefault, toString(str).createCFString().get(), 0));
+ RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithString(kCFAllocatorDefault, toString(str).createCFString().get(), 0));
// Check if the passed in string is a path and convert it to a URL.
// FIXME: This is a workaround for nightly builds until we can get Safari to pass
@@ -4723,7 +4804,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
if (!WideCharToMultiByte(CP_UTF8, 0, str, len, (LPSTR)utf8Path.data(), result, 0, 0))
return E_FAIL;
- url.adoptCF(CFURLCreateFromFileSystemRepresentation(0, utf8Path.data(), result - 1, false));
+ url = adoptCF(CFURLCreateFromFileSystemRepresentation(0, utf8Path.data(), result - 1, false));
}
settings->setUserStyleSheetLocation(url.get());
@@ -4804,7 +4885,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
hr = prefsPrivate->databasesEnabled(&enabled);
if (FAILED(hr))
return hr;
- AbstractDatabase::setIsAvailable(enabled);
+ DatabaseManager::manager().setIsAvailable(enabled);
#endif
hr = prefsPrivate->localStorageEnabled(&enabled);
@@ -4877,7 +4958,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
settings->setShowRepaintCounter(enabled);
#if ENABLE(WEB_AUDIO)
- settings->setWebAudioEnabled(true);
+ settings->:setWebAudioEnabled(true);
#endif // ENABLE(WEB_AUDIO)
#if ENABLE(WEBGL)
@@ -4889,11 +4970,6 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
return hr;
settings->setDNSPrefetchingEnabled(enabled);
- hr = prefsPrivate->memoryInfoEnabled(&enabled);
- if (FAILED(hr))
- return hr;
- settings->setMemoryInfoEnabled(enabled);
-
hr = prefsPrivate->hyperlinkAuditingEnabled(&enabled);
if (FAILED(hr))
return hr;
@@ -5228,7 +5304,7 @@ HRESULT STDMETHODCALLTYPE WebView::standardUserAgentWithApplicationName(
HRESULT STDMETHODCALLTYPE WebView::clearFocusNode()
{
if (m_page && m_page->focusController())
- m_page->focusController()->setFocusedNode(0, 0);
+ m_page->focusController()->setFocusedElement(0, 0);
return S_OK;
}
@@ -5237,7 +5313,7 @@ HRESULT STDMETHODCALLTYPE WebView::setInitialFocus(
{
if (m_page && m_page->focusController()) {
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- frame->document()->setFocusedNode(0);
+ frame->document()->setFocusedElement(0);
m_page->focusController()->setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, 0);
}
return S_OK;
@@ -5323,7 +5399,7 @@ HRESULT STDMETHODCALLTYPE WebView::loadBackForwardListFromOtherView(
HRESULT STDMETHODCALLTYPE WebView::clearUndoRedoOperations()
{
if (Frame* frame = m_page->focusController()->focusedOrMainFrame())
- frame->editor()->clearUndoRedoOperations();
+ frame->editor().clearUndoRedoOperations();
return S_OK;
}
@@ -5438,7 +5514,7 @@ void WebView::prepareCandidateWindow(Frame* targetFrame, HIMC hInputContext)
if (RefPtr<Range> range = targetFrame->selection()->selection().toNormalizedRange()) {
ExceptionCode ec = 0;
RefPtr<Range> tempRange = range->cloneRange(ec);
- caret = targetFrame->editor()->firstRectForRange(tempRange.get());
+ caret = targetFrame->editor().firstRectForRange(tempRange.get());
}
caret = targetFrame->view()->contentsToWindow(caret);
CANDIDATEFORM form;
@@ -5456,7 +5532,7 @@ void WebView::prepareCandidateWindow(Frame* targetFrame, HIMC hInputContext)
void WebView::resetIME(Frame* targetFrame)
{
if (targetFrame)
- targetFrame->editor()->cancelComposition();
+ targetFrame->editor().cancelComposition();
if (HIMC hInputContext = getIMMContext()) {
IMMDict::dict().notifyIME(hInputContext, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
@@ -5467,15 +5543,11 @@ void WebView::resetIME(Frame* targetFrame)
void WebView::updateSelectionForIME()
{
Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
- if (!targetFrame || !targetFrame->editor()->hasComposition())
- return;
- if (targetFrame->editor()->ignoreCompositionSelectionChange())
+ if (!targetFrame)
return;
- unsigned start;
- unsigned end;
- if (!targetFrame->editor()->getCompositionSelection(start, end))
+ if (!targetFrame->editor().cancelCompositionIfSelectionIsInvalid())
resetIME(targetFrame);
}
@@ -5631,7 +5703,7 @@ bool WebView::onIMEComposition(LPARAM lparam)
return true;
Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
- if (!targetFrame || !targetFrame->editor()->canEdit())
+ if (!targetFrame || !targetFrame->editor().canEdit())
return true;
prepareCandidateWindow(targetFrame, hInputContext);
@@ -5641,7 +5713,7 @@ bool WebView::onIMEComposition(LPARAM lparam)
if (!getCompositionString(hInputContext, GCS_RESULTSTR, compositionString) && lparam)
return true;
- targetFrame->editor()->confirmComposition(compositionString);
+ targetFrame->editor().confirmComposition(compositionString);
} else {
String compositionString;
if (!getCompositionString(hInputContext, GCS_COMPSTR, compositionString))
@@ -5662,7 +5734,7 @@ bool WebView::onIMEComposition(LPARAM lparam)
int cursorPosition = LOWORD(IMMDict::dict().getCompositionString(hInputContext, GCS_CURSORPOS, 0, 0));
- targetFrame->editor()->setComposition(compositionString, underlines, cursorPosition, 0);
+ targetFrame->editor().setComposition(compositionString, underlines, cursorPosition, 0);
}
return true;
@@ -5674,8 +5746,8 @@ bool WebView::onIMEEndComposition()
// If the composition hasn't been confirmed yet, it needs to be cancelled.
// This happens after deleting the last character from inline input hole.
Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
- if (targetFrame && targetFrame->editor()->hasComposition())
- targetFrame->editor()->confirmComposition(String());
+ if (targetFrame && targetFrame->editor().hasComposition())
+ targetFrame->editor().confirmComposition(String());
if (m_inIMEComposition)
m_inIMEComposition--;
@@ -5700,14 +5772,14 @@ bool WebView::onIMENotify(WPARAM wparam, LPARAM, LRESULT*)
LRESULT WebView::onIMERequestCharPosition(Frame* targetFrame, IMECHARPOSITION* charPos)
{
- if (charPos->dwCharPos && !targetFrame->editor()->hasComposition())
+ if (charPos->dwCharPos && !targetFrame->editor().hasComposition())
return 0;
IntRect caret;
- if (RefPtr<Range> range = targetFrame->editor()->hasComposition() ? targetFrame->editor()->compositionRange() : targetFrame->selection()->selection().toNormalizedRange()) {
+ if (RefPtr<Range> range = targetFrame->editor().hasComposition() ? targetFrame->editor().compositionRange() : targetFrame->selection()->selection().toNormalizedRange()) {
ExceptionCode ec = 0;
RefPtr<Range> tempRange = range->cloneRange(ec);
tempRange->setStart(tempRange->startContainer(ec), tempRange->startOffset(ec) + charPos->dwCharPos, ec);
- caret = targetFrame->editor()->firstRectForRange(tempRange.get());
+ caret = targetFrame->editor().firstRectForRange(tempRange.get());
}
caret = targetFrame->view()->contentsToWindow(caret);
charPos->pt.x = caret.x();
@@ -5740,7 +5812,7 @@ LRESULT WebView::onIMERequest(WPARAM request, LPARAM data)
{
LOG(TextInput, "onIMERequest %s", imeRequestName(request).latin1().data());
Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
- if (!targetFrame || !targetFrame->editor()->canEdit())
+ if (!targetFrame || !targetFrame->editor().canEdit())
return 0;
switch (request) {
@@ -6187,9 +6259,9 @@ void WebView::enterFullscreenForNode(Node* node)
return;
#if ENABLE(VIDEO)
- if (!static_cast<Element*>(node)->isMediaElement())
+ if (!toElement(node)->isMediaElement())
return;
- HTMLMediaElement* videoElement = static_cast<HTMLMediaElement*>(node);
+ HTMLMediaElement* videoElement = toHTMLMediaElement(node);
if (m_fullScreenVideoController) {
if (m_fullScreenVideoController->mediaElement() == videoElement) {
@@ -6859,6 +6931,20 @@ void WebView::fullScreenClientForceRepaint()
m_fullscreenController->repaintCompleted();
}
+void WebView::fullScreenClientSaveScrollPosition()
+{
+ if (Frame* coreFrame = core(m_mainFrame))
+ if (FrameView* view = coreFrame->view())
+ m_scrollPosition = view->scrollPosition();
+}
+
+void WebView::fullScreenClientRestoreScrollPosition()
+{
+ if (Frame* coreFrame = core(m_mainFrame))
+ if (FrameView* view = coreFrame->view())
+ view->setScrollPosition(m_scrollPosition);
+}
+
#endif
// Used by TextInputController in DumpRenderTree
@@ -6871,14 +6957,14 @@ HRESULT STDMETHODCALLTYPE WebView::setCompositionForTesting(
return E_FAIL;
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return E_FAIL;
String compositionStr = toString(composition);
Vector<CompositionUnderline> underlines;
underlines.append(CompositionUnderline(0, compositionStr.length(), Color(Color::black), false));
- frame->editor()->setComposition(compositionStr, underlines, from, from + length);
+ frame->editor().setComposition(compositionStr, underlines, from, from + length);
return S_OK;
}
@@ -6892,7 +6978,7 @@ HRESULT STDMETHODCALLTYPE WebView::hasCompositionForTesting(/* [out, retval] */
if (!frame)
return E_FAIL;
- *result = frame && frame->editor()->hasComposition();
+ *result = frame && frame->editor().hasComposition();
return S_OK;
}
@@ -6903,15 +6989,15 @@ HRESULT STDMETHODCALLTYPE WebView::confirmCompositionForTesting(/* [in] */ BSTR
return E_FAIL;
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return E_FAIL;
String compositionStr = toString(composition);
if (compositionStr.isNull())
- frame->editor()->confirmComposition();
+ frame->editor().confirmComposition();
- frame->editor()->confirmComposition(compositionStr);
+ frame->editor().confirmComposition(compositionStr);
return S_OK;
}
@@ -6922,10 +7008,10 @@ HRESULT STDMETHODCALLTYPE WebView::compositionRangeForTesting(/* [out] */ UINT*
return E_FAIL;
Frame* frame = m_page->focusController()->focusedOrMainFrame();
- if (!frame || !frame->editor()->canEdit())
+ if (!frame || !frame->editor().canEdit())
return E_FAIL;
- RefPtr<Range> range = frame->editor()->compositionRange();
+ RefPtr<Range> range = frame->editor().compositionRange();
if (!range)
return E_FAIL;
@@ -6966,7 +7052,7 @@ HRESULT STDMETHODCALLTYPE WebView::firstRectForCharacterRangeForTesting(
ASSERT(range->startContainer());
ASSERT(range->endContainer());
- IntRect rect = frame->editor()->firstRectForRange(range.get());
+ IntRect rect = frame->editor().firstRectForRange(range.get());
resultIntRect = frame->view()->contentsToWindow(rect);
resultRect->left = resultIntRect.x();
@@ -6986,7 +7072,7 @@ HRESULT STDMETHODCALLTYPE WebView::selectedRangeForTesting(/* [out] */ UINT* loc
if (!frame)
return E_FAIL;
- RefPtr<Range> range = frame->editor()->selectedRange();
+ RefPtr<Range> range = frame->editor().selectedRange();
size_t locationSize;
size_t lengthSize;
@@ -6997,3 +7083,4 @@ HRESULT STDMETHODCALLTYPE WebView::selectedRangeForTesting(/* [out] */ UINT* loc
return S_OK;
}
+