Title: [108274] trunk/Source/WebCore
Revision
108274
Author
[email protected]
Date
2012-02-20 17:20:20 -0800 (Mon, 20 Feb 2012)

Log Message

[Qt][WK2] Clipping is broken
https://bugs.webkit.org/show_bug.cgi?id=78677

It's not necessary to add a full-viewport rect to the scissor clip stack.
It creates a situation where if there's a clip in the page, we return to
the viewport clip instead of applying the WebView's clip we got from the
scenegraph.

Also, it's unnecessary to clip before we paint the layer's content, we should
only clip afterwards, before painting the children.

Reviewed by Kenneth Rohde Christiansen.

No new functionality.

* platform/graphics/opengl/TextureMapperGL.cpp:
(WebCore::BitmapTextureGL::size):
(WebCore::scissorClip):
(WebCore):
(WebCore::TextureMapperGL::beginScissorClip):
(WebCore::TextureMapperGL::endScissorClip):
* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::paintSelfAndChildren):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108273 => 108274)


--- trunk/Source/WebCore/ChangeLog	2012-02-21 01:15:15 UTC (rev 108273)
+++ trunk/Source/WebCore/ChangeLog	2012-02-21 01:20:20 UTC (rev 108274)
@@ -1,5 +1,31 @@
 2012-02-20  No'am Rosenthal  <[email protected]>
 
+        [Qt][WK2] Clipping is broken
+        https://bugs.webkit.org/show_bug.cgi?id=78677
+
+        It's not necessary to add a full-viewport rect to the scissor clip stack.
+        It creates a situation where if there's a clip in the page, we return to
+        the viewport clip instead of applying the WebView's clip we got from the
+        scenegraph.
+
+        Also, it's unnecessary to clip before we paint the layer's content, we should
+        only clip afterwards, before painting the children. 
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        No new functionality.
+
+        * platform/graphics/opengl/TextureMapperGL.cpp:
+        (WebCore::BitmapTextureGL::size):
+        (WebCore::scissorClip):
+        (WebCore):
+        (WebCore::TextureMapperGL::beginScissorClip):
+        (WebCore::TextureMapperGL::endScissorClip):
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::paintSelfAndChildren):
+
+2012-02-20  No'am Rosenthal  <[email protected]>
+
         [Texmap] Layers and tiles appear to have missing pixels in their right/bottom borders
         https://bugs.webkit.org/show_bug.cgi?id=78961
 

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


--- trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp	2012-02-21 01:15:15 UTC (rev 108273)
+++ trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp	2012-02-21 01:20:20 UTC (rev 108274)
@@ -809,7 +809,6 @@
         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()))
-        data().sharedGLData().clipStack.append(IntRect(data().viewport[0], data().viewport[1], data().viewport[2], data().viewport[3]));
         return;
     }
 
@@ -835,9 +834,16 @@
     }
 
     // Intersect with previous clip.
-    if (!data().sharedGLData().clipStack.isEmpty())
-        rect.intersect(data().sharedGLData().clipStack.last());
+    for (int i = data().sharedGLData().clipStack.size() - 1; i >= 0; --i) {
+        const IntRect& prevRect = data().sharedGLData().clipStack[i];
+        if (prevRect.isEmpty())
+            continue;
 
+        // We only need the last valid clip.
+        rect.intersect(prevRect);
+        break;
+    }
+
     scissorClip(rect);
     data().sharedGLData().clipStack.append(rect);
 
@@ -861,6 +867,7 @@
 {
     if (beginScissorClip(modelViewMatrix, targetRect))
         return;
+
     data().initStencil();
     TextureMapperGLData::SharedGLData::ShaderProgramIndex program = TextureMapperGLData::SharedGLData::ClipProgram;
     const TextureMapperGLData::SharedGLData::ProgramInfo& programInfo = data().sharedGLData().programs[program];

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (108273 => 108274)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2012-02-21 01:15:15 UTC (rev 108273)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2012-02-21 01:20:20 UTC (rev 108274)
@@ -175,16 +175,19 @@
 
 void TextureMapperLayer::paintSelfAndChildren(const TextureMapperPaintOptions& options)
 {
-    bool hasClip = m_state.masksToBounds && !m_children.isEmpty();
-    if (hasClip)
+    paintSelf(options);
+
+    if (m_children.isEmpty())
+        return;
+
+    bool shouldClip = m_state.masksToBounds || m_state.maskLayer;
+    if (shouldClip)
         options.textureMapper->beginClip(TransformationMatrix(options.transform).multiply(m_transform.combined()), FloatRect(0, 0, m_size.width(), m_size.height()));
 
-    paintSelf(options);
-
-    for (size_t i = 0; i < m_children.size(); ++i)
+    for (int i = 0; i < m_children.size(); ++i)
         m_children[i]->paintRecursive(options);
 
-    if (hasClip)
+    if (shouldClip)
         options.textureMapper->endClip();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to