Bug 215406

Summary: Text manipulation should not manipulate nodes out of paragraph range
Product: WebKit Reporter: Sihui Liu <sihui_liu>
Component: HTML EditingAssignee: 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 Flags
Patch
none
Patch for landing none

Sihui Liu
Reported 2020-08-11 21:03:58 PDT
...
Attachments
Patch (5.73 KB, patch)
2020-08-11 21:15 PDT, Sihui Liu
no flags
Patch for landing (5.75 KB, patch)
2020-08-24 10:39 PDT, Sihui Liu
no flags
Sihui Liu
Comment 1 2020-08-11 21:15:30 PDT
Wenson Hsieh
Comment 2 2020-08-12 09:31:49 PDT
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()); ```
Radar WebKit Bug Importer
Comment 3 2020-08-18 21:04:14 PDT
Ryosuke Niwa
Comment 4 2020-08-20 17:42:47 PDT
Is this patch getting landed??
Sihui Liu
Comment 5 2020-08-24 09:19:50 PDT
(In reply to Ryosuke Niwa from comment #4) > Is this patch getting landed?? Yes, will land soon.
Sihui Liu
Comment 6 2020-08-24 10:36:42 PDT
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.
Sihui Liu
Comment 7 2020-08-24 10:39:16 PDT
Created attachment 407109 [details] Patch for landing
EWS
Comment 8 2020-08-24 11:06:05 PDT
Committed r266075: <https://trac.webkit.org/changeset/266075> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407109 [details].
Note You need to log in before you can comment on or make changes to this bug.