Bug 190245 - [WPE] Text incorrectly rendered when using SimpleLineLayout
Summary: [WPE] Text incorrectly rendered when using SimpleLineLayout
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WPE WebKit (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Miguel Gomez
URL:
Keywords:
Depends on: 90342
Blocks:
  Show dependency treegraph
 
Reported: 2018-10-03 03:38 PDT by Miguel Gomez
Modified: 2018-11-16 01:47 PST (History)
5 users (show)

See Also:


Attachments
Testcase (632 bytes, text/html)
2018-10-03 03:38 PDT, Miguel Gomez
no flags Details
Patch (2.07 KB, patch)
2018-10-03 05:26 PDT, Miguel Gomez
no flags Details | Formatted Diff | Diff
Patch (4.88 KB, patch)
2018-10-09 02:03 PDT, Miguel Gomez
zalan: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Miguel Gomez 2018-10-03 03:38:27 PDT
Created attachment 351505 [details]
Testcase

I'm attaching a simple testcase to reproduce this problem.

In the test, we have a div with its own GraphicsLayer, and inside that div there's a text element. Then the text is changed at the same time than the style of the layer is changed. This should cause that both the div and the text were repainted but that's not happening (unless we're always using complex text). What happens is:

- RenderText::setText is called because of the changed text, and it invalidates its simpleLineLayout
- RenderLayerCompositor::layerStyleChanged is called because of the div style change. This calls RenderLayerBacking::updateAfterDescendants which calls RenderLayerBacking::updateDrawsContent. This one traverses the children to check whether its children are visible. As the child RenderText can't provide a simpleLineLayout (it won't be recreated until the layout happens), the boundingBox gotten for the text is empty, so RenderLayerBacking thinks that it doesn't have anything to paint and call GraphicsLayer::setDrawsContent with false.
- The layout happens, and it requests a display of the layer contents through RenderLayerBacking::setContentsNeedDisplay, but as the associated GraphicsLayer has drawsContent to false, it's discarded
- then the layout properly calculates the size for the new text and sets the GraphicsLayer drawsContent to true, but it's too late cause there isn't any new call to RenderLayerBacking::setContentsNeedDisplay
- in the end, the GraphicsLayer is not repainted because it wasn't set a dirty rectangle to repaint.
Comment 1 Miguel Gomez 2018-10-03 05:26:34 PDT
Created attachment 351513 [details]
Patch
Comment 2 Michael Catanzaro 2018-10-03 07:18:14 PDT
We are always using complex text. The simple text codepath is all dead code for our ports. How are you getting simple text?
Comment 3 Miguel Gomez 2018-10-03 07:23:57 PDT
(In reply to Michael Catanzaro from comment #2)
> We are always using complex text. The simple text codepath is all dead code
> for our ports. How are you getting simple text?

We are forcing complex text for wkgtk but not for wpe.
Comment 4 Miguel Gomez 2018-10-09 02:03:15 PDT
Created attachment 351871 [details]
Patch
Comment 5 Miguel Gomez 2018-10-09 02:06:48 PDT
Antti, could you please give a look to this? Thanks in advance!!
Comment 6 Antti Koivisto 2018-10-16 01:21:45 PDT
Zalan should take a look
Comment 7 zalan 2018-10-16 07:40:03 PDT
Comment on attachment 351871 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=351871&action=review

> Source/WebCore/rendering/RenderLayer.cpp:-6098
> -            if (renderText.linesBoundingBox().isEmpty())
> -                continue;

The bounding box value is totally invalid here and we should not make any painting decision based on that. We end up using the value from the previous layout which could be very different from what we might get as the result of the style/content change.
This function should either not be called when the tree is dirty (Simon?) or skip geometry checks on dirty renderers completely.
Comment 8 zalan 2018-10-16 07:43:41 PDT
(In reply to Michael Catanzaro from comment #2)
> We are always using complex text. The simple text codepath is all dead code
> for our ports. How are you getting simple text?
Simple line layout != simple text. Simple line layout is about whether the inline content can be laid out in a simple way without generating line boxes (RootInlineBox, InlineTextBox etc)
Comment 9 Simon Fraser (smfr) 2018-10-16 14:23:15 PDT
I think the patch in bug 90342 will fix this.
Comment 10 Miguel Gomez 2018-11-16 01:47:22 PST
(In reply to Simon Fraser (smfr) from comment #9)
> I think the patch in bug 90342 will fix this.

Yes, this became fixed with that patch, so closing bug.