WebCore:
authortomernic <tomernic@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jul 2006 04:55:40 +0000 (04:55 +0000)
committertomernic <tomernic@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jul 2006 04:55:40 +0000 (04:55 +0000)
        Reviewed by Maciej.

        <rdar://problem/4612079> need a way to prevent pages from scrolling to reveal elements that are focused
        by script

        * bridge/mac/WebCoreFrameBridge.h:
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge setProhibitsScrolling:]):
        * page/Frame.cpp:
        (WebCore::Frame::prohibitsScrolling):
        (WebCore::Frame::setProhibitsScrolling):
        * page/Frame.h:
        * page/FramePrivate.h:
        (WebCore::FramePrivate::FramePrivate):
        * page/FrameView.cpp:
        (WebCore::FrameView::scrollPointRecursively):
        (WebCore::FrameView::setContentsPos):
        * page/FrameView.h:
        * platform/ScrollView.h:

WebKit:

        Reviewed by Maciej.

        <rdar://problem/4612079> need a way to prevent pages from scrolling to reveal elements that are focused
        by script

        * WebView/WebViewPrivate.h:
        * WebView/WebView.m:
        (-[WebView setProhibitsMainFrameScrolling:]):
        New method.  Prohibits scrolling in the WebView's main frame.  Used to "lock" a WebView to a specific
        scroll position.

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

12 files changed:
WebCore/ChangeLog
WebCore/bridge/mac/WebCoreFrameBridge.h
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FramePrivate.h
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/platform/ScrollView.h
WebKit/ChangeLog
WebKit/WebView/WebView.m
WebKit/WebView/WebViewPrivate.h

index ff55fa8accc1b7094ea0a5a5a9a93b2a4d0fa6be..7dc3c0acc5d1e238b8b8a52ecdde8344681f15cb 100644 (file)
@@ -1,3 +1,25 @@
+2006-07-17  Tim Omernick  <timo@apple.com>
+
+        Reviewed by Maciej.
+
+        <rdar://problem/4612079> need a way to prevent pages from scrolling to reveal elements that are focused
+        by script
+
+        * bridge/mac/WebCoreFrameBridge.h:
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge setProhibitsScrolling:]):
+        * page/Frame.cpp:
+        (WebCore::Frame::prohibitsScrolling):
+        (WebCore::Frame::setProhibitsScrolling):
+        * page/Frame.h:
+        * page/FramePrivate.h:
+        (WebCore::FramePrivate::FramePrivate):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollPointRecursively):
+        (WebCore::FrameView::setContentsPos):
+        * page/FrameView.h:
+        * platform/ScrollView.h:
+
 2006-07-17  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Dave Harrison.
index 273cabe9cd613297e95d68211541c329807615c6..fe8c17c226df0a2440e560d5fe1817d34ebb149f 100644 (file)
@@ -497,6 +497,8 @@ typedef enum {
 - (void)setInViewSourceMode:(BOOL)flag;
 - (BOOL)inViewSourceMode;
 
+- (void)setProhibitsScrolling:(BOOL)prohibits;
+
 @end
 
 // The WebCoreFrameBridge protocol contains methods for use by the WebCore side of the bridge.
index 10d4e0228f54415fba068354fc43c2db6667b2cc..318e184bce4b99ba01e7b36a3a2e2072263768f9 100644 (file)
@@ -2601,6 +2601,11 @@ static NSCharacterSet *_getPostSmartSet(void)
     return m_frame->inViewSourceMode();
 }
 
+- (void)setProhibitsScrolling:(BOOL)prohibits
+{
+    m_frame->setProhibitsScrolling(prohibits);
+}
+
 @end
 
 @implementation WebCoreFrameBridge (WebCoreBridgeInternal)
index b42bb5119900dbb987c8d2509195fed4938b0c49..099d5d84ae9400a8ac8ba56fa82537e7132fe033 100644 (file)
@@ -3600,4 +3600,14 @@ bool Frame::containsPlugins() const
     return d->m_plugins.size() != 0;
 }
 
+bool Frame::prohibitsScrolling() const
+{
+    return d->m_prohibitsScrolling;
+}
+
+void Frame::setProhibitsScrolling(const bool prohibit)
+{
+    d->m_prohibitsScrolling = prohibit;
+}
+
 } // namespace WebCore
index cb976aefb0cd302c671933ee51446e2e65fc4ad5..0b99f7211663ebddf0ee6f9a96ab1cc47375125d 100644 (file)
@@ -804,6 +804,9 @@ public:
 
   bool containsPlugins() const;
   
+  bool prohibitsScrolling() const;
+  void setProhibitsScrolling(const bool);
+  
   // split out controller objects
   FrameTree* tree() const;
   SelectionController& selection() const; // FIXME: Change to pointer?
index 8f1f47afc6074f1714ecccd429d855ba03ae0591..586dcf21b8f5e7966b13a894b4d781c65e420a91 100644 (file)
@@ -103,6 +103,7 @@ namespace WebCore {
             , m_windowHasFocus(false)
             , m_inViewSourceMode(false)
             , frameCount(0)
+            , m_prohibitsScrolling(false)
         {
         }
 
@@ -229,6 +230,8 @@ namespace WebCore {
         bool m_inViewSourceMode;
 
         unsigned frameCount;
+
+        bool m_prohibitsScrolling;
     };
 }
 
index 0b9a1050eb221c4796bc0c912c6ee24cda936ac1..64a6523c5b5a58e7f08c86021952af3095d98ba9 100644 (file)
@@ -1054,6 +1054,22 @@ void FrameView::setResizingFrameSet(HTMLFrameSetElement* frameSet)
     d->resizingFrameSet = frameSet;
 }
 
+void FrameView::scrollPointRecursively(int x, int y)
+{
+    if (frame()->prohibitsScrolling())
+        return;
+
+    ScrollView::scrollPointRecursively(x, y);
+}
+
+void FrameView::setContentsPos(int x, int y)
+{
+    if (frame()->prohibitsScrolling())
+        return;
+
+    ScrollView::setContentsPos(x, y);
+}
+
 MouseEventWithHitTestResults FrameView::prepareMouseEvent(bool readonly, bool active, bool mouseMove, const PlatformMouseEvent& mev)
 {
     ASSERT(m_frame);
index e527a5c1c4bfc462e291561dacf6ea53e70cddf1..17ccf4018b029f3a8730fcbb4c0d237c690524a5 100644 (file)
@@ -174,6 +174,9 @@ public:
     void updateDashboardRegions();
 #endif
 
+    virtual void scrollPointRecursively(int x, int y);
+    virtual void setContentsPos(int x, int y);
+
     void scheduleEvent(PassRefPtr<Event>, PassRefPtr<EventTargetNode>, bool tempEvent);
 
     void ref() { ++m_refCount; }
index 10eda43f584b5eb05be263a6b5b0fb02579b36b7..585d718e84b3054ec3684ebc3fe8a1c433bee2b8 100644 (file)
@@ -43,9 +43,9 @@ namespace WebCore {
         int contentsY() const;
         IntSize scrollOffset() const;
         void scrollBy(int dx, int dy);
-        void scrollPointRecursively(int dx, int dy);
+        virtual void scrollPointRecursively(int dx, int dy);
 
-        void setContentsPos(int x, int y);
+        virtual void setContentsPos(int x, int y);
 
         virtual void setVScrollBarMode(ScrollBarMode);
         virtual void setHScrollBarMode(ScrollBarMode);
index 3925925fab26f44192f9ec1e16aa34128cf82274..2718023fe0e1c7d72c461f74e86a46ed9a7b6822 100644 (file)
@@ -1,3 +1,16 @@
+2006-07-17  Tim Omernick  <timo@apple.com>
+
+        Reviewed by Maciej.
+
+        <rdar://problem/4612079> need a way to prevent pages from scrolling to reveal elements that are focused
+        by script
+
+        * WebView/WebViewPrivate.h:
+        * WebView/WebView.m:
+        (-[WebView setProhibitsMainFrameScrolling:]):
+        New method.  Prohibits scrolling in the WebView's main frame.  Used to "lock" a WebView to a specific
+        scroll position.
+
 2006-07-17  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Darin.
index 2ef7b8b73995938c7d1aaa3796b33e023aacdf99..c07b95d766fe0f339f0c45b88cc6cb6d30df3147 100644 (file)
@@ -1471,6 +1471,11 @@ static bool debugWidget = true;
     }
 }
 
+- (void)setProhibitsMainFrameScrolling:(BOOL)prohibits
+{
+    [[[self mainFrame] _bridge] setProhibitsScrolling:YES];
+}
+
 - (BOOL)alwaysShowHorizontalScroller
 {
     WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
index bb840b9080d6b849f5c3745277d4b3dfd364771b..72d4fbbf65d83109695cb0a07fcdf45975a1042f 100644 (file)
@@ -219,6 +219,13 @@ Could be worth adding to the API.
  */
 - (BOOL)alwaysShowHorizontalScroller;
 
+/*!
+    @method setProhibitsMainFrameScrolling:
+    @abstract Prohibits scrolling in the WebView's main frame.  Used to "lock" a WebView
+    to a specific scroll position.
+  */
+- (void)setProhibitsMainFrameScrolling:(BOOL)prohibits;
+
 /*!
     @method _setAdditionalWebPlugInPaths:
     @abstract Sets additional plugin search paths for a specific WebView.