Summary: | Text manipulation should not manipulate nodes out of paragraph range | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Sihui Liu <sihui_liu> | ||||||
Component: | HTML Editing | Assignee: | Sihui Liu <sihui_liu> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | ews-watchlist, mifenton, rniwa, webkit-bug-importer, wenson_hsieh | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Sihui Liu
2020-08-11 21:03:58 PDT
Created attachment 406445 [details]
Patch
Comment on attachment 406445 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406445&action=review > Source/WebCore/ChangeLog:3 > + Text manipulationshould not manipulate nodes out of paragraph range Nit - space before “should” > Source/WebCore/ChangeLog:9 > + the nodes on the start path but out ouf range correctly, and may change position of those nodes by mistake. For Nit - “out of” > Source/WebCore/editing/TextManipulationController.cpp:840 > + while (!startTopDownPath.isEmpty()) { > + auto lastNode = startTopDownPath.last(); > + ASSERT(is<ContainerNode>(lastNode.get())); > + if (!downcast<ContainerNode>(lastNode.get()).hasOneChild()) > + break; > + nodesToRemove.add(startTopDownPath.takeLast()); > + } Perhaps getPath() should just return `Vector<Ref<ContainerNode>>` instead, and change this into something along the lines of: ``` while (!startTopDownPath.isEmpty() && startTopDownPath.last()->hasOneChild()) nodesToRemove.add(startTopDownPath.takeLast()); ``` Is this patch getting landed?? (In reply to Ryosuke Niwa from comment #4) > Is this patch getting landed?? Yes, will land soon. Comment on attachment 406445 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406445&action=review >> Source/WebCore/ChangeLog:3 >> + Text manipulationshould not manipulate nodes out of paragraph range > > Nit - space before “should” Okay. >> Source/WebCore/ChangeLog:9 >> + the nodes on the start path but out ouf range correctly, and may change position of those nodes by mistake. For > > Nit - “out of” Okay. >> Source/WebCore/editing/TextManipulationController.cpp:840 >> + } > > Perhaps getPath() should just return `Vector<Ref<ContainerNode>>` instead, and change this into something along the lines of: > ``` > while (!startTopDownPath.isEmpty() && startTopDownPath.last()->hasOneChild()) > nodesToRemove.add(startTopDownPath.takeLast()); > ``` I tried this and found we need to make changes to updateInsertions(), which seems unnecessary for fixing the bug. I can do this in a follow-up patch, as getPath should only return ContainerNodes. Created attachment 407109 [details]
Patch for landing
Committed r266075: <https://trac.webkit.org/changeset/266075> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407109 [details]. |