Bug 222406

Summary: Render tree updates for Text node content mutations should happen during rendering update
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, changseok, darin, esprehn+autocc, ews-watchlist, glenn, kangil.han, kondapallykalyan, mifenton, pdr, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 224323    
Bug Blocks:    
Attachments:
Description Flags
wip
ews-feeder: commit-queue-
patch
none
patch
none
patch
ews-feeder: commit-queue-
patch
ews-feeder: commit-queue-
patch
ews-feeder: commit-queue-
patch
none
alternative approach
none
patch
none
patch
none
patch
none
patch
simon.fraser: review+
patch
none
patch for relanding none

Antti Koivisto
Reported 2021-02-24 22:55:47 PST
Render tree should be mutated lazily as a part of rendering update like in all other cases.
Attachments
wip (4.50 KB, patch)
2021-02-24 22:56 PST, Antti Koivisto
ews-feeder: commit-queue-
patch (11.21 KB, patch)
2021-02-25 07:24 PST, Antti Koivisto
no flags
patch (11.17 KB, patch)
2021-02-25 07:42 PST, Antti Koivisto
no flags
patch (11.02 KB, patch)
2021-02-25 10:54 PST, Antti Koivisto
ews-feeder: commit-queue-
patch (9.47 KB, patch)
2021-02-26 03:15 PST, Antti Koivisto
ews-feeder: commit-queue-
patch (14.82 KB, patch)
2021-02-26 06:38 PST, Antti Koivisto
ews-feeder: commit-queue-
patch (14.84 KB, patch)
2021-02-26 07:37 PST, Antti Koivisto
no flags
alternative approach (3.63 KB, patch)
2021-02-26 08:00 PST, Antti Koivisto
no flags
patch (14.84 KB, patch)
2021-02-26 08:06 PST, Antti Koivisto
no flags
patch (16.89 KB, patch)
2021-02-26 09:46 PST, Antti Koivisto
no flags
patch (16.92 KB, patch)
2021-02-26 09:49 PST, Antti Koivisto
no flags
patch (16.36 KB, patch)
2021-02-26 11:21 PST, Antti Koivisto
simon.fraser: review+
patch (16.86 KB, patch)
2021-02-26 23:45 PST, Antti Koivisto
no flags
patch for relanding (16.94 KB, patch)
2021-04-19 11:05 PDT, Antti Koivisto
no flags
Antti Koivisto
Comment 1 2021-02-24 22:56:44 PST
Antti Koivisto
Comment 2 2021-02-25 07:24:47 PST
Antti Koivisto
Comment 3 2021-02-25 07:42:08 PST
Antti Koivisto
Comment 4 2021-02-25 10:54:50 PST
Simon Fraser (smfr)
Comment 5 2021-02-25 13:15:20 PST
Comment on attachment 421546 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=421546&action=review > Source/WebCore/ChangeLog:35 > + This is because subsequent steps in multipart commands expect render tree to be up to date. Shouldn't this be handled by the next step triggering a render tree update? It's going to be hard for author of new code to know if they have to call updateStyleIfNeeded() or not. > Source/WebCore/ChangeLog:47 > + Pending text update mat ref the node so this refcount assert is not correct. mat ref?
Antti Koivisto
Comment 6 2021-02-25 13:38:55 PST
> Shouldn't this be handled by the next step triggering a render tree update? In theory yes, but it is very difficult to discover all the paths that would need it as there is no guarantee test coverage is complete. In practice missing cases would be discover via regressions. > It's going to be hard for author of new code to know if they have to call > updateStyleIfNeeded() or not. These just maintain the existing behaviour (sync render tree update on Text content mutations). Anyone working on this code needs to be careful about updates in any case, this patch in no way changes that.
Antti Koivisto
Comment 7 2021-02-25 13:39:43 PST
(In reply to Antti Koivisto from comment #6) > These just maintain the existing behaviour (sync render tree update on Text > content mutations). ...in editing code specifically.
Antti Koivisto
Comment 8 2021-02-26 03:15:49 PST
Antti Koivisto
Comment 9 2021-02-26 06:38:45 PST
Antti Koivisto
Comment 10 2021-02-26 07:37:09 PST
Antti Koivisto
Comment 11 2021-02-26 08:00:47 PST Comment hidden (obsolete)
Antti Koivisto
Comment 12 2021-02-26 08:06:55 PST
Antti Koivisto
Comment 13 2021-02-26 09:46:00 PST
Antti Koivisto
Comment 14 2021-02-26 09:49:39 PST
Antti Koivisto
Comment 15 2021-02-26 11:21:58 PST
Simon Fraser (smfr)
Comment 16 2021-02-26 22:20:57 PST
Comment on attachment 421679 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=421679&action=review > Source/WebCore/dom/CharacterData.cpp:105 > - if (is<Text>(*this) && parentNode()) > + if (is<Text>(*this)) This doesn't seem to be mentioned in the changelog. > Source/WebCore/editing/CompositeEditCommand.cpp:1062 > + if (!nodes.isEmpty()) > + document().updateLayoutIgnorePendingStylesheets(); This is still pretty mysterious.
Antti Koivisto
Comment 17 2021-02-26 22:47:28 PST
> This doesn't seem to be mentioned in the changelog. The check just moves to the function.
Antti Koivisto
Comment 18 2021-02-26 23:45:29 PST
EWS
Comment 19 2021-02-27 00:24:07 PST
Committed r273621: <https://commits.webkit.org/r273621> All reviewed patches have been landed. Closing bug and clearing flags on attachment 421738 [details].
Radar WebKit Bug Importer
Comment 20 2021-02-27 00:25:19 PST
Darin Adler
Comment 21 2021-03-01 14:26:14 PST
Comment on attachment 421738 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=421738&action=review > Source/WebCore/style/StyleUpdate.cpp:104 > + auto result = m_texts.ensure(&text, [&] { > + return WTFMove(textUpdate); > + }); I think this is identical to: auto result = m_texts.add(&text, WTFMove(textUpdate)); Maybe because it looks like WTFMove causes a "move" that the ensure form seems safer, but pretty sure it’s no different.
Antti Koivisto
Comment 22 2021-03-02 07:33:03 PST
> Maybe because it looks like WTFMove causes a "move" that the ensure form > seems safer, but pretty sure it’s no different. Yeah, it just looked less dangerous. I think you are right that it is equivalent.
Antti Koivisto
Comment 23 2021-04-08 06:44:36 PDT
Reverted in r275657 due to PLT regression.
Antti Koivisto
Comment 24 2021-04-19 11:05:43 PDT
Created attachment 426446 [details] patch for relanding
EWS
Comment 25 2021-04-19 23:33:58 PDT
Committed r276287 (236769@main): <https://commits.webkit.org/236769@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 426446 [details].
Note You need to log in before you can comment on or make changes to this bug.