diff options
Diffstat (limited to 'webkit/port/platform/chromium')
60 files changed, 0 insertions, 10852 deletions
diff --git a/webkit/port/platform/chromium/ChromiumBridge.h b/webkit/port/platform/chromium/ChromiumBridge.h deleted file mode 100644 index 15de72f..0000000 --- a/webkit/port/platform/chromium/ChromiumBridge.h +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef ChromiumBridge_h -#define ChromiumBridge_h - -#include "config.h" - -#include "LinkHash.h" -#include "PasteboardPrivate.h" -#include "PassRefPtr.h" -#include "PlatformString.h" - -class NativeImageSkia; - -typedef struct NPObject NPObject; -typedef struct _NPP NPP_t; -typedef NPP_t* NPP; - -#if PLATFORM(WIN_OS) -typedef struct HFONT__* HFONT; -#endif - -namespace WebCore { - class Color; - class Cursor; - class Document; - class Frame; - class GraphicsContext; - class Image; - class IntRect; - class KURL; - class String; - class Widget; - - struct PluginInfo; - - // An interface to the embedding layer, which has the ability to answer - // questions about the system and so on... - - class ChromiumBridge { - public: - // Clipboard ---------------------------------------------------------- - static bool clipboardIsFormatAvailable(PasteboardPrivate::ClipboardFormat); - - static String clipboardReadPlainText(); - static void clipboardReadHTML(String*, KURL*); - - static void clipboardWriteSelection(const String&, const KURL&, const String&, bool); - static void clipboardWriteURL(const KURL&, const String&); - static void clipboardWriteImage(const NativeImageSkia* bitmap, const KURL&, const String&); - - // Cookies ------------------------------------------------------------ - static void setCookies(const KURL& url, const KURL& policyURL, const String& value); - static String cookies(const KURL& url, const KURL& policyURL); - - // DNS ---------------------------------------------------------------- - static void prefetchDNS(const String& hostname); - - // Font --------------------------------------------------------------- -#if PLATFORM(WIN_OS) - static bool ensureFontLoaded(HFONT font); -#endif - - // Forms -------------------------------------------------------------- - static void notifyFormStateChanged(const Document* doc); - - // JavaScript --------------------------------------------------------- - static void notifyJSOutOfMemory(Frame* frame); - - // Language ----------------------------------------------------------- - static String computedDefaultLanguage(); - - // LayoutTestMode ----------------------------------------------------- - static bool layoutTestMode(); - - // MimeType ----------------------------------------------------------- - static bool isSupportedImageMIMEType(const char* mime_type); - static bool isSupportedJavascriptMIMEType(const char* mime_type); - static bool isSupportedNonImageMIMEType(const char* mime_type); - static bool matchesMIMEType(const String& pattern, const String& type); - static String mimeTypeForExtension(const String& ext); - static String mimeTypeFromFile(const String& file_path); - static String preferredExtensionForMIMEType(const String& mime_type); - - // Plugin ------------------------------------------------------------- - static bool plugins(bool refresh, Vector<PluginInfo*>* plugins); - static NPObject* pluginScriptableObject(Widget* widget); - static bool popupsAllowed(NPP npp); - - // Protocol ----------------------------------------------------------- - static String uiResourceProtocol(); - - // Resources ---------------------------------------------------------- - static PassRefPtr<Image> loadPlatformImageResource(const char* name); - - // Screen ------------------------------------------------------------- - static int screenDepth(Widget*); - static int screenDepthPerComponent(Widget*); - static bool screenIsMonochrome(Widget*); - static IntRect screenRect(Widget*); - static IntRect screenAvailableRect(Widget*); - - // SharedTimers ------------------------------------------------------- - static void setSharedTimerFiredFunction(void (*func)()); - static void setSharedTimerFireTime(double fire_time); - static void stopSharedTimer(); - - // StatsCounters ------------------------------------------------------ - static void decrementStatsCounter(const char* name); - static void incrementStatsCounter(const char* name); - static void initV8CounterFunction(); - - // SystemTime --------------------------------------------------------- - static double currentTime(); - - // Theming ------------------------------------------------------------ -#if PLATFORM(WIN_OS) - static void paintButton( - GraphicsContext*, int part, int state, int classicState, const IntRect& rect); - static void paintMenuList( - GraphicsContext*, int part, int state, int classicState, const IntRect& rect); - static void paintScrollbarArrow( - GraphicsContext*, int state, int classicState, const IntRect& rect); - static void paintScrollbarThumb( - GraphicsContext*, int part, int state, int classicState, const IntRect& rect); - static void paintScrollbarTrack( - GraphicsContext*, int part, int state, int classicState, const IntRect& rect, const IntRect& alignRect); - static void paintTextField( - GraphicsContext*, int part, int state, int classicState, const IntRect& rect, const Color& color, bool fillContentArea, bool drawEdges); -#endif - - // Trace Event -------------------------------------------------------- - static void traceEventBegin(const char* name, void* id, const char* extra); - static void traceEventEnd(const char* name, void* id, const char* extra); - - // URL ---------------------------------------------------------------- - static KURL inspectorURL(); - - // Visited links ------------------------------------------------------ - static LinkHash visitedLinkHash(const UChar* url, unsigned length); - static LinkHash visitedLinkHash(const KURL& base, - const AtomicString& attributeURL); - static bool isLinkVisited(LinkHash); - - // Widget ------------------------------------------------------------- - static void widgetSetCursor(Widget*, const Cursor&); - static void widgetSetFocus(Widget*); - }; -} - -#endif diff --git a/webkit/port/platform/chromium/ChromiumDataObject.cpp b/webkit/port/platform/chromium/ChromiumDataObject.cpp deleted file mode 100644 index 54da838..0000000 --- a/webkit/port/platform/chromium/ChromiumDataObject.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "ChromiumDataObject.h" - -using namespace WebCore; - -void ChromiumDataObject::clear() -{ - url = KURL(); - url_title = ""; - filenames.clear(); - plain_text = ""; - text_html = ""; - html_base_url = KURL(); - file_content_filename = ""; - if (file_content) - file_content->clear(); -} - -bool ChromiumDataObject::hasData() -{ - return !url.isEmpty() || !filenames.isEmpty() || - !plain_text.isEmpty() || !text_html.isEmpty() || - file_content; -} diff --git a/webkit/port/platform/chromium/ChromiumDataObject.h b/webkit/port/platform/chromium/ChromiumDataObject.h deleted file mode 100644 index bdbb62c..0000000 --- a/webkit/port/platform/chromium/ChromiumDataObject.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -// A data object for holding data that would be in a clipboard or moved -// during a drag&drop operation. This is the data that webkit is aware -// of and is not specific to a platform. - -#ifndef ChromiumDataObject_h -#define ChromiumDataObject_h - -#include "KURL.h" -#include "PlatformString.h" -#include <wtf/RefPtr.h> -#include <wtf/Vector.h> - -namespace WebCore { - class ChromiumDataObject : public RefCounted<ChromiumDataObject> { - public: - static PassRefPtr<ChromiumDataObject> create() { - return adoptRef(new ChromiumDataObject); - } - - void clear(); - bool hasData(); - - KURL url; - String url_title; - - Vector<String> filenames; - - String plain_text; - - String text_html; - KURL html_base_url; - - String file_content_filename; - RefPtr<SharedBuffer> file_content; - private: - ChromiumDataObject() {} - - }; -} - -#endif // ChromiumDataObject_h diff --git a/webkit/port/platform/chromium/ChromiumUtilsWin.cpp b/webkit/port/platform/chromium/ChromiumUtilsWin.cpp deleted file mode 100644 index 8889eab..0000000 --- a/webkit/port/platform/chromium/ChromiumUtilsWin.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "ChromiumUtilsWin.h" - -#include <windows.h> - -namespace WebCore { -namespace ChromiumUtils { - -bool isVistaOrGreater() -{ - // Cache the result to avoid asking every time. - static bool haveResult = false; - static bool result = false; - if (!haveResult) { - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - GetVersionEx(&versionInfo); - - haveResult = true; - result = versionInfo.dwMajorVersion >= 6; - } - return result; -} - -} // namespace ChromiumUtils -} // namespace WebCore
\ No newline at end of file diff --git a/webkit/port/platform/chromium/ChromiumUtilsWin.h b/webkit/port/platform/chromium/ChromiumUtilsWin.h deleted file mode 100644 index 9bc3fb6..0000000 --- a/webkit/port/platform/chromium/ChromiumUtilsWin.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef ChromiumUtilsWin_h -#define ChromiumUtilsWin_h - -namespace WebCore { - namespace ChromiumUtils { - bool isVistaOrGreater(); - } -} - -#endif // ChromiumUtilsWin_h diff --git a/webkit/port/platform/chromium/ClipboardChromium.cpp b/webkit/port/platform/chromium/ClipboardChromium.cpp deleted file mode 100644 index ac701fe..0000000 --- a/webkit/port/platform/chromium/ClipboardChromium.cpp +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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" - -#if COMPILER(MSVC) -__pragma(warning(push, 0)) -#endif -#include "CachedImage.h" -#include "ChromiumBridge.h" -#include "ChromiumDataObject.h" -#include "ClipboardChromium.h" -#include "ClipboardUtilitiesChromium.h" -#include "CSSHelper.h" -#include "CString.h" -#include "Document.h" -#include "DragData.h" -#include "Editor.h" -#include "Element.h" -#include "EventHandler.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameView.h" -#include "HTMLNames.h" -#include "Image.h" -#include "MIMETypeRegistry.h" -#include "markup.h" -#include "Page.h" -#include "Pasteboard.h" -#include "PlatformString.h" -#include "Range.h" -#include "RenderImage.h" -#include "StringBuilder.h" -#include "StringHash.h" -#include <wtf/RefPtr.h> -#if COMPILER(MSVC) -__pragma(warning(pop)) -#endif - -namespace WebCore { - -using namespace HTMLNames; - -// We provide the IE clipboard types (URL and Text), and the clipboard types specified in the WHATWG Web Applications 1.0 draft -// see http://www.whatwg.org/specs/web-apps/current-work/ Section 6.3.5.3 - -enum ClipboardDataType { ClipboardDataTypeNone, ClipboardDataTypeURL, ClipboardDataTypeText }; - -static ClipboardDataType clipboardTypeFromMIMEType(const String& type) -{ - String qType = type.stripWhiteSpace().lower(); - - // two special cases for IE compatibility - if (qType == "text" || qType == "text/plain" || qType.startsWith("text/plain;")) - return ClipboardDataTypeText; - if (qType == "url" || qType == "text/uri-list") - return ClipboardDataTypeURL; - - return ClipboardDataTypeNone; -} - -ClipboardChromium::ClipboardChromium(bool isForDragging, - ChromiumDataObject* dataObject, - ClipboardAccessPolicy policy) - : Clipboard(policy, isForDragging) - , m_dataObject(dataObject) -{ -} - -PassRefPtr<ClipboardChromium> ClipboardChromium::create(bool isForDragging, - ChromiumDataObject* dataObject, ClipboardAccessPolicy policy) -{ - return adoptRef(new ClipboardChromium(isForDragging, dataObject, policy)); -} - -void ClipboardChromium::clearData(const String& type) -{ - if (policy() != ClipboardWritable || !m_dataObject) - return; - - ClipboardDataType dataType = clipboardTypeFromMIMEType(type); - - if (dataType == ClipboardDataTypeURL) { - m_dataObject->url = KURL(); - m_dataObject->url_title = ""; - } - if (dataType == ClipboardDataTypeText) { - m_dataObject->plain_text = ""; - } -} - -void ClipboardChromium::clearAllData() -{ - if (policy() != ClipboardWritable) - return; - - m_dataObject->clear(); -} - -String ClipboardChromium::getData(const String& type, bool& success) const -{ - success = false; - if (policy() != ClipboardReadable || !m_dataObject) { - return ""; - } - - ClipboardDataType dataType = clipboardTypeFromMIMEType(type); - String text; - if (dataType == ClipboardDataTypeText) { - if (!isForDragging()) { - // If this isn't for a drag, it's for a cut/paste event handler. - // In this case, we need to check the clipboard. - text = ChromiumBridge::clipboardReadPlainText(); - success = !text.isEmpty(); - } else if (!m_dataObject->plain_text.isEmpty()) { - success = true; - text = m_dataObject->plain_text; - } - } else if (dataType == ClipboardDataTypeURL) { - // TODO(tc): Handle the cut/paste event. This requires adding - // a new IPC message to get the URL from the clipboard directly. - if (!m_dataObject->url.isEmpty()) { - success = true; - text = m_dataObject->url.string(); - } - } - - return text; -} - -bool ClipboardChromium::setData(const String& type, const String& data) -{ - if (policy() != ClipboardWritable) - return false; - - ClipboardDataType winType = clipboardTypeFromMIMEType(type); - - if (winType == ClipboardDataTypeURL) { - m_dataObject->url = KURL(data); - return m_dataObject->url.isValid(); - } - - if (winType == ClipboardDataTypeText) { - m_dataObject->plain_text = data; - return true; - } - return false; -} - -// extensions beyond IE's API -HashSet<String> ClipboardChromium::types() const -{ - HashSet<String> results; - if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable) - return results; - - if (!m_dataObject) - return results; - - if (m_dataObject->url.isValid()) { - results.add("URL"); - results.add("text/uri-list"); - } - - if (!m_dataObject->plain_text.isEmpty()) { - results.add("Text"); - results.add("text/plain"); - } - - return results; -} - -void ClipboardChromium::setDragImage(CachedImage* image, Node *node, const IntPoint &loc) -{ - if (policy() != ClipboardImageWritable && policy() != ClipboardWritable) - return; - - if (m_dragImage) - m_dragImage->removeClient(this); - m_dragImage = image; - if (m_dragImage) - m_dragImage->addClient(this); - - m_dragLoc = loc; - m_dragImageElement = node; -} - -void ClipboardChromium::setDragImage(CachedImage* img, const IntPoint &loc) -{ - setDragImage(img, 0, loc); -} - -void ClipboardChromium::setDragImageElement(Node *node, const IntPoint &loc) -{ - setDragImage(0, node, loc); -} - -DragImageRef ClipboardChromium::createDragImage(IntPoint& loc) const -{ - DragImageRef result = 0; - if (m_dragImage) { - result = createDragImageFromImage(m_dragImage->image()); - loc = m_dragLoc; - } - return result; -} - -static String imageToMarkup(const String& url, Element* element) -{ - StringBuilder markup; - markup.append("<img src=\""); - markup.append(url); - markup.append("\""); - // Copy over attributes. If we are dragging an image, we expect things like - // the id to be copied as well. - NamedAttrMap* attrs = element->attributes(); - unsigned int length = attrs->length(); - for (unsigned int i = 0; i < length; ++i) { - Attribute* attr = attrs->attributeItem(i); - if (attr->localName() == "src") - continue; - markup.append(" "); - markup.append(attr->localName()); - markup.append("=\""); - String escapedAttr = attr->value(); - escapedAttr.replace("\"", """); - markup.append(escapedAttr); - markup.append("\""); - } - - markup.append("/>"); - return markup.toString(); -} - -static CachedImage* getCachedImage(Element* element) -{ - // Attempt to pull CachedImage from element - ASSERT(element); - RenderObject* renderer = element->renderer(); - if (!renderer || !renderer->isImage()) - return 0; - - RenderImage* image = static_cast<RenderImage*>(renderer); - if (image->cachedImage() && !image->cachedImage()->errorOccurred()) - return image->cachedImage(); - - return 0; -} - -static void writeImageToDataObject(ChromiumDataObject* dataObject, Element* element, - const KURL& url) -{ - // Shove image data into a DataObject for use as a file - CachedImage* cachedImage = getCachedImage(element); - if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded()) - return; - - SharedBuffer* imageBuffer = cachedImage->image()->data(); - if (!imageBuffer || !imageBuffer->size()) - return; - - dataObject->file_content = imageBuffer; - - // Determine the filename for the file contents of the image. We try to - // use the alt tag if one exists, otherwise we fall back on the suggested - // filename in the http header, and finally we resort to using the filename - // in the URL. - String extension("."); - extension += WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType( - cachedImage->response().mimeType()); - String title = element->getAttribute(altAttr); - if (title.isEmpty()) { - title = cachedImage->response().suggestedFilename(); - if (title.isEmpty()) { - // TODO(tc): Get the filename from the URL. - } - } - dataObject->file_content_filename = title + extension; -} - -void ClipboardChromium::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame) -{ - if (!m_dataObject) - return; - - m_dataObject->url = url; - m_dataObject->url_title = title; - - // Write the bytes in the image to the file format. - writeImageToDataObject(m_dataObject.get(), element, url); - - AtomicString imageURL = element->getAttribute(srcAttr); - if (imageURL.isEmpty()) - return; - - String fullURL = frame->document()->completeURL(parseURL(imageURL)); - if (fullURL.isEmpty()) - return; - - // Put img tag on the clipboard referencing the image - m_dataObject->text_html = imageToMarkup(fullURL, element); -} - -void ClipboardChromium::writeURL(const KURL& url, const String& title, Frame*) -{ - if (!m_dataObject) - return; - m_dataObject->url = url; - m_dataObject->url_title = title; - - // The URL can also be used as plain text. - m_dataObject->plain_text = url.string(); - - // The URL can also be used as an HTML fragment. - m_dataObject->text_html = urlToMarkup(url, title); - m_dataObject->html_base_url = url; -} - -void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame) -{ - ASSERT(selectedRange); - if (!m_dataObject) - return; - - m_dataObject->text_html = createMarkup(selectedRange, 0, - AnnotateForInterchange); - m_dataObject->html_base_url = frame->document()->url(); - - String str = frame->selectedText(); -#if PLATFORM(WIN_OS) - replaceNewlinesWithWindowsStyleNewlines(str); -#endif - replaceNBSPWithSpace(str); - m_dataObject->plain_text = str; -} - -bool ClipboardChromium::hasData() -{ - if (!m_dataObject) - return false; - - return m_dataObject->hasData(); -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/ClipboardChromium.h b/webkit/port/platform/chromium/ClipboardChromium.h deleted file mode 100644 index 81f2851..0000000 --- a/webkit/port/platform/chromium/ClipboardChromium.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef ClipboardChromium_h -#define ClipboardChromium_h - -#include "Clipboard.h" - -#include "CachedResourceClient.h" - -namespace WebCore { - - class CachedImage; - class ChromiumDataObject; - class IntPoint; - - class ClipboardChromium : public Clipboard, public CachedResourceClient { - public: - ~ClipboardChromium() {} - - static PassRefPtr<ClipboardChromium> create(bool, ChromiumDataObject*, - ClipboardAccessPolicy); - - virtual void clearData(const String& type); - void clearAllData(); - String getData(const String& type, bool& success) const; - bool setData(const String& type, const String& data); - - // extensions beyond IE's API - HashSet<String> types() const; - - void setDragImage(CachedImage*, const IntPoint&); - void setDragImageElement(Node*, const IntPoint&); - - PassRefPtr<ChromiumDataObject> dataObject() { - return m_dataObject; - } - - virtual DragImageRef createDragImage(IntPoint& dragLoc) const; - virtual void declareAndWriteDragImage(Element*, const KURL&, - const String& title, Frame*); - virtual void writeURL(const KURL&, const String&, Frame*); - virtual void writeRange(Range*, Frame*); - - virtual bool hasData(); - - private: - ClipboardChromium(bool, ChromiumDataObject*, ClipboardAccessPolicy); - - void resetFromClipboard(); - void setDragImage(CachedImage*, Node*, const IntPoint&); - RefPtr<ChromiumDataObject> m_dataObject; - Frame* m_frame; - }; - -} // namespace WebCore - -#endif // ClipboardChromium_h diff --git a/webkit/port/platform/chromium/ClipboardUtilitiesChromium.cpp b/webkit/port/platform/chromium/ClipboardUtilitiesChromium.cpp deleted file mode 100644 index 37910c1..0000000 --- a/webkit/port/platform/chromium/ClipboardUtilitiesChromium.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "ClipboardUtilitiesChromium.h" - -#include "KURL.h" -#include "PlatformString.h" - -namespace WebCore { - -#if PLATFORM(WIN_OS) -void replaceNewlinesWithWindowsStyleNewlines(String& str) -{ - static const UChar Newline = '\n'; - static const char* const WindowsNewline("\r\n"); - str.replace(Newline, WindowsNewline); -} -#endif - -void replaceNBSPWithSpace(String& str) -{ - static const UChar NonBreakingSpaceCharacter = 0xA0; - static const UChar SpaceCharacter = ' '; - str.replace(NonBreakingSpaceCharacter, SpaceCharacter); -} - -String urlToMarkup(const KURL& url, const String& title) -{ - String markup("<a href=\""); - markup.append(url.string()); - markup.append("\">"); - // TODO(tc): HTML escape this, possibly by moving into the glue layer so we - // can use net/base/escape.h. - markup.append(title); - markup.append("</a>"); - return markup; -} - -} diff --git a/webkit/port/platform/chromium/ClipboardUtilitiesChromium.h b/webkit/port/platform/chromium/ClipboardUtilitiesChromium.h deleted file mode 100644 index 4bccc13..0000000 --- a/webkit/port/platform/chromium/ClipboardUtilitiesChromium.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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" - -namespace WebCore { - -class KURL; -class String; - -#if PLATFORM(WIN_OS) -void replaceNewlinesWithWindowsStyleNewlines(String&); -#endif -void replaceNBSPWithSpace(String&); - -String urlToMarkup(const KURL&, const String&); - -} diff --git a/webkit/port/platform/chromium/ContextMenuChromium.cpp b/webkit/port/platform/chromium/ContextMenuChromium.cpp deleted file mode 100644 index 81c318d..0000000 --- a/webkit/port/platform/chromium/ContextMenuChromium.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "ContextMenu.h" - -namespace WebCore { - -// This is a stub implementation of WebKit's ContextMenu class that does -// nothing. - -ContextMenu::ContextMenu(const HitTestResult& result) - : m_hitTestResult(result) - , m_platformDescription(0) -{ -} - -ContextMenu::ContextMenu(const HitTestResult& result, const PlatformMenuDescription menu) - : m_hitTestResult(result) - , m_platformDescription(0) -{ -} - -ContextMenu::~ContextMenu() -{ -} - -unsigned ContextMenu::itemCount() const -{ - return 0; -} - -void ContextMenu::insertItem(unsigned int position, ContextMenuItem& item) -{ -} - -void ContextMenu::appendItem(ContextMenuItem& item) -{ -} - -ContextMenuItem* ContextMenu::itemWithAction(unsigned action) -{ - return 0; -} - -ContextMenuItem* ContextMenu::itemAtIndex(unsigned index, const PlatformMenuDescription platformDescription) -{ - return 0; -} - -void ContextMenu::setPlatformDescription(PlatformMenuDescription menu) -{ -} - -PlatformMenuDescription ContextMenu::platformDescription() const -{ - return m_platformDescription; -} - -PlatformMenuDescription ContextMenu::releasePlatformDescription() -{ - return 0; -} - -} diff --git a/webkit/port/platform/chromium/ContextMenuItemChromium.cpp b/webkit/port/platform/chromium/ContextMenuItemChromium.cpp deleted file mode 100644 index ebdc9c9..0000000 --- a/webkit/port/platform/chromium/ContextMenuItemChromium.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "ContextMenuItem.h" - -#include "ContextMenu.h" - -namespace WebCore { - -// This is a stub implementation of WebKit's ContextMenu class that does -// nothing. - -ContextMenuItem::ContextMenuItem(PlatformMenuItemDescription item) -{ -} - -ContextMenuItem::ContextMenuItem(ContextMenu* subMenu) -{ -} - -ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, ContextMenu* subMenu) -{ -} - -ContextMenuItem::~ContextMenuItem() -{ -} - -PlatformMenuItemDescription ContextMenuItem::releasePlatformDescription() -{ - return PlatformMenuItemDescription(); -} - -ContextMenuItemType ContextMenuItem::type() const -{ - return ContextMenuItemType(); -} - -ContextMenuAction ContextMenuItem::action() const -{ - return ContextMenuAction(); -} - -String ContextMenuItem::title() const -{ - return String(); -} - -PlatformMenuDescription ContextMenuItem::platformSubMenu() const -{ - return PlatformMenuDescription(); -} - -void ContextMenuItem::setType(ContextMenuItemType type) -{ -} - -void ContextMenuItem::setAction(ContextMenuAction action) -{ -} - -void ContextMenuItem::setTitle(const String& title) -{ -} - -void ContextMenuItem::setSubMenu(ContextMenu* subMenu) -{ -} - -void ContextMenuItem::setChecked(bool checked) -{ -} - -void ContextMenuItem::setEnabled(bool enabled) -{ -} - -bool ContextMenuItem::enabled() const -{ - return false; -} - -} diff --git a/webkit/port/platform/chromium/CursorChromium.cpp b/webkit/port/platform/chromium/CursorChromium.cpp deleted file mode 100644 index fe9a893..0000000 --- a/webkit/port/platform/chromium/CursorChromium.cpp +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "Cursor.h" - -namespace WebCore { - -Cursor::Cursor(const Cursor& other) - : m_impl(other.m_impl) -{ -} - -Cursor::Cursor(Image* image, const IntPoint& hotSpot) - : m_impl(image, hotSpot) -{ -} - -Cursor::~Cursor() -{ -} - -Cursor& Cursor::operator=(const Cursor& other) -{ - m_impl = other.m_impl; - return *this; -} - -Cursor::Cursor(PlatformCursor c) - : m_impl(c) -{ -} - -const Cursor& pointerCursor() -{ - static const Cursor c(PlatformCursor::typePointer); - return c; -} - -const Cursor& crossCursor() -{ - static const Cursor c(PlatformCursor::typeCross); - return c; -} - -const Cursor& handCursor() -{ - static const Cursor c(PlatformCursor::typeHand); - return c; -} - -const Cursor& iBeamCursor() -{ - static const Cursor c(PlatformCursor::typeIBeam); - return c; -} - -const Cursor& waitCursor() -{ - static const Cursor c(PlatformCursor::typeWait); - return c; -} - -const Cursor& helpCursor() -{ - static const Cursor c(PlatformCursor::typeHelp); - return c; -} - -const Cursor& eastResizeCursor() -{ - static const Cursor c(PlatformCursor::typeEastResize); - return c; -} - -const Cursor& northResizeCursor() -{ - static const Cursor c(PlatformCursor::typeNorthResize); - return c; -} - -const Cursor& northEastResizeCursor() -{ - static const Cursor c(PlatformCursor::typeNorthEastResize); - return c; -} - -const Cursor& northWestResizeCursor() -{ - static const Cursor c(PlatformCursor::typeNorthWestResize); - return c; -} - -const Cursor& southResizeCursor() -{ - static const Cursor c(PlatformCursor::typeSouthResize); - return c; -} - -const Cursor& southEastResizeCursor() -{ - static const Cursor c(PlatformCursor::typeSouthEastResize); - return c; -} - -const Cursor& southWestResizeCursor() -{ - static const Cursor c(PlatformCursor::typeSouthWestResize); - return c; -} - -const Cursor& westResizeCursor() -{ - static const Cursor c(PlatformCursor::typeWestResize); - return c; -} - -const Cursor& northSouthResizeCursor() -{ - static const Cursor c(PlatformCursor::typeNorthSouthResize); - return c; -} - -const Cursor& eastWestResizeCursor() -{ - static const Cursor c(PlatformCursor::typeEastWestResize); - return c; -} - -const Cursor& northEastSouthWestResizeCursor() -{ - static const Cursor c(PlatformCursor::typeNorthEastSouthWestResize); - return c; -} - -const Cursor& northWestSouthEastResizeCursor() -{ - static const Cursor c(PlatformCursor::typeNorthWestSouthEastResize); - return c; -} - -const Cursor& columnResizeCursor() -{ - static const Cursor c(PlatformCursor::typeColumnResize); - return c; -} - -const Cursor& rowResizeCursor() -{ - static const Cursor c(PlatformCursor::typeRowResize); - return c; -} - -const Cursor& middlePanningCursor() -{ - static const Cursor c(PlatformCursor::typeMiddlePanning); - return c; -} - -const Cursor& eastPanningCursor() -{ - static const Cursor c(PlatformCursor::typeEastPanning); - return c; -} - -const Cursor& northPanningCursor() -{ - static const Cursor c(PlatformCursor::typeNorthPanning); - return c; -} - -const Cursor& northEastPanningCursor() -{ - static const Cursor c(PlatformCursor::typeNorthEastPanning); - return c; -} - -const Cursor& northWestPanningCursor() -{ - static const Cursor c(PlatformCursor::typeNorthWestPanning); - return c; -} - -const Cursor& southPanningCursor() -{ - static const Cursor c(PlatformCursor::typeSouthPanning); - return c; -} - -const Cursor& southEastPanningCursor() -{ - static const Cursor c(PlatformCursor::typeSouthEastPanning); - return c; -} - -const Cursor& southWestPanningCursor() -{ - static const Cursor c(PlatformCursor::typeSouthWestPanning); - return c; -} - -const Cursor& westPanningCursor() -{ - static const Cursor c(PlatformCursor::typeWestPanning); - return c; -} - -const Cursor& moveCursor() -{ - static const Cursor c(PlatformCursor::typeMove); - return c; -} - -const Cursor& verticalTextCursor() -{ - static const Cursor c(PlatformCursor::typeVerticalText); - return c; -} - -const Cursor& cellCursor() -{ - static const Cursor c(PlatformCursor::typeCell); - return c; -} - -const Cursor& contextMenuCursor() -{ - static const Cursor c(PlatformCursor::typeContextMenu); - return c; -} - -const Cursor& aliasCursor() -{ - static const Cursor c(PlatformCursor::typeAlias); - return c; -} - -const Cursor& progressCursor() -{ - static const Cursor c(PlatformCursor::typeProgress); - return c; -} - -const Cursor& noDropCursor() -{ - static const Cursor c(PlatformCursor::typeNoDrop); - return c; -} - -const Cursor& copyCursor() -{ - static const Cursor c(PlatformCursor::typeCopy); - return c; -} - -const Cursor& noneCursor() -{ - static const Cursor c(PlatformCursor::typeNone); - return c; -} - -const Cursor& notAllowedCursor() -{ - static const Cursor c(PlatformCursor::typeNotAllowed); - return c; -} - -const Cursor& zoomInCursor() -{ - static const Cursor c(PlatformCursor::typeZoomIn); - return c; -} - -const Cursor& zoomOutCursor() -{ - static const Cursor c(PlatformCursor::typeZoomOut); - return c; -} - -const Cursor& grabCursor() -{ - return pointerCursor(); -} - -const Cursor& grabbingCursor() -{ - return pointerCursor(); -} - -} diff --git a/webkit/port/platform/chromium/DragDataChromium.cpp b/webkit/port/platform/chromium/DragDataChromium.cpp deleted file mode 100644 index d615559..0000000 --- a/webkit/port/platform/chromium/DragDataChromium.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (C) 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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. - */ - -// Modified from Apple's version to not directly call any windows methods as -// they may not be available to us in the multiprocess - -#include "config.h" -#include "DragData.h" - -#include "ChromiumDataObject.h" -#include "Clipboard.h" -#include "ClipboardChromium.h" -#include "DocumentFragment.h" -#include "KURL.h" -#include "PlatformString.h" -#include "markup.h" - -namespace { - -bool containsHTML(const WebCore::ChromiumDataObject* drop_data) { - return drop_data->text_html.length() > 0; -} - -} - -namespace WebCore { - -PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const -{ - RefPtr<ClipboardChromium> clipboard = ClipboardChromium::create(true, - m_platformDragData, policy); - - return clipboard.release(); -} - -bool DragData::containsURL() const -{ - return m_platformDragData->url.isValid(); -} - -String DragData::asURL(String* title) const -{ - if (!m_platformDragData->url.isValid()) - return String(); - - // |title| can be NULL - if (title) - *title = m_platformDragData->url_title; - return m_platformDragData->url.string(); -} - -bool DragData::containsFiles() const -{ - return !m_platformDragData->filenames.isEmpty(); -} - -void DragData::asFilenames(Vector<String>& result) const -{ - for (size_t i = 0; i < m_platformDragData->filenames.size(); ++i) - result.append(m_platformDragData->filenames[i]); -} - -bool DragData::containsPlainText() const -{ - return !m_platformDragData->plain_text.isEmpty(); -} - -String DragData::asPlainText() const -{ - return m_platformDragData->plain_text; -} - -bool DragData::containsColor() const -{ - return false; -} - -bool DragData::canSmartReplace() const -{ - // Mimic the situations in which mac allows drag&drop to do a smart replace. - // This is allowed whenever the drag data contains a 'range' (ie., - // ClipboardWin::writeRange is called). For example, dragging a link - // should not result in a space being added. - return !m_platformDragData->plain_text.isEmpty() && - !m_platformDragData->url.isValid(); -} - -bool DragData::containsCompatibleContent() const -{ - return containsPlainText() || containsURL() - || ::containsHTML(m_platformDragData) - || containsColor(); -} - -PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const -{ - /* - * Order is richest format first. On OSX this is: - * * Web Archive - * * Filenames - * * HTML - * * RTF - * * TIFF - * * PICT - */ - - if (containsFiles()) { - // TODO(tc): Implement this. Should be pretty simple to make some HTML - // and call createFragmentFromMarkup. - //if (RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(doc, - // ?, KURL())) - // return fragment; - } - - if (!m_platformDragData->text_html.isEmpty()) { - RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(doc, - m_platformDragData->text_html, m_platformDragData->html_base_url); - return fragment.release(); - } - - return 0; -} - -Color DragData::asColor() const -{ - return Color(); -} - -} diff --git a/webkit/port/platform/chromium/DragDataRef.h b/webkit/port/platform/chromium/DragDataRef.h deleted file mode 100644 index 4ddc1ac..0000000 --- a/webkit/port/platform/chromium/DragDataRef.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef DragDataRef_h -#define DragDataRef_h - -#include "ChromiumDataObject.h" - -namespace WebCore { - -typedef ChromiumDataObject* DragDataRef; - -} - -#endif diff --git a/webkit/port/platform/chromium/DragImageChromium.cpp b/webkit/port/platform/chromium/DragImageChromium.cpp deleted file mode 100644 index e74a204..0000000 --- a/webkit/port/platform/chromium/DragImageChromium.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "DragImage.h" - -#include "CachedImage.h" -#include "GraphicsContext.h" -#include "Image.h" - -#if PLATFORM(WIN_OS) -#include <windows.h> -#else -#include "NotImplemented.h" -#endif - -namespace WebCore { - -IntSize dragImageSize(DragImageRef image) -{ -// TODO(darin): DragImageRef should be changed to be a cross-platform -// container. However, it may still make sense for its contents to be -// platform-dependent. -#if PLATFORM(WIN_OS) - if (!image) - return IntSize(); - BITMAP b; - GetObject(image, sizeof(BITMAP), &b); - return IntSize(b.bmWidth, b.bmHeight); -#else - return IntSize(); -#endif -} - -void deleteDragImage(DragImageRef image) -{ -#if PLATFORM(WIN_OS) - if (image) - ::DeleteObject(image); -#else - notImplemented(); -#endif -} - -DragImageRef scaleDragImage(DragImageRef image, FloatSize scale) -{ - // FIXME - return 0; -} - -DragImageRef dissolveDragImageToFraction(DragImageRef image, float) -{ - //We don't do this on windows as the dragimage is blended by the OS - return image; -} - -DragImageRef createDragImageFromImage(Image* img) -{ - // FIXME - return 0; -} - -DragImageRef createDragImageIconForCachedImage(CachedImage*) -{ - //FIXME: Provide icon for image type <rdar://problem/5015949> - return 0; -} - -} diff --git a/webkit/port/platform/chromium/DragImageRef.h b/webkit/port/platform/chromium/DragImageRef.h deleted file mode 100644 index 6b7dcaf..0000000 --- a/webkit/port/platform/chromium/DragImageRef.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef DragImageRef_h__ -#define DragImageRef_h__ - -#include "config.h" - -#if PLATFORM(WIN_OS) -typedef struct HBITMAP__* HBITMAP; -#elif PLATFORM(DARWIN) -#if __OBJC__ -@class NSImage; -#else -class NSImage; -#endif -#endif - -namespace WebCore { - -#if PLATFORM(WIN_OS) -typedef HBITMAP DragImageRef; -#elif PLATFORM(DARWIN) -typedef NSImage* DragImageRef; -#else -// TODO(port): remove null port. -typedef void* DragImageRef; -#endif - -} - -#endif diff --git a/webkit/port/platform/chromium/EditorChromium.cpp b/webkit/port/platform/chromium/EditorChromium.cpp deleted file mode 100644 index 8636ed1..0000000 --- a/webkit/port/platform/chromium/EditorChromium.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "Editor.h" -#include "ChromiumDataObject.h" -#include "ClipboardChromium.h" - -namespace WebCore { - -PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy) -{ - RefPtr<ChromiumDataObject> dataObject = ChromiumDataObject::create(); - return ClipboardChromium::create(false, dataObject.get(), policy); -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/FileChooserChromium.cpp b/webkit/port/platform/chromium/FileChooserChromium.cpp deleted file mode 100644 index 2a80744..0000000 --- a/webkit/port/platform/chromium/FileChooserChromium.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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" - -#if COMPILER(MSVC) -__pragma(warning(push, 0)) -#endif -#include "ChromeClientChromium.h" -#include "Document.h" -#include "Frame.h" -#include "FileChooser.h" -#include "FileSystem.h" -#include "LocalizedStrings.h" -#include "NotImplemented.h" -#include "Page.h" -#include "StringTruncator.h" -#if COMPILER(MSVC) -__pragma(warning(pop)) -#endif - -namespace WebCore { - -String FileChooser::basenameForWidth(const Font& font, int width) const -{ - if (width <= 0) - return String(); - - String string; - if (!m_filenames.size()) - string = fileButtonNoFileSelectedLabel(); - else - string = pathGetFileName(m_filenames[0]); - - return StringTruncator::centerTruncate(string, static_cast<float>(width), font, false); -} - -} diff --git a/webkit/port/platform/chromium/FileSystemChromium.cpp b/webkit/port/platform/chromium/FileSystemChromium.cpp deleted file mode 100644 index 33b04cb..0000000 --- a/webkit/port/platform/chromium/FileSystemChromium.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "NotImplemented.h" -#include "PlatformString.h" - - -namespace WebCore { - -bool deleteFile(const String&) -{ - notImplemented(); - return false; -} - -bool deleteEmptyDirectory(const String&) -{ - notImplemented(); - return false; -} - -bool getFileSize(const String&, long long& result) -{ - notImplemented(); - return false; -} - -bool getFileModificationTime(const String&, time_t& result) -{ - notImplemented(); - return false; -} - -String directoryName(const String&) -{ - notImplemented(); - return String(); -} - -String pathByAppendingComponent(const String& path, const String& component) -{ - notImplemented(); - return String(); -} - -bool makeAllDirectories(const String& path) -{ - notImplemented(); - return false; -} - -bool fileExists(const String&) -{ - notImplemented(); - return false; -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/FileSystemChromiumLinux.cpp b/webkit/port/platform/chromium/FileSystemChromiumLinux.cpp deleted file mode 100644 index e8635dc..0000000 --- a/webkit/port/platform/chromium/FileSystemChromiumLinux.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "FileSystem.h" - -namespace WebCore { - -String pathGetFileName(const String& path) -{ - return path.substring(path.reverseFind('/') + 1); -} - -} diff --git a/webkit/port/platform/chromium/FileSystemChromiumMac.mm b/webkit/port/platform/chromium/FileSystemChromiumMac.mm deleted file mode 100644 index 7733999..0000000 --- a/webkit/port/platform/chromium/FileSystemChromiumMac.mm +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "FileSystem.h" - -#import <Foundation/NSFileManager.h> -#include "PlatformString.h" - -namespace WebCore { - -String pathGetFileName(const String& path) -{ - return [[NSFileManager defaultManager] displayNameAtPath:path]; -} - -} diff --git a/webkit/port/platform/chromium/FileSystemChromiumWin.cpp b/webkit/port/platform/chromium/FileSystemChromiumWin.cpp deleted file mode 100644 index 91486e8..0000000 --- a/webkit/port/platform/chromium/FileSystemChromiumWin.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "FileSystem.h" - -#include <windows.h> -#include <shlwapi.h> - -namespace WebCore { - -String pathGetFileName(const String& path) -{ - return String(PathFindFileName(String(path).charactersWithNullTermination())); -} - -} diff --git a/webkit/port/platform/chromium/FramelessScrollView.cpp b/webkit/port/platform/chromium/FramelessScrollView.cpp deleted file mode 100644 index 60d4375..0000000 --- a/webkit/port/platform/chromium/FramelessScrollView.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "FramelessScrollView.h" - -#include "FramelessScrollViewClient.h" - -namespace WebCore { - -FramelessScrollView::~FramelessScrollView() -{ - // Remove native scrollbars now before we lose the connection to the HostWindow. - setHasHorizontalScrollbar(false); - setHasVerticalScrollbar(false); -} - -void FramelessScrollView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) -{ - // Add in our offset within the ScrollView. - IntRect dirtyRect = rect; - dirtyRect.move(scrollbar->x(), scrollbar->y()); - invalidateRect(dirtyRect); -} - -bool FramelessScrollView::isActive() const -{ - // FIXME - return true; -} - -void FramelessScrollView::invalidateRect(const IntRect& rect) -{ - if (HostWindow* h = hostWindow()) - h->repaint(contentsToWindow(rect), true); -} - -HostWindow* FramelessScrollView::hostWindow() const -{ - return const_cast<FramelessScrollViewClient*>(m_client); -} - -IntRect FramelessScrollView::windowClipRect(bool clipToContents) const -{ - return contentsToWindow(visibleContentRect(!clipToContents)); -} - -void FramelessScrollView::paintContents(GraphicsContext*, const IntRect& damageRect) -{ -} - -void FramelessScrollView::contentsResized() -{ -} - -void FramelessScrollView::visibleContentsResized() -{ -} - -} diff --git a/webkit/port/platform/chromium/FramelessScrollView.h b/webkit/port/platform/chromium/FramelessScrollView.h deleted file mode 100644 index dd940a0..0000000 --- a/webkit/port/platform/chromium/FramelessScrollView.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef FramelessScrollView_h -#define FramelessScrollView_h - -#include "ScrollView.h" - -namespace WebCore { - class FramelessScrollViewClient; - class PlatformKeyboardEvent; - class PlatformMouseEvent; - class PlatformWheelEvent; - - // A FramelessScrollView is a ScrollView that can be used to render custom - // content, which does not have an associated Frame. - // - // TODO: It may be better to just develop a custom subclass of Widget that - // can have scroll bars for this instead of trying to reuse ScrollView. - // - class FramelessScrollView : public ScrollView { - public: - FramelessScrollView() : m_client(0) {} - ~FramelessScrollView(); - - FramelessScrollViewClient* client() const { return m_client; } - void setClient(FramelessScrollViewClient* client) { m_client = client; } - - // Event handlers that subclasses must implement. - virtual bool handleMouseDownEvent(const PlatformMouseEvent&) = 0; - virtual bool handleMouseMoveEvent(const PlatformMouseEvent&) = 0; - virtual bool handleMouseReleaseEvent(const PlatformMouseEvent&) = 0; - virtual bool handleWheelEvent(const PlatformWheelEvent&) = 0; - virtual bool handleKeyEvent(const PlatformKeyboardEvent&) = 0; - - // ScrollbarClient public methods: - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual bool isActive() const; - - // Widget public methods: - virtual void invalidateRect(const IntRect&); - - // ScrollView public methods: - virtual HostWindow* hostWindow() const; - virtual IntRect windowClipRect(bool clipToContents = true) const; - - protected: - // ScrollView protected methods: - virtual void paintContents(GraphicsContext*, const IntRect& damageRect); - virtual void contentsResized(); - virtual void visibleContentsResized(); - - private: - FramelessScrollViewClient* m_client; - }; -} - -#endif // FramelessScrollView_h diff --git a/webkit/port/platform/chromium/FramelessScrollViewClient.h b/webkit/port/platform/chromium/FramelessScrollViewClient.h deleted file mode 100644 index a237bce..0000000 --- a/webkit/port/platform/chromium/FramelessScrollViewClient.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. - -#ifndef FramelessScrollViewClient_h -#define FramelessScrollViewClient_h - -#include "HostWindow.h" - -namespace WebCore { - class FramelessScrollViewClient : public HostWindow { - public: - virtual void popupClosed(FramelessScrollView* popup_view) = 0; - }; -} - -#endif // FramelessScrollViewClient_h diff --git a/webkit/port/platform/chromium/KeyCodeConversion.h b/webkit/port/platform/chromium/KeyCodeConversion.h deleted file mode 100644 index b7f96d9..0000000 --- a/webkit/port/platform/chromium/KeyCodeConversion.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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. - */ - -namespace WebCore { - -int windowsKeyCodeForKeyEvent(unsigned int keycode); - -} diff --git a/webkit/port/platform/chromium/KeyCodeConversionGtk.cpp b/webkit/port/platform/chromium/KeyCodeConversionGtk.cpp deleted file mode 100644 index 4808d7f..0000000 --- a/webkit/port/platform/chromium/KeyCodeConversionGtk.cpp +++ /dev/null @@ -1,363 +0,0 @@ -// WindowsKeyCodeForKeyEvent is taken from -// WebKit/WebCore/platform/gtk/KeyEventGtk.cpp -/* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com - * Copyright (C) 2007 Holger Hans Peter Freyther - * Copyright (C) 2008 Collabora, Ltd. All rights reserved. - * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "KeyCodeConversion.h" -#include "KeyboardCodes.h" - -#include <gdk/gdkkeysyms.h> - -namespace WebCore { - -int windowsKeyCodeForKeyEvent(unsigned int keycode) -{ - switch (keycode) { - case GDK_KP_0: - return VKEY_NUMPAD0;// (60) Numeric keypad 0 key - case GDK_KP_1: - return VKEY_NUMPAD1;// (61) Numeric keypad 1 key - case GDK_KP_2: - return VKEY_NUMPAD2; // (62) Numeric keypad 2 key - case GDK_KP_3: - return VKEY_NUMPAD3; // (63) Numeric keypad 3 key - case GDK_KP_4: - return VKEY_NUMPAD4; // (64) Numeric keypad 4 key - case GDK_KP_5: - return VKEY_NUMPAD5; //(65) Numeric keypad 5 key - case GDK_KP_6: - return VKEY_NUMPAD6; // (66) Numeric keypad 6 key - case GDK_KP_7: - return VKEY_NUMPAD7; // (67) Numeric keypad 7 key - case GDK_KP_8: - return VKEY_NUMPAD8; // (68) Numeric keypad 8 key - case GDK_KP_9: - return VKEY_NUMPAD9; // (69) Numeric keypad 9 key - case GDK_KP_Multiply: - return VKEY_MULTIPLY; // (6A) Multiply key - case GDK_KP_Add: - return VKEY_ADD; // (6B) Add key - case GDK_KP_Subtract: - return VKEY_SUBTRACT; // (6D) Subtract key - case GDK_KP_Decimal: - return VKEY_DECIMAL; // (6E) Decimal key - case GDK_KP_Divide: - return VKEY_DIVIDE; // (6F) Divide key - - case GDK_BackSpace: - return VKEY_BACK; // (08) BACKSPACE key - case GDK_ISO_Left_Tab: - case GDK_3270_BackTab: - case GDK_Tab: - return VKEY_TAB; // (09) TAB key - case GDK_Clear: - return VKEY_CLEAR; // (0C) CLEAR key - case GDK_ISO_Enter: - case GDK_KP_Enter: - case GDK_Return: - return VKEY_RETURN; //(0D) Return key - case GDK_Shift_L: - case GDK_Shift_R: - return VKEY_SHIFT; // (10) SHIFT key - case GDK_Control_L: - case GDK_Control_R: - return VKEY_CONTROL; // (11) CTRL key - case GDK_Menu: - case GDK_Alt_L: - case GDK_Alt_R: - return VKEY_MENU; // (12) ALT key - - case GDK_Pause: - return VKEY_PAUSE; // (13) PAUSE key - case GDK_Caps_Lock: - return VKEY_CAPITAL; // (14) CAPS LOCK key - case GDK_Kana_Lock: - case GDK_Kana_Shift: - return VKEY_KANA; // (15) Input Method Editor (IME) Kana mode - case GDK_Hangul: - return VKEY_HANGUL; // VKEY_HANGUL (15) IME Hangul mode - // VKEY_JUNJA (17) IME Junja mode - // VKEY_FINAL (18) IME final mode - case GDK_Hangul_Hanja: - return VKEY_HANJA; // (19) IME Hanja mode - case GDK_Kanji: - return VKEY_KANJI; // (19) IME Kanji mode - case GDK_Escape: - return VKEY_ESCAPE; // (1B) ESC key - // VKEY_CONVERT (1C) IME convert - // VKEY_NONCONVERT (1D) IME nonconvert - // VKEY_ACCEPT (1E) IME accept - // VKEY_MODECHANGE (1F) IME mode change request - case GDK_space: - return VKEY_SPACE; // (20) SPACEBAR - case GDK_Page_Up: - return VKEY_PRIOR; // (21) PAGE UP key - case GDK_Page_Down: - return VKEY_NEXT; // (22) PAGE DOWN key - case GDK_End: - return VKEY_END; // (23) END key - case GDK_Home: - return VKEY_HOME; // (24) HOME key - case GDK_Left: - return VKEY_LEFT; // (25) LEFT ARROW key - case GDK_Up: - return VKEY_UP; // (26) UP ARROW key - case GDK_Right: - return VKEY_RIGHT; // (27) RIGHT ARROW key - case GDK_Down: - return VKEY_DOWN; // (28) DOWN ARROW key - case GDK_Select: - return VKEY_SELECT; // (29) SELECT key - case GDK_Print: - return VKEY_PRINT; // (2A) PRINT key - case GDK_Execute: - return VKEY_EXECUTE;// (2B) EXECUTE key - //dunno on this - //case GDK_PrintScreen: - // return VKEY_SNAPSHOT; // (2C) PRINT SCREEN key - case GDK_Insert: - return VKEY_INSERT; // (2D) INS key - case GDK_Delete: - return VKEY_DELETE; // (2E) DEL key - case GDK_Help: - return VKEY_HELP; // (2F) HELP key - case GDK_0: - case GDK_parenleft: - return VKEY_0; // (30) 0) key - case GDK_1: - return VKEY_1; // (31) 1 ! key - case GDK_2: - case GDK_at: - return VKEY_2; // (32) 2 & key - case GDK_3: - case GDK_numbersign: - return VKEY_3; //case '3': case '#'; - case GDK_4: - case GDK_dollar: // (34) 4 key '$'; - return VKEY_4; - case GDK_5: - case GDK_percent: - return VKEY_5; // (35) 5 key '%' - case GDK_6: - case GDK_asciicircum: - return VKEY_6; // (36) 6 key '^' - case GDK_7: - case GDK_ampersand: - return VKEY_7; // (37) 7 key case '&' - case GDK_8: - case GDK_asterisk: - return VKEY_8; // (38) 8 key '*' - case GDK_9: - case GDK_parenright: - return VKEY_9; // (39) 9 key '(' - case GDK_a: - case GDK_A: - return VKEY_A; // (41) A key case 'a': case 'A': return 0x41; - case GDK_b: - case GDK_B: - return VKEY_B; // (42) B key case 'b': case 'B': return 0x42; - case GDK_c: - case GDK_C: - return VKEY_C; // (43) C key case 'c': case 'C': return 0x43; - case GDK_d: - case GDK_D: - return VKEY_D; // (44) D key case 'd': case 'D': return 0x44; - case GDK_e: - case GDK_E: - return VKEY_E; // (45) E key case 'e': case 'E': return 0x45; - case GDK_f: - case GDK_F: - return VKEY_F; // (46) F key case 'f': case 'F': return 0x46; - case GDK_g: - case GDK_G: - return VKEY_G; // (47) G key case 'g': case 'G': return 0x47; - case GDK_h: - case GDK_H: - return VKEY_H; // (48) H key case 'h': case 'H': return 0x48; - case GDK_i: - case GDK_I: - return VKEY_I; // (49) I key case 'i': case 'I': return 0x49; - case GDK_j: - case GDK_J: - return VKEY_J; // (4A) J key case 'j': case 'J': return 0x4A; - case GDK_k: - case GDK_K: - return VKEY_K; // (4B) K key case 'k': case 'K': return 0x4B; - case GDK_l: - case GDK_L: - return VKEY_L; // (4C) L key case 'l': case 'L': return 0x4C; - case GDK_m: - case GDK_M: - return VKEY_M; // (4D) M key case 'm': case 'M': return 0x4D; - case GDK_n: - case GDK_N: - return VKEY_N; // (4E) N key case 'n': case 'N': return 0x4E; - case GDK_o: - case GDK_O: - return VKEY_O; // (4F) O key case 'o': case 'O': return 0x4F; - case GDK_p: - case GDK_P: - return VKEY_P; // (50) P key case 'p': case 'P': return 0x50; - case GDK_q: - case GDK_Q: - return VKEY_Q; // (51) Q key case 'q': case 'Q': return 0x51; - case GDK_r: - case GDK_R: - return VKEY_R; // (52) R key case 'r': case 'R': return 0x52; - case GDK_s: - case GDK_S: - return VKEY_S; // (53) S key case 's': case 'S': return 0x53; - case GDK_t: - case GDK_T: - return VKEY_T; // (54) T key case 't': case 'T': return 0x54; - case GDK_u: - case GDK_U: - return VKEY_U; // (55) U key case 'u': case 'U': return 0x55; - case GDK_v: - case GDK_V: - return VKEY_V; // (56) V key case 'v': case 'V': return 0x56; - case GDK_w: - case GDK_W: - return VKEY_W; // (57) W key case 'w': case 'W': return 0x57; - case GDK_x: - case GDK_X: - return VKEY_X; // (58) X key case 'x': case 'X': return 0x58; - case GDK_y: - case GDK_Y: - return VKEY_Y; // (59) Y key case 'y': case 'Y': return 0x59; - case GDK_z: - case GDK_Z: - return VKEY_Z; // (5A) Z key case 'z': case 'Z': return 0x5A; - case GDK_Meta_L: - return VKEY_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard) - case GDK_Meta_R: - return VKEY_RWIN; // (5C) Right Windows key (Natural keyboard) - // VKEY_APPS (5D) Applications key (Natural keyboard) - // VKEY_SLEEP (5F) Computer Sleep key - // VKEY_SEPARATOR (6C) Separator key - // VKEY_SUBTRACT (6D) Subtract key - // VKEY_DECIMAL (6E) Decimal key - // VKEY_DIVIDE (6F) Divide key - // handled by key code above - - case GDK_Num_Lock: - return VKEY_NUMLOCK; // (90) NUM LOCK key - - case GDK_Scroll_Lock: - return VKEY_SCROLL; // (91) SCROLL LOCK key - - // VKEY_LSHIFT (A0) Left SHIFT key - // VKEY_RSHIFT (A1) Right SHIFT key - // VKEY_LCONTROL (A2) Left CONTROL key - // VKEY_RCONTROL (A3) Right CONTROL key - // VKEY_LMENU (A4) Left MENU key - // VKEY_RMENU (A5) Right MENU key - // VKEY_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key - // VKEY_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key - // VKEY_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key - // VKEY_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key - // VKEY_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key - // VKEY_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key - // VKEY_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key - // VKEY_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key - // VKEY_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key - // VKEY_VOLUME_UP (AF) Windows 2000/XP: Volume Up key - // VKEY_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key - // VKEY_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key - // VKEY_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key - // VKEY_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key - // VKEY_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key - // VKEY_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key - // VKEY_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key - // VKEY_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key - - // VKEY_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key - case GDK_semicolon: - case GDK_colon: - return VKEY_OEM_1; //case ';': case ':': return 0xBA; - // VKEY_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key - case GDK_plus: - case GDK_equal: - return VKEY_OEM_PLUS; //case '=': case '+': return 0xBB; - // VKEY_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key - case GDK_comma: - case GDK_less: - return VKEY_OEM_COMMA; //case ',': case '<': return 0xBC; - // VKEY_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key - case GDK_minus: - case GDK_underscore: - return VKEY_OEM_MINUS; //case '-': case '_': return 0xBD; - // VKEY_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key - case GDK_period: - case GDK_greater: - return VKEY_OEM_PERIOD; //case '.': case '>': return 0xBE; - // VKEY_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key - case GDK_slash: - case GDK_question: - return VKEY_OEM_2; //case '/': case '?': return 0xBF; - // VKEY_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key - case GDK_asciitilde: - case GDK_quoteleft: - return VKEY_OEM_3; //case '`': case '~': return 0xC0; - // VKEY_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key - case GDK_bracketleft: - case GDK_braceleft: - return VKEY_OEM_4; //case '[': case '{': return 0xDB; - // VKEY_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key - case GDK_backslash: - case GDK_bar: - return VKEY_OEM_5; //case '\\': case '|': return 0xDC; - // VKEY_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key - case GDK_bracketright: - case GDK_braceright: - return VKEY_OEM_6; // case ']': case '}': return 0xDD; - // VKEY_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key - case GDK_quoteright: - case GDK_quotedbl: - return VKEY_OEM_7; // case '\'': case '"': return 0xDE; - // VKEY_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. - // VKEY_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard - // VKEY_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key - // VKEY_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VKEY_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP - // VKEY_ATTN (F6) Attn key - // VKEY_CRSEL (F7) CrSel key - // VKEY_EXSEL (F8) ExSel key - // VKEY_EREOF (F9) Erase EOF key - // VKEY_PLAY (FA) Play key - // VKEY_ZOOM (FB) Zoom key - // VKEY_NONAME (FC) Reserved for future use - // VKEY_PA1 (FD) PA1 key - // VKEY_OEM_CLEAR (FE) Clear key - default: - return 0; - } - -} - -} diff --git a/webkit/port/platform/chromium/KeyboardCodes.h b/webkit/port/platform/chromium/KeyboardCodes.h deleted file mode 100644 index 3f4fa7d..0000000 --- a/webkit/port/platform/chromium/KeyboardCodes.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef KeyboardCodes_h -#define KeyboardCodes_h - -#include "config.h" - -#if PLATFORM(WIN_OS) -#include "KeyboardCodesWin.h" -#else -#include "KeyboardCodesPosix.h" -#endif - -#endif diff --git a/webkit/port/platform/chromium/KeyboardCodesPosix.h b/webkit/port/platform/chromium/KeyboardCodesPosix.h deleted file mode 100644 index 14344bf..0000000 --- a/webkit/port/platform/chromium/KeyboardCodesPosix.h +++ /dev/null @@ -1,547 +0,0 @@ -/* - * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com - * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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. - */ - -#ifndef KeyboardCodesPosix_h -#define KeyboardCodesPosix_h - -namespace WebCore { - -enum { - - // VKEY_LBUTTON (01) Left mouse button - // VKEY_RBUTTON (02) Right mouse button - // VKEY_CANCEL (03) Control-break processing - // VKEY_MBUTTON (04) Middle mouse button (three-button mouse) - // VKEY_XBUTTON1 (05) - // VKEY_XBUTTON2 (06) - - // VKEY_BACK (08) BACKSPACE key - VKEY_BACK = 0x08, - - // VKEY_TAB (09) TAB key - VKEY_TAB = 0x09, - - // VKEY_CLEAR (0C) CLEAR key - VKEY_CLEAR = 0x0C, - - // VKEY_RETURN (0D) - VKEY_RETURN = 0x0D, - - // VKEY_SHIFT (10) SHIFT key - VKEY_SHIFT = 0x10, - - // VKEY_CONTROL (11) CTRL key - VKEY_CONTROL = 0x11, - - // VKEY_MENU (12) ALT key - VKEY_MENU = 0x12, - - // VKEY_PAUSE (13) PAUSE key - VKEY_PAUSE = 0x13, - - // VKEY_CAPITAL (14) CAPS LOCK key - VKEY_CAPITAL = 0x14, - - // VKEY_KANA (15) Input Method Editor (IME) Kana mode - VKEY_KANA = 0x15, - - // VKEY_HANGUEL (15) IME Hanguel mode (maintained for compatibility, use VKEY_HANGUL) - // VKEY_HANGUL (15) IME Hangul mode - VKEY_HANGUL = 0x15, - - // VKEY_JUNJA (17) IME Junja mode - VKEY_JUNJA = 0x17, - - // VKEY_FINAL (18) IME final mode - VKEY_FINAL = 0x18, - - // VKEY_HANJA (19) IME Hanja mode - VKEY_HANJA = 0x19, - - // VKEY_KANJI (19) IME Kanji mode - VKEY_KANJI = 0x19, - - // VKEY_ESCAPE (1B) ESC key - VKEY_ESCAPE = 0x1B, - - // VKEY_CONVERT (1C) IME convert - VKEY_CONVERT = 0x1C, - - // VKEY_NONCONVERT (1D) IME nonconvert - VKEY_NONCONVERT = 0x1D, - - // VKEY_ACCEPT (1E) IME accept - VKEY_ACCEPT = 0x1E, - - // VKEY_MODECHANGE (1F) IME mode change request - VKEY_MODECHANGE = 0x1F, - - // VKEY_SPACE (20) SPACEBAR - VKEY_SPACE = 0x20, - - // VKEY_PRIOR (21) PAGE UP key - VKEY_PRIOR = 0x21, - - // VKEY_NEXT (22) PAGE DOWN key - VKEY_NEXT = 0x22, - - // VKEY_END (23) END key - VKEY_END = 0x23, - - // VKEY_HOME (24) HOME key - VKEY_HOME = 0x24, - - // VKEY_LEFT (25) LEFT ARROW key - VKEY_LEFT = 0x25, - - // VKEY_UP (26) UP ARROW key - VKEY_UP = 0x26, - - // VKEY_RIGHT (27) RIGHT ARROW key - VKEY_RIGHT = 0x27, - - // VKEY_DOWN (28) DOWN ARROW key - VKEY_DOWN = 0x28, - - // VKEY_SELECT (29) SELECT key - VKEY_SELECT = 0x29, - - // VKEY_PRINT (2A) PRINT key - VKEY_PRINT = 0x2A, - - // VKEY_EXECUTE (2B) EXECUTE key - VKEY_EXECUTE = 0x2B, - - // VKEY_SNAPSHOT (2C) PRINT SCREEN key - VKEY_SNAPSHOT = 0x2C, - - // VKEY_INSERT (2D) INS key - VKEY_INSERT = 0x2D, - - // VKEY_DELETE (2E) DEL key - VKEY_DELETE = 0x2E, - - // VKEY_HELP (2F) HELP key - VKEY_HELP = 0x2F, - - // (30) 0 key - VKEY_0 = 0x30, - - // (31) 1 key - VKEY_1 = 0x31, - - // (32) 2 key - VKEY_2 = 0x32, - - // (33) 3 key - VKEY_3 = 0x33, - - // (34) 4 key - VKEY_4 = 0x34, - - // (35) 5 key, - - VKEY_5 = 0x35, - - // (36) 6 key - VKEY_6 = 0x36, - - // (37) 7 key - VKEY_7 = 0x37, - - // (38) 8 key - VKEY_8 = 0x38, - - // (39) 9 key - VKEY_9 = 0x39, - - // (41) A key - VKEY_A = 0x41, - - // (42) B key - VKEY_B = 0x42, - - // (43) C key - VKEY_C = 0x43, - - // (44) D key - VKEY_D = 0x44, - - // (45) E key - VKEY_E = 0x45, - - // (46) F key - VKEY_F = 0x46, - - // (47) G key - VKEY_G = 0x47, - - // (48) H key - VKEY_H = 0x48, - - // (49) I key - VKEY_I = 0x49, - - // (4A) J key - VKEY_J = 0x4A, - - // (4B) K key - VKEY_K = 0x4B, - - // (4C) L key - VKEY_L = 0x4C, - - // (4D) M key - VKEY_M = 0x4D, - - // (4E) N key - VKEY_N = 0x4E, - - // (4F) O key - VKEY_O = 0x4F, - - // (50) P key - VKEY_P = 0x50, - - // (51) Q key - VKEY_Q = 0x51, - - // (52) R key - VKEY_R = 0x52, - - // (53) S key - VKEY_S = 0x53, - - // (54) T key - VKEY_T = 0x54, - - // (55) U key - VKEY_U = 0x55, - - // (56) V key - VKEY_V = 0x56, - - // (57) W key - VKEY_W = 0x57, - - // (58) X key - VKEY_X = 0x58, - - // (59) Y key - VKEY_Y = 0x59, - - // (5A) Z key - VKEY_Z = 0x5A, - - // VKEY_LWIN (5B) Left Windows key (Microsoft Natural keyboard) - VKEY_LWIN = 0x5B, - - // VKEY_RWIN (5C) Right Windows key (Natural keyboard) - VKEY_RWIN = 0x5C, - - // VKEY_APPS (5D) Applications key (Natural keyboard) - VKEY_APPS = 0x5D, - - // VKEY_SLEEP (5F) Computer Sleep key - VKEY_SLEEP = 0x5F, - - // VKEY_NUMPAD0 (60) Numeric keypad 0 key - VKEY_NUMPAD0 = 0x60, - - // VKEY_NUMPAD1 (61) Numeric keypad 1 key - VKEY_NUMPAD1 = 0x61, - - // VKEY_NUMPAD2 (62) Numeric keypad 2 key - VKEY_NUMPAD2 = 0x62, - - // VKEY_NUMPAD3 (63) Numeric keypad 3 key - VKEY_NUMPAD3 = 0x63, - - // VKEY_NUMPAD4 (64) Numeric keypad 4 key - VKEY_NUMPAD4 = 0x64, - - // VKEY_NUMPAD5 (65) Numeric keypad 5 key - VKEY_NUMPAD5 = 0x65, - - // VKEY_NUMPAD6 (66) Numeric keypad 6 key - VKEY_NUMPAD6 = 0x66, - - // VKEY_NUMPAD7 (67) Numeric keypad 7 key - VKEY_NUMPAD7 = 0x67, - - // VKEY_NUMPAD8 (68) Numeric keypad 8 key - VKEY_NUMPAD8 = 0x68, - - // VKEY_NUMPAD9 (69) Numeric keypad 9 key - VKEY_NUMPAD9 = 0x69, - - // VKEY_MULTIPLY (6A) Multiply key - VKEY_MULTIPLY = 0x6A, - - // VKEY_ADD (6B) Add key - VKEY_ADD = 0x6B, - - // VKEY_SEPARATOR (6C) Separator key - VKEY_SEPARATOR = 0x6C, - - // VKEY_SUBTRACT (6D) Subtract key - VKEY_SUBTRACT = 0x6D, - - // VKEY_DECIMAL (6E) Decimal key - VKEY_DECIMAL = 0x6E, - - // VKEY_DIVIDE (6F) Divide key - VKEY_DIVIDE = 0x6F, - - // VKEY_F1 (70) F1 key - VKEY_F1 = 0x70, - - // VKEY_F2 (71) F2 key - VKEY_F2 = 0x71, - - // VKEY_F3 (72) F3 key - VKEY_F3 = 0x72, - - // VKEY_F4 (73) F4 key - VKEY_F4 = 0x73, - - // VKEY_F5 (74) F5 key - VKEY_F5 = 0x74, - - // VKEY_F6 (75) F6 key - VKEY_F6 = 0x75, - - // VKEY_F7 (76) F7 key - VKEY_F7 = 0x76, - - // VKEY_F8 (77) F8 key - VKEY_F8 = 0x77, - - // VKEY_F9 (78) F9 key - VKEY_F9 = 0x78, - - // VKEY_F10 (79) F10 key - VKEY_F10 = 0x79, - - // VKEY_F11 (7A) F11 key - VKEY_F11 = 0x7A, - - // VKEY_F12 (7B) F12 key - VKEY_F12 = 0x7B, - - // VKEY_F13 (7C) F13 key - VKEY_F13 = 0x7C, - - // VKEY_F14 (7D) F14 key - VKEY_F14 = 0x7D, - - // VKEY_F15 (7E) F15 key - VKEY_F15 = 0x7E, - - // VKEY_F16 (7F) F16 key - VKEY_F16 = 0x7F, - - // VKEY_F17 (80H) F17 key - VKEY_F17 = 0x80, - - // VKEY_F18 (81H) F18 key - VKEY_F18 = 0x81, - - // VKEY_F19 (82H) F19 key - VKEY_F19 = 0x82, - - // VKEY_F20 (83H) F20 key - VKEY_F20 = 0x83, - - // VKEY_F21 (84H) F21 key - VKEY_F21 = 0x84, - - // VKEY_F22 (85H) F22 key - VKEY_F22 = 0x85, - - // VKEY_F23 (86H) F23 key - VKEY_F23 = 0x86, - - // VKEY_F24 (87H) F24 key - VKEY_F24 = 0x87, - - // VKEY_NUMLOCK (90) NUM LOCK key - VKEY_NUMLOCK = 0x90, - - // VKEY_SCROLL (91) SCROLL LOCK key - VKEY_SCROLL = 0x91, - - // VKEY_LSHIFT (A0) Left SHIFT key - VKEY_LSHIFT = 0xA0, - - // VKEY_RSHIFT (A1) Right SHIFT key - VKEY_RSHIFT = 0xA1, - - // VKEY_LCONTROL (A2) Left CONTROL key - VKEY_LCONTROL = 0xA2, - - // VKEY_RCONTROL (A3) Right CONTROL key - VKEY_RCONTROL = 0xA3, - - // VKEY_LMENU (A4) Left MENU key - VKEY_LMENU = 0xA4, - - // VKEY_RMENU (A5) Right MENU key - VKEY_RMENU = 0xA5, - - // VKEY_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key - VKEY_BROWSER_BACK = 0xA6, - - // VKEY_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key - VKEY_BROWSER_FORWARD = 0xA7, - - // VKEY_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key - VKEY_BROWSER_REFRESH = 0xA8, - - // VKEY_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key - VKEY_BROWSER_STOP = 0xA9, - - // VKEY_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key - VKEY_BROWSER_SEARCH = 0xAA, - - // VKEY_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key - VKEY_BROWSER_FAVORITES = 0xAB, - - // VKEY_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key - VKEY_BROWSER_HOME = 0xAC, - - // VKEY_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key - VKEY_VOLUME_MUTE = 0xAD, - - // VKEY_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key - VKEY_VOLUME_DOWN = 0xAE, - - // VKEY_VOLUME_UP (AF) Windows 2000/XP: Volume Up key - VKEY_VOLUME_UP = 0xAF, - - // VKEY_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key - VKEY_MEDIA_NEXT_TRACK = 0xB0, - - // VKEY_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key - VKEY_MEDIA_PREV_TRACK = 0xB1, - - // VKEY_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key - VKEY_MEDIA_STOP = 0xB2, - - // VKEY_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key - VKEY_MEDIA_PLAY_PAUSE = 0xB3, - - // VKEY_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key - VKEY_MEDIA_LAUNCH_MAIL = 0xB4, - - // VKEY_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key - VKEY_MEDIA_LAUNCH_MEDIA_SELECT = 0xB5, - - // VKEY_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key - VKEY_MEDIA_LAUNCH_APP1 = 0xB6, - - // VKEY_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key - VKEY_MEDIA_LAUNCH_APP2 = 0xB7, - - // VKEY_OEM_1 (BA) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ',:' key - VKEY_OEM_1 = 0xBA, - - // VKEY_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key - VKEY_OEM_PLUS = 0xBB, - - // VKEY_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key - VKEY_OEM_COMMA = 0xBC, - - // VKEY_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key - VKEY_OEM_MINUS = 0xBD, - - // VKEY_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key - VKEY_OEM_PERIOD = 0xBE, - - // VKEY_OEM_2 (BF) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key - VKEY_OEM_2 = 0xBF, - - // VKEY_OEM_3 (C0) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key - VKEY_OEM_3 = 0xC0, - - // VKEY_OEM_4 (DB) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key - VKEY_OEM_4 = 0xDB, - - // VKEY_OEM_5 (DC) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key - VKEY_OEM_5 = 0xDC, - - // VKEY_OEM_6 (DD) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key - VKEY_OEM_6 = 0xDD, - - // VKEY_OEM_7 (DE) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key - VKEY_OEM_7 = 0xDE, - - // VKEY_OEM_8 (DF) Used for miscellaneous characters, it can vary by keyboard. - VKEY_OEM_8 = 0xDF, - - // VKEY_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard - VKEY_OEM_102 = 0xE2, - - // VKEY_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key - VKEY_PROCESSKEY = 0xE5, - - // VKEY_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VKEY_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP - VKEY_PACKET = 0xE7, - - // VKEY_ATTN (F6) Attn key - VKEY_ATTN = 0xF6, - - // VKEY_CRSEL (F7) CrSel key - VKEY_CRSEL = 0xF7, - - // VKEY_EXSEL (F8) ExSel key - VKEY_EXSEL = 0xF8, - - // VKEY_EREOF (F9) Erase EOF key - VKEY_EREOF = 0xF9, - - // VKEY_PLAY (FA) Play key - VKEY_PLAY = 0xFA, - - // VKEY_ZOOM (FB) Zoom key - VKEY_ZOOM = 0xFB, - - // VKEY_NONAME (FC) Reserved for future use - VKEY_NONAME = 0xFC, - - // VKEY_PA1 (FD) PA1 key - VKEY_PA1 = 0xFD, - - // VKEY_OEM_CLEAR (FE) Clear key - VKEY_OEM_CLEAR = 0xFE, - - VKEY_UNKNOWN = 0 - -}; - -} - -#endif diff --git a/webkit/port/platform/chromium/KeyboardCodesWin.h b/webkit/port/platform/chromium/KeyboardCodesWin.h deleted file mode 100644 index e23fadc..0000000 --- a/webkit/port/platform/chromium/KeyboardCodesWin.h +++ /dev/null @@ -1,552 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef KeyboardCodesWin_h -#define KeyboardCodesWin_h - -#include <windows.h> - -namespace WebCore { - -enum { - - // VKEY_LBUTTON (01) Left mouse button - // VKEY_RBUTTON (02) Right mouse button - // VKEY_CANCEL (03) Control-break processing - // VKEY_MBUTTON (04) Middle mouse button (three-button mouse) - // VKEY_XBUTTON1 (05) - // VKEY_XBUTTON2 (06) - - // VKEY_BACK (08) BACKSPACE key - VKEY_BACK = VK_BACK, - - // VKEY_TAB (09) TAB key - VKEY_TAB = VK_TAB, - - // VKEY_CLEAR (0C) CLEAR key - VKEY_CLEAR = VK_CLEAR, - - // VKEY_RETURN (0D) - VKEY_RETURN = VK_RETURN, - - // VKEY_SHIFT (10) SHIFT key - VKEY_SHIFT = VK_SHIFT, - - // VKEY_CONTROL (11) CTRL key - VKEY_CONTROL = VK_CONTROL, - - // VKEY_MENU (12) ALT key - VKEY_MENU = VK_MENU, - - // VKEY_PAUSE (13) PAUSE key - VKEY_PAUSE = VK_PAUSE, - - // VKEY_CAPITAL (14) CAPS LOCK key - VKEY_CAPITAL = VK_CAPITAL, - - // VKEY_KANA (15) Input Method Editor (IME) Kana mode - VKEY_KANA = VK_KANA, - - // VKEY_HANGUEL (15) IME Hanguel mode (maintained for compatibility, use VKEY_HANGUL) - // VKEY_HANGUL (15) IME Hangul mode - VKEY_HANGUL = VK_HANGUL, - - // VKEY_JUNJA (17) IME Junja mode - VKEY_JUNJA = VK_JUNJA, - - // VKEY_FINAL (18) IME final mode - VKEY_FINAL = VK_FINAL, - - // VKEY_HANJA (19) IME Hanja mode - VKEY_HANJA = VK_HANJA, - - // VKEY_KANJI (19) IME Kanji mode - VKEY_KANJI = VK_KANJI, - - // VKEY_ESCAPE (1B) ESC key - VKEY_ESCAPE = VK_ESCAPE, - - // VKEY_CONVERT (1C) IME convert - VKEY_CONVERT = VK_CONVERT, - - // VKEY_NONCONVERT (1D) IME nonconvert - VKEY_NONCONVERT = VK_NONCONVERT, - - // VKEY_ACCEPT (1E) IME accept - VKEY_ACCEPT = VK_ACCEPT, - - // VKEY_MODECHANGE (1F) IME mode change request - VKEY_MODECHANGE = VK_MODECHANGE, - - // VKEY_SPACE (20) SPACEBAR - VKEY_SPACE = VK_SPACE, - - // VKEY_PRIOR (21) PAGE UP key - VKEY_PRIOR = VK_PRIOR, - - // VKEY_NEXT (22) PAGE DOWN key - VKEY_NEXT = VK_NEXT, - - // VKEY_END (23) END key - VKEY_END = VK_END, - - // VKEY_HOME (24) HOME key - VKEY_HOME = VK_HOME, - - // VKEY_LEFT (25) LEFT ARROW key - VKEY_LEFT = VK_LEFT, - - // VKEY_UP (26) UP ARROW key - VKEY_UP = VK_UP, - - // VKEY_RIGHT (27) RIGHT ARROW key - VKEY_RIGHT = VK_RIGHT, - - // VKEY_DOWN (28) DOWN ARROW key - VKEY_DOWN = VK_DOWN, - - // VKEY_SELECT (29) SELECT key - VKEY_SELECT = VK_SELECT, - - // VKEY_PRINT (2A) PRINT key - VKEY_PRINT = VK_PRINT, - - // VKEY_EXECUTE (2B) EXECUTE key - VKEY_EXECUTE = VK_EXECUTE, - - // VKEY_SNAPSHOT (2C) PRINT SCREEN key - VKEY_SNAPSHOT = VK_SNAPSHOT, - - // VKEY_INSERT (2D) INS key - VKEY_INSERT = VK_INSERT, - - // VKEY_DELETE (2E) DEL key - VKEY_DELETE = VK_DELETE, - - // VKEY_HELP (2F) HELP key - VKEY_HELP = VK_HELP, - - // (30) 0 key - VKEY_0 = '0', - - // (31) 1 key - VKEY_1 = '1', - - // (32) 2 key - VKEY_2 = '2', - - // (33) 3 key - VKEY_3 = '3', - - // (34) 4 key - VKEY_4 = '4', - - // (35) 5 key, - - VKEY_5 = '5', - - // (36) 6 key - VKEY_6 = '6', - - // (37) 7 key - VKEY_7 = '7', - - // (38) 8 key - VKEY_8 = '8', - - // (39) 9 key - VKEY_9 = '9', - - // (41) A key - VKEY_A = 'A', - - // (42) B key - VKEY_B = 'B', - - // (43) C key - VKEY_C = 'C', - - // (44) D key - VKEY_D = 'D', - - // (45) E key - VKEY_E = 'E', - - // (46) F key - VKEY_F = 'F', - - // (47) G key - VKEY_G = 'G', - - // (48) H key - VKEY_H = 'H', - - // (49) I key - VKEY_I = 'I', - - // (4A) J key - VKEY_J = 'J', - - // (4B) K key - VKEY_K = 'K', - - // (4C) L key - VKEY_L = 'L', - - // (4D) M key - VKEY_M = 'M', - - // (4E) N key - VKEY_N = 'N', - - // (4F) O key - VKEY_O = 'O', - - // (50) P key - VKEY_P = 'P', - - // (51) Q key - VKEY_Q = 'Q', - - // (52) R key - VKEY_R = 'R', - - // (53) S key - VKEY_S = 'S', - - // (54) T key - VKEY_T = 'T', - - // (55) U key - VKEY_U = 'U', - - // (56) V key - VKEY_V = 'V', - - // (57) W key - VKEY_W = 'W', - - // (58) X key - VKEY_X = 'X', - - // (59) Y key - VKEY_Y = 'Y', - - // (5A) Z key - VKEY_Z = 'Z', - - // VKEY_LWIN (5B) Left Windows key (Microsoft Natural keyboard) - VKEY_LWIN = VK_LWIN, - - // VKEY_RWIN (5C) Right Windows key (Natural keyboard) - VKEY_RWIN = VK_RWIN, - - // VKEY_APPS (5D) Applications key (Natural keyboard) - VKEY_APPS = VK_APPS, - - // VKEY_SLEEP (5F) Computer Sleep key - VKEY_SLEEP = VK_SLEEP, - - // VKEY_NUMPAD0 (60) Numeric keypad 0 key - VKEY_NUMPAD0 = VK_NUMPAD0, - - // VKEY_NUMPAD1 (61) Numeric keypad 1 key - VKEY_NUMPAD1 = VK_NUMPAD1, - - // VKEY_NUMPAD2 (62) Numeric keypad 2 key - VKEY_NUMPAD2 = VK_NUMPAD2, - - // VKEY_NUMPAD3 (63) Numeric keypad 3 key - VKEY_NUMPAD3 = VK_NUMPAD3, - - // VKEY_NUMPAD4 (64) Numeric keypad 4 key - VKEY_NUMPAD4 = VK_NUMPAD4, - - // VKEY_NUMPAD5 (65) Numeric keypad 5 key - VKEY_NUMPAD5 = VK_NUMPAD5, - - // VKEY_NUMPAD6 (66) Numeric keypad 6 key - VKEY_NUMPAD6 = VK_NUMPAD6, - - // VKEY_NUMPAD7 (67) Numeric keypad 7 key - VKEY_NUMPAD7 = VK_NUMPAD7, - - // VKEY_NUMPAD8 (68) Numeric keypad 8 key - VKEY_NUMPAD8 = VK_NUMPAD8, - - // VKEY_NUMPAD9 (69) Numeric keypad 9 key - VKEY_NUMPAD9 = VK_NUMPAD9, - - // VKEY_MULTIPLY (6A) Multiply key - VKEY_MULTIPLY = VK_MULTIPLY, - - // VKEY_ADD (6B) Add key - VKEY_ADD = VK_ADD, - - // VKEY_SEPARATOR (6C) Separator key - VKEY_SEPARATOR = VK_SEPARATOR, - - // VKEY_SUBTRACT (6D) Subtract key - VKEY_SUBTRACT = VK_SUBTRACT, - - // VKEY_DECIMAL (6E) Decimal key - VKEY_DECIMAL = VK_DECIMAL, - - // VKEY_DIVIDE (6F) Divide key - VKEY_DIVIDE = VK_DIVIDE, - - // VKEY_F1 (70) F1 key - VKEY_F1 = VK_F1, - - // VKEY_F2 (71) F2 key - VKEY_F2 = VK_F2, - - // VKEY_F3 (72) F3 key - VKEY_F3 = VK_F3, - - // VKEY_F4 (73) F4 key - VKEY_F4 = VK_F4, - - // VKEY_F5 (74) F5 key - VKEY_F5 = VK_F5, - - // VKEY_F6 (75) F6 key - VKEY_F6 = VK_F6, - - // VKEY_F7 (76) F7 key - VKEY_F7 = VK_F7, - - // VKEY_F8 (77) F8 key - VKEY_F8 = VK_F8, - - // VKEY_F9 (78) F9 key - VKEY_F9 = VK_F9, - - // VKEY_F10 (79) F10 key - VKEY_F10 = VK_F10, - - // VKEY_F11 (7A) F11 key - VKEY_F11 = VK_F11, - - // VKEY_F12 (7B) F12 key - VKEY_F12 = VK_F12, - - // VKEY_F13 (7C) F13 key - VKEY_F13 = VK_F13, - - // VKEY_F14 (7D) F14 key - VKEY_F14 = VK_F14, - - // VKEY_F15 (7E) F15 key - VKEY_F15 = VK_F15, - - // VKEY_F16 (7F) F16 key - VKEY_F16 = VK_F16, - - // VKEY_F17 (80H) F17 key - VKEY_F17 = VK_F17, - - // VKEY_F18 (81H) F18 key - VKEY_F18 = VK_F18, - - // VKEY_F19 (82H) F19 key - VKEY_F19 = VK_F19, - - // VKEY_F20 (83H) F20 key - VKEY_F20 = VK_F20, - - // VKEY_F21 (84H) F21 key - VKEY_F21 = VK_F21, - - // VKEY_F22 (85H) F22 key - VKEY_F22 = VK_F22, - - // VKEY_F23 (86H) F23 key - VKEY_F23 = VK_F23, - - // VKEY_F24 (87H) F24 key - VKEY_F24 = VK_F24, - - // VKEY_NUMLOCK (90) NUM LOCK key - VKEY_NUMLOCK = VK_NUMLOCK, - - // VKEY_SCROLL (91) SCROLL LOCK key - VKEY_SCROLL = VK_SCROLL, - - // VKEY_LSHIFT (A0) Left SHIFT key - VKEY_LSHIFT = VK_LSHIFT, - - // VKEY_RSHIFT (A1) Right SHIFT key - VKEY_RSHIFT = VK_RSHIFT, - - // VKEY_LCONTROL (A2) Left CONTROL key - VKEY_LCONTROL = VK_LCONTROL, - - // VKEY_RCONTROL (A3) Right CONTROL key - VKEY_RCONTROL = VK_RCONTROL, - - // VKEY_LMENU (A4) Left MENU key - VKEY_LMENU = VK_LMENU, - - // VKEY_RMENU (A5) Right MENU key - VKEY_RMENU = VK_RMENU, - - // VKEY_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key - VKEY_BROWSER_BACK = VK_BROWSER_BACK, - - // VKEY_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key - VKEY_BROWSER_FORWARD = VK_BROWSER_FORWARD, - - // VKEY_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key - VKEY_BROWSER_REFRESH = VK_BROWSER_REFRESH, - - // VKEY_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key - VKEY_BROWSER_STOP = VK_BROWSER_STOP, - - // VKEY_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key - VKEY_BROWSER_SEARCH = VK_BROWSER_SEARCH, - - // VKEY_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key - VKEY_BROWSER_FAVORITES = VK_BROWSER_FAVORITES, - - // VKEY_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key - VKEY_BROWSER_HOME = VK_BROWSER_HOME, - - // VKEY_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key - VKEY_VOLUME_MUTE = VK_VOLUME_MUTE, - - // VKEY_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key - VKEY_VOLUME_DOWN = VK_VOLUME_DOWN, - - // VKEY_VOLUME_UP (AF) Windows 2000/XP: Volume Up key - VKEY_VOLUME_UP = VK_VOLUME_UP, - - // VKEY_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key - VKEY_MEDIA_NEXT_TRACK = VK_MEDIA_NEXT_TRACK, - - // VKEY_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key - VKEY_MEDIA_PREV_TRACK = VK_MEDIA_PREV_TRACK, - - // VKEY_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key - VKEY_MEDIA_STOP = VK_MEDIA_STOP, - - // VKEY_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key - VKEY_MEDIA_PLAY_PAUSE = VK_MEDIA_PLAY_PAUSE, - - // VKEY_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key - VKEY_MEDIA_LAUNCH_MAIL = 0xB4, - - // VKEY_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key - VKEY_MEDIA_LAUNCH_MEDIA_SELECT = 0xB5, - - // VKEY_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key - VKEY_MEDIA_LAUNCH_APP1 = 0xB6, - - // VKEY_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key - VKEY_MEDIA_LAUNCH_APP2 = 0xB7, - - // VKEY_OEM_1 (BA) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ',:' key - VKEY_OEM_1 = VK_OEM_1, - - // VKEY_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key - VKEY_OEM_PLUS = VK_OEM_PLUS, - - // VKEY_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key - VKEY_OEM_COMMA = VK_OEM_COMMA, - - // VKEY_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key - VKEY_OEM_MINUS = VK_OEM_MINUS, - - // VKEY_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key - VKEY_OEM_PERIOD = VK_OEM_PERIOD, - - // VKEY_OEM_2 (BF) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key - VKEY_OEM_2 = VK_OEM_2, - - // VKEY_OEM_3 (C0) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key - VKEY_OEM_3 = VK_OEM_3, - - // VKEY_OEM_4 (DB) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key - VKEY_OEM_4 = VK_OEM_4, - - // VKEY_OEM_5 (DC) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key - VKEY_OEM_5 = VK_OEM_5, - - // VKEY_OEM_6 (DD) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key - VKEY_OEM_6 = VK_OEM_6, - - // VKEY_OEM_7 (DE) Used for miscellaneous characters, it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key - VKEY_OEM_7 = VK_OEM_7, - - // VKEY_OEM_8 (DF) Used for miscellaneous characters, it can vary by keyboard. - VKEY_OEM_8 = VK_OEM_8, - - // VKEY_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard - VKEY_OEM_102 = VK_OEM_102, - - // VKEY_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key - VKEY_PROCESSKEY = VK_PROCESSKEY, - - // VKEY_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VKEY_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP - VKEY_PACKET = VK_PACKET, - - // VKEY_ATTN (F6) Attn key - VKEY_ATTN = VK_ATTN, - - // VKEY_CRSEL (F7) CrSel key - VKEY_CRSEL = VK_CRSEL, - - // VKEY_EXSEL (F8) ExSel key - VKEY_EXSEL = VK_EXSEL, - - // VKEY_EREOF (F9) Erase EOF key - VKEY_EREOF = VK_EREOF, - - // VKEY_PLAY (FA) Play key - VKEY_PLAY = VK_PLAY, - - // VKEY_ZOOM (FB) Zoom key - VKEY_ZOOM = VK_ZOOM, - - // VKEY_NONAME (FC) Reserved for future use - VKEY_NONAME = VK_NONAME, - - // VKEY_PA1 (FD) PA1 key - VKEY_PA1 = VK_PA1, - - // VKEY_OEM_CLEAR (FE) Clear key - VKEY_OEM_CLEAR = VK_OEM_CLEAR, - - VKEY_UNKNOWN = 0 - -}; - -} - -#endif diff --git a/webkit/port/platform/chromium/Language.cpp b/webkit/port/platform/chromium/Language.cpp deleted file mode 100644 index 343cac2..0000000 --- a/webkit/port/platform/chromium/Language.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "Language.h" - -#include "ChromiumBridge.h" -#include "PlatformString.h" - -namespace WebCore { - -String defaultLanguage() -{ - static String computedDefaultLanguage; - if (computedDefaultLanguage.isEmpty()) - computedDefaultLanguage = ChromiumBridge::computedDefaultLanguage(); - return computedDefaultLanguage; -} - -} diff --git a/webkit/port/platform/chromium/LinkHashChromium.cpp b/webkit/port/platform/chromium/LinkHashChromium.cpp deleted file mode 100644 index 91a7195..0000000 --- a/webkit/port/platform/chromium/LinkHashChromium.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "LinkHash.h" - -#include "ChromiumBridge.h" - -namespace WebCore { - -LinkHash visitedLinkHash(const UChar* url, unsigned length) -{ - return ChromiumBridge::visitedLinkHash(url, length); -} - -LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL) -{ - return ChromiumBridge::visitedLinkHash(base, attributeURL); -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/MimeTypeRegistryChromium.cpp b/webkit/port/platform/chromium/MimeTypeRegistryChromium.cpp deleted file mode 100644 index 7f83d90..0000000 --- a/webkit/port/platform/chromium/MimeTypeRegistryChromium.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "MIMETypeRegistry.h" - -#include "ChromiumBridge.h" -#include "CString.h" -#include "MediaPlayer.h" - -// NOTE: Unlike other ports, we don't use the shared implementation bits in -// MIMETypeRegistry.cpp. Instead, we need to route most functions via the -// ChromiumBridge to the embedder. - -namespace WebCore -{ - -// Checks if any of the plugins handle this extension, and if so returns the -// plugin's mime type for this extension. Otherwise returns an empty string. -// See PluginsChromium.cpp for the implementation of this function. -String getPluginMimeTypeFromExtension(const String& extension); - -String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) -{ - return ChromiumBridge::mimeTypeForExtension(ext); -} - -// Returns the file extension if one is found. Does not include the dot in the -// filename. E.g., 'html'. -String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type) -{ - // Prune out any parameters in case they happen to have snuck in there... - // TODO(darin): Is this really necessary?? - String mimeType = type.substring(0, static_cast<unsigned>(type.find(';'))); - - String ext = ChromiumBridge::preferredExtensionForMIMEType(type); - if (!ext.isEmpty() && ext[0] == L'.') - ext = ext.substring(1); - - return ext; -} - -String MIMETypeRegistry::getMIMETypeForPath(const String& path) -{ - int pos = path.reverseFind('.'); - if (pos < 0) - return "application/octet-stream"; - String extension = path.substring(pos + 1); - String mimeType = getMIMETypeForExtension(extension); - if (mimeType.isEmpty()) { - // If there's no mimetype registered for the extension, check to see - // if a plugin can handle the extension. - mimeType = getPluginMimeTypeFromExtension(extension); - } - return mimeType; -} - -bool MIMETypeRegistry::isSupportedImageMIMEType(const String& mimeType) -{ - return !mimeType.isEmpty() - && ChromiumBridge::isSupportedImageMIMEType(mimeType.latin1().data()); -} - -bool MIMETypeRegistry::isSupportedImageResourceMIMEType(const String& mimeType) -{ - return isSupportedImageMIMEType(mimeType); -} - -bool MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(const String& mimeType) -{ - // TODO(brettw) fill this out. See: http://trac.webkit.org/changeset/30888 - return isSupportedImageMIMEType(mimeType); -} - -bool MIMETypeRegistry::isSupportedJavaScriptMIMEType(const String& mimeType) -{ - return !mimeType.isEmpty() - && ChromiumBridge::isSupportedJavascriptMIMEType(mimeType.latin1().data()); -} - -bool MIMETypeRegistry::isSupportedNonImageMIMEType(const String& mimeType) -{ - return !mimeType.isEmpty() - && ChromiumBridge::isSupportedNonImageMIMEType(mimeType.latin1().data()); -} - -bool MIMETypeRegistry::isSupportedMediaMIMEType(const String& mimeType) -{ - HashSet<String> supportedMediaMIMETypes; -#if ENABLE(VIDEO) - MediaPlayer::getSupportedTypes(supportedMediaMIMETypes); -#endif - return !mimeType.isEmpty() && supportedMediaMIMETypes.contains(mimeType); -} - -bool MIMETypeRegistry::isJavaAppletMIMEType(const String& mimeType) -{ - // Since this set is very limited and is likely to remain so we won't bother with the overhead - // of using a hash set. - // Any of the MIME types below may be followed by any number of specific versions of the JVM, - // which is why we use startsWith() - return mimeType.startsWith("application/x-java-applet", false) - || mimeType.startsWith("application/x-java-bean", false) - || mimeType.startsWith("application/x-java-vm", false); -} - -static HashSet<String>& dummyHashSet() -{ - ASSERT_NOT_REACHED(); - static HashSet<String> dummy; - return dummy; -} - -// NOTE: the following methods should never be reached -HashSet<String>& MIMETypeRegistry::getSupportedImageMIMETypes() { return dummyHashSet(); } -HashSet<String>& MIMETypeRegistry::getSupportedImageResourceMIMETypes() { return dummyHashSet(); } -HashSet<String>& MIMETypeRegistry::getSupportedImageMIMETypesForEncoding() { return dummyHashSet(); } -HashSet<String>& MIMETypeRegistry::getSupportedNonImageMIMETypes() { return dummyHashSet(); } -HashSet<String>& MIMETypeRegistry::getSupportedMediaMIMETypes() { return dummyHashSet(); } - -} diff --git a/webkit/port/platform/chromium/PasteboardChromium.cpp b/webkit/port/platform/chromium/PasteboardChromium.cpp deleted file mode 100644 index 0ae7981b3..0000000 --- a/webkit/port/platform/chromium/PasteboardChromium.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "Pasteboard.h" - -#include "ChromiumBridge.h" -#include "ClipboardUtilitiesChromium.h" -#include "CString.h" -#include "DocumentFragment.h" -#include "Document.h" -#include "Element.h" -#include "Frame.h" -#include "HitTestResult.h" -#include "HTMLNames.h" -#include "Image.h" -#include "KURL.h" -#include "NativeImageSkia.h" -#include "NotImplemented.h" -#include "Page.h" -#include "Range.h" -#include "RenderImage.h" -#include "TextEncoding.h" -#include "markup.h" - -#if ENABLE(SVG) -#include "SVGNames.h" -#include "XLinkNames.h" -#endif - -namespace WebCore { - -Pasteboard* Pasteboard::generalPasteboard() -{ - static Pasteboard* pasteboard = new Pasteboard; - return pasteboard; -} - -Pasteboard::Pasteboard() -{ -} - -void Pasteboard::clear() -{ - // The ScopedClipboardWriter class takes care of clearing the clipboard's - // previous contents. -} - -void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) -{ - String html = createMarkup(selectedRange, 0, AnnotateForInterchange); - ExceptionCode ec = 0; - KURL url = selectedRange->startContainer(ec)->document()->url(); - String plainText = frame->selectedText(); -#if PLATFORM(WIN_OS) - replaceNewlinesWithWindowsStyleNewlines(plainText); -#endif - replaceNBSPWithSpace(plainText); - - ChromiumBridge::clipboardWriteSelection(html, url, plainText, - canSmartCopyOrDelete); -} - -void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame) -{ - ASSERT(!url.isEmpty()); - - String title(titleStr); - if (title.isEmpty()) { - title = url.lastPathComponent(); - if (title.isEmpty()) - title = url.host(); - } - - ChromiumBridge::clipboardWriteURL(url, title); -} - -void Pasteboard::writeImage(Node* node, const KURL& link_url, const String& title) -{ - // If the image is wrapped in a link, |url| points to the target of the - // link. This isn't useful to us, so get the actual image URL. - AtomicString urlString; - if (node->hasTagName(HTMLNames::imgTag) || node->hasTagName(HTMLNames::inputTag)) - urlString = static_cast<Element*>(node)->getAttribute(HTMLNames::srcAttr); -#if ENABLE(SVG) - else if (node->hasTagName(SVGNames::imageTag)) - urlString = static_cast<Element*>(node)->getAttribute(XLinkNames::hrefAttr); -#endif - else if (node->hasTagName(HTMLNames::embedTag) || node->hasTagName(HTMLNames::objectTag)) { - Element* element = static_cast<Element*>(node); - urlString = element->getAttribute(element->imageSourceAttributeName()); - } - KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(parseURL(urlString)); - - ASSERT(node && node->renderer() && node->renderer()->isImage()); - RenderImage* renderer = static_cast<RenderImage*>(node->renderer()); - CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage()); - ASSERT(cachedImage); - Image* image = cachedImage->image(); - ASSERT(image); - - NativeImageSkia* bitmap = 0; -#if !PLATFORM(CG) - bitmap = image->nativeImageForCurrentFrame(); -#endif - ChromiumBridge::clipboardWriteImage(bitmap, url, title); -} - -bool Pasteboard::canSmartReplace() -{ - return ChromiumBridge::clipboardIsFormatAvailable( - PasteboardPrivate::WebSmartPasteFormat); -} - -String Pasteboard::plainText(Frame* frame) -{ - return ChromiumBridge::clipboardReadPlainText(); -} - -PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText) -{ - chosePlainText = false; - - if (ChromiumBridge::clipboardIsFormatAvailable( - PasteboardPrivate::HTMLFormat)) { - String markup; - KURL src_url; - ChromiumBridge::clipboardReadHTML(&markup, &src_url); - - RefPtr<DocumentFragment> fragment = - createFragmentFromMarkup(frame->document(), markup, src_url); - - if (fragment) - return fragment.release(); - } - - if (allowPlainText) { - String markup = ChromiumBridge::clipboardReadPlainText(); - if (!markup.isEmpty()) { - chosePlainText = true; - RefPtr<DocumentFragment> fragment = - createFragmentFromText(context.get(), markup); - if (fragment) - return fragment.release(); - } - } - - return 0; -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/PasteboardPrivate.h b/webkit/port/platform/chromium/PasteboardPrivate.h deleted file mode 100644 index 014e66f..0000000 --- a/webkit/port/platform/chromium/PasteboardPrivate.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef PasteboardPrivate_h__ -#define PasteboardPrivate_h__ - -namespace WebCore { - - class PasteboardPrivate - { - public: - enum ClipboardFormat { - HTMLFormat, - BookmarkFormat, - WebSmartPasteFormat, - }; - }; - -} - -#endif diff --git a/webkit/port/platform/chromium/PlatformCursor.h b/webkit/port/platform/chromium/PlatformCursor.h deleted file mode 100644 index 8d5bd04..0000000 --- a/webkit/port/platform/chromium/PlatformCursor.h +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef PlatformCursor_h -#define PlatformCursor_h - -#include "Image.h" -#include "IntPoint.h" -#include "RefPtr.h" - -namespace WebCore { - class PlatformCursor { - public: - enum Type { - typePointer, - typeCross, - typeHand, - typeIBeam, - typeWait, - typeHelp, - typeEastResize, - typeNorthResize, - typeNorthEastResize, - typeNorthWestResize, - typeSouthResize, - typeSouthEastResize, - typeSouthWestResize, - typeWestResize, - typeNorthSouthResize, - typeEastWestResize, - typeNorthEastSouthWestResize, - typeNorthWestSouthEastResize, - typeColumnResize, - typeRowResize, - typeMiddlePanning, - typeEastPanning, - typeNorthPanning, - typeNorthEastPanning, - typeNorthWestPanning, - typeSouthPanning, - typeSouthEastPanning, - typeSouthWestPanning, - typeWestPanning, - typeMove, - typeVerticalText, - typeCell, - typeContextMenu, - typeAlias, - typeProgress, - typeNoDrop, - typeCopy, - typeNone, - typeNotAllowed, - typeZoomIn, - typeZoomOut, - typeCustom - }; - - // Cursor.h assumes that it can initialize us to 0. - explicit PlatformCursor(int type = 0) : m_type(typePointer) {} - - PlatformCursor(Type type) : m_type(type) {} - - PlatformCursor(Image* image, const IntPoint& hotSpot) - : m_image(image) - , m_hotSpot(hotSpot) - , m_type(typeCustom) {} - - PassRefPtr<Image> customImage() const { return m_image; } - const IntPoint& hotSpot() const { return m_hotSpot; } - Type type() const { return m_type; } - - private: - RefPtr<Image> m_image; - IntPoint m_hotSpot; - Type m_type; - }; -} - -#endif diff --git a/webkit/port/platform/chromium/PlatformKeyboardEventChromium.cpp b/webkit/port/platform/chromium/PlatformKeyboardEventChromium.cpp deleted file mode 100644 index 70dd4f4..0000000 --- a/webkit/port/platform/chromium/PlatformKeyboardEventChromium.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "PlatformKeyboardEvent.h" - -#if PLATFORM(WIN_OS) -#include <windows.h> -#elif PLATFORM(DARWIN) -#import <Carbon/Carbon.h> -#else -#include "NotImplemented.h" -#endif - -namespace WebCore { - -void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCompatibilityMode) -{ -#if PLATFORM(WIN_OS) - // No KeyDown events on Windows to disambiguate. - ASSERT_NOT_REACHED(); -#elif PLATFORM(DARWIN) - // Can only change type from KeyDown to RawKeyDown or Char, as we lack information for other conversions. - ASSERT(m_type == KeyDown); - ASSERT(type == RawKeyDown || type == Char); - m_type = type; - if (backwardCompatibilityMode) - return; - - if (type == RawKeyDown) { - m_text = String(); - m_unmodifiedText = String(); - } else { - m_keyIdentifier = String(); - m_windowsVirtualKeyCode = 0; - if (m_text.length() == 1 && (m_text[0U] >= 0xF700 && m_text[0U] <= 0xF7FF)) { - // According to NSEvents.h, OpenStep reserves the range 0xF700-0xF8FF for function keys. However, some actual private use characters - // happen to be in this range, e.g. the Apple logo (Option+Shift+K). - // 0xF7FF is an arbitrary cut-off. - m_text = String(); - m_unmodifiedText = String(); - } - } -#endif -} - -bool PlatformKeyboardEvent::currentCapsLockState() -{ -#if PLATFORM(WIN_OS) - // TODO(darin): does this even work inside the sandbox? - return GetKeyState(VK_CAPITAL) & 1; -#elif PLATFORM(DARWIN) - return GetCurrentKeyModifiers() & alphaLock; -#else - notImplemented(); - return false; -#endif -} - -} diff --git a/webkit/port/platform/chromium/PlatformScreenChromium.cpp b/webkit/port/platform/chromium/PlatformScreenChromium.cpp deleted file mode 100644 index ad9eeb9..0000000 --- a/webkit/port/platform/chromium/PlatformScreenChromium.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "PlatformScreen.h" - -#include "ChromiumBridge.h" -#include "IntRect.h" - -namespace WebCore { - -int screenDepth(Widget* widget) -{ - return ChromiumBridge::screenDepth(widget); -} - -int screenDepthPerComponent(Widget* widget) -{ - return ChromiumBridge::screenDepthPerComponent(widget); -} - -bool screenIsMonochrome(Widget* widget) -{ - return ChromiumBridge::screenIsMonochrome(widget); -} - -FloatRect screenRect(Widget* widget) -{ - return ChromiumBridge::screenRect(widget); -} - -FloatRect screenAvailableRect(Widget* widget) -{ - return ChromiumBridge::screenAvailableRect(widget); -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/PlatformWidget.h b/webkit/port/platform/chromium/PlatformWidget.h deleted file mode 100644 index 661999f..0000000 --- a/webkit/port/platform/chromium/PlatformWidget.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2008, Google 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: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef PlatformWidget_h -#define PlatformWidget_h - -// PlatformWidget is an opaque identifier corresponding to whatever native -// view type the embedder may use. PlatformWidget CANNOT be assumed to be -// a valid pointer. Some embedders may not use this identifier at all. - -typedef void* PlatformWidget; - -#endif diff --git a/webkit/port/platform/chromium/PopupMenuChromium.cpp b/webkit/port/platform/chromium/PopupMenuChromium.cpp deleted file mode 100644 index fb350e9..0000000 --- a/webkit/port/platform/chromium/PopupMenuChromium.cpp +++ /dev/null @@ -1,1120 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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" - -#if COMPILER(MSVC) -__pragma(warning(push, 0)) -#endif -#include "PopupMenu.h" - -#include "CharacterNames.h" -#include "ChromeClientChromium.h" -#include "Document.h" -#include "Font.h" -#include "FrameView.h" -#include "FontSelector.h" -#include "Frame.h" -#include "FramelessScrollView.h" -#include "FramelessScrollViewClient.h" -#include "GraphicsContext.h" -#include "IntRect.h" -#include "KeyboardCodes.h" -#include "NotImplemented.h" -#include "Page.h" -#include "PlatformKeyboardEvent.h" -#include "PlatformMouseEvent.h" -#include "PlatformScreen.h" -#include "PlatformWheelEvent.h" -#include "RenderBlock.h" -#include "RenderTheme.h" -#include "ScrollbarTheme.h" -#include "SystemTime.h" -#include "Widget.h" -#if COMPILER(MSVC) -__pragma(warning(pop)) -#endif - -#include "webkit/port/platform/chromium/PopupMenuChromium.h" - -using namespace WTF; -using namespace Unicode; - -using std::min; -using std::max; - -namespace WebCore { - -typedef unsigned long long TimeStamp; - -static const int kMaxVisibleRows = 20; -static const int kMaxHeight = 500; -static const int kBorderSize = 1; -static const TimeStamp kTypeAheadTimeoutMs = 1000; - -// This class uses WebCore code to paint and handle events for a drop-down list -// box ("combobox" on Windows). -class PopupListBox : public FramelessScrollView, public RefCounted<PopupListBox> { -public: - // FramelessScrollView - virtual void paint(GraphicsContext* gc, const IntRect& rect); - virtual bool handleMouseDownEvent(const PlatformMouseEvent& event); - virtual bool handleMouseMoveEvent(const PlatformMouseEvent& event); - virtual bool handleMouseReleaseEvent(const PlatformMouseEvent& event); - virtual bool handleWheelEvent(const PlatformWheelEvent& event); - virtual bool handleKeyEvent(const PlatformKeyboardEvent& event); - - // ScrollView - virtual HostWindow* hostWindow() const; - - // PopupListBox methods - - // Show the popup - void showPopup(); - - // Hide the popup. Do not call this directly: use client->hidePopup(). - void hidePopup(); - - // Update our internal list to match the client. - void updateFromElement(); - - // Free any allocated resources used in a particular popup session. - void clear(); - - // Set the index of the option that is displayed in the <select> widget in the page - void setOriginalIndex(int index); - - // Get the index of the item that the user is currently moused over or has selected with - // the keyboard. This is not the same as the original index, since the user has not yet - // accepted this input. - int selectedIndex() const { return m_selectedIndex; } - - // Move selection down/up the given number of items, scrolling if necessary. - // Positive is down. The resulting index will be clamped to the range - // [0, numItems), and non-option items will be skipped. - void adjustSelectedIndex(int delta); - - // Returns the number of items in the list. - int numItems() const { return static_cast<int>(m_items.size()); } - - void setBaseWidth(int width) - { - m_baseWidth = width; - } - - // Compute size of widget and children. - void layout(); - - // Returns whether the popup wants to process events for the passed key. - bool isInterestedInEventForKey(int key_code); - - // Sets whether the PopupMenuClient should be told to change its text when a - // new item is selected (by using the arrow keys). Default is true. - void setTextOnIndexChange(bool value) { m_setTextOnIndexChange = value; } - - // Sets whether we should accept the selected index when the popup is - // abandonned. - void setAcceptOnAbandon(bool value) { m_shouldAcceptOnAbandon = value; } - -private: - friend class PopupContainer; - friend class RefCounted<PopupListBox>; - - // A type of List Item - enum ListItemType { - TYPE_OPTION, - TYPE_GROUP, - TYPE_SEPARATOR - }; - - // A item (represented by <option> or <optgroup>) in the <select> widget. - struct ListItem { - ListItem(const String& label, ListItemType type) - : label(label.copy()), type(type), y(0) {} - String label; - ListItemType type; - int y; // y offset of this item, relative to the top of the popup. - }; - - PopupListBox(PopupMenuClient* client) - : m_originalIndex(0) - , m_selectedIndex(0) - , m_shouldAcceptOnAbandon(true) - , m_willAcceptOnAbandon(false) - , m_visibleRows(0) - , m_popupClient(client) - , m_repeatingChar(0) - , m_lastCharTime(0) - , m_setTextOnIndexChange(true) - { - setScrollbarModes(ScrollbarAlwaysOff, ScrollbarAlwaysOff); - } - - ~PopupListBox() - { - clear(); - } - - void disconnectClient() { m_popupClient = 0; } - - // Closes the popup - void abandon(); - // Select an index in the list, scrolling if necessary. - void selectIndex(int index); - // Accepts the selected index as the value to be displayed in the <select> widget on - // the web page, and closes the popup. - void acceptIndex(int index); - - // Returns true if the selection can be changed to index. - // Disabled items, or labels cannot be selected. - bool isSelectableItem(int index); - - // Scrolls to reveal the given index. - void scrollToRevealRow(int index); - void scrollToRevealSelection() { scrollToRevealRow(m_selectedIndex); } - - // Invalidates the row at the given index. - void invalidateRow(int index); - - // Gets the height of a row. - int getRowHeight(int index); - // Get the bounds of a row. - IntRect getRowBounds(int index); - - // Converts a point to an index of the row the point is over - int pointToRowIndex(const IntPoint& point); - - // Paint an individual row - void paintRow(GraphicsContext* gc, const IntRect& rect, int rowIndex); - - // Test if the given point is within the bounds of the popup window. - bool isPointInBounds(const IntPoint& point); - - // Called when the user presses a text key. Does a prefix-search of the items. - void typeAheadFind(const PlatformKeyboardEvent& event); - - // Returns the font to use for the given row - Font getRowFont(int index); - - // This is the index of the item marked as "selected" - i.e. displayed in the widget on the - // page. - int m_originalIndex; - - // This is the index of the item that the user is hovered over or has selected using the - // keyboard in the list. They have not confirmed this selection by clicking or pressing - // enter yet however. - int m_selectedIndex; - - // Whether we should accept the selectedIndex as chosen when the popup is - // "abandoned". This value is set through its setter and is useful as - // select popup menu and form autofill popup menu have different behaviors. - bool m_shouldAcceptOnAbandon; - - // True if we should accept the selectedIndex as chosen, even if the popup - // is "abandoned". This is used for keyboard navigation, where we want the - // selection to change immediately, and is only used if - // m_shouldAcceptOnAbandon is true. - bool m_willAcceptOnAbandon; - - // This is the number of rows visible in the popup. The maximum number visible at a time is - // defined as being kMaxVisibleRows. For a scrolled popup, this can be thought of as the - // page size in data units. - int m_visibleRows; - - // Our suggested width, not including scrollbar. - int m_baseWidth; - - // A list of the options contained within the <select> - Vector<ListItem*> m_items; - - // The <select> PopupMenuClient that opened us. - PopupMenuClient* m_popupClient; - - // The scrollbar which has mouse capture. Mouse events go straight to this - // if non-NULL. - RefPtr<Scrollbar> m_capturingScrollbar; - - // The last scrollbar that the mouse was over. Used for mouseover highlights. - RefPtr<Scrollbar> m_lastScrollbarUnderMouse; - - // The string the user has typed so far into the popup. Used for typeAheadFind. - String m_typedString; - - // The char the user has hit repeatedly. Used for typeAheadFind. - UChar m_repeatingChar; - - // The last time the user hit a key. Used for typeAheadFind. - TimeStamp m_lastCharTime; - - bool m_setTextOnIndexChange; -}; - -static PlatformMouseEvent constructRelativeMouseEvent(const PlatformMouseEvent& e, - FramelessScrollView* parent, - FramelessScrollView* child) -{ - IntPoint pos = parent->convertSelfToChild(child, e.pos()); - - // FIXME(beng): This is a horrible hack since PlatformMouseEvent has no setters for x/y. - // Need to add setters and get patch back upstream to webkit source. - PlatformMouseEvent relativeEvent = e; - IntPoint& relativePos = const_cast<IntPoint&>(relativeEvent.pos()); - relativePos.setX(pos.x()); - relativePos.setY(pos.y()); - return relativeEvent; -} - -static PlatformWheelEvent constructRelativeWheelEvent(const PlatformWheelEvent& e, - FramelessScrollView* parent, - FramelessScrollView* child) -{ - IntPoint pos = parent->convertSelfToChild(child, e.pos()); - - // FIXME(beng): This is a horrible hack since PlatformWheelEvent has no setters for x/y. - // Need to add setters and get patch back upstream to webkit source. - PlatformWheelEvent relativeEvent = e; - IntPoint& relativePos = const_cast<IntPoint&>(relativeEvent.pos()); - relativePos.setX(pos.x()); - relativePos.setY(pos.y()); - return relativeEvent; -} - -/////////////////////////////////////////////////////////////////////////////// -// PopupContainer implementation - -// static -PassRefPtr<PopupContainer> PopupContainer::create(PopupMenuClient* client, - bool focusOnShow) -{ - return adoptRef(new PopupContainer(client, focusOnShow)); -} - -PopupContainer::PopupContainer(PopupMenuClient* client, bool focusOnShow) - : m_listBox(new PopupListBox(client)), - m_focusOnShow(focusOnShow) -{ - // FrameViews are created with a refcount of 1 so it needs releasing after we - // assign it to a RefPtr. - m_listBox->deref(); - - setScrollbarModes(ScrollbarAlwaysOff, ScrollbarAlwaysOff); -} - -PopupContainer::~PopupContainer() -{ - if (m_listBox) - removeChild(m_listBox.get()); -} - -void PopupContainer::showPopup(FrameView* view) -{ - // Pre-layout, our size matches the <select> dropdown control. - int selectHeight = frameRect().height(); - - // Lay everything out to figure out our preferred size, then tell the view's - // WidgetClient about it. It should assign us a client. - layout(); - - ChromeClientChromium* chromeClient = static_cast<ChromeClientChromium*>( - view->frame()->page()->chrome()->client()); - if (chromeClient) { - // If the popup would extend past the bottom of the screen, open upwards - // instead. - FloatRect screen = screenRect(view); - IntRect widgetRect = chromeClient->windowToScreen(frameRect()); - if (widgetRect.bottom() > static_cast<int>(screen.bottom())) - widgetRect.move(0, -(widgetRect.height() + selectHeight)); - - chromeClient->popupOpened(this, widgetRect, m_focusOnShow); - } - - // Must get called after we have a client and containingWindow. - addChild(m_listBox.get()); - - // Enable scrollbars after the listbox is inserted into the hierarchy, so - // it has a proper WidgetClient. - m_listBox->setVerticalScrollbarMode(ScrollbarAuto); - - m_listBox->scrollToRevealSelection(); - - invalidate(); -} - -void PopupContainer::hidePopup() -{ - invalidate(); - - m_listBox->disconnectClient(); - removeChild(m_listBox.get()); - m_listBox = 0; - - if (client()) - client()->popupClosed(this); -} - -void PopupContainer::layout() -{ - m_listBox->layout(); - - // Place the listbox within our border. - m_listBox->move(kBorderSize, kBorderSize); - - // Size ourselves to contain listbox + border. - resize(m_listBox->width() + kBorderSize*2, m_listBox->height() + kBorderSize*2); - - invalidate(); -} - -bool PopupContainer::handleMouseDownEvent(const PlatformMouseEvent& event) -{ - return m_listBox->handleMouseDownEvent( - constructRelativeMouseEvent(event, this, m_listBox.get())); -} - -bool PopupContainer::handleMouseMoveEvent(const PlatformMouseEvent& event) -{ - return m_listBox->handleMouseMoveEvent( - constructRelativeMouseEvent(event, this, m_listBox.get())); -} - -bool PopupContainer::handleMouseReleaseEvent(const PlatformMouseEvent& event) -{ - return m_listBox->handleMouseReleaseEvent( - constructRelativeMouseEvent(event, this, m_listBox.get())); -} - -bool PopupContainer::handleWheelEvent(const PlatformWheelEvent& event) -{ - return m_listBox->handleWheelEvent( - constructRelativeWheelEvent(event, this, m_listBox.get())); -} - -bool PopupContainer::handleKeyEvent(const PlatformKeyboardEvent& event) -{ - return m_listBox->handleKeyEvent(event); -} - -void PopupContainer::hide() { - m_listBox->abandon(); -} - -void PopupContainer::paint(GraphicsContext* gc, const IntRect& rect) -{ - // adjust coords for scrolled frame - IntRect r = intersection(rect, frameRect()); - int tx = x(); - int ty = y(); - - r.move(-tx, -ty); - - gc->translate(static_cast<float>(tx), static_cast<float>(ty)); - m_listBox->paint(gc, r); - gc->translate(-static_cast<float>(tx), -static_cast<float>(ty)); - - paintBorder(gc, rect); -} - -void PopupContainer::paintBorder(GraphicsContext* gc, const IntRect& rect) -{ - // FIXME(mpcomplete): where do we get the border color from? - Color borderColor(127, 157, 185); - - gc->setStrokeStyle(NoStroke); - gc->setFillColor(borderColor); - - int tx = x(); - int ty = y(); - - // top, left, bottom, right - gc->drawRect(IntRect(tx, ty, width(), kBorderSize)); - gc->drawRect(IntRect(tx, ty, kBorderSize, height())); - gc->drawRect(IntRect(tx, ty + height() - kBorderSize, width(), kBorderSize)); - gc->drawRect(IntRect(tx + width() - kBorderSize, ty, kBorderSize, height())); -} - -bool PopupContainer::isInterestedInEventForKey(int key_code) { - return m_listBox->isInterestedInEventForKey(key_code); -} - -void PopupContainer::show(const IntRect& r, FrameView* v, int index) { - // The rect is the size of the select box. It's usually larger than we need. - // subtract border size so that usually the container will be displayed - // exactly the same width as the select box. - listBox()->setBaseWidth(max(r.width() - kBorderSize * 2, 0)); - - listBox()->updateFromElement(); - - // We set the selected item in updateFromElement(), and disregard the - // index passed into this function (same as Webkit's PopupMenuWin.cpp) - // TODO(ericroman): make sure this is correct, and add an assertion. - // DCHECK(popupWindow(popup)->listBox()->selectedIndex() == index); - - // Convert point to main window coords. - IntPoint location = v->contentsToWindow(r.location()); - - // Move it below the select widget. - location.move(0, r.height()); - - IntRect popupRect(location, r.size()); - setFrameRect(popupRect); - showPopup(v); -} - -void PopupContainer::setTextOnIndexChange(bool value) { - listBox()->setTextOnIndexChange(value); -} - -void PopupContainer::setAcceptOnAbandon(bool value) { - listBox()->setAcceptOnAbandon(value); -} - -void PopupContainer::refresh() { - listBox()->updateFromElement(); - layout(); -} - -/////////////////////////////////////////////////////////////////////////////// -// PopupListBox implementation - -bool PopupListBox::handleMouseDownEvent(const PlatformMouseEvent& event) -{ - Scrollbar* scrollbar = scrollbarUnderMouse(event); - if (scrollbar) { - m_capturingScrollbar = scrollbar; - m_capturingScrollbar->mouseDown(event); - return true; - } - - if (!isPointInBounds(event.pos())) - abandon(); - - return true; -} - -bool PopupListBox::handleMouseMoveEvent(const PlatformMouseEvent& event) -{ - if (m_capturingScrollbar) { - m_capturingScrollbar->mouseMoved(event); - return true; - } - - Scrollbar* scrollbar = scrollbarUnderMouse(event); - if (m_lastScrollbarUnderMouse != scrollbar) { - // Send mouse exited to the old scrollbar. - if (m_lastScrollbarUnderMouse) - m_lastScrollbarUnderMouse->mouseExited(); - m_lastScrollbarUnderMouse = scrollbar; - } - - if (scrollbar) { - scrollbar->mouseMoved(event); - return true; - } - - if (!isPointInBounds(event.pos())) - return false; - - selectIndex(pointToRowIndex(event.pos())); - return true; -} - -bool PopupListBox::handleMouseReleaseEvent(const PlatformMouseEvent& event) -{ - if (m_capturingScrollbar) { - m_capturingScrollbar->mouseUp(); - m_capturingScrollbar = 0; - return true; - } - - if (!isPointInBounds(event.pos())) - return true; - - acceptIndex(pointToRowIndex(event.pos())); - return true; -} - -bool PopupListBox::handleWheelEvent(const PlatformWheelEvent& event) -{ - if (!isPointInBounds(event.pos())) { - abandon(); - return true; - } - - // Pass it off to the scroll view. - // Sadly, WebCore devs don't understand the whole "const" thing. - wheelEvent(const_cast<PlatformWheelEvent&>(event)); - return true; -} - -// Should be kept in sync with handleKeyEvent(). -bool PopupListBox::isInterestedInEventForKey(int key_code) { - switch (key_code) { - case VKEY_ESCAPE: - case VKEY_RETURN: - case VKEY_UP: - case VKEY_DOWN: - case VKEY_PRIOR: - case VKEY_NEXT: - case VKEY_HOME: - case VKEY_END: - case VKEY_TAB: - return true; - default: - return false; - } -} - -bool PopupListBox::handleKeyEvent(const PlatformKeyboardEvent& event) -{ - if (event.type() == PlatformKeyboardEvent::KeyUp) - return true; - - if (numItems() == 0 && event.windowsVirtualKeyCode() != VKEY_ESCAPE) - return true; - - switch (event.windowsVirtualKeyCode()) { - case VKEY_ESCAPE: - abandon(); // may delete this - return true; - case VKEY_RETURN: - acceptIndex(m_selectedIndex); // may delete this - return true; - case VKEY_UP: - adjustSelectedIndex(-1); - break; - case VKEY_DOWN: - adjustSelectedIndex(1); - break; - case VKEY_PRIOR: - adjustSelectedIndex(-m_visibleRows); - break; - case VKEY_NEXT: - adjustSelectedIndex(m_visibleRows); - break; - case VKEY_HOME: - adjustSelectedIndex(-m_selectedIndex); - break; - case VKEY_END: - adjustSelectedIndex(m_items.size()); - break; - default: - if (!event.ctrlKey() && !event.altKey() && !event.metaKey() && - isPrintableChar(event.windowsVirtualKeyCode())) { - typeAheadFind(event); - } - break; - } - - if (m_originalIndex != m_selectedIndex) { - // Keyboard events should update the selection immediately (but we don't - // want to fire the onchange event until the popup is closed, to match - // IE). We change the original index so we revert to that when the - // popup is closed. - if (m_shouldAcceptOnAbandon) - m_willAcceptOnAbandon = true; - - setOriginalIndex(m_selectedIndex); - if (m_setTextOnIndexChange) - m_popupClient->setTextFromItem(m_selectedIndex); - } else if (!m_setTextOnIndexChange && - event.windowsVirtualKeyCode() == VKEY_TAB) { - // TAB is a special case as it should select the current item if any and - // advance focus. - if (m_selectedIndex >= 0) - m_popupClient->setTextFromItem(m_selectedIndex); - // Return false so the TAB key event is propagated to the page. - return false; - } - - return true; -} - -HostWindow* PopupListBox::hostWindow() const -{ - // Our parent is the root ScrollView, so it is the one that has a - // HostWindow. FrameView::hostWindow() works similarly. - return parent() ? parent()->hostWindow() : 0; -} - -// From HTMLSelectElement.cpp -static String stripLeadingWhiteSpace(const String& string) -{ - int length = string.length(); - int i; - for (i = 0; i < length; ++i) - if (string[i] != noBreakSpace && - (string[i] <= 0x7F ? !isspace(string[i]) : (direction(string[i]) != WhiteSpaceNeutral))) - break; - - return string.substring(i, length - i); -} - -// From HTMLSelectElement.cpp, with modifications -void PopupListBox::typeAheadFind(const PlatformKeyboardEvent& event) -{ - TimeStamp now = static_cast<TimeStamp>(currentTime() * 1000.0f); - TimeStamp delta = now - m_lastCharTime; - - m_lastCharTime = now; - - UChar c = event.windowsVirtualKeyCode(); - - String prefix; - int searchStartOffset = 1; - if (delta > kTypeAheadTimeoutMs) { - m_typedString = prefix = String(&c, 1); - m_repeatingChar = c; - } else { - m_typedString.append(c); - - if (c == m_repeatingChar) - // The user is likely trying to cycle through all the items starting with this character, so just search on the character - prefix = String(&c, 1); - else { - m_repeatingChar = 0; - prefix = m_typedString; - searchStartOffset = 0; - } - } - - int itemCount = numItems(); - int index = (max(0, m_selectedIndex) + searchStartOffset) % itemCount; - for (int i = 0; i < itemCount; i++, index = (index + 1) % itemCount) { - if (!isSelectableItem(index)) - continue; - - if (stripLeadingWhiteSpace(m_items[index]->label).startsWith(prefix, false)) { - selectIndex(index); - return; - } - } -} - -void PopupListBox::paint(GraphicsContext* gc, const IntRect& rect) -{ - // adjust coords for scrolled frame - IntRect r = intersection(rect, frameRect()); - int tx = x() - scrollX(); - int ty = y() - scrollY(); - - r.move(-tx, -ty); - - // set clip rect to match revised damage rect - gc->save(); - gc->translate(static_cast<float>(tx), static_cast<float>(ty)); - gc->clip(r); - - // TODO(mpcomplete): Can we optimize scrolling to not require repainting the - // entire window? Should we? - for (int i = 0; i < numItems(); ++i) - paintRow(gc, r, i); - - // Special case for an empty popup. - if (numItems() == 0) - gc->fillRect(r, Color::white); - - gc->restore(); - - ScrollView::paint(gc, rect); -} - -static const int separatorPadding = 4; -static const int separatorHeight = 1; - -void PopupListBox::paintRow(GraphicsContext* gc, const IntRect& rect, int rowIndex) -{ - // This code is based largely on RenderListBox::paint* methods. - - IntRect rowRect = getRowBounds(rowIndex); - if (!rowRect.intersects(rect)) - return; - - PopupMenuStyle style = m_popupClient->itemStyle(rowIndex); - - // Paint background - Color backColor, textColor; - if (rowIndex == m_selectedIndex) { - backColor = theme()->activeListBoxSelectionBackgroundColor(); - textColor = theme()->activeListBoxSelectionForegroundColor(); - } else { - backColor = style.backgroundColor(); - textColor = style.foregroundColor(); - } - - // If we have a transparent background, make sure it has a color to blend - // against. - if (backColor.hasAlpha()) - gc->fillRect(rowRect, Color::white); - - gc->fillRect(rowRect, backColor); - - if (m_popupClient->itemIsSeparator(rowIndex)) { - IntRect separatorRect( - rowRect.x() + separatorPadding, - rowRect.y() + (rowRect.height() - separatorHeight) / 2, - rowRect.width() - 2 * separatorPadding, separatorHeight); - gc->fillRect(separatorRect, textColor); - return; - } - - gc->setFillColor(textColor); - - Font itemFont = getRowFont(rowIndex); - gc->setFont(itemFont); - - // Bunch of shit to deal with RTL text... - String itemText = m_popupClient->itemText(rowIndex); - unsigned length = itemText.length(); - const UChar* str = itemText.characters(); - - TextRun textRun(str, length, false, 0, 0, itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft); - - // TODO(ojan): http://b/1210481 We should get the padding of individual - // option elements. This probably implies changes to PopupMenuClient. - - // Draw the item text - if (style.isVisible()) { - int textX = max(0, m_popupClient->clientPaddingLeft() - m_popupClient->clientInsetLeft()); - int textY = rowRect.y() + itemFont.ascent() + (rowRect.height() - itemFont.height()) / 2; - gc->drawBidiText(textRun, IntPoint(textX, textY)); - } -} - -Font PopupListBox::getRowFont(int rowIndex) -{ - Font itemFont = m_popupClient->itemStyle(rowIndex).font(); - if (m_popupClient->itemIsLabel(rowIndex)) { - // Bold-ify labels (ie, an <optgroup> heading). - FontDescription d = itemFont.fontDescription(); - d.setWeight(FontWeightBold); - Font font(d, itemFont.letterSpacing(), itemFont.wordSpacing()); - font.update(0); - return font; - } - - return itemFont; -} - -void PopupListBox::abandon() -{ - RefPtr<PopupListBox> keepAlive(this); - - m_selectedIndex = m_originalIndex; - - if (m_willAcceptOnAbandon) - m_popupClient->valueChanged(m_selectedIndex); - - // valueChanged may have torn down the popup! - if (m_popupClient) - m_popupClient->hidePopup(); -} - -int PopupListBox::pointToRowIndex(const IntPoint& point) -{ - int y = scrollY() + point.y(); - - // TODO(mpcomplete): binary search if perf matters. - for (int i = 0; i < numItems(); ++i) { - if (y < m_items[i]->y) - return i-1; - } - - // Last item? - if (y < contentsHeight()) - return m_items.size()-1; - - return -1; -} - -void PopupListBox::acceptIndex(int index) -{ - ASSERT(index >= -1 && index < numItems()); - if (index == -1 && m_popupClient) { - // Enter pressed with no selection, just close the popup. - m_popupClient->hidePopup(); - return; - } - - if (isSelectableItem(index)) { - RefPtr<PopupListBox> keepAlive(this); - - // Tell the <select> PopupMenuClient what index was selected, and hide ourself. - m_popupClient->valueChanged(index); - - // valueChanged may have torn down the popup! - if (m_popupClient) - m_popupClient->hidePopup(); - } -} - -void PopupListBox::selectIndex(int index) -{ - ASSERT(index >= 0 && index < numItems()); - - if (index != m_selectedIndex && isSelectableItem(index)) { - invalidateRow(m_selectedIndex); - m_selectedIndex = index; - invalidateRow(m_selectedIndex); - - scrollToRevealSelection(); - } -} - -void PopupListBox::setOriginalIndex(int index) -{ - m_originalIndex = m_selectedIndex = index; -} - -int PopupListBox::getRowHeight(int index) -{ - if (index >= 0) { - return m_popupClient->itemStyle(index).font().height(); - } else { - return 0; - } -} - -IntRect PopupListBox::getRowBounds(int index) -{ - if (index >= 0) { - return IntRect(0, m_items[index]->y, visibleWidth(), getRowHeight(index)); - } else { - return IntRect(0, 0, visibleWidth(), getRowHeight(index)); - } -} - -void PopupListBox::invalidateRow(int index) -{ - if (index < 0) - return; - - invalidateRect(getRowBounds(index)); -} - -void PopupListBox::scrollToRevealRow(int index) -{ - if (index < 0) - return; - - IntRect rowRect = getRowBounds(index); - - if (rowRect.y() < scrollY()) { - // Row is above current scroll position, scroll up. - ScrollView::setScrollPosition(IntPoint(0, rowRect.y())); - } else if (rowRect.bottom() > scrollY() + visibleHeight()) { - // Row is below current scroll position, scroll down. - ScrollView::setScrollPosition(IntPoint(0, rowRect.bottom() - visibleHeight())); - } -} - -bool PopupListBox::isSelectableItem(int index) { - return m_items[index]->type == TYPE_OPTION && - m_popupClient->itemIsEnabled(index); -} - -void PopupListBox::adjustSelectedIndex(int delta) -{ - int targetIndex = m_selectedIndex + delta; - targetIndex = min(max(targetIndex, 0), numItems() - 1); - if (!isSelectableItem(targetIndex)) { - // We didn't land on an option. Try to find one. - // We try to select the closest index to target, prioritizing any in - // the range [current, target]. - - int dir = delta > 0 ? 1 : -1; - int testIndex = m_selectedIndex; - int bestIndex = m_selectedIndex; - bool passedTarget = false; - while (testIndex >= 0 && testIndex < numItems()) { - if (isSelectableItem(testIndex)) - bestIndex = testIndex; - if (testIndex == targetIndex) - passedTarget = true; - if (passedTarget && bestIndex != m_selectedIndex) - break; - - testIndex += dir; - } - - // Pick the best index, which may mean we don't change. - targetIndex = bestIndex; - } - - // Select the new index, and ensure its visible. We do this regardless of - // whether the selection changed to ensure keyboard events always bring the - // selection into view. - selectIndex(targetIndex); - scrollToRevealSelection(); -} - -void PopupListBox::updateFromElement() -{ - // It happens when pressing a key to jump to an item, then use tab or - // mouse to get away from the select box. In that case, updateFromElement - // is called before abandon, which causes discarding of the select result. - if (m_willAcceptOnAbandon) { - m_popupClient->valueChanged(m_selectedIndex); - m_willAcceptOnAbandon = false; - } - - clear(); - - int size = m_popupClient->listSize(); - for (int i = 0; i < size; ++i) { - ListItemType type; - if (m_popupClient->itemIsSeparator(i)) - type = PopupListBox::TYPE_SEPARATOR; - else if (m_popupClient->itemIsLabel(i)) - type = PopupListBox::TYPE_GROUP; - else - type = PopupListBox::TYPE_OPTION; - m_items.append(new ListItem(m_popupClient->itemText(i), type)); - } - - m_selectedIndex = m_popupClient->selectedIndex(); - setOriginalIndex(m_selectedIndex); - - layout(); -} - -void PopupListBox::layout() -{ - // Size our child items. - int baseWidth = 0; - int paddingWidth = 0; - int y = 0; - for (int i = 0; i < numItems(); ++i) { - Font itemFont = getRowFont(i); - - // Place the item vertically. - m_items[i]->y = y; - y += itemFont.height(); - - // Ensure the popup is wide enough to fit this item. - String text = m_popupClient->itemText(i); - if (!text.isEmpty()) { - int width = itemFont.width(TextRun(text)); - baseWidth = max(baseWidth, width); - } - // TODO(ojan): http://b/1210481 We should get the padding of individual option elements. - paddingWidth = max(paddingWidth, - m_popupClient->clientPaddingLeft() + m_popupClient->clientPaddingRight()); - } - - int windowHeight = 0; - m_visibleRows = min(numItems(), kMaxVisibleRows); - for (int i = 0; i < m_visibleRows; ++i) { - int rowHeight = getRowHeight(i); - if (windowHeight + rowHeight > kMaxHeight) { - m_visibleRows = i; - break; - } - - windowHeight += rowHeight; - } - - // Set our widget and scrollable contents sizes. - int scrollbarWidth = 0; - if (m_visibleRows < numItems()) - scrollbarWidth = ScrollbarTheme::nativeTheme()->scrollbarThickness(); - - int windowWidth = baseWidth + scrollbarWidth + paddingWidth; - int contentWidth = baseWidth; - - if (windowWidth < m_baseWidth) { - windowWidth = m_baseWidth; - contentWidth = m_baseWidth - scrollbarWidth - paddingWidth; - } else { - m_baseWidth = baseWidth; - } - - resize(windowWidth, windowHeight); - setContentsSize(IntSize(contentWidth, getRowBounds(numItems() - 1).bottom())); - - if (hostWindow()) - scrollToRevealSelection(); - - invalidate(); -} - -void PopupListBox::clear() -{ - for (Vector<ListItem*>::iterator it = m_items.begin(); it != m_items.end(); ++it) - delete *it; - m_items.clear(); -} - -bool PopupListBox::isPointInBounds(const IntPoint& point) -{ - return numItems() != 0 && IntRect(0, 0, width(), height()).contains(point); -} - - -/////////////////////////////////////////////////////////////////////////////// -// PopupMenu implementation -// -// Note: you cannot add methods to this class, since it is defined above the -// portability layer. To access methods and properties on the -// popup widgets, use |popupWindow| above. - -PopupMenu::PopupMenu(PopupMenuClient* client) - : m_popupClient(client) -{ -} - -PopupMenu::~PopupMenu() -{ - hide(); -} - -void PopupMenu::show(const IntRect& r, FrameView* v, int index) -{ - p.m_popup = PopupContainer::create(client(), true); - p.m_popup->show(r, v, index); -} - -void PopupMenu::hide() -{ - if (p.m_popup) { - p.m_popup->hidePopup(); - p.m_popup = 0; - } -} - -void PopupMenu::updateFromElement() -{ - p.m_popup->listBox()->updateFromElement(); -} - -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return false; -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/PopupMenuChromium.h b/webkit/port/platform/chromium/PopupMenuChromium.h deleted file mode 100644 index c8c7098..0000000 --- a/webkit/port/platform/chromium/PopupMenuChromium.h +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PopupMenuChromium_h -#define PopupMenuChromium_h - -#include "config.h" - -#if COMPILER(MSVC) -__pragma(warning(push, 0)) -#endif -#include "PopupMenuClient.h" - -#include "FramelessScrollView.h" -#include "IntRect.h" -#if COMPILER(MSVC) -__pragma(warning(pop)) -#endif - - -namespace WebCore { - -class PopupListBox; - -// TODO(darin): Our FramelessScrollView classes need to implement HostWindow! - -// This class holds a PopupListBox (see cpp file). Its sole purpose is to be -// able to draw a border around its child. All its paint/event handling is just -// forwarded to the child listBox (with the appropriate transforms). -// NOTE: this class is exposed so it can be instantiated direcly for the -// autofill popup. We cannot use the Popup class directly in that case as the -// autofill popup should not be focused when shown and we want to forward the -// key events to it (through handleKeyEvent). - -class PopupContainer : public FramelessScrollView, public RefCounted<PopupContainer> { -public: - static PassRefPtr<PopupContainer> create(PopupMenuClient* client, - bool focusOnShow); - - // Whether a key event should be sent to this popup. - virtual bool isInterestedInEventForKey(int key_code); - - // FramelessScrollView - virtual void paint(GraphicsContext* gc, const IntRect& rect); - virtual void hide(); - virtual bool handleMouseDownEvent(const PlatformMouseEvent& event); - virtual bool handleMouseMoveEvent(const PlatformMouseEvent& event); - virtual bool handleMouseReleaseEvent(const PlatformMouseEvent& event); - virtual bool handleWheelEvent(const PlatformWheelEvent& event); - virtual bool handleKeyEvent(const PlatformKeyboardEvent& event); - - // PopupContainer methods - - // Show the popup - void showPopup(FrameView* view); - - // Show the popup in the specified rect for the specified frame. - // Note: this code was somehow arbitrarily factored-out of the Popup class - // so WebViewImpl can create a PopupContainer. - void show(const IntRect& r, FrameView* v, int index); - - // Hide the popup. Do not call this directly: use client->hidePopup(). - void hidePopup(); - - // Compute size of widget and children. - void layout(); - - // Sets whether the PopupMenuClient should be told to change its text when a - // new item is selected (by using the arrow keys). Default is true. - void setTextOnIndexChange(bool value); - - // Sets whether the selection should be accepted when the popup menu is - // closed (through ESC being pressed or the focus going away). - // Default is true. - // Note that when TAB is pressed, the selection is always accepted - // regardless of this setting. - void setAcceptOnAbandon(bool value); - - PopupListBox* listBox() const { return m_listBox.get(); } - - // Refresh the popup values from the PopupMenuClient. - void refresh(); - -private: - friend class WTF::RefCounted<PopupContainer>; - - PopupContainer(PopupMenuClient* client, bool focusOnShow); - ~PopupContainer(); - - // Paint the border. - void paintBorder(GraphicsContext* gc, const IntRect& rect); - - RefPtr<PopupListBox> m_listBox; - - // Whether the window showing this popup should be focused when shown. - bool m_focusOnShow; -}; - -} - -#endif // PopupMenuChromium_h diff --git a/webkit/port/platform/chromium/PopupMenuPrivate.h b/webkit/port/platform/chromium/PopupMenuPrivate.h deleted file mode 100644 index dfe7541..0000000 --- a/webkit/port/platform/chromium/PopupMenuPrivate.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -#ifndef PopupMenuPrivate_h__ -#define PopupMenuPrivate_h__ - -#include "RefPtr.h" - -namespace WebCore { - -class PopupContainer; - -struct PopupMenuPrivate -{ - RefPtr<PopupContainer> m_popup; -}; - -} - -#endif diff --git a/webkit/port/platform/chromium/RenderThemeGtk.cpp b/webkit/port/platform/chromium/RenderThemeGtk.cpp deleted file mode 100644 index 4481770..0000000 --- a/webkit/port/platform/chromium/RenderThemeGtk.cpp +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * Copyright (C) 2008 Collabora Ltd. - * - * 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. - * - */ - -#include "config.h" -#include "RenderThemeGtk.h" - -#include "AffineTransform.h" -#include "ChromiumBridge.h" -#include "CSSValueKeywords.h" -#include "GraphicsContext.h" -#include "NotImplemented.h" -#include "PlatformContextSkia.h" -#include "RenderObject.h" -#include "ScrollbarTheme.h" -#include "gtkdrawing.h" -#include "GdkSkia.h" -#include "UserAgentStyleSheets.h" - -#include <gdk/gdk.h> - -namespace { - -enum PaddingType { - TopPadding, - RightPadding, - BottomPadding, - LeftPadding -}; - -const int kStyledMenuListInternalPadding[4] = { 1, 4, 1, 4 }; - -// The default variable-width font size. We use this as the default font -// size for the "system font", and as a base size (which we then shrink) for -// form control fonts. -float DefaultFontSize = 16.0; - -} // namespace - -namespace WebCore { - -static Color makeColor(const GdkColor& c) -{ - return Color(makeRGB(c.red >> 8, c.green >> 8, c.blue >> 8)); -} - -// We aim to match IE here. -// -IE uses a font based on the encoding as the default font for form controls. -// -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT), -// which returns MS Shell Dlg) -// -Safari uses Lucida Grande. -// -// TODO(ojan): Fix this! -// The only case where we know we don't match IE is for ANSI encodings. IE uses -// MS Shell Dlg there, which we render incorrectly at certain pixel sizes -// (e.g. 15px). So, for now we just use Arial. -static const char* defaultGUIFont(Document* document) -{ - return "Arial"; -} - -// Converts points to pixels. One point is 1/72 of an inch. -static float pointsToPixels(float points) -{ - static float pixelsPerInch = 0.0f; - if (!pixelsPerInch) { - GdkScreen* screen = gdk_screen_get_default(); - // TODO(deanm): I'm getting floating point values of ~75 and ~100, - // and it's making my fonts look all wrong. Figure this out. - if (0 && screen) { - pixelsPerInch = gdk_screen_get_resolution(screen); - } else { - // Match the default we set on Windows. - pixelsPerInch = 96.0f; - } - } - - static const float POINTS_PER_INCH = 72.0f; - return points / POINTS_PER_INCH * pixelsPerInch; -} - -static void setSizeIfAuto(RenderStyle* style, const IntSize& size) -{ - if (style->width().isIntrinsicOrAuto()) - style->setWidth(Length(size.width(), Fixed)); - if (style->height().isAuto()) - style->setHeight(Length(size.height(), Fixed)); -} - -static bool supportsFocus(ControlPart appearance) -{ - switch (appearance) { - case PushButtonPart: - case ButtonPart: - case TextFieldPart: - case TextAreaPart: - case SearchFieldPart: - case MenulistPart: - case RadioPart: - case CheckboxPart: - return true; - default: - return false; - } -} - -static GtkTextDirection gtkTextDirection(TextDirection direction) -{ - switch (direction) { - case RTL: - return GTK_TEXT_DIR_RTL; - case LTR: - return GTK_TEXT_DIR_LTR; - default: - return GTK_TEXT_DIR_NONE; - } -} -static void setMozState(RenderTheme* theme, GtkWidgetState* state, RenderObject* o) -{ - state->active = theme->isPressed(o); - state->focused = theme->isFocused(o); - state->inHover = theme->isHovered(o); - // FIXME: Disabled does not always give the correct appearance for ReadOnly - state->disabled = !theme->isEnabled(o) || theme->isReadOnlyControl(o); - state->isDefault = false; - state->canDefault = false; - state->depressed = false; -} - -static bool paintMozWidget(RenderTheme* theme, GtkThemeWidgetType type, RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) -{ - // Painting is disabled so just claim to have succeeded - if (i.context->paintingDisabled()) - return false; - - GtkWidgetState mozState; - setMozState(theme, &mozState, o); - - int flags; - - // We might want to make setting flags the caller's job at some point rather than doing it here. - switch (type) { - case MOZ_GTK_BUTTON: - flags = GTK_RELIEF_NORMAL; - break; - case MOZ_GTK_CHECKBUTTON: - case MOZ_GTK_RADIOBUTTON: - flags = theme->isChecked(o); - break; - default: - flags = 0; - break; - } - - PlatformContextSkia* pcs = i.context->platformContext(); - SkCanvas* canvas = pcs->canvas(); - if (!canvas) - return false; - - GdkRectangle gdkRect; - gdkRect.x = rect.x(); - gdkRect.y = rect.y(); - gdkRect.width = rect.width(); - gdkRect.height = rect.height(); - - // getTotalClip returns the currently set clip region in device coordinates, - // so we have to apply the current transform (actually we only support translations) - // to get the page coordinates that our gtk widget rendering expects. - // We invert it because we want to map from device coordinates to page coordinates. - const SkIRect clip_region = canvas->getTotalClip().getBounds(); - AffineTransform ctm = i.context->getCTM().inverse(); - IntPoint pos = ctm.mapPoint(IntPoint(SkScalarRound(clip_region.fLeft), SkScalarRound(clip_region.fTop))); - GdkRectangle gdkClipRect; - gdkClipRect.x = pos.x(); - gdkClipRect.y = pos.y(); - gdkClipRect.width = clip_region.width(); - gdkClipRect.height = clip_region.height(); - - // moz_gtk_widget_paint will paint outside the bounds of gdkRect unless we further restrict |gdkClipRect|. - gdk_rectangle_intersect(&gdkRect, &gdkClipRect, &gdkClipRect); - - GtkTextDirection direction = gtkTextDirection(o->style()->direction()); - - return moz_gtk_widget_paint(type, pcs->gdk_skia(), &gdkRect, &gdkClipRect, &mozState, flags, direction) != MOZ_GTK_SUCCESS; -} - -static void gtkStyleSetCallback(GtkWidget* widget, GtkStyle* previous, RenderTheme* renderTheme) -{ - // FIXME: Make sure this function doesn't get called many times for a single GTK+ style change signal. - renderTheme->platformColorsDidChange(); -} - -static double querySystemBlinkInterval(double defaultInterval) -{ - GtkSettings* settings = gtk_settings_get_default(); - - gboolean shouldBlink; - gint time; - - g_object_get(settings, "gtk-cursor-blink", &shouldBlink, "gtk-cursor-blink-time", &time, NULL); - - if (!shouldBlink) - return 0; - - return time / 1000.0; -} - -// Implement WebCore::theme() for getting the global RenderTheme. -RenderTheme* theme() -{ - static RenderThemeGtk gtkTheme; - return >kTheme; -} - -RenderThemeGtk::RenderThemeGtk() - : m_gtkWindow(0) - , m_gtkContainer(0) - , m_gtkEntry(0) - , m_gtkTreeView(0) -{ -} - -// Use the Windows style sheets to match their metrics. -String RenderThemeGtk::extraDefaultStyleSheet() -{ - return String(themeWinUserAgentStyleSheet, sizeof(themeWinUserAgentStyleSheet)); -} - -String RenderThemeGtk::extraQuirksStyleSheet() -{ - return String(themeWinQuirksUserAgentStyleSheet, sizeof(themeWinQuirksUserAgentStyleSheet)); -} - -bool RenderThemeGtk::supportsFocusRing(const RenderStyle* style) const -{ - return supportsFocus(style->appearance()); -} - -Color RenderThemeGtk::platformActiveSelectionBackgroundColor() const -{ - GtkWidget* widget = gtkEntry(); - return makeColor(widget->style->base[GTK_STATE_SELECTED]); -} - -Color RenderThemeGtk::platformInactiveSelectionBackgroundColor() const -{ - GtkWidget* widget = gtkEntry(); - return makeColor(widget->style->base[GTK_STATE_ACTIVE]); -} - -Color RenderThemeGtk::platformActiveSelectionForegroundColor() const -{ - GtkWidget* widget = gtkEntry(); - return makeColor(widget->style->text[GTK_STATE_SELECTED]); -} - -Color RenderThemeGtk::platformInactiveSelectionForegroundColor() const -{ - GtkWidget* widget = gtkEntry(); - return makeColor(widget->style->text[GTK_STATE_ACTIVE]); -} - -Color RenderThemeGtk::platformTextSearchHighlightColor() const -{ - return Color(255, 255, 150); -} - -double RenderThemeGtk::caretBlinkInterval() const -{ - // Disable the blinking caret in layout test mode, as it introduces - // a race condition for the pixel tests. http://b/1198440 - if (ChromiumBridge::layoutTestMode()) - return 0; - - // We cache the interval so we don't have to repeatedly request it from gtk. - static double blinkInterval = querySystemBlinkInterval(RenderTheme::caretBlinkInterval()); - return blinkInterval; -} - -void RenderThemeGtk::systemFont(int propId, Document* document, FontDescription& fontDescription) const -{ - const char* faceName = 0; - float fontSize = 0; - // TODO(mmoss) see also webkit/port/rendering/RenderThemeWin.cpp - switch (propId) { - case CSSValueMenu: - case CSSValueStatusBar: - case CSSValueSmallCaption: - // triggered by LayoutTests/fast/css/css2-system-fonts.html - notImplemented(); - break; - case CSSValueWebkitMiniControl: - case CSSValueWebkitSmallControl: - case CSSValueWebkitControl: - faceName = defaultGUIFont(document); - // Why 2 points smaller? Because that's what Gecko does. - fontSize = DefaultFontSize - pointsToPixels(2); - break; - default: - faceName = defaultGUIFont(document); - fontSize = DefaultFontSize; - } - - // Only update if the size makes sense. - if (fontSize > 0) { - fontDescription.firstFamily().setFamily(faceName); - fontDescription.setSpecifiedSize(fontSize); - fontDescription.setIsAbsoluteSize(true); - fontDescription.setGenericFamily(FontDescription::NoFamily); - fontDescription.setWeight(FontWeightNormal); - fontDescription.setItalic(false); - } -} - -int RenderThemeGtk::minimumMenuListSize(RenderStyle* style) const -{ - return 0; -} - -bool RenderThemeGtk::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) -{ - return paintMozWidget(this, MOZ_GTK_CHECKBUTTON, o, i, rect); -} - -void RenderThemeGtk::setCheckboxSize(RenderStyle* style) const -{ - // If the width and height are both specified, then we have nothing to do. - if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) - return; - - // FIXME: A hard-coded size of 13 is used. This is wrong but necessary for now. It matches Firefox. - // At different DPI settings on Windows, querying the theme gives you a larger size that accounts for - // the higher DPI. Until our entire engine honors a DPI setting other than 96, we can't rely on the theme's - // metrics. - const IntSize size(13, 13); - setSizeIfAuto(style, size); -} - -bool RenderThemeGtk::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) -{ - return paintMozWidget(this, MOZ_GTK_RADIOBUTTON, o, i, rect); -} - -void RenderThemeGtk::setRadioSize(RenderStyle* style) const -{ - // Use same sizing for radio box as checkbox. - setCheckboxSize(style); -} - -bool RenderThemeGtk::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) -{ - return paintMozWidget(this, MOZ_GTK_BUTTON, o, i, rect); -} - -bool RenderThemeGtk::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) -{ - return paintMozWidget(this, MOZ_GTK_ENTRY, o, i, rect); -} - -bool RenderThemeGtk::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) -{ - return paintTextField(o, i, rect); -} - -bool RenderThemeGtk::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) -{ - return paintMozWidget(this, MOZ_GTK_CHECKMENUITEM, o, i, rect); -} - -bool RenderThemeGtk::paintSearchFieldResultsButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) -{ - return paintMozWidget(this, MOZ_GTK_DROPDOWN_ARROW, o, i, rect); -} - -bool RenderThemeGtk::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) -{ - return paintMozWidget(this, MOZ_GTK_CHECKMENUITEM, o, i, rect); -} - -void RenderThemeGtk::adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const -{ - // Height is locked to auto on all browsers. - style->setLineHeight(RenderStyle::initialLineHeight()); -} - -bool RenderThemeGtk::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) -{ - return paintMozWidget(this, MOZ_GTK_DROPDOWN, o, i, rect); -} - -void RenderThemeGtk::adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const -{ - adjustMenuListStyle(selector, style, e); -} - -// Used to paint styled menulists (i.e. with a non-default border) -bool RenderThemeGtk::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) -{ - return paintMenuList(o, i, r); -} - -int RenderThemeGtk::popupInternalPaddingLeft(RenderStyle* style) const -{ - return menuListInternalPadding(style, LeftPadding); -} - -int RenderThemeGtk::popupInternalPaddingRight(RenderStyle* style) const -{ - return menuListInternalPadding(style, RightPadding); -} - -int RenderThemeGtk::popupInternalPaddingTop(RenderStyle* style) const -{ - return menuListInternalPadding(style, TopPadding); -} - -int RenderThemeGtk::popupInternalPaddingBottom(RenderStyle* style) const -{ - return menuListInternalPadding(style, BottomPadding); -} - -void RenderThemeGtk::adjustButtonInnerStyle(RenderStyle* style) const -{ - // This inner padding matches Firefox. - style->setPaddingTop(Length(1, Fixed)); - style->setPaddingRight(Length(3, Fixed)); - style->setPaddingBottom(Length(1, Fixed)); - style->setPaddingLeft(Length(3, Fixed)); -} - -bool RenderThemeGtk::controlSupportsTints(const RenderObject* o) const -{ - return isEnabled(o); -} - -Color RenderThemeGtk::activeListBoxSelectionBackgroundColor() const -{ - GtkWidget* widget = gtkTreeView(); - return makeColor(widget->style->base[GTK_STATE_SELECTED]); -} - -Color RenderThemeGtk::activeListBoxSelectionForegroundColor() const -{ - GtkWidget* widget = gtkTreeView(); - return makeColor(widget->style->text[GTK_STATE_SELECTED]); -} - -Color RenderThemeGtk::inactiveListBoxSelectionBackgroundColor() const -{ - GtkWidget* widget = gtkTreeView(); - return makeColor(widget->style->base[GTK_STATE_ACTIVE]); -} - -Color RenderThemeGtk::inactiveListBoxSelectionForegroundColor() const -{ - GtkWidget* widget = gtkTreeView(); - return makeColor(widget->style->text[GTK_STATE_ACTIVE]); -} - -GtkWidget* RenderThemeGtk::gtkEntry() const -{ - if (m_gtkEntry) - return m_gtkEntry; - - m_gtkEntry = gtk_entry_new(); - g_signal_connect(m_gtkEntry, "style-set", G_CALLBACK(gtkStyleSetCallback), theme()); - gtk_container_add(gtkContainer(), m_gtkEntry); - gtk_widget_realize(m_gtkEntry); - - return m_gtkEntry; -} - -GtkWidget* RenderThemeGtk::gtkTreeView() const -{ - if (m_gtkTreeView) - return m_gtkTreeView; - - m_gtkTreeView = gtk_tree_view_new(); - g_signal_connect(m_gtkTreeView, "style-set", G_CALLBACK(gtkStyleSetCallback), theme()); - gtk_container_add(gtkContainer(), m_gtkTreeView); - gtk_widget_realize(m_gtkTreeView); - - return m_gtkTreeView; -} - -GtkContainer* RenderThemeGtk::gtkContainer() const -{ - if (m_gtkContainer) - return m_gtkContainer; - - m_gtkWindow = gtk_window_new(GTK_WINDOW_POPUP); - m_gtkContainer = GTK_CONTAINER(gtk_fixed_new()); - gtk_container_add(GTK_CONTAINER(m_gtkWindow), GTK_WIDGET(m_gtkContainer)); - gtk_widget_realize(m_gtkWindow); - - return m_gtkContainer; -} - -int RenderThemeGtk::menuListInternalPadding(RenderStyle* style, int paddingType) const -{ - // This internal padding is in addition to the user-supplied padding. - // Matches the FF behavior. - int padding = kStyledMenuListInternalPadding[paddingType]; - - // Reserve the space for right arrow here. The rest of the padding is - // set by adjustMenuListStyle, since PopMenuWin.cpp uses the padding from - // RenderMenuList to lay out the individual items in the popup. - // If the MenuList actually has appearance "NoAppearance", then that means - // we don't draw a button, so don't reserve space for it. - const int bar_type = style->direction() == LTR ? RightPadding : LeftPadding; - if (paddingType == bar_type && style->appearance() != NoControlPart) - padding += ScrollbarTheme::nativeTheme()->scrollbarThickness(); - - return padding; -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/RenderThemeGtk.h b/webkit/port/platform/chromium/RenderThemeGtk.h deleted file mode 100644 index 90bc6f4..0000000 --- a/webkit/port/platform/chromium/RenderThemeGtk.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * This file is part of the WebKit project. - * - * Copyright (C) 2006 Apple Computer, Inc. - * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com - * Copyright (C) 2007 Holger Hans Peter Freyther - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * All rights reserved. - * - * 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 RenderThemeGdk_h -#define RenderThemeGdk_h - -#include "RenderTheme.h" -#include "GraphicsContext.h" - -#include <gtk/gtk.h> - -namespace WebCore { - -class RenderThemeGtk : public RenderTheme { -public: - RenderThemeGtk(); - ~RenderThemeGtk() { } - - virtual String extraDefaultStyleSheet(); - virtual String extraQuirksStyleSheet(); - - // A method asking if the theme's controls actually care about redrawing when hovered. - virtual bool supportsHover(const RenderStyle*) const { return true; } - - // A method asking if the theme is able to draw the focus ring. - virtual bool supportsFocusRing(const RenderStyle*) const; - - // The platform selection color. - virtual Color platformActiveSelectionBackgroundColor() const; - virtual Color platformInactiveSelectionBackgroundColor() const; - virtual Color platformActiveSelectionForegroundColor() const; - virtual Color platformInactiveSelectionForegroundColor() const; - virtual Color platformTextSearchHighlightColor() const; - - virtual double caretBlinkInterval() const; - - // System fonts. - virtual void systemFont(int propId, Document*, FontDescription&) const; - - virtual int minimumMenuListSize(RenderStyle*) const; - - virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); - virtual void setCheckboxSize(RenderStyle* style) const; - - virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); - virtual void setRadioSize(RenderStyle* style) const; - - virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) - { return paintTextField(o, i, r); } - - virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - // MenuList refers to an unstyled menulist (meaning a menulist without - // background-color or border set) and MenuListButton refers to a styled - // menulist (a menulist with background-color or border set). They have - // this distinction to support showing aqua style themes whenever they - // possibly can, which is something we don't want to replicate. - // - // In short, we either go down the MenuList code path or the MenuListButton - // codepath. We never go down both. And in both cases, they render the - // entire menulist. - virtual void adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const; - virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const; - virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - // These methods define the padding for the MenuList's inner block. - virtual int popupInternalPaddingLeft(RenderStyle*) const; - virtual int popupInternalPaddingRight(RenderStyle*) const; - virtual int popupInternalPaddingTop(RenderStyle*) const; - virtual int popupInternalPaddingBottom(RenderStyle*) const; - - virtual void adjustButtonInnerStyle(RenderStyle* style) const; - - // A method asking if the control changes its tint when the window has focus or not. - virtual bool controlSupportsTints(const RenderObject*) const; - - // A general method asking if any control tinting is supported at all. - virtual bool supportsControlTints() const { return true; } - - // List Box selection color - virtual Color activeListBoxSelectionBackgroundColor() const; - virtual Color activeListBoxSelectionForegroundColor() const; - virtual Color inactiveListBoxSelectionBackgroundColor() const; - virtual Color inactiveListBoxSelectionForegroundColor() const; - -private: - /* - * hold the state - */ - GtkWidget* gtkEntry() const; - GtkWidget* gtkTreeView() const; - - /* - * unmapped GdkWindow having a container. This is holding all - * our fake widgets - */ - GtkContainer* gtkContainer() const; - -private: - int menuListInternalPadding(RenderStyle* style, int paddingType) const; - - mutable GtkWidget* m_gtkWindow; - mutable GtkContainer* m_gtkContainer; - mutable GtkWidget* m_gtkEntry; - mutable GtkWidget* m_gtkTreeView; -}; - -} - -#endif diff --git a/webkit/port/platform/chromium/SSLKeyGeneratorChromium.cpp b/webkit/port/platform/chromium/SSLKeyGeneratorChromium.cpp deleted file mode 100644 index 0b6cb7c..0000000 --- a/webkit/port/platform/chromium/SSLKeyGeneratorChromium.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "SSLKeyGenerator.h" - -namespace WebCore { - -// These are defined in webkit/glue/localized_strings.cpp. -String keygenMenuHighGradeKeySize(); -String keygenMenuMediumGradeKeySize(); - -// Returns the key sizes supported by the HTML keygen tag. The first string -// is displayed as the default key size in the keygen menu. -Vector<String> supportedKeySizes() -{ - Vector<String> sizes(2); - sizes[0] = keygenMenuHighGradeKeySize(); - sizes[1] = keygenMenuMediumGradeKeySize(); - return sizes; -} - -// TODO: implement signedPublicKeyAndChallengeString here. - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp b/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp deleted file mode 100644 index 4f167f9..0000000 --- a/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (C) 2008 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. ``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 - * 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 "ScrollbarThemeChromium.h" - -#include "ChromiumBridge.h" -#include "PlatformMouseEvent.h" -#include "Scrollbar.h" -#include "ScrollbarClient.h" -#include "ScrollbarThemeComposite.h" - -// ----------------------------------------------------------------------------- -// This file contains scrollbar theme code that is cross platform. Additional -// members of ScrollbarThemeChromium can be found in the platform specific files -// ----------------------------------------------------------------------------- - -namespace WebCore { - -ScrollbarTheme* ScrollbarTheme::nativeTheme() -{ - static ScrollbarThemeChromium theme; - return &theme; -} - -ScrollbarThemeChromium::ScrollbarThemeChromium() -{ -} - -ScrollbarThemeChromium::~ScrollbarThemeChromium() -{ -} - -void ScrollbarThemeChromium::themeChanged() -{ -} - -bool ScrollbarThemeChromium::hasThumb(Scrollbar* scrollbar) -{ - // This method is just called as a paint-time optimization to see if - // painting the thumb can be skipped. We don't have to be exact here. - return thumbLength(scrollbar) > 0; -} - -IntRect ScrollbarThemeChromium::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) -{ - // Windows and Linux just have single arrows. - if (part == BackButtonEndPart) - return IntRect(); - - IntSize size = buttonSize(scrollbar); - return IntRect(scrollbar->x(), scrollbar->y(), size.width(), size.height()); -} - -IntRect ScrollbarThemeChromium::forwardButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) -{ - // Windows and Linux just have single arrows. - if (part == ForwardButtonStartPart) - return IntRect(); - - IntSize size = buttonSize(scrollbar); - int x, y; - if (scrollbar->orientation() == HorizontalScrollbar) { - x = scrollbar->x() + scrollbar->width() - size.width(); - y = scrollbar->y(); - } else { - x = scrollbar->x(); - y = scrollbar->y() + scrollbar->height() - size.height(); - } - return IntRect(x, y, size.width(), size.height()); -} - -IntRect ScrollbarThemeChromium::trackRect(Scrollbar* scrollbar, bool) -{ - IntSize bs = buttonSize(scrollbar); - int thickness = scrollbarThickness(); - if (scrollbar->orientation() == HorizontalScrollbar) { - if (scrollbar->width() < 2 * thickness) - return IntRect(); - return IntRect(scrollbar->x() + bs.width(), scrollbar->y(), scrollbar->width() - 2 * bs.width(), thickness); - } - if (scrollbar->height() < 2 * thickness) - return IntRect(); - return IntRect(scrollbar->x(), scrollbar->y() + bs.height(), thickness, scrollbar->height() - 2 * bs.height()); -} - -void ScrollbarThemeChromium::paintTrackBackground(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect) -{ - // Just assume a forward track part. We only paint the track as a single piece when there is no thumb. - if (!hasThumb(scrollbar)) - paintTrackPiece(context, scrollbar, rect, ForwardTrackPart); -} - -void ScrollbarThemeChromium::paintTickmarks(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect) -{ - if (scrollbar->orientation() != VerticalScrollbar) - return; - - if (rect.height() <= 0 || rect.width() <= 0) - return; // nothing to draw on. - - // Get the tickmarks for the frameview. - Vector<IntRect> tickmarks; - scrollbar->client()->getTickmarks(tickmarks); - if (!tickmarks.size()) - return; - - // Get the image for the tickmarks. - static RefPtr<Image> dash = Image::loadPlatformResource("tickmarkDash"); - if (dash->isNull()) { - ASSERT_NOT_REACHED(); - return; - } - - context->save(); - - for (Vector<IntRect>::const_iterator i = tickmarks.begin(); i != tickmarks.end(); ++i) { - // Calculate how far down (in %) the tick-mark should appear. - const float percent = static_cast<float>(i->y()) / scrollbar->totalSize(); - - // Calculate how far down (in pixels) the tick-mark should appear. - const int yPos = rect.topLeft().y() + (rect.height() * percent); - - IntPoint tick(scrollbar->x(), yPos); - context->drawImage(dash.get(), tick); - } - - context->restore(); -} - -void ScrollbarThemeChromium::paintScrollCorner(ScrollView* view, GraphicsContext* context, const IntRect& cornerRect) -{ - // ScrollbarThemeComposite::paintScrollCorner incorrectly assumes that the - // ScrollView is a FrameView (see FramelessScrollView), so we cannot let - // that code run. For FrameView's this is correct since we don't do custom - // scrollbar corner rendering, which ScrollbarThemeComposite supports. - ScrollbarTheme::paintScrollCorner(view, context, cornerRect); -} - -bool ScrollbarThemeChromium::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt) -{ - return evt.shiftKey() && evt.button() == LeftButton; -} - -IntSize ScrollbarThemeChromium::buttonSize(Scrollbar* scrollbar) -{ - // Our desired rect is essentially thickness by thickness. - - // Our actual rect will shrink to half the available space when we have < 2 - // times thickness pixels left. This allows the scrollbar to scale down - // and function even at tiny sizes. - - int thickness = scrollbarThickness(); - -#if !defined(__linux__) - // In layout test mode, we force the button "girth" (i.e., the length of - // the button along the axis of the scrollbar) to be a fixed size. - // FIXME: This is retarded! scrollbarThickness is already fixed in layout - // test mode so that should be enough to result in repeatable results, but - // preserving this hack avoids having to rebaseline pixel tests. - const int kLayoutTestModeGirth = 17; - - int girth = ChromiumBridge::layoutTestMode() ? kLayoutTestModeGirth : thickness; -#else - int girth = thickness; -#endif - - if (scrollbar->orientation() == HorizontalScrollbar) { - int width = scrollbar->width() < 2 * girth ? scrollbar->width() / 2 : girth; - return IntSize(width, thickness); - } - - int height = scrollbar->height() < 2 * girth ? scrollbar->height() / 2 : girth; - return IntSize(thickness, height); -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromium.h b/webkit/port/platform/chromium/ScrollbarThemeChromium.h deleted file mode 100644 index c198222..0000000 --- a/webkit/port/platform/chromium/ScrollbarThemeChromium.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2008 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. ``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 - * 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. - */ - -#ifndef ScrollbarThemeChromium_h -#define ScrollbarThemeChromium_h - -#include "ScrollbarThemeComposite.h" - -namespace WebCore { - -class PlatformMouseEvent; - -// ----------------------------------------------------------------------------- -// This class contains the Chromium scrollbar implementations for Windows and -// Linux. All of the symbols here in must be defined somewhere in the code and -// we manage the platform specific parts by linking in different, platform -// specific, files. Methods that we shared across platforms are implemented in -// ScrollbarThemeChromium.cpp -// ----------------------------------------------------------------------------- -class ScrollbarThemeChromium : public ScrollbarThemeComposite { -public: - ScrollbarThemeChromium(); - virtual ~ScrollbarThemeChromium(); - - virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar); - - virtual void themeChanged(); - - virtual bool invalidateOnMouseEnterExit(); - -protected: - virtual bool hasButtons(Scrollbar*) { return true; } - virtual bool hasThumb(Scrollbar*); - - virtual IntRect backButtonRect(Scrollbar*, ScrollbarPart, bool painting = false); - virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool painting = false); - virtual IntRect trackRect(Scrollbar*, bool painting = false); - - virtual void paintScrollCorner(ScrollView*, GraphicsContext*, const IntRect&); - virtual bool shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent&); - - virtual void paintTrackBackground(GraphicsContext*, Scrollbar*, const IntRect&); - virtual void paintTrackPiece(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart); - virtual void paintButton(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart); - virtual void paintThumb(GraphicsContext*, Scrollbar*, const IntRect&); - virtual void paintTickmarks(GraphicsContext*, Scrollbar*, const IntRect&); - -private: - IntSize buttonSize(Scrollbar*); - - int getThemeState(Scrollbar*, ScrollbarPart) const; - int getThemeArrowState(Scrollbar*, ScrollbarPart) const; - int getClassicThemeState(Scrollbar*, ScrollbarPart) const; -}; - -} -#endif diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp b/webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp deleted file mode 100644 index f052d92..0000000 --- a/webkit/port/platform/chromium/ScrollbarThemeChromiumLinux.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "ScrollbarThemeChromium.h" - -#include "AffineTransform.h" -#include "NotImplemented.h" -#include "PlatformContextSkia.h" -#include "PlatformMouseEvent.h" -#include "Scrollbar.h" - -#include "gtkdrawing.h" -#include "GdkSkia.h" -#include <gtk/gtk.h> - - -namespace WebCore { - -int ScrollbarThemeChromium::scrollbarThickness(ScrollbarControlSize controlSize) -{ - static int size = 0; - if (!size) { - MozGtkScrollbarMetrics metrics; - moz_gtk_get_scrollbar_metrics(&metrics); - size = metrics.slider_width; - } - return size; -} - -bool ScrollbarThemeChromium::invalidateOnMouseEnterExit() -{ - notImplemented(); - return false; -} - -// ----------------------------------------------------------------------------- -// Given an uninitialised widget state object, set the members such that it's -// sane for drawing scrollbars -// ----------------------------------------------------------------------------- -static void initMozState(GtkWidgetState* mozState) -{ - mozState->active = true; - mozState->focused = false; - mozState->inHover = false; - mozState->disabled = false; - mozState->isDefault = false; - mozState->canDefault = false; - mozState->depressed = false; - mozState->curpos = 0; - mozState->maxpos = 0; -} - -// ----------------------------------------------------------------------------- -// Paint a GTK widget -// gc: context to draw onto -// rect: the area of the widget -// widget_type: the type of widget to draw -// flags: widget dependent flags (e.g. direction of scrollbar arrows etc) -// -// See paintMozWiget in RenderThemeGtk.cpp for an explanation of the clipping. -// ----------------------------------------------------------------------------- -static void paintScrollbarWidget(GraphicsContext* gc, const IntRect& rect, - GtkThemeWidgetType widget_type, gint flags) -{ - PlatformContextSkia* pcs = gc->platformContext(); - - GdkRectangle gdkRect = { rect.x(), rect.y(), rect.width(), rect.height() }; - - const SkIRect clip_region = pcs->canvas()->getTotalClip().getBounds(); - AffineTransform ctm = gc->getCTM().inverse(); - IntPoint pos = ctm.mapPoint( - IntPoint(SkScalarRound(clip_region.fLeft), SkScalarRound(clip_region.fTop))); - GdkRectangle gdkClipRect; - gdkClipRect.x = pos.x(); - gdkClipRect.y = pos.y(); - gdkClipRect.width = clip_region.width(); - gdkClipRect.height = clip_region.height(); - - gdk_rectangle_intersect(&gdkRect, &gdkClipRect, &gdkClipRect); - - GtkWidgetState mozState; - initMozState(&mozState); - - moz_gtk_widget_paint(widget_type, pcs->gdk_skia(), &gdkRect, &gdkClipRect, - &mozState, flags, GTK_TEXT_DIR_LTR); -} - -void ScrollbarThemeChromium::paintTrackPiece(GraphicsContext* gc, Scrollbar* scrollbar, - const IntRect& rect, ScrollbarPart partType) -{ - const bool horz = scrollbar->orientation() == HorizontalScrollbar; - const GtkThemeWidgetType track_type = - horz ? MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL : MOZ_GTK_SCROLLBAR_TRACK_VERTICAL; - paintScrollbarWidget(gc, rect, track_type, 0); - - return; -} - -void ScrollbarThemeChromium::paintButton(GraphicsContext* gc, Scrollbar* scrollbar, - const IntRect& rect, ScrollbarPart part) -{ - // TODO(port): It appears the either we're upsetting GTK by forcing WebKit - // sizes on it, or the buttons expect the track to be drawn under them. - // Either way, we end up with unpainted pixels which are upsetting the - // pixel tests. Thus we paint green under the buttons to, at least, make - // the pixel output the same between debug and opt builds. - SkPaint paint; - paint.setARGB(255, 0, 255, 128); - SkRect skrect; - skrect.set(rect.x(), rect.y(), rect.x() + rect.width() - 1, rect.y() + rect.height() - 1); - gc->platformContext()->canvas()->drawRect(skrect, paint); - - const bool horz = scrollbar->orientation() == HorizontalScrollbar; - gint flags = horz ? 0 : MOZ_GTK_STEPPER_VERTICAL; - flags |= ForwardButtonEndPart == part ? MOZ_GTK_STEPPER_DOWN : 0; - paintScrollbarWidget(gc, rect, MOZ_GTK_SCROLLBAR_BUTTON, flags); -} - -void ScrollbarThemeChromium::paintThumb(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect) -{ - const bool horz = scrollbar->orientation() == HorizontalScrollbar; - const GtkThemeWidgetType thumb_type = - horz ? MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL : MOZ_GTK_SCROLLBAR_THUMB_VERTICAL; - paintScrollbarWidget(gc, rect, thumb_type, 0); -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp b/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp deleted file mode 100644 index 90c5e21..0000000 --- a/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (C) 2008 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. ``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 - * 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 "ScrollbarThemeChromium.h" - -#include <windows.h> -#include <vsstyle.h> - -#include "ChromiumBridge.h" -#include "ChromiumUtilsWin.h" -#include "GraphicsContext.h" -#include "PlatformContextSkia.h" -#include "PlatformMouseEvent.h" -#include "Scrollbar.h" - -namespace WebCore { - -using ChromiumUtils::isVistaOrGreater; - -// The scrollbar size in DumpRenderTree on the Mac - so we can match their -// layout results. Entries are for regular, small, and mini scrollbars. -// Metrics obtained using [NSScroller scrollerWidthForControlSize:] -static const int kMacScrollbarSize[3] = { 15, 11, 15 }; - -int ScrollbarThemeChromium::scrollbarThickness(ScrollbarControlSize controlSize) -{ - static int thickness; - if (!thickness) { - if (ChromiumBridge::layoutTestMode()) - return kMacScrollbarSize[controlSize]; - thickness = GetSystemMetrics(SM_CXVSCROLL); - } - return thickness; -} - -bool ScrollbarThemeChromium::invalidateOnMouseEnterExit() -{ - return isVistaOrGreater(); -} - -void ScrollbarThemeChromium::paintTrackPiece(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart partType) -{ - bool horz = scrollbar->orientation() == HorizontalScrollbar; - - int partId; - if (partType == BackTrackPart) { - partId = horz ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT; - } else { - partId = horz ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; - } - - IntRect alignRect = trackRect(scrollbar, false); - - // Draw the track area before/after the thumb on the scroll bar. - ChromiumBridge::paintScrollbarTrack( - gc, - partId, - getThemeState(scrollbar, partType), - getClassicThemeState(scrollbar, partType), - rect, - alignRect); -} - -void ScrollbarThemeChromium::paintButton(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part) -{ - bool horz = scrollbar->orientation() == HorizontalScrollbar; - - int partId; - if (part == BackButtonStartPart || part == ForwardButtonStartPart) { - partId = horz ? DFCS_SCROLLLEFT : DFCS_SCROLLUP; - } else { - partId = horz ? DFCS_SCROLLRIGHT : DFCS_SCROLLDOWN; - } - - // Draw the thumb (the box you drag in the scroll bar to scroll). - ChromiumBridge::paintScrollbarArrow( - gc, - getThemeArrowState(scrollbar, part), - partId | getClassicThemeState(scrollbar, part), - rect); -} - -void ScrollbarThemeChromium::paintThumb(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect) -{ - bool horz = scrollbar->orientation() == HorizontalScrollbar; - - // Draw the thumb (the box you drag in the scroll bar to scroll). - ChromiumBridge::paintScrollbarThumb( - gc, - horz ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT, - getThemeState(scrollbar, ThumbPart), - getClassicThemeState(scrollbar, ThumbPart), - rect); - - // Draw the gripper (the three little lines on the thumb). - ChromiumBridge::paintScrollbarThumb( - gc, - horz ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT, - getThemeState(scrollbar, ThumbPart), - getClassicThemeState(scrollbar, ThumbPart), - rect); -} - -int ScrollbarThemeChromium::getThemeState(Scrollbar* scrollbar, ScrollbarPart part) const -{ - // When dragging the thumb, draw thumb pressed and other segments normal - // regardless of where the cursor actually is. See also four places in - // getThemeArrowState(). - if (scrollbar->pressedPart() == ThumbPart) { - if (part == ThumbPart) - return SCRBS_PRESSED; - return isVistaOrGreater() ? SCRBS_HOVER : SCRBS_NORMAL; - } - if (!scrollbar->enabled()) - return SCRBS_DISABLED; - if (scrollbar->hoveredPart() != part || part == BackTrackPart || part == ForwardTrackPart) - return (scrollbar->hoveredPart() == NoPart || !isVistaOrGreater()) ? SCRBS_NORMAL : SCRBS_HOVER; - if (scrollbar->pressedPart() == NoPart) - return SCRBS_HOT; - return (scrollbar->pressedPart() == part) ? SCRBS_PRESSED : SCRBS_NORMAL; -} - -int ScrollbarThemeChromium::getThemeArrowState(Scrollbar* scrollbar, ScrollbarPart part) const -{ - // We could take advantage of knowing the values in the state enum to write - // some simpler code, but treating the state enum as a black box seems - // clearer and more future-proof. - if (part == BackButtonStartPart || part == ForwardButtonStartPart) { - if (scrollbar->orientation() == HorizontalScrollbar) { - if (scrollbar->pressedPart() == ThumbPart) - return !isVistaOrGreater() ? ABS_LEFTNORMAL : ABS_LEFTHOVER; - if (!scrollbar->enabled()) - return ABS_LEFTDISABLED; - if (scrollbar->hoveredPart() != part) - return ((scrollbar->hoveredPart() == NoPart) || !isVistaOrGreater()) ? ABS_LEFTNORMAL : ABS_LEFTHOVER; - if (scrollbar->pressedPart() == NoPart) - return ABS_LEFTHOT; - return (scrollbar->pressedPart() == part) ? - ABS_LEFTPRESSED : ABS_LEFTNORMAL; - } - if (scrollbar->pressedPart() == ThumbPart) - return !isVistaOrGreater() ? ABS_UPNORMAL : ABS_UPHOVER; - if (!scrollbar->enabled()) - return ABS_UPDISABLED; - if (scrollbar->hoveredPart() != part) - return ((scrollbar->hoveredPart() == NoPart) || !isVistaOrGreater()) ? ABS_UPNORMAL : ABS_UPHOVER; - if (scrollbar->pressedPart() == NoPart) - return ABS_UPHOT; - return (scrollbar->pressedPart() == part) ? ABS_UPPRESSED : ABS_UPNORMAL; - } - if (scrollbar->orientation() == HorizontalScrollbar) { - if (scrollbar->pressedPart() == ThumbPart) - return !isVistaOrGreater() ? ABS_RIGHTNORMAL : ABS_RIGHTHOVER; - if (!scrollbar->enabled()) - return ABS_RIGHTDISABLED; - if (scrollbar->hoveredPart() != part) - return ((scrollbar->hoveredPart() == NoPart) || !isVistaOrGreater()) ? ABS_RIGHTNORMAL : ABS_RIGHTHOVER; - if (scrollbar->pressedPart() == NoPart) - return ABS_RIGHTHOT; - return (scrollbar->pressedPart() == part) ? ABS_RIGHTPRESSED : ABS_RIGHTNORMAL; - } - if (scrollbar->pressedPart() == ThumbPart) - return !isVistaOrGreater() ? ABS_DOWNNORMAL : ABS_DOWNHOVER; - if (!scrollbar->enabled()) - return ABS_DOWNDISABLED; - if (scrollbar->hoveredPart() != part) - return ((scrollbar->hoveredPart() == NoPart) || !isVistaOrGreater()) ? ABS_DOWNNORMAL : ABS_DOWNHOVER; - if (scrollbar->pressedPart() == NoPart) - return ABS_DOWNHOT; - return (scrollbar->pressedPart() == part) ? ABS_DOWNPRESSED : ABS_DOWNNORMAL; -} - -int ScrollbarThemeChromium::getClassicThemeState(Scrollbar* scrollbar, ScrollbarPart part) const -{ - // When dragging the thumb, draw the buttons normal even when hovered. - if (scrollbar->pressedPart() == ThumbPart) - return 0; - if (!scrollbar->enabled()) - return DFCS_INACTIVE; - if (scrollbar->hoveredPart() != part || part == BackTrackPart || part == ForwardTrackPart) - return 0; - if (scrollbar->pressedPart() == NoPart) - return DFCS_HOT; - return (scrollbar->pressedPart() == part) ? (DFCS_PUSHED | DFCS_FLAT) : 0; -} - -} diff --git a/webkit/port/platform/chromium/SearchPopupMenuChromium.cpp b/webkit/port/platform/chromium/SearchPopupMenuChromium.cpp deleted file mode 100644 index d16ffa6..0000000 --- a/webkit/port/platform/chromium/SearchPopupMenuChromium.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Inc. - * - * 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., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" -#include "SearchPopupMenu.h" - -#include "AtomicString.h" -#include "NotImplemented.h" - -namespace WebCore { - -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) -{ -} - -bool SearchPopupMenu::enabled() -{ - // FIXME: <rdar://problem/5057218> Reenable "recent searches" search field menu when menu is fully implemented - return false; -} - -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) -{ - notImplemented(); -} - -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) -{ - notImplemented(); -} - -} diff --git a/webkit/port/platform/chromium/SharedTimerChromium.cpp b/webkit/port/platform/chromium/SharedTimerChromium.cpp deleted file mode 100644 index e942437..0000000 --- a/webkit/port/platform/chromium/SharedTimerChromium.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "ChromiumBridge.h" -#include "SharedTimer.h" - -namespace WebCore { - -void setSharedTimerFiredFunction(void (*f)()) -{ - ChromiumBridge::setSharedTimerFiredFunction(f); -} - -void setSharedTimerFireTime(double fireTime) -{ - ChromiumBridge::setSharedTimerFireTime(fireTime); -} - -void stopSharedTimer() -{ - ChromiumBridge::stopSharedTimer(); -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/SoundChromiumPosix.cpp b/webkit/port/platform/chromium/SoundChromiumPosix.cpp deleted file mode 100644 index 4e3790a..0000000 --- a/webkit/port/platform/chromium/SoundChromiumPosix.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "Sound.h" - -#include "NotImplemented.h" - -namespace WebCore { - -void systemBeep() -{ - notImplemented(); -} - -} diff --git a/webkit/port/platform/chromium/SoundChromiumWin.cpp b/webkit/port/platform/chromium/SoundChromiumWin.cpp deleted file mode 100644 index 38c5995..0000000 --- a/webkit/port/platform/chromium/SoundChromiumWin.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "Sound.h" - -#include <Windows.h> - -namespace WebCore { - -void systemBeep() { MessageBeep(static_cast<UINT>(-1)); } - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/SystemTimeChromium.cpp b/webkit/port/platform/chromium/SystemTimeChromium.cpp deleted file mode 100644 index 857d767..0000000 --- a/webkit/port/platform/chromium/SystemTimeChromium.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "SystemTime.h" - -#include "NotImplemented.h" -#include "ChromiumBridge.h" - -namespace WebCore { - -// Get the current time in seconds since epoch. -double currentTime() -{ - return ChromiumBridge::currentTime(); -} - -float userIdleTime() -{ - // Needed for back/forward cache. - notImplemented(); - return 0.0F; -} - -} diff --git a/webkit/port/platform/chromium/TemporaryLinkStubs.cpp b/webkit/port/platform/chromium/TemporaryLinkStubs.cpp deleted file mode 100644 index 637c353..0000000 --- a/webkit/port/platform/chromium/TemporaryLinkStubs.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2008, Google 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: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * 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. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT - * OWNER OR 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 "KURL.h" -#include "NotImplemented.h" -#include "SharedBuffer.h" - -namespace WebCore { - -String signedPublicKeyAndChallengeString(unsigned, const String&, const KURL&) { notImplemented(); return String(); } -void getSupportedKeySizes(Vector<String>&) { notImplemented(); } - -String KURL::fileSystemPath() const { notImplemented(); return String(); } - -PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String&) { notImplemented(); return 0; } - -} // namespace WebCore - -// Required to use notImplemented() outside of the WebCore namespace. -using namespace WebCore; - -namespace WTF { - -#if !defined(__linux__) -void scheduleDispatchFunctionsOnMainThread() { notImplemented(); } -#endif - -} // namespace WTF diff --git a/webkit/port/platform/chromium/TextBoundariesChromium.cpp b/webkit/port/platform/chromium/TextBoundariesChromium.cpp deleted file mode 100644 index d226048..0000000 --- a/webkit/port/platform/chromium/TextBoundariesChromium.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "TextBoundaries.h" - -#include <unicode/ubrk.h> - -#include "StringImpl.h" -#include "TextBreakIterator.h" - -namespace WebCore { - -int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward) -{ - UBreakIterator* it = wordBreakIterator(chars, len); - - if (forward) { - position = ubrk_following(it, position); - while (position != UBRK_DONE) { - // We stop searching when the character preceeding the break - // is alphanumeric. - if (position < len && u_isalnum(chars[position - 1])) - return position; - - position = ubrk_following(it, position); - } - - return len; - } else { - position = ubrk_preceding(it, position); - while (position != UBRK_DONE) { - // We stop searching when the character following the break - // is alphanumeric. - if (position > 0 && u_isalnum(chars[position])) - return position; - - position = ubrk_preceding(it, position); - } - - return 0; - } -} - -void findWordBoundary(const UChar* chars, int len, int position, int* start, int* end) -{ - UBreakIterator* it = wordBreakIterator(chars, len); - *end = ubrk_following(it, position); - if (*end < 0) - *end = ubrk_last(it); - *start = ubrk_previous(it); -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/TextBreakIteratorInternalICUChromium.cpp b/webkit/port/platform/chromium/TextBreakIteratorInternalICUChromium.cpp deleted file mode 100644 index 000ae9b..0000000 --- a/webkit/port/platform/chromium/TextBreakIteratorInternalICUChromium.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * 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., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#include "config.h" -#include "TextBreakIteratorInternalICU.h" - -namespace WebCore { - -const char* currentTextBreakLocaleID() -{ - return "en_us"; -} - -} diff --git a/webkit/port/platform/chromium/WidgetChromium.cpp b/webkit/port/platform/chromium/WidgetChromium.cpp deleted file mode 100644 index e980370..0000000 --- a/webkit/port/platform/chromium/WidgetChromium.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR - * 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 "Widget.h" - -#include "ChromiumBridge.h" -#include "Assertions.h" -#include "NotImplemented.h" - -namespace WebCore { - -Widget::Widget(PlatformWidget widget) -{ - init(widget); -} - -Widget::~Widget() -{ - ASSERT(!parent()); -} - -void Widget::show() -{ -} - -void Widget::hide() -{ -} - -void Widget::setCursor(const Cursor& cursor) -{ - ChromiumBridge::widgetSetCursor(this, cursor); -} - -void Widget::paint(GraphicsContext*, const IntRect&) -{ -} - -void Widget::setFocus() -{ - ChromiumBridge::widgetSetFocus(this); -} - -void Widget::setIsSelected(bool) -{ -} - -IntRect Widget::frameRect() const -{ - return m_frame; -} - -void Widget::setFrameRect(const IntRect& rect) -{ - m_frame = rect; -} - -} // namespace WebCore diff --git a/webkit/port/platform/chromium/gtk2drawing.c b/webkit/port/platform/chromium/gtk2drawing.c deleted file mode 100644 index 475e9fd..0000000 --- a/webkit/port/platform/chromium/gtk2drawing.c +++ /dev/null @@ -1,2815 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Brian Ryner <bryner@brianryner.com> (Original Author) - * Pierre Chanial <p_ch@verizon.net> - * Michael Ventnor <m.ventnor@gmail.com> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* - * This file contains painting functions for each of the gtk2 widgets. - * Adapted from the gtkdrawing.c, and gtk+2.0 source. - */ - -#include <gtk/gtk.h> -#include <gdk/gdkprivate.h> -#include <string.h> -#include "gtkdrawing.h" - -#include <math.h> - -#define XTHICKNESS(style) (style->xthickness) -#define YTHICKNESS(style) (style->ythickness) -#define WINDOW_IS_MAPPED(window) ((window) && GDK_IS_WINDOW(window) && gdk_window_is_visible(window)) - -static GtkWidget* gProtoWindow; -static GtkWidget* gButtonWidget; -static GtkWidget* gToggleButtonWidget; -static GtkWidget* gCheckboxWidget; -static GtkWidget* gRadiobuttonWidget; -static GtkWidget* gHorizScrollbarWidget; -static GtkWidget* gVertScrollbarWidget; -static GtkWidget* gSpinWidget; -static GtkWidget* gHScaleWidget; -static GtkWidget* gVScaleWidget; -static GtkWidget* gEntryWidget; -static GtkWidget* gArrowWidget; -static GtkWidget* gOptionMenuWidget; -static GtkWidget* gComboBoxEntryWidget; -static GtkWidget* gDropdownEntryWidget; -static GtkWidget* gDropdownButtonWidget; -static GtkWidget* gHandleBoxWidget; -static GtkWidget* gToolbarWidget; -static GtkWidget* gFrameWidget; -static GtkWidget* gStatusbarWidget; -static GtkWidget* gProgressWidget; -static GtkWidget* gTabWidget; -static GtkWidget* gTooltipWidget; -static GtkWidget* gMenuBarWidget; -static GtkWidget* gMenuBarItemWidget; -static GtkWidget* gMenuPopupWidget; -static GtkWidget* gMenuItemWidget; -static GtkWidget* gCheckMenuItemWidget; -static GtkWidget* gTreeViewWidget; -static GtkWidget* gTreeHeaderCellWidget; -static GtkWidget* gTreeHeaderSortArrowWidget; -static GtkWidget* gExpanderWidget; -static GtkWidget* gToolbarSeparatorWidget; -static GtkWidget* gMenuSeparatorWidget; -static GtkWidget* gHPanedWidget; -static GtkWidget* gVPanedWidget; - -static GtkShadowType gMenuBarShadowType; -static GtkShadowType gToolbarShadowType; - -static style_prop_t style_prop_func; -static gboolean have_menu_shadow_type; -static gboolean is_initialized; - -gint -moz_gtk_enable_style_props(style_prop_t styleGetProp) -{ - style_prop_func = styleGetProp; - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_window_widget() -{ - if (!gProtoWindow) { - gProtoWindow = gtk_window_new(GTK_WINDOW_POPUP); - gtk_widget_realize(gProtoWindow); - } - return MOZ_GTK_SUCCESS; -} - -static gint -setup_widget_prototype(GtkWidget* widget) -{ - static GtkWidget* protoLayout; - ensure_window_widget(); - if (!protoLayout) { - protoLayout = gtk_fixed_new(); - gtk_container_add(GTK_CONTAINER(gProtoWindow), protoLayout); - } - - gtk_container_add(GTK_CONTAINER(protoLayout), widget); - gtk_widget_realize(widget); - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_button_widget() -{ - if (!gButtonWidget) { - gButtonWidget = gtk_button_new_with_label("M"); - setup_widget_prototype(gButtonWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_hpaned_widget() -{ - if (!gHPanedWidget) { - gHPanedWidget = gtk_hpaned_new(); - setup_widget_prototype(gHPanedWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_vpaned_widget() -{ - if (!gVPanedWidget) { - gVPanedWidget = gtk_vpaned_new(); - setup_widget_prototype(gVPanedWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_toggle_button_widget() -{ - if (!gToggleButtonWidget) { - gToggleButtonWidget = gtk_toggle_button_new(); - setup_widget_prototype(gToggleButtonWidget); - /* toggle button must be set active to get the right style on hover. */ - GTK_TOGGLE_BUTTON(gToggleButtonWidget)->active = TRUE; - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_checkbox_widget() -{ - if (!gCheckboxWidget) { - gCheckboxWidget = gtk_check_button_new_with_label("M"); - setup_widget_prototype(gCheckboxWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_radiobutton_widget() -{ - if (!gRadiobuttonWidget) { - gRadiobuttonWidget = gtk_radio_button_new_with_label(NULL, "M"); - setup_widget_prototype(gRadiobuttonWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_scrollbar_widget() -{ - if (!gVertScrollbarWidget) { - gVertScrollbarWidget = gtk_vscrollbar_new(NULL); - setup_widget_prototype(gVertScrollbarWidget); - } - if (!gHorizScrollbarWidget) { - gHorizScrollbarWidget = gtk_hscrollbar_new(NULL); - setup_widget_prototype(gHorizScrollbarWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_spin_widget() -{ - if (!gSpinWidget) { - gSpinWidget = gtk_spin_button_new(NULL, 1, 0); - setup_widget_prototype(gSpinWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_scale_widget() -{ - if (!gHScaleWidget) { - gHScaleWidget = gtk_hscale_new(NULL); - setup_widget_prototype(gHScaleWidget); - } - if (!gVScaleWidget) { - gVScaleWidget = gtk_vscale_new(NULL); - setup_widget_prototype(gVScaleWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_entry_widget() -{ - if (!gEntryWidget) { - gEntryWidget = gtk_entry_new(); - setup_widget_prototype(gEntryWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_option_menu_widget() -{ - if (!gOptionMenuWidget) { - gOptionMenuWidget = gtk_option_menu_new(); - setup_widget_prototype(gOptionMenuWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_combo_box_entry_widget() -{ - if (!gComboBoxEntryWidget) { - gComboBoxEntryWidget = gtk_combo_box_entry_new(); - setup_widget_prototype(gComboBoxEntryWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_dropdown_entry_widget() -{ - if (!gDropdownEntryWidget) { - ensure_combo_box_entry_widget(); - - gDropdownEntryWidget = GTK_BIN(gComboBoxEntryWidget)->child; - gtk_widget_realize(gDropdownEntryWidget); - } - return MOZ_GTK_SUCCESS; -} - -static void -moz_gtk_get_dropdown_button(GtkWidget *widget, - gpointer client_data) -{ - if (GTK_IS_TOGGLE_BUTTON(widget)) - gDropdownButtonWidget = widget; -} - -static gint -ensure_arrow_widget() -{ - if (!gArrowWidget) { - ensure_combo_box_entry_widget(); - - gtk_container_forall(GTK_CONTAINER(gComboBoxEntryWidget), - moz_gtk_get_dropdown_button, - NULL); - - gArrowWidget = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT); - gtk_container_add(GTK_CONTAINER(GTK_BIN(gDropdownButtonWidget)->child), - gArrowWidget); - gtk_widget_realize(gArrowWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_handlebox_widget() -{ - if (!gHandleBoxWidget) { - gHandleBoxWidget = gtk_handle_box_new(); - setup_widget_prototype(gHandleBoxWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_toolbar_widget() -{ - if (!gToolbarWidget) { - ensure_handlebox_widget(); - gToolbarWidget = gtk_toolbar_new(); - gtk_container_add(GTK_CONTAINER(gHandleBoxWidget), gToolbarWidget); - gtk_widget_realize(gToolbarWidget); - gtk_widget_style_get(gToolbarWidget, "shadow_type", &gToolbarShadowType, - NULL); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_toolbar_separator_widget() -{ - if (!gToolbarSeparatorWidget) { - ensure_toolbar_widget(); - gToolbarSeparatorWidget = GTK_WIDGET(gtk_separator_tool_item_new()); - setup_widget_prototype(gToolbarSeparatorWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_tooltip_widget() -{ - if (!gTooltipWidget) { - gTooltipWidget = gtk_window_new(GTK_WINDOW_POPUP); - gtk_widget_realize(gTooltipWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_tab_widget() -{ - if (!gTabWidget) { - gTabWidget = gtk_notebook_new(); - setup_widget_prototype(gTabWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_progress_widget() -{ - if (!gProgressWidget) { - gProgressWidget = gtk_progress_bar_new(); - setup_widget_prototype(gProgressWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_statusbar_widget() -{ - if (!gStatusbarWidget) { - gStatusbarWidget = gtk_statusbar_new(); - setup_widget_prototype(gStatusbarWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_frame_widget() -{ - if (!gFrameWidget) { - ensure_statusbar_widget(); - gFrameWidget = gtk_frame_new(NULL); - gtk_container_add(GTK_CONTAINER(gStatusbarWidget), gFrameWidget); - gtk_widget_realize(gFrameWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_menu_bar_widget() -{ - if (!gMenuBarWidget) { - gMenuBarWidget = gtk_menu_bar_new(); - setup_widget_prototype(gMenuBarWidget); - gtk_widget_style_get(gMenuBarWidget, "shadow_type", &gMenuBarShadowType, - NULL); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_menu_bar_item_widget() -{ - if (!gMenuBarItemWidget) { - ensure_menu_bar_widget(); - gMenuBarItemWidget = gtk_menu_item_new(); - gtk_menu_shell_append(GTK_MENU_SHELL(gMenuBarWidget), - gMenuBarItemWidget); - gtk_widget_realize(gMenuBarItemWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_menu_popup_widget() -{ - if (!gMenuPopupWidget) { - ensure_menu_bar_item_widget(); - gMenuPopupWidget = gtk_menu_new(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(gMenuBarItemWidget), - gMenuPopupWidget); - gtk_widget_realize(gMenuPopupWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_menu_item_widget() -{ - if (!gMenuItemWidget) { - ensure_menu_popup_widget(); - gMenuItemWidget = gtk_menu_item_new_with_label("M"); - gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget), - gMenuItemWidget); - gtk_widget_realize(gMenuItemWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_menu_separator_widget() -{ - if (!gMenuSeparatorWidget) { - ensure_menu_popup_widget(); - gMenuSeparatorWidget = gtk_separator_menu_item_new(); - gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget), - gMenuSeparatorWidget); - gtk_widget_realize(gMenuSeparatorWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_check_menu_item_widget() -{ - if (!gCheckMenuItemWidget) { - ensure_menu_popup_widget(); - gCheckMenuItemWidget = gtk_check_menu_item_new_with_label("M"); - gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget), - gCheckMenuItemWidget); - gtk_widget_realize(gCheckMenuItemWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_tree_view_widget() -{ - if (!gTreeViewWidget) { - gTreeViewWidget = gtk_tree_view_new(); - setup_widget_prototype(gTreeViewWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_tree_header_cell_widget() -{ - if(!gTreeHeaderCellWidget) { - GtkTreeViewColumn* treeViewColumn; - ensure_tree_view_widget(); - - treeViewColumn = gtk_tree_view_column_new(); - gtk_tree_view_column_set_title(treeViewColumn, "M"); - - gtk_tree_view_append_column(GTK_TREE_VIEW(gTreeViewWidget), treeViewColumn); - gTreeHeaderCellWidget = treeViewColumn->button; - gtk_tree_view_column_set_sort_indicator(treeViewColumn, TRUE); - gTreeHeaderSortArrowWidget = treeViewColumn->arrow; - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_expander_widget() -{ - if (!gExpanderWidget) { - gExpanderWidget = gtk_expander_new("M"); - setup_widget_prototype(gExpanderWidget); - } - return MOZ_GTK_SUCCESS; -} - -static GtkStateType -ConvertGtkState(GtkWidgetState* state) -{ - if (state->disabled) - return GTK_STATE_INSENSITIVE; - else if (state->depressed) - return (state->inHover ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE); - else if (state->inHover) - return (state->active ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT); - else - return GTK_STATE_NORMAL; -} - -static gint -TSOffsetStyleGCArray(GdkGC** gcs, gint xorigin, gint yorigin) -{ - int i; - /* there are 5 gc's in each array, for each of the widget states */ - for (i = 0; i < 5; ++i) - gdk_gc_set_ts_origin(gcs[i], xorigin, yorigin); - return MOZ_GTK_SUCCESS; -} - -static gint -TSOffsetStyleGCs(GtkStyle* style, gint xorigin, gint yorigin) -{ - TSOffsetStyleGCArray(style->fg_gc, xorigin, yorigin); - TSOffsetStyleGCArray(style->bg_gc, xorigin, yorigin); - TSOffsetStyleGCArray(style->light_gc, xorigin, yorigin); - TSOffsetStyleGCArray(style->dark_gc, xorigin, yorigin); - TSOffsetStyleGCArray(style->mid_gc, xorigin, yorigin); - TSOffsetStyleGCArray(style->text_gc, xorigin, yorigin); - TSOffsetStyleGCArray(style->base_gc, xorigin, yorigin); - gdk_gc_set_ts_origin(style->black_gc, xorigin, yorigin); - gdk_gc_set_ts_origin(style->white_gc, xorigin, yorigin); - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_button_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkReliefStyle relief, GtkWidget* widget, - GtkTextDirection direction) -{ - GtkShadowType shadow_type; - GtkStyle* style = widget->style; - GtkStateType button_state = ConvertGtkState(state); - gint x = rect->x, y=rect->y, width=rect->width, height=rect->height; - - gboolean interior_focus; - gint focus_width, focus_pad; - - moz_gtk_widget_get_focus(widget, &interior_focus, &focus_width, &focus_pad); - - if (WINDOW_IS_MAPPED(drawable)) { - gdk_window_set_back_pixmap(drawable, NULL, TRUE); - gdk_window_clear_area(drawable, cliprect->x, cliprect->y, - cliprect->width, cliprect->height); - } - - gtk_widget_set_state(widget, button_state); - gtk_widget_set_direction(widget, direction); - - if (state->isDefault) - GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_DEFAULT); - - if (!interior_focus && state->focused) { - x += focus_width + focus_pad; - y += focus_width + focus_pad; - width -= 2 * (focus_width + focus_pad); - height -= 2 * (focus_width + focus_pad); - } - - shadow_type = button_state == GTK_STATE_ACTIVE || - state->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT; - - if (state->isDefault && GTK_BUTTON(widget)->relief == GTK_RELIEF_NORMAL) { - gtk_paint_box(style, drawable, button_state, shadow_type, cliprect, - widget, "buttondefault", x, y, width, height); - } - - if (relief != GTK_RELIEF_NONE || state->depressed || - (button_state != GTK_STATE_NORMAL && - button_state != GTK_STATE_INSENSITIVE)) { - TSOffsetStyleGCs(style, x, y); - /* the following line can trigger an assertion (Crux theme) - file ../../gdk/gdkwindow.c: line 1846 (gdk_window_clear_area): - assertion `GDK_IS_WINDOW (window)' failed */ - gtk_paint_box(style, drawable, button_state, shadow_type, cliprect, - widget, "button", x, y, width, height); - } - - if (state->focused) { - if (interior_focus) { - x += widget->style->xthickness + focus_pad; - y += widget->style->ythickness + focus_pad; - width -= 2 * (widget->style->xthickness + focus_pad); - height -= 2 * (widget->style->ythickness + focus_pad); - } else { - x -= focus_width + focus_pad; - y -= focus_width + focus_pad; - width += 2 * (focus_width + focus_pad); - height += 2 * (focus_width + focus_pad); - } - - TSOffsetStyleGCs(style, x, y); - gtk_paint_focus(style, drawable, button_state, cliprect, - widget, "button", x, y, width, height); - } - - GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_DEFAULT); - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_init() -{ - is_initialized = TRUE; - have_menu_shadow_type = - (gtk_major_version > 2 || - (gtk_major_version == 2 && gtk_minor_version >= 1)); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing) -{ - ensure_checkbox_widget(); - - gtk_widget_style_get (gCheckboxWidget, - "indicator_size", indicator_size, - "indicator_spacing", indicator_spacing, - NULL); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing) -{ - ensure_radiobutton_widget(); - - gtk_widget_style_get (gRadiobuttonWidget, - "indicator_size", indicator_size, - "indicator_spacing", indicator_spacing, - NULL); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_widget_get_focus(GtkWidget* widget, gboolean* interior_focus, - gint* focus_width, gint* focus_pad) -{ - gtk_widget_style_get (widget, - "interior-focus", interior_focus, - "focus-line-width", focus_width, - "focus-padding", focus_pad, - NULL); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_option_menu_get_metrics(gboolean* interior_focus, - GtkRequisition* indicator_size, - GtkBorder* indicator_spacing, - gint* focus_width, - gint* focus_pad) -{ - static const GtkRequisition default_indicator_size = { 7, 13 }; - static const GtkBorder default_indicator_spacing = { 7, 5, 2, 2 }; - /* these default values are not used in gtkoptionmenu.c - static const gboolean default_interior_focus = TRUE; - static const gint default_focus_width = 1; - static const gint default_focus_pad = 0; */ - GtkRequisition *tmp_indicator_size; - GtkBorder *tmp_indicator_spacing; - - gtk_widget_style_get(gOptionMenuWidget, - "interior_focus", interior_focus, - "indicator_size", &tmp_indicator_size, - "indicator_spacing", &tmp_indicator_spacing, - "focus_line_width", focus_width, - "focus_padding", focus_pad, - NULL); - - if (tmp_indicator_size) - *indicator_size = *tmp_indicator_size; - else - *indicator_size = default_indicator_size; - if (tmp_indicator_spacing) - *indicator_spacing = *tmp_indicator_spacing; - else - *indicator_spacing = default_indicator_spacing; - - gtk_requisition_free(tmp_indicator_size); - gtk_border_free(tmp_indicator_spacing); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_splitter_get_metrics(gint orientation, gint* size) -{ - if (orientation == GTK_ORIENTATION_HORIZONTAL) { - ensure_hpaned_widget(); - gtk_widget_style_get(gHPanedWidget, "handle_size", size, NULL); - } else { - ensure_vpaned_widget(); - gtk_widget_style_get(gVPanedWidget, "handle_size", size, NULL); - } - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_toggle_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - gboolean selected, gboolean isradio, - GtkTextDirection direction) -{ - GtkStateType state_type = ConvertGtkState(state); - GtkShadowType shadow_type = (selected)?GTK_SHADOW_IN:GTK_SHADOW_OUT; - gint indicator_size, indicator_spacing; - gint x, y, width, height; - GtkWidget *w; - GtkStyle *style; - - if (isradio) { - moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing); - w = gRadiobuttonWidget; - } else { - moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing); - w = gCheckboxWidget; - } - - /* offset by indicator_spacing, and centered vertically within the rect */ - x = rect->x + indicator_spacing; - y = rect->y + (rect->height - indicator_size) / 2; - width = indicator_size; - height = indicator_size; - - style = w->style; - TSOffsetStyleGCs(style, x, y); - - gtk_widget_set_sensitive(w, !state->disabled); - gtk_widget_set_direction(w, direction); - GTK_TOGGLE_BUTTON(w)->active = selected; - - if (isradio) { - gtk_paint_option(style, drawable, state_type, shadow_type, cliprect, - gRadiobuttonWidget, "radiobutton", x, y, - width, height); - if (state->focused) { - gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect, - gRadiobuttonWidget, "radiobutton", rect->x, rect->y, - rect->width, rect->height); - } - } - else { - gtk_paint_check(style, drawable, state_type, shadow_type, cliprect, - gCheckboxWidget, "checkbutton", x, y, width, height); - if (state->focused) { - gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect, - gCheckboxWidget, "checkbutton", rect->x, rect->y, - rect->width, rect->height); - } - } - - return MOZ_GTK_SUCCESS; -} - -static gint -calculate_arrow_dimensions(GdkRectangle* rect, GdkRectangle* arrow_rect) -{ - GtkMisc* misc = GTK_MISC(gArrowWidget); - - gint extent = MIN(rect->width - misc->xpad * 2, - rect->height - misc->ypad * 2); - - arrow_rect->x = ((rect->x + misc->xpad) * (1.0 - misc->xalign) + - (rect->x + rect->width - extent - misc->xpad) * - misc->xalign); - - arrow_rect->y = ((rect->y + misc->ypad) * (1.0 - misc->yalign) + - (rect->y + rect->height - extent - misc->ypad) * - misc->yalign); - - arrow_rect->width = arrow_rect->height = extent; - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_scrollbar_button_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkScrollbarButtonFlags flags, - GtkTextDirection direction) -{ - GtkStateType state_type = ConvertGtkState(state); - GtkShadowType shadow_type = (state->active) ? - GTK_SHADOW_IN : GTK_SHADOW_OUT; - GdkRectangle button_rect; - GdkRectangle arrow_rect; - GtkStyle* style; - GtkWidget *scrollbar; - GtkArrowType arrow_type; - const char* detail = (flags & MOZ_GTK_STEPPER_VERTICAL) ? - "vscrollbar" : "hscrollbar"; - - ensure_scrollbar_widget(); - - if (flags & MOZ_GTK_STEPPER_VERTICAL) - scrollbar = gVertScrollbarWidget; - else - scrollbar = gHorizScrollbarWidget; - - gtk_widget_set_direction(scrollbar, direction); - - /* Some theme engines (i.e., ClearLooks) check the scrollbar's allocation - to determine where it should paint rounded corners on the buttons. - We need to trick them into drawing the buttons the way we want them. */ - - scrollbar->allocation.x = rect->x; - scrollbar->allocation.y = rect->y; - scrollbar->allocation.width = rect->width; - scrollbar->allocation.height = rect->height; - - if (flags & MOZ_GTK_STEPPER_VERTICAL) { - scrollbar->allocation.height *= 5; - if (flags & MOZ_GTK_STEPPER_DOWN) { - arrow_type = GTK_ARROW_DOWN; - if (flags & MOZ_GTK_STEPPER_BOTTOM) - scrollbar->allocation.y -= 4 * rect->height; - else - scrollbar->allocation.y -= rect->height; - - } else { - arrow_type = GTK_ARROW_UP; - if (flags & MOZ_GTK_STEPPER_BOTTOM) - scrollbar->allocation.y -= 3 * rect->height; - } - } else { - scrollbar->allocation.width *= 5; - if (flags & MOZ_GTK_STEPPER_DOWN) { - arrow_type = GTK_ARROW_RIGHT; - if (flags & MOZ_GTK_STEPPER_BOTTOM) - scrollbar->allocation.x -= 4 * rect->width; - else - scrollbar->allocation.x -= rect->width; - } else { - arrow_type = GTK_ARROW_LEFT; - if (flags & MOZ_GTK_STEPPER_BOTTOM) - scrollbar->allocation.x -= 3 * rect->width; - } - } - - style = scrollbar->style; - - ensure_arrow_widget(); - - calculate_arrow_dimensions(rect, &button_rect); - TSOffsetStyleGCs(style, button_rect.x, button_rect.y); - - gtk_paint_box(style, drawable, state_type, shadow_type, cliprect, - scrollbar, detail, button_rect.x, button_rect.y, - button_rect.width, button_rect.height); - - arrow_rect.width = button_rect.width / 2; - arrow_rect.height = button_rect.height / 2; - arrow_rect.x = button_rect.x + (button_rect.width - arrow_rect.width) / 2; - arrow_rect.y = button_rect.y + - (button_rect.height - arrow_rect.height) / 2; - - gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, - scrollbar, detail, arrow_type, TRUE, arrow_rect.x, - arrow_rect.y, arrow_rect.width, arrow_rect.height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_scrollbar_trough_paint(GtkThemeWidgetType widget, - GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkTextDirection direction) -{ - GtkStyle* style; - GtkScrollbar *scrollbar; - - ensure_scrollbar_widget(); - - if (widget == MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL) - scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget); - else - scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget); - - gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction); - - style = GTK_WIDGET(scrollbar)->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_ACTIVE, - cliprect, rect->x, rect->y, - rect->width, rect->height); - - gtk_paint_box(style, drawable, GTK_STATE_ACTIVE, GTK_SHADOW_IN, cliprect, - GTK_WIDGET(scrollbar), "trough", rect->x, rect->y, - rect->width, rect->height); - - if (state->focused) { - gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect, - GTK_WIDGET(scrollbar), "trough", - rect->x, rect->y, rect->width, rect->height); - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_scrollbar_thumb_paint(GtkThemeWidgetType widget, - GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkTextDirection direction) -{ - GtkStateType state_type = (state->inHover || state->active) ? - GTK_STATE_PRELIGHT : GTK_STATE_NORMAL; - GtkStyle* style; - GtkScrollbar *scrollbar; - GtkAdjustment *adj; - - ensure_scrollbar_widget(); - - if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) - scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget); - else - scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget); - - gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction); - - /* Make sure to set the scrollbar range before painting so that - everything is drawn properly. At least the bluecurve (and - maybe other) themes don't draw the top or bottom black line - surrounding the scrollbar if the theme thinks that it's butted - up against the scrollbar arrows. Note the increases of the - clip rect below. */ - /* Changing the cliprect is pretty bogus. This lets themes draw - outside the frame, which means we don't invalidate them - correctly. See bug 297508. But some themes do seem to need - it. So we modify the frame's overflow area to account for what - we're doing here; see nsNativeThemeGTK::GetWidgetOverflow. */ - adj = gtk_range_get_adjustment(GTK_RANGE(scrollbar)); - - if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) { - cliprect->x -= 1; - cliprect->width += 2; - adj->page_size = rect->width; - } - else { - cliprect->y -= 1; - cliprect->height += 2; - adj->page_size = rect->height; - } - - adj->lower = 0; - adj->value = state->curpos; - adj->upper = state->maxpos; - gtk_adjustment_changed(adj); - - style = GTK_WIDGET(scrollbar)->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - - gtk_paint_slider(style, drawable, state_type, GTK_SHADOW_OUT, cliprect, - GTK_WIDGET(scrollbar), "slider", rect->x, rect->y, - rect->width, rect->height, - (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) ? - GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_spin_paint(GdkDrawable* drawable, GdkRectangle* rect, - GtkTextDirection direction) -{ - GtkStyle* style; - - ensure_spin_widget(); - gtk_widget_set_direction(gSpinWidget, direction); - style = gSpinWidget->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL, - gSpinWidget, "spinbutton", - rect->x, rect->y, rect->width, rect->height); - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_spin_updown_paint(GdkDrawable* drawable, GdkRectangle* rect, - gboolean isDown, GtkWidgetState* state, - GtkTextDirection direction) -{ - GdkRectangle arrow_rect; - GtkStateType state_type = ConvertGtkState(state); - GtkShadowType shadow_type = state_type == GTK_STATE_ACTIVE ? - GTK_SHADOW_IN : GTK_SHADOW_OUT; - GtkStyle* style; - - ensure_spin_widget(); - style = gSpinWidget->style; - gtk_widget_set_direction(gSpinWidget, direction); - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_box(style, drawable, state_type, shadow_type, NULL, gSpinWidget, - isDown ? "spinbutton_down" : "spinbutton_up", - rect->x, rect->y, rect->width, rect->height); - - /* hard code these values */ - arrow_rect.width = 6; - arrow_rect.height = 6; - arrow_rect.x = rect->x + (rect->width - arrow_rect.width) / 2; - arrow_rect.y = rect->y + (rect->height - arrow_rect.height) / 2; - arrow_rect.y += isDown ? -1 : 1; - - gtk_paint_arrow(style, drawable, state_type, shadow_type, NULL, - gSpinWidget, "spinbutton", - isDown ? GTK_ARROW_DOWN : GTK_ARROW_UP, TRUE, - arrow_rect.x, arrow_rect.y, - arrow_rect.width, arrow_rect.height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_scale_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkOrientation flags, GtkTextDirection direction) -{ - gint x = 0, y = 0; - GtkStateType state_type = ConvertGtkState(state); - GtkStyle* style; - GtkWidget* widget; - - ensure_scale_widget(); - widget = ((flags == GTK_ORIENTATION_HORIZONTAL) ? gHScaleWidget : gVScaleWidget); - gtk_widget_set_direction(widget, direction); - - style = widget->style; - - if (flags == GTK_ORIENTATION_HORIZONTAL) { - x = XTHICKNESS(style); - y++; - } - else { - x++; - y = YTHICKNESS(style); - } - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL, - cliprect, rect->x, rect->y, - rect->width, rect->height); - - gtk_paint_box(style, drawable, GTK_STATE_ACTIVE, GTK_SHADOW_IN, cliprect, - widget, "trough", rect->x + x, rect->y + y, - rect->width - 2*x, rect->height - 2*y); - - if (state->focused) - gtk_paint_focus(style, drawable, state_type, cliprect, widget, "trough", - rect->x, rect->y, rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_scale_thumb_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkOrientation flags, GtkTextDirection direction) -{ - GtkStateType state_type = ConvertGtkState(state); - GtkStyle* style; - GtkWidget* widget; - gint thumb_width, thumb_height, x, y; - - ensure_scale_widget(); - widget = ((flags == GTK_ORIENTATION_HORIZONTAL) ? gHScaleWidget : gVScaleWidget); - gtk_widget_set_direction(widget, direction); - - style = widget->style; - - /* determine the thumb size, and position the thumb in the center in the opposite axis */ - if (flags == GTK_ORIENTATION_HORIZONTAL) { - moz_gtk_get_scalethumb_metrics(GTK_ORIENTATION_HORIZONTAL, &thumb_width, &thumb_height); - x = rect->x; - y = rect->y + (rect->height - thumb_height) / 2; - } - else { - moz_gtk_get_scalethumb_metrics(GTK_ORIENTATION_VERTICAL, &thumb_height, &thumb_width); - x = rect->x + (rect->width - thumb_width) / 2; - y = rect->y; - } - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_slider(style, drawable, state_type, GTK_SHADOW_OUT, cliprect, - widget, (flags == GTK_ORIENTATION_HORIZONTAL) ? "hscale" : "vscale", - x, y, thumb_width, thumb_height, flags); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_gripper_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkTextDirection direction) -{ - GtkStateType state_type = ConvertGtkState(state); - GtkShadowType shadow_type; - GtkStyle* style; - - ensure_handlebox_widget(); - gtk_widget_set_direction(gHandleBoxWidget, direction); - - style = gHandleBoxWidget->style; - shadow_type = GTK_HANDLE_BOX(gHandleBoxWidget)->shadow_type; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_box(style, drawable, state_type, shadow_type, cliprect, - gHandleBoxWidget, "handlebox_bin", rect->x, rect->y, - rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_hpaned_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state) -{ - GtkStateType hpaned_state = ConvertGtkState(state); - - ensure_hpaned_widget(); - gtk_paint_handle(gHPanedWidget->style, drawable, hpaned_state, - GTK_SHADOW_NONE, cliprect, gHPanedWidget, "paned", - rect->x, rect->y, rect->width, rect->height, - GTK_ORIENTATION_VERTICAL); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_vpaned_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state) -{ - GtkStateType vpaned_state = ConvertGtkState(state); - - ensure_vpaned_widget(); - gtk_paint_handle(gVPanedWidget->style, drawable, vpaned_state, - GTK_SHADOW_NONE, cliprect, gVPanedWidget, "paned", - rect->x, rect->y, rect->width, rect->height, - GTK_ORIENTATION_HORIZONTAL); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_entry_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkWidget* widget, GtkTextDirection direction) -{ - gint x, y, width = rect->width, height = rect->height; - GtkStyle* style; - gboolean interior_focus; - gint focus_width; - - gtk_widget_set_direction(widget, direction); - - style = widget->style; - - /* paint the background first */ - x = XTHICKNESS(style); - y = YTHICKNESS(style); - - /* This gets us a lovely greyish disabledish look */ - gtk_widget_set_sensitive(widget, !state->disabled); - - TSOffsetStyleGCs(style, rect->x + x, rect->y + y); - gtk_paint_flat_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, - cliprect, widget, "entry_bg", rect->x + x, - rect->y + y, rect->width - 2*x, rect->height - 2*y); - - gtk_widget_style_get(widget, - "interior-focus", &interior_focus, - "focus-line-width", &focus_width, - NULL); - - /* - * Now paint the shadow and focus border. - * - * gtk+ is able to draw over top of the entry when it gains focus, - * so the non-focused text border is implicitly already drawn when - * the entry is drawn in a focused state. - * - * Gecko doesn't quite work this way, so always draw the non-focused - * shadow, then draw the shadow again, inset, if we're focused. - */ - - x = rect->x; - y = rect->y; - - if (state->focused && !state->disabled) { - /* This will get us the lit borders that focused textboxes enjoy on some themes. */ - GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS); - - if (!interior_focus) { - /* Indent the border a little bit if we have exterior focus - (this is what GTK does to draw native entries) */ - x += focus_width; - y += focus_width; - width -= 2 * focus_width; - height -= 2 * focus_width; - } - } - - TSOffsetStyleGCs(style, x, y); - gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, - cliprect, widget, "entry", x, y, width, height); - - if (state->focused && !state->disabled) { - if (!interior_focus) { - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_focus(style, drawable, GTK_STATE_NORMAL, cliprect, - widget, "entry", - rect->x, rect->y, rect->width, rect->height); - } - - /* Now unset the focus flag. We don't want other entries to look like they're focused too! */ - GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS); - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_treeview_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkTextDirection direction) -{ - gint xthickness, ythickness; - - GtkStyle *style; - GtkStateType state_type; - - ensure_tree_view_widget(); - gtk_widget_set_direction(gTreeViewWidget, direction); - - /* only handle disabled and normal states, otherwise the whole background - * area will be painted differently with other states */ - state_type = state->disabled ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL; - - /* In GTK the treeview sets the background of the window - * which contains the cells to the treeview base color. - * If we don't set it here the background color will not be correct.*/ - gtk_widget_modify_bg(gTreeViewWidget, state_type, - &gTreeViewWidget->style->base[state_type]); - - style = gTreeViewWidget->style; - xthickness = XTHICKNESS(style); - ythickness = YTHICKNESS(style); - - TSOffsetStyleGCs(style, rect->x, rect->y); - - gtk_paint_flat_box(style, drawable, state_type, GTK_SHADOW_NONE, - cliprect, gTreeViewWidget, "treeview", - rect->x + xthickness, rect->y + ythickness, - rect->width - 2 * xthickness, - rect->height - 2 * ythickness); - - gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, - cliprect, gTreeViewWidget, "scrolled_window", - rect->x, rect->y, rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_tree_header_cell_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkTextDirection direction) -{ - moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL, - gTreeHeaderCellWidget, direction); - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_tree_header_sort_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, - GtkWidgetState* state, GtkArrowType flags, - GtkTextDirection direction) -{ - GdkRectangle arrow_rect; - GtkStateType state_type = ConvertGtkState(state); - GtkShadowType shadow_type = GTK_SHADOW_IN; - GtkArrowType arrow_type = flags; - GtkStyle* style; - - ensure_tree_header_cell_widget(); - gtk_widget_set_direction(gTreeHeaderSortArrowWidget, direction); - - /* hard code these values */ - arrow_rect.width = 11; - arrow_rect.height = 11; - arrow_rect.x = rect->x + (rect->width - arrow_rect.width) / 2; - arrow_rect.y = rect->y + (rect->height - arrow_rect.height) / 2; - - style = gTreeHeaderSortArrowWidget->style; - TSOffsetStyleGCs(style, arrow_rect.x, arrow_rect.y); - - gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, - gTreeHeaderSortArrowWidget, "arrow", arrow_type, TRUE, - arrow_rect.x, arrow_rect.y, - arrow_rect.width, arrow_rect.height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_treeview_expander_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkExpanderStyle expander_state, - GtkTextDirection direction) -{ - GtkStyle *style; - GtkStateType state_type; - - ensure_tree_view_widget(); - gtk_widget_set_direction(gTreeViewWidget, direction); - - style = gTreeViewWidget->style; - - /* Because the frame we get is of the entire treeview, we can't get the precise - * event state of one expander, thus rendering hover and active feedback useless. */ - state_type = state->disabled ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_expander(style, drawable, state_type, cliprect, gTreeViewWidget, "treeview", - rect->x + rect->width / 2, rect->y + rect->height / 2, expander_state); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_expander_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkExpanderStyle expander_state, - GtkTextDirection direction) -{ - GtkStyle *style; - GtkStateType state_type = ConvertGtkState(state); - - ensure_expander_widget(); - gtk_widget_set_direction(gExpanderWidget, direction); - - style = gExpanderWidget->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_expander(style, drawable, state_type, cliprect, gExpanderWidget, "expander", - rect->x + rect->width / 2, rect->y + rect->height / 2, expander_state); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_option_menu_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkTextDirection direction) -{ - GtkStyle* style; - GtkStateType state_type = ConvertGtkState(state); - gint x = rect->x, y=rect->y, width=rect->width, height=rect->height; - gint tab_x, tab_y; - gboolean interior_focus; - GtkRequisition indicator_size; - GtkBorder indicator_spacing; - gint focus_width; - gint focus_pad; - - ensure_option_menu_widget(); - gtk_widget_set_direction(gOptionMenuWidget, direction); - moz_gtk_option_menu_get_metrics(&interior_focus, &indicator_size, - &indicator_spacing, &focus_width, - &focus_pad); - - style = gOptionMenuWidget->style; - - if (!interior_focus && state->focused) { - x += focus_width + focus_pad; - y += focus_width + focus_pad; - width -= 2 * (focus_width + focus_pad); - height -= 2 * (focus_width + focus_pad); - } - - TSOffsetStyleGCs(style, x, y); - gtk_paint_box(style, drawable, state_type, GTK_SHADOW_OUT, - cliprect, gOptionMenuWidget, "optionmenu", - x, y, width, height); - - if (direction == GTK_TEXT_DIR_RTL) { - tab_x = x + indicator_spacing.right + XTHICKNESS(style); - } else { - tab_x = x + width - indicator_size.width - indicator_spacing.right - - XTHICKNESS(style); - } - tab_y = y + (height - indicator_size.height) / 2; - - TSOffsetStyleGCs(style, tab_x, tab_y); - gtk_paint_tab(style, drawable, state_type, GTK_SHADOW_OUT, cliprect, - gOptionMenuWidget, "optionmenutab", tab_x, tab_y, - indicator_size.width, indicator_size.height); - - if (state->focused) { - if (interior_focus) { - x += XTHICKNESS(style) + focus_pad; - y += YTHICKNESS(style) + focus_pad; - /* Standard GTK combos have their focus ring around the entire - control, not just the text bit */ - width -= 2 * (XTHICKNESS(style) + focus_pad); - height -= 2 * (YTHICKNESS(style) + focus_pad); - } else { - x -= focus_width + focus_pad; - y -= focus_width + focus_pad; - width += 2 * (focus_width + focus_pad); - height += 2 * (focus_width + focus_pad); - } - - TSOffsetStyleGCs(style, x, y); - gtk_paint_focus (style, drawable, state_type, cliprect, gOptionMenuWidget, - "button", x, y, width, height); - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_downarrow_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state) -{ - GtkStyle* style; - GtkStateType state_type = ConvertGtkState(state); - GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT; - GdkRectangle arrow_rect; - - ensure_arrow_widget(); - style = gArrowWidget->style; - - arrow_rect.x = rect->x + 1 + XTHICKNESS(style); - arrow_rect.y = rect->y + 1 + YTHICKNESS(style); - arrow_rect.width = MAX(1, rect->width - (arrow_rect.x - rect->x) * 2); - arrow_rect.height = MAX(1, rect->height - (arrow_rect.y - rect->y) * 2); - - TSOffsetStyleGCs(style, arrow_rect.x, arrow_rect.y); - gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, - gArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE, - arrow_rect.x, arrow_rect.y, arrow_rect.width, arrow_rect.height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_dropdown_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkTextDirection direction) -{ - static gfloat arrow_scaling = 0.7; - gint real_arrow_padding; - GdkRectangle arrow_rect, real_arrow_rect; - GtkStateType state_type = ConvertGtkState(state); - GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT; - GtkStyle* style; - - ensure_arrow_widget(); - gtk_widget_set_direction(gDropdownButtonWidget, direction); - - moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL, - gDropdownButtonWidget, direction); - - /* This mirrors gtkbutton's child positioning */ - style = gDropdownButtonWidget->style; - arrow_rect.x = rect->x + 1 + XTHICKNESS(style); - arrow_rect.y = rect->y + 1 + YTHICKNESS(style); - arrow_rect.width = MAX(1, rect->width - (arrow_rect.x - rect->x) * 2); - arrow_rect.height = MAX(1, rect->height - (arrow_rect.y - rect->y) * 2); - - calculate_arrow_dimensions(&arrow_rect, &real_arrow_rect); - style = gArrowWidget->style; - TSOffsetStyleGCs(style, real_arrow_rect.x, real_arrow_rect.y); - - real_arrow_rect.width = real_arrow_rect.height = - MIN (real_arrow_rect.width, real_arrow_rect.height) * arrow_scaling; - - real_arrow_padding = floor((arrow_rect.width - real_arrow_rect.width) / 2 + 0.5); - real_arrow_rect.x = arrow_rect.x + real_arrow_padding; - if (direction == GTK_TEXT_DIR_RTL) - real_arrow_rect.x = arrow_rect.x + arrow_rect.width - - real_arrow_rect.width - real_arrow_padding; - real_arrow_rect.y = floor (arrow_rect.y + ((arrow_rect.height - real_arrow_rect.height) / 2) + 0.5); - - gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, - gDropdownButtonWidget, "arrow", GTK_ARROW_DOWN, TRUE, - real_arrow_rect.x, real_arrow_rect.y, - real_arrow_rect.width, real_arrow_rect.height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_container_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - gboolean isradio, GtkTextDirection direction) -{ - GtkStateType state_type = ConvertGtkState(state); - GtkStyle* style; - GtkWidget *widget; - gboolean interior_focus; - gint focus_width, focus_pad; - - if (isradio) { - ensure_radiobutton_widget(); - widget = gRadiobuttonWidget; - } else { - ensure_checkbox_widget(); - widget = gCheckboxWidget; - } - gtk_widget_set_direction(widget, direction); - - style = widget->style; - moz_gtk_widget_get_focus(widget, &interior_focus, &focus_width, - &focus_pad); - - TSOffsetStyleGCs(style, rect->x, rect->y); - - /* The detail argument for the gtk_paint_* calls below are "checkbutton" - even for radio buttons, to match what gtk does. */ - - /* this is for drawing a prelight box */ - if (state_type == GTK_STATE_PRELIGHT || state_type == GTK_STATE_ACTIVE) { - gtk_paint_flat_box(style, drawable, GTK_STATE_PRELIGHT, - GTK_SHADOW_ETCHED_OUT, cliprect, widget, - "checkbutton", - rect->x, rect->y, rect->width, rect->height); - } - - if (state_type != GTK_STATE_NORMAL && state_type != GTK_STATE_PRELIGHT) - state_type = GTK_STATE_NORMAL; - - if (state->focused && !interior_focus) { - gtk_paint_focus(style, drawable, state_type, cliprect, widget, - "checkbutton", - rect->x, rect->y, rect->width, rect->height); - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_toggle_label_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - gboolean isradio, GtkTextDirection direction) -{ - GtkStateType state_type; - GtkStyle *style; - GtkWidget *widget; - gboolean interior_focus; - - if (!state->focused) - return MOZ_GTK_SUCCESS; - - if (isradio) { - ensure_radiobutton_widget(); - widget = gRadiobuttonWidget; - } else { - ensure_checkbox_widget(); - widget = gCheckboxWidget; - } - gtk_widget_set_direction(widget, direction); - - gtk_widget_style_get(widget, "interior-focus", &interior_focus, NULL); - if (!interior_focus) - return MOZ_GTK_SUCCESS; - - state_type = ConvertGtkState(state); - - style = widget->style; - TSOffsetStyleGCs(style, rect->x, rect->y); - - /* Always "checkbutton" to match gtkcheckbutton.c */ - gtk_paint_focus(style, drawable, state_type, cliprect, widget, - "checkbutton", - rect->x, rect->y, rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_toolbar_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - GtkShadowType shadow_type; - - ensure_toolbar_widget(); - gtk_widget_set_direction(gToolbarWidget, direction); - - style = gToolbarWidget->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - - gtk_style_apply_default_background(style, drawable, TRUE, - GTK_STATE_NORMAL, - cliprect, rect->x, rect->y, - rect->width, rect->height); - - gtk_paint_box (style, drawable, GTK_STATE_NORMAL, gToolbarShadowType, - cliprect, gToolbarWidget, "toolbar", - rect->x, rect->y, rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_toolbar_separator_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, - GtkTextDirection direction) -{ - GtkStyle* style; - gint separator_width; - gint paint_width; - gboolean wide_separators; - - /* Defined as constants in GTK+ 2.10.14 */ - const double start_fraction = 0.2; - const double end_fraction = 0.8; - - ensure_toolbar_separator_widget(); - gtk_widget_set_direction(gToolbarSeparatorWidget, direction); - - style = gToolbarSeparatorWidget->style; - - gtk_widget_style_get(gToolbarWidget, - "wide-separators", &wide_separators, - "separator-width", &separator_width, - NULL); - - TSOffsetStyleGCs(style, rect->x, rect->y); - - if (wide_separators) { - if (separator_width > rect->width) - separator_width = rect->width; - - gtk_paint_box(style, drawable, - GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, - cliprect, gToolbarWidget, "vseparator", - rect->x + (rect->width - separator_width) / 2, - rect->y + rect->height * start_fraction, - separator_width, - rect->height * (end_fraction - start_fraction)); - - } else { - paint_width = style->xthickness; - - if (paint_width > rect->width) - paint_width = rect->width; - - gtk_paint_vline(style, drawable, - GTK_STATE_NORMAL, cliprect, gToolbarSeparatorWidget, - "toolbar", - rect->y + rect->height * start_fraction, - rect->y + rect->height * end_fraction, - rect->x + (rect->width - paint_width) / 2); - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_tooltip_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - - ensure_tooltip_widget(); - gtk_widget_set_direction(gTooltipWidget, direction); - - style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), - "gtk-tooltips", "GtkWindow", - GTK_TYPE_WINDOW); - - style = gtk_style_attach(style, gTooltipWidget->window); - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_flat_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - cliprect, gTooltipWidget, "tooltip", - rect->x, rect->y, rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_resizer_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkTextDirection direction) -{ - GtkStyle* style; - GtkStateType state_type = ConvertGtkState(state); - - ensure_window_widget(); - gtk_widget_set_direction(gProtoWindow, direction); - - style = gProtoWindow->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - - gtk_paint_resize_grip(style, drawable, state_type, cliprect, gProtoWindow, - NULL, (direction == GTK_TEXT_DIR_LTR) ? - GDK_WINDOW_EDGE_SOUTH_EAST : - GDK_WINDOW_EDGE_SOUTH_WEST, - rect->x, rect->y, rect->width, rect->height); - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_frame_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - GtkShadowType shadow_type; - - ensure_frame_widget(); - gtk_widget_set_direction(gFrameWidget, direction); - - style = gFrameWidget->style; - - gtk_widget_style_get(gStatusbarWidget, "shadow-type", &shadow_type, NULL); - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, shadow_type, - cliprect, gFrameWidget, "frame", rect->x, rect->y, - rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_progressbar_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - - ensure_progress_widget(); - gtk_widget_set_direction(gProgressWidget, direction); - - style = gProgressWidget->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, - cliprect, gProgressWidget, "trough", rect->x, rect->y, - rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_progress_chunk_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - - ensure_progress_widget(); - gtk_widget_set_direction(gProgressWidget, direction); - - style = gProgressWidget->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_box(style, drawable, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, - cliprect, gProgressWidget, "bar", rect->x, rect->y, - rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_get_tab_thickness(void) -{ - ensure_tab_widget(); - if (YTHICKNESS(gTabWidget->style) < 2) - return 2; /* some themes don't set ythickness correctly */ - - return YTHICKNESS(gTabWidget->style); -} - -static gint -moz_gtk_tab_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTabFlags flags, - GtkTextDirection direction) -{ - /* When the tab isn't selected, we just draw a notebook extension. - * When it is selected, we overwrite the adjacent border of the tabpanel - * touching the tab with a pierced border (called "the gap") to make the - * tab appear physically attached to the tabpanel; see details below. */ - - GtkStyle* style; - - ensure_tab_widget(); - gtk_widget_set_direction(gTabWidget, direction); - - style = gTabWidget->style; - TSOffsetStyleGCs(style, rect->x, rect->y); - - if ((flags & MOZ_GTK_TAB_SELECTED) == 0) { - /* Only draw the tab */ - gtk_paint_extension(style, drawable, GTK_STATE_ACTIVE, GTK_SHADOW_OUT, - cliprect, gTabWidget, "tab", - rect->x, rect->y, rect->width, rect->height, - (flags & MOZ_GTK_TAB_BOTTOM) ? - GTK_POS_TOP : GTK_POS_BOTTOM ); - } else { - /* Draw the tab and the gap - * We want the gap to be positionned exactly on the tabpanel top - * border; since tabbox.css may set a negative margin so that the tab - * frame rect already overlaps the tabpanel frame rect, we need to take - * that into account when drawing. To that effect, nsNativeThemeGTK - * passes us this negative margin (bmargin in the graphic below) in the - * lowest bits of |flags|. We use it to set gap_voffset, the distance - * between the top of the gap and the bottom of the tab (resp. the - * bottom of the gap and the top of the tab when we draw a bottom tab), - * while ensuring that the gap always touches the border of the tab, - * i.e. 0 <= gap_voffset <= gap_height, to avoid surprinsing results - * with big negative or positive margins. - * Here is a graphical explanation in the case of top tabs: - * ___________________________ - * / \ - * | T A B | - * ----------|. . . . . . . . . . . . . . .|----- top of tabpanel - * : ^ bmargin : ^ - * : | (-negative margin, : | - * bottom : v passed in flags) : | gap_height - * of -> :.............................: | (the size of the - * the tab . part of the gap . | tabpanel top border) - * . outside of the tab . v - * ---------------------------------------------- - * - * To draw the gap, we use gtk_paint_box_gap(), see comment in - * moz_gtk_tabpanels_paint(). This box_gap is made 3 * gap_height tall, - * which should suffice to ensure that the only visible border is the - * pierced one. If the tab is in the middle, we make the box_gap begin - * a bit to the left of the tab and end a bit to the right, adjusting - * the gap position so it still is under the tab, because we want the - * rendering of a gap in the middle of a tabpanel. This is the role of - * the gints gap_{l,r}_offset. On the contrary, if the tab is the - * first, we align the start border of the box_gap with the start - * border of the tab (left if LTR, right if RTL), by setting the - * appropriate offset to 0.*/ - gint gap_loffset, gap_roffset, gap_voffset, gap_height; - - /* Get height needed by the gap */ - gap_height = moz_gtk_get_tab_thickness(); - - /* Extract gap_voffset from the first bits of flags */ - gap_voffset = flags & MOZ_GTK_TAB_MARGIN_MASK; - if (gap_voffset > gap_height) - gap_voffset = gap_height; - - /* Set gap_{l,r}_offset to appropriate values */ - gap_loffset = gap_roffset = 20; /* should be enough */ - if (flags & MOZ_GTK_TAB_FIRST) { - if (direction == GTK_TEXT_DIR_RTL) - gap_roffset = 0; - else - gap_loffset = 0; - } - - if (flags & MOZ_GTK_TAB_BOTTOM) { - /* Enlarge the cliprect to have room for the full gap height */ - cliprect->height += gap_height - gap_voffset; - cliprect->y -= gap_height - gap_voffset; - - /* Draw the tab */ - gtk_paint_extension(style, drawable, GTK_STATE_NORMAL, - GTK_SHADOW_OUT, cliprect, gTabWidget, "tab", - rect->x, rect->y + gap_voffset, rect->width, - rect->height - gap_voffset, GTK_POS_TOP); - - /* Draw the gap; erase with background color before painting in - * case theme does not */ - gtk_style_apply_default_background(style, drawable, TRUE, - GTK_STATE_NORMAL, cliprect, - rect->x, - rect->y + gap_voffset - - gap_height, - rect->width, gap_height); - gtk_paint_box_gap(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - cliprect, gTabWidget, "notebook", - rect->x - gap_loffset, - rect->y + gap_voffset - 3 * gap_height, - rect->width + gap_loffset + gap_roffset, - 3 * gap_height, GTK_POS_BOTTOM, - gap_loffset, rect->width); - } else { - /* Enlarge the cliprect to have room for the full gap height */ - cliprect->height += gap_height - gap_voffset; - - /* Draw the tab */ - gtk_paint_extension(style, drawable, GTK_STATE_NORMAL, - GTK_SHADOW_OUT, cliprect, gTabWidget, "tab", - rect->x, rect->y, rect->width, - rect->height - gap_voffset, GTK_POS_BOTTOM); - - /* Draw the gap; erase with background color before painting in - * case theme does not */ - gtk_style_apply_default_background(style, drawable, TRUE, - GTK_STATE_NORMAL, cliprect, - rect->x, - rect->y + rect->height - - gap_voffset, - rect->width, gap_height); - gtk_paint_box_gap(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - cliprect, gTabWidget, "notebook", - rect->x - gap_loffset, - rect->y + rect->height - gap_voffset, - rect->width + gap_loffset + gap_roffset, - 3 * gap_height, GTK_POS_TOP, - gap_loffset, rect->width); - } - - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_tabpanels_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - /* We use gtk_paint_box_gap() to draw the tabpanels widget. gtk_paint_box() - * draws an all-purpose box, which a lot of themes render differently. - * A zero-width gap is still visible in most themes, so we hide it to the - * left (10px should be enough) */ - GtkStyle* style; - - ensure_tab_widget(); - gtk_widget_set_direction(gTabWidget, direction); - - style = gTabWidget->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_box_gap(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - cliprect, gTabWidget, "notebook", rect->x, rect->y, - rect->width, rect->height, - GTK_POS_TOP, -10, 0); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_menu_bar_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - GtkShadowType shadow_type; - ensure_menu_bar_widget(); - gtk_widget_set_direction(gMenuBarWidget, direction); - - style = gMenuBarWidget->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL, - cliprect, rect->x, rect->y, - rect->width, rect->height); - gtk_paint_box(style, drawable, GTK_STATE_NORMAL, gMenuBarShadowType, - cliprect, gMenuBarWidget, "menubar", rect->x, rect->y, - rect->width, rect->height); - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_menu_popup_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - ensure_menu_popup_widget(); - gtk_widget_set_direction(gMenuPopupWidget, direction); - - style = gMenuPopupWidget->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL, - cliprect, rect->x, rect->y, - rect->width, rect->height); - gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - cliprect, gMenuPopupWidget, "menu", - rect->x, rect->y, rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_menu_separator_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - gboolean wide_separators; - gint separator_height; - guint horizontal_padding; - gint paint_height; - - ensure_menu_separator_widget(); - gtk_widget_set_direction(gMenuSeparatorWidget, direction); - - style = gMenuSeparatorWidget->style; - - gtk_widget_style_get(gMenuSeparatorWidget, - "wide-separators", &wide_separators, - "separator-height", &separator_height, - "horizontal-padding", &horizontal_padding, - NULL); - - TSOffsetStyleGCs(style, rect->x, rect->y); - - if (wide_separators) { - if (separator_height > rect->height) - separator_height = rect->height; - - gtk_paint_box(style, drawable, - GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, - cliprect, gMenuSeparatorWidget, "hseparator", - rect->x + horizontal_padding + style->xthickness, - rect->y + (rect->height - separator_height - style->ythickness) / 2, - rect->width - 2 * (horizontal_padding + style->xthickness), - separator_height); - } else { - paint_height = style->ythickness; - if (paint_height > rect->height) - paint_height = rect->height; - - gtk_paint_hline(style, drawable, - GTK_STATE_NORMAL, cliprect, gMenuSeparatorWidget, - "menuitem", - rect->x + horizontal_padding + style->xthickness, - rect->x + rect->width - horizontal_padding - style->xthickness - 1, - rect->y + (rect->height - style->ythickness) / 2); - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_menu_item_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - gint flags, GtkTextDirection direction) -{ - GtkStyle* style; - GtkShadowType shadow_type; - GtkWidget* item_widget; - - if (state->inHover && !state->disabled) { - if (flags & MOZ_TOPLEVEL_MENU_ITEM) { - ensure_menu_bar_item_widget(); - item_widget = gMenuBarItemWidget; - } else { - ensure_menu_item_widget(); - item_widget = gMenuItemWidget; - } - gtk_widget_set_direction(item_widget, direction); - - style = item_widget->style; - TSOffsetStyleGCs(style, rect->x, rect->y); - if (have_menu_shadow_type) { - gtk_widget_style_get(item_widget, "selected_shadow_type", - &shadow_type, NULL); - } else { - shadow_type = GTK_SHADOW_OUT; - } - - gtk_paint_box(style, drawable, GTK_STATE_PRELIGHT, shadow_type, - cliprect, item_widget, "menuitem", rect->x, rect->y, - rect->width, rect->height); - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_menu_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkTextDirection direction) -{ - GtkStyle* style; - GtkStateType state_type = ConvertGtkState(state); - - ensure_menu_item_widget(); - gtk_widget_set_direction(gMenuItemWidget, direction); - - style = gMenuItemWidget->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_arrow(style, drawable, state_type, - (state_type == GTK_STATE_PRELIGHT) ? GTK_SHADOW_IN : GTK_SHADOW_OUT, - cliprect, gMenuItemWidget, "menuitem", - (direction == GTK_TEXT_DIR_LTR) ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT, - TRUE, rect->x, rect->y, rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_check_menu_item_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - gboolean checked, gboolean isradio, - GtkTextDirection direction) -{ - GtkStateType state_type = ConvertGtkState(state); - GtkStyle* style; - GtkShadowType shadow_type = (checked)?GTK_SHADOW_IN:GTK_SHADOW_OUT; - gint offset; - gint indicator_size; - gint x, y; - - moz_gtk_menu_item_paint(drawable, rect, cliprect, state, FALSE, direction); - - ensure_check_menu_item_widget(); - gtk_widget_set_direction(gCheckMenuItemWidget, direction); - - gtk_widget_style_get (gCheckMenuItemWidget, - "indicator-size", &indicator_size, - NULL); - - if (checked || GTK_CHECK_MENU_ITEM(gCheckMenuItemWidget)->always_show_toggle) { - style = gCheckMenuItemWidget->style; - - offset = GTK_CONTAINER(gCheckMenuItemWidget)->border_width + - gCheckMenuItemWidget->style->xthickness + 2; - - /* while normally this "3" would be the horizontal-padding style value, passing it to Gecko - as the value of menuitem padding causes problems with dropdowns (bug 406129), so in the menu.css - file this is hardcoded as 3px. Yes it sucks, but we don't really have a choice. */ - x = (direction == GTK_TEXT_DIR_RTL) ? - rect->width - indicator_size - offset - 3: rect->x + offset + 3; - y = rect->y + (rect->height - indicator_size) / 2; - - TSOffsetStyleGCs(style, x, y); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gCheckMenuItemWidget), - checked); - - if (isradio) { - gtk_paint_option(style, drawable, state_type, shadow_type, cliprect, - gCheckMenuItemWidget, "option", - x, y, indicator_size, indicator_size); - } else { - gtk_paint_check(style, drawable, state_type, shadow_type, cliprect, - gCheckMenuItemWidget, "check", - x, y, indicator_size, indicator_size); - } - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_window_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - - ensure_window_widget(); - gtk_widget_set_direction(gProtoWindow, direction); - - style = gProtoWindow->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_style_apply_default_background(style, drawable, TRUE, - GTK_STATE_NORMAL, - cliprect, rect->x, rect->y, - rect->width, rect->height); - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, - gint* right, gint* bottom, GtkTextDirection direction, - gboolean inhtml) -{ - GtkWidget* w; - - switch (widget) { - case MOZ_GTK_BUTTON: - { - /* Constant in gtkbutton.c */ - static const gint child_spacing = 1; - gboolean interior_focus; - gint focus_width, focus_pad; - - ensure_button_widget(); - *left = *top = *right = *bottom = GTK_CONTAINER(gButtonWidget)->border_width; - - /* Don't add this padding in HTML, otherwise the buttons will - become too big and stuff the layout. */ - if (!inhtml) { - moz_gtk_widget_get_focus(gButtonWidget, &interior_focus, &focus_width, &focus_pad); - *left += focus_width + focus_pad + child_spacing; - *right += focus_width + focus_pad + child_spacing; - *top += focus_width + focus_pad + child_spacing; - *bottom += focus_width + focus_pad + child_spacing; - } - - *left += gButtonWidget->style->xthickness; - *right += gButtonWidget->style->xthickness; - *top += gButtonWidget->style->ythickness; - *bottom += gButtonWidget->style->ythickness; - return MOZ_GTK_SUCCESS; - } - - case MOZ_GTK_TOOLBAR: - ensure_toolbar_widget(); - w = gToolbarWidget; - break; - case MOZ_GTK_ENTRY: - ensure_entry_widget(); - w = gEntryWidget; - break; - case MOZ_GTK_TREEVIEW: - ensure_tree_view_widget(); - w = gTreeViewWidget; - break; - case MOZ_GTK_TREE_HEADER_CELL: - { - /* A Tree Header in GTK is just a different styled button - * It must be placed in a TreeView for getting the correct style - * assigned. - * That is why the following code is the same as for MOZ_GTK_BUTTON. - * */ - - /* Constant in gtkbutton.c */ - static const gint child_spacing = 1; - gboolean interior_focus; - gint focus_width, focus_pad; - - ensure_tree_header_cell_widget(); - *left = *top = *right = *bottom = GTK_CONTAINER(gTreeHeaderCellWidget)->border_width; - - moz_gtk_widget_get_focus(gTreeHeaderCellWidget, &interior_focus, &focus_width, &focus_pad); - *left += focus_width + focus_pad; - *right += focus_width + focus_pad; - *top += focus_width + focus_pad + child_spacing; - *bottom += focus_width + focus_pad + child_spacing; - - *left += gTreeHeaderCellWidget->style->xthickness; - *right += gTreeHeaderCellWidget->style->xthickness; - *top += gTreeHeaderCellWidget->style->ythickness; - *bottom += gTreeHeaderCellWidget->style->ythickness; - return MOZ_GTK_SUCCESS; - } - case MOZ_GTK_TREE_HEADER_SORTARROW: - ensure_tree_header_cell_widget(); - w = gTreeHeaderSortArrowWidget; - break; - case MOZ_GTK_DROPDOWN_ENTRY: - ensure_dropdown_entry_widget(); - w = gDropdownEntryWidget; - break; - case MOZ_GTK_DROPDOWN_ARROW: - ensure_arrow_widget(); - w = gDropdownButtonWidget; - break; - case MOZ_GTK_DROPDOWN: - { - /* We need to account for the arrow on the dropdown, so text doesn't - come too close to the arrow, or in some cases spill into the arrow. */ - gboolean interior_focus; - GtkRequisition indicator_size; - GtkBorder indicator_spacing; - gint focus_width, focus_pad; - - ensure_option_menu_widget(); - *right = *left = gOptionMenuWidget->style->xthickness; - *bottom = *top = gOptionMenuWidget->style->ythickness; - moz_gtk_option_menu_get_metrics(&interior_focus, &indicator_size, - &indicator_spacing, &focus_width, &focus_pad); - - if (direction == GTK_TEXT_DIR_RTL) - *left += indicator_spacing.left + indicator_size.width + indicator_spacing.right; - else - *right += indicator_spacing.left + indicator_size.width + indicator_spacing.right; - return MOZ_GTK_SUCCESS; - } - case MOZ_GTK_TABPANELS: - ensure_tab_widget(); - w = gTabWidget; - break; - case MOZ_GTK_PROGRESSBAR: - ensure_progress_widget(); - w = gProgressWidget; - break; - case MOZ_GTK_SPINBUTTON_ENTRY: - case MOZ_GTK_SPINBUTTON_UP: - case MOZ_GTK_SPINBUTTON_DOWN: - ensure_spin_widget(); - w = gSpinWidget; - break; - case MOZ_GTK_SCALE_HORIZONTAL: - ensure_scale_widget(); - w = gHScaleWidget; - break; - case MOZ_GTK_SCALE_VERTICAL: - ensure_scale_widget(); - w = gVScaleWidget; - break; - case MOZ_GTK_FRAME: - ensure_frame_widget(); - w = gFrameWidget; - break; - case MOZ_GTK_CHECKBUTTON_LABEL: - case MOZ_GTK_RADIOBUTTON_LABEL: - { - gboolean interior_focus; - gint focus_width, focus_pad; - - /* If the focus is interior, then the label has a border of - (focus_width + focus_pad). */ - if (widget == MOZ_GTK_CHECKBUTTON_LABEL) { - ensure_checkbox_widget(); - moz_gtk_widget_get_focus(gCheckboxWidget, &interior_focus, - &focus_width, &focus_pad); - } - else { - ensure_radiobutton_widget(); - moz_gtk_widget_get_focus(gRadiobuttonWidget, &interior_focus, - &focus_width, &focus_pad); - } - - if (interior_focus) - *left = *top = *right = *bottom = (focus_width + focus_pad); - else - *left = *top = *right = *bottom = 0; - - return MOZ_GTK_SUCCESS; - } - - case MOZ_GTK_CHECKBUTTON_CONTAINER: - case MOZ_GTK_RADIOBUTTON_CONTAINER: - { - gboolean interior_focus; - gint focus_width, focus_pad; - - /* If the focus is _not_ interior, then the container has a border - of (focus_width + focus_pad). */ - if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) { - ensure_checkbox_widget(); - moz_gtk_widget_get_focus(gCheckboxWidget, &interior_focus, - &focus_width, &focus_pad); - w = gCheckboxWidget; - } else { - ensure_radiobutton_widget(); - moz_gtk_widget_get_focus(gRadiobuttonWidget, &interior_focus, - &focus_width, &focus_pad); - w = gRadiobuttonWidget; - } - - *left = *top = *right = *bottom = GTK_CONTAINER(w)->border_width; - - if (!interior_focus) { - *left += (focus_width + focus_pad); - *right += (focus_width + focus_pad); - *top += (focus_width + focus_pad); - *bottom += (focus_width + focus_pad); - } - - return MOZ_GTK_SUCCESS; - } - case MOZ_GTK_MENUBAR: - ensure_menu_bar_widget(); - w = gMenuBarWidget; - break; - case MOZ_GTK_MENUPOPUP: - ensure_menu_popup_widget(); - w = gMenuPopupWidget; - break; - case MOZ_GTK_MENUITEM: - ensure_menu_item_widget(); - ensure_menu_bar_item_widget(); - w = gMenuItemWidget; - break; - case MOZ_GTK_CHECKMENUITEM: - case MOZ_GTK_RADIOMENUITEM: - ensure_check_menu_item_widget(); - w = gCheckMenuItemWidget; - break; - case MOZ_GTK_TAB: - ensure_tab_widget(); - w = gTabWidget; - break; - /* These widgets have no borders, since they are not containers. */ - case MOZ_GTK_SPLITTER_HORIZONTAL: - case MOZ_GTK_SPLITTER_VERTICAL: - case MOZ_GTK_CHECKBUTTON: - case MOZ_GTK_RADIOBUTTON: - case MOZ_GTK_SCROLLBAR_BUTTON: - case MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL: - case MOZ_GTK_SCROLLBAR_TRACK_VERTICAL: - case MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL: - case MOZ_GTK_SCROLLBAR_THUMB_VERTICAL: - case MOZ_GTK_SCALE_THUMB_HORIZONTAL: - case MOZ_GTK_SCALE_THUMB_VERTICAL: - case MOZ_GTK_GRIPPER: - case MOZ_GTK_PROGRESS_CHUNK: - case MOZ_GTK_EXPANDER: - case MOZ_GTK_TOOLBAR_SEPARATOR: - case MOZ_GTK_MENUSEPARATOR: - /* These widgets have no borders.*/ - case MOZ_GTK_SPINBUTTON: - case MOZ_GTK_TOOLTIP: - case MOZ_GTK_WINDOW: - case MOZ_GTK_RESIZER: - case MOZ_GTK_MENUARROW: - case MOZ_GTK_TOOLBARBUTTON_ARROW: - *left = *top = *right = *bottom = 0; - return MOZ_GTK_SUCCESS; - default: - g_warning("Unsupported widget type: %d", widget); - return MOZ_GTK_UNKNOWN_WIDGET; - } - - *right = *left = XTHICKNESS(w->style); - *bottom = *top = YTHICKNESS(w->style); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_get_dropdown_arrow_size(gint* width, gint* height) -{ - const gint min_arrow_size = 15; - ensure_arrow_widget(); - - /* - * First get the border of the dropdown arrow, then add in the requested - * size of the arrow. Note that the minimum arrow size is fixed at - * 15 pixels. - */ - - *width = 2 * (1 + XTHICKNESS(gDropdownButtonWidget->style)); - *width += min_arrow_size + GTK_MISC(gArrowWidget)->xpad * 2; - - *height = 2 * (1 + YTHICKNESS(gDropdownButtonWidget->style)); - *height += min_arrow_size + GTK_MISC(gArrowWidget)->ypad * 2; - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_get_toolbar_separator_width(gint* size) -{ - gboolean wide_separators; - gint separator_width; - GtkStyle* style; - - ensure_toolbar_widget(); - - style = gToolbarWidget->style; - - gtk_widget_style_get(gToolbarWidget, - "space-size", size, - "wide-separators", &wide_separators, - "separator-width", &separator_width, - NULL); - - /* Just in case... */ - *size = MAX(*size, (wide_separators ? separator_width : style->xthickness)); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_get_expander_size(gint* size) -{ - ensure_expander_widget(); - gtk_widget_style_get(gExpanderWidget, - "expander-size", size, - NULL); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_get_treeview_expander_size(gint* size) -{ - ensure_tree_view_widget(); - gtk_widget_style_get(gTreeViewWidget, - "expander-size", size, - NULL); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_get_menu_separator_height(gint *size) -{ - gboolean wide_separators; - gint separator_height; - - ensure_menu_separator_widget(); - - gtk_widget_style_get(gMenuSeparatorWidget, - "wide-separators", &wide_separators, - "separator-height", &separator_height, - NULL); - - if (wide_separators) - *size = separator_height + gMenuSeparatorWidget->style->ythickness; - else - *size = gMenuSeparatorWidget->style->ythickness * 2; - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_get_scalethumb_metrics(GtkOrientation orient, gint* thumb_length, gint* thumb_height) -{ - GtkWidget* widget; - - ensure_scale_widget(); - widget = ((orient == GTK_ORIENTATION_HORIZONTAL) ? gHScaleWidget : gVScaleWidget); - - gtk_widget_style_get (widget, - "slider_length", thumb_length, - "slider_width", thumb_height, - NULL); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_get_scrollbar_metrics(MozGtkScrollbarMetrics *metrics) -{ - ensure_scrollbar_widget(); - - gtk_widget_style_get (gHorizScrollbarWidget, - "slider_width", &metrics->slider_width, - "trough_border", &metrics->trough_border, - "stepper_size", &metrics->stepper_size, - "stepper_spacing", &metrics->stepper_spacing, - NULL); - - metrics->min_slider_size = - GTK_RANGE(gHorizScrollbarWidget)->min_slider_size; - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable, - GdkRectangle* rect, GdkRectangle* cliprect, - GtkWidgetState* state, gint flags, - GtkTextDirection direction) -{ - switch (widget) { - case MOZ_GTK_BUTTON: - if (state->depressed) { - ensure_toggle_button_widget(); - return moz_gtk_button_paint(drawable, rect, cliprect, state, - (GtkReliefStyle) flags, - gToggleButtonWidget, direction); - } - ensure_button_widget(); - return moz_gtk_button_paint(drawable, rect, cliprect, state, - (GtkReliefStyle) flags, gButtonWidget, - direction); - break; - case MOZ_GTK_CHECKBUTTON: - case MOZ_GTK_RADIOBUTTON: - return moz_gtk_toggle_paint(drawable, rect, cliprect, state, - (gboolean) flags, - (widget == MOZ_GTK_RADIOBUTTON), - direction); - break; - case MOZ_GTK_SCROLLBAR_BUTTON: - return moz_gtk_scrollbar_button_paint(drawable, rect, cliprect, state, - (GtkScrollbarButtonFlags) flags, - direction); - break; - case MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL: - case MOZ_GTK_SCROLLBAR_TRACK_VERTICAL: - return moz_gtk_scrollbar_trough_paint(widget, drawable, rect, - cliprect, state, direction); - break; - case MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL: - case MOZ_GTK_SCROLLBAR_THUMB_VERTICAL: - return moz_gtk_scrollbar_thumb_paint(widget, drawable, rect, - cliprect, state, direction); - break; - case MOZ_GTK_SCALE_HORIZONTAL: - case MOZ_GTK_SCALE_VERTICAL: - return moz_gtk_scale_paint(drawable, rect, cliprect, state, - (GtkOrientation) flags, direction); - break; - case MOZ_GTK_SCALE_THUMB_HORIZONTAL: - case MOZ_GTK_SCALE_THUMB_VERTICAL: - return moz_gtk_scale_thumb_paint(drawable, rect, cliprect, state, - (GtkOrientation) flags, direction); - break; - case MOZ_GTK_SPINBUTTON: - return moz_gtk_spin_paint(drawable, rect, direction); - break; - case MOZ_GTK_SPINBUTTON_UP: - case MOZ_GTK_SPINBUTTON_DOWN: - return moz_gtk_spin_updown_paint(drawable, rect, - (widget == MOZ_GTK_SPINBUTTON_DOWN), - state, direction); - break; - case MOZ_GTK_SPINBUTTON_ENTRY: - ensure_spin_widget(); - return moz_gtk_entry_paint(drawable, rect, cliprect, state, - gSpinWidget, direction); - break; - case MOZ_GTK_GRIPPER: - return moz_gtk_gripper_paint(drawable, rect, cliprect, state, - direction); - break; - case MOZ_GTK_TREEVIEW: - return moz_gtk_treeview_paint(drawable, rect, cliprect, state, - direction); - break; - case MOZ_GTK_TREE_HEADER_CELL: - return moz_gtk_tree_header_cell_paint(drawable, rect, cliprect, state, - direction); - break; - case MOZ_GTK_TREE_HEADER_SORTARROW: - return moz_gtk_tree_header_sort_arrow_paint(drawable, rect, cliprect, - state, - (GtkArrowType) flags, - direction); - break; - case MOZ_GTK_TREEVIEW_EXPANDER: - return moz_gtk_treeview_expander_paint(drawable, rect, cliprect, state, - (GtkExpanderStyle) flags, direction); - break; - case MOZ_GTK_EXPANDER: - return moz_gtk_expander_paint(drawable, rect, cliprect, state, - (GtkExpanderStyle) flags, direction); - break; - case MOZ_GTK_ENTRY: - ensure_entry_widget(); - return moz_gtk_entry_paint(drawable, rect, cliprect, state, - gEntryWidget, direction); - break; - case MOZ_GTK_DROPDOWN: - return moz_gtk_option_menu_paint(drawable, rect, cliprect, state, - direction); - break; - case MOZ_GTK_DROPDOWN_ARROW: - return moz_gtk_dropdown_arrow_paint(drawable, rect, cliprect, state, - direction); - break; - case MOZ_GTK_DROPDOWN_ENTRY: - ensure_dropdown_entry_widget(); - return moz_gtk_entry_paint(drawable, rect, cliprect, state, - gDropdownEntryWidget, direction); - break; - case MOZ_GTK_CHECKBUTTON_CONTAINER: - case MOZ_GTK_RADIOBUTTON_CONTAINER: - return moz_gtk_container_paint(drawable, rect, cliprect, state, - (widget == MOZ_GTK_RADIOBUTTON_CONTAINER), - direction); - break; - case MOZ_GTK_CHECKBUTTON_LABEL: - case MOZ_GTK_RADIOBUTTON_LABEL: - return moz_gtk_toggle_label_paint(drawable, rect, cliprect, state, - (widget == MOZ_GTK_RADIOBUTTON_LABEL), - direction); - break; - case MOZ_GTK_TOOLBAR: - return moz_gtk_toolbar_paint(drawable, rect, cliprect, direction); - break; - case MOZ_GTK_TOOLBAR_SEPARATOR: - return moz_gtk_toolbar_separator_paint(drawable, rect, cliprect, - direction); - break; - case MOZ_GTK_TOOLTIP: - return moz_gtk_tooltip_paint(drawable, rect, cliprect, direction); - break; - case MOZ_GTK_FRAME: - return moz_gtk_frame_paint(drawable, rect, cliprect, direction); - break; - case MOZ_GTK_RESIZER: - return moz_gtk_resizer_paint(drawable, rect, cliprect, state, - direction); - break; - case MOZ_GTK_PROGRESSBAR: - return moz_gtk_progressbar_paint(drawable, rect, cliprect, direction); - break; - case MOZ_GTK_PROGRESS_CHUNK: - return moz_gtk_progress_chunk_paint(drawable, rect, cliprect, - direction); - break; - case MOZ_GTK_TAB: - return moz_gtk_tab_paint(drawable, rect, cliprect, - (GtkTabFlags) flags, direction); - break; - case MOZ_GTK_TABPANELS: - return moz_gtk_tabpanels_paint(drawable, rect, cliprect, direction); - break; - case MOZ_GTK_MENUBAR: - return moz_gtk_menu_bar_paint(drawable, rect, cliprect, direction); - break; - case MOZ_GTK_MENUPOPUP: - return moz_gtk_menu_popup_paint(drawable, rect, cliprect, direction); - break; - case MOZ_GTK_MENUSEPARATOR: - return moz_gtk_menu_separator_paint(drawable, rect, cliprect, - direction); - break; - case MOZ_GTK_MENUITEM: - return moz_gtk_menu_item_paint(drawable, rect, cliprect, state, flags, - direction); - break; - case MOZ_GTK_MENUARROW: - return moz_gtk_menu_arrow_paint(drawable, rect, cliprect, state, - direction); - break; - case MOZ_GTK_TOOLBARBUTTON_ARROW: - return moz_gtk_downarrow_paint(drawable, rect, cliprect, state); - break; - case MOZ_GTK_CHECKMENUITEM: - case MOZ_GTK_RADIOMENUITEM: - return moz_gtk_check_menu_item_paint(drawable, rect, cliprect, state, - (gboolean) flags, - (widget == MOZ_GTK_RADIOMENUITEM), - direction); - break; - case MOZ_GTK_SPLITTER_HORIZONTAL: - return moz_gtk_vpaned_paint(drawable, rect, cliprect, state); - break; - case MOZ_GTK_SPLITTER_VERTICAL: - return moz_gtk_hpaned_paint(drawable, rect, cliprect, state); - break; - case MOZ_GTK_WINDOW: - return moz_gtk_window_paint(drawable, rect, cliprect, direction); - break; - default: - g_warning("Unknown widget type: %d", widget); - } - - return MOZ_GTK_UNKNOWN_WIDGET; -} - -GtkWidget* moz_gtk_get_scrollbar_widget(void) -{ - if (!is_initialized) - return NULL; - ensure_scrollbar_widget(); - return gHorizScrollbarWidget; -} - -gint -moz_gtk_shutdown() -{ - if (gTooltipWidget) - gtk_widget_destroy(gTooltipWidget); - /* This will destroy all of our widgets */ - if (gProtoWindow) - gtk_widget_destroy(gProtoWindow); - - gProtoWindow = NULL; - gButtonWidget = NULL; - gToggleButtonWidget = NULL; - gCheckboxWidget = NULL; - gRadiobuttonWidget = NULL; - gHorizScrollbarWidget = NULL; - gVertScrollbarWidget = NULL; - gSpinWidget = NULL; - gHScaleWidget = NULL; - gVScaleWidget = NULL; - gEntryWidget = NULL; - gArrowWidget = NULL; - gOptionMenuWidget = NULL; - gDropdownButtonWidget = NULL; - gDropdownEntryWidget = NULL; - gComboBoxEntryWidget = NULL; - gHandleBoxWidget = NULL; - gToolbarWidget = NULL; - gStatusbarWidget = NULL; - gFrameWidget = NULL; - gProgressWidget = NULL; - gTabWidget = NULL; - gTooltipWidget = NULL; - gMenuBarWidget = NULL; - gMenuBarItemWidget = NULL; - gMenuPopupWidget = NULL; - gMenuItemWidget = NULL; - gCheckMenuItemWidget = NULL; - gTreeViewWidget = NULL; - gTreeHeaderCellWidget = NULL; - gTreeHeaderSortArrowWidget = NULL; - gExpanderWidget = NULL; - gToolbarSeparatorWidget = NULL; - gMenuSeparatorWidget = NULL; - gHPanedWidget = NULL; - gVPanedWidget = NULL; - - is_initialized = FALSE; - - return MOZ_GTK_SUCCESS; -} diff --git a/webkit/port/platform/chromium/gtkdrawing.h b/webkit/port/platform/chromium/gtkdrawing.h deleted file mode 100644 index ee79746..0000000 --- a/webkit/port/platform/chromium/gtkdrawing.h +++ /dev/null @@ -1,390 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Brian Ryner <bryner@brianryner.com> (Original Author) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/** - * gtkdrawing.h: GTK widget rendering utilities - * - * gtkdrawing provides an API for rendering GTK widgets in the - * current theme to a pixmap or window, without requiring an actual - * widget instantiation, similar to the Macintosh Appearance Manager - * or Windows XP's DrawThemeBackground() API. - */ - -#ifndef _GTK_DRAWING_H_ -#define _GTK_DRAWING_H_ - -#include <gdk/gdk.h> -#include <gtk/gtkstyle.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*** type definitions ***/ -typedef struct { - guint8 active; - guint8 focused; - guint8 inHover; - guint8 disabled; - guint8 isDefault; - guint8 canDefault; - /* The depressed state is for buttons which remain active for a longer period: - * activated toggle buttons or buttons showing a popup menu. */ - guint8 depressed; - gint32 curpos; /* curpos and maxpos are used for scrollbars */ - gint32 maxpos; -} GtkWidgetState; - -typedef struct { - gint slider_width; - gint trough_border; - gint stepper_size; - gint stepper_spacing; - gint min_slider_size; -} MozGtkScrollbarMetrics; - -typedef enum { - MOZ_GTK_STEPPER_DOWN = 1 << 0, - MOZ_GTK_STEPPER_BOTTOM = 1 << 1, - MOZ_GTK_STEPPER_VERTICAL = 1 << 2 -} GtkScrollbarButtonFlags; - -/** flags for tab state **/ -typedef enum { - /* first eight bits are used to pass a margin */ - MOZ_GTK_TAB_MARGIN_MASK = 0xFF, - /* bottom tabs */ - MOZ_GTK_TAB_BOTTOM = 1 << 8, - /* the first tab in the group */ - MOZ_GTK_TAB_FIRST = 1 << 9, - /* the selected tab */ - MOZ_GTK_TAB_SELECTED = 1 << 10 -} GtkTabFlags; - -/** flags for menuitems **/ -typedef enum { - /* menuitem is part of the menubar */ - MOZ_TOPLEVEL_MENU_ITEM = 1 << 0 -} GtkMenuItemFlags; - -/* function type for moz_gtk_enable_style_props */ -typedef gint (*style_prop_t)(GtkStyle*, const gchar*, gint); - -/*** result/error codes ***/ -#define MOZ_GTK_SUCCESS 0 -#define MOZ_GTK_UNKNOWN_WIDGET -1 -#define MOZ_GTK_UNSAFE_THEME -2 - -/*** widget type constants ***/ -typedef enum { - /* Paints a GtkButton. flags is a GtkReliefStyle. */ - MOZ_GTK_BUTTON, - /* Paints a GtkCheckButton. flags is a boolean, 1=checked, 0=not checked. */ - MOZ_GTK_CHECKBUTTON, - /* Paints a GtkRadioButton. flags is a boolean, 1=checked, 0=not checked. */ - MOZ_GTK_RADIOBUTTON, - /** - * Paints the button of a GtkScrollbar. flags is a GtkArrowType giving - * the arrow direction. - */ - MOZ_GTK_SCROLLBAR_BUTTON, - /* Paints the trough (track) of a GtkScrollbar. */ - MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL, - MOZ_GTK_SCROLLBAR_TRACK_VERTICAL, - /* Paints the slider (thumb) of a GtkScrollbar. */ - MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL, - MOZ_GTK_SCROLLBAR_THUMB_VERTICAL, - /* Paints a GtkScale. */ - MOZ_GTK_SCALE_HORIZONTAL, - MOZ_GTK_SCALE_VERTICAL, - /* Paints a GtkScale thumb. */ - MOZ_GTK_SCALE_THUMB_HORIZONTAL, - MOZ_GTK_SCALE_THUMB_VERTICAL, - /* Paints a GtkSpinButton */ - MOZ_GTK_SPINBUTTON, - MOZ_GTK_SPINBUTTON_UP, - MOZ_GTK_SPINBUTTON_DOWN, - MOZ_GTK_SPINBUTTON_ENTRY, - /* Paints the gripper of a GtkHandleBox. */ - MOZ_GTK_GRIPPER, - /* Paints a GtkEntry. */ - MOZ_GTK_ENTRY, - /* Paints a GtkOptionMenu. */ - MOZ_GTK_DROPDOWN, - /* Paints a dropdown arrow (a GtkButton containing a down GtkArrow). */ - MOZ_GTK_DROPDOWN_ARROW, - /* Paints an entry in an editable option menu */ - MOZ_GTK_DROPDOWN_ENTRY, - /* Paints the container part of a GtkCheckButton. */ - MOZ_GTK_CHECKBUTTON_CONTAINER, - /* Paints the container part of a GtkRadioButton. */ - MOZ_GTK_RADIOBUTTON_CONTAINER, - /* Paints the label of a GtkCheckButton (focus outline) */ - MOZ_GTK_CHECKBUTTON_LABEL, - /* Paints the label of a GtkRadioButton (focus outline) */ - MOZ_GTK_RADIOBUTTON_LABEL, - /* Paints the background of a GtkHandleBox. */ - MOZ_GTK_TOOLBAR, - /* Paints a toolbar separator */ - MOZ_GTK_TOOLBAR_SEPARATOR, - /* Paints a GtkToolTip */ - MOZ_GTK_TOOLTIP, - /* Paints a GtkFrame (e.g. a status bar panel). */ - MOZ_GTK_FRAME, - /* Paints a resize grip for a GtkWindow */ - MOZ_GTK_RESIZER, - /* Paints a GtkProgressBar. */ - MOZ_GTK_PROGRESSBAR, - /* Paints a progress chunk of a GtkProgressBar. */ - MOZ_GTK_PROGRESS_CHUNK, - /* Paints a tab of a GtkNotebook. flags is a GtkTabFlags, defined above. */ - MOZ_GTK_TAB, - /* Paints the background and border of a GtkNotebook. */ - MOZ_GTK_TABPANELS, - /* Paints the background and border of a GtkTreeView */ - MOZ_GTK_TREEVIEW, - /* Paints treeheader cells */ - MOZ_GTK_TREE_HEADER_CELL, - /* Paints sort arrows in treeheader cells */ - MOZ_GTK_TREE_HEADER_SORTARROW, - /* Paints an expander for a GtkTreeView */ - MOZ_GTK_TREEVIEW_EXPANDER, - /* Paints a GtkExpander */ - MOZ_GTK_EXPANDER, - /* Paints the background of the menu bar. */ - MOZ_GTK_MENUBAR, - /* Paints the background of menus, context menus. */ - MOZ_GTK_MENUPOPUP, - /* Paints the arrow of menuitems that contain submenus */ - MOZ_GTK_MENUARROW, - /* Paints an arrow that points down */ - MOZ_GTK_TOOLBARBUTTON_ARROW, - /* Paints items of menubar and popups. */ - MOZ_GTK_MENUITEM, - MOZ_GTK_CHECKMENUITEM, - MOZ_GTK_RADIOMENUITEM, - MOZ_GTK_MENUSEPARATOR, - /* Paints a GtkVPaned separator */ - MOZ_GTK_SPLITTER_HORIZONTAL, - /* Paints a GtkHPaned separator */ - MOZ_GTK_SPLITTER_VERTICAL, - /* Paints the background of a window, dialog or page. */ - MOZ_GTK_WINDOW -} GtkThemeWidgetType; - -/*** General library functions ***/ -/** - * Initializes the drawing library. You must call this function - * prior to using any other functionality. - * returns: MOZ_GTK_SUCCESS if there were no errors - * MOZ_GTK_UNSAFE_THEME if the current theme engine is known - * to crash with gtkdrawing. - */ -gint moz_gtk_init(); - -/** - * Enable GTK+ 1.2.9+ theme enhancements. You must provide a pointer - * to the GTK+ 1.2.9+ function "gtk_style_get_prop_experimental". - * styleGetProp: pointer to gtk_style_get_prop_experimental - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint moz_gtk_enable_style_props(style_prop_t styleGetProp); - -/** - * Perform cleanup of the drawing library. You should call this function - * when your program exits, or you no longer need the library. - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint moz_gtk_shutdown(); - - -/*** Widget drawing ***/ -/** - * Paint a widget in the current theme. - * widget: a constant giving the widget to paint - * rect: the bounding rectangle for the widget - * cliprect: a clipprect rectangle for this painting operation - * state: the state of the widget. ignored for some widgets. - * flags: widget-dependant flags; see the GtkThemeWidgetType definition. - * direction: the text direction, to draw the widget correctly LTR and RTL. - */ -gint -moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable, - GdkRectangle* rect, GdkRectangle* cliprect, - GtkWidgetState* state, gint flags, - GtkTextDirection direction); - - -/*** Widget metrics ***/ -/** - * Get the border size of a widget - * left/right: [OUT] the widget's left/right border - * top/bottom: [OUT] the widget's top/bottom border - * direction: the text direction for the widget - * inhtml: boolean indicating whether this widget will be drawn as a HTML form control, - * in order to workaround a size issue (MOZ_GTK_BUTTON only, ignored otherwise) - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, - gint* right, gint* bottom, GtkTextDirection direction, - gboolean inhtml); - -/** - * Get the desired size of a GtkCheckButton - * indicator_size: [OUT] the indicator size - * indicator_spacing: [OUT] the spacing between the indicator and its - * container - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint -moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing); - -/** - * Get the desired size of a GtkRadioButton - * indicator_size: [OUT] the indicator size - * indicator_spacing: [OUT] the spacing between the indicator and its - * container - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint -moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing); - -/** Get the focus metrics for a treeheadercell, button, checkbox, or radio button. - * widget: [IN] the widget to get the focus metrics for - * interior_focus: [OUT] whether the focus is drawn around the - * label (TRUE) or around the whole container (FALSE) - * focus_width: [OUT] the width of the focus line - * focus_pad: [OUT] the padding between the focus line and children - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint -moz_gtk_widget_get_focus(GtkWidget* widget, gboolean* interior_focus, - gint* focus_width, gint* focus_pad); - -/** - * Get the desired size of a GtkScale thumb - * orient: [IN] the scale orientation - * thumb_length: [OUT] the length of the thumb - * thumb_height: [OUT] the height of the thumb - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint -moz_gtk_get_scalethumb_metrics(GtkOrientation orient, gint* thumb_length, gint* thumb_height); - -/** - * Get the desired metrics for a GtkScrollbar - * metrics: [IN] struct which will contain the metrics - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint -moz_gtk_get_scrollbar_metrics(MozGtkScrollbarMetrics* metrics); - -/** - * Get the desired size of a dropdown arrow button - * width: [OUT] the desired width - * height: [OUT] the desired height - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint moz_gtk_get_dropdown_arrow_size(gint* width, gint* height); - -/** - * Get the desired size of a toolbar separator - * size: [OUT] the desired width - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint moz_gtk_get_toolbar_separator_width(gint* size); - -/** - * Get the size of a regular GTK expander that shows/hides content - * size: [OUT] the size of the GTK expander, size = width = height. - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint moz_gtk_get_expander_size(gint* size); - -/** - * Get the size of a treeview's expander (we call them twisties) - * size: [OUT] the size of the GTK expander, size = width = height. - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint moz_gtk_get_treeview_expander_size(gint* size); - -/** - * Get the desired height of a menu separator - * size: [OUT] the desired height - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint moz_gtk_get_menu_separator_height(gint* size); - -/** - * Get the desired size of a splitter - * orientation: [IN] GTK_ORIENTATION_HORIZONTAL or GTK_ORIENTATION_VERTICAL - * size: [OUT] width or height of the splitter handle - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint moz_gtk_splitter_get_metrics(gint orientation, gint* size); - -/** - * Retrieve an actual GTK scrollbar widget for style analysis. It will not - * be modified. - */ -GtkWidget* moz_gtk_get_scrollbar_widget(void); - -/** - * Get the YTHICKNESS of a tab (notebook extension). - */ -gint moz_gtk_get_tab_thickness(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif |