Merge "Put canvas on a layer" into ics-mr1
diff --git a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index 8358b2a..7ec2d78 100644
--- a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -370,8 +370,7 @@
         updateLayerPositions(visibleRect);
         // For now, we render layers only if the rendering mode
         // is kAllTextures or kClippedTextures
-        if (m_state->layersRenderingMode() < GLWebViewState::kScrollableAndFixedLayers
-            && compositedRoot->drawGL()) {
+        if (compositedRoot->drawGL()) {
             if (TilesManager::instance()->layerTexturesRemain()) {
                 // only try redrawing for layers if layer textures remain,
                 // otherwise we'll repaint without getting anything done
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index 5206b7a..a33c3d0 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -379,6 +379,9 @@
     if (nbTexturesNeeded.full < maxTextures)
         m_layersRenderingMode = kAllTextures;
 
+    if (!maxTextures && !nbTexturesNeeded.full)
+        m_layersRenderingMode = kAllTextures;
+
     if (m_layersRenderingMode < layersRenderingMode
         && m_layersRenderingMode != kAllTextures)
         invalBase = true;
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
index 9e7626a..859973a 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -1115,11 +1115,13 @@
 
     bool askScreenUpdate = false;
 
-    if (m_texture)
-        askScreenUpdate |= m_texture->draw();
+    if (m_state->layersRenderingMode() < GLWebViewState::kScrollableAndFixedLayers) {
+        if (m_texture)
+            askScreenUpdate |= m_texture->draw();
 
-    if (m_imageTexture)
-        m_imageTexture->drawGL(this);
+        if (m_imageTexture)
+            m_imageTexture->drawGL(this);
+    }
 
     // When the layer is dirty, the UI thread should be notified to redraw.
     askScreenUpdate |= drawChildrenGL();