[Webkit-unassigned] [Bug 40278] [EFL] EFLWebKit doesn't support viewport meta tag

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 14 19:36:18 PDT 2010


--- Comment #23 from Gyuyoung Kim <gyuyoung.kim at samsung.com>  2010-06-14 19:36:14 PST ---
Hello Lukasz, 
Thank you for your review. It seems I need to explain this patch more detail.

First of all, this patch implemented that viewport tag should be processed by application(EWebLauncher) or user.

When the viewport is found in WebCore, viewport arguments are sent to ChromeClientEfl::didReceiveViewportArguments(). Then, the function sends a signal "viewport,changed" to application(EWebLauncher). When application receives the signal, application can decide if viewport tag is adjusted or not as below,

+on_viewport_changed(void* user_data, Evas_Object* webview, void* event_info)
+    int w, h;
+    float initScale, minScale, maxScale;
+    Eina_Bool userScalable;
+    ewk_view_viewport_get(webview, &w, &h, &initScale, &maxScale, &minScale, &userScalable);
+    w = (w == -1) ? DEFAULT_WIDTH : w;
+    h = (h == -1) ? DEFAULT_HEIGHT : h;
+    initScale = ((int)initScale == -1) ? DEFAULT_SCALE : initScale;
+    minScale = ((int)minScale == -1) ? DEFAULT_SCALE : minScale; 
+    maxScale = ((int)maxScale == -1) ? DEFAULT_SCALE : maxScale;

I think, if application doens't want to adjust viewport, they just doesn't process nothing in the callback function(on_viewport_changed).

But, if user want to process viewport tag, they can process viewport via APIs below,

+    ewk_view_fixed_layout_size_set(webview, w, h);
+    ewk_view_zoom_set(webview, initScale, 0, 0);
+    ewk_view_zoom_range_set(webview, minScale, maxScale);
+    ewk_view_user_scalable_set(webview, userScalable);

As you know, the ewk_view_zoom_range_set(), ewk_view_zoom_scalable_set() were made by this patch. 

Zoom range can be set via the ewk_view_zoom_range_set() as below,
+void ewk_view_zoom_range_set(...)
+    priv->settings.zoom_range.min_scale = min_scale;
+    priv->settings.zoom_range.max_scale = max_scale;

I needed to have min_scale, max_scale, init_scale and user_scalable respectively.

+        Eina_Bool user_scalable:1;
+        struct {
+            int w;
+            int h;
+            float init_scale;
+            float min_scale;
+            float max_scale;
+            Eina_Bool user_scalable:1;
+        } viewport;
+        struct {
+            float min_scale;
+            float max_scale;
+        } zoom_range;

Because there are two reasons. First. to store argument of viewport tag in order to send the data of viewport via ewk_viewport_get() to application(EWebLauncher). Second, do not adjust the data of viewport directly. If we don't have two vairaiables, viewport can be set via ewk_view_viewport_set() directly, Or, there are no way to adjust viewport by application(EWebLauncher). So, I made two variables respectly.

The min_scale and max_scale in zoom_range were just replaced with ZOOM_MIN / ZOOM_MAX in order to change ZOOM_MIN, ZOOM_MAX with application's request(I mean ewk_view_zoom_range_set())

+        struct {
+            float min_scale;
+            float max_scale;
+        } zoom_range;

Thus, I need to initialize the min_scale and max_scale with ZOOM_MIN, ZOOM_MAX

>+    priv->settings.zoom_range.min_scale = ZOOM_MIN;
>+    priv->settings.zoom_range.max_scale = ZOOM_MAX;

As mentioned in above, the zoom_range.min_scale/max_scale only can be changed by the ewk_view_zoom_set()(from application)

>+void ChromeClientEfl::didReceiveViewportArguments(Frame* frame, const ViewportArguments& arguments) const
>+    Eina_Bool userScalable;

>+    userScalable = (int)arguments.userScalable == 1 ? EINA_TRUE : EINA_FALSE;
>>You should check for arguments.userScalable == -1, not just == 1.

As you know, userScalable is boolean(yes or no) check if user can scale or not. So, I process it in the didReceiveViewportArguments directly. If userScalable is "1", user can scalable, If not so, user can't scalable. The user-scalable is defined as below,

"Determines whether or not the user can zoom in and out—whether or not the user can change the scale of the viewport. Set to yes to allow scaling and no to disallow scaling. The default is yes."

However, if you think it is better userScalalble also is processed by application, I will modify it.

>> Please, consider the comment #11 about the place to put this signal in order to ignore the meta tag outside of <head></head>.

According to the comment #11, I put this signal on "dispatchDidCommitLoad" and ChromeClientEfl::didReceiveViewportArguments. However, To my debugging, dispatchDidCommitLoad() is invoked more faster than didReceiveViewportArguments(). Thus, if webpage contains viewport tag, the viewport,changed signal are sent to application twice by dispatchDidCommitLoad() and ChromeClientEfl::didReceiveViewportArguments(). I don't want to send twice signal to application. It can make confusion for application. Because application processes viewport tag twice.

If didReceiveViewportArguments() is invoked, I don't want to send a signal for viewport to applicaiton. So, I needed to set flag (initialLayoutComplete), But, there was no way to notify the flog from ChoromeClientEfl to FrameLoaderClientEfl. So, I made internal APIs for the flag as below,

+void   ewk_view_init_layout_completed_set(Evas_Object *o, Eina_Bool init_layout);
+Eina_Bool ewk_view_init_layout_completed_get(Evas_Object *o);

Do you think should we send viewport signal twice ?

Thank you.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list