diff options
author | Bart Sears <bsears@google.com> | 2012-01-04 13:49:30 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-01-04 13:49:30 -0800 |
commit | 0d647bc28cc93eef51ec61acd0bb6e445eb2c276 (patch) | |
tree | ab516412bc9275f3bcf06daf2a007dac6494a9b5 | |
parent | 9a4df506f5f02fbd4cca2cde580324c45a0b56f5 (diff) | |
parent | d13df54b67ff2373e79cf6c70bd2369e556ec9c0 (diff) | |
download | external_webkit-0d647bc28cc93eef51ec61acd0bb6e445eb2c276.zip external_webkit-0d647bc28cc93eef51ec61acd0bb6e445eb2c276.tar.gz external_webkit-0d647bc28cc93eef51ec61acd0bb6e445eb2c276.tar.bz2 |
am d13df54b: Merge "Fix crash with composited layers - DO NOT MERGE" into ics-mr1
* commit 'd13df54b67ff2373e79cf6c70bd2369e556ec9c0':
Fix crash with composited layers - DO NOT MERGE
3 files changed, 51 insertions, 4 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index 6990503..567b54b 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -963,11 +963,31 @@ void GraphicsLayerAndroid::syncMask() } } -void GraphicsLayerAndroid::syncCompositingState() +void GraphicsLayerAndroid::gatherRootLayers(Vector<const RenderLayer*>& list) { - for (unsigned int i = 0; i < m_children.size(); i++) - m_children[i]->syncCompositingState(); + RenderLayer* renderLayer = renderLayerFromClient(m_client); + if (renderLayer) { + const RenderLayer* rootLayer = renderLayer->root(); + bool found = false; + for (unsigned int i = 0; i < list.size(); i++) { + const RenderLayer* current = list[i]; + if (current == rootLayer) { + found = true; + break; + } + } + if (!found) + list.append(rootLayer); + } + for (unsigned int i = 0; i < m_children.size(); i++) { + GraphicsLayerAndroid* layer = static_cast<GraphicsLayerAndroid*>(m_children[i]); + layer->gatherRootLayers(list); + } +} + +void GraphicsLayerAndroid::syncCompositingStateForThisLayerOnly() +{ updateScrollingLayers(); updateFixedPosition(); syncChildren(); @@ -977,6 +997,14 @@ void GraphicsLayerAndroid::syncCompositingState() repaint(); } +void GraphicsLayerAndroid::syncCompositingState() +{ + for (unsigned int i = 0; i < m_children.size(); i++) + m_children[i]->syncCompositingState(); + + syncCompositingStateForThisLayerOnly(); +} + void GraphicsLayerAndroid::notifyClientAnimationStarted() { for (unsigned int i = 0; i < m_children.size(); i++) diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.h b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.h index 358f674..e6d75b0 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.h +++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.h @@ -116,7 +116,9 @@ public: virtual void setZPosition(float); + void gatherRootLayers(Vector<const RenderLayer*>&); virtual void syncCompositingState(); + virtual void syncCompositingStateForThisLayerOnly(); void notifyClientAnimationStarted(); LayerAndroid* contentLayer() { return m_contentLayer; } diff --git a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index 7ff5b19..ab5fcb0 100644 --- a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -37,12 +37,15 @@ #include "FrameLoader.h" #include "FrameView.h" #include "Geolocation.h" +#include "GraphicsLayerAndroid.h" #include "HTMLMediaElement.h" #include "HTMLNames.h" #include "Icon.h" #include "LayerAndroid.h" #include "Page.h" #include "PopupMenuAndroid.h" +#include "RenderLayer.h" +#include "RenderLayerCompositor.h" #include "ScriptController.h" #include "SearchPopupMenuAndroid.h" #include "WebCoreFrameBridge.h" @@ -64,7 +67,21 @@ static unsigned long long tryToReclaimDatabaseQuota(SecurityOrigin* originNeedin WebCore::GraphicsLayer* ChromeClientAndroid::layersSync() { if (m_rootGraphicsLayer && m_needsLayerSync && m_webFrame) { - if (FrameView* frameView = m_webFrame->page()->mainFrame()->view()) + // We may have more than one frame, so let's first update all of them + // (webkit may want to update the GraphicsLayer tree, and we do *not* want + // to find this out when we are painting, as it means we could be summarily + // deallocated while painting...) + GraphicsLayerAndroid* rootLayer = static_cast<GraphicsLayerAndroid*>(m_rootGraphicsLayer); + Vector<const RenderLayer*> listRootLayers; + rootLayer->gatherRootLayers(listRootLayers); + + for (unsigned int i = 0; i < listRootLayers.size(); i++) { + RenderLayer* layer = const_cast<RenderLayer*>(listRootLayers[i]); + layer->compositor()->updateCompositingLayers(); + } + + Frame* frame = m_webFrame->page()->mainFrame(); + if (FrameView* frameView = frame->view()) frameView->syncCompositingStateIncludingSubframes(); } m_needsLayerSync = false; |