Changeset 69650 in webkit


Ignore:
Timestamp:
Oct 13, 2010 5:14:58 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-10-13 Gyuyoung Kim <gyuyoung.kim@samsung.com>

Reviewed by Kenneth Rohde Christiansen.

[EFL] Support viewport configuration and add new arguments for WebKit EFL
https://bugs.webkit.org/show_bug.cgi?id=47084

Opera spec regarding to viewport meta tag was adjusted to WebCore. So, EFL port
needs to be modified according to the changes.

  • WebCoreSupport/ChromeClientEfl.cpp: (WebCore::ChromeClientEfl::dispatchViewportDataDidChange):
  • WebCoreSupport/FrameLoaderClientEfl.cpp: (WebCore::FrameLoaderClientEfl::dispatchDidCommitLoad):
  • ewk/ewk_private.h:
  • ewk/ewk_view.cpp: (_ewk_view_priv_new): (_ewk_view_viewport_attributes_compute): (ewk_view_viewport_attributes_set): (ewk_view_viewport_attributes_get): (ewk_view_device_pixel_ratio_get):
  • ewk/ewk_view.h:

2010-10-13 Gyuyoung Kim <gyuyoung.kim@samsung.com>

Reviewed by Kenneth Rohde Christiansen.

[EFL] Support viewport configuration and add new arguments for WebKit EFL
https://bugs.webkit.org/show_bug.cgi?id=47084

Opera spec regarding to viewport meta tag was adjusted to WebCore. So, EFL port
needs to be modified according to the changes.

  • EWebLauncher/main.c: (on_viewport_changed):
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/efl/ChangeLog

    r69613 r69650  
     12010-10-13  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [EFL] Support viewport configuration and add new arguments for WebKit EFL
     6        https://bugs.webkit.org/show_bug.cgi?id=47084
     7
     8        Opera spec regarding to viewport meta tag was adjusted to WebCore. So, EFL port
     9        needs to be modified according to the changes.
     10
     11        * WebCoreSupport/ChromeClientEfl.cpp:
     12        (WebCore::ChromeClientEfl::dispatchViewportDataDidChange):
     13        * WebCoreSupport/FrameLoaderClientEfl.cpp:
     14        (WebCore::FrameLoaderClientEfl::dispatchDidCommitLoad):
     15        * ewk/ewk_private.h:
     16        * ewk/ewk_view.cpp:
     17        (_ewk_view_priv_new):
     18        (_ewk_view_viewport_attributes_compute):
     19        (ewk_view_viewport_attributes_set):
     20        (ewk_view_viewport_attributes_get):
     21        (ewk_view_device_pixel_ratio_get):
     22        * ewk/ewk_view.h:
     23
    1242010-10-12  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    225
  • trunk/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp

    r69376 r69650  
    520520void ChromeClientEfl::dispatchViewportDataDidChange(const ViewportArguments& arguments) const
    521521{
    522     ewk_view_viewport_set(m_view, arguments.width, arguments.height, arguments.initialScale, arguments.minimumScale, arguments.maximumScale, arguments.userScalable);
     522    ewk_view_viewport_attributes_set(m_view, arguments);
    523523}
    524524
  • trunk/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp

    r69061 r69650  
    622622
    623623    ViewportArguments arguments;
    624     ewk_view_viewport_set(m_view, arguments.width, arguments.height, arguments.initialScale, arguments.minimumScale, arguments.maximumScale, arguments.userScalable);
     624    ewk_view_viewport_attributes_set(m_view, arguments);
    625625}
    626626
  • trunk/WebKit/efl/ewk/ewk_private.h

    r69613 r69650  
    103103
    104104void ewk_view_popup_new(Evas_Object *o, WebCore::PopupMenuClient* client, int selected, const WebCore::IntRect& rect);
    105 void ewk_view_viewport_set(Evas_Object *o, float w, float h, float init_scale, float max_scale, float min_scale, float user_scalable);
     105void ewk_view_viewport_attributes_set(Evas_Object *o, const WebCore::ViewportArguments& arguments);
    106106
    107107void ewk_view_download_request(Evas_Object *o, Ewk_Download *download);
  • trunk/WebKit/efl/ewk/ewk_view.cpp

    r69613 r69650  
    2323#include "ewk_view.h"
    2424
    25 #include "appcache/ApplicationCacheStorage.h"
     25#include "Chrome.h"
    2626#include "ChromeClientEfl.h"
    2727#include "ContextMenuClientEfl.h"
     
    4343#include "PopupMenuClient.h"
    4444#include "ProgressTracker.h"
     45#include "appcache/ApplicationCacheStorage.h"
    4546#include "ewk_private.h"
    4647
     
    5960#define ZOOM_MAX (4.0)
    6061
     62#define DEVICE_PIXEL_RATIO (1.0)
     63
    6164static const char EWK_VIEW_TYPE_STR[] = "EWK_View";
    6265
     
    7376    WebCore::Settings* page_settings;
    7477    WebCore::Frame* main_frame;
     78    WebCore::ViewportArguments viewport_arguments;
    7579    Ewk_History* history;
    7680    struct {
     
    121125        Eina_Bool page_cache: 1;
    122126        struct {
    123             float w;
    124             float h;
    125             float init_scale;
    126             float min_scale;
    127             float max_scale;
    128             float user_scalable;
    129         } viewport;
    130         struct {
    131127            float min_scale;
    132128            float max_scale;
    133129            Eina_Bool user_scalable:1;
    134130        } zoom_range;
     131        float device_pixel_ratio;
    135132    } settings;
    136133    struct {
     
    625622    priv->settings.zoom_range.max_scale = ZOOM_MAX;
    626623    priv->settings.zoom_range.user_scalable = EINA_TRUE;
     624    priv->settings.device_pixel_ratio = DEVICE_PIXEL_RATIO;
    627625
    628626    priv->main_frame = _ewk_view_core_frame_new(sd, priv, 0).get();
     
    966964    priv->animated_zoom.animator = ecore_animator_add
    967965        (_ewk_view_zoom_animator_cb, sd);
     966}
     967
     968static WebCore::ViewportAttributes _ewk_view_viewport_attributes_compute(Evas_Object* o)
     969{
     970    EWK_VIEW_SD_GET(o, sd);
     971    EWK_VIEW_PRIV_GET(sd, priv);
     972
     973    int desktop_width = 980;
     974    int device_dpi = 160;
     975
     976    int available_width = (int) priv->page->chrome()->client()->pageRect().width();
     977    int available_height = (int) priv->page->chrome()->client()->pageRect().height();
     978
     979    int device_width = (int) priv->page->chrome()->client()->windowRect().width();
     980    int device_height = (int) priv->page->chrome()->client()->windowRect().height();
     981
     982    IntSize available_size = IntSize(available_width, available_height);
     983    WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewport_arguments, desktop_width, device_width, device_height, device_dpi, available_size);
     984
     985    return attributes;
    968986}
    969987
     
    40504068 * Reports the viewport has changed.
    40514069 *
    4052  * @param o view.
    4053  * @param w width.
    4054  * @param h height.
    4055  * @param init_scale initialScale value.
    4056  * @param max_scale maximumScale value.
    4057  * @param min_scale minimumScale value.
    4058  * @param user_scalable userscalable flag.
     4070 * @param arguments viewport argument.
    40594071 *
    40604072 * Emits signal: "viewport,changed" with no parameters.
    40614073 */
    4062 void ewk_view_viewport_set(Evas_Object *o, float w, float h, float init_scale, float max_scale, float min_scale, float user_scalable)
     4074void ewk_view_viewport_attributes_set(Evas_Object *o, const WebCore::ViewportArguments& arguments)
    40634075{
    40644076    EWK_VIEW_SD_GET(o, sd);
    40654077    EWK_VIEW_PRIV_GET(sd, priv);
    4066 
    4067     priv->settings.viewport.w = w;
    4068     priv->settings.viewport.h = h;
    4069     priv->settings.viewport.init_scale = init_scale;
    4070     priv->settings.viewport.min_scale = min_scale;
    4071     priv->settings.viewport.max_scale = max_scale;
    4072     priv->settings.viewport.user_scalable = user_scalable;
    4073 
     4078   
     4079    priv->viewport_arguments = arguments;
    40744080    evas_object_smart_callback_call(o, "viewport,changed", 0);
    40754081}
    40764082
    40774083/**
    4078  * Gets data of viewport meta tag.
     4084 * Gets attributes of viewport meta tag.
    40794085 *
    40804086 * @param o view.
     
    40844090 * @param max_scale maximum Scale value.
    40854091 * @param min_scale minimum Scale value.
     4092 * @param device_pixel_ratio value.
    40864093 * @param user_scalable user Scalable value.
    40874094 */
    4088 void ewk_view_viewport_get(Evas_Object *o, float* w, float* h, float* init_scale, float* max_scale, float* min_scale, float* user_scalable)
    4089 {
    4090     EWK_VIEW_SD_GET(o, sd);
    4091     EWK_VIEW_PRIV_GET(sd, priv);
     4095void ewk_view_viewport_attributes_get(Evas_Object *o, float* w, float* h, float* init_scale, float* max_scale, float* min_scale, float* device_pixel_ratio, Eina_Bool* user_scalable)
     4096{
     4097    WebCore::ViewportAttributes attributes = _ewk_view_viewport_attributes_compute(o);
    40924098
    40934099    if (w)
    4094         *w = priv->settings.viewport.w;
     4100        *w = attributes.layoutSize.width();
    40954101    if (h)
    4096         *h = priv->settings.viewport.h;
     4102        *h = attributes.layoutSize.height();
    40974103    if (init_scale)
    4098         *init_scale = priv->settings.viewport.init_scale;
     4104        *init_scale = attributes.initialScale;
    40994105    if (max_scale)
    4100         *max_scale = priv->settings.viewport.max_scale;
     4106        *max_scale = attributes.maximumScale;
    41014107    if (min_scale)
    4102         *min_scale = priv->settings.viewport.min_scale;
     4108        *min_scale = attributes.minimumScale;
     4109    if (device_pixel_ratio)
     4110        *device_pixel_ratio = attributes.devicePixelRatio;
    41034111    if (user_scalable)
    4104         *user_scalable = priv->settings.viewport.user_scalable;
     4112        *user_scalable = attributes.userScalable;
    41054113}
    41064114
     
    41924200
    41934201/**
     4202 * Gets device pixel ratio value.
     4203 *
     4204 * @param o view.
     4205 * @param user_scalable where to return the current user scalable value.
     4206 *
     4207 * @return @c EINA_TRUE if zoom is enabled, @c EINA_FALSE if not.
     4208 */
     4209float ewk_view_device_pixel_ratio_get(Evas_Object* o)
     4210{
     4211    EWK_VIEW_SD_GET(o, sd);
     4212    EWK_VIEW_PRIV_GET(sd, priv);
     4213
     4214    return priv->settings.device_pixel_ratio;
     4215}
     4216
     4217/**
    41944218 * @internal
    41954219 * Reports a requeset will be loaded. It's client responsibility to decide if
  • trunk/WebKit/efl/ewk/ewk_view.h

    r68363 r69650  
    490490EAPI Eina_Bool ewk_view_paint_contents(Ewk_View_Private_Data *priv, cairo_t *cr, const Eina_Rectangle *area);
    491491
    492 EAPI void ewk_view_viewport_get(Evas_Object *o, float* w, float* h, float* init_scale, float* max_scale, float* min_scale, float* user_scalable);
     492EAPI void ewk_view_viewport_attributes_get(Evas_Object *o, float* w, float* h, float* init_scale, float* max_scale, float* min_scale, float* device_pixel_ratio , Eina_Bool* user_scalable);
    493493EAPI Eina_Bool ewk_view_zoom_range_set(Evas_Object* o, float min_scale, float max_scale);
    494494EAPI float ewk_view_zoom_range_min_get(Evas_Object* o);
     
    496496EAPI void ewk_view_user_scalable_set(Evas_Object* o, Eina_Bool user_scalable);
    497497EAPI Eina_Bool ewk_view_user_scalable_get(Evas_Object* o);
     498EAPI float ewk_view_device_pixel_ratio_get(Evas_Object* o);
    498499
    499500#ifdef __cplusplus
  • trunk/WebKitTools/ChangeLog

    r69638 r69650  
     12010-10-13  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [EFL] Support viewport configuration and add new arguments for WebKit EFL
     6        https://bugs.webkit.org/show_bug.cgi?id=47084
     7
     8        Opera spec regarding to viewport meta tag was adjusted to WebCore. So, EFL port
     9        needs to be modified according to the changes.
     10
     11        * EWebLauncher/main.c:
     12        (on_viewport_changed):
     13
    1142010-10-12  Dirk Pranke  <dpranke@chromium.org>
    215
  • trunk/WebKitTools/EWebLauncher/main.c

    r68363 r69650  
    133133    float minScale;
    134134    float maxScale;
     135    float devicePixelRatio;
    135136    Eina_Bool userScalable;
    136137} Viewport;
     
    403404    ELauncher *app = (ELauncher *)user_data;
    404405
    405     float w, h, initScale, minScale, maxScale, userScalable;
    406 
    407     ewk_view_viewport_get(webview, &w, &h, &initScale, &maxScale, &minScale, &userScalable);
     406    float w, h, initScale, minScale, maxScale, devicePixelRatio;
     407    Eina_Bool userScalable;
     408
     409    ewk_view_viewport_attributes_get(webview, &w, &h, &initScale, &maxScale, &minScale, &devicePixelRatio, &userScalable);
    408410
    409411    /**
     
    420422    if ((int)maxScale == -1)
    421423        maxScale = ewk_view_zoom_range_max_get(webview);
     424    if ((int)devicePixelRatio == -1)
     425        devicePixelRatio = ewk_view_device_pixel_ratio_get(webview);
    422426    if ((int)userScalable == -1)
    423427        userScalable = EINA_TRUE;
     
    428432    app->viewport.minScale = minScale;
    429433    app->viewport.maxScale = maxScale;
    430     app->viewport.userScalable = (Eina_Bool)userScalable;
     434    app->viewport.devicePixelRatio = devicePixelRatio;
     435    app->viewport.userScalable = userScalable;
    431436    viewport_set();
    432437}
Note: See TracChangeset for help on using the changeset viewer.