[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 02:02:49 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 796fc590c70f8166dae4fe80bee3bdfff87e2d98
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Feb 27 03:53:24 2010 +0000

    2010-02-26  Leandro Pereira  <leandro at profusion.mobi>
    
            Reviewed by NOBODY.
    
            Add EFL port files to platform/efl.
            http://webkit.org/b/35087
    
            * WebCore/platform/efl/PlatformWheelEventEfl.cpp: Added.
            * WebCore/platform/efl/FileChooserEfl.cpp: Added.
            * WebCore/platform/efl/ContextMenuEfl.cpp: Added.
            * WebCore/platform/efl/PlatformScreenEfl.cpp: Added.
            * WebCore/platform/efl/WidgetEfl.cpp: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55338 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e58173c..2898e1a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-02-26  Leandro Pereira  <leandro at profusion.mobi>
+
+        Reviewed by NOBODY.
+
+        Add EFL port files to platform/efl.
+        http://webkit.org/b/35087
+
+        * WebCore/platform/efl/PlatformWheelEventEfl.cpp: Added.
+        * WebCore/platform/efl/FileChooserEfl.cpp: Added.
+        * WebCore/platform/efl/ContextMenuEfl.cpp: Added.
+        * WebCore/platform/efl/PlatformScreenEfl.cpp: Added.
+        * WebCore/platform/efl/WidgetEfl.cpp: Added.
+
 2010-02-26  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebCore/platform/efl/ContextMenuEfl.cpp b/WebCore/platform/efl/ContextMenuEfl.cpp
new file mode 100644
index 0000000..240f106
--- /dev/null
+++ b/WebCore/platform/efl/ContextMenuEfl.cpp
@@ -0,0 +1,62 @@
+/*
+ *  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(const HitTestResult& result)
+    : m_hitTestResult(result)
+    , m_platformDescription(0)
+{
+    notImplemented();
+}
+
+ContextMenu::~ContextMenu()
+{
+    notImplemented();
+}
+
+void ContextMenu::appendItem(ContextMenuItem&)
+{
+    notImplemented();
+}
+
+void ContextMenu::setPlatformDescription(PlatformMenuDescription menu)
+{
+    m_platformDescription = menu;
+}
+
+PlatformMenuDescription ContextMenu::platformDescription() const
+{
+    return m_platformDescription;
+}
+
+PlatformMenuDescription ContextMenu::releasePlatformDescription()
+{
+    notImplemented();
+    return 0;
+}
+
+}
diff --git a/WebCore/platform/efl/FileChooserEfl.cpp b/WebCore/platform/efl/FileChooserEfl.cpp
new file mode 100644
index 0000000..866caae
--- /dev/null
+++ b/WebCore/platform/efl/FileChooserEfl.cpp
@@ -0,0 +1,46 @@
+/*
+ * 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"
+
+namespace WebCore {
+
+String FileChooser::basenameForWidth(const Font& font, int width) const
+{
+    if (width <= 0)
+        return String();
+
+    if (m_filenames.isEmpty())
+        return fileButtonNoFileSelectedLabel();
+}
+
+}
diff --git a/WebCore/platform/efl/PlatformScreenEfl.cpp b/WebCore/platform/efl/PlatformScreenEfl.cpp
new file mode 100644
index 0000000..23e8705
--- /dev/null
+++ b/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 "CString.h"
+#include "NotImplemented.h"
+#include "PlatformString.h"
+#include "Widget.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/WebCore/platform/efl/PlatformWheelEventEfl.cpp b/WebCore/platform/efl/PlatformWheelEventEfl.cpp
new file mode 100644
index 0000000..406844d
--- /dev/null
+++ b/WebCore/platform/efl/PlatformWheelEventEfl.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ *           (C) 2006 Michael Emmel mike.emmel at 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"
+
+namespace WebCore {
+
+enum {
+    VerticalScrollDirection = 0,
+    HorizontalScrollDirection = 1
+};
+
+PlatformWheelEvent::PlatformWheelEvent(const Evas_Event_Mouse_Wheel* ev)
+    : 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"))
+    , m_globalPosition(IntPoint(ev->canvas.x, ev->canvas.y))
+    , m_position(IntPoint(ev->canvas.x, ev->canvas.y))
+{
+    // 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/WebCore/platform/efl/WidgetEfl.cpp b/WebCore/platform/efl/WidgetEfl.cpp
new file mode 100644
index 0000000..b3bc4a2
--- /dev/null
+++ b/WebCore/platform/efl/WidgetEfl.cpp
@@ -0,0 +1,371 @@
+/*
+ * Copyright (C) 2006 Michael Emmel mike.emmel at 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 "CString.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 <Edje.h>
+#include <Evas.h>
+
+#ifdef HAVE_ECORE_X
+#include <Ecore_X.h>
+#include <Ecore_X_Cursor.h>
+#endif
+
+#include <wtf/HashMap.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()
+{
+}
+
+void Widget::applyFallbackCursor()
+{
+#if 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) {
+            fprintf(stderr, "ERROR: cannot map an equivalent X cursor for"
+                    " cursor 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;
+    }
+#else
+    fprintf(stderr, "ERROR: Ooops, no fallback to set cursor %s!\n",
+            m_data->m_cursorGroup.utf8().data());
+#endif
+}
+
+void Widget::applyCursor()
+{
+    const char *file;
+    Evas_Coord x, y;
+
+    String theme = edjeThemeRecursive();
+    if (!theme.isNull())
+        file = edjeThemeRecursive().utf8().data();
+
+    m_data->m_cursorObject = edje_object_add(evas());
+    if (!edje_object_file_set(m_data->m_cursorObject, file, 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 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 (!platformWidget() || !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;
+        m_data->m_isUsingEcoreX = false;
+        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;
+}
+
+}

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list