external/webkit
Revisión | d13df54b67ff2373e79cf6c70bd2369e556ec9c0 (tree) |
---|---|
Tiempo | 2012-01-05 06:46:46 |
Autor | Bart Sears <bsears@goog...> |
Commiter | Android (Google) Code Review |
Merge "Fix crash with composited layers - DO NOT MERGE" into ics-mr1
@@ -963,11 +963,31 @@ void GraphicsLayerAndroid::syncMask() | ||
963 | 963 | } |
964 | 964 | } |
965 | 965 | |
966 | -void GraphicsLayerAndroid::syncCompositingState() | |
966 | +void GraphicsLayerAndroid::gatherRootLayers(Vector<const RenderLayer*>& list) | |
967 | 967 | { |
968 | - for (unsigned int i = 0; i < m_children.size(); i++) | |
969 | - m_children[i]->syncCompositingState(); | |
968 | + RenderLayer* renderLayer = renderLayerFromClient(m_client); | |
969 | + if (renderLayer) { | |
970 | + const RenderLayer* rootLayer = renderLayer->root(); | |
971 | + bool found = false; | |
972 | + for (unsigned int i = 0; i < list.size(); i++) { | |
973 | + const RenderLayer* current = list[i]; | |
974 | + if (current == rootLayer) { | |
975 | + found = true; | |
976 | + break; | |
977 | + } | |
978 | + } | |
979 | + if (!found) | |
980 | + list.append(rootLayer); | |
981 | + } | |
970 | 982 | |
983 | + for (unsigned int i = 0; i < m_children.size(); i++) { | |
984 | + GraphicsLayerAndroid* layer = static_cast<GraphicsLayerAndroid*>(m_children[i]); | |
985 | + layer->gatherRootLayers(list); | |
986 | + } | |
987 | +} | |
988 | + | |
989 | +void GraphicsLayerAndroid::syncCompositingStateForThisLayerOnly() | |
990 | +{ | |
971 | 991 | updateScrollingLayers(); |
972 | 992 | updateFixedPosition(); |
973 | 993 | syncChildren(); |
@@ -977,6 +997,14 @@ void GraphicsLayerAndroid::syncCompositingState() | ||
977 | 997 | repaint(); |
978 | 998 | } |
979 | 999 | |
1000 | +void GraphicsLayerAndroid::syncCompositingState() | |
1001 | +{ | |
1002 | + for (unsigned int i = 0; i < m_children.size(); i++) | |
1003 | + m_children[i]->syncCompositingState(); | |
1004 | + | |
1005 | + syncCompositingStateForThisLayerOnly(); | |
1006 | +} | |
1007 | + | |
980 | 1008 | void GraphicsLayerAndroid::notifyClientAnimationStarted() |
981 | 1009 | { |
982 | 1010 | for (unsigned int i = 0; i < m_children.size(); i++) |
@@ -116,7 +116,9 @@ public: | ||
116 | 116 | |
117 | 117 | virtual void setZPosition(float); |
118 | 118 | |
119 | + void gatherRootLayers(Vector<const RenderLayer*>&); | |
119 | 120 | virtual void syncCompositingState(); |
121 | + virtual void syncCompositingStateForThisLayerOnly(); | |
120 | 122 | void notifyClientAnimationStarted(); |
121 | 123 | |
122 | 124 | LayerAndroid* contentLayer() { return m_contentLayer; } |
@@ -37,12 +37,15 @@ | ||
37 | 37 | #include "FrameLoader.h" |
38 | 38 | #include "FrameView.h" |
39 | 39 | #include "Geolocation.h" |
40 | +#include "GraphicsLayerAndroid.h" | |
40 | 41 | #include "HTMLMediaElement.h" |
41 | 42 | #include "HTMLNames.h" |
42 | 43 | #include "Icon.h" |
43 | 44 | #include "LayerAndroid.h" |
44 | 45 | #include "Page.h" |
45 | 46 | #include "PopupMenuAndroid.h" |
47 | +#include "RenderLayer.h" | |
48 | +#include "RenderLayerCompositor.h" | |
46 | 49 | #include "ScriptController.h" |
47 | 50 | #include "SearchPopupMenuAndroid.h" |
48 | 51 | #include "WebCoreFrameBridge.h" |
@@ -64,7 +67,21 @@ static unsigned long long tryToReclaimDatabaseQuota(SecurityOrigin* originNeedin | ||
64 | 67 | WebCore::GraphicsLayer* ChromeClientAndroid::layersSync() |
65 | 68 | { |
66 | 69 | if (m_rootGraphicsLayer && m_needsLayerSync && m_webFrame) { |
67 | - if (FrameView* frameView = m_webFrame->page()->mainFrame()->view()) | |
70 | + // We may have more than one frame, so let's first update all of them | |
71 | + // (webkit may want to update the GraphicsLayer tree, and we do *not* want | |
72 | + // to find this out when we are painting, as it means we could be summarily | |
73 | + // deallocated while painting...) | |
74 | + GraphicsLayerAndroid* rootLayer = static_cast<GraphicsLayerAndroid*>(m_rootGraphicsLayer); | |
75 | + Vector<const RenderLayer*> listRootLayers; | |
76 | + rootLayer->gatherRootLayers(listRootLayers); | |
77 | + | |
78 | + for (unsigned int i = 0; i < listRootLayers.size(); i++) { | |
79 | + RenderLayer* layer = const_cast<RenderLayer*>(listRootLayers[i]); | |
80 | + layer->compositor()->updateCompositingLayers(); | |
81 | + } | |
82 | + | |
83 | + Frame* frame = m_webFrame->page()->mainFrame(); | |
84 | + if (FrameView* frameView = frame->view()) | |
68 | 85 | frameView->syncCompositingStateIncludingSubframes(); |
69 | 86 | } |
70 | 87 | m_needsLayerSync = false; |