Skip to content
Permalink
Browse files
REGRESSION(r180924): ASSERTION FAILED: !from.isEmpty() in WebCore::Tr…
…ansformationMatrix::rectToRect

https://bugs.webkit.org/show_bug.cgi?id=142345

Reviewed by Martin Robinson.

This was caused by r180924 that postpones the creation of the
TextureMapper, which could cause that a layer has not yet a size
when TextureMapper::paint() is called. This patch moves the
creation of the TextureMapper to
LayerTreeHostGtk::setNativeSurfaceHandleForCompositing(), so that
it's created as soon as it's possible to create. This method is
called by the drawing area right after creating the
LayerTreeHostGtk if it already have a handler, or when the handle
is received from the UI process.

* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::initialize): Remove the
nsureTextureMapper call because at this point the layer context ID
is always 0, so it's impossible to create the TextureMapper.
(WebKit::LayerTreeHostGtk::compositeLayersToContext): Remove the
ensureTextureMapper call from here too, since at this point, if we
have a context, we should also have a TextureMapper. Add an ASSERT
right before using the TextureMapper.
(WebKit::LayerTreeHostGtk::setNativeSurfaceHandleForCompositing):
Create the TextureMapper here.
(WebKit::LayerTreeHostGtk::ensureTextureMapper): Deleted.
* WebProcess/WebPage/gtk/LayerTreeHostGtk.h:

Canonical link: https://commits.webkit.org/160422@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181138 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Mar 6, 2015
1 parent 3e53702 commit cb8148d8d45138f550c7aaca079b031113a14344
Showing with 44 additions and 22 deletions.
  1. +30 −0 Source/WebKit2/ChangeLog
  2. +14 −21 Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp
  3. +0 −1 Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h
@@ -1,3 +1,33 @@
2015-03-05 Carlos Garcia Campos <cgarcia@igalia.com>

REGRESSION(r180924): ASSERTION FAILED: !from.isEmpty() in WebCore::TransformationMatrix::rectToRect
https://bugs.webkit.org/show_bug.cgi?id=142345

Reviewed by Martin Robinson.

This was caused by r180924 that postpones the creation of the
TextureMapper, which could cause that a layer has not yet a size
when TextureMapper::paint() is called. This patch moves the
creation of the TextureMapper to
LayerTreeHostGtk::setNativeSurfaceHandleForCompositing(), so that
it's created as soon as it's possible to create. This method is
called by the drawing area right after creating the
LayerTreeHostGtk if it already have a handler, or when the handle
is received from the UI process.

* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::initialize): Remove the
nsureTextureMapper call because at this point the layer context ID
is always 0, so it's impossible to create the TextureMapper.
(WebKit::LayerTreeHostGtk::compositeLayersToContext): Remove the
ensureTextureMapper call from here too, since at this point, if we
have a context, we should also have a TextureMapper. Add an ASSERT
right before using the TextureMapper.
(WebKit::LayerTreeHostGtk::setNativeSurfaceHandleForCompositing):
Create the TextureMapper here.
(WebKit::LayerTreeHostGtk::ensureTextureMapper): Deleted.
* WebProcess/WebPage/gtk/LayerTreeHostGtk.h:

2015-03-05 Anders Carlsson <andersca@apple.com>

WKWebView Encoder for remote object communication does not implement encodeInt32:forKey:
@@ -92,17 +92,6 @@ bool LayerTreeHostGtk::makeContextCurrent()
return m_context->makeContextCurrent();
}

void LayerTreeHostGtk::ensureTextureMapper()
{
if (m_textureMapper)
return;

ASSERT(m_isValid);
m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
static_cast<TextureMapperGL*>(m_textureMapper.get())->setEnableEdgeDistanceAntialiasing(true);
downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setTextureMapper(m_textureMapper.get());
}

void LayerTreeHostGtk::initialize()
{
m_rootLayer = GraphicsLayer::create(graphicsLayerFactory(), *this);
@@ -124,13 +113,6 @@ void LayerTreeHostGtk::initialize()

m_rootLayer->addChild(m_nonCompositedContentLayer.get());
m_nonCompositedContentLayer->setNeedsDisplay();

// The creation of the TextureMapper needs an active OpenGL context.
if (!makeContextCurrent())
return;

ensureTextureMapper();
scheduleLayerFlush();
}

LayerTreeHostGtk::~LayerTreeHostGtk()
@@ -296,8 +278,6 @@ void LayerTreeHostGtk::compositeLayersToContext(CompositePurpose purpose)
if (!makeContextCurrent())
return;

ensureTextureMapper();

// The window size may be out of sync with the page size at this point, and getting
// the viewport parameters incorrect, means that the content will be misplaced. Thus
// we set the viewport parameters directly from the window size.
@@ -309,6 +289,7 @@ void LayerTreeHostGtk::compositeLayersToContext(CompositePurpose purpose)
glClear(GL_COLOR_BUFFER_BIT);
}

ASSERT(m_textureMapper);
m_textureMapper->beginPainting();
downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().paint();
m_textureMapper->endPainting();
@@ -344,7 +325,7 @@ void LayerTreeHostGtk::flushAndRenderLayers()

void LayerTreeHostGtk::scheduleLayerFlush()
{
if (!m_layerFlushSchedulingEnabled)
if (!m_layerFlushSchedulingEnabled || !m_textureMapper)
return;

// We use a GLib timer because otherwise GTK+ event handling during dragging can starve WebCore timers, which have a lower priority.
@@ -387,6 +368,18 @@ void LayerTreeHostGtk::setViewOverlayRootLayer(WebCore::GraphicsLayer* viewOverl
void LayerTreeHostGtk::setNativeSurfaceHandleForCompositing(uint64_t handle)
{
m_layerTreeContext.contextID = handle;

// The creation of the TextureMapper needs an active OpenGL context.
if (!makeContextCurrent())
return;

ASSERT(m_isValid);
ASSERT(!m_textureMapper);
m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
static_cast<TextureMapperGL*>(m_textureMapper.get())->setEnableEdgeDistanceAntialiasing(true);
downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setTextureMapper(m_textureMapper.get());

scheduleLayerFlush();
}

} // namespace WebKit
@@ -87,7 +87,6 @@ class LayerTreeHostGtk final : public LayerTreeHost, WebCore::GraphicsLayerClien
void layerFlushTimerFired();

bool makeContextCurrent();
void ensureTextureMapper();

LayerTreeContext m_layerTreeContext;
bool m_isValid;

0 comments on commit cb8148d

Please sign in to comment.