Hi experts,
While hacking composited layer in WebKit, I realized CSS outline style inflate
size of all RenderLayers. Since WebKit has default css of 5px outline for
focused element, focusing input in the below sample inflate the cyan box. This
can reproduced in WK2 OSX port in r186227.
<style>
.box {
position: fixed;
top: 50px;
width: 100px;
height: 30px;
border-radius: 10%;
background-color: cyan;
}
</style>
<input type='text'>
<div class='box'></div>
Through investigation, I found `RenderView::m_maximalOutlineSize` value is set
in the RenderElement::setStyle() function. And this cause inflation of layers
in RenderLayer::localBoundingBox() function. Since setter of
`m_maximalOutlineSize` scheduled rebuild of the whole composited layers, all
layers inflated by the value.
Honestly, I don't know about this value's purpose. But it seems weird to me
that this value does not cleared in the RenderView even after outline style
cleared. (i.e. loose focus of the input)
And this behavior makes several problem in our ports, [EAWebKit][1]. Since we
uses composited layers backed by DirectX, this makes paint call requests larger
size than texture itself in TextureMapperTile::paint() function. This cause
rendering of corrupted memory. Steps follow,
a. layer inflated by maximalOutlineSize. Let 100x100 layer increased to 110x110.
b. texture increased in the
TextureMapperTiledBackingStore::createOrDestroyTilesIfNeeded() to 110x110.
c. layer's texture destroyed then reconstructed by display style change.
d. while reconstruct of the layer's texture, this time texture created with the
size of 100x100 instead of 110x110.
e. then painting this texture in TextureMapperTile::paint() request 110x110
rect for 100x100 texture.
While step d. GraphicsLayerTextureMapper::m_needsDisplayRect intersected with
TextureMapperTile::m_rect, makes texture smaller then layer's size. On the
other hand, TextureMapperTile::paint() call in the step e. request whole
TextureMapperTile::m_rect for draw request.
To escape this problem, I overridden default style of :focus to `outline:
none`. I wonder better solution for this. Is it some bug of WebKit? Is there
some proper way to handle this? If inflation of the layers inevitable, it seems
reasonable shrunken back after outline style cleared.
Regards,
Namhoon
[1]: http://gpl.ea.com/eawebkit.html
_______________________________________________
webkit-dev mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-dev