Bug 107850 - Make moveCaretTowardsWindowPoint not snap to the beginning/end when moved above/below editable
Summary: Make moveCaretTowardsWindowPoint not snap to the beginning/end when moved abo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-24 11:42 PST by Chris Hopman
Modified: 2013-02-04 17:29 PST (History)
12 users (show)

See Also:


Attachments
Patch (5.01 KB, patch)
2013-01-24 12:51 PST, Chris Hopman
no flags Details | Formatted Diff | Diff
Patch (7.28 KB, patch)
2013-01-25 16:11 PST, Chris Hopman
no flags Details | Formatted Diff | Diff
Patch (17.06 KB, patch)
2013-01-31 18:08 PST, Chris Hopman
no flags Details | Formatted Diff | Diff
Updated more tests (43.19 KB, patch)
2013-01-31 23:33 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Patch (45.95 KB, patch)
2013-02-04 16:04 PST, Chris Hopman
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Hopman 2013-01-24 11:42:12 PST
Make moveCaretTowardsWindowPoint not snap to the beginning/end when moved above/below editable
Comment 1 Chris Hopman 2013-01-24 12:51:07 PST
Created attachment 184556 [details]
Patch
Comment 2 Alexey Proskuryakov 2013-01-24 22:20:52 PST
This doesn't have a regression test. Is there no behavior change?
Comment 3 Chris Hopman 2013-01-25 16:11:25 PST
Created attachment 184834 [details]
Patch
Comment 4 Chris Hopman 2013-01-25 16:12:16 PST
(In reply to comment #2)
> This doesn't have a regression test. Is there no behavior change?

Added a test for the changed behavior.
Comment 5 Ryosuke Niwa 2013-01-30 15:12:35 PST
Comment on attachment 184834 [details]
Patch

I don't understand what you're trying to to do at all but I don't like the code being added to VisiblePosition here.
Comment 6 Ojan Vafai 2013-01-30 15:59:22 PST
Comment on attachment 184834 [details]
Patch

Can we fix this by adding EditingAndroidBehavior and making it do the same as EditingWindowsBehavior in the right places or does that not work for some reason?
Comment 7 Ryosuke Niwa 2013-01-30 16:02:36 PST
(In reply to comment #6)
> (From update of attachment 184834 [details])
> Can we fix this by adding EditingAndroidBehavior and making it do the same as EditingWindowsBehavior in the right places or does that not work for some reason?

That seems like an acceptable solution although it means that we have to update the existing editing layout tests to test this editing behavior as well.
Comment 8 Chris Hopman 2013-01-30 16:09:47 PST
(In reply to comment #6)
> (From update of attachment 184834 [details])
> Can we fix this by adding EditingAndroidBehavior and making it do the same as EditingWindowsBehavior in the right places or does that not work for some reason?

That would be nice... I tried that first: https://bugs.webkit.org/show_bug.cgi?id=107171

Really though, moveCaret should have that behavior on all platforms that use it. Currently, only Android uses this function so adding the editing behavior would work. In the future, if another platform wanted to use the function, it would be impractical to expect that platform to change their EditingBehavior.

rniwa@ mentioned the possibility of having positionForPoint optionally take a flag for shouldMoveCaretTo[...]. Currently EditingBehavior::shouldMoveCaret[...] is used in RenderBlock::positionForPointWithInlineChildren and its setting completely changes the behavior of RenderObject::positionForPoint. It makes sense to me for that to actually be more exposed/obvious to callers of positionForPoint. What do you think?
Comment 9 Ojan Vafai 2013-01-30 17:23:24 PST
(In reply to comment #8)
> (In reply to comment #6)
> > (From update of attachment 184834 [details] [details])
> > Can we fix this by adding EditingAndroidBehavior and making it do the same as EditingWindowsBehavior in the right places or does that not work for some reason?
> 
> That would be nice... I tried that first: https://bugs.webkit.org/show_bug.cgi?id=107171

Sigh. I agree with Darin obviously (Darin and I came up with the concept EditingBehavior in the first place). Android is a different OS and has different editing behavior. I don't see what the problem is with adding a new editing behavior is. It's not like we get a new OS that often.

> Really though, moveCaret should have that behavior on all platforms that use it. 

This is not clear to me. It seems like it should just respect whatever editing behavior you pick. Why would another platform choose to use this but not want their platform's normal editing behavior?

> rniwa@ mentioned the possibility of having positionForPoint optionally take a flag for shouldMoveCaretTo[...]. Currently EditingBehavior::shouldMoveCaret[...] is used in RenderBlock::positionForPointWithInlineChildren and its setting completely changes the behavior of RenderObject::positionForPoint. It makes sense to me for that to actually be more exposed/obvious to callers of positionForPoint. What do you think?

Adding a new EditingBehavior is the clear correct approach here IMO. We should just do that as per your first patch on bug 107171. Please upload that patch + tests and I will approve it. Sorry you've gotten the runaround on this.
Comment 10 Levi Weintraub 2013-01-30 17:40:45 PST
(In reply to comment #9)
> Adding a new EditingBehavior is the clear correct approach here IMO. We should just do that as per your first patch on bug 107171. Please upload that patch + tests and I will approve it. Sorry you've gotten the runaround on this.

This was my belief from the start as well. Android has its own editing behavior and should be defined as such.
Comment 11 Ryosuke Niwa 2013-01-30 18:08:26 PST
If you're adding a new editing behavior, please be sure to update existing layout tests in LayoutTests/editing that manually set editing behavior.
Comment 12 Ryosuke Niwa 2013-01-30 18:11:55 PST
Comment on attachment 184834 [details]
Patch

I'm gonna say r-. I don't think it makes sense to add this code to VisiblePosition from the discussion we've had so far.
Comment 13 Ojan Vafai 2013-01-30 18:59:38 PST
(In reply to comment #11)
> If you're adding a new editing behavior, please be sure to update existing layout tests in LayoutTests/editing that manually set editing behavior.

I don't see why this needs to be a prerequisite to landing this patch.
Comment 14 Ryosuke Niwa 2013-01-30 19:12:52 PST
(In reply to comment #13)
> (In reply to comment #11)
> > If you're adding a new editing behavior, please be sure to update existing layout tests in LayoutTests/editing that manually set editing behavior.
> 
> I don't see why this needs to be a prerequisite to landing this patch.

It needs to be because the whole point of those tests is that they test all editing behaviors.
Comment 15 Ryosuke Niwa 2013-01-30 19:14:46 PST
There are less than 40 tests that call setEditingBehavior, of which only few of them really test all editing behaviors so I don't think this is a unfair/unreasonable requirement at all.
Comment 16 Ojan Vafai 2013-01-31 10:35:13 PST
(In reply to comment #14)
> (In reply to comment #13)
> > (In reply to comment #11)
> > > If you're adding a new editing behavior, please be sure to update existing layout tests in LayoutTests/editing that manually set editing behavior.
> > 
> > I don't see why this needs to be a prerequisite to landing this patch.
> 
> It needs to be because the whole point of those tests is that they test all editing behaviors.

I agree that it would be nice to do, but I don't see any benefit from coupling it with this patch.
Comment 17 Ryosuke Niwa 2013-01-31 10:56:34 PST
(In reply to comment #16)
> (In reply to comment #14)
> > (In reply to comment #13)
> > > (In reply to comment #11)
> > > > If you're adding a new editing behavior, please be sure to update existing layout tests in LayoutTests/editing that manually set editing behavior.
> > > 
> > > I don't see why this needs to be a prerequisite to landing this patch.
> > 
> > It needs to be because the whole point of those tests is that they test all editing behaviors.
> 
> I agree that it would be nice to do, but I don't see any benefit from coupling it with this patch.

It's not nice to do. It must be done when a new editing behavior is added. That's what we did when we added 'unix' editing behavior.
Comment 18 Ryosuke Niwa 2013-01-31 11:04:45 PST
I just don't know why you're so opposed to the idea of requiring this change when we're adding new editing behavior. But whatever. I'll just write a patch to do it myself and upload it somewhere.

So please stop arguing about this.
Comment 19 Chris Hopman 2013-01-31 18:08:05 PST
Created attachment 185909 [details]
Patch
Comment 20 WebKit Review Bot 2013-01-31 18:12:07 PST
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 21 Ryosuke Niwa 2013-01-31 23:33:16 PST
Created attachment 185955 [details]
Updated more tests
Comment 22 Chris Hopman 2013-02-04 16:04:23 PST
Created attachment 186487 [details]
Patch
Comment 23 WebKit Review Bot 2013-02-04 17:29:01 PST
Comment on attachment 186487 [details]
Patch

Clearing flags on attachment: 186487

Committed r141837: <http://trac.webkit.org/changeset/141837>
Comment 24 WebKit Review Bot 2013-02-04 17:29:07 PST
All reviewed patches have been landed.  Closing bug.