Changeset 62666 in webkit
- Timestamp:
- Jul 7, 2010 7:49:12 AM (14 years ago)
- Location:
- trunk/WebKit
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/ChangeLog
r62663 r62666 1 2010-07-07 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [EFL] EFLWebKit doesn't support viewport meta tag. 6 Support viewport meta tag on EFL Port. 7 https://bugs.webkit.org/show_bug.cgi?id=40278 8 9 * efl/EWebLauncher/main.c: Process 'viewport,changed' signal. 10 (viewport_set): 11 (on_viewport_changed): Add a callback function for the 'viewport,changed' signal. 12 (browserCreate): Register the callback function for the 'viewport,changed' signal. 13 * efl/WebCoreSupport/ChromeClientEfl.cpp: Implement method to process viewport tag. 14 (WebCore::ChromeClientEfl::didReceiveViewportArguments): 15 * efl/WebCoreSupport/ChromeClientEfl.h: Define method to process viewport tag. 16 * efl/WebCoreSupport/FrameLoaderClientEfl.cpp: 17 (WebCore::FrameLoaderClientEfl::FrameLoaderClientEfl): Implement a function to set layout 18 when website doesn't contain viewport tag. 19 (WebCore::FrameLoaderClientEfl::dispatchDidCommitLoad): 20 (WebCore::FrameLoaderClientEfl::dispatchDidFirstLayout): 21 * efl/WebCoreSupport/FrameLoaderClientEfl.h: 22 (WebCore::FrameLoaderClientEfl::setInitLayoutCompleted): 23 (WebCore::FrameLoaderClientEfl::getInitLayoutCompleted): 24 * efl/ewk/ewk_private.h: Added internal APIs to process viewport tag. 25 * efl/ewk/ewk_view.cpp: Added APIs to process and to handle viewport tag. 26 (_ewk_view_priv_new): 27 (ewk_view_fixed_layout_size_set): 28 (ewk_view_zoom_set): 29 (ewk_view_zoom_weak_set): 30 (ewk_view_zoom_animated_set): 31 (ewk_view_viewport_set): Reports that viewport has changed. 32 (ewk_view_viewport_get): Reports that viewport has changed. 33 (ewk_view_zoom_range_set): Sets the zoom range. 34 (ewk_view_zoom_range_min_get): Gets minimum value of zoom range. 35 (ewk_view_zoom_range_max_get): Gets maximum value of zoom range. 36 (ewk_view_user_scalable_set): Sets if zoom is enabled. 37 (ewk_view_user_scalable_get): Gets if zoom is enabled. 38 * efl/ewk/ewk_view.h: 39 1 40 2010-07-07 Rafael Antognolli <antognolli@profusion.mobi> 2 41 -
trunk/WebKit/efl/EWebLauncher/main.c
r62015 r62666 48 48 #define DEFAULT_WIDTH 800 49 49 #define DEFAULT_HEIGHT 600 50 #define DEFAULT_ZOOM_INIT 1.0 50 51 51 52 #define info(format, args...) \ … … 126 127 }; 127 128 129 typedef struct _Viewport { 130 int w; 131 int h; 132 float initScale; 133 float minScale; 134 float maxScale; 135 Eina_Bool userScalable; 136 } Viewport; 137 128 138 typedef struct _ELauncher { 129 139 Ecore_Evas *ee; … … 133 143 const char *theme; 134 144 const char *userAgent; 145 Viewport viewport; 135 146 } ELauncher; 136 147 … … 226 237 } 227 238 239 /** 240 * This is en example function to adjust viewport via viewport tag's arguments. 241 * Application can invoke this function in order to adjust viewport tag when it is required. 242 */ 243 static void 244 viewport_set() 245 { 246 ELauncher *app; 247 app = (ELauncher*) eina_list_data_get(windows); 248 249 ewk_view_fixed_layout_size_set(app->browser, app->viewport.w, app->viewport.h); 250 ewk_view_zoom_set(app->browser, app->viewport.initScale, 0, 0); 251 if (!ewk_view_zoom_range_set(app->browser, app->viewport.minScale, app->viewport.maxScale)) 252 info(" Fail to set zoom range. minScale = %f, maxScale = %f\n", app->viewport.minScale, app->viewport.maxScale); 253 ewk_view_user_scalable_set(app->browser, app->viewport.userScalable); 254 } 255 228 256 static void 229 257 on_title_changed(void *user_data, Evas_Object *webview, void *event_info) … … 344 372 if (text && *text != '\0') 345 373 info("%s\n", text); 374 } 375 376 /** 377 * "viewport,changed" signal will be always emitted regardless of the viewport existence. 378 * 379 * If you don't want to process the viewport tag, you can either do nothing in this callback 380 * or simply ignore the signal in your application. 381 * 382 * More information about this can be found at http://developer.apple.com/safari/library/docum 383 * entation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html 384 */ 385 static void 386 on_viewport_changed(void* user_data, Evas_Object* webview, void* event_info) 387 { 388 ELauncher *app = (ELauncher *)user_data; 389 390 float w, h, initScale, minScale, maxScale, userScalable; 391 392 ewk_view_viewport_get(webview, &w, &h, &initScale, &maxScale, &minScale, &userScalable); 393 394 /** 395 * If there is no argument in viewport tag, argument's value is -1. 396 */ 397 if ((int)w == -1) 398 w = DEFAULT_WIDTH; 399 if ((int)h == -1) 400 h = DEFAULT_HEIGHT; 401 if ((int)initScale == -1) 402 initScale = DEFAULT_ZOOM_INIT; // There's no scale separated from zooming in webkit-efl. 403 if ((int)minScale == -1) 404 minScale = ewk_view_zoom_range_min_get(webview); 405 if ((int)maxScale == -1) 406 maxScale = ewk_view_zoom_range_max_get(webview); 407 if ((int)userScalable == -1) 408 userScalable = EINA_TRUE; 409 410 app->viewport.w = (int)w; 411 app->viewport.h = (int)h; 412 app->viewport.initScale = initScale; 413 app->viewport.minScale = minScale; 414 app->viewport.maxScale = maxScale; 415 app->viewport.userScalable = (Eina_Bool)userScalable; 346 416 } 347 417 … … 580 650 evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app); 581 651 evas_object_smart_callback_add(app->browser, "load,finished", on_load_finished, app); 652 evas_object_smart_callback_add(app->browser, "viewport,changed", on_viewport_changed, app); 582 653 583 654 evas_object_smart_callback_add(app->browser, "toolbars,visible,set", on_toolbars_visible_set, app); -
trunk/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
r62180 r62666 48 48 #include "NotImplemented.h" 49 49 #include "PlatformString.h" 50 #include "ViewportArguments.h" 50 51 #include "WindowFeatures.h" 51 52 #include "ewk_private.h" … … 505 506 } 506 507 507 } 508 void ChromeClientEfl::didReceiveViewportArguments(Frame* frame, const ViewportArguments& arguments) const 509 { 510 FrameLoaderClientEfl* client = static_cast<FrameLoaderClientEfl*>(frame->loader()->client()); 511 if (client->getInitLayoutCompleted()) 512 return; 513 514 ewk_view_viewport_set(m_view, arguments.width, arguments.height, arguments.initialScale, arguments.minimumScale, arguments.maximumScale, arguments.userScalable); 515 } 516 517 } -
trunk/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
r61331 r62666 136 136 virtual void iconForFiles(const Vector<String, 0u>&, PassRefPtr<FileChooser>); 137 137 138 virtual void didReceiveViewportArguments(Frame* frame, const ViewportArguments& arguments) const; 139 138 140 Evas_Object* m_view; 139 141 KURL m_hoveredLinkURL; -
trunk/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
r62006 r62666 50 50 #include "RenderPart.h" 51 51 #include "ResourceRequest.h" 52 #include "ViewportArguments.h" 52 53 #include "ewk_private.h" 53 54 #include <wtf/text/CString.h> … … 71 72 , m_pluginView(0) 72 73 , m_hasSentResponseToPlugin(false) 74 , m_initLayoutCompleted(false) 73 75 { 74 76 } … … 576 578 void FrameLoaderClientEfl::dispatchDidCommitLoad() 577 579 { 580 m_initLayoutCompleted = false; 581 578 582 ewk_frame_uri_changed(m_frame); 579 583 if (ewk_view_frame_main_get(m_view) != m_frame) … … 581 585 ewk_view_title_set(m_view, 0); 582 586 ewk_view_uri_changed(m_view); 587 588 ViewportArguments arguments; 589 ewk_view_viewport_set(m_view, arguments.width, arguments.height, arguments.initialScale, arguments.minimumScale, arguments.maximumScale, arguments.userScalable); 583 590 } 584 591 … … 591 598 { 592 599 // emit m_frame->initialLayoutCompleted(); 593 notImplemented();600 m_initLayoutCompleted = true; 594 601 } 595 602 -
trunk/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h
r58686 r62666 56 56 const String& customUserAgent() const; 57 57 58 void setInitLayoutCompleted(bool completed) { m_initLayoutCompleted = completed; } 59 bool getInitLayoutCompleted() { return m_initLayoutCompleted; } 60 58 61 virtual bool hasWebView() const; 59 62 virtual bool hasFrameView() const; … … 214 217 PluginView* m_pluginView; 215 218 bool m_hasSentResponseToPlugin; 219 220 bool m_initLayoutCompleted; 216 221 }; 217 222 -
trunk/WebKit/efl/ewk/ewk_private.h
r62006 r62666 96 96 97 97 void ewk_view_popup_new(Evas_Object *o, WebCore::PopupMenuClient* client, int selected, const WebCore::IntRect& rect); 98 void ewk_view_viewport_set(Evas_Object *o, float w, float h, float init_scale, float max_scale, float min_scale, float user_scalable); 98 99 99 100 void ewk_view_download_request(Evas_Object *o, Ewk_Download *download); -
trunk/WebKit/efl/ewk/ewk_view.cpp
r62015 r62666 103 103 Eina_Bool private_browsing:1; 104 104 Eina_Bool caret_browsing:1; 105 struct { 106 float w; 107 float h; 108 float init_scale; 109 float min_scale; 110 float max_scale; 111 float user_scalable; 112 } viewport; 113 struct { 114 float min_scale; 115 float max_scale; 116 Eina_Bool user_scalable:1; 117 } zoom_range; 105 118 } settings; 106 119 struct { … … 577 590 priv->settings.caret_browsing = priv->page_settings->caretBrowsingEnabled(); 578 591 592 // Since there's no scale separated from zooming in webkit-efl, this functionality of 593 // viewport meta tag is implemented using zoom. When scale zoom is supported by webkit-efl, 594 // this functionality will be modified by the scale zoom patch. 595 priv->settings.zoom_range.min_scale = ZOOM_MIN; 596 priv->settings.zoom_range.max_scale = ZOOM_MAX; 597 579 598 priv->main_frame = _ewk_view_core_frame_new(sd, priv, 0).get(); 580 599 if (!priv->main_frame) { … … 1002 1021 EWK_VIEW_SD_GET_OR_RETURN(o, sd); 1003 1022 EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv); 1023 1024 WebCore::FrameLoaderClientEfl* client = static_cast<WebCore::FrameLoaderClientEfl*>(priv->main_frame->loader()->client()); 1025 if (!client->getInitLayoutCompleted()) 1026 return; 1027 1004 1028 WebCore::FrameView* view = sd->_priv->main_frame->view(); 1005 1029 if (w <= 0 && h <= 0) { … … 1758 1782 { 1759 1783 EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE); 1784 EWK_VIEW_PRIV_GET(sd, priv); 1785 1760 1786 EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api, EINA_FALSE); 1761 1787 EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api->zoom_set, EINA_FALSE); 1762 if (zoom < ZOOM_MIN) { 1763 WRN("zoom level is < %f : %f", (double)ZOOM_MIN, (double)zoom); 1788 1789 if (!priv->settings.zoom_range.user_scalable) { 1790 WRN("userScalable is false"); 1764 1791 return EINA_FALSE; 1765 1792 } 1766 if (zoom > ZOOM_MAX) { 1767 WRN("zoom level is > %f : %f", (double)ZOOM_MAX, (double)zoom); 1793 1794 if (zoom < priv->settings.zoom_range.min_scale) { 1795 WRN("zoom level is < %f : %f", (double)priv->settings.zoom_range.min_scale, (double)zoom); 1796 return EINA_FALSE; 1797 } 1798 if (zoom > priv->settings.zoom_range.max_scale) { 1799 WRN("zoom level is > %f : %f", (double)priv->settings.zoom_range.max_scale, (double)zoom); 1768 1800 return EINA_FALSE; 1769 1801 } … … 1828 1860 { 1829 1861 EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE); 1862 EWK_VIEW_PRIV_GET(sd, priv); 1863 1830 1864 EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api, EINA_FALSE); 1831 1865 EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api->zoom_weak_set, EINA_FALSE); 1832 if (zoom < ZOOM_MIN) { 1833 WRN("zoom level is < %f : %f", (double)ZOOM_MIN, (double)zoom); 1866 1867 if (!priv->settings.zoom_range.user_scalable) { 1868 WRN("userScalable is false"); 1834 1869 return EINA_FALSE; 1835 1870 } 1836 if (zoom > ZOOM_MAX) { 1837 WRN("zoom level is > %f : %f", (double)ZOOM_MAX, (double)zoom); 1871 1872 if (zoom < priv->settings.zoom_range.min_scale) { 1873 WRN("zoom level is < %f : %f", (double)priv->settings.zoom_range.min_scale, (double)zoom); 1874 return EINA_FALSE; 1875 } 1876 if (zoom > priv->settings.zoom_range.max_scale) { 1877 WRN("zoom level is > %f : %f", (double)priv->settings.zoom_range.max_scale, (double)zoom); 1838 1878 return EINA_FALSE; 1839 1879 } … … 1978 2018 EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api->zoom_weak_set, EINA_FALSE); 1979 2019 1980 if ( zoom < ZOOM_MIN) {1981 WRN(" zoom level is < %f : %f", (double)ZOOM_MIN, (double)zoom);2020 if (!priv->settings.zoom_range.user_scalable) { 2021 WRN("userScalable is false"); 1982 2022 return EINA_FALSE; 1983 2023 } 1984 if (zoom > ZOOM_MAX) { 1985 WRN("zoom level is > %f : %f", (double)ZOOM_MAX, (double)zoom); 2024 2025 if (zoom < priv->settings.zoom_range.min_scale) { 2026 WRN("zoom level is < %f : %f", (double)priv->settings.zoom_range.min_scale, (double)zoom); 2027 return EINA_FALSE; 2028 } 2029 if (zoom > priv->settings.zoom_range.max_scale) { 2030 WRN("zoom level is > %f : %f", (double)priv->settings.zoom_range.max_scale, (double)zoom); 1986 2031 return EINA_FALSE; 1987 2032 } … … 3711 3756 evas_object_smart_callback_call(o, "download,request", download); 3712 3757 } 3758 3759 /** 3760 * @internal 3761 * Reports the viewport has changed. 3762 * 3763 * @param o view. 3764 * @param w width. 3765 * @param h height. 3766 * @param init_scale initialScale value. 3767 * @param max_scale maximumScale value. 3768 * @param min_scale minimumScale value. 3769 * @param user_scalable userscalable flag. 3770 * 3771 * Emits signal: "viewport,changed" with no parameters. 3772 */ 3773 void ewk_view_viewport_set(Evas_Object *o, float w, float h, float init_scale, float max_scale, float min_scale, float user_scalable) 3774 { 3775 EWK_VIEW_SD_GET(o, sd); 3776 EWK_VIEW_PRIV_GET(sd, priv); 3777 3778 priv->settings.viewport.w = w; 3779 priv->settings.viewport.h = h; 3780 priv->settings.viewport.init_scale = init_scale; 3781 priv->settings.viewport.min_scale = min_scale; 3782 priv->settings.viewport.max_scale = max_scale; 3783 priv->settings.viewport.user_scalable = user_scalable; 3784 3785 evas_object_smart_callback_call(o, "viewport,changed", 0); 3786 } 3787 3788 /** 3789 * Gets data of viewport meta tag. 3790 * 3791 * @param o view. 3792 * @param w width. 3793 * @param h height. 3794 * @param init_scale initial Scale value. 3795 * @param max_scale maximum Scale value. 3796 * @param min_scale minimum Scale value. 3797 * @param user_scalable user Scalable value. 3798 */ 3799 void ewk_view_viewport_get(Evas_Object *o, float* w, float* h, float* init_scale, float* max_scale, float* min_scale, float* user_scalable) 3800 { 3801 EWK_VIEW_SD_GET(o, sd); 3802 EWK_VIEW_PRIV_GET(sd, priv); 3803 3804 if (w) 3805 *w = priv->settings.viewport.w; 3806 if (h) 3807 *h = priv->settings.viewport.h; 3808 if (init_scale) 3809 *init_scale = priv->settings.viewport.init_scale; 3810 if (max_scale) 3811 *max_scale = priv->settings.viewport.max_scale; 3812 if (min_scale) 3813 *min_scale = priv->settings.viewport.min_scale; 3814 if (user_scalable) 3815 *user_scalable = priv->settings.viewport.user_scalable; 3816 } 3817 3818 /** 3819 * Sets the zoom range. 3820 * 3821 * @param o view. 3822 * @param min_scale minimum value of zoom range. 3823 * @param max_scale maximum value of zoom range. 3824 * 3825 * @return @c EINA_TRUE if zoom range is changed, @c EINA_FALSE if not or failure. 3826 */ 3827 Eina_Bool ewk_view_zoom_range_set(Evas_Object* o, float min_scale, float max_scale) 3828 { 3829 EWK_VIEW_SD_GET(o, sd); 3830 EWK_VIEW_PRIV_GET(sd, priv); 3831 3832 if (max_scale < min_scale) { 3833 WRN("min_scale is larger than max_scale"); 3834 return EINA_FALSE; 3835 } 3836 3837 priv->settings.zoom_range.min_scale = min_scale; 3838 priv->settings.zoom_range.max_scale = max_scale; 3839 3840 return EINA_TRUE; 3841 } 3842 3843 /** 3844 * Gets the minimum value of zoom range. 3845 * 3846 * @param o view. 3847 * 3848 * @return minimum value of zoom range. 3849 */ 3850 float ewk_view_zoom_range_min_get(Evas_Object* o) 3851 { 3852 EWK_VIEW_SD_GET(o, sd); 3853 EWK_VIEW_PRIV_GET(sd, priv); 3854 3855 return priv->settings.zoom_range.min_scale; 3856 } 3857 3858 /** 3859 * Gets the maximum value of zoom range. 3860 * 3861 * @param o view. 3862 * 3863 * @return maximum value of zoom range. 3864 */ 3865 float ewk_view_zoom_range_max_get(Evas_Object* o) 3866 { 3867 EWK_VIEW_SD_GET(o, sd); 3868 EWK_VIEW_PRIV_GET(sd, priv); 3869 3870 return priv->settings.zoom_range.max_scale; 3871 } 3872 3873 /** 3874 * Sets if zoom is enabled. 3875 * 3876 * @param o view. 3877 * @param user_scalable boolean pointer in which to enable zoom. It defaults 3878 * to @c EINA_TRUE. 3879 */ 3880 void ewk_view_user_scalable_set(Evas_Object* o, Eina_Bool user_scalable) 3881 { 3882 EWK_VIEW_SD_GET(o, sd); 3883 EWK_VIEW_PRIV_GET(sd, priv); 3884 3885 priv->settings.zoom_range.user_scalable = user_scalable; 3886 } 3887 3888 /** 3889 * Gets if zoom is enabled. 3890 * 3891 * @param o view. 3892 * @param user_scalable where to return the current user scalable value. 3893 * 3894 * @return @c EINA_TRUE if zoom is enabled, @c EINA_FALSE if not. 3895 */ 3896 Eina_Bool ewk_view_user_scalable_get(Evas_Object* o) 3897 { 3898 EWK_VIEW_SD_GET(o, sd); 3899 EWK_VIEW_PRIV_GET(sd, priv); 3900 3901 return priv->settings.zoom_range.user_scalable; 3902 } -
trunk/WebKit/efl/ewk/ewk_view.h
r61706 r62666 86 86 * and as arguments gives its details. 87 87 * - "icon,received", void: main frame received an icon. 88 * - "viewport,changed", void: Report that viewport has changed. 88 89 */ 89 90 … … 454 455 EAPI Eina_Bool ewk_view_paint_contents(Ewk_View_Private_Data *priv, cairo_t *cr, const Eina_Rectangle *area); 455 456 457 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); 458 EAPI Eina_Bool ewk_view_zoom_range_set(Evas_Object* o, float min_scale, float max_scale); 459 EAPI float ewk_view_zoom_range_min_get(Evas_Object* o); 460 EAPI float ewk_view_zoom_range_max_get(Evas_Object* o); 461 EAPI void ewk_view_user_scalable_set(Evas_Object* o, Eina_Bool user_scalable); 462 EAPI Eina_Bool ewk_view_user_scalable_get(Evas_Object* o); 463 456 464 #ifdef __cplusplus 457 465 }
Note: See TracChangeset
for help on using the changeset viewer.