diff options
Diffstat (limited to 'WebCore/platform/android')
22 files changed, 3724 insertions, 0 deletions
diff --git a/WebCore/platform/android/ClipboardAndroid.cpp b/WebCore/platform/android/ClipboardAndroid.cpp new file mode 100644 index 0000000..0322e01 --- /dev/null +++ b/WebCore/platform/android/ClipboardAndroid.cpp @@ -0,0 +1,105 @@ +/* + * Copyright 2009, The Android Open Source Project + * 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 "ClipboardAndroid.h" + +#include "CachedImage.h" +#include "Element.h" +#include "Frame.h" +#include "Range.h" + +namespace WebCore { + +ClipboardAndroid::ClipboardAndroid(ClipboardAccessPolicy policy, bool isForDragging) + : Clipboard(policy, isForDragging) +{ +} + +ClipboardAndroid::~ClipboardAndroid() +{ +} + +void ClipboardAndroid::clearData(const String&) +{ + ASSERT(isForDragging()); +} + +void ClipboardAndroid::clearAllData() +{ + ASSERT(isForDragging()); +} + +String ClipboardAndroid::getData(const String&, bool& success) const +{ + success = false; + return ""; +} + +bool ClipboardAndroid::setData(const String&, const String&) +{ + ASSERT(isForDragging()); + return false; +} + +// extensions beyond IE's API +HashSet<String> ClipboardAndroid::types() const +{ + return HashSet<String>(); +} + +void ClipboardAndroid::setDragImage(CachedImage*, const IntPoint&) +{ +} + +void ClipboardAndroid::setDragImageElement(Node*, const IntPoint&) +{ +} + +DragImageRef ClipboardAndroid::createDragImage(IntPoint&) const +{ + return 0; +} + +void ClipboardAndroid::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) +{ +} + +void ClipboardAndroid::writeURL(const KURL&, const String&, Frame*) +{ +} + +void ClipboardAndroid::writeRange(Range* selectedRange, Frame*) +{ + ASSERT(selectedRange); +} + +bool ClipboardAndroid::hasData() +{ + return false; +} + +} // namespace WebCore diff --git a/WebCore/platform/android/ClipboardAndroid.h b/WebCore/platform/android/ClipboardAndroid.h new file mode 100644 index 0000000..987463f --- /dev/null +++ b/WebCore/platform/android/ClipboardAndroid.h @@ -0,0 +1,64 @@ +/* + * Copyright 2009, The Android Open Source Project + * 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. + */ + +#ifndef ClipboardAndroid_h +#define ClipboardAndroid_h + +#include "Clipboard.h" + +#include "CachedResourceClient.h" + +namespace WebCore { + + class CachedImage; + + class ClipboardAndroid : public Clipboard, public CachedResourceClient { + public: + ClipboardAndroid(ClipboardAccessPolicy policy, bool isForDragging); + ~ClipboardAndroid(); + + void clearData(const String&); + void clearAllData(); + String getData(const String&, bool& success) const; + bool setData(const String&, const String&); + + // extensions beyond IE's API + HashSet<String> types() const; + + void setDragImage(CachedImage*, const IntPoint&); + void setDragImageElement(Node*, const IntPoint&); + + virtual DragImageRef createDragImage(IntPoint&) const; + virtual void declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*); + virtual void writeURL(const KURL&, const String&, Frame*); + virtual void writeRange(Range*, Frame*); + + virtual bool hasData(); + }; + +} // namespace WebCore + +#endif // ClipboardAndroid_h diff --git a/WebCore/platform/android/CursorAndroid.cpp b/WebCore/platform/android/CursorAndroid.cpp new file mode 100644 index 0000000..5c6e473 --- /dev/null +++ b/WebCore/platform/android/CursorAndroid.cpp @@ -0,0 +1,295 @@ +/* + * Copyright 2009, The Android Open Source Project + * Copyright (C) 2004, 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. + */ +#define LOG_TAG "WebCore" + +#include "config.h" +#include "Cursor.h" + +#include "NotImplemented.h" + +namespace WebCore { + +Cursor::Cursor(Image*, const IntPoint&) +{ + notImplemented(); +} + +Cursor::Cursor(const Cursor&) +{ + notImplemented(); +} + +Cursor::~Cursor() +{ + notImplemented(); +} + +Cursor& Cursor::operator=(const Cursor&) +{ + notImplemented(); + return *this; +} + +static Cursor c; +const Cursor& pointerCursor() +{ + notImplemented(); + return c; +} + +const Cursor& crossCursor() +{ + notImplemented(); + return c; +} + +const Cursor& handCursor() +{ + notImplemented(); + return c; +} + +const Cursor& moveCursor() +{ + notImplemented(); + return c; +} + +const Cursor& iBeamCursor() +{ + notImplemented(); + return c; +} + +const Cursor& waitCursor() +{ + notImplemented(); + return c; +} + +const Cursor& helpCursor() +{ + notImplemented(); + return c; +} + +const Cursor& eastResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& northResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& northEastResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& northWestResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& southResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& southEastResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& southWestResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& westResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& northSouthResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& eastWestResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& northEastSouthWestResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& northWestSouthEastResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& columnResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& rowResizeCursor() +{ + notImplemented(); + return c; +} + +const Cursor& verticalTextCursor() +{ + notImplemented(); + return c; +} + +const Cursor& cellCursor() +{ + notImplemented(); + return c; +} + +const Cursor& contextMenuCursor() +{ + notImplemented(); + return c; +} + +const Cursor& noDropCursor() +{ + notImplemented(); + return c; +} + +const Cursor& copyCursor() +{ + notImplemented(); + return c; +} + +const Cursor& progressCursor() +{ + notImplemented(); + return c; +} + +const Cursor& aliasCursor() +{ + notImplemented(); + return c; +} + +const Cursor& noneCursor() +{ + notImplemented(); + return c; +} + +const Cursor& middlePanningCursor() +{ + notImplemented(); + return c; +} + +const Cursor& eastPanningCursor() +{ + notImplemented(); + return c; +} + +const Cursor& northPanningCursor() +{ + notImplemented(); + return c; +} + +const Cursor& northEastPanningCursor() +{ + notImplemented(); + return c; +} + +const Cursor& northWestPanningCursor() +{ + notImplemented(); + return c; +} + +const Cursor& southPanningCursor() +{ + notImplemented(); + return c; +} + +const Cursor& southEastPanningCursor() +{ + notImplemented(); + return c; +} + +const Cursor& southWestPanningCursor() +{ + notImplemented(); + return c; +} + +const Cursor& westPanningCursor() +{ + notImplemented(); + return c; +} + +const Cursor& grabCursor() { + notImplemented(); + return c; +} + +const Cursor& grabbingCursor() { + notImplemented(); + return c; +} + +} // namespace WebCore diff --git a/WebCore/platform/android/DragDataAndroid.cpp b/WebCore/platform/android/DragDataAndroid.cpp new file mode 100644 index 0000000..39b2963 --- /dev/null +++ b/WebCore/platform/android/DragDataAndroid.cpp @@ -0,0 +1,96 @@ +/* + * Copyright 2009, The Android Open Source Project + * 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 "DragData.h" + +#include "Clipboard.h" +#include "Document.h" +#include "DocumentFragment.h" + +namespace WebCore { + +bool DragData::canSmartReplace() const +{ + return false; +} + +bool DragData::containsColor() const +{ + return false; +} + +bool DragData::containsPlainText() const +{ + return false; +} + +String DragData::asPlainText() const +{ + return String(); +} + +Color DragData::asColor() const +{ + return Color(); +} + +PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy) const +{ + return 0; +} + +bool DragData::containsCompatibleContent() const +{ + return false; +} + +bool DragData::containsURL() const +{ + return false; +} + +String DragData::asURL(String*) const +{ + return String(); +} + + +PassRefPtr<DocumentFragment> DragData::asFragment(Document*) const +{ + return 0; +} + +void DragData::asFilenames(Vector<String>&) const +{ +} + +bool DragData::containsFiles() const +{ + return false; +} + +} // namespace WebCore diff --git a/WebCore/platform/android/EventLoopAndroid.cpp b/WebCore/platform/android/EventLoopAndroid.cpp new file mode 100644 index 0000000..3a6d7ed --- /dev/null +++ b/WebCore/platform/android/EventLoopAndroid.cpp @@ -0,0 +1,38 @@ +/* + * Copyright 2008, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "EventLoop.h" + +#include "NotImplemented.h" + +namespace WebCore { + +void EventLoop::cycle() +{ + notImplemented(); +} + +} // namespace WebCore diff --git a/WebCore/platform/android/FileChooserAndroid.cpp b/WebCore/platform/android/FileChooserAndroid.cpp new file mode 100644 index 0000000..2c75373 --- /dev/null +++ b/WebCore/platform/android/FileChooserAndroid.cpp @@ -0,0 +1,59 @@ +/* + * Copyright 2006, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "FileChooser.h" + +#include "Font.h" + +namespace WebCore { + +String FileChooser::basenameForWidth(const Font& font, int width) const +{ + // FIXME: This could be a lot faster, but assuming the data will not + // often be much longer than the provided width, this may be fast enough. + String output = m_filenames[0].copy(); + while (font.width(TextRun(output.impl())) > width && output.length() > 4) { + output = output.replace(output.length() - 4, 4, String("...")); + } + return output; +} + +// The following two strings are used for File Upload form control, ie +// <input type="file">. The first is the text that appears on the button +// that when pressed, the user can browse for and select a file. The +// second string is rendered on the screen when no file has been selected. +String fileButtonChooseFileLabel() +{ + return String("Uploads Disabled"); +} + +String fileButtonNoFileSelectedLabel() +{ + return String("No file selected"); +} + +} // namesapce WebCore + diff --git a/WebCore/platform/android/FileSystemAndroid.cpp b/WebCore/platform/android/FileSystemAndroid.cpp new file mode 100644 index 0000000..b6d58bc --- /dev/null +++ b/WebCore/platform/android/FileSystemAndroid.cpp @@ -0,0 +1,101 @@ +/* + * Copyright 2009, The Android Open Source Project + * Copyright (C) 2007 Holger Hans Peter Freyther + * 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 "FileSystem.h" + +#include "CString.h" +#include <dlfcn.h> +#include <errno.h> +#include <sys/stat.h> +#include "cutils/log.h" + +namespace WebCore { + +// Global static used to store the base to the plugin path. +// This is set in WebSettings.cpp +String sPluginPath; + +CString fileSystemRepresentation(const String& path) { + return path.utf8(); +} + +CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle) +{ + int number = rand() % 10000 + 1; + CString filename; + do { + String path = sPluginPath; + path.append("/"); + path.append(prefix); + path.append(String::number(number)); + filename = path.utf8(); + const char *fstr = filename.data(); + handle = open(filename.data(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + number++; + } while (handle == -1 && errno == EEXIST); + + if (handle != -1) { + return filename; + } + return CString(); +} + +bool unloadModule(PlatformModule module) +{ + return dlclose(module) == 0; +} + +void closeFile(PlatformFileHandle& handle) +{ + if (isHandleValid(handle)) { + close(handle); + handle = invalidPlatformFileHandle; + } +} + +int writeToFile(PlatformFileHandle handle, const char* data, int length) +{ + int totalBytesWritten = 0; + while (totalBytesWritten < length) { + int bytesWritten = write(handle, data, length - totalBytesWritten); + if (bytesWritten < 0 && errno != EINTR) + return -1; + else if (bytesWritten > 0) + totalBytesWritten += bytesWritten; + } + + return totalBytesWritten; +} + +// new as of SVN change 36269, Sept 8, 2008 +String homeDirectoryPath() +{ + return sPluginPath; +} + +} diff --git a/WebCore/platform/android/KeyEventAndroid.cpp b/WebCore/platform/android/KeyEventAndroid.cpp new file mode 100644 index 0000000..5496bbc --- /dev/null +++ b/WebCore/platform/android/KeyEventAndroid.cpp @@ -0,0 +1,267 @@ +/* + * Copyright 2007, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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" + +#include "KeyboardCodes.h" +#include "NotImplemented.h" +#include <ui/KeycodeLabels.h> + +namespace WebCore { + +// compare to same function in gdk/KeyEventGdk.cpp +static int windowsKeyCodeForKeyEvent(unsigned int keyCode) { + // Does not provide all key codes, and does not handle all keys. + switch(keyCode) { + case kKeyCodeDel: + return VK_BACK; + case kKeyCodeTab: + return VK_TAB; + case kKeyCodeClear: + return VK_CLEAR; + case kKeyCodeDpadCenter: + case kKeyCodeNewline: + return VK_RETURN; + case kKeyCodeShiftLeft: + case kKeyCodeShiftRight: + return VK_SHIFT; + // back will serve as escape, although we probably do not have access to it + case kKeyCodeBack: + return VK_ESCAPE; + case kKeyCodeSpace: + return VK_SPACE; + case kKeyCodeHome: + return VK_HOME; + case kKeyCodeDpadLeft: + return VK_LEFT; + case kKeyCodeDpadUp: + return VK_UP; + case kKeyCodeDpadRight: + return VK_RIGHT; + case kKeyCodeDpadDown: + return VK_DOWN; + case kKeyCode0: + return VK_0; + case kKeyCode1: + return VK_1; + case kKeyCode2: + return VK_2; + case kKeyCode3: + return VK_3; + case kKeyCode4: + return VK_4; + case kKeyCode5: + return VK_5; + case kKeyCode6: + return VK_6; + case kKeyCode7: + return VK_7; + case kKeyCode8: + return VK_8; + case kKeyCode9: + return VK_9; + case kKeyCodeA: + return VK_A; + case kKeyCodeB: + return VK_B; + case kKeyCodeC: + return VK_C; + case kKeyCodeD: + return VK_D; + case kKeyCodeE: + return VK_E; + case kKeyCodeF: + return VK_F; + case kKeyCodeG: + return VK_G; + case kKeyCodeH: + return VK_H; + case kKeyCodeI: + return VK_I; + case kKeyCodeJ: + return VK_J; + case kKeyCodeK: + return VK_K; + case kKeyCodeL: + return VK_L; + case kKeyCodeM: + return VK_M; + case kKeyCodeN: + return VK_N; + case kKeyCodeO: + return VK_O; + case kKeyCodeP: + return VK_P; + case kKeyCodeQ: + return VK_Q; + case kKeyCodeR: + return VK_R; + case kKeyCodeS: + return VK_S; + case kKeyCodeT: + return VK_T; + case kKeyCodeU: + return VK_U; + case kKeyCodeV: + return VK_V; + case kKeyCodeW: + return VK_W; + case kKeyCodeX: + return VK_X; + case kKeyCodeY: + return VK_Y; + case kKeyCodeZ: + return VK_Z; + // colon + case kKeyCodeSemicolon: + return VK_OEM_1; + case kKeyCodeComma: + return VK_OEM_COMMA; + case kKeyCodeMinus: + return VK_OEM_MINUS; + case kKeyCodeEquals: + return VK_OEM_PLUS; + case kKeyCodePeriod: + return VK_OEM_PERIOD; + case kKeyCodeSlash: + return VK_OEM_2; + // maybe not the right choice + case kKeyCodeLeftBracket: + return VK_OEM_4; + case kKeyCodeBackslash: + return VK_OEM_5; + case kKeyCodeRightBracket: + return VK_OEM_6; + default: + return 0; + } +} + +static String keyIdentifierForAndroidKeyCode(int keyCode) +{ + // Does not return all of the same key identifiers, and + // does not handle all the keys. + switch (keyCode) { + case kKeyCodeClear: + return "Clear"; + case kKeyCodeNewline: + case kKeyCodeDpadCenter: + return "Enter"; + case kKeyCodeHome: + return "Home"; + case kKeyCodeDpadDown: + return "Down"; + case kKeyCodeDpadLeft: + return "Left"; + case kKeyCodeDpadRight: + return "Right"; + case kKeyCodeDpadUp: + return "Up"; + // Standard says that DEL becomes U+00007F. + case kKeyCodeDel: + return "U+00007F"; + default: + char upper[16]; + sprintf(upper, "U+%06X", windowsKeyCodeForKeyEvent(keyCode)); + return String(upper); + } +} + +static inline String singleCharacterString(int c) +{ + if (!c) + return String(); + if (c > 0xffff) { + UChar lead = U16_LEAD(c); + UChar trail = U16_TRAIL(c); + UChar utf16[2] = {lead, trail}; + return String(utf16, 2); + } + UChar n = (UChar)c; + return String(&n, 1); +} + +PlatformKeyboardEvent::PlatformKeyboardEvent(int keyCode, UChar32 unichar, + Type type, int repeatCount, + ModifierKey mods) + : m_type(type) + , m_text(singleCharacterString(unichar)) + , m_unmodifiedText(singleCharacterString(unichar)) + , m_keyIdentifier(keyIdentifierForAndroidKeyCode(keyCode)) + , m_autoRepeat(repeatCount > 0) + , m_windowsVirtualKeyCode(windowsKeyCodeForKeyEvent(keyCode)) + , m_nativeVirtualKeyCode(keyCode) + , m_isKeypad(false) + , m_shiftKey((mods & ShiftKey) != 0) + , m_ctrlKey((mods & CtrlKey) != 0) + , m_altKey((mods & AltKey) != 0) + , m_metaKey((mods & MetaKey) != 0) + // added for android + , m_repeatCount(repeatCount) + , m_unichar(unichar) +{ + // Copied from the mac port + if (m_windowsVirtualKeyCode == '\r') { + m_text = "\r"; + m_unmodifiedText = "\r"; + } + + if (m_text == "\x7F") + m_text = "\x8"; + if (m_unmodifiedText == "\x7F") + m_unmodifiedText = "\x8"; + + if (m_windowsVirtualKeyCode == 9) { + m_text = "\x9"; + m_unmodifiedText = "\x9"; + } +} + +bool PlatformKeyboardEvent::currentCapsLockState() +{ + notImplemented(); + return false; +} + +void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCompatibilityMode) +{ + // Copied with modification from the mac port. + 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; + } +} + +} // namespace WebCore diff --git a/WebCore/platform/android/KeyboardCodes.h b/WebCore/platform/android/KeyboardCodes.h new file mode 100644 index 0000000..321e9da --- /dev/null +++ b/WebCore/platform/android/KeyboardCodes.h @@ -0,0 +1,545 @@ +/* + * Copyright 2009, The Android Open Source Project + * 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 KeyboardCodes_H +#define KeyboardCodes_H + +namespace WebCore { + +// VK_LBUTTON (01) Left mouse button +// VK_RBUTTON (02) Right mouse button +// VK_CANCEL (03) Control-break processing +// VK_MBUTTON (04) Middle mouse button (three-button mouse) +// VK_XBUTTON1 (05) +// VK_XBUTTON2 (06) + +// VK_BACK (08) BACKSPACE key +const int VK_BACK = 0x08; + +// VK_TAB (09) TAB key +const int VK_TAB = 0x09; + +// VK_CLEAR (0C) CLEAR key +const int VK_CLEAR = 0x0C; + +// VK_RETURN (0D) +const int VK_RETURN = 0x0D; + +// VK_SHIFT (10) SHIFT key +const int VK_SHIFT = 0x10; + +// VK_CONTROL (11) CTRL key +const int VK_CONTROL = 0x11; + +// VK_MENU (12) ALT key +const int VK_MENU = 0x12; + +// VK_PAUSE (13) PAUSE key +const int VK_PAUSE = 0x13; + +// VK_CAPITAL (14) CAPS LOCK key +const int VK_CAPITAL = 0x14; + +// VK_KANA (15) Input Method Editor (IME) Kana mode +const int VK_KANA = 0x15; + +// VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL) +// VK_HANGUL (15) IME Hangul mode +const int VK_HANGUL = 0x15; + +// VK_JUNJA (17) IME Junja mode +const int VK_JUNJA = 0x17; + +// VK_FINAL (18) IME final mode +const int VK_FINAL = 0x18; + +// VK_HANJA (19) IME Hanja mode +const int VK_HANJA = 0x19; + +// VK_KANJI (19) IME Kanji mode +const int VK_KANJI = 0x19; + +// VK_ESCAPE (1B) ESC key +const int VK_ESCAPE = 0x1B; + +// VK_CONVERT (1C) IME convert +const int VK_CONVERT = 0x1C; + +// VK_NONCONVERT (1D) IME nonconvert +const int VK_NONCONVERT = 0x1D; + +// VK_ACCEPT (1E) IME accept +const int VK_ACCEPT = 0x1E; + +// VK_MODECHANGE (1F) IME mode change request +const int VK_MODECHANGE = 0x1F; + +// VK_SPACE (20) SPACEBAR +const int VK_SPACE = 0x20; + +// VK_PRIOR (21) PAGE UP key +const int VK_PRIOR = 0x21; + +// VK_NEXT (22) PAGE DOWN key +const int VK_NEXT = 0x22; + +// VK_END (23) END key +const int VK_END = 0x23; + +// VK_HOME (24) HOME key +const int VK_HOME = 0x24; + +// VK_LEFT (25) LEFT ARROW key +const int VK_LEFT = 0x25; + +// VK_UP (26) UP ARROW key +const int VK_UP = 0x26; + +// VK_RIGHT (27) RIGHT ARROW key +const int VK_RIGHT = 0x27; + +// VK_DOWN (28) DOWN ARROW key +const int VK_DOWN = 0x28; + +// VK_SELECT (29) SELECT key +const int VK_SELECT = 0x29; + +// VK_PRINT (2A) PRINT key +const int VK_PRINT = 0x2A; + +// VK_EXECUTE (2B) EXECUTE key +const int VK_EXECUTE = 0x2B; + +// VK_SNAPSHOT (2C) PRINT SCREEN key +const int VK_SNAPSHOT = 0x2C; + +// VK_INSERT (2D) INS key +const int VK_INSERT = 0x2D; + +// VK_DELETE (2E) DEL key +const int VK_DELETE = 0x2E; + +// VK_HELP (2F) HELP key +const int VK_HELP = 0x2F; + +// (30) 0 key +const int VK_0 = 0x30; + +// (31) 1 key +const int VK_1 = 0x31; + +// (32) 2 key +const int VK_2 = 0x32; + +// (33) 3 key +const int VK_3 = 0x33; + +// (34) 4 key +const int VK_4 = 0x34; + +// (35) 5 key; + +const int VK_5 = 0x35; + +// (36) 6 key +const int VK_6 = 0x36; + +// (37) 7 key +const int VK_7 = 0x37; + +// (38) 8 key +const int VK_8 = 0x38; + +// (39) 9 key +const int VK_9 = 0x39; + +// (41) A key +const int VK_A = 0x41; + +// (42) B key +const int VK_B = 0x42; + +// (43) C key +const int VK_C = 0x43; + +// (44) D key +const int VK_D = 0x44; + +// (45) E key +const int VK_E = 0x45; + +// (46) F key +const int VK_F = 0x46; + +// (47) G key +const int VK_G = 0x47; + +// (48) H key +const int VK_H = 0x48; + +// (49) I key +const int VK_I = 0x49; + +// (4A) J key +const int VK_J = 0x4A; + +// (4B) K key +const int VK_K = 0x4B; + +// (4C) L key +const int VK_L = 0x4C; + +// (4D) M key +const int VK_M = 0x4D; + +// (4E) N key +const int VK_N = 0x4E; + +// (4F) O key +const int VK_O = 0x4F; + +// (50) P key +const int VK_P = 0x50; + +// (51) Q key +const int VK_Q = 0x51; + +// (52) R key +const int VK_R = 0x52; + +// (53) S key +const int VK_S = 0x53; + +// (54) T key +const int VK_T = 0x54; + +// (55) U key +const int VK_U = 0x55; + +// (56) V key +const int VK_V = 0x56; + +// (57) W key +const int VK_W = 0x57; + +// (58) X key +const int VK_X = 0x58; + +// (59) Y key +const int VK_Y = 0x59; + +// (5A) Z key +const int VK_Z = 0x5A; + +// VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard) +const int VK_LWIN = 0x5B; + +// VK_RWIN (5C) Right Windows key (Natural keyboard) +const int VK_RWIN = 0x5C; + +// VK_APPS (5D) Applications key (Natural keyboard) +const int VK_APPS = 0x5D; + +// VK_SLEEP (5F) Computer Sleep key +const int VK_SLEEP = 0x5F; + +// VK_NUMPAD0 (60) Numeric keypad 0 key +const int VK_NUMPAD0 = 0x60; + +// VK_NUMPAD1 (61) Numeric keypad 1 key +const int VK_NUMPAD1 = 0x61; + +// VK_NUMPAD2 (62) Numeric keypad 2 key +const int VK_NUMPAD2 = 0x62; + +// VK_NUMPAD3 (63) Numeric keypad 3 key +const int VK_NUMPAD3 = 0x63; + +// VK_NUMPAD4 (64) Numeric keypad 4 key +const int VK_NUMPAD4 = 0x64; + +// VK_NUMPAD5 (65) Numeric keypad 5 key +const int VK_NUMPAD5 = 0x65; + +// VK_NUMPAD6 (66) Numeric keypad 6 key +const int VK_NUMPAD6 = 0x66; + +// VK_NUMPAD7 (67) Numeric keypad 7 key +const int VK_NUMPAD7 = 0x67; + +// VK_NUMPAD8 (68) Numeric keypad 8 key +const int VK_NUMPAD8 = 0x68; + +// VK_NUMPAD9 (69) Numeric keypad 9 key +const int VK_NUMPAD9 = 0x69; + +// VK_MULTIPLY (6A) Multiply key +const int VK_MULTIPLY = 0x6A; + +// VK_ADD (6B) Add key +const int VK_ADD = 0x6B; + +// VK_SEPARATOR (6C) Separator key +const int VK_SEPARATOR = 0x6C; + +// VK_SUBTRACT (6D) Subtract key +const int VK_SUBTRACT = 0x6D; + +// VK_DECIMAL (6E) Decimal key +const int VK_DECIMAL = 0x6E; + +// VK_DIVIDE (6F) Divide key +const int VK_DIVIDE = 0x6F; + +// VK_F1 (70) F1 key +const int VK_F1 = 0x70; + +// VK_F2 (71) F2 key +const int VK_F2 = 0x71; + +// VK_F3 (72) F3 key +const int VK_F3 = 0x72; + +// VK_F4 (73) F4 key +const int VK_F4 = 0x73; + +// VK_F5 (74) F5 key +const int VK_F5 = 0x74; + +// VK_F6 (75) F6 key +const int VK_F6 = 0x75; + +// VK_F7 (76) F7 key +const int VK_F7 = 0x76; + +// VK_F8 (77) F8 key +const int VK_F8 = 0x77; + +// VK_F9 (78) F9 key +const int VK_F9 = 0x78; + +// VK_F10 (79) F10 key +const int VK_F10 = 0x79; + +// VK_F11 (7A) F11 key +const int VK_F11 = 0x7A; + +// VK_F12 (7B) F12 key +const int VK_F12 = 0x7B; + +// VK_F13 (7C) F13 key +const int VK_F13 = 0x7C; + +// VK_F14 (7D) F14 key +const int VK_F14 = 0x7D; + +// VK_F15 (7E) F15 key +const int VK_F15 = 0x7E; + +// VK_F16 (7F) F16 key +const int VK_F16 = 0x7F; + +// VK_F17 (80H) F17 key +const int VK_F17 = 0x80; + +// VK_F18 (81H) F18 key +const int VK_F18 = 0x81; + +// VK_F19 (82H) F19 key +const int VK_F19 = 0x82; + +// VK_F20 (83H) F20 key +const int VK_F20 = 0x83; + +// VK_F21 (84H) F21 key +const int VK_F21 = 0x84; + +// VK_F22 (85H) F22 key +const int VK_F22 = 0x85; + +// VK_F23 (86H) F23 key +const int VK_F23 = 0x86; + +// VK_F24 (87H) F24 key +const int VK_F24 = 0x87; + +// VK_NUMLOCK (90) NUM LOCK key +const int VK_NUMLOCK = 0x90; + +// VK_SCROLL (91) SCROLL LOCK key +const int VK_SCROLL = 0x91; + +// VK_LSHIFT (A0) Left SHIFT key +const int VK_LSHIFT = 0xA0; + +// VK_RSHIFT (A1) Right SHIFT key +const int VK_RSHIFT = 0xA1; + +// VK_LCONTROL (A2) Left CONTROL key +const int VK_LCONTROL = 0xA2; + +// VK_RCONTROL (A3) Right CONTROL key +const int VK_RCONTROL = 0xA3; + +// VK_LMENU (A4) Left MENU key +const int VK_LMENU = 0xA4; + +// VK_RMENU (A5) Right MENU key +const int VK_RMENU = 0xA5; + +// VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key +const int VK_BROWSER_BACK = 0xA6; + +// VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key +const int VK_BROWSER_FORWARD = 0xA7; + +// VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key +const int VK_BROWSER_REFRESH = 0xA8; + +// VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key +const int VK_BROWSER_STOP = 0xA9; + +// VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key +const int VK_BROWSER_SEARCH = 0xAA; + +// VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key +const int VK_BROWSER_FAVORITES = 0xAB; + +// VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key +const int VK_BROWSER_HOME = 0xAC; + +// VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key +const int VK_VOLUME_MUTE = 0xAD; + +// VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key +const int VK_VOLUME_DOWN = 0xAE; + +// VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key +const int VK_VOLUME_UP = 0xAF; + +// VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key +const int VK_MEDIA_NEXT_TRACK = 0xB0; + +// VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key +const int VK_MEDIA_PREV_TRACK = 0xB1; + +// VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key +const int VK_MEDIA_STOP = 0xB2; + +// VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key +const int VK_MEDIA_PLAY_PAUSE = 0xB3; + +// VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key +const int VK_MEDIA_LAUNCH_MAIL = 0xB4; + +// VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key +const int VK_MEDIA_LAUNCH_MEDIA_SELECT = 0xB5; + +// VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key +const int VK_MEDIA_LAUNCH_APP1 = 0xB6; + +// VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key +const int VK_MEDIA_LAUNCH_APP2 = 0xB7; + +// VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key +const int VK_OEM_1 = 0xBA; + +// VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key +const int VK_OEM_PLUS = 0xBB; + +// VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key +const int VK_OEM_COMMA = 0xBC; + +// VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key +const int VK_OEM_MINUS = 0xBD; + +// VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key +const int VK_OEM_PERIOD = 0xBE; + +// VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key +const int VK_OEM_2 = 0xBF; + +// VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key +const int VK_OEM_3 = 0xC0; + +// VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key +const int VK_OEM_4 = 0xDB; + +// VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key +const int VK_OEM_5 = 0xDC; + +// VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key +const int VK_OEM_6 = 0xDD; + +// VK_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 +const int VK_OEM_7 = 0xDE; + +// VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. +const int VK_OEM_8 = 0xDF; + +// VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard +const int VK_OEM_102 = 0xE2; + +// VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key +const int VK_PROCESSKEY = 0xE5; + +// VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_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 +const int VK_PACKET = 0xE7; + +// VK_ATTN (F6) Attn key +const int VK_ATTN = 0xF6; + +// VK_CRSEL (F7) CrSel key +const int VK_CRSEL = 0xF7; + +// VK_EXSEL (F8) ExSel key +const int VK_EXSEL = 0xF8; + +// VK_EREOF (F9) Erase EOF key +const int VK_EREOF = 0xF9; + +// VK_PLAY (FA) Play key +const int VK_PLAY = 0xFA; + +// VK_ZOOM (FB) Zoom key +const int VK_ZOOM = 0xFB; + +// VK_NONAME (FC) Reserved for future use +const int VK_NONAME = 0xFC; + +// VK_PA1 (FD) PA1 key +const int VK_PA1 = 0xFD; + +// VK_OEM_CLEAR (FE) Clear key +const int VK_OEM_CLEAR = 0xFE; + +const int VK_UNKNOWN = 0; + +} + +#endif // KeyboardCodes_h diff --git a/WebCore/platform/android/LocalizedStringsAndroid.cpp b/WebCore/platform/android/LocalizedStringsAndroid.cpp new file mode 100644 index 0000000..02f135f --- /dev/null +++ b/WebCore/platform/android/LocalizedStringsAndroid.cpp @@ -0,0 +1,54 @@ +/* + * Copyright 2009, The Android Open Source Project + * 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 + * 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 "LocalizedStrings.h" + +#include "NotImplemented.h" +#include "PlatformString.h" + +namespace WebCore { + +String contextMenuItemTagInspectElement() +{ + return String::fromUTF8("Inspect Element"); +} + +String unknownFileSizeText() +{ + return String::fromUTF8("Unknown"); +} + +String imageTitle(const String& filename, const IntSize& size) +{ + notImplemented(); + return String(); +} + +} // namespace WebCore diff --git a/WebCore/platform/android/PopupMenuAndroid.cpp b/WebCore/platform/android/PopupMenuAndroid.cpp new file mode 100644 index 0000000..4d1fe04 --- /dev/null +++ b/WebCore/platform/android/PopupMenuAndroid.cpp @@ -0,0 +1,58 @@ +/* + * This file is part of the popup menu implementation for <select> elements in WebCore. + * + * Copyright 2009, The Android Open Source Project + * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com + * + * 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 "PopupMenu.h" + +namespace WebCore { + +// Now we handle all of this in WebViewCore.cpp. +PopupMenu::PopupMenu(PopupMenuClient* menuList) + : m_popupClient(menuList) +{ +} + +PopupMenu::~PopupMenu() +{ +} + +void PopupMenu::show(const IntRect&, FrameView*, int) +{ + +} + +void PopupMenu::hide() +{ +} + +void PopupMenu::updateFromElement() +{ +} + +bool PopupMenu::itemWritingDirectionIsNatural() +{ + return false; +} + +} // namespace WebCore diff --git a/WebCore/platform/android/RenderThemeAndroid.cpp b/WebCore/platform/android/RenderThemeAndroid.cpp new file mode 100644 index 0000000..e104c8e --- /dev/null +++ b/WebCore/platform/android/RenderThemeAndroid.cpp @@ -0,0 +1,318 @@ +/* + * Copyright 2006, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "RenderThemeAndroid.h" + +#include "RenderSkinAndroid.h" +#include "RenderSkinButton.h" +#include "RenderSkinCombo.h" +#include "RenderSkinRadio.h" + +#include "GraphicsContext.h" +#include "PlatformGraphicsContext.h" + +#include "SkCanvas.h" + +#define MAX_COMBO_HEIGHT 20 + +// Add a constant amount of padding to the textsize to get the final height of buttons, +// so that our button images are large enough to properly fit the text. +#define BUTTON_PADDING 18 + +// Add padding to the fontSize of ListBoxes to get their maximum sizes. +// Listboxes often have a specified size. Since we change them into dropdowns, +// we want a much smaller height, which encompasses the text. +#define LISTBOX_PADDING 5 + +namespace WebCore { + +static SkCanvas* getCanvasFromInfo(const RenderObject::PaintInfo& info) +{ + return info.context->platformContext()->mCanvas; +} + +RenderTheme* theme() +{ + static RenderThemeAndroid androidTheme; + return &androidTheme; +} + +RenderThemeAndroid::RenderThemeAndroid() +{ +} + +RenderThemeAndroid::~RenderThemeAndroid() +{ +} + +void RenderThemeAndroid::close() +{ +} + +bool RenderThemeAndroid::stateChanged(RenderObject* o, ControlState state) const +{ + if (CheckedState == state) { + o->repaint(); + return true; + } + return false; +} + +Color RenderThemeAndroid::platformActiveSelectionBackgroundColor() const +{ + return Color(46, 251, 0); +} + +Color RenderThemeAndroid::platformInactiveSelectionBackgroundColor() const +{ + return Color(255, 255, 0, 255); +} + +Color RenderThemeAndroid::platformActiveSelectionForegroundColor() const +{ + return Color::black; +} + +Color RenderThemeAndroid::platformInactiveSelectionForegroundColor() const +{ + return Color::black; +} + +Color RenderThemeAndroid::platformTextSearchHighlightColor() const +{ + return Color(192, 192, 192); +} + +int RenderThemeAndroid::baselinePosition(const RenderObject* obj) const +{ + // From the description of this function in RenderTheme.h: + // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline + // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of + // controls that need to do this. + // + // Our checkboxes and radio buttons need to be offset to line up properly. + return RenderTheme::baselinePosition(obj) - 5; +} + +void RenderThemeAndroid::addIntrinsicMargins(RenderStyle* style) const +{ + // Cut out the intrinsic margins completely if we end up using a small font size + if (style->fontSize() < 11) + return; + + // Intrinsic margin value. + const int m = 2; + + // FIXME: Using width/height alone and not also dealing with min-width/max-width is flawed. + if (style->width().isIntrinsicOrAuto()) { + if (style->marginLeft().quirk()) + style->setMarginLeft(Length(m, Fixed)); + if (style->marginRight().quirk()) + style->setMarginRight(Length(m, Fixed)); + } + + if (style->height().isAuto()) { + if (style->marginTop().quirk()) + style->setMarginTop(Length(m, Fixed)); + if (style->marginBottom().quirk()) + style->setMarginBottom(Length(m, Fixed)); + } +} + +bool RenderThemeAndroid::supportsFocus(ControlPart appearance) +{ + switch (appearance) { + case PushButtonPart: + case ButtonPart: + case TextFieldPart: + return true; + default: + return false; + } + + return false; +} + +void RenderThemeAndroid::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const +{ + // Padding code is taken from RenderThemeSafari.cpp + // It makes sure we have enough space for the button text. + const int padding = 8; + style->setPaddingLeft(Length(padding, Fixed)); + style->setPaddingRight(Length(padding, Fixed)); + style->setMinHeight(Length(style->fontSize() + BUTTON_PADDING, Fixed)); +} + +bool RenderThemeAndroid::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) +{ + RenderSkinRadio::Draw(getCanvasFromInfo(i), o->element(), ir, true); + return false; +} + +bool RenderThemeAndroid::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) +{ + // If it is a disabled button, simply paint it to the master picture. + Node* element = o->element(); + if (!element->isEnabled()) { + RenderSkinButton::Draw(getCanvasFromInfo(i), ir, RenderSkinAndroid::kDisabled); + } else { + // Store all the important information in the platform context. + i.context->platformContext()->storeButtonInfo(element, ir); + } + // We always return false so we do not request to be redrawn. + return false; +} + +bool RenderThemeAndroid::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) +{ + RenderSkinRadio::Draw(getCanvasFromInfo(i), o->element(), ir, false); + return false; +} + +void RenderThemeAndroid::setCheckboxSize(RenderStyle* style) const +{ + style->setWidth(Length(19, Fixed)); + style->setHeight(Length(19, Fixed)); +} + +void RenderThemeAndroid::setRadioSize(RenderStyle* style) const +{ + // This is the same as checkboxes. + setCheckboxSize(style); +} + +void RenderThemeAndroid::adjustTextFieldStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const +{ + addIntrinsicMargins(style); +} + +bool RenderThemeAndroid::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) +{ + return true; +} + +void RenderThemeAndroid::adjustTextAreaStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const +{ + addIntrinsicMargins(style); +} + +bool RenderThemeAndroid::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) +{ + if (o->isMenuList()) { + return paintCombo(o, i, ir); + } + return true; +} + +void RenderThemeAndroid::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + addIntrinsicMargins(style); +} + +bool RenderThemeAndroid::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) +{ + return true; +} + +void RenderThemeAndroid::adjustListboxStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + style->setPaddingRight(Length(RenderSkinCombo::extraWidth(), Fixed)); + style->setMaxHeight(Length(style->fontSize() + LISTBOX_PADDING, Fixed)); + addIntrinsicMargins(style); +} + +void RenderThemeAndroid::adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + style->setPaddingRight(Length(RenderSkinCombo::extraWidth(), Fixed)); + addIntrinsicMargins(style); +} + +bool RenderThemeAndroid::paintCombo(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) +{ + if (o->style() && o->style()->backgroundColor().alpha() == 0) + return true; + Node* element = o->element(); + int height = ir.height(); + int y = ir.y(); + // If the combo box is too large, leave it at its max height, and center it. + if (height > MAX_COMBO_HEIGHT) { + y += (height - MAX_COMBO_HEIGHT) >> 1; + height = MAX_COMBO_HEIGHT; + } + return RenderSkinCombo::Draw(getCanvasFromInfo(i), element, ir.x(), y, + ir.width(), height); +} + +bool RenderThemeAndroid::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) +{ + return paintCombo(o, i, ir); +} + +void RenderThemeAndroid::adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + // Copied from RenderThemeSafari. + const float baseFontSize = 11.0f; + const int baseBorderRadius = 5; + float fontScale = style->fontSize() / baseFontSize; + + style->resetPadding(); + style->setBorderRadius(IntSize(int(baseBorderRadius + fontScale - 1), int(baseBorderRadius + fontScale - 1))); // FIXME: Round up? + + const int minHeight = 15; + style->setMinHeight(Length(minHeight, Fixed)); + + style->setLineHeight(RenderStyle::initialLineHeight()); + // Found these padding numbers by trial and error. + const int padding = 4; + style->setPaddingTop(Length(padding, Fixed)); + style->setPaddingLeft(Length(padding, Fixed)); + // Added to make room for our arrow. + style->setPaddingRight(Length(RenderSkinCombo::extraWidth(), Fixed)); +} + +bool RenderThemeAndroid::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) +{ + return paintCombo(o, i, ir); +} + +bool RenderThemeAndroid::supportsFocusRing(const RenderStyle* style) const +{ + return (style->opacity() > 0 && style->hasAppearance() + && style->appearance() != TextFieldPart + && style->appearance() != SearchFieldPart + && style->appearance() != TextAreaPart + && style->appearance() != CheckboxPart + && style->appearance() != RadioPart + && style->appearance() != PushButtonPart + && style->appearance() != SquareButtonPart + && style->appearance() != ButtonPart + && style->appearance() != ButtonBevelPart + && style->appearance() != MenulistPart + && style->appearance() != MenulistButtonPart + ); +} + +} diff --git a/WebCore/platform/android/RenderThemeAndroid.h b/WebCore/platform/android/RenderThemeAndroid.h new file mode 100644 index 0000000..3b6e9cb --- /dev/null +++ b/WebCore/platform/android/RenderThemeAndroid.h @@ -0,0 +1,105 @@ +/* + * Copyright 2006, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 RenderThemeAndroid_h +#define RenderThemeAndroid_h + +#include "RenderTheme.h" + +namespace WebCore { + +class RenderSkinButton; +class RenderSkinRadio; +class RenderSkinCombo; + +struct ThemeData { + ThemeData() :m_part(0), m_state(0) {} + + unsigned m_part; + unsigned m_state; +}; + +class RenderThemeAndroid : public RenderTheme { +public: + RenderThemeAndroid(); + ~RenderThemeAndroid(); + + virtual bool stateChanged(RenderObject*, ControlState) const; + + virtual bool supportsFocusRing(const RenderStyle* style) const; + // A method asking if the theme's controls actually care about redrawing when hovered. + virtual bool supportsHover(const RenderStyle* style) const { return style->affectedByHoverRules(); } + + virtual int baselinePosition(const RenderObject*) const; + + virtual Color platformActiveSelectionBackgroundColor() const; + virtual Color platformInactiveSelectionBackgroundColor() const; + virtual Color platformActiveSelectionForegroundColor() const; + virtual Color platformInactiveSelectionForegroundColor() const; + virtual Color platformTextSearchHighlightColor() const; + + virtual void systemFont(int, WebCore::FontDescription&) const {} + + virtual int minimumMenuListSize(RenderStyle*) const { return 0; } + +protected: + 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 void adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const; + virtual bool paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); + + virtual void adjustTextFieldStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const; + virtual bool paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); + + virtual void adjustTextAreaStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const; + virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); + + bool paintCombo(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir); + + virtual void adjustListboxStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const; + virtual void adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const; + virtual bool paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); + + virtual void adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const; + virtual bool paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); + + virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + +private: + void addIntrinsicMargins(RenderStyle* style) const; + void close(); + + bool supportsFocus(ControlPart appearance); +}; + +} // namespace WebCore + +#endif // RenderThemeAndroid_h + diff --git a/WebCore/platform/android/ScreenAndroid.cpp b/WebCore/platform/android/ScreenAndroid.cpp new file mode 100644 index 0000000..c1e43b0 --- /dev/null +++ b/WebCore/platform/android/ScreenAndroid.cpp @@ -0,0 +1,134 @@ +/* + * Copyright 2009, The Android Open Source Project + * 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. + */ + +#define LOG_TAG "WebCore" + +#include "config.h" +#include "Screen.h" + +#include "FloatRect.h" +#include "Widget.h" + +#undef LOG // FIXME: Still have to do this to get the log to show up +#include "utils/Log.h" + +#include "ui/SurfaceComposerClient.h" +#include "ui/PixelFormat.h" +#include "ui/DisplayInfo.h" + +namespace WebCore { + +int screenDepth(Widget* page) +{ + android::DisplayInfo info; + android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info); + return info.pixelFormatInfo.bitsPerPixel; +} + +int screenDepthPerComponent(Widget* page) +{ + android::DisplayInfo info; + android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info); + return info.pixelFormatInfo.bitsPerPixel; +} + +bool screenIsMonochrome(Widget* page) +{ + return false; +} + +#ifdef ANDROID_ORIENTATION_SUPPORT +int Screen::orientation() const +{ + android::DisplayInfo info; + android::SurfaceComposerClient::getDisplayInfo( + android::DisplayID(0), &info); + // getDisplayInfo returns an enum describing the orientation. Map the enum + // to the values described here + // (http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/chapter_8_section_6.html) + switch (info.orientation) { + case android::ISurfaceComposer::eOrientationDefault: + return 0; + case android::ISurfaceComposer::eOrientation90: + return 90; + case android::ISurfaceComposer::eOrientation180: + return 180; + case android::ISurfaceComposer::eOrientation270: + return -90; + default: + LOGE("Bad orientation returned from getDisplayIndo %d", + info.orientation); + return 0; + } +} +#endif + +// The only place I have seen these values used is +// positioning popup windows. If we support multiple windows +// they will be most likely full screen. Therefore, +// the accuracy of these number are not too important. +FloatRect screenRect(Widget* page) +{ + android::DisplayInfo info; + android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info); + return FloatRect(0.0, 0.0, info.w, info.h); +} + +/* +Scale functions don't seem to be needed. There is no code that +call them, and they seem to only exist in ports and not in the core +WebKit code - davidc +FloatRect usableScreenRect(Widget* page) +{ + return FloatRect();; +} + +FloatRect scaleScreenRectToPageCoordinates(const FloatRect&, Widget*) +{ + return FloatRect();; +} + +FloatRect scalePageRectToScreenCoordinates(const FloatRect&, Widget*) +{ + return FloatRect();; +} + +float scaleFactor(Widget*) +{ + return 1.0f; +} +*/ + +// Similar screenRect, this function is commonly used by javascripts +// to position and resize windows (usually to full screen). +FloatRect screenAvailableRect(Widget*) +{ + android::DisplayInfo info; + android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info); + return FloatRect(0.0, 0.0, info.w, info.h); +} + +} diff --git a/WebCore/platform/android/ScrollViewAndroid.cpp b/WebCore/platform/android/ScrollViewAndroid.cpp new file mode 100644 index 0000000..5622d8b --- /dev/null +++ b/WebCore/platform/android/ScrollViewAndroid.cpp @@ -0,0 +1,105 @@ +/* + * Copyright 2007, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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. + */ +#define LOG_TAG "WebCore" + +#include "config.h" +#include "ScrollView.h" + +#include "FloatRect.h" +#include "FrameView.h" +#include "IntRect.h" +#include "WebCoreFrameBridge.h" +#include "WebCoreViewBridge.h" +#include "WebViewCore.h" + +/* + This class implementation does NOT actually emulate the Qt ScrollView. + It does provide an implementation that khtml will use to interact with + WebKit's WebFrameView documentView and our NSScrollView subclass. + + ScrollView's view is a NSScrollView (or subclass of NSScrollView) + in most cases. That scrollview is a subview of an + WebCoreFrameView. The WebCoreFrameView's documentView will also be + the scroll view's documentView. + + The WebCoreFrameView's size is the frame size. The WebCoreFrameView's documentView + corresponds to the frame content size. The scrollview itself is autosized to the + WebCoreFrameView's size (see Widget::resize). +*/ + +namespace WebCore { + +IntRect ScrollView::platformVisibleContentRect(bool includeScrollbars) const +{ + IntRect rect = platformWidget()->getBounds(); + // This makes subframes draw correctly, since subframes cannot scroll. + if (parent()) + return IntRect(0, 0, rect.width(), rect.height()); + return rect; +} + +IntSize ScrollView::platformContentsSize() const +{ + return m_contentsSize; +} + +void ScrollView::platformSetScrollPosition(const WebCore::IntPoint& pt) +{ + if (parent()) // don't attempt to scroll subframes; they're fully visible + return; + android::WebViewCore::getWebViewCore(this)->scrollTo(pt.x(), pt.y()); +} + +void ScrollView::platformScrollbarModes(ScrollbarMode& h, ScrollbarMode& v) const +{ + h = v = ScrollbarAlwaysOff; +} + +bool ScrollView::platformProhibitsScrolling() +{ + if (!isFrameView()) + return false; + FrameView* view = static_cast<FrameView*>(this); + // We want to ignore requests to scroll that were not initiated by the user. An + // example of this is when text is inserted into a textfield/area, which results in + // a scroll. We ignore this because we now how to do this ourselves in the UI thread. + // An example of it being initiated by the user is if the user clicks an anchor + // element which simply scrolls the page. + return !android::WebFrame::getWebFrame(view->frame())->userInitiatedClick(); +} + +void ScrollView::platformRepaintContentRectangle(const IntRect &rect, bool now) +{ + android::WebViewCore::getWebViewCore(this)->contentInvalidate(rect); +} + +#ifdef ANDROID_CAPTURE_OFFSCREEN_PAINTS +void ScrollView::platformOffscreenContentRectangle(const IntRect& rect) +{ + android::WebViewCore::getWebViewCore(this)->offInvalidate(rect); +} +#endif + +} diff --git a/WebCore/platform/android/SearchPopupMenuAndroid.cpp b/WebCore/platform/android/SearchPopupMenuAndroid.cpp new file mode 100644 index 0000000..fa976e7 --- /dev/null +++ b/WebCore/platform/android/SearchPopupMenuAndroid.cpp @@ -0,0 +1,52 @@ +/* + * Copyright 2006, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "SearchPopupMenu.h" + +namespace WebCore { + +// Save the past searches stored in 'searchItems' to a database associated with 'name' +void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +{ + //ASSERT(0); //notImplemented(); +} + +// Load past searches associated with 'name' from the database to 'searchItems' +void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +{ + //ASSERT(0); //notImplemented(); +} + +// Create a search popup menu - not sure what else we have to do here +SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) : PopupMenu(client) +{ + //ASSERT(0); //notImplemented(); +} + +// functions new to Jun-07 tip of tree merge: +bool SearchPopupMenu::enabled() { return false; } + +} // namespace WebCore diff --git a/WebCore/platform/android/SharedTimerAndroid.cpp b/WebCore/platform/android/SharedTimerAndroid.cpp new file mode 100644 index 0000000..d797cfb --- /dev/null +++ b/WebCore/platform/android/SharedTimerAndroid.cpp @@ -0,0 +1,64 @@ +/* + * Copyright 2007, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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. + */ +#define LOG_TAG "Timers" + +#include "config.h" +#include "SharedTimer.h" + +#include "SystemTime.h" +#include "JavaSharedClient.h" +#include "TimerClient.h" +#include <utils/Log.h> + +using namespace android; + +namespace WebCore { + +// Single timer, shared to implement all the timers managed by the Timer class. +// Not intended to be used directly; use the Timer class instead. +void setSharedTimerFiredFunction(void (*f)()) +{ + if (JavaSharedClient::GetTimerClient()) + JavaSharedClient::GetTimerClient()->setSharedTimerCallback(f); +} + +// The fire time is relative to the classic POSIX epoch of January 1, 1970, +// as the result of currentTime() is. +void setSharedTimerFireTime(double fireTime) +{ + long long timeInMS = (long long)((fireTime - currentTime()) * 1000); + + LOGV("setSharedTimerFireTime: in %ld millisec", timeInMS); + if (JavaSharedClient::GetTimerClient()) + JavaSharedClient::GetTimerClient()->setSharedTimer(timeInMS); +} + +void stopSharedTimer() +{ + if (JavaSharedClient::GetTimerClient()) + JavaSharedClient::GetTimerClient()->stopSharedTimer(); +} + +} // namespace WebCore diff --git a/WebCore/platform/android/SystemTimeAndroid.cpp b/WebCore/platform/android/SystemTimeAndroid.cpp new file mode 100644 index 0000000..9ac32dc --- /dev/null +++ b/WebCore/platform/android/SystemTimeAndroid.cpp @@ -0,0 +1,59 @@ +/* + * Copyright 2007, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 <sys/time.h> + +namespace WebCore { + +double currentTime() +{ + struct timeval tv; + + gettimeofday(&tv, (struct timezone *) NULL); + double now = tv.tv_sec + (tv.tv_usec / 1000000.0); + + return now; +} + +uint32_t get_thread_msec() +{ +#if defined(HAVE_POSIX_CLOCKS) + struct timespec tm; + + clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tm); + + return tm.tv_sec * 1000LL + tm.tv_nsec / 1000000; +#else + struct timeval tv; + + gettimeofday(&tv, NULL); + return tv.tv_sec * 1000LL + tv.tv_usec / 1000; +#endif +} + +} // namespace WebCore diff --git a/WebCore/platform/android/TemporaryLinkStubs.cpp b/WebCore/platform/android/TemporaryLinkStubs.cpp new file mode 100644 index 0000000..01789f4 --- /dev/null +++ b/WebCore/platform/android/TemporaryLinkStubs.cpp @@ -0,0 +1,965 @@ +/* + * Copyright 2007, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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. + */ +#define LOG_TAG "WebCore" + +#include "config.h" + +#define ANDROID_COMPILE_HACK + +#include <stdio.h> +#include <stdlib.h> +#include "AXObjectCache.h" +#include "CachedPage.h" +#include "CachedResource.h" +#include "CookieJar.h" +#include "Console.h" +#include "ContextMenu.h" +#include "ContextMenuItem.h" +#include "Clipboard.h" +#include "CString.h" +#include "Cursor.h" +#include "Database.h" +//#include "DebuggerCallFrame.h" +#include "DocumentFragment.h" +#include "DocumentLoader.h" +#include "EditCommand.h" +#include "Editor.h" +#include "File.h" +#include "FileList.h" +#include "Font.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameLoadRequest.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "HTMLFrameOwnerElement.h" +#include "HTMLKeygenElement.h" +#include "History.h" +#include "Icon.h" +#include "IconDatabase.h" +#include "IconLoader.h" +#include "IntPoint.h" +#include "JavaScriptCallFrame.h" +#include "JavaScriptDebugServer.h" +#include "API/JSClassRef.h" +#include "JavaScriptCallFrame.h" +#include "JavaScriptProfile.h" +#include "jni_utility.h" +#include "KURL.h" +#include "Language.h" +#include "loader.h" +#include "LocalizedStrings.h" +#include "MainResourceLoader.h" +#include "MIMETypeRegistry.h" +#include "Node.h" +#include "NotImplemented.h" +#include "PageCache.h" +#include "Pasteboard.h" +#include "Path.h" +#include "PluginInfoStore.h" +#include "ResourceError.h" +#include "ResourceHandle.h" +#include "ResourceLoader.h" +#include "Screen.h" +#include "Scrollbar.h" +#include "ScrollbarTheme.h" +#include "SmartReplace.h" +#include "Widget.h" + +using namespace WebCore; + +// This function is called when the frame view has changed the state of it's border. +// iFrames, which are have a FrameView, are drawn with a 1px left/right border and 2px top/bottom border +// Check function _shouldDrawBorder in WebFrameView.mm +// We don't draw borders unless css draws them. +//void FrameView::updateBorder() { verifiedOk(); } +//int WebCore::screenDepthPerComponent(Widget*) { ASSERT(0); notImplemented(); return 0; } +//bool WebCore::screenIsMonochrome(Widget*) { ASSERT(0); notImplemented(); return false; } + +/********************************************************/ +/* Completely empty stubs (mostly to allow DRT to run): */ +/********************************************************/ + +// This function is used by Javascript to find out what the default language +// the user has selected. It is used by the JS object Navigator.language +// I guess this information should be mapped with the Accept-Language: HTTP header. +String WebCore::defaultLanguage() +{ + verifiedOk(); + return "en"; +} + +namespace WebCore { + +#if !defined(ANDROID_PLUGINS) +// If plugins support is turned on, don't use these stubs. + +// Except for supportsMIMEType(), these Plugin functions are used by javascript's +// navigator.plugins[] object to provide the list of available plugins. This is most +// often used with to check to see if the browser supports Flash or which video +// codec to use. +// The supportsMIMEType() is used by the Frame to determine if a full screen instance +// of a plugin can be used to render a mimetype that is not native to the browser. +PluginInfo* PluginInfoStore::createPluginInfoForPluginAtIndex(unsigned) +{ + ASSERT(0); + return 0; +} + +unsigned PluginInfoStore::pluginCount() const +{ + verifiedOk(); + return 0; +} + +String PluginInfoStore::pluginNameForMIMEType(const String&) +{ + notImplemented(); + return String(); +} + +bool PluginInfoStore::supportsMIMEType(const String&) +{ + verifiedOk(); + return false; +} + +void refreshPlugins(bool) +{ + verifiedOk(); +} + +#endif // !defined(ANDROID_PLUGINS) + +// This function tells the bridge that a resource was loaded from the cache and thus +// the app may update progress with the amount of data loaded. +void CheckCacheObjectStatus(DocLoader*, CachedResource*) +{ + ASSERT(0); + notImplemented(); +} + +// This class is used in conjunction with the File Upload form element, and +// therefore relates to the above. When a file has been selected, an icon +// representing the file type can be rendered next to the filename on the +// web page. The icon for the file is encapsulated within this class. +Icon::~Icon() { } +void Icon::paint(GraphicsContext*, const IntRect&) { } + +// *** The following strings should be localized *** // + +// The following functions are used to fetch localized text for HTML form +// elements submit and reset. These strings are used when the page author +// has not specified any text for these buttons. +String submitButtonDefaultLabel() +{ + verifiedOk(); + return "Submit"; +} + +String resetButtonDefaultLabel() +{ + verifiedOk(); + return "Reset"; +} + +// The alt text for an input element is not used visually, but rather is +// used for accessability - eg reading the web page. See +// HTMLInputElement::altText() for more information. +String inputElementAltText() +{ + notImplemented(); + return String(); +} + +// This is the string that appears before an input box when the HTML element +// <ISINDEX> is used. The returned string is used if no PROMPT attribute is +// provided. +// note: Safari and FireFox use (too long for us imho) "This is a searchable index. Enter search keywords:" +String searchableIndexIntroduction() +{ + verifiedOk(); + return String("Enter search:"); +} + +// This function provides the default value for the CSS property: +// -webkit-focus-ring-color +// It is also related to the CSS property outline-color: +Color focusRingColor() +{ + verifiedOk(); + return 0xFF0000FF; +} + +// LocalizedStrings +String contextMenuItemTagOpenLinkInNewWindow() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagDownloadLinkToDisk() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagCopyLinkToClipboard() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagOpenImageInNewWindow() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagDownloadImageToDisk() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagCopyImageToClipboard() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagOpenFrameInNewWindow() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagCopy() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagGoBack() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagGoForward() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagStop() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagReload() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagCut() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagPaste() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagNoGuessesFound() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagIgnoreSpelling() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagLearnSpelling() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagSearchWeb() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagLookUpInDictionary() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagOpenLink() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagIgnoreGrammar() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagSpellingMenu() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagShowSpellingPanel(bool) +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagCheckSpelling() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagCheckSpellingWhileTyping() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagCheckGrammarWithSpelling() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagFontMenu() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagBold() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagItalic() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagUnderline() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagOutline() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagWritingDirectionMenu() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagDefaultDirection() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagLeftToRight() +{ + ASSERT(0); + return String(); +} + +String contextMenuItemTagRightToLeft() +{ + ASSERT(0); + return String(); +} + +} // namespace WebCore + +// FIXME, no support for spelling yet. +Pasteboard* Pasteboard::generalPasteboard() +{ + return new Pasteboard(); +} + +void Pasteboard::writeSelection(Range*, bool, Frame*) +{ + notImplemented(); +} + +void Pasteboard::writeURL(const KURL&, const String&, Frame*) +{ + notImplemented(); +} + +void Pasteboard::clear() +{ + notImplemented(); +} + +bool Pasteboard::canSmartReplace() +{ + notImplemented(); + return false; +} + +PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame*, PassRefPtr<Range>, bool, bool&) +{ + notImplemented(); + return 0; +} + +String Pasteboard::plainText(Frame*) +{ + notImplemented(); + return String(); +} + +Pasteboard::Pasteboard() +{ + notImplemented(); +} + +Pasteboard::~Pasteboard() +{ + notImplemented(); +} + + +ContextMenu::ContextMenu(const HitTestResult& result) : m_hitTestResult(result) +{ + ASSERT(0); + notImplemented(); +} + +ContextMenu::~ContextMenu() +{ + ASSERT(0); + notImplemented(); +} + +void ContextMenu::appendItem(ContextMenuItem&) +{ + ASSERT(0); + notImplemented(); +} + +void ContextMenu::setPlatformDescription(PlatformMenuDescription menu) +{ + ASSERT(0); + m_platformDescription = menu; +} + +PlatformMenuDescription ContextMenu::platformDescription() const +{ + ASSERT(0); + return m_platformDescription; +} + +ContextMenuItem::ContextMenuItem(PlatformMenuItemDescription) +{ + ASSERT(0); + notImplemented(); +} + +ContextMenuItem::ContextMenuItem(ContextMenu*) +{ + ASSERT(0); + notImplemented(); +} + +ContextMenuItem::ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, ContextMenu*) +{ + ASSERT(0); + notImplemented(); +} + +ContextMenuItem::~ContextMenuItem() +{ + ASSERT(0); + notImplemented(); +} + +PlatformMenuItemDescription ContextMenuItem::releasePlatformDescription() +{ + ASSERT(0); + notImplemented(); + return m_platformDescription; +} + +ContextMenuItemType ContextMenuItem::type() const +{ + ASSERT(0); + notImplemented(); + return ActionType; +} + +void ContextMenuItem::setType(ContextMenuItemType) +{ + ASSERT(0); + notImplemented(); +} + +ContextMenuAction ContextMenuItem::action() const +{ + ASSERT(0); + notImplemented(); + return ContextMenuItemTagNoAction; +} + +void ContextMenuItem::setAction(ContextMenuAction) +{ + ASSERT(0); + notImplemented(); +} + +String ContextMenuItem::title() const +{ + ASSERT(0); + notImplemented(); + return String(); +} + +void ContextMenuItem::setTitle(const String&) +{ + ASSERT(0); + notImplemented(); +} + +PlatformMenuDescription ContextMenuItem::platformSubMenu() const +{ + ASSERT(0); + notImplemented(); + return 0; +} + +void ContextMenuItem::setSubMenu(ContextMenu*) +{ + ASSERT(0); + notImplemented(); +} + +void ContextMenuItem::setChecked(bool) +{ + ASSERT(0); + notImplemented(); +} + +void ContextMenuItem::setEnabled(bool) +{ + ASSERT(0); + notImplemented(); +} + +namespace WebCore { + +float userIdleTime() +{ + notImplemented(); + return 0; +} + +// systemBeep() is called by the Editor to indicate that there was nothing to copy, and may be called from +// other places too. +void systemBeep() +{ + notImplemented(); +} + +} + +// functions new to Jun-07 tip of tree merge: + +// void WebCore::CachedPage::close() {} + +//void WebCore::Frame::print() {} +// void WebCore::Frame::issueTransposeCommand() {} +//void WebCore::Frame::cleanupPlatformScriptObjects() {} +// void WebCore::Frame::dashboardRegionsChanged() {} +//bool WebCore::Frame::isCharacterSmartReplaceExempt(unsigned short, bool) { return false; } + +void* WebCore::Frame::dragImageForSelection() +{ + return 0; +} + + +WebCore::String WebCore::MIMETypeRegistry::getMIMETypeForExtension(WebCore::String const&) +{ + return WebCore::String(); +} + +void WebCore::Pasteboard::writeImage(WebCore::Node*, WebCore::KURL const&, WebCore::String const&) {} + +namespace WebCore { + +IntSize dragImageSize(void*) +{ + return IntSize(0, 0); +} + +void deleteDragImage(void*) {} +void* createDragImageFromImage(Image*) +{ + return 0; +} + +void* dissolveDragImageToFraction(void*, float) +{ + return 0; +} + +void* createDragImageIconForCachedImage(CachedImage*) +{ + return 0; +} + +Cursor dummyCursor; +const Cursor& zoomInCursor() +{ + return dummyCursor; +} + +const Cursor& zoomOutCursor() +{ + return dummyCursor; +} + +const Cursor& notAllowedCursor() +{ + return dummyCursor; +} + +void* scaleDragImage(void*, FloatSize) +{ + return 0; +} + +String searchMenuRecentSearchesText() +{ + return String(); +} + +String searchMenuNoRecentSearchesText() +{ + return String(); +} + +String searchMenuClearRecentSearchesText() +{ + return String(); +} + +Vector<String> supportedKeySizes() +{ + notImplemented(); + return Vector<String>(); +} + +String signedPublicKeyAndChallengeString(unsigned int, String const&, WebCore::KURL const&) +{ + return String(); +} + +} // namespace WebCore + +// added for Nov-16-07 ToT integration +//namespace WebCore { +//void Frame::clearPlatformScriptObjects() { notImplemented(); } + +//} + +// functions new to Feb-19 tip of tree merge: +namespace WebCore { +// isCharacterSmartReplaceExempt is defined in SmartReplaceICU.cpp; in theory, we could use that one +// but we don't support all of the required icu functions +bool isCharacterSmartReplaceExempt(UChar32, bool) +{ + notImplemented(); + return false; +} + +} // WebCore + +int MakeDataExecutable; + +// functions new to Mar-2 tip of tree merge: +String KURL::fileSystemPath() const +{ + notImplemented(); + return String(); +} + + +// functions new to Jun-1 tip of tree merge: +PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String&) +{ + notImplemented(); + return 0; +} + + +namespace JSC { namespace Bindings { +bool dispatchJNICall(ExecState*, void const*, _jobject*, bool, JNIType, + _jmethodID*, jvalue*, jvalue&, char const*, JSValue*&) +{ + notImplemented(); + return false; +} + +} } // namespace JSC::Bindings + +char* dirname(const char*) +{ + notImplemented(); + return 0; +} + + // new as of SVN change 36269, Sept 8, 2008 +const String& Database::databaseInfoTableName() +{ + notImplemented(); + static const String dummy; + return dummy; +} + + // new as of SVN change 38068, Nov 5, 2008 +namespace WebCore { +void prefetchDNS(const String&) +{ + notImplemented(); +} + +void getSupportedKeySizes(Vector<String>&) +{ + notImplemented(); +} + +PassRefPtr<Icon> Icon::createIconForFile(const String&) +{ + notImplemented(); + return 0; +} + +PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>&) +{ + notImplemented(); + return 0; +} + +// ScrollbarTheme::nativeTheme() is called by RenderTextControl::calcPrefWidths() +// like this: scrollbarSize = ScrollbarTheme::nativeTheme()->scrollbarThickness(); +// with this comment: +// // FIXME: We should get the size of the scrollbar from the RenderTheme instead. +// since our text control doesn't have scrollbars, the default size of 0 width should be +// ok. notImplemented() is commented out below so that we can find other unresolved +// unimplemented functions. +ScrollbarTheme* ScrollbarTheme::nativeTheme() +{ + /* notImplemented(); */ + static ScrollbarTheme theme; + return &theme; +} + +JSC::JSValue* toJS(JSC::ExecState*, JSC::Profile*) +{ + notImplemented(); + return 0; +} + +} // namespace WebCore + +FileList::FileList() +{ + notImplemented(); +} + +File* FileList::item(unsigned index) const +{ + notImplemented(); + return 0; +} + +AXObjectCache::~AXObjectCache() +{ + notImplemented(); +} + +// This value turns on or off the Mac specific Accessibility support. +bool AXObjectCache::gAccessibilityEnabled = false; +bool AXObjectCache::gAccessibilityEnhancedUserInterfaceEnabled = false; + +void AXObjectCache::childrenChanged(RenderObject*) +{ + notImplemented(); +} + +void AXObjectCache::remove(RenderObject*) +{ + notImplemented(); +} + +using namespace JSC; + + +OpaqueJSClass::~OpaqueJSClass() +{ + notImplemented(); +} + +OpaqueJSClassContextData::~OpaqueJSClassContextData() +{ + notImplemented(); +} + +namespace WebCore { + +JSC::JSValue* JavaScriptCallFrame::evaluate(JSC::UString const&, JSC::JSValue*&) const +{ + notImplemented(); + return 0; +} + +const JSC::ScopeChainNode* JavaScriptCallFrame::scopeChain() const +{ + notImplemented(); + return 0; +} + +JSC::JSObject* JavaScriptCallFrame::thisObject() const +{ + notImplemented(); + return 0; +} + +JSC::DebuggerCallFrame::Type JavaScriptCallFrame::type() const +{ + notImplemented(); + return (JSC::DebuggerCallFrame::Type) 0; +} + +JavaScriptCallFrame* JavaScriptCallFrame::caller() +{ + notImplemented(); + return 0; +} + +String JavaScriptCallFrame::functionName() const +{ + notImplemented(); + return String(); +} +} + +JavaScriptDebugServer::JavaScriptDebugServer() : + m_recompileTimer(this, 0) +{ + notImplemented(); +} + +JavaScriptDebugServer::~JavaScriptDebugServer() +{ + notImplemented(); +} + +JavaScriptDebugServer& JavaScriptDebugServer::shared() +{ + static JavaScriptDebugServer server; + notImplemented(); + return server; +} + +void JavaScriptDebugServer::atStatement(const DebuggerCallFrame&, int, int) +{ + notImplemented(); +} + +void JavaScriptDebugServer::callEvent(const DebuggerCallFrame&, int, int) +{ + notImplemented(); +} + +void JavaScriptDebugServer::didExecuteProgram(const DebuggerCallFrame&, int, int) +{ + notImplemented(); +} + +void JavaScriptDebugServer::didReachBreakpoint(const DebuggerCallFrame&, int, int) +{ + notImplemented(); +} + +void JavaScriptDebugServer::exception(const DebuggerCallFrame&, int, int) +{ + notImplemented(); +} + +void JavaScriptDebugServer::sourceParsed(ExecState*, const SourceCode&, int, const UString&) +{ + notImplemented(); +} + +void JavaScriptDebugServer::pageCreated(Page*) +{ + notImplemented(); +} + +void JavaScriptDebugServer::returnEvent(const DebuggerCallFrame&, int, int) +{ + notImplemented(); +} + +void JavaScriptDebugServer::willExecuteProgram(const DebuggerCallFrame&, int, int) +{ + notImplemented(); +} diff --git a/WebCore/platform/android/TextBoundaries.cpp b/WebCore/platform/android/TextBoundaries.cpp new file mode 100644 index 0000000..457a36e --- /dev/null +++ b/WebCore/platform/android/TextBoundaries.cpp @@ -0,0 +1,78 @@ +/* + * Copyright 2009, The Android Open Source Project + * 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 "TextBreakIterator.h" + +namespace WebCore { + +int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward) +{ + UBreakIterator* it = wordBreakIterator(chars, len); + + int newPosition = position; + + 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/WebCore/platform/android/TextBreakIteratorInternalICU.cpp b/WebCore/platform/android/TextBreakIteratorInternalICU.cpp new file mode 100644 index 0000000..9bebe74 --- /dev/null +++ b/WebCore/platform/android/TextBreakIteratorInternalICU.cpp @@ -0,0 +1,36 @@ +/* + * Copyright 2007, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "TextBreakIteratorInternalICU.h" + +namespace WebCore { + +const char* currentTextBreakLocaleID() +{ + return "en_us"; +} + +} diff --git a/WebCore/platform/android/WidgetAndroid.cpp b/WebCore/platform/android/WidgetAndroid.cpp new file mode 100644 index 0000000..84ab26c --- /dev/null +++ b/WebCore/platform/android/WidgetAndroid.cpp @@ -0,0 +1,126 @@ +/* + * Copyright 2007, The Android Open Source Project + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "Font.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "NotImplemented.h" +#include "WebCoreFrameBridge.h" +#include "WebCoreViewBridge.h" +#include "WebViewCore.h" + +namespace WebCore { + +Widget::Widget(PlatformWidget widget) +{ + init(widget); +} + +Widget::~Widget() +{ + ASSERT(!parent()); + releasePlatformWidget(); +} + +IntRect Widget::frameRect() const +{ + // FIXME: use m_frame instead? + if (!platformWidget()) + return IntRect(0, 0, 0, 0); + return platformWidget()->getBounds(); +} + +void Widget::setFocus() +{ + notImplemented(); +} + +void Widget::paint(GraphicsContext* ctx, const IntRect& r) +{ + // FIXME: in what case, will this be called for the top frame? + if (!platformWidget()) + return; + platformWidget()->draw(ctx, r); +} + +void Widget::releasePlatformWidget() +{ + Release(platformWidget()); +} + +void Widget::retainPlatformWidget() +{ + Retain(platformWidget()); +} + +void Widget::setCursor(const Cursor& cursor) +{ + notImplemented(); +} + +void Widget::show() +{ + notImplemented(); +} + +void Widget::hide() +{ + notImplemented(); +} + +void Widget::setFrameRect(const IntRect& rect) +{ + // FIXME: set m_frame instead? + // platformWidget() is NULL when called from Scrollbar + if (!platformWidget()) + return; + platformWidget()->setLocation(rect.x(), rect.y()); + platformWidget()->setSize(rect.width(), rect.height()); +} + +void Widget::setIsSelected(bool isSelected) +{ + notImplemented(); +} + +int Widget::screenWidth() const +{ + const Widget* widget = this; + while (!widget->isFrameView()) { + widget = widget->parent(); + if (!widget) + break; + } + if (!widget) + return 0; + + return android::WebViewCore::getWebViewCore( + static_cast<const ScrollView*>(widget))->screenWidth(); +} + +} // WebCore namepsace |