diff options
Diffstat (limited to 'Source/WebCore/platform/efl')
40 files changed, 5361 insertions, 0 deletions
diff --git a/Source/WebCore/platform/efl/ClipboardEfl.cpp b/Source/WebCore/platform/efl/ClipboardEfl.cpp new file mode 100644 index 0000000..a7c2a54 --- /dev/null +++ b/Source/WebCore/platform/efl/ClipboardEfl.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "ClipboardEfl.h" + +#include "Editor.h" +#include "FileList.h" +#include "NotImplemented.h" +#include <wtf/text/StringHash.h> + +namespace WebCore { +PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame*) +{ + return ClipboardEfl::create(policy, Clipboard::CopyAndPaste); +} + +PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy, DragData*, Frame*) +{ + return 0; +} + +ClipboardEfl::ClipboardEfl(ClipboardAccessPolicy policy, ClipboardType clipboardType) + : Clipboard(policy, clipboardType) +{ + notImplemented(); +} + +ClipboardEfl::~ClipboardEfl() +{ + notImplemented(); +} + +void ClipboardEfl::clearData(const String&) +{ + notImplemented(); +} + +void ClipboardEfl::writePlainText(const WTF::String&) +{ + notImplemented(); +} + +void ClipboardEfl::clearAllData() +{ + notImplemented(); +} + +String ClipboardEfl::getData(const String&, bool &success) const +{ + notImplemented(); + success = false; + return String(); +} + +bool ClipboardEfl::setData(const String&, const String&) +{ + notImplemented(); + return false; +} + +HashSet<String> ClipboardEfl::types() const +{ + notImplemented(); + return HashSet<String>(); +} + +PassRefPtr<FileList> ClipboardEfl::files() const +{ + notImplemented(); + return 0; +} + +IntPoint ClipboardEfl::dragLocation() const +{ + notImplemented(); + return IntPoint(0, 0); +} + +CachedImage* ClipboardEfl::dragImage() const +{ + notImplemented(); + return 0; +} + +void ClipboardEfl::setDragImage(CachedImage*, const IntPoint&) +{ + notImplemented(); +} + +Node* ClipboardEfl::dragImageElement() +{ + notImplemented(); + return 0; +} + +void ClipboardEfl::setDragImageElement(Node*, const IntPoint&) +{ + notImplemented(); +} + +DragImageRef ClipboardEfl::createDragImage(IntPoint&) const +{ + notImplemented(); + return 0; +} + +void ClipboardEfl::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) +{ + notImplemented(); +} + +void ClipboardEfl::writeURL(const KURL&, const String&, Frame*) +{ + notImplemented(); +} + +void ClipboardEfl::writeRange(Range*, Frame*) +{ + notImplemented(); +} + +bool ClipboardEfl::hasData() +{ + notImplemented(); + return false; +} + +} diff --git a/Source/WebCore/platform/efl/ClipboardEfl.h b/Source/WebCore/platform/efl/ClipboardEfl.h new file mode 100644 index 0000000..06f4e58 --- /dev/null +++ b/Source/WebCore/platform/efl/ClipboardEfl.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef ClipboardEfl_h +#define ClipboardEfl_h + +#include "Clipboard.h" + +namespace WebCore { +class CachedImage; + +class ClipboardEfl : public Clipboard { +public: + static PassRefPtr<ClipboardEfl> create(ClipboardAccessPolicy policy, ClipboardType clipboardType = CopyAndPaste) + { + return adoptRef(new ClipboardEfl(policy, clipboardType)); + } + ~ClipboardEfl(); + + void clearData(const String&); + void clearAllData(); + String getData(const String&, bool&) const; + bool setData(const String&, const String&); + + HashSet<String> types() const; + virtual PassRefPtr<FileList> files() const; + + IntPoint dragLocation() const; + CachedImage* dragImage() const; + void setDragImage(CachedImage*, const IntPoint&); + Node* dragImageElement(); + 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(); + + virtual void writePlainText(const WTF::String&); + +private: + ClipboardEfl(ClipboardAccessPolicy, ClipboardType); +}; +} + +#endif diff --git a/Source/WebCore/platform/efl/ContextMenuEfl.cpp b/Source/WebCore/platform/efl/ContextMenuEfl.cpp new file mode 100644 index 0000000..a5c6524 --- /dev/null +++ b/Source/WebCore/platform/efl/ContextMenuEfl.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "ContextMenu.h" + +#include "NotImplemented.h" + +namespace WebCore { + +ContextMenu::ContextMenu(void* menu) +{ + getContextMenuItems(menu, m_items); +} + +ContextMenu::ContextMenu() +{ + notImplemented(); +} + +void ContextMenu::getContextMenuItems(void* menu, Vector<ContextMenuItem>& items) +{ + notImplemented(); +} + +void* ContextMenu::createNativeMenuFromItems(const Vector<ContextMenuItem>& items) +{ + notImplemented(); + return 0; +} + +void* ContextMenu::nativeMenu() const +{ + return createNativeMenuFromItems(m_items); +} + +} diff --git a/Source/WebCore/platform/efl/ContextMenuItemEfl.cpp b/Source/WebCore/platform/efl/ContextMenuItemEfl.cpp new file mode 100644 index 0000000..5ce8fab --- /dev/null +++ b/Source/WebCore/platform/efl/ContextMenuItemEfl.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net> + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ContextMenuItem.h" + +#include "NotImplemented.h" + +namespace WebCore { + +ContextMenuItem::ContextMenuItem(void* const&) +{ + notImplemented(); +} + +ContextMenuItem::ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, ContextMenu*) +{ + notImplemented(); +} + +ContextMenuItem::~ContextMenuItem() +{ + notImplemented(); +} + +void* ContextMenuItem::nativeMenuItem() const +{ + notImplemented(); + return 0; +} + +ContextMenuItemType ContextMenuItem::type() const +{ + notImplemented(); + return ActionType; +} + +void ContextMenuItem::setAction(ContextMenuAction) +{ + notImplemented(); +} + +ContextMenuAction ContextMenuItem::action() const +{ + notImplemented(); + return ContextMenuItemTagNoAction; +} + +void ContextMenuItem::setChecked(bool) +{ + notImplemented(); +} + +bool ContextMenuItem::checked() const +{ + notImplemented(); + return 0; +} + +void ContextMenuItem::setEnabled(bool) +{ + notImplemented(); +} + +bool ContextMenuItem::enabled() const +{ + notImplemented(); + return false; +} + +void ContextMenuItem::setSubMenu(ContextMenu*) +{ + notImplemented(); +} + +} diff --git a/Source/WebCore/platform/efl/CookieJarEfl.cpp b/Source/WebCore/platform/efl/CookieJarEfl.cpp new file mode 100644 index 0000000..6c78dbd --- /dev/null +++ b/Source/WebCore/platform/efl/CookieJarEfl.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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 "CookieJar.h" + +#include "KURL.h" +#include "PlatformString.h" +#include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> + +namespace WebCore { + +static HashMap<String, String> cookieJar; + +void setCookies(Document* document, const KURL& url, const KURL& policyURL, const String& value) +{ + cookieJar.set(url.string(), value); +} + +String cookies(const Document* document, const KURL& url) +{ + return cookieJar.get(url.string()); +} + +bool cookiesEnabled(const Document* document) +{ + return true; +} + +} diff --git a/Source/WebCore/platform/efl/CursorEfl.cpp b/Source/WebCore/platform/efl/CursorEfl.cpp new file mode 100644 index 0000000..47141f9 --- /dev/null +++ b/Source/WebCore/platform/efl/CursorEfl.cpp @@ -0,0 +1,409 @@ +/* + * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> + * Copyright (C) 2006 George Staikos <staikos@kde.org> + * Copyright (C) 2006 Charles Samuels <charles@kde.org> + * Copyright (C) 2008 Holger Hans Peter Freyther + * Copyright (C) 2008 Kenneth Rohde Christiansen + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Cursor.h" + +#include "NotImplemented.h" + +#include <Edje.h> +#include <Evas.h> +#include <stdio.h> +#include <wtf/Assertions.h> + +namespace WebCore { + +Cursor::Cursor(PlatformCursor p) +{ + m_platformCursor = eina_stringshare_add(p); +} + +Cursor::Cursor(const Cursor& other) +{ + m_platformCursor = eina_stringshare_ref(other.m_platformCursor); +} + +Cursor::~Cursor() +{ + if (m_platformCursor) { + eina_stringshare_del(m_platformCursor); + m_platformCursor = 0; + } +} + +Cursor::Cursor(Image* image, const IntPoint& hotspot) + : m_platformCursor(0) +{ + notImplemented(); +} + +Cursor& Cursor::operator=(const Cursor& other) +{ + eina_stringshare_ref(other.m_platformCursor); + eina_stringshare_del(m_platformCursor); + m_platformCursor = other.m_platformCursor; + return *this; +} + +namespace { + +class Cursors { +protected: + Cursors() + : PointerCursor("cursor/pointer") + , MoveCursor("cursor/move") + , CrossCursor("cursor/cross") + , HandCursor("cursor/hand") + , IBeamCursor("cursor/i_beam") + , WaitCursor("cursor/wait") + , HelpCursor("cursor/help") + , EastResizeCursor("cursor/east_resize") + , NorthResizeCursor("cursor/north_resize") + , NorthEastResizeCursor("cursor/north_east_resize") + , NorthWestResizeCursor("cursor/north_west_resize") + , SouthResizeCursor("cursor/south_resize") + , SouthEastResizeCursor("cursor/south_east_resize") + , SouthWestResizeCursor("cursor/south_west_resize") + , WestResizeCursor("cursor/west_resize") + , NorthSouthResizeCursor("cursor/north_south_resize") + , EastWestResizeCursor("cursor/east_west_resize") + , NorthEastSouthWestResizeCursor("cursor/north_east_south_west_resize") + , NorthWestSouthEastResizeCursor("cursor/north_west_south_east_resize") + , ColumnResizeCursor("cursor/column_resize") + , RowResizeCursor("cursor/row_resize") + , MiddlePanningCursor("cursor/middle_panning") + , EastPanningCursor("cursor/east_panning") + , NorthPanningCursor("cursor/north_panning") + , NorthEastPanningCursor("cursor/north_east_panning") + , NorthWestPanningCursor("cursor/north_west_panning") + , SouthPanningCursor("cursor/south_panning") + , SouthEastPanningCursor("cursor/south_east_panning") + , SouthWestPanningCursor("cursor/south_west_panning") + , WestPanningCursor("cursor/west_panning") + , VerticalTextCursor("cursor/vertical_text") + , CellCursor("cursor/cell") + , ContextMenuCursor("cursor/context_menu") + , NoDropCursor("cursor/no_drop") + , CopyCursor("cursor/copy") + , ProgressCursor("cursor/progress") + , AliasCursor("cursor/alias") + , NoneCursor("cursor/none") + , NotAllowedCursor("cursor/not_allowed") + , ZoomInCursor("cursor/zoom_in") + , ZoomOutCursor("cursor/zoom_out") + , GrabCursor("cursor/grab") + , GrabbingCursor("cursor/grabbing") + { + } + + ~Cursors() + { + } + +public: + static Cursors* self(); + static Cursors* s_self; + + Cursor PointerCursor; + Cursor MoveCursor; + Cursor CrossCursor; + Cursor HandCursor; + Cursor IBeamCursor; + Cursor WaitCursor; + Cursor HelpCursor; + Cursor EastResizeCursor; + Cursor NorthResizeCursor; + Cursor NorthEastResizeCursor; + Cursor NorthWestResizeCursor; + Cursor SouthResizeCursor; + Cursor SouthEastResizeCursor; + Cursor SouthWestResizeCursor; + Cursor WestResizeCursor; + Cursor NorthSouthResizeCursor; + Cursor EastWestResizeCursor; + Cursor NorthEastSouthWestResizeCursor; + Cursor NorthWestSouthEastResizeCursor; + Cursor ColumnResizeCursor; + Cursor RowResizeCursor; + Cursor MiddlePanningCursor; + Cursor EastPanningCursor; + Cursor NorthPanningCursor; + Cursor NorthEastPanningCursor; + Cursor NorthWestPanningCursor; + Cursor SouthPanningCursor; + Cursor SouthEastPanningCursor; + Cursor SouthWestPanningCursor; + Cursor WestPanningCursor; + Cursor VerticalTextCursor; + Cursor CellCursor; + Cursor ContextMenuCursor; + Cursor NoDropCursor; + Cursor CopyCursor; + Cursor ProgressCursor; + Cursor AliasCursor; + Cursor NoneCursor; + Cursor NotAllowedCursor; + Cursor ZoomInCursor; + Cursor ZoomOutCursor; + Cursor GrabCursor; + Cursor GrabbingCursor; +}; + +Cursors* Cursors::s_self = 0; + +Cursors* Cursors::self() +{ + if (!s_self) + s_self = new Cursors(); + + return s_self; +} + +} + +const Cursor& pointerCursor() +{ + return Cursors::self()->PointerCursor; +} + +const Cursor& moveCursor() +{ + return Cursors::self()->MoveCursor; +} + +const Cursor& crossCursor() +{ + return Cursors::self()->CrossCursor; +} + +const Cursor& handCursor() +{ + return Cursors::self()->HandCursor; +} + +const Cursor& iBeamCursor() +{ + return Cursors::self()->IBeamCursor; +} + +const Cursor& waitCursor() +{ + return Cursors::self()->WaitCursor; +} + +const Cursor& helpCursor() +{ + return Cursors::self()->HelpCursor; +} + +const Cursor& eastResizeCursor() +{ + return Cursors::self()->EastResizeCursor; +} + +const Cursor& northResizeCursor() +{ + return Cursors::self()->NorthResizeCursor; +} + +const Cursor& northEastResizeCursor() +{ + return Cursors::self()->NorthEastResizeCursor; +} + +const Cursor& northWestResizeCursor() +{ + return Cursors::self()->NorthWestResizeCursor; +} + +const Cursor& southResizeCursor() +{ + return Cursors::self()->SouthResizeCursor; +} + +const Cursor& southEastResizeCursor() +{ + return Cursors::self()->SouthEastResizeCursor; +} + +const Cursor& southWestResizeCursor() +{ + return Cursors::self()->SouthWestResizeCursor; +} + +const Cursor& westResizeCursor() +{ + return Cursors::self()->WestResizeCursor; +} + +const Cursor& northSouthResizeCursor() +{ + return Cursors::self()->NorthSouthResizeCursor; +} + +const Cursor& eastWestResizeCursor() +{ + return Cursors::self()->EastWestResizeCursor; +} + +const Cursor& northEastSouthWestResizeCursor() +{ + return Cursors::self()->NorthEastSouthWestResizeCursor; +} + +const Cursor& northWestSouthEastResizeCursor() +{ + return Cursors::self()->NorthWestSouthEastResizeCursor; +} + +const Cursor& columnResizeCursor() +{ + return Cursors::self()->ColumnResizeCursor; +} + +const Cursor& rowResizeCursor() +{ + return Cursors::self()->RowResizeCursor; +} + +const Cursor& middlePanningCursor() +{ + return Cursors::self()->MiddlePanningCursor; +} + +const Cursor& eastPanningCursor() +{ + return Cursors::self()->EastPanningCursor; +} + +const Cursor& northPanningCursor() +{ + return Cursors::self()->NorthPanningCursor; +} + +const Cursor& northEastPanningCursor() +{ + return Cursors::self()->NorthEastPanningCursor; +} + +const Cursor& northWestPanningCursor() +{ + return Cursors::self()->NorthWestPanningCursor; +} + +const Cursor& southPanningCursor() +{ + return Cursors::self()->SouthPanningCursor; +} + +const Cursor& southEastPanningCursor() +{ + return Cursors::self()->SouthEastPanningCursor; +} + +const Cursor& southWestPanningCursor() +{ + return Cursors::self()->SouthWestPanningCursor; +} + +const Cursor& westPanningCursor() +{ + return Cursors::self()->WestPanningCursor; +} + +const Cursor& verticalTextCursor() +{ + return Cursors::self()->VerticalTextCursor; +} + +const Cursor& cellCursor() +{ + return Cursors::self()->CellCursor; +} + +const Cursor& contextMenuCursor() +{ + return Cursors::self()->ContextMenuCursor; +} + +const Cursor& noDropCursor() +{ + return Cursors::self()->NoDropCursor; +} + +const Cursor& copyCursor() +{ + return Cursors::self()->CopyCursor; +} + +const Cursor& progressCursor() +{ + return Cursors::self()->ProgressCursor; +} + +const Cursor& aliasCursor() +{ + return Cursors::self()->AliasCursor; +} + +const Cursor& noneCursor() +{ + return Cursors::self()->NoneCursor; +} + +const Cursor& notAllowedCursor() +{ + return Cursors::self()->NotAllowedCursor; +} + +const Cursor& zoomInCursor() +{ + return Cursors::self()->ZoomInCursor; +} + +const Cursor& zoomOutCursor() +{ + return Cursors::self()->ZoomOutCursor; +} + +const Cursor& grabCursor() +{ + return Cursors::self()->GrabCursor; +} + +const Cursor& grabbingCursor() +{ + return Cursors::self()->GrabbingCursor; +} + +} diff --git a/Source/WebCore/platform/efl/DragDataEfl.cpp b/Source/WebCore/platform/efl/DragDataEfl.cpp new file mode 100644 index 0000000..a8458d6 --- /dev/null +++ b/Source/WebCore/platform/efl/DragDataEfl.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "DragData.h" + +#include "Document.h" +#include "DocumentFragment.h" + +namespace WebCore { + +bool DragData::canSmartReplace() const +{ + return false; +} + +bool DragData::containsColor() const +{ + return false; +} + +bool DragData::containsFiles() const +{ + return false; +} + +void DragData::asFilenames(Vector<String>& result) const +{ +} + +bool DragData::containsPlainText() const +{ + return false; +} + +String DragData::asPlainText() const +{ + return String(); +} + +Color DragData::asColor() const +{ + return Color(); +} + +bool DragData::containsCompatibleContent() const +{ + return false; +} + +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const +{ + return false; +} + +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const +{ + return String(); +} + +PassRefPtr<DocumentFragment> DragData::asFragment(Document*) const +{ + return 0; +} + +} diff --git a/Source/WebCore/platform/efl/DragImageEfl.cpp b/Source/WebCore/platform/efl/DragImageEfl.cpp new file mode 100644 index 0000000..4b0f417 --- /dev/null +++ b/Source/WebCore/platform/efl/DragImageEfl.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "DragImage.h" + +#include "CachedImage.h" +#include "Image.h" +#include "NotImplemented.h" + +namespace WebCore { + +IntSize dragImageSize(DragImageRef) +{ + notImplemented(); + return IntSize(0, 0); +} + +void deleteDragImage(DragImageRef) +{ + notImplemented(); +} + +DragImageRef scaleDragImage(DragImageRef image, FloatSize) +{ + notImplemented(); + return image; +} + +DragImageRef dissolveDragImageToFraction(DragImageRef image, float) +{ + notImplemented(); + return image; +} + +DragImageRef createDragImageFromImage(Image*) +{ + notImplemented(); + return 0; +} + +DragImageRef createDragImageIconForCachedImage(CachedImage*) +{ + notImplemented(); + return 0; +} + +} diff --git a/Source/WebCore/platform/efl/EventLoopEfl.cpp b/Source/WebCore/platform/efl/EventLoopEfl.cpp new file mode 100644 index 0000000..533ffe9 --- /dev/null +++ b/Source/WebCore/platform/efl/EventLoopEfl.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2008 Nuanti Ltd. + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "EventLoop.h" + +#include <Ecore.h> + +namespace WebCore { + +void EventLoop::cycle() +{ + ecore_main_loop_iterate(); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/efl/FileChooserEfl.cpp b/Source/WebCore/platform/efl/FileChooserEfl.cpp new file mode 100644 index 0000000..c77fa9e --- /dev/null +++ b/Source/WebCore/platform/efl/FileChooserEfl.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2008, 2009 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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 "FileChooser.h" + +#include "LocalizedStrings.h" +#include "StringTruncator.h" + +namespace WebCore { + +String FileChooser::basenameForWidth(const Font& font, int width) const +{ + if (width <= 0) + return String(); + + String string; + if (m_filenames.isEmpty()) + string = fileButtonNoFileSelectedLabel(); + else if (m_filenames.size() == 1) + string = m_filenames[0]; + else + return StringTruncator::rightTruncate(multipleFileUploadText(m_filenames.size()), width, font, false); + + return StringTruncator::centerTruncate(string, static_cast<float>(width), font, false); +} + +} diff --git a/Source/WebCore/platform/efl/FileSystemEfl.cpp b/Source/WebCore/platform/efl/FileSystemEfl.cpp new file mode 100644 index 0000000..cb117bc --- /dev/null +++ b/Source/WebCore/platform/efl/FileSystemEfl.cpp @@ -0,0 +1,159 @@ +/* + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 Collabora, Ltd. All rights reserved. + * Copyright (C) 2008 Kenneth Rohde Christiansen. + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FileSystem.h" + +#include "NotImplemented.h" + +#include <Ecore.h> +#include <Ecore_File.h> +#include <Eina.h> +#include <dirent.h> +#include <dlfcn.h> +#include <errno.h> +#include <fnmatch.h> +#if ENABLE(GLIB_SUPPORT) +#include <glib.h> // TODO: remove me after following TODO is solved. +#endif +#include <limits.h> +#include <stdio.h> +#include <sys/stat.h> +#include <unistd.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +CString fileSystemRepresentation(const String& path) +{ +// WARNING: this is just used by platform/network/soup, thus must be GLIB!!! +// TODO: move this to CString and use it instead in both, being more standard +#if !PLATFORM(WIN_OS) && defined(WTF_USE_SOUP) + char* filename = g_uri_unescape_string(path.utf8().data(), 0); + CString cfilename(filename); + g_free(filename); + return cfilename; +#else + return path.utf8(); +#endif +} + +CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle) +{ + char buffer[PATH_MAX]; + const char* tmpDir = getenv("TMPDIR"); + + if (!tmpDir) + tmpDir = "/tmp"; + + if (snprintf(buffer, PATH_MAX, "%s/%sXXXXXX", tmpDir, prefix) >= PATH_MAX) + goto end; + + handle = mkstemp(buffer); + if (handle < 0) + goto end; + + return CString(buffer); + +end: + handle = invalidPlatformFileHandle; + return CString(); +} + +bool unloadModule(PlatformModule module) +{ + // caution, closing handle will make memory vanish and any remaining + // timer, idler, threads or any other left-over will crash, + // maybe just ignore this is a safer solution? + return !dlclose(module); +} + +String homeDirectoryPath() +{ + const char *home = getenv("HOME"); + if (!home) { + home = getenv("TMPDIR"); + if (!home) + home = "/tmp"; + } + return String::fromUTF8(home); +} + +Vector<String> listDirectory(const String& path, const String& filter) +{ + Vector<String> entries; + CString cpath = path.utf8(); + CString cfilter = filter.utf8(); + char filePath[PATH_MAX]; + char* fileName; + size_t fileNameSpace; + DIR* dir; + + if (cpath.length() + NAME_MAX >= sizeof(filePath)) + return entries; + // loop invariant: directory part + '/' + memcpy(filePath, cpath.data(), cpath.length()); + fileName = filePath + cpath.length(); + if (cpath.length() > 0 && filePath[cpath.length() - 1] != '/') { + fileName[0] = '/'; + fileName++; + } + fileNameSpace = sizeof(filePath) - (fileName - filePath) - 1; + + dir = opendir(cpath.data()); + if (!dir) + return entries; + + struct dirent* de; + while (de = readdir(dir)) { + size_t nameLen; + if (de->d_name[0] == '.') { + if (de->d_name[1] == '\0') + continue; + if (de->d_name[1] == '.' && de->d_name[2] == '\0') + continue; + } + if (fnmatch(cfilter.data(), de->d_name, 0)) + continue; + + nameLen = strlen(de->d_name); + if (nameLen >= fileNameSpace) + continue; // maybe assert? it should never happen anyway... + + memcpy(fileName, de->d_name, nameLen + 1); + entries.append(filePath); + } + closedir(dir); + return entries; +} + +} diff --git a/Source/WebCore/platform/efl/KURLEfl.cpp b/Source/WebCore/platform/efl/KURLEfl.cpp new file mode 100644 index 0000000..69af7ba --- /dev/null +++ b/Source/WebCore/platform/efl/KURLEfl.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "KURL.h" + +namespace WebCore { + +String KURL::fileSystemPath() const +{ + if (!isValid() || !protocolIs("file")) + return String(); + + return String(path()); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/efl/LanguageEfl.cpp b/Source/WebCore/platform/efl/LanguageEfl.cpp new file mode 100644 index 0000000..efed862 --- /dev/null +++ b/Source/WebCore/platform/efl/LanguageEfl.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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 "Language.h" + +#include "PlatformString.h" + +#include <locale.h> + +namespace WebCore { + +String platformDefaultLanguage() +{ + char* localeDefault = setlocale(LC_CTYPE, 0); + + if (!localeDefault) + return String("c"); + + char* ptr = strchr(localeDefault, '_'); + + if (ptr) + *ptr = '-'; + + return String(localeDefault); +} + +} diff --git a/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp b/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp new file mode 100644 index 0000000..85dcdcb --- /dev/null +++ b/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp @@ -0,0 +1,538 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com + * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2008 Christian Dywan <christian@imendio.com> + * Copyright (C) 2008 Nuanti Ltd. + * Copyright (C) 2008 INdT Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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 submitButtonDefaultLabel() +{ + return String::fromUTF8("Submit"); +} + +String inputElementAltText() +{ + return String::fromUTF8("Submit"); +} + +String resetButtonDefaultLabel() +{ + return String::fromUTF8("Reset"); +} + +String searchableIndexIntroduction() +{ + return String::fromUTF8("_Searchable Index"); +} + +String fileButtonChooseFileLabel() +{ + return String::fromUTF8("Choose File"); +} + +String fileButtonNoFileSelectedLabel() +{ + return String::fromUTF8("No file selected"); +} + +String contextMenuItemTagOpenLinkInNewWindow() +{ + return String::fromUTF8("Open Link in New Window"); +} + +String contextMenuItemTagDownloadLinkToDisk() +{ + return String::fromUTF8("Download Linked File"); +} + +String contextMenuItemTagCopyLinkToClipboard() +{ + return String::fromUTF8("Copy Link Location"); +} + +String contextMenuItemTagOpenImageInNewWindow() +{ + return String::fromUTF8("Open Image in New Window"); +} + +String contextMenuItemTagDownloadImageToDisk() +{ + return String::fromUTF8("Save Image As"); +} + +String contextMenuItemTagCopyImageToClipboard() +{ + return String::fromUTF8("Copy Image"); +} + +String contextMenuItemTagOpenVideoInNewWindow() +{ + return String::fromUTF8("Open Video in New Window"); +} + +String contextMenuItemTagOpenAudioInNewWindow() +{ + return String::fromUTF8("Open Audio in New Window"); +} + +String contextMenuItemTagCopyVideoLinkToClipboard() +{ + return String::fromUTF8("Copy Video Link Location"); +} + +String contextMenuItemTagCopyAudioLinkToClipboard() +{ + return String::fromUTF8("Copy Audio Link Location"); +} + +String contextMenuItemTagToggleMediaControls() +{ + return String::fromUTF8("Toggle Media Controls"); +} + +String contextMenuItemTagToggleMediaLoop() +{ + return String::fromUTF8("Toggle Media Loop Playback"); +} + +String contextMenuItemTagEnterVideoFullscreen() +{ + return String::fromUTF8("Switch Video to Fullscreen"); +} + +String contextMenuItemTagMediaPlay() +{ + return String::fromUTF8("Play"); +} + +String contextMenuItemTagMediaPause() +{ + return String::fromUTF8("Pause"); +} + +String contextMenuItemTagMediaMute() +{ + return String::fromUTF8("Mute"); +} + +String contextMenuItemTagOpenFrameInNewWindow() +{ + return String::fromUTF8("Open Frame in New Window"); +} + +String contextMenuItemTagCopy() +{ + static String stockLabel = String::fromUTF8("Copy"); + return stockLabel; +} + +String contextMenuItemTagDelete() +{ + static String stockLabel = String::fromUTF8("Delete"); + return stockLabel; +} + +String contextMenuItemTagSelectAll() +{ + static String stockLabel = String::fromUTF8("Select All"); + return stockLabel; +} + +String contextMenuItemTagUnicode() +{ + return String::fromUTF8("Insert Unicode Control Character"); +} + +String contextMenuItemTagInputMethods() +{ + return String::fromUTF8("Input Methods"); +} + +String contextMenuItemTagGoBack() +{ + static String stockLabel = String::fromUTF8("Go Back"); + return stockLabel; +} + +String contextMenuItemTagGoForward() +{ + static String stockLabel = String::fromUTF8("Go Forward"); + return stockLabel; +} + +String contextMenuItemTagStop() +{ + static String stockLabel = String::fromUTF8("Stop"); + return stockLabel; +} + +String contextMenuItemTagReload() +{ + return String::fromUTF8("Reload"); +} + +String contextMenuItemTagCut() +{ + static String stockLabel = String::fromUTF8("Cut"); + return stockLabel; +} + +String contextMenuItemTagPaste() +{ + static String stockLabel = String::fromUTF8("Paste"); + return stockLabel; +} + +String contextMenuItemTagNoGuessesFound() +{ + return String::fromUTF8("No Guesses Found"); +} + +String contextMenuItemTagIgnoreSpelling() +{ + return String::fromUTF8("Ignore Spelling"); +} + +String contextMenuItemTagLearnSpelling() +{ + return String::fromUTF8("Learn Spelling"); +} + +String contextMenuItemTagSearchWeb() +{ + return String::fromUTF8("Search the Web"); +} + +String contextMenuItemTagLookUpInDictionary() +{ + return String::fromUTF8("Look Up in Dictionary"); +} + +String contextMenuItemTagOpenLink() +{ + return String::fromUTF8("Open Link"); +} + +String contextMenuItemTagIgnoreGrammar() +{ + return String::fromUTF8("Ignore Grammar"); +} + +String contextMenuItemTagSpellingMenu() +{ + return String::fromUTF8("Spelling and Grammar"); +} + +String contextMenuItemTagShowSpellingPanel(bool show) +{ + return String::fromUTF8(show ? "Show Spelling and Grammar" : "Hide Spelling and Grammar"); +} + +String contextMenuItemTagCheckSpelling() +{ + return String::fromUTF8("Check Document Now"); +} + +String contextMenuItemTagCheckSpellingWhileTyping() +{ + return String::fromUTF8("Check Spelling While _Typing"); +} + +String contextMenuItemTagCheckGrammarWithSpelling() +{ + return String::fromUTF8("Check Grammar With Spelling"); +} + +String contextMenuItemTagFontMenu() +{ + return String::fromUTF8("Font"); +} + +String contextMenuItemTagBold() +{ + static String stockLabel = String::fromUTF8("Bold"); + return stockLabel; +} + +String contextMenuItemTagItalic() +{ + static String stockLabel = String::fromUTF8("Italic"); + return stockLabel; +} + +String contextMenuItemTagUnderline() +{ + static String stockLabel = String::fromUTF8("Underline"); + return stockLabel; +} + +String contextMenuItemTagOutline() +{ + return String::fromUTF8("Outline"); +} + +String contextMenuItemTagInspectElement() +{ + return String::fromUTF8("Inspect Element"); +} + +String contextMenuItemTagRightToLeft() +{ + return String(); +} + +String contextMenuItemTagLeftToRight() +{ + return String(); +} + +String contextMenuItemTagWritingDirectionMenu() +{ + return String(); +} + +String contextMenuItemTagTextDirectionMenu() +{ + return String(); +} + +String contextMenuItemTagDefaultDirection() +{ + return String(); +} + +String searchMenuNoRecentSearchesText() +{ + return String::fromUTF8("No recent searches"); +} + +String searchMenuRecentSearchesText() +{ + return String::fromUTF8("Recent searches"); +} + +String searchMenuClearRecentSearchesText() +{ + return String::fromUTF8("Clear recent searches"); +} + +String AXDefinitionListTermText() +{ + return String::fromUTF8("term"); +} + +String AXDefinitionListDefinitionText() +{ + return String::fromUTF8("definition"); +} + +String AXButtonActionVerb() +{ + return String::fromUTF8("press"); +} + +String AXRadioButtonActionVerb() +{ + return String::fromUTF8("select"); +} + +String AXTextFieldActionVerb() +{ + return String::fromUTF8("activate"); +} + +String AXCheckedCheckBoxActionVerb() +{ + return String::fromUTF8("uncheck"); +} + +String AXUncheckedCheckBoxActionVerb() +{ + return String::fromUTF8("check"); +} + +String AXLinkActionVerb() +{ + return String::fromUTF8("jump"); +} + +String unknownFileSizeText() +{ + return String::fromUTF8("Unknown"); +} + +String imageTitle(const String& filename, const IntSize& size) +{ + notImplemented(); + return String(); +} + +#if ENABLE(VIDEO) +String localizedMediaControlElementString(const String& name) +{ + notImplemented(); + return String(); +} + +String localizedMediaControlElementHelpText(const String& name) +{ + notImplemented(); + return String(); +} + +String localizedMediaTimeDescription(float time) +{ + notImplemented(); + return String(); +} +#endif + +String mediaElementLoadingStateText() +{ + return String::fromUTF8("Loading..."); +} + +String mediaElementLiveBroadcastStateText() +{ + return String::fromUTF8("Live Broadcast"); +} + +String validationMessagePatternMismatchText() +{ + return String::fromUTF8("pattern mismatch"); +} + +String validationMessageRangeOverflowText(const String&) +{ + return String::fromUTF8("range overflow"); +} + +String validationMessageRangeUnderflowText(const String&) +{ + return String::fromUTF8("range underflow"); +} + +String validationMessageStepMismatchText(const String&, const String&) +{ + return String::fromUTF8("step mismatch"); +} + +String validationMessageTooLongText(int, int) +{ + return String::fromUTF8("too long"); +} + +String validationMessageTypeMismatchText() +{ + return String::fromUTF8("type mismatch"); +} + +String validationMessageTypeMismatchForEmailText() +{ + return String::fromUTF8("type mismatch"); +} + +String validationMessageTypeMismatchForMultipleEmailText() +{ + return String::fromUTF8("type mismatch"); +} + +String validationMessageTypeMismatchForURLText() +{ + return String::fromUTF8("type mismatch"); +} + +String validationMessageValueMissingText() +{ + return String::fromUTF8("value missing"); +} + +String validationMessageValueMissingForCheckboxText() +{ + notImplemented(); + return validationMessageValueMissingText(); +} + +String validationMessageValueMissingForFileText() +{ + notImplemented(); + return validationMessageValueMissingText(); +} + +String validationMessageValueMissingForMultipleFileText() +{ + notImplemented(); + return validationMessageValueMissingText(); +} + +String validationMessageValueMissingForRadioText() +{ + notImplemented(); + return validationMessageValueMissingText(); +} + +String validationMessageValueMissingForSelectText() +{ + notImplemented(); + return validationMessageValueMissingText(); +} + +String missingPluginText() +{ + return String::fromUTF8("missing plugin"); +} + +String AXMenuListPopupActionVerb() +{ + return String(); +} + +String AXMenuListActionVerb() +{ + return String(); +} + +String multipleFileUploadText(unsigned numberOfFiles) +{ + return String::number(numberOfFiles) + String::fromUTF8(" files"); +} + +String crashedPluginText() +{ + return String::fromUTF8("plugin crashed"); +} + +} diff --git a/Source/WebCore/platform/efl/LoggingEfl.cpp b/Source/WebCore/platform/efl/LoggingEfl.cpp new file mode 100644 index 0000000..55de765 --- /dev/null +++ b/Source/WebCore/platform/efl/LoggingEfl.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2007 Alp Toker <alp@atoker.com> + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "Logging.h" + +#include "PlatformString.h" +#include <Eina.h> + +namespace WebCore { + +void InitializeLoggingChannelsIfNecessary() +{ + static bool didInitializeLoggingChannels = false; + if (didInitializeLoggingChannels) + return; + + didInitializeLoggingChannels = true; + + char* logEnv = getenv("WEBKIT_DEBUG"); + if (!logEnv) + return; + +#if defined(NDEBUG) + EINA_LOG_WARN("WEBKIT_DEBUG is not empty, but this is a release build. Notice that many log messages will only appear in a debug build."); +#endif + + char** logv = eina_str_split(logEnv, ",", -1); + + EINA_SAFETY_ON_NULL_RETURN(logv); + + for (int i = 0; logv[i]; i++) { + if (WTFLogChannel* channel = getChannelFromName(logv[i])) + channel->state = WTFLogChannelOn; + } + + free(*logv); + free(logv); + + // To disable logging notImplemented set the DISABLE_NI_WARNING + // environment variable to 1. + LogNotYetImplemented.state = WTFLogChannelOn; +} + +} diff --git a/Source/WebCore/platform/efl/MIMETypeRegistryEfl.cpp b/Source/WebCore/platform/efl/MIMETypeRegistryEfl.cpp new file mode 100644 index 0000000..d0c95bf --- /dev/null +++ b/Source/WebCore/platform/efl/MIMETypeRegistryEfl.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008 Torch Mobile Inc. http://www.torchmobile.com/ + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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 "MIMETypeRegistry.h" + +namespace WebCore { + +struct ExtensionMap { + const char* extension; + const char* mimeType; +}; + +static const ExtensionMap extensionMap[] = { + { "bmp", "image/bmp" }, + { "css", "text/css" }, + { "gif", "image/gif" }, + { "html", "text/html" }, + { "htm", "text/html" }, + { "ico", "image/x-icon" }, + { "jpeg", "image/jpeg" }, + { "jpg", "image/jpeg" }, + { "js", "application/x-javascript" }, + { "mng", "video/x-mng" }, + { "pbm", "image/x-portable-bitmap" }, + { "pgm", "image/x-portable-graymap" }, + { "pdf", "application/pdf" }, + { "png", "image/png" }, + { "ppm", "image/x-portable-pixmap" }, + { "rss", "application/rss+xml" }, + { "svg", "image/svg+xml" }, + { "text", "text/plain" }, + { "tif", "image/tiff" }, + { "tiff", "image/tiff" }, + { "txt", "text/plain" }, + { "xbm", "image/x-xbitmap" }, + { "xml", "text/xml" }, + { "xpm", "image/x-xpm" }, + { "xsl", "text/xsl" }, + { "xhtml", "application/xhtml+xml" }, + { "wml", "text/vnd.wap.wml" }, + { "wmlc", "application/vnd.wap.wmlc" }, + { 0, 0 } +}; + +String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) +{ + String s = ext.lower(); + const ExtensionMap *e = extensionMap; + while (e->extension) { + if (s == e->extension) + return e->mimeType; + ++e; + } + + return String(); +} + +bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&) +{ + return false; +} + +} diff --git a/Source/WebCore/platform/efl/PasteboardEfl.cpp b/Source/WebCore/platform/efl/PasteboardEfl.cpp new file mode 100644 index 0000000..1af5a92 --- /dev/null +++ b/Source/WebCore/platform/efl/PasteboardEfl.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2007 Alp Toker <alp@atoker.com> + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "Pasteboard.h" + +#include "DocumentFragment.h" +#include "Frame.h" +#include "Image.h" +#include "KURL.h" +#include "NotImplemented.h" +#include "PlatformString.h" +#include "RenderImage.h" +#include "markup.h" +#include <wtf/text/CString.h> + +namespace WebCore { + +Pasteboard* Pasteboard::generalPasteboard() +{ + static Pasteboard* pasteboard = new Pasteboard(); + return pasteboard; +} + +Pasteboard::Pasteboard() +{ + notImplemented(); +} + +Pasteboard::~Pasteboard() +{ + notImplemented(); +} + +void Pasteboard::writePlainText(const String&) +{ + notImplemented(); +} + +void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) +{ + notImplemented(); +} + +void Pasteboard::writeURL(const KURL&, const String&, Frame*) +{ + notImplemented(); +} + +void Pasteboard::writeImage(Node* node, const KURL&, const String&) +{ + notImplemented(); +} + +void Pasteboard::clear() +{ + notImplemented(); +} + +bool Pasteboard::canSmartReplace() +{ + notImplemented(); + return false; +} + +PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, + bool allowPlainText, bool& chosePlainText) +{ + notImplemented(); + return 0; +} + +String Pasteboard::plainText(Frame*) +{ + notImplemented(); + return String(); +} + +} diff --git a/Source/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp b/Source/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp new file mode 100644 index 0000000..2888b22 --- /dev/null +++ b/Source/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp @@ -0,0 +1,254 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2008 Diego Hidalgo C. Gonzalez + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "PlatformKeyboardEvent.h" + +#include "NotImplemented.h" +#include "TextEncoding.h" +#include "WindowsKeyboardCodes.h" + +#include <Evas.h> +#include <stdio.h> +#include <wtf/HashMap.h> +#include <wtf/text/StringConcatenate.h> +#include <wtf/text/StringHash.h> + +namespace WebCore { + +typedef HashMap<String, String> KeyMap; +typedef HashMap<String, int> WindowsKeyMap; + +static KeyMap gKeyMap; +static WindowsKeyMap gWindowsKeyMap; + +static void createKeyMap() +{ + for (unsigned int i = 1; i < 25; i++) { + String key = makeString('F', String::number(i)); + gKeyMap.set(key, key); + } + gKeyMap.set("Alt_L", "Alt"); + gKeyMap.set("ISO_Level3_Shift", "Alt"); + gKeyMap.set("Menu", "Alt"); + gKeyMap.set("Shift_L", "Shift"); + gKeyMap.set("Shift_R", "Shift"); + gKeyMap.set("Down", "Down"); + gKeyMap.set("End", "End"); + gKeyMap.set("Return", "Enter"); + gKeyMap.set("KP_Enter", "Enter"); + gKeyMap.set("Home", "Home"); + gKeyMap.set("Insert", "Insert"); + gKeyMap.set("Left", "Left"); + gKeyMap.set("Down", "Down"); + gKeyMap.set("Next", "PageDown"); + gKeyMap.set("Prior", "PageUp"); + gKeyMap.set("Right", "Right"); + gKeyMap.set("Up", "Up"); + gKeyMap.set("Delete", "U+007F"); + gKeyMap.set("Tab", "U+0009"); + gKeyMap.set("ISO_Left_Tab", "U+0009"); +} + +static void createWindowsKeyMap() +{ + gWindowsKeyMap.set("Return", VK_RETURN); + gWindowsKeyMap.set("KP_Return", VK_RETURN); + gWindowsKeyMap.set("Alt_L", VK_MENU); + gWindowsKeyMap.set("ISO_Level3_Shift", VK_MENU); + gWindowsKeyMap.set("Menu", VK_MENU); + gWindowsKeyMap.set("Shift_L", VK_SHIFT); + gWindowsKeyMap.set("Shift_R", VK_SHIFT); + gWindowsKeyMap.set("Control_L", VK_CONTROL); + gWindowsKeyMap.set("Control_R", VK_CONTROL); + gWindowsKeyMap.set("Pause", VK_PAUSE); + gWindowsKeyMap.set("Break", VK_PAUSE); + gWindowsKeyMap.set("Caps_Lock", VK_CAPITAL); + gWindowsKeyMap.set("Scroll_Lock", VK_SCROLL); + gWindowsKeyMap.set("Num_Lock", VK_NUMLOCK); + gWindowsKeyMap.set("Escape", VK_ESCAPE); + gWindowsKeyMap.set("Tab", VK_TAB); + gWindowsKeyMap.set("ISO_Left_Tab", VK_TAB); + gWindowsKeyMap.set("BackSpace", VK_BACK); + gWindowsKeyMap.set("Space", VK_SPACE); + gWindowsKeyMap.set("Next", VK_NEXT); + gWindowsKeyMap.set("Prior", VK_PRIOR); + gWindowsKeyMap.set("Home", VK_HOME); + gWindowsKeyMap.set("End", VK_END); + gWindowsKeyMap.set("Right", VK_RIGHT); + gWindowsKeyMap.set("Left", VK_LEFT); + gWindowsKeyMap.set("Up", VK_UP); + gWindowsKeyMap.set("Down", VK_DOWN); + gWindowsKeyMap.set("Print", VK_PRINT); + gWindowsKeyMap.set("Insert", VK_INSERT); + gWindowsKeyMap.set("Delete", VK_DELETE); + + gWindowsKeyMap.set("comma", VK_OEM_COMMA); + gWindowsKeyMap.set("less", VK_OEM_COMMA); + gWindowsKeyMap.set("period", VK_OEM_PERIOD); + gWindowsKeyMap.set("greater", VK_OEM_PERIOD); + gWindowsKeyMap.set("semicolon", VK_OEM_1); + gWindowsKeyMap.set("colon", VK_OEM_1); + gWindowsKeyMap.set("slash", VK_OEM_2); + gWindowsKeyMap.set("question", VK_OEM_2); + gWindowsKeyMap.set("grave", VK_OEM_3); + gWindowsKeyMap.set("asciitilde", VK_OEM_3); + gWindowsKeyMap.set("bracketleft", VK_OEM_4); + gWindowsKeyMap.set("braceleft", VK_OEM_4); + gWindowsKeyMap.set("backslash", VK_OEM_5); + gWindowsKeyMap.set("bar", VK_OEM_5); + gWindowsKeyMap.set("bracketright", VK_OEM_6); + gWindowsKeyMap.set("braceright", VK_OEM_6); + gWindowsKeyMap.set("apostrophe", VK_OEM_7); + gWindowsKeyMap.set("quotedbl", VK_OEM_7); + + // Alphabet + const char* alphabet = "abcdefghijklmnopqrstuvwxyz"; + for (unsigned int i = 0; i < 26; i++) { + String key(alphabet + i, 1); + gWindowsKeyMap.set(key, VK_A + i); + } + + // Digits + for (unsigned int i = 0; i < 10; i++) { + String key = String::number(i); + gWindowsKeyMap.set(key, VK_0 + i); + } + + // Shifted digits + gWindowsKeyMap.set("exclam", VK_1); + gWindowsKeyMap.set("at", VK_2); + gWindowsKeyMap.set("numbersign", VK_3); + gWindowsKeyMap.set("dollar", VK_4); + gWindowsKeyMap.set("percent", VK_5); + gWindowsKeyMap.set("asciicircum", VK_6); + gWindowsKeyMap.set("ampersand", VK_7); + gWindowsKeyMap.set("asterisk", VK_8); + gWindowsKeyMap.set("parenleft", VK_9); + gWindowsKeyMap.set("parenright", VK_0); + gWindowsKeyMap.set("minus", VK_OEM_MINUS); + gWindowsKeyMap.set("underscore", VK_OEM_MINUS); + gWindowsKeyMap.set("equal", VK_OEM_PLUS); + gWindowsKeyMap.set("plus", VK_OEM_PLUS); + + // F_XX + for (unsigned int i = 1; i < 25; i++) { + String key = makeString('F', String::number(i)); + gWindowsKeyMap.set(key, VK_F1 + i); + } +} + +static String keyIdentifierForEvasKeyName(String& keyName) +{ + if (gKeyMap.isEmpty()) + createKeyMap(); + + if (gKeyMap.contains(keyName)) + return gKeyMap.get(keyName); + + return keyName; +} + +static int windowsKeyCodeForEvasKeyName(String& keyName) +{ + if (gWindowsKeyMap.isEmpty()) + createWindowsKeyMap(); + + if (gWindowsKeyMap.contains(keyName)) + return gWindowsKeyMap.get(keyName); + + return 0; +} + +PlatformKeyboardEvent::PlatformKeyboardEvent(const Evas_Event_Key_Down* ev) + : m_type(KeyDown) + , m_text(String::fromUTF8(ev->string)) + , m_shiftKey(evas_key_modifier_is_set(ev->modifiers, "Shift")) + , m_ctrlKey(evas_key_modifier_is_set(ev->modifiers, "Control")) + , m_altKey(evas_key_modifier_is_set(ev->modifiers, "Alt")) + , m_metaKey(evas_key_modifier_is_set(ev->modifiers, "Meta")) +{ + String keyName = String(ev->key); + m_keyIdentifier = keyIdentifierForEvasKeyName(keyName); + m_windowsVirtualKeyCode = windowsKeyCodeForEvasKeyName(keyName); + + // FIXME: + m_isKeypad = false; + m_autoRepeat = false; +} + +PlatformKeyboardEvent::PlatformKeyboardEvent(const Evas_Event_Key_Up* ev) + : m_type(KeyUp) + , m_text(String::fromUTF8(ev->string)) + , m_shiftKey(evas_key_modifier_is_set(ev->modifiers, "Shift")) + , m_ctrlKey(evas_key_modifier_is_set(ev->modifiers, "Control")) + , m_altKey(evas_key_modifier_is_set(ev->modifiers, "Alt")) + , m_metaKey(evas_key_modifier_is_set(ev->modifiers, "Meta")) +{ + String keyName = String(ev->key); + m_keyIdentifier = keyIdentifierForEvasKeyName(keyName); + m_windowsVirtualKeyCode = windowsKeyCodeForEvasKeyName(keyName); + + // FIXME: + m_isKeypad = false; + m_autoRepeat = false; +} + +void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool) +{ + ASSERT(m_type == KeyDown); + m_type = type; + + if (type == RawKeyDown) { + m_text = String(); + m_unmodifiedText = String(); + } else { + m_keyIdentifier = String(); + m_windowsVirtualKeyCode = 0; + } +} + +bool PlatformKeyboardEvent::currentCapsLockState() +{ + notImplemented(); + return false; +} + +void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey) +{ + notImplemented(); + shiftKey = false; + ctrlKey = false; + altKey = false; + metaKey = false; +} + +} diff --git a/Source/WebCore/platform/efl/PlatformMouseEventEfl.cpp b/Source/WebCore/platform/efl/PlatformMouseEventEfl.cpp new file mode 100644 index 0000000..53de522 --- /dev/null +++ b/Source/WebCore/platform/efl/PlatformMouseEventEfl.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2008, 2009 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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 "PlatformMouseEvent.h" + +#include <Evas.h> +#include <wtf/CurrentTime.h> + +namespace WebCore { + +void PlatformMouseEvent::setClickCount(unsigned int flags) +{ + if (flags & EVAS_BUTTON_TRIPLE_CLICK) + m_clickCount = 3; + else if (flags & EVAS_BUTTON_DOUBLE_CLICK) + m_clickCount = 2; + else + m_clickCount = 1; +} + +PlatformMouseEvent::PlatformMouseEvent(const Evas_Event_Mouse_Down* ev, IntPoint pos) + : m_position(IntPoint(ev->canvas.x - pos.x(), ev->canvas.y - pos.y())) + , m_globalPosition(IntPoint(ev->canvas.x, ev->canvas.y)) + , m_button(MouseButton(ev->button - 1)) + , m_eventType(MouseEventPressed) + , m_shiftKey(evas_key_modifier_is_set(ev->modifiers, "Shift")) + , m_ctrlKey(evas_key_modifier_is_set(ev->modifiers, "Control")) + , m_altKey(evas_key_modifier_is_set(ev->modifiers, "Alt")) + , m_metaKey(evas_key_modifier_is_set(ev->modifiers, "Meta")) + , m_timestamp(currentTime()) +{ + setClickCount(ev->flags); +} + +PlatformMouseEvent::PlatformMouseEvent(const Evas_Event_Mouse_Up* ev, IntPoint pos) + : m_position(IntPoint(ev->canvas.x - pos.x(), ev->canvas.y - pos.y())) + , m_globalPosition(IntPoint(ev->canvas.x, ev->canvas.y)) + , m_button(MouseButton(ev->button - 1)) + , m_eventType(MouseEventReleased) + , m_shiftKey(evas_key_modifier_is_set(ev->modifiers, "Shift")) + , m_ctrlKey(evas_key_modifier_is_set(ev->modifiers, "Control")) + , m_altKey(evas_key_modifier_is_set(ev->modifiers, "Alt")) + , m_metaKey(evas_key_modifier_is_set(ev->modifiers, "Meta")) + , m_timestamp(currentTime()) +{ + setClickCount(ev->flags); +} + +PlatformMouseEvent::PlatformMouseEvent(const Evas_Event_Mouse_Move* ev, IntPoint pos) + : m_position(IntPoint(ev->cur.canvas.x - pos.x(), ev->cur.canvas.y - pos.y())) + , m_globalPosition(IntPoint(ev->cur.canvas.x, ev->cur.canvas.y)) + , m_button(MouseButton(ev->buttons - 1)) + , m_eventType(MouseEventMoved) + , m_clickCount(0) + , m_shiftKey(evas_key_modifier_is_set(ev->modifiers, "Shift")) + , m_ctrlKey(evas_key_modifier_is_set(ev->modifiers, "Control")) + , m_altKey(evas_key_modifier_is_set(ev->modifiers, "Alt")) + , m_metaKey(evas_key_modifier_is_set(ev->modifiers, "Meta")) + , m_timestamp(currentTime()) +{ +} + +} diff --git a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp new file mode 100644 index 0000000..c60ae95 --- /dev/null +++ b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008 Holger Hans Peter Freyther + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "PlatformScreen.h" + +#include "NotImplemented.h" +#include "PlatformString.h" +#include "Widget.h" +#include <wtf/text/CString.h> + +#ifdef HAVE_ECORE_X +#include <Ecore_X.h> +#include <X11/Xlib.h> +#endif + +namespace WebCore { + +int screenDepth(Widget* widget) +{ + notImplemented(); + return 8; +} + +int screenDepthPerComponent(Widget*) +{ + notImplemented(); + return 8; +} + +bool screenIsMonochrome(Widget*) +{ + notImplemented(); + return false; +} + +FloatRect screenRect(Widget* widget) +{ + int x = 0, y = 0, w = 0, h = 0; + +#ifdef HAVE_ECORE_X + Ecore_X_Display* display = ecore_x_display_get(); + int def = DefaultScreen(display); + Screen* screen = ScreenOfDisplay(display, def); + x = 0; + y = 0; + w = screen->width; + h = screen->height; +#endif + + return FloatRect(x, y, w, h); +} + +FloatRect screenAvailableRect(Widget* widget) +{ + notImplemented(); + return screenRect(widget); +} + +} diff --git a/Source/WebCore/platform/efl/PlatformTouchEventEfl.cpp b/Source/WebCore/platform/efl/PlatformTouchEventEfl.cpp new file mode 100644 index 0000000..80dfe6f --- /dev/null +++ b/Source/WebCore/platform/efl/PlatformTouchEventEfl.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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 "PlatformTouchEvent.h" + +#include "ewk_frame.h" + +#if ENABLE(TOUCH_EVENTS) + +namespace WebCore { + +PlatformTouchEvent::PlatformTouchEvent(Eina_List* points, const IntPoint pos, TouchEventType type, int metaState) + : m_type(type) + , m_ctrlKey(false) + , m_altKey(false) + , m_shiftKey(false) + , m_metaKey(false) +{ + void* point; + + EINA_LIST_FREE(points, point) { + Ewk_Touch_Point* p = static_cast<Ewk_Touch_Point*>(point); + IntPoint pnt = IntPoint(p->x - pos.x(), p->y - pos.y()); + + PlatformTouchPoint::State state = PlatformTouchPoint::TouchPressed; + switch (p->state) { + case EWK_TOUCH_POINT_PRESSED: + state = PlatformTouchPoint::TouchPressed; + break; + case EWK_TOUCH_POINT_RELEASED: + state = PlatformTouchPoint::TouchReleased; + break; + case EWK_TOUCH_POINT_MOVED: + state = PlatformTouchPoint::TouchMoved; + break; + case EWK_TOUCH_POINT_CANCELLED: + state = PlatformTouchPoint::TouchCancelled; + break; + } + + m_touchPoints.append(PlatformTouchPoint(p->id, pnt, state)); + } + + // FIXME: We don't support metaState for now. +} + +} + +#endif diff --git a/Source/WebCore/platform/efl/PlatformTouchPointEfl.cpp b/Source/WebCore/platform/efl/PlatformTouchPointEfl.cpp new file mode 100644 index 0000000..b181f68 --- /dev/null +++ b/Source/WebCore/platform/efl/PlatformTouchPointEfl.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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 "PlatformTouchPoint.h" + +#if ENABLE(TOUCH_EVENTS) + +namespace WebCore { + +PlatformTouchPoint::PlatformTouchPoint(unsigned id, const IntPoint& windowPos, State state) + : m_id(id) + , m_state(state) + , m_screenPos(windowPos) + , m_pos(windowPos) { } + +} + +#endif diff --git a/Source/WebCore/platform/efl/PlatformWheelEventEfl.cpp b/Source/WebCore/platform/efl/PlatformWheelEventEfl.cpp new file mode 100644 index 0000000..704db38 --- /dev/null +++ b/Source/WebCore/platform/efl/PlatformWheelEventEfl.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * (C) 2006 Michael Emmel mike.emmel@gmail.com. All rights reserved. + * (C) 2008 Kenneth Rohde Christiansen. All rights reserved. + * (C) 2009 INdT - Instituto Nokia de Tecnologia. + * (C) 2009-2010 ProFUSION embedded systems + * (C) 2009-2010 Samsung Electronics + * + * 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 "PlatformWheelEvent.h" + +#include "Scrollbar.h" + +#include <Evas.h> + +namespace WebCore { + +enum { + VerticalScrollDirection = 0, + HorizontalScrollDirection = 1 +}; + +PlatformWheelEvent::PlatformWheelEvent(const Evas_Event_Mouse_Wheel* ev) + : m_position(IntPoint(ev->canvas.x, ev->canvas.y)) + , m_globalPosition(IntPoint(ev->canvas.x, ev->canvas.y)) + , m_granularity(ScrollByPixelWheelEvent) + , m_isAccepted(false) + , m_shiftKey(evas_key_modifier_is_set(ev->modifiers, "Shift")) + , m_ctrlKey(evas_key_modifier_is_set(ev->modifiers, "Control")) + , m_altKey(evas_key_modifier_is_set(ev->modifiers, "Alt")) + , m_metaKey(evas_key_modifier_is_set(ev->modifiers, "Meta")) +{ + // A negative z value means (in EFL) that we are scrolling down, so we need + // to invert the value. + if (ev->direction == VerticalScrollDirection) { + m_deltaX = 0; + m_deltaY = - ev->z; + } else if (ev->direction == HorizontalScrollDirection) { + m_deltaX = - ev->z; + m_deltaY = 0; + } + + // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event + m_wheelTicksX = m_deltaX; + m_wheelTicksY = m_deltaY; + m_deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep()); + m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep()); +} + +} diff --git a/Source/WebCore/platform/efl/PopupMenuEfl.cpp b/Source/WebCore/platform/efl/PopupMenuEfl.cpp new file mode 100644 index 0000000..a6f7a53 --- /dev/null +++ b/Source/WebCore/platform/efl/PopupMenuEfl.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "PopupMenuEfl.h" + +#include "Chrome.h" +#include "ChromeClientEfl.h" +#include "FrameView.h" +#include "NotImplemented.h" +#include "PopupMenuClient.h" + +namespace WebCore { + +PopupMenuEfl::PopupMenuEfl(PopupMenuClient* client) + : m_popupClient(client) + , m_view(0) +{ +} + +PopupMenuEfl::~PopupMenuEfl() +{ + // Tell client to destroy data related to this popup since this object is + // going away. + if (m_view) + hide(); +} + +void PopupMenuEfl::show(const IntRect& rect, FrameView* view, int index) +{ + ASSERT(m_popupClient); + ChromeClientEfl* chromeClient = static_cast<ChromeClientEfl*>(view->frame()->page()->chrome()->client()); + ASSERT(chromeClient); + + m_view = view; + chromeClient->createSelectPopup(m_popupClient, index, rect); +} + +void PopupMenuEfl::hide() +{ + ASSERT(m_view); + ChromeClientEfl* chromeClient = static_cast<ChromeClientEfl*>(m_view->frame()->page()->chrome()->client()); + ASSERT(chromeClient); + + chromeClient->destroySelectPopup(); +} + +void PopupMenuEfl::updateFromElement() +{ + client()->setTextFromItem(client()->selectedIndex()); +} + +void PopupMenuEfl::disconnectClient() +{ + m_popupClient = 0; +} + +} diff --git a/Source/WebCore/platform/efl/PopupMenuEfl.h b/Source/WebCore/platform/efl/PopupMenuEfl.h new file mode 100644 index 0000000..4a2dbfc --- /dev/null +++ b/Source/WebCore/platform/efl/PopupMenuEfl.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuEfl_h +#define PopupMenuEfl_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class FrameView; +class Scrollbar; +class PopupMenuClient; + +class PopupMenuEfl : public PopupMenu { +public: + PopupMenuEfl(PopupMenuClient*); + ~PopupMenuEfl(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + FrameView* m_view; +}; + +} + +#endif // PopupMenuEfl_h diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.cpp b/Source/WebCore/platform/efl/RenderThemeEfl.cpp new file mode 100644 index 0000000..7cf635f --- /dev/null +++ b/Source/WebCore/platform/efl/RenderThemeEfl.cpp @@ -0,0 +1,1045 @@ +/* + * Copyright (C) 2007 Apple Inc. + * Copyright (C) 2007 Alp Toker <alp@atoker.com> + * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "RenderThemeEfl.h" + +#include "CSSValueKeywords.h" +#include "FileSystem.h" +#include "Frame.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "NotImplemented.h" +#include "Page.h" +#include "RenderBox.h" +#include "RenderObject.h" +#include "RenderProgress.h" +#include "RenderSlider.h" +#include <wtf/text/CString.h> + +#include <Ecore_Evas.h> +#include <Edje.h> +namespace WebCore { + +// TODO: change from object count to ecore_evas size (bytes) +// TODO: as objects are webpage/user defined and they can be very large. +#define RENDER_THEME_EFL_PART_CACHE_MAX 32 + +void RenderThemeEfl::adjustSizeConstraints(RenderStyle* style, FormType type) const +{ + const struct ThemePartDesc* desc = m_partDescs + (size_t)type; + + if (style->minWidth().isIntrinsicOrAuto()) + style->setMinWidth(desc->min.width()); + if (style->minHeight().isIntrinsicOrAuto()) + style->setMinHeight(desc->min.height()); + + if (desc->max.width().value() > 0 && style->maxWidth().isIntrinsicOrAuto()) + style->setMaxWidth(desc->max.width()); + if (desc->max.height().value() > 0 && style->maxHeight().isIntrinsicOrAuto()) + style->setMaxHeight(desc->max.height()); + + style->setPaddingTop(desc->padding.top()); + style->setPaddingBottom(desc->padding.bottom()); + style->setPaddingLeft(desc->padding.left()); + style->setPaddingRight(desc->padding.right()); +} + +bool RenderThemeEfl::themePartCacheEntryReset(struct ThemePartCacheEntry* ce, FormType type) +{ + const char *file, *group; + + ASSERT(ce); + + edje_object_file_get(m_edje, &file, 0); + group = edjeGroupFromFormType(type); + ASSERT(file); + ASSERT(group); + + if (!edje_object_file_set(ce->o, file, group)) { + Edje_Load_Error err = edje_object_load_error_get(ce->o); + const char *errmsg = edje_load_error_str(err); + EINA_LOG_ERR("Could not load '%s' from theme %s: %s", + group, file, errmsg); + return false; + } + return true; +} + +bool RenderThemeEfl::themePartCacheEntrySurfaceCreate(struct ThemePartCacheEntry* ce) +{ + int w, h; + cairo_status_t status; + + ASSERT(ce); + ASSERT(ce->ee); + + ecore_evas_geometry_get(ce->ee, 0, 0, &w, &h); + ASSERT(w > 0); + ASSERT(h > 0); + + ce->surface = cairo_image_surface_create_for_data((unsigned char *)ecore_evas_buffer_pixels_get(ce->ee), + CAIRO_FORMAT_ARGB32, w, h, w * 4); + status = cairo_surface_status(ce->surface); + if (status != CAIRO_STATUS_SUCCESS) { + EINA_LOG_ERR("Could not create cairo surface: %s", + cairo_status_to_string(status)); + return false; + } + + return true; +} + +// allocate a new entry and fill it with edje group +struct RenderThemeEfl::ThemePartCacheEntry* RenderThemeEfl::cacheThemePartNew(FormType type, const IntSize& size) +{ + struct ThemePartCacheEntry *ce = new struct ThemePartCacheEntry; + + if (!ce) { + EINA_LOG_ERR("could not allocate ThemePartCacheEntry."); + return 0; + } + + ce->ee = ecore_evas_buffer_new(size.width(), size.height()); + if (!ce->ee) { + EINA_LOG_ERR("ecore_evas_buffer_new(%d, %d) failed.", + size.width(), size.height()); + delete ce; + return 0; + } + + ce->o = edje_object_add(ecore_evas_get(ce->ee)); + ASSERT(ce->o); + if (!themePartCacheEntryReset(ce, type)) { + evas_object_del(ce->o); + ecore_evas_free(ce->ee); + delete ce; + return 0; + } + + if (!themePartCacheEntrySurfaceCreate(ce)) { + evas_object_del(ce->o); + ecore_evas_free(ce->ee); + delete ce; + return 0; + } + + evas_object_resize(ce->o, size.width(), size.height()); + evas_object_show(ce->o); + + ce->type = type; + ce->size = size; + + m_partCache.prepend(ce); + return ce; +} + +// just change the edje group and return the same entry +struct RenderThemeEfl::ThemePartCacheEntry* RenderThemeEfl::cacheThemePartReset(FormType type, struct RenderThemeEfl::ThemePartCacheEntry* ce) +{ + if (!themePartCacheEntryReset(ce, type)) { + ce->type = FormTypeLast; // invalidate + m_partCache.append(ce); + return 0; + } + ce->type = type; + m_partCache.prepend(ce); + return ce; +} + +// resize entry and reset it +struct RenderThemeEfl::ThemePartCacheEntry* RenderThemeEfl::cacheThemePartResizeAndReset(FormType type, const IntSize& size, struct RenderThemeEfl::ThemePartCacheEntry* ce) +{ + cairo_surface_finish(ce->surface); + ecore_evas_resize(ce->ee, size.width(), size.height()); + evas_object_resize(ce->o, size.width(), size.height()); + + if (!themePartCacheEntrySurfaceCreate(ce)) { + evas_object_del(ce->o); + ecore_evas_free(ce->ee); + delete ce; + return 0; + } + + return cacheThemePartReset(type, ce); +} + +// general purpose get (will create, reuse and all) +struct RenderThemeEfl::ThemePartCacheEntry* RenderThemeEfl::cacheThemePartGet(FormType type, const IntSize& size) +{ + Vector<struct ThemePartCacheEntry *>::iterator itr, end; + struct ThemePartCacheEntry *ce_last_size = 0; + int i, idxLastSize = -1; + + itr = m_partCache.begin(); + end = m_partCache.end(); + for (i = 0; itr != end; i++, itr++) { + struct ThemePartCacheEntry *ce = *itr; + if (ce->size == size) { + if (ce->type == type) + return ce; + ce_last_size = ce; + idxLastSize = i; + } + } + + if (m_partCache.size() < RENDER_THEME_EFL_PART_CACHE_MAX) + return cacheThemePartNew(type, size); + + if (ce_last_size && ce_last_size != m_partCache.first()) { + m_partCache.remove(idxLastSize); + return cacheThemePartReset(type, ce_last_size); + } + + ThemePartCacheEntry* ce = m_partCache.last(); + m_partCache.removeLast(); + return cacheThemePartResizeAndReset(type, size, ce); +} + +void RenderThemeEfl::cacheThemePartFlush() +{ + Vector<struct ThemePartCacheEntry *>::iterator itr, end; + + itr = m_partCache.begin(); + end = m_partCache.end(); + for (; itr != end; itr++) { + struct ThemePartCacheEntry *ce = *itr; + cairo_surface_finish(ce->surface); + evas_object_del(ce->o); + ecore_evas_free(ce->ee); + delete ce; + } + m_partCache.clear(); +} + +void RenderThemeEfl::applyEdjeStateFromForm(Evas_Object* o, ControlStates states) +{ + const char *signals[] = { // keep in sync with WebCore/platform/ThemeTypes.h + "hovered", + "pressed", + "focused", + "enabled", + "checked", + "read-only", + "default", + "window-inactive", + "indeterminate" + }; + + edje_object_signal_emit(o, "reset", ""); + + for (size_t i = 0; i < WTF_ARRAY_LENGTH(signals); ++i) { + if (states & (1 << i)) + edje_object_signal_emit(o, signals[i], ""); + } +} + +bool RenderThemeEfl::paintThemePart(RenderObject* o, FormType type, const PaintInfo& i, const IntRect& rect) +{ + ThemePartCacheEntry* ce; + Eina_List* updates; + cairo_t* cairo; + + ASSERT(m_canvas); + ASSERT(m_edje); + + ce = cacheThemePartGet(type, rect.size()); + ASSERT(ce); + if (!ce) + return false; + + applyEdjeStateFromForm(ce->o, controlStatesForRenderer(o)); + + cairo = i.context->platformContext(); + ASSERT(cairo); + + // Currently, only sliders needs this message; if other widget ever needs special + // treatment, move them to special functions. + if (type == SliderVertical || type == SliderHorizontal) { + RenderSlider* renderSlider = toRenderSlider(o); + Edje_Message_Float_Set* msg; + int max, value; + + if (type == SliderVertical) { + max = rect.height() - renderSlider->thumbRect().height(); + value = renderSlider->thumbRect().y(); + } else { + max = rect.width() - renderSlider->thumbRect().width(); + value = renderSlider->thumbRect().x(); + } + + msg = static_cast<Edje_Message_Float_Set*>(alloca(sizeof(Edje_Message_Float_Set) + sizeof(float))); + + msg->count = 2; + msg->val[0] = static_cast<float>(value) / static_cast<float>(max); + msg->val[1] = 0.1; + edje_object_message_send(ce->o, EDJE_MESSAGE_FLOAT_SET, 0, msg); +#if ENABLE(PROGRESS_TAG) + } else if (type == ProgressBar) { + RenderProgress* renderProgress = toRenderProgress(o); + Edje_Message_Float_Set* msg; + int max; + double value; + + msg = static_cast<Edje_Message_Float_Set*>(alloca(sizeof(Edje_Message_Float_Set) + sizeof(float))); + max = rect.width(); + value = renderProgress->position(); + + msg->count = 2; + if (o->style()->direction() == RTL) + msg->val[0] = (1.0 - value) * max; + else + msg->val[0] = 0; + msg->val[1] = value; + edje_object_message_send(ce->o, EDJE_MESSAGE_FLOAT_SET, 0, msg); +#endif + } + + edje_object_calc_force(ce->o); + edje_object_message_signal_process(ce->o); + updates = evas_render_updates(ecore_evas_get(ce->ee)); + evas_render_updates_free(updates); + + cairo_save(cairo); + cairo_set_source_surface(cairo, ce->surface, rect.x(), rect.y()); + cairo_paint_with_alpha(cairo, 1.0); + cairo_restore(cairo); + + return false; +} + +PassRefPtr<RenderTheme> RenderThemeEfl::create(Page* page) +{ + return adoptRef(new RenderThemeEfl(page)); +} + +PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page) +{ + if (page) + return RenderThemeEfl::create(page); + + static RenderTheme* fallback = RenderThemeEfl::create(0).releaseRef(); + return fallback; +} + +static void renderThemeEflColorClassSelectionActive(void* data, Evas_Object* o, const char* signal, const char* source) +{ + RenderThemeEfl* that = static_cast<RenderThemeEfl *>(data); + int fr, fg, fb, fa, br, bg, bb, ba; + + if (!edje_object_color_class_get(o, source, &fr, &fg, &fb, &fa, &br, &bg, &bb, &ba, 0, 0, 0, 0)) + return; + + that->setActiveSelectionColor(fr, fg, fb, fa, br, bg, bb, ba); +} + +static void renderThemeEflColorClassSelectionInactive(void* data, Evas_Object* o, const char* signal, const char* source) +{ + RenderThemeEfl* that = static_cast<RenderThemeEfl *>(data); + int fr, fg, fb, fa, br, bg, bb, ba; + + if (!edje_object_color_class_get(o, source, &fr, &fg, &fb, &fa, &br, &bg, &bb, &ba, 0, 0, 0, 0)) + return; + + that->setInactiveSelectionColor(fr, fg, fb, fa, br, bg, bb, ba); +} + +static void renderThemeEflColorClassFocusRing(void* data, Evas_Object* o, const char* signal, const char* source) +{ + RenderThemeEfl* that = static_cast<RenderThemeEfl *>(data); + int fr, fg, fb, fa; + + if (!edje_object_color_class_get(o, source, &fr, &fg, &fb, &fa, 0, 0, 0, 0, 0, 0, 0, 0)) + return; + + that->setFocusRingColor(fr, fg, fb, fa); +} + +static void renderThemeEflColorClassButtonText(void* data, Evas_Object* o, const char* signal, const char* source) +{ + RenderThemeEfl* that = static_cast<RenderThemeEfl *>(data); + int fr, fg, fb, fa, br, bg, bb, ba; + + if (!edje_object_color_class_get(o, source, &fr, &fg, &fb, &fa, &br, &bg, &bb, &ba, 0, 0, 0, 0)) + return; + + that->setButtonTextColor(fr, fg, fb, fa, br, bg, bb, ba); +} + +static void renderThemeEflColorClassComboText(void* data, Evas_Object* o, const char* signal, const char* source) +{ + RenderThemeEfl* that = static_cast<RenderThemeEfl *>(data); + int fr, fg, fb, fa, br, bg, bb, ba; + + if (!edje_object_color_class_get(o, source, &fr, &fg, &fb, &fa, &br, &bg, &bb, &ba, 0, 0, 0, 0)) + return; + + that->setComboTextColor(fr, fg, fb, fa, br, bg, bb, ba); +} + +static void renderThemeEflColorClassEntryText(void* data, Evas_Object* o, const char* signal, const char* source) +{ + RenderThemeEfl* that = static_cast<RenderThemeEfl *>(data); + int fr, fg, fb, fa, br, bg, bb, ba; + + if (!edje_object_color_class_get(o, source, &fr, &fg, &fb, &fa, &br, &bg, &bb, &ba, 0, 0, 0, 0)) + return; + + that->setEntryTextColor(fr, fg, fb, fa, br, bg, bb, ba); +} + +static void renderThemeEflColorClassSearchText(void* data, Evas_Object* o, const char* signal, const char* source) +{ + RenderThemeEfl* that = static_cast<RenderThemeEfl *>(data); + int fr, fg, fb, fa, br, bg, bb, ba; + if (!edje_object_color_class_get(o, source, &fr, &fg, &fb, &fa, &br, &bg, &bb, &ba, 0, 0, 0, 0)) + return; + + that->setSearchTextColor(fr, fg, fb, fa, br, bg, bb, ba); +} + +void RenderThemeEfl::createCanvas() +{ + ASSERT(!m_canvas); + m_canvas = ecore_evas_buffer_new(1, 1); + ASSERT(m_canvas); +} + +void RenderThemeEfl::createEdje() +{ + ASSERT(!m_edje); + Frame* frame = m_page ? m_page->mainFrame() : 0; + FrameView* view = frame ? frame->view() : 0; + String theme = view ? view->edjeThemeRecursive() : ""; + if (theme.isEmpty()) + EINA_LOG_ERR("No theme defined, unable to set RenderThemeEfl."); + else { + m_edje = edje_object_add(ecore_evas_get(m_canvas)); + if (!m_edje) + EINA_LOG_ERR("Could not create base edje object."); + else if (!edje_object_file_set(m_edje, theme.utf8().data(), "webkit/base")) { + Edje_Load_Error err = edje_object_load_error_get(m_edje); + const char* errmsg = edje_load_error_str(err); + EINA_LOG_ERR("Could not load 'webkit/base' from theme %s: %s", + theme.utf8().data(), errmsg); + evas_object_del(m_edje); + m_edje = 0; + } else { +#define CONNECT(cc, func) \ + edje_object_signal_callback_add(m_edje, "color_class,set", \ + "webkit/"cc, func, this) + + CONNECT("selection/active", + renderThemeEflColorClassSelectionActive); + CONNECT("selection/inactive", + renderThemeEflColorClassSelectionInactive); + CONNECT("focus_ring", renderThemeEflColorClassFocusRing); + CONNECT("button/text", renderThemeEflColorClassButtonText); + CONNECT("combo/text", renderThemeEflColorClassComboText); + CONNECT("entry/text", renderThemeEflColorClassEntryText); + CONNECT("search/text", renderThemeEflColorClassSearchText); +#undef CONNECT + } + } + ASSERT(m_edje); +} + +void RenderThemeEfl::applyEdjeColors() +{ + int fr, fg, fb, fa, br, bg, bb, ba; + ASSERT(m_edje); +#define COLOR_GET(cls) \ + edje_object_color_class_get(m_edje, "webkit/"cls, \ + &fr, &fg, &fb, &fa, &br, &bg, &bb, &ba, \ + 0, 0, 0, 0) + + if (COLOR_GET("selection/active")) { + m_activeSelectionForegroundColor = Color(fr, fg, fb, fa); + m_activeSelectionBackgroundColor = Color(br, bg, bb, ba); + } + if (COLOR_GET("selection/inactive")) { + m_inactiveSelectionForegroundColor = Color(fr, fg, fb, fa); + m_inactiveSelectionBackgroundColor = Color(br, bg, bb, ba); + } + if (COLOR_GET("focus_ring")) { + m_focusRingColor = Color(fr, fg, fb, fa); + // webkit just use platformFocusRingColor() for default theme (without page) + // this is ugly, but no other way to do it unless we change + // it to use page themes as much as possible. + RenderTheme::setCustomFocusRingColor(m_focusRingColor); + } + if (COLOR_GET("button/text")) { + m_buttonTextForegroundColor = Color(fr, fg, fb, fa); + m_buttonTextBackgroundColor = Color(br, bg, bb, ba); + } + if (COLOR_GET("combo/text")) { + m_comboTextForegroundColor = Color(fr, fg, fb, fa); + m_comboTextBackgroundColor = Color(br, bg, bb, ba); + } + if (COLOR_GET("entry/text")) { + m_entryTextForegroundColor = Color(fr, fg, fb, fa); + m_entryTextBackgroundColor = Color(br, bg, bb, ba); + } + if (COLOR_GET("search/text")) { + m_searchTextForegroundColor = Color(fr, fg, fb, fa); + m_searchTextBackgroundColor = Color(br, bg, bb, ba); + } +#undef COLOR_GET + platformColorsDidChange(); +} + +void RenderThemeEfl::applyPartDescriptionFallback(struct ThemePartDesc* desc) +{ + desc->min.setWidth(Length(0, Fixed)); + desc->min.setHeight(Length(0, Fixed)); + + desc->max.setWidth(Length(0, Fixed)); + desc->max.setHeight(Length(0, Fixed)); + + desc->padding = LengthBox(0, 0, 0, 0); +} + +void RenderThemeEfl::applyPartDescription(Evas_Object* o, struct ThemePartDesc* desc) +{ + Evas_Coord minw, minh, maxw, maxh; + + edje_object_size_min_get(o, &minw, &minh); + if (!minw && !minh) + edje_object_size_min_calc(o, &minw, &minh); + + desc->min.setWidth(Length(minw, Fixed)); + desc->min.setHeight(Length(minh, Fixed)); + + edje_object_size_max_get(o, &maxw, &maxh); + desc->max.setWidth(Length(maxw, Fixed)); + desc->max.setHeight(Length(maxh, Fixed)); + + if (!edje_object_part_exists(o, "text_confinement")) + desc->padding = LengthBox(0, 0, 0, 0); + else { + Evas_Coord px, py, pw, ph; + Evas_Coord ox = 0, oy = 0, ow = 0, oh = 0; + int t, r, b, l; + + if (minw > 0) + ow = minw; + else + ow = 100; + if (minh > 0) + oh = minh; + else + oh = 100; + if (maxw > 0 && ow > maxw) + ow = maxw; + if (maxh > 0 && oh > maxh) + oh = maxh; + + evas_object_move(o, ox, oy); + evas_object_resize(o, ow, oh); + edje_object_calc_force(o); + edje_object_message_signal_process(o); + edje_object_part_geometry_get(o, "text_confinement", &px, &py, &pw, &ph); + + t = py - oy; + b = (oh + oy) - (ph + py); + + l = px - ox; + r = (ow + ox) - (pw + px); + + desc->padding = LengthBox(t, r, b, l); + } +} + +const char* RenderThemeEfl::edjeGroupFromFormType(FormType type) const +{ + static const char* groups[] = { +#define W(n) "webkit/widget/"n + W("button"), + W("radio"), + W("entry"), + W("checkbox"), + W("combo"), +#if ENABLE(PROGRESS_TAG) + W("progressbar"), +#endif + W("search/field"), + W("search/decoration"), + W("search/results_button"), + W("search/results_decoration"), + W("search/cancel_button"), + W("slider/vertical"), + W("slider/horizontal"), +#undef W + 0 + }; + ASSERT(type >= 0); + ASSERT((size_t)type < sizeof(groups) / sizeof(groups[0])); // out of sync? + return groups[type]; +} + +void RenderThemeEfl::applyPartDescriptions() +{ + Evas_Object* o; + unsigned int i; + const char* file; + + ASSERT(m_canvas); + ASSERT(m_edje); + + edje_object_file_get(m_edje, &file, 0); + ASSERT(file); + + o = edje_object_add(ecore_evas_get(m_canvas)); + if (!o) { + EINA_LOG_ERR("Could not create Edje object."); + return; + } + + for (i = 0; i < FormTypeLast; i++) { + FormType type = static_cast<FormType>(i); + const char* group = edjeGroupFromFormType(type); + m_partDescs[i].type = type; + if (!edje_object_file_set(o, file, group)) { + Edje_Load_Error err = edje_object_load_error_get(o); + const char* errmsg = edje_load_error_str(err); + EINA_LOG_ERR("Could not set theme group '%s' of file '%s': %s", + group, file, errmsg); + + applyPartDescriptionFallback(m_partDescs + i); + } else + applyPartDescription(o, m_partDescs + i); + } + evas_object_del(o); +} + +void RenderThemeEfl::themeChanged() +{ + cacheThemePartFlush(); + + if (!m_canvas) { + createCanvas(); + if (!m_canvas) + return; + } + + if (!m_edje) { + createEdje(); + if (!m_edje) + return; + } + + applyEdjeColors(); + applyPartDescriptions(); +} + +float RenderThemeEfl::defaultFontSize = 16.0f; + +RenderThemeEfl::RenderThemeEfl(Page* page) + : RenderTheme() + , m_page(page) + , m_activeSelectionBackgroundColor(0, 0, 255) + , m_activeSelectionForegroundColor(255, 255, 255) + , m_inactiveSelectionBackgroundColor(0, 0, 128) + , m_inactiveSelectionForegroundColor(200, 200, 200) + , m_focusRingColor(32, 32, 224, 224) + , m_buttonTextBackgroundColor(0, 0, 0, 0) + , m_buttonTextForegroundColor(0, 0, 0) + , m_comboTextBackgroundColor(0, 0, 0, 0) + , m_comboTextForegroundColor(0, 0, 0) + , m_entryTextBackgroundColor(0, 0, 0, 0) + , m_entryTextForegroundColor(0, 0, 0) + , m_searchTextBackgroundColor(0, 0, 0, 0) + , m_searchTextForegroundColor(0, 0, 0) + , m_canvas(0) + , m_edje(0) +{ + if (page && page->mainFrame() && page->mainFrame()->view()) + themeChanged(); +} + +RenderThemeEfl::~RenderThemeEfl() +{ + cacheThemePartFlush(); + + if (m_canvas) { + if (m_edje) + evas_object_del(m_edje); + ecore_evas_free(m_canvas); + } +} + +void RenderThemeEfl::setActiveSelectionColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA) +{ + m_activeSelectionForegroundColor = Color(foreR, foreG, foreB, foreA); + m_activeSelectionBackgroundColor = Color(backR, backG, backB, backA); + platformColorsDidChange(); +} + +void RenderThemeEfl::setInactiveSelectionColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA) +{ + m_inactiveSelectionForegroundColor = Color(foreR, foreG, foreB, foreA); + m_inactiveSelectionBackgroundColor = Color(backR, backG, backB, backA); + platformColorsDidChange(); +} + +void RenderThemeEfl::setFocusRingColor(int r, int g, int b, int a) +{ + m_focusRingColor = Color(r, g, b, a); + // webkit just use platformFocusRingColor() for default theme (without page) + // this is ugly, but no other way to do it unless we change + // it to use page themes as much as possible. + RenderTheme::setCustomFocusRingColor(m_focusRingColor); + platformColorsDidChange(); +} + +void RenderThemeEfl::setButtonTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA) +{ + m_buttonTextForegroundColor = Color(foreR, foreG, foreB, foreA); + m_buttonTextBackgroundColor = Color(backR, backG, backB, backA); + platformColorsDidChange(); +} + +void RenderThemeEfl::setComboTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA) +{ + m_comboTextForegroundColor = Color(foreR, foreG, foreB, foreA); + m_comboTextBackgroundColor = Color(backR, backG, backB, backA); + platformColorsDidChange(); +} + +void RenderThemeEfl::setEntryTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA) +{ + m_entryTextForegroundColor = Color(foreR, foreG, foreB, foreA); + m_entryTextBackgroundColor = Color(backR, backG, backB, backA); + platformColorsDidChange(); +} + +void RenderThemeEfl::setSearchTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA) +{ + m_searchTextForegroundColor = Color(foreR, foreG, foreB, foreA); + m_searchTextBackgroundColor = Color(backR, backG, backB, backA); + platformColorsDidChange(); +} + +static bool supportsFocus(ControlPart appearance) +{ + switch (appearance) { + case PushButtonPart: + case ButtonPart: + case TextFieldPart: + case TextAreaPart: + case SearchFieldPart: + case MenulistPart: + case RadioPart: + case CheckboxPart: + case SliderVerticalPart: + case SliderHorizontalPart: + return true; + default: + return false; + } +} + +bool RenderThemeEfl::supportsFocusRing(const RenderStyle* style) const +{ + return supportsFocus(style->appearance()); +} + +bool RenderThemeEfl::controlSupportsTints(const RenderObject* o) const +{ + return isEnabled(o); +} + +int RenderThemeEfl::baselinePosition(const RenderObject* o) const +{ + if (!o->isBox()) + return 0; + + if (o->style()->appearance() == CheckboxPart + || o->style()->appearance() == RadioPart) + return toRenderBox(o)->marginTop() + toRenderBox(o)->height() - 3; + + return RenderTheme::baselinePosition(o); +} + +bool RenderThemeEfl::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + if (o->style()->appearance() == SliderHorizontalPart) + return paintThemePart(o, SliderHorizontal, i, rect); + return paintThemePart(o, SliderVertical, i, rect); +} + +void RenderThemeEfl::adjustSliderTrackStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustSliderTrackStyle(selector, style, e); + return; + } + + adjustSizeConstraints(style, SliderHorizontal); + style->resetBorder(); + + const struct ThemePartDesc *desc = m_partDescs + (size_t)SliderHorizontal; + if (style->width().value() < desc->min.width().value()) + style->setWidth(desc->min.width()); + if (style->height().value() < desc->min.height().value()) + style->setHeight(desc->min.height()); +} + +void RenderThemeEfl::adjustSliderThumbStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + adjustSliderTrackStyle(selector, style, e); +} + +bool RenderThemeEfl::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintSliderTrack(o, i, rect); +} + +void RenderThemeEfl::adjustCheckboxStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustCheckboxStyle(selector, style, e); + return; + } + adjustSizeConstraints(style, CheckBox); + style->resetBorder(); + + const struct ThemePartDesc *desc = m_partDescs + (size_t)CheckBox; + if (style->width().value() < desc->min.width().value()) + style->setWidth(desc->min.width()); + if (style->height().value() < desc->min.height().value()) + style->setHeight(desc->min.height()); +} + +bool RenderThemeEfl::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, CheckBox, i, rect); +} + +void RenderThemeEfl::adjustRadioStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustRadioStyle(selector, style, e); + return; + } + adjustSizeConstraints(style, RadioButton); + style->resetBorder(); + + const struct ThemePartDesc *desc = m_partDescs + (size_t)RadioButton; + if (style->width().value() < desc->min.width().value()) + style->setWidth(desc->min.width()); + if (style->height().value() < desc->min.height().value()) + style->setHeight(desc->min.height()); +} + +bool RenderThemeEfl::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, RadioButton, i, rect); +} + +void RenderThemeEfl::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustButtonStyle(selector, style, e); + return; + } + + adjustSizeConstraints(style, Button); + + if (style->appearance() == PushButtonPart) { + style->resetBorder(); + style->setWhiteSpace(PRE); + style->setHeight(Length(Auto)); + style->setColor(m_buttonTextForegroundColor); + style->setBackgroundColor(m_buttonTextBackgroundColor); + } +} + +bool RenderThemeEfl::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, Button, i, rect); +} + +void RenderThemeEfl::adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustMenuListStyle(selector, style, e); + return; + } + adjustSizeConstraints(style, ComboBox); + style->resetBorder(); + style->setWhiteSpace(PRE); + style->setColor(m_comboTextForegroundColor); + style->setBackgroundColor(m_comboTextBackgroundColor); +} + +bool RenderThemeEfl::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, ComboBox, i, rect); +} + +void RenderThemeEfl::adjustTextFieldStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustTextFieldStyle(selector, style, e); + return; + } + adjustSizeConstraints(style, TextField); + style->resetBorder(); + style->setWhiteSpace(PRE); + style->setColor(m_entryTextForegroundColor); + style->setBackgroundColor(m_entryTextBackgroundColor); +} + +bool RenderThemeEfl::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, TextField, i, rect); +} + +void RenderThemeEfl::adjustTextAreaStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + adjustTextFieldStyle(selector, style, e); +} + +bool RenderThemeEfl::paintTextArea(RenderObject* o, const PaintInfo& i, const IntRect& r) +{ + return paintTextField(o, i, r); +} + +void RenderThemeEfl::adjustSearchFieldDecorationStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustSearchFieldDecorationStyle(selector, style, e); + return; + } + adjustSizeConstraints(style, SearchFieldDecoration); + style->resetBorder(); + style->setWhiteSpace(PRE); +} + +bool RenderThemeEfl::paintSearchFieldDecoration(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, SearchFieldDecoration, i, rect); +} + +void RenderThemeEfl::adjustSearchFieldResultsButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustSearchFieldResultsButtonStyle(selector, style, e); + return; + } + adjustSizeConstraints(style, SearchFieldResultsButton); + style->resetBorder(); + style->setWhiteSpace(PRE); +} + +bool RenderThemeEfl::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, SearchFieldResultsButton, i, rect); +} + +void RenderThemeEfl::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustSearchFieldResultsDecorationStyle(selector, style, e); + return; + } + adjustSizeConstraints(style, SearchFieldResultsDecoration); + style->resetBorder(); + style->setWhiteSpace(PRE); +} + +bool RenderThemeEfl::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, SearchFieldResultsDecoration, i, rect); +} + +void RenderThemeEfl::adjustSearchFieldCancelButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustSearchFieldCancelButtonStyle(selector, style, e); + return; + } + adjustSizeConstraints(style, SearchFieldCancelButton); + style->resetBorder(); + style->setWhiteSpace(PRE); +} + +bool RenderThemeEfl::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, SearchFieldCancelButton, i, rect); +} + +void RenderThemeEfl::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const +{ + if (!m_page && e && e->document()->page()) { + static_cast<RenderThemeEfl*>(e->document()->page()->theme())->adjustSearchFieldStyle(selector, style, e); + return; + } + adjustSizeConstraints(style, SearchField); + style->resetBorder(); + style->setWhiteSpace(PRE); + style->setColor(m_searchTextForegroundColor); + style->setBackgroundColor(m_searchTextBackgroundColor); +} + +bool RenderThemeEfl::paintSearchField(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, SearchField, i, rect); +} + +void RenderThemeEfl::setDefaultFontSize(int size) +{ + defaultFontSize = size; +} + +void RenderThemeEfl::systemFont(int propId, FontDescription& fontDescription) const +{ + // It was called by RenderEmbeddedObject::paintReplaced to render alternative string. + // To avoid cairo_error while rendering, fontDescription should be passed. + DEFINE_STATIC_LOCAL(String, fontFace, ("Sans")); + float fontSize = defaultFontSize; + + fontDescription.firstFamily().setFamily(fontFace); + fontDescription.setSpecifiedSize(fontSize); + fontDescription.setIsAbsoluteSize(true); + fontDescription.setGenericFamily(FontDescription::NoFamily); + fontDescription.setWeight(FontWeightNormal); + fontDescription.setItalic(false); +} + +#if ENABLE(PROGRESS_TAG) +void RenderThemeEfl::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle* style, Element*) const +{ + style->setBoxShadow(0); +} + +bool RenderThemeEfl::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + return paintThemePart(o, ProgressBar, i, rect); +} +#endif + +} diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.h b/Source/WebCore/platform/efl/RenderThemeEfl.h new file mode 100644 index 0000000..087e2aa --- /dev/null +++ b/Source/WebCore/platform/efl/RenderThemeEfl.h @@ -0,0 +1,223 @@ +/* + * This file is part of the WebKit project. + * + * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com + * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2007 Alp Toker <alp@atoker.com> + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef RenderThemeEfl_h +#define RenderThemeEfl_h + +#include "RenderTheme.h" + +#include <cairo.h> + +typedef struct _Ecore_Evas Ecore_Evas; +typedef struct _Evas_Object Evas_Object; + +namespace WebCore { + +enum FormType { // KEEP IN SYNC WITH edjeGroupFromFormType() + Button, + RadioButton, + TextField, + CheckBox, + ComboBox, +#if ENABLE(PROGRESS_TAG) + ProgressBar, +#endif + SearchField, + SearchFieldDecoration, + SearchFieldResultsButton, + SearchFieldResultsDecoration, + SearchFieldCancelButton, + SliderVertical, + SliderHorizontal, + FormTypeLast +}; + +class RenderThemeEfl : public RenderTheme { +private: + RenderThemeEfl(Page*); + ~RenderThemeEfl(); + +public: + static PassRefPtr<RenderTheme> create(Page*); + + // A method asking if the theme's controls actually care about redrawing when hovered. + virtual bool supportsHover(const RenderStyle*) const { return true; } + + // A method asking if the theme is able to draw the focus ring. + virtual bool supportsFocusRing(const RenderStyle*) const; + + // A method asking if the control changes its tint when the window has focus or not. + virtual bool controlSupportsTints(const RenderObject*) const; + + // A general method asking if any control tinting is supported at all. + virtual bool supportsControlTints() const { return true; } + + // 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. + virtual int baselinePosition(const RenderObject*) const; + + virtual Color platformActiveSelectionBackgroundColor() const { return m_activeSelectionBackgroundColor; } + virtual Color platformInactiveSelectionBackgroundColor() const { return m_inactiveSelectionBackgroundColor; } + virtual Color platformActiveSelectionForegroundColor() const { return m_activeSelectionForegroundColor; } + virtual Color platformInactiveSelectionForegroundColor() const { return m_inactiveSelectionForegroundColor; } + virtual Color platformFocusRingColor() const { return m_focusRingColor; } + + virtual void themeChanged(); + + // Set platform colors and notify they changed + void setActiveSelectionColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA); + void setInactiveSelectionColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA); + void setFocusRingColor(int r, int g, int b, int a); + + void setButtonTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA); + void setComboTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA); + void setEntryTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA); + void setSearchTextColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA); + + void adjustSizeConstraints(RenderStyle* style, FormType type) const; + + + // System fonts. + virtual void systemFont(int propId, FontDescription&) const; + + virtual void adjustCheckboxStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustRadioStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + + static void setDefaultFontSize(int size); + +#if ENABLE(PROGRESS_TAG) + virtual void adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); +#endif + +protected: + static float defaultFontSize; + +private: + void createCanvas(); + void createEdje(); + void applyEdjeColors(); + void applyPartDescriptions(); + const char* edjeGroupFromFormType(FormType type) const; + void applyEdjeStateFromForm(Evas_Object* o, ControlStates states); + bool paintThemePart(RenderObject* o, FormType type, const PaintInfo& i, const IntRect& rect); + + Page* m_page; + Color m_activeSelectionBackgroundColor; + Color m_activeSelectionForegroundColor; + Color m_inactiveSelectionBackgroundColor; + Color m_inactiveSelectionForegroundColor; + Color m_focusRingColor; + Color m_buttonTextBackgroundColor; + Color m_buttonTextForegroundColor; + Color m_comboTextBackgroundColor; + Color m_comboTextForegroundColor; + Color m_entryTextBackgroundColor; + Color m_entryTextForegroundColor; + Color m_searchTextBackgroundColor; + Color m_searchTextForegroundColor; + Ecore_Evas* m_canvas; + Evas_Object* m_edje; + + struct ThemePartDesc { + FormType type; + LengthSize min; + LengthSize max; + LengthBox padding; + }; + void applyPartDescriptionFallback(struct ThemePartDesc* desc); + void applyPartDescription(Evas_Object* o, struct ThemePartDesc* desc); + + struct ThemePartCacheEntry { + FormType type; + IntSize size; + Ecore_Evas* ee; + Evas_Object* o; + cairo_surface_t* surface; + }; + + struct ThemePartDesc m_partDescs[FormTypeLast]; + + // this should be small and not so frequently used, + // so use a vector and do linear searches + Vector<struct ThemePartCacheEntry *> m_partCache; + + // get (use, create or replace) entry from cache + struct ThemePartCacheEntry* cacheThemePartGet(FormType type, const IntSize& size); + // flush cache, deleting all entries + void cacheThemePartFlush(); + + // internal, used by cacheThemePartGet() + bool themePartCacheEntryReset(struct ThemePartCacheEntry* ce, FormType type); + bool themePartCacheEntrySurfaceCreate(struct ThemePartCacheEntry* ce); + struct ThemePartCacheEntry* cacheThemePartNew(FormType type, const IntSize& size); + struct ThemePartCacheEntry* cacheThemePartReset(FormType type, struct ThemePartCacheEntry* ce); + struct ThemePartCacheEntry* cacheThemePartResizeAndReset(FormType type, const IntSize& size, struct ThemePartCacheEntry* ce); + +}; +} + +#endif // RenderThemeEfl_h diff --git a/Source/WebCore/platform/efl/ScrollViewEfl.cpp b/Source/WebCore/platform/efl/ScrollViewEfl.cpp new file mode 100644 index 0000000..6768a4a --- /dev/null +++ b/Source/WebCore/platform/efl/ScrollViewEfl.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com + * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009, 2010 ProFUSION embedded systems + * Copyright (C) 2009, 2010 Samsung Electronics + * + * 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 "ScrollView.h" + +#include "FloatRect.h" +#include "FrameView.h" +#include "HostWindow.h" +#include "IntRect.h" +#include "NotImplemented.h" +#include "ScrollbarTheme.h" + +#include <Ecore_Evas.h> +#include <Evas.h> + +using namespace std; + +namespace WebCore { + +void ScrollView::platformInit() +{ +} + +void ScrollView::platformDestroy() +{ +} + +} diff --git a/Source/WebCore/platform/efl/ScrollbarEfl.cpp b/Source/WebCore/platform/efl/ScrollbarEfl.cpp new file mode 100644 index 0000000..282ca7c --- /dev/null +++ b/Source/WebCore/platform/efl/ScrollbarEfl.cpp @@ -0,0 +1,216 @@ +/* + * Copyright (C) 2007 Holger Hans Peter Freyther zecke@selfish.org + * (C) 2009 Kenneth Rohde Christiansen + * (C) 2009 INdT, Instituto Nokia de Technologia + * (C) 2009-2010 ProFUSION embedded systems + * (C) 2009-2010 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "ScrollbarEfl.h" + +#include "ChromeClient.h" +#include "Frame.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "HostWindow.h" +#include "IntRect.h" +#include "NotImplemented.h" +#include "Page.h" +#include "ScrollbarTheme.h" + +#include <Ecore.h> +#include <Edje.h> +#include <Evas.h> +#include <string> +#include <wtf/text/CString.h> + +using namespace std; +using namespace WebCore; + +PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size) +{ + return adoptRef(new ScrollbarEfl(client, orientation, size)); +} + +ScrollbarEfl::ScrollbarEfl(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) + : Scrollbar(client, orientation, controlSize) + , m_lastPos(0) + , m_lastTotalSize(0) + , m_lastVisibleSize(0) +{ + Widget::setFrameRect(IntRect(0, 0, 0, 0)); +} + +ScrollbarEfl::~ScrollbarEfl() +{ + if (!evasObject()) + return; + evas_object_del(evasObject()); + setEvasObject(0); +} + +static void scrollbarEflEdjeMessage(void* data, Evas_Object* o, Edje_Message_Type type, int id, void* msg) +{ + ScrollbarEfl* that = static_cast<ScrollbarEfl*>(data); + Edje_Message_Float* m; + int v; + + if (!id) { + EINA_LOG_ERR("Unknown message id '%d' from scroll bar theme.", id); + return; + } + + if (type != EDJE_MESSAGE_FLOAT) { + EINA_LOG_ERR("Message id '%d' of incorrect type from scroll bar theme. " + "Expected '%d', got '%d'.", + id, EDJE_MESSAGE_FLOAT, type); + return; + } + + m = static_cast<Edje_Message_Float*>(msg); + v = m->val * (that->totalSize() - that->visibleSize()); + that->setValue(v, Scrollbar::NotFromScrollAnimator); +} + +void ScrollbarEfl::setParent(ScrollView* view) +{ + Evas_Object* o = evasObject(); + Evas_Coord w, h; + + Widget::setParent(view); + + if (!o) { + if (!view) + return; + + o = edje_object_add(view->evas()); + if (!o) { + EINA_LOG_ERR("Could not create edje object for view=%p (evas=%p)", + view, view->evas()); + return; + } + edje_object_message_handler_set(o, scrollbarEflEdjeMessage, this); + setEvasObject(o); + } else if (!view) { + evas_object_hide(o); + return; + } + + const char* group = (orientation() == HorizontalScrollbar) + ? "scrollbar.horizontal" : "scrollbar.vertical"; + String theme(edjeThemeRecursive()); + + if (theme.isEmpty()) { + EINA_LOG_ERR("Could not load theme '%s': no theme path set.", group); + evas_object_hide(o); + return; + } + + if (!edje_object_file_set(o, theme.utf8().data(), group)) { + Edje_Load_Error err = edje_object_load_error_get(o); + const char* errmsg = edje_load_error_str(err); + EINA_LOG_ERR("Could not load theme '%s' from file '%s': #%d '%s'", + group, theme.utf8().data(), err, errmsg); + return; + } + + setPlatformWidget(o); + evas_object_smart_member_add(o, view->evasObject()); + evas_object_show(o); + + edje_object_size_min_get(o, &w, &h); + + IntRect rect = frameRect(); + rect.setSize(IntSize(w, h)); + setFrameRect(rect); +} + +void ScrollbarEfl::updateThumbPosition() +{ + updateThumbPositionAndProportion(); +} + +void ScrollbarEfl::updateThumbProportion() +{ + updateThumbPositionAndProportion(); +} + +void ScrollbarEfl::updateThumbPositionAndProportion() +{ + if (!platformWidget()) + return; + + int pos = currentPos(); + int tSize = totalSize(); + int vSize = visibleSize(); + + if (m_lastPos == pos + && m_lastTotalSize == tSize + && m_lastVisibleSize == vSize) + return; + + m_lastPos = pos; + m_lastTotalSize = tSize; + m_lastVisibleSize = vSize; + + Edje_Message_Float_Set* msg = static_cast<Edje_Message_Float_Set*> + (alloca(sizeof(Edje_Message_Float_Set) + sizeof(float))); + msg->count = 2; + + if (tSize - vSize > 0) + msg->val[0] = pos / (float)(tSize - vSize); + else + msg->val[0] = 0.0; + + if (tSize > 0) + msg->val[1] = vSize / (float)tSize; + else + msg->val[1] = 0.0; + + edje_object_message_send(platformWidget(), EDJE_MESSAGE_FLOAT_SET, 0, msg); +} + +void ScrollbarEfl::setFrameRect(const IntRect& rect) +{ + Widget::setFrameRect(rect); + frameRectsChanged(); +} + +void ScrollbarEfl::frameRectsChanged() +{ + Evas_Object* o = platformWidget(); + Evas_Coord x, y; + + if (!parent() || !o) + return; + + IntRect rect = frameRect(); + if (parent()->isScrollViewScrollbar(this)) + rect.setLocation(parent()->convertToContainingWindow(rect.location())); + else + rect.setLocation(parent()->contentsToWindow(rect.location())); + + evas_object_geometry_get(root()->evasObject(), &x, &y, 0, 0); + evas_object_move(o, x + rect.x(), y + rect.y()); + evas_object_resize(o, rect.width(), rect.height()); +} + +void ScrollbarEfl::paint(GraphicsContext* context, const IntRect& rect) +{ +} + diff --git a/Source/WebCore/platform/efl/ScrollbarEfl.h b/Source/WebCore/platform/efl/ScrollbarEfl.h new file mode 100644 index 0000000..35375a6 --- /dev/null +++ b/Source/WebCore/platform/efl/ScrollbarEfl.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * 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 ScrollbarEfl_h +#define ScrollbarEfl_h + +#include "Scrollbar.h" +#include <wtf/PassRefPtr.h> + +namespace WebCore { + +class ScrollbarEfl : public Scrollbar { +public: + friend class Scrollbar; + + virtual ~ScrollbarEfl(); + + virtual void setFrameRect(const IntRect&); + + virtual bool handleMouseMoveEvent(const PlatformMouseEvent&) { return false; } + virtual bool handleMouseOutEvent(const PlatformMouseEvent&) { return false; } + virtual bool handleMousePressEvent(const PlatformMouseEvent&) { return false; } + virtual bool handleMouseReleaseEvent(const PlatformMouseEvent&) { return false; } + + virtual void frameRectsChanged(); + + virtual void paint(GraphicsContext* context, const IntRect& damageRect); + +protected: + ScrollbarEfl(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize); + + virtual void updateThumbPositionAndProportion(); + virtual void updateThumbPosition(); + virtual void updateThumbProportion(); + + virtual void setParent(ScrollView* view); + +private: + int m_lastPos; + int m_lastTotalSize; + int m_lastVisibleSize; +}; + +} + +#endif // ScrollbarEfl_h diff --git a/Source/WebCore/platform/efl/ScrollbarThemeEfl.cpp b/Source/WebCore/platform/efl/ScrollbarThemeEfl.cpp new file mode 100644 index 0000000..62df005 --- /dev/null +++ b/Source/WebCore/platform/efl/ScrollbarThemeEfl.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ScrollbarThemeEfl.h" + +#include "NotImplemented.h" +#include <stdio.h> + +namespace WebCore { + +ScrollbarTheme* ScrollbarTheme::nativeTheme() +{ + static ScrollbarThemeEfl theme; + return &theme; +} + +ScrollbarThemeEfl::~ScrollbarThemeEfl() +{ +} + +int ScrollbarThemeEfl::scrollbarThickness(ScrollbarControlSize controlSize) +{ + return 0; // we paint on top +} + +void ScrollbarThemeEfl::registerScrollbar(Scrollbar* scrollbar) +{ +} + +void ScrollbarThemeEfl::unregisterScrollbar(Scrollbar* scrollbar) +{ +} + +} + diff --git a/Source/WebCore/platform/efl/ScrollbarThemeEfl.h b/Source/WebCore/platform/efl/ScrollbarThemeEfl.h new file mode 100644 index 0000000..0fe1688 --- /dev/null +++ b/Source/WebCore/platform/efl/ScrollbarThemeEfl.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScrollbarThemeEfl_h +#define ScrollbarThemeEfl_h + +#include "ScrollbarTheme.h" + +namespace WebCore { + +class ScrollbarThemeEfl : public ScrollbarTheme { +public: + virtual ~ScrollbarThemeEfl(); + + virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar); + + virtual void registerScrollbar(Scrollbar* scrollbar); + virtual void unregisterScrollbar(Scrollbar* scrollbar); +}; + +} +#endif // ScrollbarThemeEfl_h + diff --git a/Source/WebCore/platform/efl/SearchPopupMenuEfl.cpp b/Source/WebCore/platform/efl/SearchPopupMenuEfl.cpp new file mode 100644 index 0000000..20ecb09 --- /dev/null +++ b/Source/WebCore/platform/efl/SearchPopupMenuEfl.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "SearchPopupMenuEfl.h" + +#include "NotImplemented.h" + +namespace WebCore { + +SearchPopupMenuEfl::SearchPopupMenuEfl(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuEfl(client))) +{ + notImplemented(); +} + +PopupMenu* SearchPopupMenuEfl::popupMenu() +{ + return m_popup.get(); +} + +void SearchPopupMenuEfl::saveRecentSearches(const AtomicString&, const Vector<String>&) +{ + notImplemented(); +} + +void SearchPopupMenuEfl::loadRecentSearches(const AtomicString&, Vector<String>&) +{ + notImplemented(); +} + +bool SearchPopupMenuEfl::enabled() +{ + notImplemented(); + return true; +} + +} diff --git a/Source/WebCore/platform/efl/SearchPopupMenuEfl.h b/Source/WebCore/platform/efl/SearchPopupMenuEfl.h new file mode 100644 index 0000000..4ffb62e --- /dev/null +++ b/Source/WebCore/platform/efl/SearchPopupMenuEfl.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuEfl_h +#define SearchPopupMenuEfl_h + +#include "PopupMenuEfl.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuEfl : public SearchPopupMenu { +public: + SearchPopupMenuEfl(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuEfl> m_popup; +}; + +} + +#endif // SearchPopupMenuEfl_h diff --git a/Source/WebCore/platform/efl/SharedBufferEfl.cpp b/Source/WebCore/platform/efl/SharedBufferEfl.cpp new file mode 100644 index 0000000..23769ab --- /dev/null +++ b/Source/WebCore/platform/efl/SharedBufferEfl.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2008 Holger Hans Peter Freyther + * 2008 Kenneth Rohde Christiansen + * 2009-2010 ProFUSION embedded systems + * 2009-2010 Samsung Electronics + * + * 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 "SharedBuffer.h" + +#include <wtf/text/CString.h> +#include <stdio.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +namespace WebCore { + +PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& filePath) +{ + FILE* file; + struct stat fileStat; + RefPtr<SharedBuffer> result; + + if (filePath.isEmpty()) + return 0; + + if (!(file = fopen(filePath.utf8().data(), "rb"))) + return 0; + + if (fstat(fileno(file), &fileStat)) { + fclose(file); + return 0; + } + + result = SharedBuffer::create(); + result->m_buffer.resize(fileStat.st_size); + if (result->m_buffer.size() != static_cast<unsigned>(fileStat.st_size)) { + fclose(file); + return 0; + } + + fread(result->m_buffer.data(), 1, fileStat.st_size, file); + fclose(file); + + return result.release(); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/efl/SharedTimerEfl.cpp b/Source/WebCore/platform/efl/SharedTimerEfl.cpp new file mode 100644 index 0000000..2534c60 --- /dev/null +++ b/Source/WebCore/platform/efl/SharedTimerEfl.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2008 Kenneth Rohde Christiansen + * (C) 2008 Afonso Rabelo Costa Jr. + * (C) 2009-2010 ProFUSION embedded systems + * (C) 2009-2010 Samsung Electronics + * + * 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 "SharedTimer.h" + +#include <Ecore.h> +#include <wtf/Assertions.h> +#include <wtf/CurrentTime.h> +#include <wtf/MainThread.h> + +namespace WebCore { + +static Ecore_Timer *_sharedTimer = 0; + +static void (*_timerFunction)(); + +void setSharedTimerFiredFunction(void (*func)()) +{ + _timerFunction = func; +} + +static Eina_Bool timerEvent(void*) +{ + if (_timerFunction) + _timerFunction(); + + _sharedTimer = 0; + + return ECORE_CALLBACK_CANCEL; +} + +void stopSharedTimer() +{ + if (_sharedTimer) { + ecore_timer_del(_sharedTimer); + _sharedTimer = 0; + } +} + +void addNewTimer(double fireTime) +{ + double interval = fireTime - currentTime(); + stopSharedTimer(); + + _sharedTimer = ecore_timer_loop_add(interval, timerEvent, 0); +} + +void setSharedTimerFireTime(double fireTime) +{ + addNewTimer(fireTime); +} + +} + diff --git a/Source/WebCore/platform/efl/SoundEfl.cpp b/Source/WebCore/platform/efl/SoundEfl.cpp new file mode 100644 index 0000000..091de7a --- /dev/null +++ b/Source/WebCore/platform/efl/SoundEfl.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Sound.h" + +#include "NotImplemented.h" + +#ifdef HAVE_ECORE_X +#include <Ecore_X.h> +#endif + +namespace WebCore { + +void systemBeep() +{ +#ifdef HAVE_ECORE_X + ecore_x_bell(0); +#endif +} + +} diff --git a/Source/WebCore/platform/efl/SystemTimeEfl.cpp b/Source/WebCore/platform/efl/SystemTimeEfl.cpp new file mode 100644 index 0000000..de8c87c --- /dev/null +++ b/Source/WebCore/platform/efl/SystemTimeEfl.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2008 INdT. All rights reserved. + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SystemTime.h" + +#include <Ecore.h> + +namespace WebCore { + +double currentTime() +{ + return ecore_time_get(); +} + +} diff --git a/Source/WebCore/platform/efl/TemporaryLinkStubs.cpp b/Source/WebCore/platform/efl/TemporaryLinkStubs.cpp new file mode 100644 index 0000000..ef6e6f7 --- /dev/null +++ b/Source/WebCore/platform/efl/TemporaryLinkStubs.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * 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 "AXObjectCache.h" +#include "CookieStorage.h" +#include "Editor.h" +#include "FTPDirectoryDocument.h" +#include "FrameView.h" +#include "KURL.h" +#include "NotImplemented.h" +#include "PluginView.h" +#include "ScrollbarTheme.h" +#include "SharedBuffer.h" + +#include <float.h> + +using namespace WebCore; + +namespace WebCore { + +void getSupportedKeySizes(Vector<String>&) +{ + notImplemented(); +} + +String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) +{ + return String(); +} + +float userIdleTime() +{ + notImplemented(); + return FLT_MAX; +} + +void setCookieStoragePrivateBrowsingEnabled(bool) +{ + notImplemented(); +} + +} + diff --git a/Source/WebCore/platform/efl/WidgetEfl.cpp b/Source/WebCore/platform/efl/WidgetEfl.cpp new file mode 100644 index 0000000..640e6e3 --- /dev/null +++ b/Source/WebCore/platform/efl/WidgetEfl.cpp @@ -0,0 +1,368 @@ +/* + * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com + * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2008 Kenneth Rohde Christiansen + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Widget.h" + +#include "ChromeClient.h" +#include "Cursor.h" +#include "Frame.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "IntRect.h" +#include "NotImplemented.h" +#include "Page.h" + +#include <Ecore.h> +#include <Ecore_Evas.h> +#include <Edje.h> +#include <Evas.h> + +#ifdef HAVE_ECORE_X +#include <Ecore_X.h> +#include <Ecore_X_Cursor.h> +#endif + +#include <wtf/HashMap.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +#ifdef HAVE_ECORE_X +class CursorMap { +private: + HashMap<String, unsigned short> m_cursorStringMap; + +public: + CursorMap(); + unsigned int cursor(String); +}; + +unsigned int CursorMap::cursor(String cursorGroup) +{ + int ret = m_cursorStringMap.get(cursorGroup); + + if (ret < ECORE_X_CURSOR_X || ret > ECORE_X_CURSOR_XTERM) + ret = ECORE_X_CURSOR_LEFT_PTR; + + return ret; +} + +CursorMap::CursorMap() +{ + m_cursorStringMap.set("cursor/pointer", ECORE_X_CURSOR_LEFT_PTR); + m_cursorStringMap.set("cursor/move", ECORE_X_CURSOR_FLEUR); + m_cursorStringMap.set("cursor/cross", ECORE_X_CURSOR_CROSS); + m_cursorStringMap.set("cursor/hand", ECORE_X_CURSOR_HAND2); + m_cursorStringMap.set("cursor/i_beam", ECORE_X_CURSOR_XTERM); + m_cursorStringMap.set("cursor/wait", ECORE_X_CURSOR_WATCH); + m_cursorStringMap.set("cursor/help", ECORE_X_CURSOR_QUESTION_ARROW); + m_cursorStringMap.set("cursor/east_resize", ECORE_X_CURSOR_RIGHT_SIDE); + m_cursorStringMap.set("cursor/north_resize", ECORE_X_CURSOR_TOP_SIDE); + m_cursorStringMap.set("cursor/north_east_resize", ECORE_X_CURSOR_TOP_RIGHT_CORNER); + m_cursorStringMap.set("cursor/north_west_resize", ECORE_X_CURSOR_TOP_LEFT_CORNER); + m_cursorStringMap.set("cursor/south_resize", ECORE_X_CURSOR_BOTTOM_SIDE); + m_cursorStringMap.set("cursor/south_east_resize", ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER); + m_cursorStringMap.set("cursor/south_west_resize", ECORE_X_CURSOR_BOTTOM_LEFT_CORNER); + m_cursorStringMap.set("cursor/west_resize", ECORE_X_CURSOR_LEFT_SIDE); + m_cursorStringMap.set("cursor/north_south_resize", ECORE_X_CURSOR_SB_H_DOUBLE_ARROW); + m_cursorStringMap.set("cursor/east_west_resize", ECORE_X_CURSOR_SB_V_DOUBLE_ARROW); + m_cursorStringMap.set("cursor/north_east_south_west_resize", ECORE_X_CURSOR_SIZING); + m_cursorStringMap.set("cursor/north_west_south_east_resize", ECORE_X_CURSOR_SIZING); + m_cursorStringMap.set("cursor/column_resize", ECORE_X_CURSOR_SB_V_DOUBLE_ARROW); + m_cursorStringMap.set("cursor/row_resize", ECORE_X_CURSOR_SB_H_DOUBLE_ARROW); + m_cursorStringMap.set("cursor/middle_panning", ECORE_X_CURSOR_CROSS_REVERSE); + m_cursorStringMap.set("cursor/east_panning", ECORE_X_CURSOR_CROSS_REVERSE); + m_cursorStringMap.set("cursor/north_panning", ECORE_X_CURSOR_CROSS_REVERSE); + m_cursorStringMap.set("cursor/north_east_panning", ECORE_X_CURSOR_CROSS_REVERSE); + m_cursorStringMap.set("cursor/north_west_panning", ECORE_X_CURSOR_CROSS_REVERSE); + m_cursorStringMap.set("cursor/south_panning", ECORE_X_CURSOR_CROSS_REVERSE); + m_cursorStringMap.set("cursor/south_east_panning", ECORE_X_CURSOR_CROSS_REVERSE); + m_cursorStringMap.set("cursor/south_west_panning", ECORE_X_CURSOR_CROSS_REVERSE); + m_cursorStringMap.set("cursor/west_panning", ECORE_X_CURSOR_CROSS_REVERSE); + m_cursorStringMap.set("cursor/vertical_text", ECORE_X_CURSOR_SB_DOWN_ARROW); + m_cursorStringMap.set("cursor/cell", ECORE_X_CURSOR_ICON); + m_cursorStringMap.set("cursor/context_menu", ECORE_X_CURSOR_HAND2); + m_cursorStringMap.set("cursor/no_drop", ECORE_X_CURSOR_DOT_BOX_MASK); + m_cursorStringMap.set("cursor/copy", ECORE_X_CURSOR_ICON); + m_cursorStringMap.set("cursor/progress", ECORE_X_CURSOR_WATCH); + m_cursorStringMap.set("cursor/alias", ECORE_X_CURSOR_MAN); + m_cursorStringMap.set("cursor/none", ECORE_X_CURSOR_X); + m_cursorStringMap.set("cursor/not_allowed", ECORE_X_CURSOR_X); + m_cursorStringMap.set("cursor/zoom_in", ECORE_X_CURSOR_DIAMOND_CROSS); + m_cursorStringMap.set("cursor/zoom_out", ECORE_X_CURSOR_DIAMOND_CROSS); + m_cursorStringMap.set("cursor/grab", ECORE_X_CURSOR_HAND2); + m_cursorStringMap.set("cursor/grabbing", ECORE_X_CURSOR_HAND2); +} + +static CursorMap cursorStringMap = CursorMap(); +#endif + +class WidgetPrivate { +public: + Evas* m_evas; + Evas_Object* m_evasObject; + String m_theme; + + WidgetPrivate() + : m_evas(0) + , m_evasObject(0) + , m_cursorObject(0) +#ifdef HAVE_ECORE_X + , m_isUsingEcoreX(false) +#endif + {} + + /* cursor */ + String m_cursorGroup; + Evas_Object* m_cursorObject; + +#ifdef HAVE_ECORE_X + bool m_isUsingEcoreX; +#endif +}; + +Widget::Widget(PlatformWidget widget) + : m_parent(0) + , m_widget(0) + , m_selfVisible(false) + , m_parentVisible(false) + , m_frame(0, 0, 0, 0) + , m_data(new WidgetPrivate) +{ + init(widget); +} + +Widget::~Widget() +{ + ASSERT(!parent()); + + if (m_data->m_cursorObject) + evas_object_del(m_data->m_cursorObject); + + delete m_data; +} + +IntRect Widget::frameRect() const +{ + return m_frame; +} + +void Widget::setFrameRect(const IntRect& rect) +{ + m_frame = rect; + Widget::frameRectsChanged(); +} + +void Widget::frameRectsChanged() +{ + Evas_Object* o = evasObject(); + Evas_Coord x, y; + + if (!parent() || !o) + return; + + IntRect rect = frameRect(); + if (parent()->isScrollViewScrollbar(this)) + rect.setLocation(parent()->convertToContainingWindow(rect.location())); + else + rect.setLocation(parent()->contentsToWindow(rect.location())); + + evas_object_geometry_get(root()->evasObject(), &x, &y, 0, 0); + evas_object_move(o, x + rect.x(), y + rect.y()); + evas_object_resize(o, rect.width(), rect.height()); +} + +void Widget::setFocus(bool focused) +{ +} + +void Widget::applyFallbackCursor() +{ +#ifdef HAVE_ECORE_X + if (m_data->m_isUsingEcoreX && !m_data->m_cursorGroup.isNull()) { + int shape = cursorStringMap.cursor(m_data->m_cursorGroup.utf8().data()); + + if (shape < ECORE_X_CURSOR_X || shape > ECORE_X_CURSOR_XTERM) { + LOG_ERROR("cannot map an equivalent X cursor for" + " c ursor group %s", m_data->m_cursorGroup.utf8().data()); + shape = ECORE_X_CURSOR_LEFT_PTR; + } + + Ecore_X_Window win = ecore_evas_software_x11_window_get(ecoreEvas()); + Ecore_X_Cursor cur = ecore_x_cursor_shape_get(shape); + ecore_x_window_cursor_set(win, cur); + return; + } +#endif + LOG_ERROR("Ooops, no fallback to set cursor %s!\n", + m_data->m_cursorGroup.utf8().data()); +} + +void Widget::applyCursor() +{ + CString file = edjeThemeRecursive().utf8(); + + m_data->m_cursorObject = edje_object_add(evas()); + if (!file.isNull() && !edje_object_file_set(m_data->m_cursorObject, file.data(), m_data->m_cursorGroup.utf8().data())) { + evas_object_del(m_data->m_cursorObject); + m_data->m_cursorObject = 0; + ecore_evas_object_cursor_set(ecoreEvas(), 0, 0, 0, 0); + applyFallbackCursor(); + } else { + Evas_Coord x, y, w, h; + const char *d; + + edje_object_size_min_get(m_data->m_cursorObject, &w, &h); + if ((w <= 0) || (h <= 0)) + edje_object_size_min_calc(m_data->m_cursorObject, &w, &h); + if ((w <= 0) || (h <= 0)) + w = h = 16; + evas_object_resize(m_data->m_cursorObject, w, h); + + d = edje_object_data_get(m_data->m_cursorObject, "hot.x"); + x = d ? atoi(d) : 0; + + d = edje_object_data_get(m_data->m_cursorObject, "hot.y"); + y = d ? atoi(d) : 0; + + ecore_evas_object_cursor_set(ecoreEvas(), m_data->m_cursorObject, + EVAS_LAYER_MAX, x, y); + } +} + +void Widget::setCursor(const Cursor& cursor) +{ + if (!evas()) + return; + + const char *group = cursor.impl(); + if (!group || String(group) == m_data->m_cursorGroup) + return; + + m_data->m_cursorGroup = group; + + applyCursor(); +} + +void Widget::show() +{ + if (!platformWidget()) + return; + + evas_object_show(platformWidget()); +} + +void Widget::hide() +{ + if (!platformWidget()) + return; + + evas_object_hide(platformWidget()); +} + +void Widget::paint(GraphicsContext* context, const IntRect&) +{ + notImplemented(); +} + +void Widget::setIsSelected(bool) +{ + notImplemented(); +} + +const String Widget::edjeTheme() const +{ + return m_data->m_theme; +} + +void Widget::setEdjeTheme(const String& themePath) +{ + if (m_data->m_theme == themePath) + return; + + m_data->m_theme = themePath; +} + +const String Widget::edjeThemeRecursive() const +{ + if (!m_data->m_theme.isNull()) + return m_data->m_theme; + if (m_parent) + return m_parent->edjeThemeRecursive(); + + return String(); +} + +Evas* Widget::evas() const +{ + return m_data->m_evas; +} + +Ecore_Evas* Widget::ecoreEvas() const +{ + // FIXME EFL: XXX assume evas was created by ecore_evas + return static_cast<Ecore_Evas*>(evas_data_attach_get(evas())); +} + +void Widget::setEvasObject(Evas_Object *o) +{ + // FIXME: study platformWidget() and use it + // FIXME: right now platformWidget() requires implementing too much + if (m_data->m_evasObject == o) + return; + m_data->m_evasObject = o; + if (!o) { + m_data->m_evas = 0; +#ifdef HAVE_ECORE_X + m_data->m_isUsingEcoreX = false; +#endif + return; + } + + m_data->m_evas = evas_object_evas_get(o); + +#ifdef HAVE_ECORE_X + const char *engine = ecore_evas_engine_name_get(ecoreEvas()); + m_data->m_isUsingEcoreX = (!strcmp(engine, "software_x11") + || !strcmp(engine, "software_xcb") + || !strcmp(engine, "software_16_x11") + || !strncmp(engine, "xrender", sizeof("xrender") - 1)); +#endif + + Widget::frameRectsChanged(); +} + +Evas_Object* Widget::evasObject() const +{ + return m_data->m_evasObject; +} + +} |