Diff
Modified: trunk/Source/WebKit2/ChangeLog (147616 => 147617)
--- trunk/Source/WebKit2/ChangeLog 2013-04-04 09:40:45 UTC (rev 147616)
+++ trunk/Source/WebKit2/ChangeLog 2013-04-04 10:47:46 UTC (rev 147617)
@@ -1,3 +1,37 @@
+2013-04-04 Mikhail Pozdnyakov <mikhail.pozdnya...@intel.com>
+
+ [WK2][EFL] WebView should own view size
+ https://bugs.webkit.org/show_bug.cgi?id=110753
+
+ Reviewed by Andreas Kling.
+
+ WebView owns view size. WKViewGetSize and WKViewSetSize API
+ is exposed accordingly. Usage of EFL-specific ewkView inside
+ toolkit-agnostic WebView class is reduced.
+
+ * UIProcess/API/C/efl/WKView.cpp:
+ (WKViewGetSize):
+ (WKViewSetSize):
+ * UIProcess/API/C/efl/WKView.h:
+ * UIProcess/API/efl/EwkView.cpp:
+ (EwkView::setDeviceScaleFactor):
+ (EwkView::size):
+ (EwkView::deviceSize):
+ (EwkView::scheduleUpdateDisplay):
+ (EwkView::handleEvasObjectCalculate):
+ * UIProcess/API/efl/EwkView.h:
+ (EwkView):
+ * UIProcess/efl/WebView.cpp:
+ (WebKit::WebView::setSize):
+ (WebKit):
+ (WebKit::WebView::paintToCurrentGLContext):
+ (WebKit::WebView::updateViewportSize):
+ (WebKit::WebView::viewSize):
+ (WebKit::WebView::dipSize):
+ * UIProcess/efl/WebView.h:
+ (WebView):
+ (WebKit::WebView::size):
+
2013-04-03 Anders Carlsson <ander...@apple.com>
Don't try to set the exception port for server connections
Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp (147616 => 147617)
--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp 2013-04-04 09:40:45 UTC (rev 147616)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp 2013-04-04 10:47:46 UTC (rev 147617)
@@ -40,6 +40,16 @@
toImpl(viewRef)->initialize();
}
+WKSize WKViewGetSize(WKViewRef viewRef)
+{
+ return toAPI(toImpl(viewRef)->size());
+}
+
+void WKViewSetSize(WKViewRef viewRef, WKSize size)
+{
+ toImpl(viewRef)->setSize(toIntSize(size));
+}
+
void WKViewSetViewClient(WKViewRef viewRef, const WKViewClient* client)
{
toImpl(viewRef)->initializeClient(client);
Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h (147616 => 147617)
--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h 2013-04-04 09:40:45 UTC (rev 147616)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h 2013-04-04 10:47:46 UTC (rev 147617)
@@ -52,6 +52,10 @@
WK_EXPORT WKViewRef WKViewCreate(WKContextRef context, WKPageGroupRef pageGroup);
WK_EXPORT void WKViewInitialize(WKViewRef);
+
+WK_EXPORT WKSize WKViewGetSize(WKViewRef);
+WK_EXPORT void WKViewSetSize(WKViewRef, WKSize size);
+
WK_EXPORT void WKViewSetViewClient(WKViewRef, const WKViewClient*);
WK_EXPORT void WKViewSetUserViewportTranslation(WKViewRef, double tx, double ty);
Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp (147616 => 147617)
--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp 2013-04-04 09:40:45 UTC (rev 147616)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp 2013-04-04 10:47:46 UTC (rev 147617)
@@ -465,10 +465,11 @@
void EwkView::setDeviceScaleFactor(float scale)
{
+ const WKSize& deviceSize = WKViewGetSize(wkView());
page()->setIntrinsicDeviceScaleFactor(scale);
// Update internal viewport size after device-scale change.
- setDeviceSize(deviceSize());
+ WKViewSetSize(wkView(), deviceSize);
}
float EwkView::deviceScaleFactor() const
@@ -476,31 +477,6 @@
return WKPageGetBackingScaleFactor(wkPage());
}
-void EwkView::setDeviceSize(const IntSize& deviceSize)
-{
- m_deviceSize = deviceSize;
-
- DrawingAreaProxy* drawingArea = page()->drawingArea();
- if (!drawingArea)
- return;
-
- drawingArea->setSize(size(), IntSize());
- webView()->updateViewportSize();
-}
-
-IntSize EwkView::size() const
-{
- // WebPage expects a size in UI units, and not raw device units.
- FloatSize uiSize = m_deviceSize;
- uiSize.scale(1 / deviceScaleFactor());
- return roundedIntSize(uiSize);
-}
-
-IntSize EwkView::deviceSize() const
-{
- return m_deviceSize;
-}
-
AffineTransform EwkView::transformToScreen() const
{
AffineTransform transform;
@@ -539,6 +515,19 @@
return toSmartData(m_evasObject);
}
+inline IntSize EwkView::size() const
+{
+ // WebPage expects a size in UI units, and not raw device units.
+ FloatSize uiSize = deviceSize();
+ uiSize.scale(1 / deviceScaleFactor());
+ return roundedIntSize(uiSize);
+}
+
+inline IntSize EwkView::deviceSize() const
+{
+ return toIntSize(WKViewGetSize(wkView()));
+}
+
void EwkView::displayTimerFired(Timer<EwkView>*)
{
Ewk_View_Smart_Data* sd = smartData();
@@ -571,7 +560,7 @@
void EwkView::scheduleUpdateDisplay()
{
- if (m_deviceSize.isEmpty())
+ if (deviceSize().isEmpty())
return;
if (!m_displayTimer.isActive())
@@ -1125,7 +1114,10 @@
smartData->view.w = width;
smartData->view.h = height;
- self->setDeviceSize(IntSize(width, height));
+ WKViewSetSize(self->wkView(), WKSizeMake(width, height));
+ if (WKPageUseFixedLayout(self->wkPage()))
+ self->pageViewportController()->didChangeViewportSize(self->size());
+
self->setNeedsSurfaceResize();
}
}
Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h (147616 => 147617)
--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h 2013-04-04 09:40:45 UTC (rev 147616)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h 2013-04-04 10:47:46 UTC (rev 147617)
@@ -125,9 +125,6 @@
void setDeviceScaleFactor(float scale);
float deviceScaleFactor() const;
- WebCore::IntSize size() const;
- WebCore::IntSize deviceSize() const;
-
WebCore::AffineTransform transformToScreen() const;
const char* url() const { return m_url; }
@@ -212,6 +209,9 @@
void setDeviceSize(const WebCore::IntSize&);
Ewk_View_Smart_Data* smartData() const;
+ WebCore::IntSize size() const;
+ WebCore::IntSize deviceSize() const;
+
void displayTimerFired(WebCore::Timer<EwkView>*);
// Evas_Smart_Class callback interface:
@@ -251,7 +251,6 @@
OwnPtr<Evas_GL> m_evasGL;
OwnPtr<WebKit::EvasGLContext> m_evasGLContext;
OwnPtr<WebKit::EvasGLSurface> m_evasGLSurface;
- WebCore::IntSize m_deviceSize;
WebCore::TransformationMatrix m_userViewportTransform;
bool m_pendingSurfaceResize;
OwnPtr<WebKit::PageLoadClientEfl> m_pageLoadClient;
Modified: trunk/Source/WebKit2/UIProcess/efl/WebView.cpp (147616 => 147617)
--- trunk/Source/WebKit2/UIProcess/efl/WebView.cpp 2013-04-04 09:40:45 UTC (rev 147616)
+++ trunk/Source/WebKit2/UIProcess/efl/WebView.cpp 2013-04-04 10:47:46 UTC (rev 147617)
@@ -95,6 +95,13 @@
scene->setActive(true);
}
+void WebView::setSize(const WebCore::IntSize& size)
+{
+ m_size = size;
+
+ updateViewportSize();
+}
+
void WebView::setUserViewportTranslation(double tx, double ty)
{
m_userViewportTransform = TransformationMatrix().translate(tx, ty);
@@ -113,8 +120,8 @@
// FIXME: We need to clean up this code as it is split over CoordGfx and Page.
scene->setDrawsBackground(m_page->drawsBackground());
+ const FloatRect& viewport = m_userViewportTransform.mapRect(IntRect(IntPoint(), m_size));
- FloatRect viewport = m_userViewportTransform.mapRect(IntRect(IntPoint(), m_ewkView->deviceSize()));
scene->paintToCurrentGLContext(transformToScene().toTransformationMatrix(), /* opacity */ 1, viewport);
}
@@ -206,17 +213,6 @@
m_ewkView->scheduleUpdateDisplay();
}
-void WebView::updateViewportSize()
-{
- if (m_page->useFixedLayout()) {
- m_ewkView->pageViewportController()->didChangeViewportSize(m_ewkView->size());
- return;
- }
- FloatPoint uiPosition(m_ewkView->pagePosition());
- uiPosition.scale(1 / m_ewkView->pageScaleFactor(), 1 / m_ewkView->pageScaleFactor());
- m_page->drawingArea()->setVisibleContentsRect(FloatRect(uiPosition, m_ewkView->size()), FloatPoint());
-}
-
void WebView::didChangeContentsSize(const WebCore::IntSize& size)
{
m_client.didChangeContentsSize(this, size);
@@ -252,6 +248,23 @@
return layerTreeHostProxy->coordinatedGraphicsScene();
}
+void WebView::updateViewportSize()
+{
+ if (DrawingAreaProxy* drawingArea = page()->drawingArea()) {
+ // Web Process expects sizes in UI units, and not raw device units.
+ drawingArea->setSize(roundedIntSize(dipSize()), IntSize());
+ drawingArea->setVisibleContentsRect(FloatRect(m_ewkView->pagePosition(), dipSize()), FloatPoint());
+ }
+}
+
+inline WebCore::FloatSize WebView::dipSize() const
+{
+ FloatSize dipSize(size());
+ dipSize.scale(1 / m_page->deviceScaleFactor());
+
+ return dipSize;
+}
+
// Page Client
PassOwnPtr<DrawingAreaProxy> WebView::createDrawingAreaProxy()
@@ -277,7 +290,7 @@
WebCore::IntSize WebView::viewSize()
{
- return m_ewkView->size();
+ return roundedIntSize(dipSize());
}
bool WebView::isViewWindowActive()
Modified: trunk/Source/WebKit2/UIProcess/efl/WebView.h (147616 => 147617)
--- trunk/Source/WebKit2/UIProcess/efl/WebView.h 2013-04-04 09:40:45 UTC (rev 147616)
+++ trunk/Source/WebKit2/UIProcess/efl/WebView.h 2013-04-04 10:47:46 UTC (rev 147617)
@@ -57,6 +57,9 @@
void initialize();
+ void setSize(const WebCore::IntSize&);
+ const WebCore::IntSize& size() const { return m_size; }
+
void setUserViewportTranslation(double tx, double ty);
WebCore::IntPoint userViewportToContents(const WebCore::IntPoint&) const;
@@ -89,8 +92,7 @@
Evas_Object* evasObject();
WebPageProxy* page() { return m_page.get(); }
- void didCommitLoad();
- void updateViewportSize();
+ void didCommitLoad();
void didChangeContentsSize(const WebCore::IntSize&);
// FIXME: Should become private when Web Events creation is moved to WebView.
@@ -101,6 +103,8 @@
WebView(WebContext*, WebPageGroup*);
WebCore::CoordinatedGraphicsScene* coordinatedGraphicsScene();
+ void updateViewportSize();
+ WebCore::FloatSize dipSize() const;
// PageClient
PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy() OVERRIDE;
@@ -180,6 +184,7 @@
RefPtr<WebPageProxy> m_page;
DefaultUndoController m_undoController;
WebCore::TransformationMatrix m_userViewportTransform;
+ WebCore::IntSize m_size; // Size in device units.
};
}