Title: [150012] trunk/Source/WebKit2
Revision
150012
Author
[email protected]
Date
2013-05-13 07:59:15 -0700 (Mon, 13 May 2013)

Log Message

[WK2][CoordinatedGraphics] WKView needs API for handling opacity
https://bugs.webkit.org/show_bug.cgi?id=116032

Patch by Jesus Sanchez-Palencia <[email protected]> on 2013-05-13
Reviewed by Kenneth Rohde Christiansen.

Add WKViewSetOpacity and WKViewOpacity APIs and use them in
WebView.cpp.

* UIProcess/API/C/CoordinatedGraphics/WKView.cpp:
(WKViewSetOpacity):
(WKViewOpacity):
* UIProcess/API/C/CoordinatedGraphics/WKView.h:
* UIProcess/CoordinatedGraphics/WebView.cpp:
(WebKit::WebView::WebView):
(WebKit::WebView::paintToCurrentGLContext):
* UIProcess/CoordinatedGraphics/WebView.h:
(WebKit::WebView::setOpacity):
(WebKit::WebView::opacity):
(WebView):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (150011 => 150012)


--- trunk/Source/WebKit2/ChangeLog	2013-05-13 14:55:38 UTC (rev 150011)
+++ trunk/Source/WebKit2/ChangeLog	2013-05-13 14:59:15 UTC (rev 150012)
@@ -1,3 +1,25 @@
+2013-05-13  Jesus Sanchez-Palencia  <[email protected]>
+
+        [WK2][CoordinatedGraphics] WKView needs API for handling opacity
+        https://bugs.webkit.org/show_bug.cgi?id=116032
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add WKViewSetOpacity and WKViewOpacity APIs and use them in
+        WebView.cpp.
+
+        * UIProcess/API/C/CoordinatedGraphics/WKView.cpp:
+        (WKViewSetOpacity):
+        (WKViewOpacity):
+        * UIProcess/API/C/CoordinatedGraphics/WKView.h:
+        * UIProcess/CoordinatedGraphics/WebView.cpp:
+        (WebKit::WebView::WebView):
+        (WebKit::WebView::paintToCurrentGLContext):
+        * UIProcess/CoordinatedGraphics/WebView.h:
+        (WebKit::WebView::setOpacity):
+        (WebKit::WebView::opacity):
+        (WebView):
+
 2013-05-13  Zan Dobersek  <[email protected]>
 
         [GTK] Use WebCore layer archives for TestWebCore, WebKitPluginProcess

Modified: trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp (150011 => 150012)


--- trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp	2013-05-13 14:55:38 UTC (rev 150011)
+++ trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp	2013-05-13 14:59:15 UTC (rev 150012)
@@ -166,4 +166,14 @@
 #endif
 }
 
+void WKViewSetOpacity(WKViewRef view, double opacity)
+{
+    toImpl(view)->setOpacity(opacity);
+}
+
+double WKViewOpacity(WKViewRef view)
+{
+    return toImpl(view)->opacity();
+}
+
 #endif // USE(COORDINATED_GRAPHICS)

Modified: trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h (150011 => 150012)


--- trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h	2013-05-13 14:55:38 UTC (rev 150011)
+++ trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h	2013-05-13 14:59:15 UTC (rev 150012)
@@ -98,6 +98,9 @@
 
 WK_EXPORT bool WKViewExitFullScreen(WKViewRef);
 
+WK_EXPORT void WKViewSetOpacity(WKViewRef view, double opacity);
+WK_EXPORT double WKViewOpacity(WKViewRef view);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp (150011 => 150012)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp	2013-05-13 14:55:38 UTC (rev 150011)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp	2013-05-13 14:59:15 UTC (rev 150012)
@@ -49,6 +49,7 @@
     , m_focused(false)
     , m_visible(false)
     , m_contentScaleFactor(1.0)
+    , m_opacity(1.0)
 {
     m_page->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
     m_page->pageGroup()->preferences()->setForceCompositingMode(true);
@@ -119,7 +120,7 @@
     scene->setDrawsBackground(m_page->drawsBackground());
     const FloatRect& viewport = m_userViewportTransform.mapRect(IntRect(IntPoint(), m_size));
 
-    scene->paintToCurrentGLContext(transformToScene().toTransformationMatrix(), /* opacity */ 1, viewport);
+    scene->paintToCurrentGLContext(transformToScene().toTransformationMatrix(), m_opacity, viewport);
 }
 
 void WebView::setDrawsBackground(bool drawsBackground)

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h (150011 => 150012)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h	2013-05-13 14:55:38 UTC (rev 150011)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h	2013-05-13 14:59:15 UTC (rev 150012)
@@ -102,6 +102,9 @@
     WebCore::AffineTransform transformFromScene() const;
     WebCore::AffineTransform transformToScene() const;
 
+    void setOpacity(double opacity) { m_opacity = clampTo(opacity, 0.0, 1.0); }
+    double opacity() const { return m_opacity; }
+
 protected:
     WebView(WebContext*, WebPageGroup*);
     WebCore::CoordinatedGraphicsScene* coordinatedGraphicsScene();
@@ -190,6 +193,7 @@
     bool m_focused;
     bool m_visible;
     float m_contentScaleFactor;
+    double m_opacity;
     WebCore::FloatPoint m_contentPosition; // Position in UI units.
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to