Reviewed by Adam.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 25 Feb 2007 23:44:04 +0000 (23:44 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 25 Feb 2007 23:44:04 +0000 (23:44 +0000)
        - fixed layout test failure in fast/overflow/scrollRevealButton

        I added a new ScrollView method, fullyClippedContentRect, that vies the content rect
        as clipped by all ancestor scroll views, not just this one. Currently it only works
        correctly on mac however. visibleContentRect, only accounting for the clipping from
        this particular scroll view, is sufficient for most purposes.

        * page/Frame.cpp:
        (WebCore::Frame::visibleSelectionRect):
        (WebCore::Frame::setIsActive):
        (WebCore::Frame::markAllMatchesForText):
        * platform/ScrollView.h:
        * platform/gdk/ScrollViewGdk.cpp:
        (WebCore::ScrolView::fullyClippedContentRect):
        * platform/mac/ScrollViewMac.mm:
        (WebCore::ScrollView::fullyClippedContentRect):
        * platform/qt/ScrollViewQt.cpp:
        (WebCore::ScrolView::fullyClippedContentRect):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::scrollRectToVisible):

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

WebCore/ChangeLog
WebCore/page/Frame.cpp
WebCore/platform/ScrollView.h
WebCore/platform/gdk/ScrollViewGdk.cpp
WebCore/platform/mac/ScrollViewMac.mm
WebCore/platform/qt/ScrollViewQt.cpp
WebCore/rendering/RenderLayer.cpp

index 2aa5194a6a019118256007234f2e8c3d5b3cc49c..37d06ad00e13c5c9ef87514f5b167e8c4f3f87c4 100644 (file)
@@ -1,3 +1,28 @@
+2007-02-24  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Adam.
+
+        - fixed layout test failure in fast/overflow/scrollRevealButton
+        
+        I added a new ScrollView method, fullyClippedContentRect, that vies the content rect
+        as clipped by all ancestor scroll views, not just this one. Currently it only works
+        correctly on mac however. visibleContentRect, only accounting for the clipping from
+        this particular scroll view, is sufficient for most purposes.
+
+        * page/Frame.cpp:
+        (WebCore::Frame::visibleSelectionRect):
+        (WebCore::Frame::setIsActive):
+        (WebCore::Frame::markAllMatchesForText):
+        * platform/ScrollView.h:
+        * platform/gdk/ScrollViewGdk.cpp:
+        (WebCore::ScrolView::fullyClippedContentRect):
+        * platform/mac/ScrollViewMac.mm:
+        (WebCore::ScrollView::fullyClippedContentRect):
+        * platform/qt/ScrollViewQt.cpp:
+        (WebCore::ScrolView::fullyClippedContentRect):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollRectToVisible):
+
 2007-02-24  Adam Roben  <aroben@apple.com>
 
         Reviewed by Steve.
index 9db8e7aabe5e8ee92c82333ce5fcfc776eeb1e57..0692d4434aed4600c26f597ae53000738e3b2c19 100644 (file)
@@ -1162,7 +1162,7 @@ FloatRect Frame::visibleSelectionRect() const
     if (!d->m_view)
         return FloatRect();
     
-    return intersection(selectionRect(), d->m_view->visibleContentRect());
+    return intersection(selectionRect(), d->m_view->fullyClippedContentRect());
 }
 
 bool Frame::isFrameSet() const
@@ -1496,7 +1496,7 @@ void Frame::setIsActive(bool flag)
     // done if the theme supports control tinting.
     if (doc && d->m_view && theme()->supportsControlTints() && renderer()) {
         doc->updateLayout(); // Ensure layout is up to date.
-        IntRect visibleRect(enclosingIntRect(d->m_view->visibleContentRect()));
+        IntRect visibleRect(enclosingIntRect(d->m_view->fullyClippedContentRect()));
         GraphicsContext context((PlatformGraphicsContext*)0);
         context.setUpdatingControlTints(true);
         paint(&context, visibleRect);
@@ -1650,7 +1650,7 @@ unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsig
     Document* doc = document();
     if (doc && d->m_view && renderer()) {
         doc->updateLayout(); // Ensure layout is up to date.
-        IntRect visibleRect(enclosingIntRect(d->m_view->visibleContentRect()));
+        IntRect visibleRect(enclosingIntRect(d->m_view->fullyClippedContentRect()));
         GraphicsContext context((PlatformGraphicsContext*)0);
         context.setPaintingDisabled(true);
         paint(&context, visibleRect);
index d873a51714afc3609ef98075c72253a9041fae0d..148a8fb52db7fb7e75ab90fa46f55fde74fdb8a3 100644 (file)
@@ -49,6 +49,8 @@ namespace WebCore {
         int visibleWidth() const;
         int visibleHeight() const;
         FloatRect visibleContentRect() const;
+        FloatRect fullyClippedContentRect() const;
+
         int contentsWidth() const;
         int contentsHeight() const;
         int contentsX() const;
index 799fbb62ff361931a9faf2a6564f823a935cf306..e95005e794aa8c31163a13aed968ab893202f12c 100644 (file)
@@ -111,6 +111,13 @@ FloatRect ScrollView::visibleContentRect() const
     return contentRect;
 }
 
+FloatRect ScrolView::fullyClippedContentRect() const
+{
+    // FIXME: this isn't exactly right, with this implementation, 
+    // fast/overflow/scrollRevealButton will fail
+    return visibleContentRect();
+}
+
 void ScrollView::setContentsPos(int newX, int newY)
 {
     int dx = newX - contentsX();
index 3f08b6a2af7e5834bb27d2a4be1c826f255661bc..181d9ff43b8245366aad907199906a9887b79d0d 100644 (file)
@@ -91,6 +91,16 @@ FloatRect ScrollView::visibleContentRect() const
     return FloatRect();
 }
 
+FloatRect ScrollView::fullyClippedContentRect() const
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS; 
+    if (NSView *docView = getDocumentView()) 
+        return [docView visibleRect]; 
+    END_BLOCK_OBJC_EXCEPTIONS; 
+
+    return FloatRect();
+}
+
 int ScrollView::contentsWidth() const
 {
     NSView *docView, *view = getView();
index cd26719c06028a2b419ba81f01fbee25df06ff5c..6c475e61709ef3659a628f55bd8958f9efb0f789 100644 (file)
@@ -106,6 +106,13 @@ FloatRect ScrollView::visibleContentRect() const
                      visibleHeight());
 }
 
+FloatRect ScrolView::fullyClippedContentRect() const
+{
+    // FIXME: this isn't exactly right, with this implementation, 
+    // fast/overflow/scrollRevealButton will fail
+    return visibleContentRect();
+}
+
 void ScrollView::setContentsPos(int newX, int newY)
 {
     if (!m_area)
index ea62becc5159b60fa4ff01913bd1d15f9837bf2e..b348474c522acf191a597661cd10647edb021741 100644 (file)
@@ -760,7 +760,7 @@ void RenderLayer::scrollRectToVisible(const IntRect &rect, const ScrollAlignment
     } else {
         FrameView* view = m_object->document()->view();
         if (view) {
-            IntRect viewRect = enclosingIntRect(view->visibleContentRect());
+            IntRect viewRect = enclosingIntRect(view->fullyClippedContentRect());
             IntRect r = getRectToExpose(viewRect, rect, alignX, alignY);
             
             xOffset = r.x();