[Webkit-unassigned] [Bug 161215] charactersAroundPosition can be wrong because it crosses editing boundaries

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 26 14:12:58 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=161215

--- Comment #5 from Beth Dakin <bdakin at apple.com> ---
(In reply to comment #4)
> Comment on attachment 287027 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=287027&action=review
> 
> It looks like fast/dom/focus-contenteditable.html is failing on WebKit2. 
> Please check that before landing it.
> 

I investigated, and this test is going back to its pre-https://trac.webkit.org/changeset/195078 state. That change caused this test to have a different layout because it caused more layouts to happen. Now that we don’t allow the call to charactersAroundPosition() to cross editing boundaries, those layouts don’t happen, and we have the old behavior back.

> > Source/WebCore/ChangeLog:5
> > +        -and corresponding-
> 
> I don't think we need this line.
> 
> > Source/WebCore/ChangeLog:14
> > +        VisiblePosition::previous().
> > +        * editing/VisibleUnits.cpp:
> 
> We need a blank line here.
> 

Added.

> > LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html:3
> > +<script src=../../editing.js language="javascript" type="text/javascript"></script>
> 
> We don't need language & type attributes.
> 

Removed.

> > LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html:10
> > +    var s = window.getSelection();
> 
> It looks like this variable is never used.
> 

Removed.

> > LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html:32
> > +<div style="visibility:hidden;">
> > +    <br>
> > +</div>
> > +
> > +<div style="width: 1px; height: 1px;"></div>
> 
> Do we really need these stray elements?

We do!! These elements are key to reproduce the bug. When charactersAroundPosition can cross editing boundaries, this DOM structure tricks it into thinking that the <br> inside the hidden div is the character before the caret. And when we think a newline is the character before the caret, we don't replace the typed text with the candidate.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160826/bd144d3c/attachment.html>


More information about the webkit-unassigned mailing list