New issue
Advanced search Search tips

Issue 811479 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Task



Sign in to add a comment

[LayoutNG] Caching of text paining broken?

Project Member Reported by mstensho@chromium.org, Feb 12 2018

Issue description

If a dynamic change moves a block that contains text (inline children), without triggering layout, we fail to repaint that text at the new position. 

So this only seems to happen if we manage to skip layout of some object. Since NG currently just re-lays out everything every time it needs to lay out anything at all, I guess it's only reproducible when re-entering NG from legacy layout, e.g. table cells or flex items. Attaching two tests.

If I remove the DrawingRecorder::UseCachedDrawingIfPossible() check in NGBoxFragmentPainter::PaintTextChild(), I get (a bunch of DCHECK failures, and) text repainted correctly at the new position.

https://chromium-review.googlesource.com/c/chromium/src/+/773791 seems interesting here. So are we using cached items when we shouldn't, or is it something else?

This bug is responsible for a few flakes (depending on image loading timing), such as LayoutTests/tables/mozilla/bugs/ bug25074 .html (and probably some pure failures as well).
 
tc-table.html
377 bytes View Download
tc-flex.html
364 bytes View Download

Comment 1 by kojii@chromium.org, Feb 19 2018

Maybe LayoutNGMixin change in this CL fixed?
https://chromium-review.googlesource.com/c/chromium/src/+/899622

I'll check..
I think I already had that CL in my tree when reporting this, but anyway, the problem is still there.

It's pretty much impossible for me to run through LayoutTests/tables/ without any failures.

Comment 3 by kojii@chromium.org, Mar 6 2018

Cc: atotic@chromium.org
It looks like background images not being painted is from the same reason; UseCachedDrawingIfPossible() calls PaintController::ClientCacheIsValid(), at which point somehow the current_cache_generation_ is not updated.

Comment 4 by kojii@chromium.org, Mar 6 2018

Cc: yoichio@chromium.org
atotic@, when you're working on paint invalidation, does that include LayoutObject::InvalidateDisplayItemClients()? It looks like background-image is from this function, and I guess Morten's problem as well.

/cc yoichio@, as he made partial changes for selection in
https://chromium-review.googlesource.com/821394

Comment 5 by kojii@chromium.org, Mar 6 2018

Labels: -Type-Bug Type-Task
I am looking at all invalidation bugs. Have not learned enough yet to classify failures into different buckets.

The cache is not turned on by default, so this is invalidation bug.
My change is invalidating NGPaintFragment of a LayoutText when selection is updated because we paint text with the NGPaintFragments.
FYI, NGPaintFragment inherits DisplayItemClinent.

Comment 8 by kojii@chromium.org, Mar 7 2018

yoichio@: thanks, yeah, that was a good work, and I think the CL
https://chromium-review.googlesource.com/c/chromium/src/+/951522
covers other cases than selection painting as well that it might be good to review and merge your changes.
Project Member

Comment 9 by bugdroid1@chromium.org, Mar 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b2756c9c2a6fb21f37e1cac78c5d283f97029fc1

commit b2756c9c2a6fb21f37e1cac78c5d283f97029fc1
Author: Koji Ishii <kojii@chromium.org>
Date: Wed Mar 07 05:13:33 2018

[LayoutNG] Implement LayoutObject::InvalidateDisplayItemClients

This patch implements LayoutObject::InvalidateDisplayItemClients
for LayoutText, LayoutInline, and LayoutBlockFlow. These are the
all classes that implement this virtual functions.

For one, this fixes background-image to be painted when images
are loaded. Before this patch, invalidating LayoutObject does
call painters, but NGPaintFragment is not invalidated and that
CachedDrawing was used to paint.

Note that not all logic LayoutBlockFlow does for LayoutObject
are not examined. They probably need to be examined and some of
them are needed to be ported to LayoutNG, in its own invalidator.
That part is not included in this patch.

Bug: 636993,  811479 
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Icf6fabc4ecc30687c1a5cd21c0c3db268e3c7e3f
Reviewed-on: https://chromium-review.googlesource.com/951522
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: Aleks Totic <atotic@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541353}
[modify] https://crrev.com/b2756c9c2a6fb21f37e1cac78c5d283f97029fc1/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
[modify] https://crrev.com/b2756c9c2a6fb21f37e1cac78c5d283f97029fc1/third_party/WebKit/Source/core/layout/LayoutInline.cpp
[modify] https://crrev.com/b2756c9c2a6fb21f37e1cac78c5d283f97029fc1/third_party/WebKit/Source/core/layout/LayoutText.cpp
[modify] https://crrev.com/b2756c9c2a6fb21f37e1cac78c5d283f97029fc1/third_party/WebKit/Source/core/layout/ng/layout_ng_mixin.cc
[modify] https://crrev.com/b2756c9c2a6fb21f37e1cac78c5d283f97029fc1/third_party/WebKit/Source/core/layout/ng/layout_ng_mixin.h
[modify] https://crrev.com/b2756c9c2a6fb21f37e1cac78c5d283f97029fc1/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
[modify] https://crrev.com/b2756c9c2a6fb21f37e1cac78c5d283f97029fc1/third_party/WebKit/Source/core/paint/ng/ng_paint_fragment.cc
[modify] https://crrev.com/b2756c9c2a6fb21f37e1cac78c5d283f97029fc1/third_party/WebKit/Source/core/paint/ng/ng_paint_fragment.h
[modify] https://crrev.com/b2756c9c2a6fb21f37e1cac78c5d283f97029fc1/third_party/WebKit/Source/core/paint/ng/ng_paint_fragment_test.cc

Status: Fixed (was: Assigned)

Sign in to add a comment