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):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108274
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2012-02-20 No'am Rosenthal <noam.rosenthal@nokia.com>
+ [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 <noam.rosenthal@nokia.com>
+
[Texmap] Layers and tiles appear to have missing pixels in their right/bottom borders
https://bugs.webkit.org/show_bug.cgi?id=78961
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;
}
}
// 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);
{
if (beginScissorClip(modelViewMatrix, targetRect))
return;
+
data().initStencil();
TextureMapperGLData::SharedGLData::ShaderProgramIndex program = TextureMapperGLData::SharedGLData::ClipProgram;
const TextureMapperGLData::SharedGLData::ProgramInfo& programInfo = data().sharedGLData().programs[program];
void TextureMapperLayer::paintSelfAndChildren(const TextureMapperPaintOptions& options)
{
- bool hasClip = m_state.masksToBounds && !m_children.isEmpty();
- if (hasClip)
- 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)
+ 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()));
+
+ for (int i = 0; i < m_children.size(); ++i)
m_children[i]->paintRecursive(options);
- if (hasClip)
+ if (shouldClip)
options.textureMapper->endClip();
}