WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
35368
Frame should use SelectionController's TextGranularity instead of its own
https://bugs.webkit.org/show_bug.cgi?id=35368
Summary
Frame should use SelectionController's TextGranularity instead of its own
Ojan Vafai
Reported
2010-02-24 16:57:32 PST
Frame should use SelectionController's TextGranularity instead of it's own
Attachments
Patch
(42.06 KB, patch)
2010-02-24 17:01 PST
,
Ojan Vafai
no flags
Details
Formatted Diff
Diff
Patch
(36.76 KB, patch)
2010-03-01 15:38 PST
,
Ojan Vafai
no flags
Details
Formatted Diff
Diff
mistmatched editing callbacks
(628 bytes, text/html)
2010-03-04 12:08 PST
,
Ojan Vafai
no flags
Details
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Ojan Vafai
Comment 1
2010-02-24 17:01:47 PST
Created
attachment 49451
[details]
Patch
Sam Weinig
Comment 2
2010-02-24 18:42:10 PST
Your changelog says there is no functionality change but it seems like a lot of tests are changing their results. Is there a way you can construct this patch such that results don't change.
Ojan Vafai
Comment 3
2010-02-24 19:37:25 PST
All the changes in test results are either extraneous "webViewDidChangeSelection:WebViewDidChangeSelectionNotification" or selection changes from one range to the *same* range, at least according to what editing delegate dumps. I don't really understand why this change affects affects those. I went through each of these tests and manually verified that the user-visible behavior is the same with and without the patch, hence my comment that there's no functionality change. I came to the conclusion that it's just a quirk of how we dump editing delegate info. That's just a guess though. I can spend some time tomorrow trying to understand where the extra notifications are coming from.
Sam Weinig
Comment 4
2010-02-26 08:37:36 PST
Comment on
attachment 49451
[details]
Patch I am going to r-. A patch which claims no change should not change test behavior, especially if it cannot be fully explained.
Ojan Vafai
Comment 5
2010-03-01 15:38:24 PST
Created
attachment 49759
[details]
Patch
Alexey Proskuryakov
Comment 6
2010-03-02 20:54:28 PST
With this patch, a shouldChangeSelectedDOMRange delegate method is being called, but a subsequent webViewDidChangeSelection one no longer is. This is quite suspicious, and perhaps it violates what can be considered an invariant in the API. VisibleSelection is a member if EditCommand, used for restoring selection after undo/redo. This patch looks like it actually changes behavior, so that selection granularity isn't restored. Is this indeed the case?
Ojan Vafai
Comment 7
2010-03-03 18:45:49 PST
(In reply to
comment #6
)
> With this patch, a shouldChangeSelectedDOMRange delegate method is being > called, but a subsequent webViewDidChangeSelection one no longer is. This is > quite suspicious, and perhaps it violates what can be considered an invariant > in the API.
OK. I'll look into this more.
> VisibleSelection is a member if EditCommand, used for restoring selection after > undo/redo. This patch looks like it actually changes behavior, so that > selection granularity isn't restored. Is this indeed the case?
I didn't think about this case. It turns out that our current behavior doesn't match TextEdit anyways. TextEdit, as best I can tell, always uses CharacterGranularity after an undo, but it selects the space that got smart deleted. I've filed a patch at
bug 35713
to fix that. Then this problem goes away. :)
Ojan Vafai
Comment 8
2010-03-03 18:46:36 PST
Comment on
attachment 49759
[details]
Patch r- until
bug 35713
is resolved and the other issue AP brought up is addressed.
Ojan Vafai
Comment 9
2010-03-04 12:08:02 PST
(In reply to
comment #7
)
> (In reply to
comment #6
) > > With this patch, a shouldChangeSelectedDOMRange delegate method is being > > called, but a subsequent webViewDidChangeSelection one no longer is. This is > > quite suspicious, and perhaps it violates what can be considered an invariant > > in the API. > > OK. I'll look into this more.
This is not currently an invariant of the API. Anytime SelectionController::setSelection early returns, we'd see this mismatch. In this case, this patch hits an early return at line 141 of SelectionController.cpp. Since the granularity is no longer a member of the VisibleSelection, the selection itself is not actually changing. I'm attaching an example test that also has this mismatch and hits the same early return on a clean trunk build (single click in the same spot twice).
Ojan Vafai
Comment 10
2010-03-04 12:08:44 PST
Created
attachment 50046
[details]
mistmatched editing callbacks
Ojan Vafai
Comment 11
2010-03-04 12:09:43 PST
Comment on
attachment 49759
[details]
Patch Marking for review again as the callback concern has been addressed and the undo concern will be addressed once
bug 35713
is resolved.
Ojan Vafai
Comment 12
2010-03-04 17:09:20 PST
Comment on
attachment 49759
[details]
Patch I've rolled this patch into the fix for
bug 35314
since that patch would remove many of the lines added in this one. I'll close the bug once
bug 35314
is resolved.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug