aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2011-11-03 23:49:00 +0100
committerJoakim Verona2011-11-03 23:49:00 +0100
commit2670512ad701759689591a8a7a1661d356d9c8b4 (patch)
treeaf46a2e2521ce560e880166c9b6848462655dcf3
parente40ee7bd1eac05291eb99306f8b7afc7637e9064 (diff)
downloademacs-2670512ad701759689591a8a7a1661d356d9c8b4.tar.gz
emacs-2670512ad701759689591a8a7a1661d356d9c8b4.zip
even better relative links
-rw-r--r--README.xwidget17
-rw-r--r--lisp/xwidget.el15
2 files changed, 26 insertions, 6 deletions
diff --git a/README.xwidget b/README.xwidget
index 5b0bfcd91f3..ff7acb7b365 100644
--- a/README.xwidget
+++ b/README.xwidget
@@ -1185,9 +1185,20 @@ open a new window or something, which wont work.
1185have a look at how docview solves it 1185have a look at how docview solves it
1186webkit_web_view_search_text () 1186webkit_web_view_search_text ()
1187*** TODO webkit relative references doesn't work 1187*** TODO webkit relative references doesn't work
1188probably because we handle scrolling in a non-standard way. It does 1188because we handle scrolling in a non-standard way. It does
1189work sort of when theres a html frameset and webkit scrolls by itself. 1189work sort of when theres a html frameset and webkit scrolls by itself.
1190 1190
1191internal links (page.html#section) do not work
1192see xwidget-webkit-show-named-element
1193
1194also did some webkit signal work for this.
1195
1196now it actually works! except for I need to know the Y coordinate of
1197the element to navigate to, and that can either be by "name" or "id"
1198attribute, currently "id" works.
1199
1200
1201
1191*** TODO webkit width adjustment handling issue 1202*** TODO webkit width adjustment handling issue
1192since there are so many levels of clipping and whatnot in xwidgets 1203since there are so many levels of clipping and whatnot in xwidgets
1193sizing issues are difficult. 1204sizing issues are difficult.
@@ -1240,10 +1251,6 @@ that image-mode has special code to handle scrolling. the browser mode
1240and image mode has some similarities. 1251and image mode has some similarities.
1241 1252
1242I made some delegation code frrom webkit mode to image mode. 1253I made some delegation code frrom webkit mode to image mode.
1243*** TODO internal links (page.html#section) do not work
1244see xwidget-webkit-show-named-element
1245
1246also did some preliminary webkit signal work for this
1247*** TODO url-browse improvement 1254*** TODO url-browse improvement
1248sindikat: site.com and http://site.com should be equivalent (simple site.com 1255sindikat: site.com and http://site.com should be equivalent (simple site.com
1249 throws error) 1256 throws error)
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 0225889811d..71b3de5ff38 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -169,7 +169,7 @@ defaults to the string looking like a url around the cursor position."
169 (let ((elmid (progn (string-match ".*#\\(.*\\)" strarg)(match-string 1 strarg)))) 169 (let ((elmid (progn (string-match ".*#\\(.*\\)" strarg)(match-string 1 strarg))))
170 (message "navigation-policy-decision-requested: '%s' %s" strarg elmid ) 170 (message "navigation-policy-decision-requested: '%s' %s" strarg elmid )
171 171
172 (if elmid (xwidget-webkit-show-id-element xwidget elmid)) 172 (if elmid (xwidget-webkit-show-id-or-named-element xwidget elmid))
173 ) 173 )
174 174
175 ) 175 )
@@ -285,6 +285,19 @@ Argument STR string."
285 (set-window-vscroll (selected-window) y t)) 285 (set-window-vscroll (selected-window) y t))
286 ) 286 )
287 287
288(defun xwidget-webkit-show-id-or-named-element (xw element-id)
289 "make id-element show. for instance an anchor."
290 (interactive (list (xwidget-webkit-current-session) (read-string "element id:")))
291 (let* ((y1
292 (string-to-number (xwidget-webkit-execute-script-rv xw (format "document.getElementsByName('%s')[0].getBoundingClientRect().top" element-id) 0)))
293 (y2
294 (string-to-number (xwidget-webkit-execute-script-rv xw (format "document.getElementById('%s').getBoundingClientRect().top" element-id) 0)))
295 (y3 (max y1 y2)))
296 ;;now we need to tell emacs to scroll the element into view.
297 (message "scroll: %d" y3)
298 (set-window-vscroll (selected-window) y3 t))
299 )
300
288(defun xwidget-webkit-adjust-size-to-content () 301(defun xwidget-webkit-adjust-size-to-content ()
289 "Adjust webkit to content size." 302 "Adjust webkit to content size."
290 (interactive) 303 (interactive)