Title: [104651] trunk/Source
Revision
104651
Author
ostapenko.viatches...@nokia.com
Date
2012-01-10 16:42:11 -0800 (Tue, 10 Jan 2012)

Log Message

[Qt][WK2]REGRESSION(r102435): It made tst_QQuickWebView::show() crash
https://bugs.webkit.org/show_bug.cgi?id=74176

Reviewed by Noam Rosenthal.

Source/WebCore:

Replaces static global GL resource holder with holder shared between
TextureMapperGL instances created on the same GL context. Also adds
deallocation of GL resources when last TextureMapperGL instance on the
current GL context gets deleted.

Tested by multipleWebViewWindows and multipleWebViews Qt WK2 API tests.

* platform/graphics/opengl/TextureMapperGL.cpp:
(WebCore::TextureMapperGLData::SharedGLData::getCurrentGLContext):
(WebCore::TextureMapperGLData::SharedGLData::glContextDataMap):
(WebCore::TextureMapperGLData::SharedGLData::currentSharedGLData):
(WebCore::TextureMapperGLData::SharedGLData::ProgramInfo::ProgramInfo):
(WebCore::TextureMapperGLData::SharedGLData::createShaderProgram):
(WebCore::TextureMapperGLData::SharedGLData::deleteShaderProgram):
(WebCore::TextureMapperGLData::SharedGLData::SharedGLData):
(WebCore::TextureMapperGLData::SharedGLData::~SharedGLData):
(WebCore::TextureMapperGLData::sharedGLData):
(WebCore::TextureMapperGLData::TextureMapperGLData):
(WebCore::TextureMapperGLData::SharedGLData::initializeShaders):
(WebCore::TextureMapperGL::beginPainting):
(WebCore::TextureMapperGL::drawTexture):
(WebCore::BitmapTextureGL::bind):
(WebCore::TextureMapperGL::bindSurface):
(WebCore::TextureMapperGL::beginClip):
(WebCore::TextureMapperGL::endClip):
* platform/graphics/opengl/TextureMapperGL.h:

Source/WebKit2:

Check texture mapper exists already in ensureRootLayer to avoid recrecation.
Check if root layer was deleted already in purgeGLResources.
Added multipleWebViewWindows and multipleWebViews API tests.

* UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
(tst_QQuickWebView::multipleWebViewWindows):
(tst_QQuickWebView::multipleWebViews):
* UIProcess/qt/LayerTreeHostProxyQt.cpp:
(WebKit::LayerTreeHostProxy::ensureRootLayer):
(WebKit::LayerTreeHostProxy::purgeGLResources):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104650 => 104651)


--- trunk/Source/WebCore/ChangeLog	2012-01-11 00:39:01 UTC (rev 104650)
+++ trunk/Source/WebCore/ChangeLog	2012-01-11 00:42:11 UTC (rev 104651)
@@ -1,3 +1,37 @@
+2012-01-10  Viatcheslav Ostapenko  <ostapenko.viatches...@nokia.com>
+
+        [Qt][WK2]REGRESSION(r102435): It made tst_QQuickWebView::show() crash
+        https://bugs.webkit.org/show_bug.cgi?id=74176
+
+        Reviewed by Noam Rosenthal.
+
+        Replaces static global GL resource holder with holder shared between
+        TextureMapperGL instances created on the same GL context. Also adds
+        deallocation of GL resources when last TextureMapperGL instance on the 
+        current GL context gets deleted.
+
+        Tested by multipleWebViewWindows and multipleWebViews Qt WK2 API tests.
+
+        * platform/graphics/opengl/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGLData::SharedGLData::getCurrentGLContext):
+        (WebCore::TextureMapperGLData::SharedGLData::glContextDataMap):
+        (WebCore::TextureMapperGLData::SharedGLData::currentSharedGLData):
+        (WebCore::TextureMapperGLData::SharedGLData::ProgramInfo::ProgramInfo):
+        (WebCore::TextureMapperGLData::SharedGLData::createShaderProgram):
+        (WebCore::TextureMapperGLData::SharedGLData::deleteShaderProgram):
+        (WebCore::TextureMapperGLData::SharedGLData::SharedGLData):
+        (WebCore::TextureMapperGLData::SharedGLData::~SharedGLData):
+        (WebCore::TextureMapperGLData::sharedGLData):
+        (WebCore::TextureMapperGLData::TextureMapperGLData):
+        (WebCore::TextureMapperGLData::SharedGLData::initializeShaders):
+        (WebCore::TextureMapperGL::beginPainting):
+        (WebCore::TextureMapperGL::drawTexture):
+        (WebCore::BitmapTextureGL::bind):
+        (WebCore::TextureMapperGL::bindSurface):
+        (WebCore::TextureMapperGL::beginClip):
+        (WebCore::TextureMapperGL::endClip):
+        * platform/graphics/opengl/TextureMapperGL.h:
+
 2012-01-10  Simon Fraser  <simon.fra...@apple.com>
 
         Disabled mock scrollbars should draw differently

Modified: trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp (104650 => 104651)


--- trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp	2012-01-11 00:39:01 UTC (rev 104650)
+++ trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp	2012-01-11 00:42:11 UTC (rev 104651)
@@ -41,6 +41,16 @@
 #include <GL/gl.h>
 #endif
 
+#if defined(TEXMAP_OPENGL_ES_2)
+#include <EGL/egl.h>
+#elif OS(WINDOWS)
+#include <windows.h>
+#elif OS(MAC_OS_X)
+#include <AGL/agl.h>
+#elif defined(XP_UNIX)
+#include <GL/glx.h>
+#endif
+
 #if !defined(TEXMAP_OPENGL_ES_2) && !PLATFORM(QT)
 extern "C" {
     void glUniform1f(GLint, GLfloat);
@@ -103,7 +113,60 @@
 #endif
 
 struct TextureMapperGLData {
-    static struct GlobalGLData {
+    struct SharedGLData : public RefCounted<SharedGLData> {
+#if defined(TEXMAP_OPENGL_ES_2)
+        typedef EGLContext GLContext;
+        static GLContext getCurrentGLContext()
+        {
+            return eglGetCurrentContext();
+        }
+#elif OS(WINDOWS)
+        typedef HGLRC GLContext;
+        static GLContext getCurrentGLContext()
+        {
+            return wglGetCurrentContext();
+        }
+#elif OS(MAC_OS_X)
+        typedef AGLContext GLContext;
+        static GLContext getCurrentGLContext()
+        {
+            return aglGetCurrentContext();
+        }
+#elif defined(XP_UNIX)
+        typedef GLXContext GLContext;
+        static GLContext getCurrentGLContext()
+        {
+            return glXGetCurrentContext();
+        }
+#else
+        // Default implementation for unknown opengl.
+        // Returns always increasing number and disables GL context data sharing.
+        typedef unsigned int GLContext;
+        static GLContext getCurrentGLContext()
+        {
+            static GLContext dummyContextCounter = 0;
+            return ++dummyContextCounter;
+        }
+
+#endif
+
+        typedef HashMap<GLContext, SharedGLData*> GLContextDataMap;
+        static GLContextDataMap& glContextDataMap()
+        {
+            static GLContextDataMap map;
+            return map;
+        }
+
+        static PassRefPtr<SharedGLData> currentSharedGLData()
+        {
+            GLContext currentGLConext = getCurrentGLContext();
+            GLContextDataMap::iterator it = glContextDataMap().find(currentGLConext);
+            if (it != glContextDataMap().end())
+                return it->second;
+
+            return adoptRef(new SharedGLData(getCurrentGLContext()));
+        }
+
         enum ShaderProgramIndex {
             NoProgram = -1,
             SimpleProgram,
@@ -128,6 +191,9 @@
             GLuint id;
             GLuint vertexAttrib;
             GLint vars[VariableCount];
+            GLuint vertexShader;
+            GLuint fragmentShader;
+            ProgramInfo() : id(0) { }
         };
 
         GLint getUniformLocation(ShaderProgramIndex prog, ShaderVariableIndex var, const char* name)
@@ -149,17 +215,54 @@
             GL_CMD(glLinkProgram(programID))
             programs[index].vertexAttrib = glGetAttribLocation(programID, "InVertex");
             programs[index].id = programID;
+            programs[index].vertexShader = vertexShader;
+            programs[index].fragmentShader = fragmentShader;
         }
 
+        void deleteShaderProgram(ShaderProgramIndex index)
+        {
+            ProgramInfo& programInfo = programs[index];
+            GLuint programID = programInfo.id;
+            if (!programID)
+                return;
+
+            GL_CMD(glDetachShader(programID, programInfo.vertexShader))
+            GL_CMD(glDeleteShader(programInfo.vertexShader))
+            GL_CMD(glDetachShader(programID, programInfo.fragmentShader))
+            GL_CMD(glDeleteShader(programInfo.fragmentShader))
+            GL_CMD(glDeleteProgram(programID))
+        }
+
+        void initializeShaders();
+
         ProgramInfo programs[ProgramCount];
 
         int stencilIndex;
 
-        GlobalGLData()
-            : stencilIndex(1)
-        { }
-    } globalGLData;
+        SharedGLData(GLContext glContext) : stencilIndex(1)
+        {
+            glContextDataMap().add(glContext, this);
+            initializeShaders();
+        }
 
+        ~SharedGLData()
+        {
+            for (int i = SimpleProgram; i < ProgramCount; ++i)
+                deleteShaderProgram(ShaderProgramIndex(i));
+
+            GLContextDataMap::const_iterator end = glContextDataMap().end();
+            GLContextDataMap::iterator it;
+            for (it = glContextDataMap().begin(); it != end; ++it) {
+                if (it->second == this)
+                    break;
+            }
+
+            ASSERT(it != end);
+            glContextDataMap().remove(it);
+        }
+
+    };
+
     struct DirectlyCompositedImageRepository {
         struct Entry {
             GLuint texture;
@@ -211,17 +314,22 @@
         }
     } directlyCompositedImages;
 
+    SharedGLData& sharedGLData() const
+    {
+        return *(m_sharedGLData.get());
+    }
+
     TextureMapperGLData()
-        : currentProgram(TextureMapperGLData::GlobalGLData::NoProgram)
+        : currentProgram(SharedGLData::NoProgram)
+        , m_sharedGLData(TextureMapperGLData::SharedGLData::currentSharedGLData())
     { }
 
     TransformationMatrix projectionMatrix;
     int currentProgram;
     int previousProgram;
+    RefPtr<SharedGLData> m_sharedGLData;
 };
 
-TextureMapperGLData::GlobalGLData TextureMapperGLData::globalGLData;
-
 class BitmapTextureGL : public BitmapTexture {
 public:
     virtual void destroy();
@@ -289,11 +397,11 @@
 };
 
 #define TEXMAP_GET_SHADER_VAR_LOCATION(prog, var) \
-    if (TextureMapperGLData::globalGLData.getUniformLocation(TextureMapperGLData::globalGLData.prog##Program, TextureMapperGLData::globalGLData.var##Variable, #var) < 0) \
+    if (getUniformLocation(prog##Program, var##Variable, #var) < 0) \
             LOG_ERROR("Couldn't find variable "#var" in program "#prog"\n");
 
 #define TEXMAP_BUILD_SHADER(program) \
-    TextureMapperGLData::globalGLData.createShaderProgram(vertexShaderSource##program, fragmentShaderSource##program, TextureMapperGLData::globalGLData.program##Program);
+    createShaderProgram(vertexShaderSource##program, fragmentShaderSource##program, program##Program);
 
 TextureMapperGL::TextureMapperGL()
     : m_data(new TextureMapperGLData)
@@ -301,12 +409,8 @@
 {
 }
 
-void TextureMapperGL::initializeShaders()
+void TextureMapperGLData::SharedGLData::initializeShaders()
 {
-    static bool shadersCompiled = false;
-    if (shadersCompiled)
-        return;
-    shadersCompiled = true;
 #ifndef TEXMAP_OPENGL_ES_2
 #define OES2_PRECISION_DEFINITIONS \
     "#define lowp\n#define highp\n"
@@ -322,6 +426,9 @@
                                 OES2_FRAGMENT_SHADER_DEFAULT_PRECISION\
                                 #src
 
+    if (!initializeOpenGLShims())
+        return;
+
     const char* fragmentShaderSourceOpacityAndMask =
         FRAGMENT_SHADER(
             uniform sampler2D SourceTexture, MaskTexture;
@@ -426,7 +533,6 @@
     glClear(GL_STENCIL_BUFFER_BIT);
     bindSurface(0);
 #endif
-    initializeShaders();
 }
 
 void TextureMapperGL::endPainting()
@@ -454,13 +560,13 @@
 
 void TextureMapperGL::drawTexture(uint32_t texture, bool opaque, const FloatSize& relativeSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, const BitmapTexture* maskTexture, bool flip)
 {
-    TextureMapperGLData::GlobalGLData::ShaderProgramIndex program;
+    TextureMapperGLData::SharedGLData::ShaderProgramIndex program;
     if (maskTexture)
-        program = TextureMapperGLData::GlobalGLData::OpacityAndMaskProgram;
+        program = TextureMapperGLData::SharedGLData::OpacityAndMaskProgram;
     else
-        program = TextureMapperGLData::GlobalGLData::SimpleProgram;
+        program = TextureMapperGLData::SharedGLData::SimpleProgram;
 
-    const TextureMapperGLData::GlobalGLData::ProgramInfo& programInfo = data().globalGLData.programs[program];
+    const TextureMapperGLData::SharedGLData::ProgramInfo& programInfo = data().sharedGLData().programs[program];
     GL_CMD(glUseProgram(programInfo.id))
     data().currentProgram = program;
     GL_CMD(glEnableVertexAttribArray(programInfo.vertexAttrib))
@@ -487,10 +593,10 @@
                                      0, 0, 1, 0,
                                      0, flip ? relativeSize.height() : 0, 0, 1};
 
-    GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::GlobalGLData::InMatrixVariable], 1, GL_FALSE, m4))
-    GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::GlobalGLData::InSourceMatrixVariable], 1, GL_FALSE, m4src))
-    GL_CMD(glUniform1i(programInfo.vars[TextureMapperGLData::GlobalGLData::SourceTextureVariable], 0))
-    GL_CMD(glUniform1f(programInfo.vars[TextureMapperGLData::GlobalGLData::OpacityVariable], opacity))
+    GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::SharedGLData::InMatrixVariable], 1, GL_FALSE, m4))
+    GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::SharedGLData::InSourceMatrixVariable], 1, GL_FALSE, m4src))
+    GL_CMD(glUniform1i(programInfo.vars[TextureMapperGLData::SharedGLData::SourceTextureVariable], 0))
+    GL_CMD(glUniform1f(programInfo.vars[TextureMapperGLData::SharedGLData::OpacityVariable], opacity))
 
     if (maskTexture && maskTexture->isValid()) {
         const BitmapTextureGL* maskTextureGL = static_cast<const BitmapTextureGL*>(maskTexture);
@@ -500,8 +606,8 @@
                                          0, maskTextureGL->relativeSize().height(), 0, 0,
                                          0, 0, 1, 0,
                                          0, 0, 0, 1};
-        GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::GlobalGLData::InMaskMatrixVariable], 1, GL_FALSE, m4mask));
-        GL_CMD(glUniform1i(programInfo.vars[TextureMapperGLData::GlobalGLData::MaskTextureVariable], 1))
+        GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::SharedGLData::InMaskMatrixVariable], 1, GL_FALSE, m4mask));
+        GL_CMD(glUniform1i(programInfo.vars[TextureMapperGLData::SharedGLData::MaskTextureVariable], 1))
         GL_CMD(glActiveTexture(GL_TEXTURE0))
     }
 
@@ -670,7 +776,7 @@
 
 void BitmapTextureGL::bind()
 {
-    int& stencilIndex = TextureMapperGLData::globalGLData.stencilIndex;
+    int& stencilIndex = m_textureMapper->data().sharedGLData().stencilIndex;
     if (m_surfaceNeedsReset || !m_fbo) {
         if (!m_fbo)
             GL_CMD(glGenFramebuffers(1, &m_fbo))
@@ -743,7 +849,7 @@
     if (!surface) {
         GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, 0))
         data().projectionMatrix = createProjectionMatrix(viewportSize(), true).multiply(transform());
-        GL_CMD(glStencilFunc(data().globalGLData.stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().globalGLData.stencilIndex - 1, data().globalGLData.stencilIndex - 1))
+        GL_CMD(glStencilFunc(data().sharedGLData().stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().sharedGLData().stencilIndex - 1, data().sharedGLData().stencilIndex - 1))
         GL_CMD(glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP))
         GL_CMD(glViewport(0, 0, viewportSize().width(), viewportSize().height()))
         return;
@@ -754,8 +860,8 @@
 
 void TextureMapperGL::beginClip(const TransformationMatrix& modelViewMatrix, const FloatRect& targetRect)
 {
-    TextureMapperGLData::GlobalGLData::ShaderProgramIndex program = TextureMapperGLData::GlobalGLData::ClipProgram;
-    const TextureMapperGLData::GlobalGLData::ProgramInfo& programInfo = data().globalGLData.programs[program];
+    TextureMapperGLData::SharedGLData::ShaderProgramIndex program = TextureMapperGLData::SharedGLData::ClipProgram;
+    const TextureMapperGLData::SharedGLData::ProgramInfo& programInfo = data().sharedGLData().programs[program];
     GL_CMD(glUseProgram(programInfo.id))
     GL_CMD(glEnableVertexAttribArray(programInfo.vertexAttrib))
     const GLfloat unitRect[] = {0, 0, 1, 0, 1, 1, 0, 1};
@@ -775,9 +881,9 @@
         matrix.m41(), matrix.m42(), matrix.m43(), matrix.m44()
     };
 
-    int& stencilIndex = data().globalGLData.stencilIndex;
+    int& stencilIndex = data().sharedGLData().stencilIndex;
 
-    GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::GlobalGLData::InMatrixVariable], 1, GL_FALSE, m4))
+    GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::SharedGLData::InMatrixVariable], 1, GL_FALSE, m4))
     GL_CMD(glEnable(GL_STENCIL_TEST))
     GL_CMD(glStencilFunc(GL_NEVER, stencilIndex, stencilIndex))
     GL_CMD(glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE))
@@ -791,8 +897,8 @@
 
 void TextureMapperGL::endClip()
 {
-    data().globalGLData.stencilIndex >>= 1;
-    glStencilFunc(data().globalGLData.stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().globalGLData.stencilIndex - 1, data().globalGLData.stencilIndex - 1);
+    data().sharedGLData().stencilIndex >>= 1;
+    glStencilFunc(data().sharedGLData().stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().sharedGLData().stencilIndex - 1, data().sharedGLData().stencilIndex - 1);
 }
 
 PassRefPtr<BitmapTexture> TextureMapperGL::createTexture()

Modified: trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h (104650 => 104651)


--- trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h	2012-01-11 00:39:01 UTC (rev 104650)
+++ trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h	2012-01-11 00:42:11 UTC (rev 104651)
@@ -55,7 +55,6 @@
     virtual bool isOpenGLBacked() const { return true; }
 
 private:
-    void initializeShaders();
     inline TextureMapperGLData& data() { return *m_data; }
     TextureMapperGLData* m_data;
     GraphicsContext* m_context;

Modified: trunk/Source/WebKit2/ChangeLog (104650 => 104651)


--- trunk/Source/WebKit2/ChangeLog	2012-01-11 00:39:01 UTC (rev 104650)
+++ trunk/Source/WebKit2/ChangeLog	2012-01-11 00:42:11 UTC (rev 104651)
@@ -1,3 +1,21 @@
+2012-01-10  Viatcheslav Ostapenko  <ostapenko.viatches...@nokia.com>
+
+        [Qt][WK2]REGRESSION(r102435): It made tst_QQuickWebView::show() crash
+        https://bugs.webkit.org/show_bug.cgi?id=74176
+
+        Reviewed by Noam Rosenthal.
+
+        Check texture mapper exists already in ensureRootLayer to avoid recrecation.
+        Check if root layer was deleted already in purgeGLResources.
+        Added multipleWebViewWindows and multipleWebViews API tests.
+
+        * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
+        (tst_QQuickWebView::multipleWebViewWindows):
+        (tst_QQuickWebView::multipleWebViews):
+        * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+        (WebKit::LayerTreeHostProxy::ensureRootLayer):
+        (WebKit::LayerTreeHostProxy::purgeGLResources):
+
 2012-01-10  Ryosuke Niwa  <rn...@webkit.org>
 
         Snow Leopard build fix.

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp (104650 => 104651)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp	2012-01-11 00:39:01 UTC (rev 104650)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp	2012-01-11 00:42:11 UTC (rev 104651)
@@ -51,6 +51,8 @@
     void show();
     void showWebView();
     void removeFromCanvas();
+    void multipleWebViewWindows();
+    void multipleWebViews();
 
 private:
     inline QQuickWebView* webView() const;
@@ -270,6 +272,52 @@
     QTest::qWait(200);
 }
 
+void tst_QQuickWebView::multipleWebViewWindows()
+{
+    showWebView();
+
+    // This should not crash.
+    QQuickWebView* webView1 = new QQuickWebView();
+    QScopedPointer<TestWindow> window1(new TestWindow(webView1));
+    QQuickWebView* webView2 = new QQuickWebView();
+    QScopedPointer<TestWindow> window2(new TestWindow(webView2));
+
+    webView1->setSize(QSizeF(300, 400));
+    webView1->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html")));
+    QVERIFY(waitForSignal(webView1, SIGNAL(loadSucceeded())));
+    window1->show();
+    webView1->setVisible(true);
+
+    webView2->setSize(QSizeF(300, 400));
+    webView2->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
+    QVERIFY(waitForSignal(webView2, SIGNAL(loadSucceeded())));
+    window2->show();
+    webView2->setVisible(true);
+    QTest::qWait(200);
+}
+
+void tst_QQuickWebView::multipleWebViews()
+{
+    showWebView();
+
+    // This should not crash.
+    QScopedPointer<QQuickWebView> webView1(new QQuickWebView());
+    webView1->setParentItem(m_window->rootItem());
+    QScopedPointer<QQuickWebView> webView2(new QQuickWebView());
+    webView2->setParentItem(m_window->rootItem());
+
+    webView1->setSize(QSizeF(300, 400));
+    webView1->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html")));
+    QVERIFY(waitForSignal(webView1.data(), SIGNAL(loadSucceeded())));
+    webView1->setVisible(true);
+
+    webView2->setSize(QSizeF(300, 400));
+    webView2->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
+    QVERIFY(waitForSignal(webView2.data(), SIGNAL(loadSucceeded())));
+    webView2->setVisible(true);
+    QTest::qWait(200);
+}
+
 void tst_QQuickWebView::scrollRequest()
 {
     webView()->setSize(QSizeF(300, 400));

Modified: trunk/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp (104650 => 104651)


--- trunk/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp	2012-01-11 00:39:01 UTC (rev 104650)
+++ trunk/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp	2012-01-11 00:42:11 UTC (rev 104651)
@@ -460,7 +460,8 @@
 
     // The root layer should not have zero size, or it would be optimized out.
     m_rootLayer->setSize(FloatSize(1.0, 1.0));
-    m_textureMapper = TextureMapperGL::create();
+    if (!m_textureMapper)
+        m_textureMapper = TextureMapperGL::create();
     toTextureMapperNode(m_rootLayer.get())->setTextureMapper(m_textureMapper.get());
 }
 
@@ -623,7 +624,9 @@
 {
     TextureMapperNode* node = toTextureMapperNode(rootLayer());
 
-    node->purgeNodeTexturesRecursive();
+    if (node)
+        node->purgeNodeTexturesRecursive();
+
     m_directlyCompositedImages.clear();
 
     m_textureMapper.clear();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to