[webkit-dev] maximalOutlineSize inflate all RenderLayers

Simon Fraser simon.fraser at apple.com
Mon Jul 6 21:32:33 PDT 2015


This is a well-known issue. Ideally outline size would be factored into visual overflow, but that’s a bit tricky because outline is weird and crosses between RenderObjects.

https://bugs.webkit.org/show_bug.cgi?id=106397 <https://bugs.webkit.org/show_bug.cgi?id=106397>


> On Jul 6, 2015, at 9:26 PM, Kim, NamHoon <nakim at ea.com> wrote:
> 
> 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.

This sounds like a bug in your port.

> 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.

Simon


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20150706/4d92a386/attachment.html>


More information about the webkit-dev mailing list