-
Notifications
You must be signed in to change notification settings - Fork 6k
Add Paragraph#getPositionForOffset #2327
Conversation
We'll use this function to position the caret when the user taps a text input control. Very little of the code in this patch is actually new. Most of it is restoring code that we previously removed from the engine. I've made some small changes to the restored code to handle the lack of a DOM. The only major change is to RenderObject::createPositionWithAffinity, which now just returns the values it captures instead of trying to compute a DOM position. TextAffinity and TextPosition are lifted from package:flutter. Once this patch rolls into package:flutter, I'll remove the declarations there.
812b7d5 to
21d7575
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is dead, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still have RenderReplaced, but there's no way to create one currently. We do want to let people have replaced objects in their text flows (e.g., material chips), but we haven't sorted out how we're going to do that yet.
|
Too much C++ code for me to really digest in one go. But I trust you that you're restoring. rslgtm. |
Add Paragraph#getPositionForOffset
|
It's like restoring antique furniture. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
writing-mode is about vertical text, right? I think this comment is moot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
|
At some point I really should try to learn all this code, but for now, what Eric said. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "with between"
* npe fixes * fmt * sort * review follow-up * cleanup
We'll use this function to position the caret when the user taps a text
input control.
Very little of the code in this patch is actually new. Most of it is
restoring code that we previously removed from the engine. I've made
some small changes to the restored code to handle the lack of a DOM. The
only major change is to RenderObject::createPositionWithAffinity, which
now just returns the values it captures instead of trying to compute a
DOM position.
TextAffinity and TextPosition are lifted from package:flutter. Once this
patch rolls into package:flutter, I'll remove the declarations there.