diff options
| author | Nicolas Roard <nicolas@android.com> | 2010-01-04 19:33:17 +0000 |
|---|---|---|
| committer | Nicolas Roard <nicolas@android.com> | 2010-01-04 19:33:17 +0000 |
| commit | 9acd586e4a0aa54e4f630665aa0d3c8c95b78e72 (patch) | |
| tree | 97f62cc64e391bde4a9436791e844dda7ed3f76a /WebKit/android/WebCoreSupport | |
| parent | 5bd553b63661fa0f711bb9c02566d5df80a9432f (diff) | |
| download | external_webkit-9acd586e4a0aa54e4f630665aa0d3c8c95b78e72.zip external_webkit-9acd586e4a0aa54e4f630665aa0d3c8c95b78e72.tar.gz external_webkit-9acd586e4a0aa54e4f630665aa0d3c8c95b78e72.tar.bz2 | |
webkit layers support
Diffstat (limited to 'WebKit/android/WebCoreSupport')
| -rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp | 63 | ||||
| -rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.h | 26 | ||||
| -rw-r--r-- | WebKit/android/WebCoreSupport/PlatformBridge.cpp | 19 |
3 files changed, 104 insertions, 4 deletions
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index 8390cbc..f14c2c1 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -38,6 +38,7 @@ #include "FrameLoader.h" #include "FrameView.h" #include "Geolocation.h" +#include "GraphicsLayerAndroid.h" #include "Page.h" #include "Screen.h" #include "ScriptController.h" @@ -49,6 +50,68 @@ namespace android { +#if USE(ACCELERATED_COMPOSITING) + +void ChromeClientAndroid::syncTimerFired(Timer<ChromeClientAndroid>* client) +{ + m_syncTimer.stop(); + compositingLayerSync(); +} + +void ChromeClientAndroid::compositingLayerSync() +{ + if (!m_rootGraphicsLayer) { + scheduleCompositingLayerSync(); + return; + } + + if (m_webFrame) { + FrameView* frameView = m_webFrame->page()->mainFrame()->view(); + if (frameView && !frameView->layoutPending() && !frameView->needsLayout()) { + frameView->syncCompositingStateRecursive(); + GraphicsLayerAndroid* androidGraphicsLayer = + static_cast<GraphicsLayerAndroid*>(m_rootGraphicsLayer); + if (androidGraphicsLayer) + androidGraphicsLayer->sendImmediateRepaint(); + return; + } + } + if (m_askToDrawAgain) { + m_askToDrawAgain = false; + scheduleCompositingLayerSync(); + } +} + +void ChromeClientAndroid::scheduleCompositingLayerSync() +{ + if (!m_syncTimer.isActive()) + m_syncTimer.startOneShot(0.001); // 1ms + else + m_askToDrawAgain = true; +} + +void ChromeClientAndroid::setNeedsOneShotDrawingSynchronization() +{ + // This should not be needed +} + +void ChromeClientAndroid::attachRootGraphicsLayer(WebCore::Frame* frame, WebCore::GraphicsLayer* layer) +{ + m_rootGraphicsLayer = layer; + if (!layer) { + WebViewCore::getWebViewCore(frame->view())->setRootLayer(0); + return; + } + WebCore::GraphicsLayerAndroid* androidGraphicsLayer = static_cast<GraphicsLayerAndroid*>(layer); + if (frame && frame->view() && androidGraphicsLayer) { + androidGraphicsLayer->setFrame(frame); + WebCore::LayerAndroid* androidLayer = new LayerAndroid(androidGraphicsLayer->contentLayer()); + WebViewCore::getWebViewCore(frame->view())->setRootLayer((int)androidLayer); + } +} + +#endif + void ChromeClientAndroid::setWebFrame(android::WebFrame* webframe) { Release(m_webFrame); diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h index 7396997..45dd078 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h @@ -43,7 +43,13 @@ namespace android { class ChromeClientAndroid : public ChromeClient { public: - ChromeClientAndroid() : m_webFrame(0), m_geolocationPermissions(0) { } + ChromeClientAndroid() : m_webFrame(0), m_geolocationPermissions(0) +#if USE(ACCELERATED_COMPOSITING) + , m_rootGraphicsLayer(0) + , m_askToDrawAgain(false) + , m_syncTimer(this, &ChromeClientAndroid::syncTimerFired) +#endif + { } virtual void chromeDestroyed(); virtual void setWindowRect(const FloatRect&); @@ -149,13 +155,27 @@ namespace android { // Android-specific void setWebFrame(android::WebFrame* webframe); void wakeUpMainThreadWithNewQuota(long newQuota); + +#if USE(ACCELERATED_COMPOSITING) + virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer* g); + virtual void setNeedsOneShotDrawingSynchronization(); + virtual void scheduleCompositingLayerSync(); + void compositingLayerSync(); + void syncTimerFired(Timer<ChromeClientAndroid>*); +#endif + private: android::WebFrame* m_webFrame; + // The Geolocation permissions manager. + OwnPtr<GeolocationPermissions> m_geolocationPermissions; +#if USE(ACCELERATED_COMPOSITING) + WebCore::GraphicsLayer* m_rootGraphicsLayer; + bool m_askToDrawAgain; + Timer<ChromeClientAndroid> m_syncTimer; +#endif WTF::ThreadCondition m_quotaThreadCondition; WTF::Mutex m_quotaThreadLock; long m_newQuota; - // The Geolocation permissions manager. - OwnPtr<GeolocationPermissions> m_geolocationPermissions; }; } diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp index e4fe4ce..e93d3da 100644 --- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -28,11 +28,28 @@ #include "JavaSharedClient.h" #include "KeyGeneratorClient.h" +#include "WebViewCore.h" using namespace android; namespace WebCore { +#if USE(ACCELERATED_COMPOSITING) + +void PlatformBridge::setRootLayer(const WebCore::FrameView* view, int layer) +{ + android::WebViewCore* core = android::WebViewCore::getWebViewCore(view); + core->setRootLayer(layer); +} + +void PlatformBridge::immediateRepaint(const WebCore::FrameView* view) +{ + android::WebViewCore* core = android::WebViewCore::getWebViewCore(view); + core->immediateRepaint(); +} + +#endif // USE(ACCELERATED_COMPOSITING) + WTF::Vector<String> PlatformBridge::getSupportedKeyStrengthList() { KeyGeneratorClient* client = JavaSharedClient::GetKeyGeneratorClient(); @@ -51,4 +68,4 @@ String PlatformBridge::getSignedPublicKeyAndChallengeString(unsigned index, cons return client->getSignedPublicKeyAndChallengeString(index, challenge, url); } -}
\ No newline at end of file +} |
