[Webkit-unassigned] [Bug 71207] An extra line break is inserted when pasting into a font element
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Mar 26 09:49:53 PDT 2012
https://bugs.webkit.org/show_bug.cgi?id=71207
--- Comment #14 from yi shen <yi.4.shen at nokia.com> 2012-03-26 09:49:53 PST ---
Thanks for the follow up :) But I have two concerns about your code,
1) Since the Position::next() is still used here, it is possible to move the insertion position into sibling node's child, which seems incorrect (that's why my patch doesn't use position::next to avoid it). e.g
<div><u><u>text underline<u>^<u>test underline</u></u></div>
==>
<div><u><u>text underline<u><u>^test underline</u></u></div>
2) It is possible to move the insertion position to the end of the enclosingBlock. That's why some tests failed.
e.g.
<div><u>abc^</u>#text "\n"<div> ==> <div><u>abc^</u>#text "\n"<div>^
This can be fixed by changing the for statement to
for (Position nextPosition = pos; nextPosition.containerNode() != enclosingBlock; pos = nextPosition) {
...
}
(In reply to comment #13)
> Anyway, my preference is to do something along the line of:
>
> Index: Source/WebCore/editing/ReplaceSelectionCommand.cpp
> ===================================================================
> --- Source/WebCore/editing/ReplaceSelectionCommand.cpp (revision 111896)
> +++ Source/WebCore/editing/ReplaceSelectionCommand.cpp (working copy)
> @@ -121,9 +121,14 @@
> // same. E.g.,
> // <div>foo^</div>^
> // The two positions above are the same visual position, but we want to stay in the same block.
> - Node* stopNode = pos.deprecatedNode()->enclosingBlockFlowElement();
> - while (stopNode != pos.deprecatedNode() && VisiblePosition(pos) == VisiblePosition(pos.next()))
> - pos = pos.next();
> + Node* enclosingBlock = pos.containerNode()->enclosingBlockFlowElement();
> + for (Position nextPosition = pos; ;pos = nextPosition) {
> + nextPosition = pos.next();
> + if (nextPosition == pos
> + || nextPosition.containerNode()->enclosingBlockFlowElement() != enclosingBlock
> + || VisiblePosition(pos) != VisiblePosition(nextPosition))
> + break;
> + }
> return pos;
> }
>
> Note that a couple of tests fail with this change along, and there's about a dozen test to be rebaselined.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list