2006-09-26 David Smith <catfish.man@gmail.com>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2006 02:46:19 +0000 (02:46 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2006 02:46:19 +0000 (02:46 +0000)
        Reviewed by Timothy.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=3723
        Add -scrollDOMRangeToVisible:

        No automated tests are possible as this code path isn't reachable from JavaScript.

        * bridge/mac/WebCoreFrameBridge.h:
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge scrollDOMRangeToVisible:]):

2006-09-26  David Smith  <catfish.man@gmail.com>

        Reviewed by Timothy.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=3723
        Add -scrollDOMRangeToVisible:

        * WebView/WebView.m:
        (-[WebView scrollDOMRangeToVisible:]):
        * WebView/WebViewPrivate.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16761 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bridge/mac/WebCoreFrameBridge.h
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebKit/ChangeLog
WebKit/WebView/WebView.m
WebKit/WebView/WebViewPrivate.h

index a5e9b43e4f3404da8ea08e478a42933c6d06431c..e361b1b9382a678ceae60c6658bea2341c77af53 100644 (file)
@@ -1,3 +1,16 @@
+2006-09-26  David Smith  <catfish.man@gmail.com>
+
+        Reviewed by Timothy.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=3723
+        Add -scrollDOMRangeToVisible:
+
+        No automated tests are possible as this code path isn't reachable from JavaScript.
+
+        * bridge/mac/WebCoreFrameBridge.h:
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge scrollDOMRangeToVisible:]):
+
 2006-10-03  Graham Dennis  <graham.dennis@gmail.com>
 
         Reviewed by Timothy.
index 65cbecf0421a2b3da7953d0112eae067c2f2a612..52749e3c0b3a71460e95a331cb23204724420fe8 100644 (file)
@@ -358,6 +358,7 @@ typedef enum {
 - (NSImage *)selectionImageForcingWhiteText:(BOOL)forceWhiteText;
 - (NSRect)caretRectAtNode:(DOMNode *)node offset:(int)offset affinity:(NSSelectionAffinity)affinity;
 - (NSRect)firstRectForDOMRange:(DOMRange *)range;
+- (void)scrollDOMRangeToVisible:(DOMRange *)range;
 
 - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity closeTyping:(BOOL)closeTyping;
 - (DOMRange *)selectedDOMRange;
index 63f881e5a628d01cace8754e9d52f50b74b104f2..bfa8e9e636f9dc181567c2ac13188d3f141344e2 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
  * Copyright (C) 2005, 2006 Alexey Proskuryakov (ap@nypop.com)
+ * Copyright (C) 2006 David Smith (catfish.man@gmail.com)
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -1429,6 +1430,18 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
                  startCaretRect.height());
 }
 
+- (void)scrollDOMRangeToVisible:(DOMRange *)range
+{
+    NSRect rangeRect = [self firstRectForDOMRange:range];    
+    Node *startNode = [[range startContainer] _node];
+        
+    if (startNode && startNode->renderer()) {
+        RenderLayer *layer = startNode->renderer()->enclosingLayer();
+        if (layer)
+            layer->scrollRectToVisible(enclosingIntRect(rangeRect), RenderLayer::gAlignToEdgeIfNeeded, RenderLayer::gAlignToEdgeIfNeeded);
+    }
+}
+
 - (NSImage *)selectionImageForcingWhiteText:(BOOL)forceWhiteText;
 {
     return m_frame->selectionImage(forceWhiteText);
index 9b867939b2624ff874cd23def9a1edf8061a33bf..d7af3b562683e818dc8539d817f6d64bec995dfa 100644 (file)
@@ -1,3 +1,14 @@
+2006-09-26  David Smith  <catfish.man@gmail.com>
+
+        Reviewed by Timothy.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=3723
+        Add -scrollDOMRangeToVisible:
+
+        * WebView/WebView.m:
+        (-[WebView scrollDOMRangeToVisible:]):
+        * WebView/WebViewPrivate.h:
+
 2006-10-03  Graham Dennis  <graham.dennis@gmail.com>
 
         Reviewed by Timothy.
index d92b36b2897882ebae41bd8f198a1baf2d0915ac..2471b102498698537ecc1e718e574a30f43cebcb 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 David Smith (catfish.man@gmail.com)
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -3063,6 +3064,11 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 @implementation WebView (WebViewEditing)
 
+- (void)scrollDOMRangeToVisible:(DOMRange *)range
+{
+    [[[range startContainer] _bridge] scrollDOMRangeToVisible:range];
+}
+
 - (DOMRange *)editableDOMRangeForPoint:(NSPoint)point
 {
     WebFrameBridge *bridge = [self _bridgeAtPoint:point];
index c00afee16e913953eca6c455445b1672c4a7c4ca..b99eba5a309f236f55a9edc51b9bb6f968e3c215 100644 (file)
@@ -78,6 +78,8 @@ typedef enum {
 - (void)setTabKeyCyclesThroughElements:(BOOL)cyclesElements;
 - (BOOL)tabKeyCyclesThroughElements;
 
+- (void)scrollDOMRangeToVisible:(DOMRange *)range;
+
 /*!
 @method setScriptDebugDelegate:
 @abstract Set the WebView's WebScriptDebugDelegate delegate.