summaryrefslogtreecommitdiffstats
path: root/WebKit/efl/ewk/ewk_view_single.c
blob: 803b219c31c340f885c4b2e838ce05eebfdd5582 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
/*
    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 "ewk_view.h"

#include "ewk_frame.h"
#include "ewk_logging.h"

#include <Evas.h>
#include <eina_safety_checks.h>
#include <string.h>

static Ewk_View_Smart_Class _parent_sc = EWK_VIEW_SMART_CLASS_INIT_NULL;

static void _ewk_view_single_on_del(void *data, Evas *e, Evas_Object *o, void *event_info)
{
    Evas_Object *clip = (Evas_Object*)data;
    evas_object_del(clip);
}

static void _ewk_view_single_smart_add(Evas_Object *o)
{
    Ewk_View_Smart_Data *sd;

    _parent_sc.sc.add(o);

    sd = (Ewk_View_Smart_Data *)evas_object_smart_data_get(o);

    Evas_Object *clip = evas_object_rectangle_add(sd->base.evas);
    evas_object_clip_set(sd->backing_store, clip);
    evas_object_smart_member_add(clip, o);
    evas_object_show(clip);

    evas_object_event_callback_add
        (sd->backing_store, EVAS_CALLBACK_DEL, _ewk_view_single_on_del, clip);
}

static Evas_Object *_ewk_view_single_smart_backing_store_add(Ewk_View_Smart_Data *sd)
{
    Evas_Object *bs = evas_object_image_add(sd->base.evas);
    evas_object_image_alpha_set(bs, EINA_FALSE);
    evas_object_image_smooth_scale_set(bs, sd->zoom_weak_smooth_scale);

    return bs;
}

static void _ewk_view_single_smart_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h)
{
    Ewk_View_Smart_Data *sd = (Ewk_View_Smart_Data*)evas_object_smart_data_get(o);
    _parent_sc.sc.resize(o, w, h);

    // these should be queued and processed in calculate as well!
    evas_object_image_size_set(sd->backing_store, w, h);
    if (sd->animated_zoom.zoom.current < 0.00001) {
        Evas_Object *clip = evas_object_clip_get(sd->backing_store);
        Evas_Coord x, y, cw, ch;
        evas_object_image_fill_set(sd->backing_store, 0, 0, w, h);
        evas_object_geometry_get(sd->backing_store, &x, &y, 0, 0);
        evas_object_move(clip, x, y);
        ewk_frame_contents_size_get(sd->main_frame, &cw, &ch);
        if (w > cw)
            w = cw;
        if (h > ch)
            h = ch;
        evas_object_resize(clip, w, h);
    }
}

static inline void _ewk_view_4b_move_region_up(uint32_t *image, size_t rows, size_t x, size_t y, size_t w, size_t h, size_t rowsize)
{
    uint32_t *src;
    uint32_t *dst;

    dst = image + x + y * rowsize;
    src = dst + rows * rowsize;
    h -= rows;

    for (; h > 0; h--, dst += rowsize, src += rowsize)
        memcpy(dst, src, w * 4);
}

static inline void _ewk_view_4b_move_region_down(uint32_t *image, size_t rows, size_t x, size_t y, size_t w, size_t h, size_t rowsize)
{
    uint32_t *src;
    uint32_t *dst;

    h -= rows;
    src = image + x + (y + h - 1) * rowsize;
    dst = src + rows * rowsize;

    for (; h > 0; h--, dst -= rowsize, src -= rowsize)
        memcpy(dst, src, w * 4);
}

static inline void _ewk_view_4b_move_line_left(uint32_t *dst, const uint32_t *src, size_t count)
{
    uint32_t *dst_end = dst + count;
    /* no memcpy() as it does not allow overlapping regions */
    /* no memmove() as it will copy to a temporary buffer */
    /* TODO: loop unrolling, copying up to quad-words would help */
    for (; dst < dst_end; dst++, src++)
        *dst = *src;
}

static inline void _ewk_view_4b_move_line_right(uint32_t *dst, uint32_t *src, size_t count)
{
    uint32_t *dst_end = dst - count;
    /* no memcpy() as it does not allow overlapping regions */
    /* no memmove() as it will copy to a temporary buffer */
    /* TODO: loop unrolling, copying up to quad-words would help */
    for (; dst > dst_end; dst--, src--)
        *dst = *src;
}

static inline void _ewk_view_4b_move_region_left(uint32_t *image, size_t cols, size_t x, size_t y, size_t w, size_t h, size_t rowsize)
{
    uint32_t *src;
    uint32_t *dst;

    dst = image + x + y * rowsize;
    src = dst + cols;
    w -= cols;

    for (; h > 0; h--, dst += rowsize, src += rowsize)
        _ewk_view_4b_move_line_left(dst, src, w);
}

static inline void _ewk_view_4b_move_region_right(uint32_t *image, size_t cols, size_t x, size_t y, size_t w, size_t h, size_t rowsize)
{
    uint32_t *src;
    uint32_t *dst;

    w -= cols;
    src = image + (x + w - 1) + y * rowsize;
    dst = src + cols;

    for (; h > 0; h--, dst += rowsize, src += rowsize)
        _ewk_view_4b_move_line_right(dst, src, w);
}

/* catch-all function, not as optimized as the others, but does the work. */
static inline void _ewk_view_4b_move_region(uint32_t *image, int dx, int dy, size_t x, size_t y, size_t w, size_t h, size_t rowsize)
{
    uint32_t *src;
    uint32_t *dst;

    if (dy < 0) {
        h += dy;
        dst = image + x + y * rowsize;
        src = dst - dy * rowsize;
        if (dx <= 0) {
            w += dx;
            src -= dx;
            for (; h > 0; h--, dst += rowsize, src += rowsize)
                _ewk_view_4b_move_line_left(dst, src, w);
        } else {
            w -= dx;
            src += w - 1;
            dst += w + dx -1;
            for (; h > 0; h--, dst += rowsize, src += rowsize)
                _ewk_view_4b_move_line_right(dst, src, w);
        }
    } else {
        h -= dy;
        src = image + x + (y + h - 1) * rowsize;
        dst = src + dy * rowsize;
        if (dx <= 0) {
            w += dx;
            src -= dx;
            for (; h > 0; h--, dst -= rowsize, src -= rowsize)
                _ewk_view_4b_move_line_left(dst, src, w);
        } else {
            w -= dx;
            src += w - 1;
            dst += w + dx - 1;
            for (; h > 0; h--, dst -= rowsize, src -= rowsize)
                _ewk_view_4b_move_line_right(dst, src, w);
        }
    }
}

static inline void _ewk_view_single_scroll_process_single(Ewk_View_Smart_Data *sd, void *pixels, Evas_Coord ow, Evas_Coord oh, const Ewk_Scroll_Request *sr)
{
    Evas_Coord sx, sy, sw, sh;

    DBG("%d,%d + %d,%d %+03d,%+03d, store: %p %dx%d",
        sr->x, sr->y, sr->w, sr->h, sr->dx, sr->dy, pixels, ow, oh);

    sx = sr->x;
    sy = sr->y;
    sw = sr->w;
    sh = sr->h;

    if (abs(sr->dx) >= sw || abs(sr->dy) >= sh) {
        /* doubt webkit would be so stupid... */
        DBG("full page scroll %+03d,%+03d. convert to repaint %d,%d + %dx%d",
            sr->dx, sr->dy, sx, sy, sw, sh);
        ewk_view_repaint_add(sd->_priv, sx, sy, sw, sh);
        return;
    }

    if (sx < 0) {
        sw += sx;
        sx = 0;
    }
    if (sy < 0) {
        sh += sy;
        sy = 0;
    }

    if (sx + sw > ow)
        sw = ow - sx;
    if (sy + sh > oh)
        sh = oh - sy;

    if (sw < 0)
        sw = 0;
    if (sh < 0)
        sh = 0;

    EINA_SAFETY_ON_TRUE_RETURN(!sw || !sh);
    if (!sr->dx) {
        if (sr->dy < 0) {
            DBG("scroll up: %+03d,%+03d update=%d,%d+%dx%d, "
                "repaint=%d,%d+%dx%d",
                sr->dx, sr->dy, sx, sy, sw, sh + sr->dy,
                sx, sy + sh + sr->dy, sw, -sr->dy);

            _ewk_view_4b_move_region_up
                ((uint32_t*)pixels, -sr->dy, sx, sy, sw, sh, ow);
            evas_object_image_data_update_add
                (sd->backing_store, sx, sy, sw, sh + sr->dy);

            ewk_view_repaint_add(sd->_priv, sx, sy + sh + sr->dy, sw, -sr->dy);
        } else if (sr->dy > 0) {
            DBG("scroll down: %+03d,%+03d update=%d,%d+%dx%d, "
                "repaint=%d,%d+%dx%d",
                sr->dx, sr->dy, sx, sy + sr->dy, sw, sh - sr->dy,
                sx, sy, sw, sr->dy);

            _ewk_view_4b_move_region_down
                ((uint32_t*)pixels, sr->dy, sx, sy, sw, sh, ow);
            evas_object_image_data_update_add
                (sd->backing_store, sx, sy + sr->dy, sw, sh - sr->dy);

            ewk_view_repaint_add(sd->_priv, sx, sy, sw, sr->dy);
        }
    } else if (!sr->dy) {
        if (sr->dx < 0) {
            DBG("scroll left: %+03d,%+03d update=%d,%d+%dx%d, "
                "repaint=%d,%d+%dx%d",
                sr->dx, sr->dy, sx, sy, sw + sr->dx, sh,
                sx + sw + sr->dx, sy, -sr->dx, sh);

            _ewk_view_4b_move_region_left
                ((uint32_t*)pixels, -sr->dx, sx, sy, sw, sh, ow);
            evas_object_image_data_update_add
                (sd->backing_store, sx, sy, sw + sr->dx, sh);

            ewk_view_repaint_add(sd->_priv, sx + sw + sr->dx, sy, -sr->dx, sh);
        } else if (sr->dx > 0) {
            DBG("scroll up: %+03d,%+03d update=%d,%d+%dx%d, "
                "repaint=%d,%d+%dx%d",
                sr->dx, sr->dy, sx + sr->dx, sy, sw - sr->dx, sh,
                sx, sy, sr->dx, sh);

            _ewk_view_4b_move_region_right
                ((uint32_t*)pixels, sr->dx, sx, sy, sw, sh, ow);
            evas_object_image_data_update_add
                (sd->backing_store, sx + sr->dx, sy, sw - sr->dx, sh);

            ewk_view_repaint_add(sd->_priv, sx, sy, sr->dx, sh);
        }
    } else {
        Evas_Coord mx, my, mw, mh, ax, ay, aw, ah, bx, by, bw, bh;

        if (sr->dx < 0) {
            mx = sx;
            mw = sw + sr->dx;
            ax = mx + mw;
            aw = -sr->dx;
        } else {
            ax = sx;
            aw = sr->dx;
            mx = ax + aw;
            mw = sw - sr->dx;
        }

        if (sr->dy < 0) {
            my = sy;
            mh = sh + sr->dy;
            by = my + mh;
            bh = -sr->dy;
        } else {
            by = sy;
            bh = sr->dy;
            my = by + bh;
            mh = sh - sr->dy;
        }

        ay = my;
        ah = mh;
        bx = sx;
        bw = sw;

        DBG("scroll diagonal: %+03d,%+03d update=%d,%d+%dx%d, "
            "repaints: h=%d,%d+%dx%d v=%d,%d+%dx%d",
            sr->dx, sr->dy, mx, my, mw, mh, ax, ay, aw, ah, bx, by, bw, bh);

        _ewk_view_4b_move_region
            ((uint32_t*)pixels, sr->dx, sr->dy, sx, sy, sw, sh, ow);

        evas_object_image_data_update_add(sd->backing_store, mx, my, mw, mh);
        ewk_view_repaint_add(sd->_priv, ax, ay, aw, ah);
        ewk_view_repaint_add(sd->_priv, bx, by, bw, bh);
    }
}

static Eina_Bool _ewk_view_single_smart_scrolls_process(Ewk_View_Smart_Data *sd)
{
    const Ewk_Scroll_Request *sr;
    const Ewk_Scroll_Request *sr_end;
    Evas_Coord ow, oh;
    size_t count;
    void *pixels = evas_object_image_data_get(sd->backing_store, 1);
    evas_object_image_size_get(sd->backing_store, &ow, &oh);

    sr = ewk_view_scroll_requests_get(sd->_priv, &count);
    sr_end = sr + count;
    for (; sr < sr_end; sr++)
        _ewk_view_single_scroll_process_single(sd, pixels, ow, oh, sr);

    return EINA_TRUE;
}

static Eina_Bool _ewk_view_single_smart_repaints_process(Ewk_View_Smart_Data *sd)
{
    Ewk_View_Paint_Context *ctxt;
    Evas_Coord ow, oh;
    void *pixels;
    Eina_Rectangle r = {0, 0, 0, 0};
    const Eina_Rectangle *pr;
    const Eina_Rectangle *pr_end;
    Eina_Tiler *tiler;
    Eina_Iterator *itr;
    cairo_status_t status;
    cairo_surface_t *surface;
    cairo_format_t format;
    cairo_t *cairo;
    size_t count;
    Eina_Bool ret = EINA_TRUE;

    if (sd->animated_zoom.zoom.current < 0.00001) {
        Evas_Object *clip = evas_object_clip_get(sd->backing_store);
        Evas_Coord w, h, cw, ch;
        // reset effects of zoom_weak_set()
        evas_object_image_fill_set
            (sd->backing_store, 0, 0, sd->view.w, sd->view.h);
        evas_object_move(clip, sd->view.x, sd->view.y);

        w = sd->view.w;
        h = sd->view.h;

        ewk_frame_contents_size_get(sd->main_frame, &cw, &ch);
        if (w > cw)
            w = cw;
        if (h > ch)
            h = ch;
        evas_object_resize(clip, w, h);
    }

    pixels = evas_object_image_data_get(sd->backing_store, 1);
    evas_object_image_size_get(sd->backing_store, &ow, &oh);

    if (sd->bg_color.a < 255)
        format = CAIRO_FORMAT_ARGB32;
    else
        format = CAIRO_FORMAT_RGB24;

    surface = cairo_image_surface_create_for_data
        ((unsigned char*)pixels, format, ow, oh, ow * 4);
    status = cairo_surface_status(surface);
    if (status != CAIRO_STATUS_SUCCESS) {
        ERR("could not create surface from data %dx%d: %s",
            ow, oh, cairo_status_to_string(status));
        ret = EINA_FALSE;
        goto error_cairo_surface;
    }
    cairo = cairo_create(surface);
    status = cairo_status(cairo);
    if (status != CAIRO_STATUS_SUCCESS) {
        ERR("could not create cairo from surface %dx%d: %s",
            ow, oh, cairo_status_to_string(status));
        ret = EINA_FALSE;
        goto error_cairo;
    }

    ctxt = ewk_view_paint_context_new(sd->_priv, cairo);
    if (!ctxt) {
        ERR("could not create paint context");
        ret = EINA_FALSE;
        goto error_paint_context;
    }

    tiler = eina_tiler_new(ow, oh);
    if (!tiler) {
        ERR("could not create tiler %dx%d", ow, oh);
        ret = EINA_FALSE;
        goto error_tiler;
    }

    pr = ewk_view_repaints_get(sd->_priv, &count);
    pr_end = pr + count;
    for (; pr < pr_end; pr++)
        eina_tiler_rect_add(tiler, pr);

    itr = eina_tiler_iterator_new(tiler);
    if (!itr) {
        ERR("could not get iterator for tiler");
        ret = EINA_FALSE;
        goto error_iterator;
    }

    int sx, sy;
    ewk_frame_scroll_pos_get(sd->main_frame, &sx, &sy);

    EINA_ITERATOR_FOREACH(itr, r) {
        Eina_Rectangle scrolled_rect = {
            r.x + sx, r.y + sy,
            r.w, r.h
        };

        ewk_view_paint_context_save(ctxt);

        if ((sx) || (sy))
            ewk_view_paint_context_translate(ctxt, -sx, -sy);

        ewk_view_paint_context_clip(ctxt, &scrolled_rect);
        ewk_view_paint_context_paint_contents(ctxt, &scrolled_rect);

        ewk_view_paint_context_restore(ctxt);
        evas_object_image_data_update_add
            (sd->backing_store, r.x, r.y, r.w, r.h);
    }
    eina_iterator_free(itr);

error_iterator:
    eina_tiler_free(tiler);
error_tiler:
    ewk_view_paint_context_free(ctxt);
error_paint_context:
    cairo_destroy(cairo);
error_cairo:
    cairo_surface_destroy(surface);
error_cairo_surface:
    evas_object_image_data_set(sd->backing_store, pixels); /* dec refcount */

    return ret;
}

static Eina_Bool _ewk_view_single_smart_zoom_weak_set(Ewk_View_Smart_Data *sd, float zoom, Evas_Coord cx, Evas_Coord cy)
{
    // TODO: review
    float scale = zoom / sd->animated_zoom.zoom.start;
    Evas_Coord w = sd->view.w * scale;
    Evas_Coord h = sd->view.h * scale;
    Evas_Coord dx, dy, cw, ch;
    Evas_Object *clip = evas_object_clip_get(sd->backing_store);

    ewk_frame_contents_size_get(sd->main_frame, &cw, &ch);
    if (sd->view.w > 0 && sd->view.h > 0) {
        dx = (w * (sd->view.w - cx)) / sd->view.w;
        dy = (h * (sd->view.h - cy)) / sd->view.h;
    } else {
        dx = 0;
        dy = 0;
    }

    evas_object_image_fill_set(sd->backing_store, cx + dx, cy + dy, w, h);

    if (sd->view.w > 0 && sd->view.h > 0) {
        dx = ((sd->view.w - w) * cx) / sd->view.w;
        dy = ((sd->view.h - h) * cy) / sd->view.h;
    } else {
        dx = 0;
        dy = 0;
    }
    evas_object_move(clip, sd->view.x + dx, sd->view.y + dy);

    if (cw < sd->view.w)
        w = cw * scale;
    if (ch < sd->view.h)
        h = ch * scale;
    evas_object_resize(clip, w, h);
    return EINA_TRUE;
}

static void _ewk_view_single_smart_zoom_weak_smooth_scale_set(Ewk_View_Smart_Data *sd, Eina_Bool smooth_scale)
{
    evas_object_image_smooth_scale_set(sd->backing_store, smooth_scale);
}

static void _ewk_view_single_smart_bg_color_set(Ewk_View_Smart_Data *sd, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
    evas_object_image_alpha_set(sd->backing_store, a < 255);
}

/**
 * Sets the smart class api using single backing store, enabling view
 * to be inherited.
 *
 * @param api class definition to be set, all members with the
 *        exception of Evas_Smart_Class->data may be overridden. Must
 *        @b not be @c NULL.
 *
 * @note Evas_Smart_Class->data is used to implement type checking and
 *       is not supposed to be changed/overridden. If you need extra
 *       data for your smart class to work, just extend
 *       Ewk_View_Smart_Class instead.
 *
 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
 *         version mismatch).
 *
 * @see ewk_view_base_smart_set()
 */
Eina_Bool ewk_view_single_smart_set(Ewk_View_Smart_Class *api)
{
    if (!ewk_view_base_smart_set(api))
        return EINA_FALSE;

    if (EINA_UNLIKELY(!_parent_sc.sc.add))
        ewk_view_base_smart_set(&_parent_sc);

    api->sc.add = _ewk_view_single_smart_add;
    api->sc.resize = _ewk_view_single_smart_resize;

    api->backing_store_add = _ewk_view_single_smart_backing_store_add;
    api->scrolls_process = _ewk_view_single_smart_scrolls_process;
    api->repaints_process = _ewk_view_single_smart_repaints_process;
    api->zoom_weak_set = _ewk_view_single_smart_zoom_weak_set;
    api->zoom_weak_smooth_scale_set = _ewk_view_single_smart_zoom_weak_smooth_scale_set;
    api->bg_color_set = _ewk_view_single_smart_bg_color_set;

    return EINA_TRUE;
}

static inline Evas_Smart *_ewk_view_single_smart_class_new(void)
{
    static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("Ewk_View_Single");
    static Evas_Smart *smart = 0;

    if (EINA_UNLIKELY(!smart)) {
        ewk_view_single_smart_set(&api);
        smart = evas_smart_class_new(&api.sc);
    }

    return smart;
}

/**
 * Creates a new EFL WebKit View object.
 *
 * View objects are the recommended way to deal with EFL WebKit as it
 * abstracts the complex pieces of the process.
 *
 * Each view is composed by a set of frames. The set has at least one
 * frame, called 'main_frame'. See ewk_view_frame_main_get() and
 * ewk_view_frame_focused_get().
 *
 * @param e canvas where to create the view object.
 *
 * @return view object or @c NULL if errors.
 *
 * @see ewk_view_uri_set()
 */
Evas_Object *ewk_view_single_add(Evas *e)
{
    return evas_object_smart_add(e, _ewk_view_single_smart_class_new());
}