diff options
Diffstat (limited to 'WebKit/win/WebCoreSupport')
-rw-r--r-- | WebKit/win/WebCoreSupport/EmbeddedWidget.cpp | 33 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/EmbeddedWidget.h | 15 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/WebChromeClient.cpp | 6 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/WebChromeClient.h | 3 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/WebContextMenuClient.cpp | 2 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/WebDragClient.cpp | 9 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/WebEditorClient.cpp | 7 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/WebEditorClient.h | 1 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp | 186 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/WebFrameLoaderClient.h | 16 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/WebInspectorClient.cpp | 116 | ||||
-rw-r--r-- | WebKit/win/WebCoreSupport/WebInspectorClient.h | 4 |
12 files changed, 273 insertions, 125 deletions
diff --git a/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp b/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp index b18022b..952bc03 100644 --- a/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp +++ b/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp @@ -31,6 +31,10 @@ #include <WebCore/FrameView.h>
#include <WebCore/RenderObject.h>
+#include "MemoryStream.h"
+#include "WebError.h"
+#include "WebURLResponse.h"
+
using namespace WebCore;
EmbeddedWidget* EmbeddedWidget::create(IWebEmbeddedView* view, Element* element, HWND parentWindow, const IntSize& size)
@@ -84,7 +88,7 @@ void EmbeddedWidget::setFrameRect(const IntRect& rect) frameRectsChanged();
}
-void EmbeddedWidget::frameRectsChanged() const
+void EmbeddedWidget::frameRectsChanged()
{
if (!parent())
return;
@@ -207,3 +211,30 @@ void EmbeddedWidget::detachFromWindow() ShowWindow(m_window, SW_HIDE);
m_attachedToWindow = false;
}
+
+void EmbeddedWidget::didReceiveResponse(const ResourceResponse& response)
+{
+ ASSERT(m_view);
+
+ COMPtr<IWebURLResponse> urlResponse(AdoptCOM, WebURLResponse::createInstance(response));
+ m_view->didReceiveResponse(urlResponse.get());
+}
+
+void EmbeddedWidget::didReceiveData(const char* data, int length)
+{
+ RefPtr<SharedBuffer> buffer(SharedBuffer::create(data, length));
+
+ COMPtr<IStream> stream(AdoptCOM, MemoryStream::createInstance(buffer.release()));
+ m_view->didReceiveData(stream.get());
+}
+
+void EmbeddedWidget::didFinishLoading()
+{
+ m_view->didFinishLoading();
+}
+
+void EmbeddedWidget::didFail(const ResourceError& error)
+{
+ COMPtr<IWebError> webError(AdoptCOM, WebError::createInstance(error));
+ m_view->didFail(webError.get());
+}
diff --git a/WebKit/win/WebCoreSupport/EmbeddedWidget.h b/WebKit/win/WebCoreSupport/EmbeddedWidget.h index ed7c025..56cd436 100644 --- a/WebKit/win/WebCoreSupport/EmbeddedWidget.h +++ b/WebKit/win/WebCoreSupport/EmbeddedWidget.h @@ -28,7 +28,7 @@ #include <WebCore/COMPtr.h>
#include <WebCore/IntRect.h>
-#include <WebCore/Widget.h>
+#include <WebCore/PluginView.h>
namespace WebCore {
class Element;
@@ -37,7 +37,7 @@ namespace WebCore { interface IWebEmbeddedView;
-class EmbeddedWidget : public WebCore::Widget {
+class EmbeddedWidget : public WebCore::Widget, public WebCore::PluginManualLoader {
public:
static EmbeddedWidget* create(IWebEmbeddedView*, WebCore::Element* element, HWND parentWindow, const WebCore::IntSize&);
~EmbeddedWidget();
@@ -54,9 +54,14 @@ private: bool createWindow(HWND parentWindow, const WebCore::IntSize& size);
+ virtual void didReceiveResponse(const WebCore::ResourceResponse&); + virtual void didReceiveData(const char*, int); + virtual void didFinishLoading(); + virtual void didFail(const WebCore::ResourceError&); +
virtual void invalidateRect(const WebCore::IntRect&);
virtual void setFrameRect(const WebCore::IntRect&);
- virtual void frameRectsChanged() const;
+ virtual void frameRectsChanged();
virtual void setFocus();
virtual void show();
virtual void hide();
@@ -73,8 +78,8 @@ private: bool m_isVisible;
bool m_attachedToWindow;
- mutable WebCore::IntRect m_clipRect; // The clip rect to apply to an embedded view.
- mutable WebCore::IntRect m_windowRect; // Our window rect.
+ WebCore::IntRect m_clipRect; // The clip rect to apply to an embedded view.
+ WebCore::IntRect m_windowRect; // Our window rect.
};
#endif // EmbeddedWidget_h
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp index dba87e5..9aec24b 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.cpp +++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp @@ -40,6 +40,7 @@ #include <WebCore/FrameLoadRequest.h> #include <WebCore/FrameView.h> #include <WebCore/LocalizedStrings.h> +#include <WebCore/NotImplemented.h> #include <WebCore/Page.h> #include <WebCore/WindowFeatures.h> #pragma warning(pop) @@ -474,6 +475,11 @@ PlatformWidget WebChromeClient::platformWindow() const return viewWindow; } +void WebChromeClient::contentsSizeChanged(Frame*, const IntSize&) const +{ + notImplemented(); +} + void WebChromeClient::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags) { COMPtr<IWebUIDelegate> uiDelegate; diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.h b/WebKit/win/WebCoreSupport/WebChromeClient.h index 83c5a70..cb9f470 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.h +++ b/WebKit/win/WebCoreSupport/WebChromeClient.h @@ -97,6 +97,7 @@ public: virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint& p) const; virtual WebCore::IntRect windowToScreen(const WebCore::IntRect& r) const; virtual PlatformWidget platformWindow() const; + virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const; virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags); @@ -117,6 +118,8 @@ public: WebView* webView() const { return m_webView; } + virtual void formStateDidChange(const WebCore::Node*) { } + private: COMPtr<IWebUIDelegate> uiDelegate(); COMPtr<IWebUIDelegate2> uiDelegate2(); diff --git a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp index be7b483..deabb5c 100644 --- a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp +++ b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp @@ -160,7 +160,7 @@ void WebContextMenuClient::searchWithGoogle(const Frame* frame) ResourceRequest request = ResourceRequest(url); if (Page* page = frame->page()) - page->mainFrame()->loader()->urlSelected(FrameLoadRequest(request), 0, false); + page->mainFrame()->loader()->urlSelected(FrameLoadRequest(request), 0, false, false); } void WebContextMenuClient::lookUpInDictionary(Frame*) diff --git a/WebKit/win/WebCoreSupport/WebDragClient.cpp b/WebKit/win/WebCoreSupport/WebDragClient.cpp index c35991f..d42f7b5 100644 --- a/WebKit/win/WebCoreSupport/WebDragClient.cpp +++ b/WebKit/win/WebCoreSupport/WebDragClient.cpp @@ -30,7 +30,6 @@ #include "WebView.h" #include <shlobj.h> -#include <CoreGraphics/CoreGraphics.h> #pragma warning(push, 0) #include <WebCore/ClipboardWin.h> @@ -46,7 +45,8 @@ #pragma warning(pop) namespace WebCore { - HBITMAP allocImage(HDC dc, IntSize size, CGContextRef *targetRef); + HBITMAP allocImage(HDC dc, IntSize size, PlatformGraphicsContext** targetRef); + void deallocContext(PlatformGraphicsContext* target); } @@ -223,7 +223,7 @@ DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& inLa return 0; } - CGContextRef contextRef; + PlatformGraphicsContext* contextRef; image = allocImage(workingDC, imageSize, &contextRef); if (!image) { DeleteDC(workingDC); @@ -237,7 +237,6 @@ DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& inLa // for drag images on win, so we use 1 static const Color backgroundColor(140, 140, 140); static const IntSize radii(DRAG_LABEL_RADIUS, DRAG_LABEL_RADIUS); - context.setFont(labelFont); IntRect rect(0, 0, imageSize.width(), imageSize.height()); context.fillRoundedRect(rect, radii, radii, radii, radii, backgroundColor); @@ -257,7 +256,7 @@ DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& inLa IntPoint textPos(DRAG_LABEL_BORDER_X, DRAG_LABEL_BORDER_Y + labelFont.pixelSize()); WebCoreDrawDoubledTextAtPoint(context, label, textPos, labelFont, topColor, bottomColor); - CGContextRelease(contextRef); + deallocContext(contextRef); DeleteDC(workingDC); ReleaseDC(0, dc); return image; diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.cpp b/WebKit/win/WebCoreSupport/WebEditorClient.cpp index e38cd0d..985742f 100644 --- a/WebKit/win/WebCoreSupport/WebEditorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebEditorClient.cpp @@ -295,6 +295,13 @@ bool WebEditorClient::smartInsertDeleteEnabled(void) return !!enabled; } +bool WebEditorClient::isSelectTrailingWhitespaceEnabled(void) +{ + BOOL enabled = FALSE; + m_webView->isSelectTrailingWhitespaceEnabled(&enabled); + return !!enabled; +} + bool WebEditorClient::shouldChangeSelectedRange(WebCore::Range*, WebCore::Range*, WebCore::EAffinity, bool) { notImplemented(); return true; } diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.h b/WebKit/win/WebCoreSupport/WebEditorClient.h index 8c603f2..52cb66d 100644 --- a/WebKit/win/WebCoreSupport/WebEditorClient.h +++ b/WebKit/win/WebCoreSupport/WebEditorClient.h @@ -75,6 +75,7 @@ public: void webViewDidChangeSelection(WebNotification*); bool smartInsertDeleteEnabled(); + bool isSelectTrailingWhitespaceEnabled(); void registerCommandForUndo(PassRefPtr<WebCore::EditCommand>); void registerCommandForRedo(PassRefPtr<WebCore::EditCommand>); diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp index 17bee47..1af1673 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp @@ -31,9 +31,11 @@ #include "CFDictionaryPropertyBag.h" #include "COMPropertyBag.h" +#include "DOMHTMLClasses.h" #include "EmbeddedWidget.h" #include "MarshallingHelpers.h" -#include "WebCachedPagePlatformData.h" +#include "NotImplemented.h" +#include "WebCachedFramePlatformData.h" #include "WebChromeClient.h" #include "WebDocumentLoader.h" #include "WebError.h" @@ -46,6 +48,7 @@ #include "WebURLResponse.h" #include "WebView.h" #pragma warning(push, 0) +#include <WebCore/CachedFrame.h> #include <WebCore/DocumentLoader.h> #include <WebCore/FrameLoader.h> #include <WebCore/FrameTree.h> @@ -71,7 +74,7 @@ static WebDataSource* getWebDataSource(DocumentLoader* loader) WebFrameLoaderClient::WebFrameLoaderClient(WebFrame* webFrame) : m_webFrame(webFrame) - , m_pluginView(0) + , m_manualLoader(0) , m_hasSentResponseToPlugin(false) { ASSERT_ARG(webFrame, webFrame); @@ -102,8 +105,27 @@ void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identi resourceLoadDelegate->identifierForInitialRequest(webView, webURLRequest.get(), getWebDataSource(loader), identifier); } +bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader* loader, unsigned long identifier) +{ + WebView* webView = m_webFrame->webView(); + COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate; + if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate))) + return true; + + COMPtr<IWebResourceLoadDelegatePrivate2> resourceLoadDelegatePrivate; + if (FAILED(resourceLoadDelegate->QueryInterface(IID_IWebResourceLoadDelegatePrivate2, reinterpret_cast<void**>(&resourceLoadDelegatePrivate)))) + return true; + + BOOL shouldUse; + if (SUCCEEDED(resourceLoadDelegatePrivate->shouldUseCredentialStorage(webView, identifier, getWebDataSource(loader), &shouldUse))) + return shouldUse; + + return true; +} + void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader* loader, unsigned long identifier, const AuthenticationChallenge& challenge) { +#if USE(CFNETWORK) ASSERT(challenge.sourceHandle()); WebView* webView = m_webFrame->webView(); @@ -117,6 +139,9 @@ void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoa // If the ResourceLoadDelegate doesn't exist or fails to handle the call, we tell the ResourceHandle // to continue without credential - this is the best approximation of Mac behavior challenge.sourceHandle()->receivedRequestToContinueWithoutCredential(challenge); +#else + notImplemented(); +#endif } void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader* loader, unsigned long identifier, const AuthenticationChallenge& challenge) @@ -297,6 +322,17 @@ void WebFrameLoaderClient::dispatchDidFirstLayout() frameLoadDelegatePriv->didFirstLayoutInFrame(webView, m_webFrame); } +void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() +{ + WebView* webView = m_webFrame->webView(); + COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePrivate; + if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePrivate)) && frameLoadDelegatePrivate) { + COMPtr<IWebFrameLoadDelegatePrivate2> frameLoadDelegatePrivate2(Query, frameLoadDelegatePrivate); + if (frameLoadDelegatePrivate2) + frameLoadDelegatePrivate2->didFirstVisuallyNonEmptyLayoutInFrame(webView, m_webFrame); + } +} + Frame* WebFrameLoaderClient::dispatchCreatePage() { WebView* webView = m_webFrame->webView(); @@ -331,12 +367,11 @@ void WebFrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader*) void WebFrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceError& error) { - if (!m_pluginView) + if (!m_manualLoader) return; - if (m_pluginView->status() == PluginStatusLoadedSuccessfully) - m_pluginView->didFail(error); - m_pluginView = 0; + m_manualLoader->didFail(error); + m_manualLoader = 0; m_hasSentResponseToPlugin = false; } @@ -366,22 +401,22 @@ void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* dat // FIXME: This should probably go through the data source. const String& textEncoding = loader->response().textEncodingName(); - if (!m_pluginView) + if (!m_manualLoader) receivedData(data, length, textEncoding); - if (!m_pluginView || m_pluginView->status() != PluginStatusLoadedSuccessfully) + if (!m_manualLoader) return; if (!m_hasSentResponseToPlugin) { - m_pluginView->didReceiveResponse(core(m_webFrame)->loader()->documentLoader()->response()); + m_manualLoader->didReceiveResponse(core(m_webFrame)->loader()->documentLoader()->response()); // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in - // setting up this stream can cause the main document load to be cancelled, setting m_pluginView + // setting up this stream can cause the main document load to be cancelled, setting m_manualLoader // to null - if (!m_pluginView) + if (!m_manualLoader) return; m_hasSentResponseToPlugin = true; } - m_pluginView->didReceiveData(data, length); + m_manualLoader->didReceiveData(data, length); } void WebFrameLoaderClient::receivedData(const char* data, int length, const String& textEncoding) @@ -405,23 +440,44 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader) // Telling the frame we received some data and passing 0 as the data is our // way to get work done that is normally done when the first bit of data is // received, even for the case of a document with no data (like about:blank) - if (!m_pluginView) { + if (!m_manualLoader) { committedLoad(loader, 0, 0); return; } - if (m_pluginView->status() == PluginStatusLoadedSuccessfully) - m_pluginView->didFinishLoading(); - m_pluginView = 0; + m_manualLoader->didFinishLoading(); + m_manualLoader = 0; m_hasSentResponseToPlugin = false; } -void WebFrameLoaderClient::updateGlobalHistory(const KURL& url) +void WebFrameLoaderClient::updateGlobalHistory() { WebHistory* history = WebHistory::sharedHistory(); if (!history) return; - history->addItem(url, core(m_webFrame)->loader()->documentLoader()->title()); + + DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader(); + + if (loader->urlForHistoryReflectsServerRedirect()) { + history->visitedURL(loader->urlForHistory(), loader->title(), loader->request().httpMethod(), loader->urlForHistoryReflectsFailure(), loader->url(), false); + return; + } + + if (loader->urlForHistoryReflectsClientRedirect()) { + history->visitedURL(loader->urlForHistory(), loader->title(), loader->request().httpMethod(), loader->urlForHistoryReflectsFailure(), KURL(), true); + return; + } + + history->visitedURL(loader->urlForHistory(), loader->title(), loader->request().httpMethod(), loader->urlForHistoryReflectsFailure(), KURL(), false); +} + +void WebFrameLoaderClient::updateGlobalHistoryForRedirectWithoutHistoryItem() +{ + WebHistory* history = WebHistory::sharedHistory(); + if (!history) + return; + DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader(); + history->visitedURLForRedirectWithoutHistoryItem(loader->url()); } bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const @@ -464,56 +520,35 @@ void WebFrameLoaderClient::setTitle(const String& title, const KURL& url) itemPrivate->setTitle(BString(title)); } -void WebFrameLoaderClient::savePlatformDataToCachedPage(CachedPage* cachedPage) +void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame* cachedFrame) { +#if USE(CFNETWORK) Frame* coreFrame = core(m_webFrame); if (!coreFrame) return; - ASSERT(coreFrame->loader()->documentLoader() == cachedPage->documentLoader()); + ASSERT(coreFrame->loader()->documentLoader() == cachedFrame->documentLoader()); - WebCachedPagePlatformData* webPlatformData = new WebCachedPagePlatformData(static_cast<IWebDataSource*>(getWebDataSource(coreFrame->loader()->documentLoader()))); - cachedPage->setCachedPagePlatformData(webPlatformData); + WebCachedFramePlatformData* webPlatformData = new WebCachedFramePlatformData(static_cast<IWebDataSource*>(getWebDataSource(coreFrame->loader()->documentLoader()))); + cachedFrame->setCachedFramePlatformData(webPlatformData); +#else + notImplemented(); +#endif } -void WebFrameLoaderClient::transitionToCommittedForNewPage() +void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*) { - Frame* frame = core(m_webFrame); - ASSERT(frame); - - Page* page = frame->page(); - ASSERT(page); - - bool isMainFrame = frame == page->mainFrame(); - - if (isMainFrame && frame->view()) - frame->view()->setParentVisible(false); - - frame->setView(0); - - WebView* webView = m_webFrame->webView(); - - FrameView* frameView; - if (isMainFrame) { - RECT rect; - webView->frameRect(&rect); - frameView = new FrameView(frame, IntRect(rect).size()); - } else - frameView = new FrameView(frame); - - frame->setView(frameView); - frameView->deref(); // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame. - - m_webFrame->updateBackground(); - - if (isMainFrame) - frameView->setParentVisible(true); +} - if (frame->ownerRenderer()) - frame->ownerRenderer()->setWidget(frameView); +void WebFrameLoaderClient::transitionToCommittedForNewPage() +{ + WebView* view = m_webFrame->webView(); - if (HTMLFrameOwnerElement* owner = frame->ownerElement()) - frame->view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOff); + RECT rect; + view->frameRect(&rect); + bool transparent = view->transparent(); + Color backgroundColor = transparent ? Color::transparent : Color::white; + WebCore::FrameLoaderClient::transitionToCommittedForNewPage(core(m_webFrame), IntRect(rect).size(), backgroundColor, transparent, IntSize(), false); } bool WebFrameLoaderClient::canCachePage() const @@ -562,18 +597,14 @@ void WebFrameLoaderClient::loadURLIntoChild(const KURL& originalURL, const Strin HistoryItem* parentItem = coreFrame->loader()->currentHistoryItem(); FrameLoadType loadType = coreFrame->loader()->loadType(); - FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedHistory; + FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedBackForwardList; KURL url = originalURL; // If we're moving in the backforward list, we might want to replace the content // of this child frame with whatever was there at that point. // Reload will maintain the frame contents, LoadSame will not. - if (parentItem && parentItem->children().size() && - (isBackForwardLoadType(loadType) - || loadType == FrameLoadTypeReload - || loadType == FrameLoadTypeReloadAllowingStaleData)) - { + if (parentItem && parentItem->children().size() && isBackForwardLoadType(loadType)) { if (HistoryItem* childItem = parentItem->childItemWithName(core(childFrame)->tree()->name())) { // Use the original URL to ensure we get all the side-effects, such as // onLoad handlers, of any redirects that happened. An example of where @@ -593,7 +624,7 @@ void WebFrameLoaderClient::loadURLIntoChild(const KURL& originalURL, const Strin // FIXME: Handle loading WebArchives here String frameName = core(childFrame)->tree()->name(); - core(childFrame)->loader()->loadURL(url, referrer, frameName, childLoadType, 0, 0); + core(childFrame)->loader()->loadURL(url, referrer, frameName, false, childLoadType, 0, 0); } Widget* WebFrameLoaderClient::createPlugin(const IntSize& pluginSize, Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) @@ -610,11 +641,16 @@ Widget* WebFrameLoaderClient::createPlugin(const IntSize& pluginSize, Element* e for (unsigned i = 0; i < paramNames.size(); i++) viewArguments.set(paramNames[i], paramValues[i]); COMPtr<IPropertyBag> viewArgumentsBag(AdoptCOM, COMPropertyBag<String>::adopt(viewArguments)); + COMPtr<IDOMElement> containingElement(AdoptCOM, DOMElement::createInstance(element)); + + HashMap<String, COMVariant> arguments; - // Now create a new property bag where the view arguments is the only property. - HashMap<String, COMPtr<IUnknown> > arguments; - arguments.set(WebEmbeddedViewAttributesKey, COMPtr<IUnknown>(AdoptCOM, viewArgumentsBag.releaseRef())); - COMPtr<IPropertyBag> argumentsBag(AdoptCOM, COMPropertyBag<COMPtr<IUnknown> >::adopt(arguments)); + arguments.set(WebEmbeddedViewAttributesKey, viewArgumentsBag); + arguments.set(WebEmbeddedViewBaseURLKey, url.string()); + arguments.set(WebEmbeddedViewContainingElementKey, containingElement); + arguments.set(WebEmbeddedViewMIMETypeKey, mimeType); + + COMPtr<IPropertyBag> argumentsBag(AdoptCOM, COMPropertyBag<COMVariant>::adopt(arguments)); COMPtr<IWebEmbeddedView> view; HRESULT result = uiPrivate->embeddedViewWithArguments(webView, m_webFrame, argumentsBag.get(), &view); @@ -694,7 +730,10 @@ void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) { // Ideally, this function shouldn't be necessary, see <rdar://problem/4852889> - m_pluginView = static_cast<PluginView*>(pluginWidget); + if (pluginWidget->isPluginView()) + m_manualLoader = static_cast<PluginView*>(pluginWidget); + else + m_manualLoader = static_cast<EmbeddedWidget*>(pluginWidget); } WebHistory* WebFrameLoaderClient::webHistory() const @@ -704,3 +743,12 @@ WebHistory* WebFrameLoaderClient::webHistory() const return WebHistory::sharedHistory(); } + +bool WebFrameLoaderClient::shouldUsePluginDocument(const String& mimeType) const +{ + WebView* webView = m_webFrame->webView(); + if (!webView) + return false; + + return webView->shouldUseEmbeddedView(mimeType); +} diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h index b9fd027..3877273 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h @@ -34,7 +34,7 @@ #pragma warning(pop) namespace WebCore { - class PluginView; + class PluginManualLoader; } template <typename T> class COMPtr; @@ -49,6 +49,7 @@ public: virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&); virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); + virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier); virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); @@ -69,6 +70,7 @@ public: virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); virtual void dispatchDidFirstLayout(); + virtual void dispatchDidFirstVisuallyNonEmptyLayout(); virtual WebCore::Frame* dispatchCreatePage(); virtual void dispatchShow(); @@ -83,13 +85,15 @@ public: virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); virtual void finishedLoading(WebCore::DocumentLoader*); - virtual void updateGlobalHistory(const WebCore::KURL&); + virtual void updateGlobalHistory(); + virtual void updateGlobalHistoryForRedirectWithoutHistoryItem(); virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); virtual void setTitle(const WebCore::String& title, const WebCore::KURL&); - virtual void savePlatformDataToCachedPage(WebCore::CachedPage*); + virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedForNewPage(); virtual bool canCachePage() const; @@ -99,6 +103,8 @@ public: virtual WebCore::Widget* createPlugin(const WebCore::IntSize&, WebCore::Element*, const WebCore::KURL&, const Vector<WebCore::String>&, const Vector<WebCore::String>&, const WebCore::String&, bool loadManually); virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); + virtual bool shouldUsePluginDocument(const WebCore::String& mimeType) const; + protected: WebFrameLoaderClient(WebFrame*); ~WebFrameLoaderClient(); @@ -111,8 +117,8 @@ private: WebFrame* m_webFrame; - // Points to the plugin view that data should be redirected to. - WebCore::PluginView* m_pluginView; + // Points to the manual loader that data should be redirected to. + WebCore::PluginManualLoader* m_manualLoader; bool m_hasSentResponseToPlugin; }; diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp index bfbf858..56cf0df 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp @@ -72,6 +72,7 @@ WebInspectorClient::WebInspectorClient(WebView* webView) : m_inspectedWebView(webView) , m_hwnd(0) , m_webViewHwnd(0) + , m_shouldAttachWhenShown(false) , m_attached(false) { ASSERT(m_inspectedWebView); @@ -202,20 +203,13 @@ String WebInspectorClient::localizedStringsURL() void WebInspectorClient::showWindow() { - if (!m_hwnd) - return; - - updateWindowTitle(); - ::SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); + showWindowWithoutNotifications(); m_inspectedWebView->page()->inspectorController()->setWindowVisible(true); } void WebInspectorClient::closeWindow() { - if (!m_webView) - return; - - ::ShowWindow(m_hwnd, SW_HIDE); + closeWindowWithoutNotifications(); m_inspectedWebView->page()->inspectorController()->setWindowVisible(false); } @@ -226,27 +220,13 @@ bool WebInspectorClient::windowVisible() void WebInspectorClient::attachWindow() { - ASSERT(m_hwnd); - ASSERT(m_webView); - ASSERT(m_inspectedWebViewHwnd); - if (m_attached) return; - WindowMessageBroadcaster::addListener(m_inspectedWebViewHwnd, this); + m_shouldAttachWhenShown = true; - HWND hostWindow; - if (FAILED(m_inspectedWebView->hostWindow((OLE_HANDLE*)&hostWindow))) - return; - - m_webView->setHostWindow((OLE_HANDLE)(ULONG64)hostWindow); - ::ShowWindow(m_hwnd, SW_HIDE); - m_attached = true; - - ::SendMessage(hostWindow, WM_SIZE, 0, 0); - - if (m_highlight && m_highlight->isShowing()) - m_highlight->update(); + closeWindowWithoutNotifications(); + showWindowWithoutNotifications(); } void WebInspectorClient::detachWindow() @@ -254,20 +234,10 @@ void WebInspectorClient::detachWindow() if (!m_attached) return; - WindowMessageBroadcaster::removeListener(m_inspectedWebViewHwnd, this); - - m_attached = false; - - m_webView->setHostWindow((OLE_HANDLE)(ULONG64)m_hwnd); - ::ShowWindow(m_hwnd, SW_SHOW); - ::SendMessage(m_hwnd, WM_SIZE, 0, 0); + m_shouldAttachWhenShown = false; - HWND hostWindow; - if (SUCCEEDED(m_inspectedWebView->hostWindow((OLE_HANDLE*)&hostWindow))) - ::SendMessage(hostWindow, WM_SIZE, 0, 0); - - if (m_highlight && m_highlight->isShowing()) - m_highlight->update(); + closeWindowWithoutNotifications(); + showWindowWithoutNotifications(); } void WebInspectorClient::setAttachedWindowHeight(unsigned height) @@ -303,6 +273,74 @@ void WebInspectorClient::inspectedURLChanged(const String& newURL) updateWindowTitle(); } +void WebInspectorClient::closeWindowWithoutNotifications() +{ + if (!m_hwnd) + return; + + if (!m_attached) { + ShowWindow(m_hwnd, SW_HIDE); + return; + } + + ASSERT(m_webView); + ASSERT(m_inspectedWebViewHwnd); + ASSERT(!IsWindowVisible(m_hwnd)); + + // Remove the Inspector's WebView from the inspected WebView's parent window. + WindowMessageBroadcaster::removeListener(m_inspectedWebViewHwnd, this); + + m_attached = false; + + m_webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(m_hwnd)); + + // Make sure everything has the right size/position. + HWND hostWindow; + if (SUCCEEDED(m_inspectedWebView->hostWindow((OLE_HANDLE*)&hostWindow))) + SendMessage(hostWindow, WM_SIZE, 0, 0); + + if (m_highlight && m_highlight->isShowing()) + m_highlight->update(); +} + +void WebInspectorClient::showWindowWithoutNotifications() +{ + if (!m_hwnd) + return; + + ASSERT(m_webView); + ASSERT(m_inspectedWebViewHwnd); + + if (!m_shouldAttachWhenShown) { + // Put the Inspector's WebView inside our window and show it. + m_webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(m_hwnd)); + SendMessage(m_hwnd, WM_SIZE, 0, 0); + updateWindowTitle(); + + SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); + return; + } + + // Put the Inspector's WebView inside the inspected WebView's parent window. + WindowMessageBroadcaster::addListener(m_inspectedWebViewHwnd, this); + + HWND hostWindow; + if (FAILED(m_inspectedWebView->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow)))) + return; + + m_webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(hostWindow)); + + // Then hide our own window. + ShowWindow(m_hwnd, SW_HIDE); + + m_attached = true; + + // Make sure everything has the right size/position. + SendMessage(hostWindow, WM_SIZE, 0, 0); + if (m_highlight && m_highlight->isShowing()) + m_highlight->update(); +} + void WebInspectorClient::updateWindowTitle() { // FIXME: The series of appends should be replaced with a call to String::format() diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.h b/WebKit/win/WebCoreSupport/WebInspectorClient.h index a28507a..86317f6 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.h +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.h @@ -71,6 +71,9 @@ public: private: ~WebInspectorClient(); + void closeWindowWithoutNotifications(); + void showWindowWithoutNotifications(); + void updateWindowTitle(); LRESULT onGetMinMaxInfo(WPARAM, LPARAM); @@ -88,6 +91,7 @@ private: COMPtr<WebView> m_webView; HWND m_webViewHwnd; + bool m_shouldAttachWhenShown; bool m_attached; OwnPtr<WebNodeHighlight> m_highlight; |