-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessary logic in Renderer#render() #4370
Comments
cc @f1ames |
I'm analysing this comment for clues:
|
OK, are there?
We fixed deep structure rendering recently, so most likely that's gone now. Will write a test though.
According to the below code, after it gets removed, we then check if we need it again and if we do, we mark the children to be rendered. So the comment seems outdated too. if ( this._inlineFiller && !this._isSelectionInInlineFiller() ) {
this._removeInlineFiller();
}
// If we've got the filler, let's try to guess its position in the view.
if ( this._inlineFiller ) {
inlineFillerPosition = this._getInlineFillerPosition();
}
// Otherwise, if it's needed, create it at the selection position.
else if ( this._needsInlineFillerAtSelection() ) {
inlineFillerPosition = this.selection.getFirstPosition();
// Do not use `markToSync` so it will be added even if the parent is already added.
this.markedChildren.add( inlineFillerPosition.parent );
} |
There was exactly one unit test covering this case earlier: and it was: https://github.com/ckeditor/ckeditor5-engine/blob/26673a0c8cd62244d9ccdb6967f50d4e0e47414d/tests/view/renderer.js#L1315-L1351 which leads to https://github.com/ckeditor/ckeditor5-engine/issues/1014. |
Cool :) So I don't even have to write a new test. This one is good. |
OK, @f1ames pointed out that I lost Adding it back there indeed shows that the code which I've removed in ckeditor/ckeditor5-engine#1452 was needed. However, it means that we need a test which proves that |
Just to add some insights here to show how the code works with <ul1>
<li1>Foobar.</li1>
<li2>FILLER[]<div></div></li2>
</ul1> and then it moves <ul1>
<li1>
Foobar.
<ul2>
<li2>FILLER[]<div></div></li2>
</ul2>
</li1>
</ul1> then
|
@f1ames So, does the old The second question – if it gets reused, then is anything wrong with If so, do you think that it makes sense for cc @scofalik |
With
I'm really not sure about this. I stumbled upon this case at least two times in the past and it was quite confusing that the |
Internal: Added `withChildren: false` parameter missing after refactoring and unit test covering that case. Closes #1451. Closes #1452.
After yesterday's small refactoring in the renderer a CC dropped in the renderer:
The change I did yesterday was supposed to not touch any logic but apparently, it did. Namely, I think that
_updateChildren()
started rendering the filler itself. I tried to understand why it didn't render the filler previously but the code got complicated before the refactoring and I have problems tracking it down.Anyway, it seems completely accidental that it didn't do it previously. According to the logic,
_diffChildren()
got the filler position as a param and so it was injecting filler into theexpectedDomChildren
. However, the_updateChildren()
method didn't use theexpectedDomChildren
returned by_diffChildren()
but another array which it created earlier... That array should also contain the filler, but maybe the duplication caused some problems. IDK. But the logic didn't make sense, for sure.Now it seems that
_updateChildren()
and_updateText()
always take care of rendering the filler by themselves. It seems logical that there's no need to render the filler inrender()
if these two functions took care of everything.The text was updated successfully, but these errors were encountered: