Changeset 166766 in webkit
- Timestamp:
- Apr 3, 2014 10:04:56 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r166763 r166766 1 2014-04-03 Eunmi Lee <eunmi15.lee@samsung.com> 2 3 [EFL][WK2] Add API to get contents size of current web page. 4 https://bugs.webkit.org/show_bug.cgi?id=131148 5 6 Reviewed by Gyuyoung Kim. 7 8 Application can want to get contents size of current web page without 9 monitoring "contents,size,changed" signal, so I add API to get contents 10 size directly. 11 12 * UIProcess/API/C/CoordinatedGraphics/WKView.cpp: 13 (WKViewGetContentsSize): WK API to get contents size from WebView. 14 * UIProcess/API/C/CoordinatedGraphics/WKView.h: 15 * UIProcess/API/efl/ewk_view.cpp: 16 (ewk_view_contents_size_get): new API to get contents size. 17 * UIProcess/API/efl/ewk_view.h: 18 * UIProcess/API/efl/tests/test_ewk2_view.cpp: 19 (TEST_F): 20 1 21 2014-04-03 Jinwoo Song <jinwoo7.song@samsung.com> 2 22 -
trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp
r164266 r166766 196 196 } 197 197 198 WKSize WKViewGetContentsSize(WKViewRef viewRef) 199 { 200 const WebCore::IntSize& size = toImpl(viewRef)->contentsSize(); 201 return WKSizeMake(size.width(), size.height()); 202 } 203 198 204 #endif // USE(COORDINATED_GRAPHICS) -
trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h
r164266 r166766 114 114 WK_EXPORT void WKViewFindZoomableAreaForRect(WKViewRef, WKRect); 115 115 116 WK_EXPORT WKSize WKViewGetContentsSize(WKViewRef); 117 116 118 #ifdef __cplusplus 117 119 } -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
r166718 r166766 756 756 WKViewGetBackgroundColor(impl->wkView(), red, green, blue, alpha); 757 757 } 758 759 Eina_Bool ewk_view_contents_size_get(const Evas_Object* ewkView, Evas_Coord* width, Evas_Coord* height) 760 { 761 EwkView* impl = toEwkViewChecked(ewkView); 762 if (EINA_UNLIKELY(!impl)) { 763 EINA_LOG_CRIT("no private data for object %p", ewkView); 764 if (width) 765 *width = 0; 766 if (height) 767 *height = 0; 768 769 return false; 770 } 771 772 WKSize contentsSize = WKViewGetContentsSize(impl->wkView()); 773 if (width) 774 *width = contentsSize.width; 775 if (height) 776 *height = contentsSize.height; 777 778 return true; 779 } -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h
r166718 r166766 932 932 EAPI void ewk_view_bg_color_get(const Evas_Object *o, int *r, int *g, int *b, int *a); 933 933 934 /** 935 * Get contents size of current web page. 936 * 937 * If it fails to get the content size, the width and height will be set to 0. 938 * 939 * @param o view object to get contents size 940 * @param width pointer to an integer in which to store the width of contents. 941 * @param height pointer to an integer in which to store the height of contents. 942 * 943 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise 944 */ 945 EAPI Eina_Bool ewk_view_contents_size_get(const Evas_Object *o, Evas_Coord *width, Evas_Coord *height); 946 934 947 #ifdef __cplusplus 935 948 } -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
r166718 r166766 1114 1114 ASSERT_FLOAT_EQ(1, ewk_view_page_zoom_get(webView())); 1115 1115 } 1116 1117 TEST_F(EWK2ViewTest, ewk_view_contents_size_get) 1118 { 1119 int contentsWidth, contentsHeight; 1120 ewk_view_contents_size_get(0, &contentsWidth, &contentsHeight); 1121 1122 EXPECT_EQ(0, contentsWidth); 1123 EXPECT_EQ(0, contentsHeight); 1124 1125 ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); 1126 ewk_view_contents_size_get(webView(), &contentsWidth, &contentsHeight); 1127 1128 EXPECT_EQ(environment->defaultWidth(), contentsWidth); 1129 EXPECT_EQ(environment->defaultHeight(), contentsHeight); 1130 1131 ewk_view_device_pixel_ratio_set(webView(), 2); 1132 ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl())); 1133 ewk_view_contents_size_get(webView(), &contentsWidth, &contentsHeight); 1134 1135 EXPECT_EQ(environment->defaultWidth() / 2, contentsWidth); 1136 EXPECT_EQ(environment->defaultHeight() / 2, contentsHeight); 1137 1138 const char fixedContentsSize[] = 1139 "<!DOCTYPE html>" 1140 "<body style=\"margin:0px;width:2000px;height:3000px\"></body>"; 1141 ewk_view_html_string_load(webView(), fixedContentsSize, 0, 0); 1142 ASSERT_TRUE(waitUntilLoadFinished()); 1143 ewk_view_contents_size_get(webView(), &contentsWidth, &contentsHeight); 1144 1145 EXPECT_EQ(2000, contentsWidth); 1146 EXPECT_EQ(3000, contentsHeight); 1147 }
Note: See TracChangeset
for help on using the changeset viewer.