[WK2] Fixed magnifier size which varies according to Zoom level of the page
authorprathmesh.m <prathmesh.m@samsung.com>
Mon, 27 Aug 2012 10:27:45 +0000 (19:27 +0900)
committerprathmesh.m <prathmesh.m@samsung.com>
Mon, 27 Aug 2012 10:27:45 +0000 (19:27 +0900)
[Version] N/A
[Project] N/A
[Title] Fixed magnifier size which varies according to Zoom level of page
[BinType] N/A
[Customer] N/A
[Issue#] WEB-1078
[Problem] Magnifier zooms with respect to page
[Cause] Image size was used to set the pop-up size
[Solution] Fixed the pop-up size and recaled the image for viewing
[Team] Browser(WCS)
[Developer] Prathmesh.m
[Request] N/A
[Horizontal expansion] N/A
[SCMRequest] N/A

Change-Id: I07fa66039f0335868ac84ba1136f4e7622b795fa

Source/WebKit2/UIProcess/API/efl/editor/TextSelectionMagnifier.cpp

index c591415..3ecf0d5 100755 (executable)
@@ -65,9 +65,10 @@ void TextSelectionMagnifier::update(const IntPoint& point)
     int viewX, viewY;
     evas_object_geometry_get(m_pageClient->viewWidget(), &viewX, &viewY, 0, 0);
 
-    IntRect rect(point.x() - viewX - (m_width/2), point.y() -viewY - (m_height/2), m_width, m_height);
+    float zoomLevel = 1.5f;
+    IntRect rect(point.x() - viewX - (ceil(m_width/zoomLevel)/2), point.y() - viewY - (ceil(m_height/zoomLevel)/2), ceil(m_width/zoomLevel), ceil(m_height/zoomLevel));
 
-    RefPtr<WebImage> webImage = m_page->createSnapshot(rect, m_pageClient->scaleFactor());
+    RefPtr<WebImage> webImage = m_page->createSnapshot(rect, zoomLevel);
     if (!webImage || !webImage->bitmap())
         return;
     RefPtr<cairo_surface_t> cairoSurface = webImage->bitmap()->createCairoSurface();
@@ -76,13 +77,10 @@ void TextSelectionMagnifier::update(const IntPoint& point)
 
     if (m_image)
         evas_object_del(m_image);
-    m_image = ewk_util_image_from_cairo_surface_add(evas_object_evas_get(m_object), cairoSurface.get());
-
-    int magnifierWidth = cairo_image_surface_get_width(cairoSurface.get());
-    int magnifierHeight = cairo_image_surface_get_height(cairoSurface.get());
 
-    evas_object_size_hint_min_set(m_image, magnifierWidth, magnifierHeight);
-    evas_object_resize(m_image, magnifierWidth, magnifierHeight);
+    m_image = ewk_util_image_from_cairo_surface_add(evas_object_evas_get(m_object), cairoSurface.get());
+    evas_object_size_hint_min_set(m_image, m_width, m_height);
+    evas_object_resize(m_image, m_width, m_height);
 
     evas_object_image_filled_set(m_image, true);