Fixed when user tap on linkable contents, somtimes focus ring is not shown.
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / tizen / FocusRing.h
1 /*
2  * Copyright (C) 2012 Samsung Electronics
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef FocusRing_h
21 #define FocusRing_h
22
23 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
24
25 #include <Ecore.h>
26 #include <Evas.h>
27 #include <WebCore/IntPoint.h>
28 #include <WebCore/IntRect.h>
29 #include <wtf/PassOwnPtr.h>
30
31 class EwkViewImpl;
32
33 class FocusRing {
34 public:
35     static PassOwnPtr<FocusRing> create(EwkViewImpl* viewImpl)
36     {
37         return adoptPtr(new FocusRing(viewImpl));
38     }
39     ~FocusRing();
40
41     void setImage(const String&, int, int);
42
43     void requestToShow(const WebCore::IntPoint&);
44     void requestToHide(bool immediately = false);
45
46     void show(const WebCore::IntRect&, const bool includeOnlyImage = false);
47     void hide(bool = true);
48
49     void updateScrollAndScale(const WebCore::IntPoint&, float);
50
51     const WebCore::IntRect& rect() { return m_rect; }
52     WebCore::IntPoint centerPointInScreen();
53
54 private:
55     static const int s_showTimerTime = 100;
56     static Eina_Bool showTimerCallback(void* data);
57
58     static const int s_hideTimerTime = 200;
59     static Eina_Bool hideTimerCallback(void* data);
60
61 private:
62     FocusRing(EwkViewImpl* viewImpl);
63     void internalShow(bool, const WebCore::IntRect&);
64
65     EwkViewImpl* m_viewImpl;
66
67     Evas_Object* m_focusRingObject;
68
69     String m_imagePath;
70     int m_imageOuterWidth;
71     int m_imageInnerWidth;
72
73     Ecore_Timer* m_showTimer;
74     Ecore_Timer* m_hideTimer;
75     WebCore::IntPoint m_position;
76
77     WebCore::IntRect m_rect;
78 };
79
80 #endif // #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
81
82 #endif // FocusRing_h