Commit a2ccb1f3 authored by eric@webkit.org's avatar eric@webkit.org

2010-05-04 Vangelis Kokkevis <vangelis@chromium.org>

        Reviewed by Darin Fisher.

        Provide an API for querying whether a WebWidget is using gpu accelerated compositing.
        Also changed: isAcceleratedCompositing to: isAcceleratedCompositingActive.
        https://bugs.webkit.org/show_bug.cgi?id=38220

        * public/WebWidget.h:
        * src/WebPopupMenuImpl.h:
        (WebKit::WebPopupMenuImpl::isAcceleratedCompositingActive):
        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::WebViewImpl):
        (WebKit::WebViewImpl::paint):
        (WebKit::WebViewImpl::isAcceleratedCompositingActive):
        (WebKit::WebViewImpl::setRootGraphicsLayer):
        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
        (WebKit::WebViewImpl::updateRootLayerContents):
        * src/WebViewImpl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58793 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c4eeafc6
2010-05-04 Vangelis Kokkevis <vangelis@chromium.org>
Reviewed by Darin Fisher.
Provide an API for querying whether a WebWidget is using gpu accelerated compositing.
Also changed: isAcceleratedCompositing to: isAcceleratedCompositingActive.
https://bugs.webkit.org/show_bug.cgi?id=38220
* public/WebWidget.h:
* src/WebPopupMenuImpl.h:
(WebKit::WebPopupMenuImpl::isAcceleratedCompositingActive):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):
(WebKit::WebViewImpl::paint):
(WebKit::WebViewImpl::isAcceleratedCompositingActive):
(WebKit::WebViewImpl::setRootGraphicsLayer):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
(WebKit::WebViewImpl::updateRootLayerContents):
* src/WebViewImpl.h:
2010-04-29 John Gregg <johnnyg@google.com>
Reviewed by Dmitry Titov.
......
......@@ -90,6 +90,10 @@ public:
// Changes the text direction of the selected input node.
virtual void setTextDirection(WebTextDirection) = 0;
// Returns true if the WebWidget uses GPU accelerated compositing
// to render its contents.
virtual bool isAcceleratedCompositingActive() const = 0;
protected:
~WebWidget() { }
};
......
......@@ -75,6 +75,7 @@ public:
int targetStart, int targetEnd, const WebString& text);
virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect);
virtual void setTextDirection(WebTextDirection direction);
virtual bool isAcceleratedCompositingActive() const { return false; }
// WebPopupMenuImpl
void Init(WebCore::FramelessScrollView* widget,
......
......@@ -242,7 +242,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_haveMouseCapture(false)
#if USE(ACCELERATED_COMPOSITING)
, m_layerRenderer(0)
, m_isAcceleratedCompositing(false)
, m_isAcceleratedCompositingActive(false)
#endif
{
// WebKit/win/WebView.cpp does the same thing, except they call the
......@@ -944,7 +944,7 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
{
#if USE(ACCELERATED_COMPOSITING)
if (!isAcceleratedCompositing()) {
if (!isAcceleratedCompositingActive()) {
#endif
WebFrameImpl* webframe = mainFrameImpl();
if (webframe)
......@@ -1280,6 +1280,15 @@ void WebViewImpl::setTextDirection(WebTextDirection direction)
}
}
bool WebViewImpl::isAcceleratedCompositingActive() const
{
#if USE(ACCELERATED_COMPOSITING)
return m_isAcceleratedCompositingActive;
#else
return false;
#endif
}
// WebView --------------------------------------------------------------------
WebSettings* WebViewImpl::settings()
......@@ -2057,29 +2066,29 @@ bool WebViewImpl::tabsToLinks() const
#if USE(ACCELERATED_COMPOSITING)
void WebViewImpl::setRootGraphicsLayer(WebCore::PlatformLayer* layer)
{
setAcceleratedCompositing(layer ? true : false);
setIsAcceleratedCompositingActive(layer ? true : false);
if (m_layerRenderer)
m_layerRenderer->setRootLayer(layer);
}
void WebViewImpl::setAcceleratedCompositing(bool accelerated)
void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
{
if (m_isAcceleratedCompositing == accelerated)
if (m_isAcceleratedCompositingActive == active)
return;
if (accelerated) {
if (active) {
m_layerRenderer = LayerRendererChromium::create();
if (m_layerRenderer)
m_isAcceleratedCompositing = true;
m_isAcceleratedCompositingActive = true;
} else {
m_layerRenderer = 0;
m_isAcceleratedCompositing = false;
m_isAcceleratedCompositingActive = false;
}
}
void WebViewImpl::updateRootLayerContents(const WebRect& rect)
{
if (!isAcceleratedCompositing())
if (!isAcceleratedCompositingActive())
return;
WebFrameImpl* webframe = mainFrameImpl();
......
......@@ -100,6 +100,7 @@ public:
virtual bool queryCompositionStatus(bool* enabled,
WebRect* caretRect);
virtual void setTextDirection(WebTextDirection direction);
virtual bool isAcceleratedCompositingActive() const;
// WebView methods:
virtual void initializeMainFrame(WebFrameClient*);
......@@ -359,8 +360,7 @@ private:
DragAction);
#if USE(ACCELERATED_COMPOSITING)
void setAcceleratedCompositing(bool);
bool isAcceleratedCompositing() const { return m_isAcceleratedCompositing; }
void setIsAcceleratedCompositingActive(bool);
void updateRootLayerContents(const WebRect&);
#endif
......@@ -496,7 +496,7 @@ private:
#if USE(ACCELERATED_COMPOSITING)
OwnPtr<WebCore::LayerRendererChromium> m_layerRenderer;
bool m_isAcceleratedCompositing;
bool m_isAcceleratedCompositingActive;
#endif
static const WebInputEvent* m_currentInputEvent;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment