WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
3723
Add -[WebView scrollDOMRangeToVisible:]
https://bugs.webkit.org/show_bug.cgi?id=3723
Summary
Add -[WebView scrollDOMRangeToVisible:]
Duncan Wilcox
Reported
2005-06-26 07:38:41 PDT
-[WebView setSelectedDOMRange:affinity:] calls -[WebCoreBridge setSelectedDOMRange:affinity:closeTyping:], that in turn doesn't appear to ever directly or indirectly call - [WebCoreBridge ensureSelectionVisible]. -[WebView setSelectedDOMRange:affinity:] isn't documented as making the selection visible, but if it turns out it shouldn't then there's no public API for functionality equivalent to -[WebCoreBridge ensureSelectionVisible].
Attachments
testcase
(1.43 KB, application/octet-stream)
2005-07-01 00:32 PDT
,
Duncan Wilcox
no flags
Details
js testcase
(1.25 KB, text/html)
2005-07-01 00:34 PDT
,
Duncan Wilcox
no flags
Details
Patch
(2.88 KB, patch)
2005-10-06 07:56 PDT
,
Justin Garcia
no flags
Details
Formatted Diff
Diff
Updated patch
(2.64 KB, patch)
2006-09-25 02:10 PDT
,
David Smith
no flags
Details
Formatted Diff
Diff
Updated patch take 2: no tabs here
(2.66 KB, patch)
2006-09-25 14:53 PDT
,
David Smith
timothy
: review-
Details
Formatted Diff
Diff
Updated patch, take 3
(4.49 KB, patch)
2006-09-26 01:21 PDT
,
David Smith
timothy
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Duncan Wilcox
Comment 1
2005-06-26 07:43:31 PDT
Also javascript code seems to follow a completely different path and doesn't appear to scroll the view (as far as I could tell browsing through the code and writing small tests).
Joost de Valk (AlthA)
Comment 2
2005-06-30 11:35:47 PDT
Is there any way to reproduce this? A layout test perhaps? An automated webkit test? As long as there isn't, i can't confirm this bug.
Duncan Wilcox
Comment 3
2005-07-01 00:32:34 PDT
Created
attachment 2725
[details]
testcase Here's an objective-c testcase. Create a cocoa app in xcode, replace main.m with the attachment and add the WeKit.framework to the project.
Duncan Wilcox
Comment 4
2005-07-01 00:34:32 PDT
Created
attachment 2726
[details]
js testcase Here's a javascript testcase, same effect (doesn't scroll to selection), though the codepath it follows internally is completely different.
Darin Adler
Comment 5
2005-08-23 09:35:21 PDT
I don't think that changing the selection should have a side effect of scrolling to the selection. On the other hand, WebView's API for selection and editing was based on NSTextView's API, and NSTextView has a scrollRangeToVisible: method. We might want to add the equivalent.
Justin Garcia
Comment 6
2005-10-06 07:56:09 PDT
Created
attachment 4235
[details]
Patch Added -[WebView scrollDOMRangeToVisible:] to public-pending api. For the bridge method, I look for a node in the DOM range that has a valid rect, in case the start/end containers are invisible. -[NSText scrollRangeToVisible:]'s documentation <
http://tuvix.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSText.html#//apple_ref/doc/uid/20000367-scrollRangeToVisible_
> reads: Scrolls the receiver in its enclosing scroll view so the first characters of aRange are visible. This isn't clear on where the range will appear within the scrolled view. I just put it in the upper left. Tested with the previously attached sample app.
Justin Garcia
Comment 7
2005-10-06 20:29:16 PDT
Oops I just realized that -[WebCoreBridge firstRectForDOMRange] already exists. I'll redo this to use that.
David Smith
Comment 8
2006-09-25 02:10:40 PDT
Created
attachment 10750
[details]
Updated patch I noticed this bug hadn't been touched in a while, so I updated the patch to a) work on the modern directory layout/file names, and b) use -[WebCoreBridge firstRectForDOMRange] as suggested by Justin.
David Smith
Comment 9
2006-09-25 14:53:49 PDT
Created
attachment 10773
[details]
Updated patch take 2: no tabs here Silly Xcode not being able to set tabs/spaces per-project.
Timothy Hatcher
Comment 10
2006-09-25 21:58:06 PDT
Comment on
attachment 10773
[details]
Updated patch take 2: no tabs here Sorry still has tabs. Other comments: You need to add this to WebViewPrivate.h. We can't modify WebView.h wihtout getting the API approved first. Please include a ChangeLog.
Timothy Hatcher
Comment 11
2006-09-25 21:58:50 PDT
You should also add yourself to the copyright in the header of WebView.m and WebCoreFrameBridge.m
David Smith
Comment 12
2006-09-26 01:21:55 PDT
Created
attachment 10779
[details]
Updated patch, take 3 Doublechecked the tabs (regex search in Xcode for \t should catch all of them, right?), added changelog entry, moved declaration to WebViewPrivate, fixed a spacing issue to conform to coding style, added self to WebView.m and WebCoreFrameBridge.mm copyright section.
Mark Rowe (bdash)
Comment 13
2006-10-03 19:50:16 PDT
Landed in
r16761
.
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