-;;the xwidget event needs to go into a higher level handler
-;;since the xwidget can generate an event even if its offscreen
-;;TODO this needs to use callbacks and consider different xw ev types
-(define-key (current-global-map) [xwidget-event] 'xwidget-event-handler)
-(defun xwidget-log ( &rest msg)
- (let ( (buf (get-buffer-create "*xwidget-log*")))
- (save-excursion
- (buffer-disable-undo buf)
- (set-buffer buf)
- (insert (apply 'format msg))
+(defun xwidget-webkit-scroll-up ()
+ "Scroll webkit up.
+Depending on the value of `xwidget-webkit-scroll-behavior',
+this scrolls in `native' fashion, or like `image-mode' would."
+ (interactive)
+ (if (eq xwidget-webkit-scroll-behavior 'native)
+ (xwidget-set-adjustment (xwidget-webkit-last-session) 'vertical t 50)
+ (image-scroll-up)))
+
+(defun xwidget-webkit-scroll-down ()
+ "Scroll webkit down.
+Depending on the value of `xwidget-webkit-scroll-behavior',
+this scrolls in `native' fashion, or like `image-mode' would."
+ (interactive)
+ (if (eq xwidget-webkit-scroll-behavior 'native)
+ (xwidget-set-adjustment (xwidget-webkit-last-session) 'vertical t -50)
+ (image-scroll-down)))
+
+(defun xwidget-webkit-scroll-forward ()
+ "Scroll webkit forwards.
+Depending on the value of `xwidget-webkit-scroll-behavior',
+this scrolls in `native' fashion, or like `image-mode' would."
+ (interactive)
+ (if (eq xwidget-webkit-scroll-behavior 'native)
+ (xwidget-set-adjustment (xwidget-webkit-last-session) 'horizontal t 50)
+ (xwidget-webkit-scroll-forward))) ; FIXME infloop!
+
+(defun xwidget-webkit-scroll-backward ()
+ "Scroll webkit backwards.
+Depending on the value of `xwidget-webkit-scroll-behavior',
+this scrolls in `native' fashion, or like `image-mode' would."
+ (interactive)
+ (if (eq xwidget-webkit-scroll-behavior 'native)
+ (xwidget-set-adjustment (xwidget-webkit-last-session) 'horizontal t -50)
+ (xwidget-webkit-scroll-backward))) ; FIXME infloop!
+
+
+;; The xwidget event needs to go into a higher level handler
+;; since the xwidget can generate an event even if it's offscreen.
+;; TODO this needs to use callbacks and consider different xwidget event types.
+(define-key (current-global-map) [xwidget-event] #'xwidget-event-handler)
+(defun xwidget-log (&rest msg)
+ "Log MSG to a buffer."
+ (let ((buf (get-buffer-create " *xwidget-log*")))
+ (with-current-buffer buf
+ (insert (apply #'format msg))