diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/win')
-rw-r--r-- | Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp | 66 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/win/TextCheckerWin.cpp | 8 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp | 2 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/win/WebContextWin.cpp | 23 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp | 11 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp | 52 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp | 2 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h | 2 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/win/WebView.cpp | 78 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/win/WebView.h | 8 |
10 files changed, 86 insertions, 166 deletions
diff --git a/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp b/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp deleted file mode 100644 index 58dc3b0..0000000 --- a/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "LayerBackedDrawingAreaProxy.h" - -#if USE(ACCELERATED_COMPOSITING) - -#include "DrawingAreaMessageKinds.h" -#include "DrawingAreaProxyMessageKinds.h" -#include "WebView.h" -#include "WebPageProxy.h" -#include "WebProcessProxy.h" - -using namespace WebCore; - -namespace WebKit { - -WebPageProxy* LayerBackedDrawingAreaProxy::page() -{ - return m_webView->page(); -} - -void LayerBackedDrawingAreaProxy::platformSetSize() -{ -} - -void LayerBackedDrawingAreaProxy::attachCompositingContext(uint32_t contextID) -{ - -} - -void LayerBackedDrawingAreaProxy::detachCompositingContext() -{ -} - -bool LayerBackedDrawingAreaProxy::paint(const IntRect&, PlatformDrawingContext) -{ - return false; -} - -} // namespace WebKit - -#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp index a16f169..dbc6fdc 100644 --- a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp +++ b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp @@ -26,9 +26,8 @@ #include "config.h" #include "TextChecker.h" -#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 -#include "NotImplemented.h" #include "TextCheckerState.h" +#include <WebCore/NotImplemented.h> using namespace WebCore; @@ -82,6 +81,11 @@ void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWor notImplemented(); } +void TextChecker::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail) +{ + notImplemented(); +} + void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses) { notImplemented(); diff --git a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp index f8f3a24..5afd07e 100644 --- a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "WebContextMenuProxyWin.h" -#include "NotImplemented.h" +#include <WebCore/NotImplemented.h> using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/win/WebContextWin.cpp b/Source/WebKit2/UIProcess/win/WebContextWin.cpp index 210d6cc..26708d7 100644 --- a/Source/WebKit2/UIProcess/win/WebContextWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebContextWin.cpp @@ -30,6 +30,11 @@ #include "WebProcessMessages.h" #include <WebCore/FileSystem.h> +#if USE(CFNETWORK) +#include <CFNetwork/CFURLCachePriv.h> +#include <WebKitSystemInterface/WebKitSystemInterface.h> +#endif + using namespace WebCore; namespace WebKit { @@ -51,6 +56,24 @@ void WebContext::setShouldPaintNativeControls(bool b) void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters) { parameters.shouldPaintNativeControls = m_shouldPaintNativeControls; + +#if USE(CFNETWORK) + RetainPtr<CFURLCacheRef> cfurlCache(AdoptCF, CFURLCacheCopySharedURLCache()); + parameters.cfURLCacheDiskCapacity = CFURLCacheDiskCapacity(cfurlCache.get()); + parameters.cfURLCacheMemoryCapacity = CFURLCacheMemoryCapacity(cfurlCache.get()); + + RetainPtr<CFStringRef> cfURLCachePath(AdoptCF, wkCopyFoundationCacheDirectory()); + parameters.cfURLCachePath = String(cfURLCachePath.get()); + // Remove the ending '/' (necessary to have CFNetwork find the Cache file). + ASSERT(parameters.cfURLCachePath.length()); + if (parameters.cfURLCachePath[parameters.cfURLCachePath.length() - 1] == '/') + parameters.cfURLCachePath.remove(parameters.cfURLCachePath.length() - 1); + +#if USE(CFURLSTORAGESESSIONS) + parameters.uiProcessBundleIdentifier = String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey))); +#endif // USE(CFURLSTORAGESESSIONS) + +#endif // USE(CFNETWORK) } String WebContext::platformDefaultDatabaseDirectory() const diff --git a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp index 35d73ac..30b012e 100644 --- a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp @@ -28,11 +28,13 @@ #if ENABLE(INSPECTOR) +#include "WebKitBundle.h" #include "WebPageProxy.h" #include "WebView.h" #include <WebCore/WebCoreInstanceHandle.h> #include <wtf/PassRefPtr.h> #include <wtf/RetainPtr.h> +#include <wtf/text/StringConcatenate.h> #include <wtf/text/WTFString.h> using namespace WebCore; @@ -184,9 +186,16 @@ void WebInspectorProxy::platformClose() m_inspectorView = 0; } +void WebInspectorProxy::platformInspectedURLChanged(const String& urlString) +{ + // FIXME: this should be made localizable once WebKit2 supports it. <rdar://problem/8728860> + String title = makeString("Web Inspector ", static_cast<UChar>(0x2014), ' ', urlString); + ::SetWindowTextW(m_inspectorWindow, title.charactersWithNullTermination()); +} + String WebInspectorProxy::inspectorPageURL() const { - RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector"))); + RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(webKitBundle(), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector"))); if (!htmlURLRef) return String(); diff --git a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp index f70363c..186ad44 100644 --- a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp @@ -26,8 +26,8 @@ #include "config.h" #include "WebPageProxy.h" +#include "resource.h" #include <tchar.h> -#include <WebCore/Language.h> #include <WebCore/WebCoreInstanceHandle.h> #include <wtf/StdLibExtras.h> #include <wtf/text/StringConcatenate.h> @@ -62,53 +62,21 @@ static String windowsVersion() static String userVisibleWebKitVersionString() { - String versionStr = "420+"; - void* data = 0; + LPWSTR buildNumberStringPtr; + if (!::LoadStringW(instanceHandle(), BUILD_NUMBER, reinterpret_cast<LPWSTR>(&buildNumberStringPtr), 0) || !buildNumberStringPtr) + return "534+"; - struct LANGANDCODEPAGE { - WORD wLanguage; - WORD wCodePage; - } *lpTranslate; - - TCHAR path[MAX_PATH]; - ::GetModuleFileName(instanceHandle(), path, WTF_ARRAY_LENGTH(path)); - DWORD handle; - DWORD versionSize = ::GetFileVersionInfoSize(path, &handle); - if (!versionSize) - goto exit; - data = fastMalloc(versionSize); - if (!data) - goto exit; - if (!::GetFileVersionInfo(path, 0, versionSize, data)) - goto exit; - UINT cbTranslate; - if (!::VerQueryValue(data, TEXT("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate)) - goto exit; - TCHAR key[256]; - _stprintf_s(key, WTF_ARRAY_LENGTH(key), TEXT("\\StringFileInfo\\%04x%04x\\ProductVersion"), lpTranslate[0].wLanguage, lpTranslate[0].wCodePage); - LPCTSTR productVersion; - UINT productVersionLength; - if (!::VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&productVersion, &productVersionLength)) - goto exit; - versionStr = String(productVersion, productVersionLength - 1); - -exit: - if (data) - fastFree(data); - return versionStr; + return buildNumberStringPtr; } String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) { - DEFINE_STATIC_LOCAL(String, osVersion, (windowsVersion())); - DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString())); - - // FIXME: We should upate the user agent if the default language changes. - String language = defaultLanguage(); + DEFINE_STATIC_LOCAL(String, osVersion, (windowsVersion())); + DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString())); - if (applicationNameForUserAgent.isEmpty()) - return makeString("Mozilla/5.0 (Windows; U; ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)"); - return makeString("Mozilla/5.0 (Windows; U; ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent); + if (applicationNameForUserAgent.isEmpty()) + return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)"); + return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp index 4039c49..eebde75 100644 --- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp @@ -188,7 +188,7 @@ WebPopupMenuProxyWin::~WebPopupMenuProxyWin() m_scrollbar->setParent(0); } -void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex) +void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, TextDirection, double, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex) { m_items = items; m_data = data; diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h index 2d09bb9..5a20edf 100644 --- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h +++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h @@ -48,7 +48,7 @@ public: } ~WebPopupMenuProxyWin(); - virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); + virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, double scaleFactor, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); virtual void hidePopupMenu(); void hide() { hidePopupMenu(); } diff --git a/Source/WebKit2/UIProcess/win/WebView.cpp b/Source/WebKit2/UIProcess/win/WebView.cpp index eea43c5..62e0c42 100644 --- a/Source/WebKit2/UIProcess/win/WebView.cpp +++ b/Source/WebKit2/UIProcess/win/WebView.cpp @@ -29,7 +29,6 @@ #include "ChunkedUpdateDrawingAreaProxy.h" #include "DrawingAreaProxyImpl.h" #include "FindIndicator.h" -#include "LayerBackedDrawingAreaProxy.h" #include "Logging.h" #include "NativeWebKeyboardEvent.h" #include "Region.h" @@ -415,6 +414,7 @@ static void drawPageBackground(HDC dc, const RECT& rect) void WebView::paint(HDC hdc, const IntRect& dirtyRect) { + m_page->endPrinting(); if (useNewDrawingArea()) { if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(m_page->drawingArea())) { // FIXME: We should port WebKit1's rect coalescing logic here. @@ -438,11 +438,33 @@ void WebView::paint(HDC hdc, const IntRect& dirtyRect) } } +static void flashRects(HDC dc, const IntRect rects[], size_t rectCount, HBRUSH brush) +{ + for (size_t i = 0; i < rectCount; ++i) { + RECT winRect = rects[i]; + ::FillRect(dc, &winRect, brush); + } + + ::GdiFlush(); + ::Sleep(50); +} + +static OwnPtr<HBRUSH> createBrush(const Color& color) +{ + return adoptPtr(::CreateSolidBrush(RGB(color.red(), color.green(), color.blue()))); +} + LRESULT WebView::onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled) { PAINTSTRUCT paintStruct; HDC hdc = ::BeginPaint(m_window, &paintStruct); + if (WebPageProxy::debugPaintFlags() & kWKDebugFlashViewUpdates) { + static HBRUSH brush = createBrush(WebPageProxy::viewUpdatesFlashColor().rgb()).leakPtr(); + IntRect rect = paintStruct.rcPaint; + flashRects(hdc, &rect, 1, brush); + } + paint(hdc, paintStruct.rcPaint); ::EndPaint(m_window, &paintStruct); @@ -650,6 +672,14 @@ void WebView::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset) setViewNeedsDisplay(scrollRect); } +void WebView::flashBackingStoreUpdates(const Vector<IntRect>& updateRects) +{ + static HBRUSH brush = createBrush(WebPageProxy::backingStoreUpdatesFlashColor().rgb()).leakPtr(); + HDC dc = ::GetDC(m_window); + flashRects(dc, updateRects.data(), updateRects.size(), brush); + ::ReleaseDC(m_window, dc); +} + WebCore::IntSize WebView::viewSize() { RECT clientRect; @@ -771,10 +801,6 @@ void WebView::clearAllEditCommands() { } -void WebView::setEditCommandState(const String&, bool, int) -{ -} - FloatRect WebView::convertToDeviceSpace(const FloatRect& rect) { return rect; @@ -1114,7 +1140,7 @@ void WebView::didCommitLoadForMainFrame(bool useCustomRepresentation) { } -void WebView::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&) +void WebView::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&) { } @@ -1153,46 +1179,6 @@ void WebView::exitAcceleratedCompositingMode() ASSERT_NOT_REACHED(); } -void WebView::pageDidEnterAcceleratedCompositing() -{ - ASSERT(!useNewDrawingArea()); - switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::LayerBacked); -} - -void WebView::pageDidLeaveAcceleratedCompositing() -{ - ASSERT(!useNewDrawingArea()); - switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::ChunkedUpdate); -} - -void WebView::switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type type) -{ - ASSERT(!useNewDrawingArea()); - - DrawingAreaInfo::Type existingDrawingAreaType = m_page->drawingArea() ? m_page->drawingArea()->info().type : DrawingAreaInfo::None; - if (existingDrawingAreaType == type) - return; - - OwnPtr<DrawingAreaProxy> newDrawingArea; - switch (type) { - case DrawingAreaInfo::Impl: - case DrawingAreaInfo::None: - break; - case DrawingAreaInfo::ChunkedUpdate: - newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(this, m_page.get()); - break; - case DrawingAreaInfo::LayerBacked: - newDrawingArea = LayerBackedDrawingAreaProxy::create(this, m_page.get()); - break; - } - - if (m_page->drawingArea()) - newDrawingArea->setSize(m_page->drawingArea()->size(), IntSize()); - - m_page->drawingArea()->detachCompositingContext(); - m_page->setDrawingArea(newDrawingArea.release()); -} - #endif // USE(ACCELERATED_COMPOSITING) HWND WebView::nativeWindow() diff --git a/Source/WebKit2/UIProcess/win/WebView.h b/Source/WebKit2/UIProcess/win/WebView.h index 297b6ad..28aedd6 100644 --- a/Source/WebKit2/UIProcess/win/WebView.h +++ b/Source/WebKit2/UIProcess/win/WebView.h @@ -133,6 +133,7 @@ private: virtual void setViewNeedsDisplay(const WebCore::IntRect&); virtual void displayView(); virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); + virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects); virtual WebCore::IntSize viewSize(); virtual bool isViewWindowActive(); @@ -148,7 +149,6 @@ private: virtual void setViewportArguments(const WebCore::ViewportArguments&); virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo); virtual void clearAllEditCommands(); - virtual void setEditCommandState(const WTF::String&, bool, int); virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&); virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&); virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled); @@ -160,14 +160,10 @@ private: #if USE(ACCELERATED_COMPOSITING) virtual void enterAcceleratedCompositingMode(const LayerTreeContext&); virtual void exitAcceleratedCompositingMode(); - - virtual void pageDidEnterAcceleratedCompositing(); - virtual void pageDidLeaveAcceleratedCompositing(); - void switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type); #endif void didCommitLoadForMainFrame(bool useCustomRepresentation); - void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&); + void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&); virtual double customRepresentationZoomFactor(); virtual void setCustomRepresentationZoomFactor(double); WebCore::DragOperation keyStateToDragOperation(DWORD grfKeyState) const; |