diff options
| author | Ben Murdoch <benm@google.com> | 2011-05-13 16:23:25 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2011-05-16 11:35:02 +0100 |
| commit | 65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch) | |
| tree | f478babb801e720de7bfaee23443ffe029f58731 /Source/WebKit2/WebProcess/WebCoreSupport/win | |
| parent | 47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff) | |
| download | external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2 | |
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebKit2/WebProcess/WebCoreSupport/win')
6 files changed, 384 insertions, 0 deletions
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp new file mode 100644 index 0000000..c16a4d6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp @@ -0,0 +1,54 @@ +/* + * 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 "WebContextMenuClient.h" +#include <WebCore/NotImplemented.h> + +using namespace WebCore; + +namespace WebKit { + +void WebContextMenuClient::lookUpInDictionary(Frame*) +{ + notImplemented(); +} + +bool WebContextMenuClient::isSpeaking() +{ + notImplemented(); + return false; +} + +void WebContextMenuClient::speak(const String&) +{ + notImplemented(); +} + +void WebContextMenuClient::stopSpeaking() +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp new file mode 100644 index 0000000..b6d15fd --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp @@ -0,0 +1,39 @@ +/* + * 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 "WebDatabaseManager.h" + +#include <WebCore/FileSystem.h> + +using namespace WebCore; + +namespace WebKit { + +String WebDatabaseManager::databaseDirectory() const +{ + return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases"); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp new file mode 100644 index 0000000..b29b461 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp @@ -0,0 +1,80 @@ +/* + * 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 "WebErrors.h" + +#include "WKError.h" +#include "WebError.h" +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> + +#if USE(CFNETWORK) +#include <CFNetwork/CFNetworkErrors.h> +#endif + +using namespace WebCore; + +namespace WebKit { + +ResourceError cancelledError(const ResourceRequest& request) +{ +#if USE(CFNETWORK) + return ResourceError(kCFErrorDomainCFNetwork, kCFURLErrorCancelled, request.url().string(), String()); +#else + return ResourceError(); // FIXME +#endif +} + +ResourceError blockedError(const ResourceRequest& request) +{ + return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotUseRestrictedPort, request.url().string(), String()); +} + +ResourceError cannotShowURLError(const ResourceRequest& request) +{ + return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotShowURL, request.url().string(), String()); +} + +ResourceError interruptForPolicyChangeError(const ResourceRequest& request) +{ + return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeFrameLoadInterruptedByPolicyChange, request.url().string(), String()); +} + +ResourceError cannotShowMIMETypeError(const ResourceResponse& response) +{ + return ResourceError(); +} + +ResourceError fileDoesNotExistError(const ResourceResponse& response) +{ + return ResourceError(); +} + +ResourceError pluginWillHandleLoadError(const ResourceResponse& response) +{ + return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url().string(), String()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp new file mode 100644 index 0000000..6b20c1f --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp @@ -0,0 +1,20 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +// Checking this file in empty to get the build system work out of the way. +// Will put the code in here later. diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h new file mode 100644 index 0000000..016dcce --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h @@ -0,0 +1,47 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WebFrameNetworkingContext_h +#define WebFrameNetworkingContext_h + +#include <WebCore/FrameNetworkingContext.h> +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceRequest.h> + +class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext { +public: + static PassRefPtr<WebFrameNetworkingContext> create(WebCore::Frame* frame) + { + return adoptRef(new WebFrameNetworkingContext(frame)); + } + +private: + WebFrameNetworkingContext(WebCore::Frame* frame) + : WebCore::FrameNetworkingContext(frame) + { + } + + virtual WTF::String userAgent() const; + virtual WTF::String referrer() const; + virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const; + + WTF::String m_userAgent; +}; + +#endif // WebFrameNetworkingContext_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp new file mode 100644 index 0000000..9c23133 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp @@ -0,0 +1,144 @@ +/* + * 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 "WebPopupMenu.h" + +#include "PlatformPopupMenuData.h" +#include <WebCore/Font.h> +#include <WebCore/GraphicsContext.h> +#include <WebCore/TextRun.h> +#include <WebCore/PopupMenuClient.h> +#include <WebCore/PopupMenuStyle.h> +#include <WebCore/RenderTheme.h> + +using namespace WebCore; + +namespace WebKit { + +static const int separatorPadding = 4; +static const int separatorHeight = 1; +static const int popupWindowBorderWidth = 1; + +void WebPopupMenu::setUpPlatformData(const WebCore::IntRect& pageCoordinates, PlatformPopupMenuData& data) +{ + int itemCount = m_popupClient->listSize(); + + data.m_clientPaddingLeft = m_popupClient->clientPaddingLeft(); + data.m_clientPaddingRight = m_popupClient->clientPaddingRight(); + data.m_clientInsetLeft = m_popupClient->clientInsetLeft(); + data.m_clientInsetRight = m_popupClient->clientInsetRight(); + data.m_itemHeight = m_popupClient->menuStyle().font().height() + 1; + + int popupWidth = 0; + for (size_t i = 0; i < itemCount; ++i) { + String text = m_popupClient->itemText(i); + if (text.isEmpty()) + continue; + + Font itemFont = m_popupClient->menuStyle().font(); + if (m_popupClient->itemIsLabel(i)) { + FontDescription d = itemFont.fontDescription(); + d.setWeight(d.bolderWeight()); + itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing()); + itemFont.update(m_popupClient->fontSelector()); + } + + popupWidth = std::max(popupWidth, itemFont.width(TextRun(text.characters(), text.length()))); + } + + // FIXME: popupWidth should probably take into account monitor constraints as is done with WebPopupMenuProxyWin::calculatePositionAndSize. + + popupWidth += max(0, data.m_clientPaddingRight - data.m_clientInsetRight) + max(0, data.m_clientPaddingLeft - data.m_clientInsetLeft); + popupWidth += 2 * popupWindowBorderWidth; + data.m_popupWidth = popupWidth; + + // The backing stores should be drawn at least as wide as the control on the page to match the width of the popup window we'll create. + int backingStoreWidth = max(pageCoordinates.width() - m_popupClient->clientInsetLeft() - m_popupClient->clientInsetRight(), popupWidth); + + data.m_backingStoreSize = IntSize(backingStoreWidth, (itemCount * data.m_itemHeight)); + data.m_notSelectedBackingStore = ShareableBitmap::createShareable(data.m_backingStoreSize); + data.m_selectedBackingStore = ShareableBitmap::createShareable(data.m_backingStoreSize); + + OwnPtr<GraphicsContext> notSelectedBackingStoreContext = data.m_notSelectedBackingStore->createGraphicsContext(); + OwnPtr<GraphicsContext> selectedBackingStoreContext = data.m_selectedBackingStore->createGraphicsContext(); + + Color activeOptionBackgroundColor = RenderTheme::defaultTheme()->activeListBoxSelectionBackgroundColor(); + Color activeOptionTextColor = RenderTheme::defaultTheme()->activeListBoxSelectionForegroundColor(); + + for (int y = 0; y < data.m_backingStoreSize.height(); y += data.m_itemHeight) { + int index = y / data.m_itemHeight; + + PopupMenuStyle itemStyle = m_popupClient->itemStyle(index); + + Color optionBackgroundColor = itemStyle.backgroundColor(); + Color optionTextColor = itemStyle.foregroundColor(); + + IntRect itemRect(0, y, backingStoreWidth, data.m_itemHeight); + + // Draw the background for this menu item + if (itemStyle.isVisible()) { + notSelectedBackingStoreContext->fillRect(itemRect, optionBackgroundColor, ColorSpaceDeviceRGB); + selectedBackingStoreContext->fillRect(itemRect, activeOptionBackgroundColor, ColorSpaceDeviceRGB); + } + + if (m_popupClient->itemIsSeparator(index)) { + IntRect separatorRect(itemRect.x() + separatorPadding, itemRect.y() + (itemRect.height() - separatorHeight) / 2, itemRect.width() - 2 * separatorPadding, separatorHeight); + + notSelectedBackingStoreContext->fillRect(separatorRect, optionTextColor, ColorSpaceDeviceRGB); + selectedBackingStoreContext->fillRect(separatorRect, activeOptionTextColor, ColorSpaceDeviceRGB); + continue; + } + + String itemText = m_popupClient->itemText(index); + + unsigned length = itemText.length(); + const UChar* string = itemText.characters(); + TextRun textRun(string, length, false, 0, 0, itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft); + + notSelectedBackingStoreContext->setFillColor(optionTextColor, ColorSpaceDeviceRGB); + selectedBackingStoreContext->setFillColor(activeOptionTextColor, ColorSpaceDeviceRGB); + + Font itemFont = m_popupClient->menuStyle().font(); + if (m_popupClient->itemIsLabel(index)) { + FontDescription d = itemFont.fontDescription(); + d.setWeight(d.bolderWeight()); + itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing()); + itemFont.update(m_popupClient->fontSelector()); + } + + // Draw the item text + if (itemStyle.isVisible()) { + int textX = std::max(0, data.m_clientPaddingLeft - data.m_clientInsetLeft); + if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR) + textX += itemStyle.textIndent().calcMinValue(itemRect.width()); + int textY = itemRect.y() + itemFont.ascent() + (itemRect.height() - itemFont.height()) / 2; + + notSelectedBackingStoreContext->drawBidiText(itemFont, textRun, IntPoint(textX, textY)); + selectedBackingStoreContext->drawBidiText(itemFont, textRun, IntPoint(textX, textY)); + } + } +} + +} // namespace WebKit |
