Commit 14590a57 authored by mjs's avatar mjs

LayoutTests:

        Reviewed by Darin.
        
        - <rdar://problem/4820817> Autoscroll is broken in Mail.app (message jumps around when trying to select text)

        * fast/overflow/scrollRevealButton-expected.checksum:
        * fast/overflow/scrollRevealButton-expected.png:
        * fast/overflow/scrollRevealButton-expected.txt:

WebCore:

        Reviewed by Darin.
        
        - fixed <rdar://problem/4820817> Autoscroll is broken in Mail.app (message jumps around when trying to select text)
                
        Handle scrolling external scrollviews around the webview during
        autoscroll or when scrolling into view.
        
        This should also restore performance on BenchJS test 6 lost due to Tim's partial fix.

        * page/FrameView.cpp:
        (WebCore::FrameView::scrollRectIntoViewRecursively):
        * page/FrameView.h:
        * platform/ScrollView.h:
        * platform/gdk/ScrollViewGdk.cpp:
        (WebCore::ScrollView::visibleContentRectConsideringExternalScrollers):
        (WebCore::ScrollView::scrollRectIntoViewRecursively):
        * platform/mac/ScrollViewMac.mm:
        (WebCore::ScrollView::visibleContentRect):
        (WebCore::ScrollView::visibleContentRectConsideringExternalScrollers):
        (WebCore::ScrollView::scrollRectIntoViewRecursively):
        (WebCore::ScrollView::updateContents):
        * platform/qt/ScrollViewQt.cpp:
        (WebCore::ScrollView::visibleContentRectConsideringExternalScrollers):
        (WebCore::ScrollView::scrollRectIntoViewRecursively):
        * platform/win/ScrollViewWin.cpp:
        (WebCore::ScrollView::visibleContentRectConsideringExternalScrollers):
        * platform/win/TemporaryLinkStubs.cpp:
        (WebCore::ScrollView::scrollRectIntoViewRecursively):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::scrollRectToVisible):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1d3bb180
2007-03-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- <rdar://problem/4820817> Autoscroll is broken in Mail.app (message jumps around when trying to select text)
* fast/overflow/scrollRevealButton-expected.checksum:
* fast/overflow/scrollRevealButton-expected.png:
* fast/overflow/scrollRevealButton-expected.txt:
2007-03-28 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
1a3eb440919a835d1c2d8b87e3e75d51
\ No newline at end of file
09a85baee72e3618e0e122168b061246
\ No newline at end of file
......@@ -39,4 +39,5 @@ layer at (0,0) size 785x1188
RenderBlock {DIV} at (0,558) size 135x300
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,672) size 769x500
frame 'fr' scrolled to 0,122
scrolled to 0,4
frame 'fr' scrolled to 0,91
2007-03-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- fixed <rdar://problem/4820817> Autoscroll is broken in Mail.app (message jumps around when trying to select text)
Handle scrolling external scrollviews around the webview during
autoscroll or when scrolling into view.
This should also restore performance on BenchJS test 6 lost due to Tim's partial fix.
* page/FrameView.cpp:
(WebCore::FrameView::scrollRectIntoViewRecursively):
* page/FrameView.h:
* platform/ScrollView.h:
* platform/gdk/ScrollViewGdk.cpp:
(WebCore::ScrollView::visibleContentRectConsideringExternalScrollers):
(WebCore::ScrollView::scrollRectIntoViewRecursively):
* platform/mac/ScrollViewMac.mm:
(WebCore::ScrollView::visibleContentRect):
(WebCore::ScrollView::visibleContentRectConsideringExternalScrollers):
(WebCore::ScrollView::scrollRectIntoViewRecursively):
(WebCore::ScrollView::updateContents):
* platform/qt/ScrollViewQt.cpp:
(WebCore::ScrollView::visibleContentRectConsideringExternalScrollers):
(WebCore::ScrollView::scrollRectIntoViewRecursively):
* platform/win/ScrollViewWin.cpp:
(WebCore::ScrollView::visibleContentRectConsideringExternalScrollers):
* platform/win/TemporaryLinkStubs.cpp:
(WebCore::ScrollView::scrollRectIntoViewRecursively):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
2007-03-28 Jungshik Shin <jungshik.shin@gmail.com>
Reviewed and landed by Darin
......
......@@ -603,11 +603,11 @@ void FrameView::restoreScrollbar()
suppressScrollbars(false);
}
void FrameView::scrollPointRecursively(int x, int y)
void FrameView::scrollRectIntoViewRecursively(const IntRect& r)
{
if (frame()->prohibitsScrolling())
return;
ScrollView::scrollPointRecursively(x, y);
ScrollView::scrollRectIntoViewRecursively(r);
}
void FrameView::setContentsPos(int x, int y)
......
......@@ -110,7 +110,7 @@ public:
IntRect windowClipRect(bool clipToContents) const;
IntRect windowClipRectForLayer(const RenderLayer*, bool clipToLayerContents) const;
virtual void scrollPointRecursively(int x, int y);
virtual void scrollRectIntoViewRecursively(const IntRect& r);
virtual void setContentsPos(int x, int y);
String mediaType() const;
......
......@@ -50,6 +50,7 @@ namespace WebCore {
int visibleWidth() const;
int visibleHeight() const;
FloatRect visibleContentRect() const;
FloatRect visibleContentRectConsideringExternalScrollers() const;
int contentsWidth() const;
int contentsHeight() const;
......@@ -57,7 +58,7 @@ namespace WebCore {
int contentsY() const;
IntSize scrollOffset() const;
void scrollBy(int dx, int dy);
virtual void scrollPointRecursively(int dx, int dy);
virtual void scrollRectIntoViewRecursively(const IntRect&);
virtual void setContentsPos(int x, int y);
......
......@@ -116,6 +116,12 @@ FloatRect ScrollView::visibleContentRect() const
return contentRect;
}
FloatRect ScrollView::visibleContentRectConsideringExternalScrollers() const
{
// external scrollers not supported for now
return visibleContentRect();
}
void ScrollView::setContentsPos(int newX, int newY)
{
int dx = newX - contentsX();
......@@ -274,7 +280,7 @@ void ScrollView::removeChild(Widget*)
notImplementedGdk();
}
void ScrollView::scrollPointRecursively(int x, int y)
void ScrollView::scrollRectIntoViewRecursively(const IntRect&)
{
notImplementedGdk();
}
......@@ -308,7 +314,7 @@ IntPoint ScrollView::windowToContents(const IntPoint& point) const
}
IntPoint ScrollView::contentsToWindow(const IntPoint& point) const
{
`{
notImplementedGdk();
return point;
}
......
......@@ -78,14 +78,30 @@ int ScrollView::visibleHeight() const
}
FloatRect ScrollView::visibleContentRect() const
{
NSScrollView *view = (NSScrollView *)getView();
BEGIN_BLOCK_OBJC_EXCEPTIONS;
if ([view isKindOfClass:[NSScrollView class]])
return [view documentVisibleRect];
else
return [view visibleRect];
END_BLOCK_OBJC_EXCEPTIONS;
return FloatRect();
}
FloatRect ScrollView::visibleContentRectConsideringExternalScrollers() 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();
......@@ -160,11 +176,9 @@ void ScrollView::scrollBy(int dx, int dy)
setContentsPos(contentsX() + dx, contentsY() + dy);
}
void ScrollView::scrollPointRecursively(int x, int y)
void ScrollView::scrollRectIntoViewRecursively(const IntRect& r)
{
x = (x < 0) ? 0 : x;
y = (y < 0) ? 0 : y;
NSPoint p = NSMakePoint(x,y);
NSRect rect = r;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
NSView *docView;
......@@ -178,8 +192,7 @@ void ScrollView::scrollPointRecursively(int x, int y)
if ([view isKindOfClass:[NSClipView class]]) {
NSClipView *clipView = (NSClipView *)view;
NSView *documentView = [clipView documentView];
NSPoint viewPoint = [clipView constrainScrollPoint:[documentView convertPoint:p fromView:originalView]];
[documentView scrollPoint:viewPoint];
[documentView scrollRectToVisible:[documentView convertRect:rect fromView:originalView]];
}
view = [view superview];
......@@ -338,10 +351,12 @@ void ScrollView::updateContents(const IntRect &rect, bool now)
if ([view isKindOfClass:[NSScrollView class]])
view = getDocumentView();
NSRect visibleRect = visibleContentRect();
// Checking for rect visibility is an important optimization for the case of
// Select All of a large document. AppKit does not do this check, and so ends
// up building a large complicated NSRegion if we don't perform the check.
NSRect dirtyRect = NSIntersectionRect(rect, [view visibleRect]);
NSRect dirtyRect = NSIntersectionRect(rect, visibleRect);
if (!NSIsEmptyRect(dirtyRect)) {
[view setNeedsDisplayInRect:dirtyRect];
if (now) {
......
......@@ -106,6 +106,12 @@ FloatRect ScrollView::visibleContentRect() const
visibleHeight());
}
FloatRect ScrollView::visibleContentRectConsideringExternalScrollers() const
{
// external scrollers not supported for now
return visibleContentRect();
}
void ScrollView::setContentsPos(int newX, int newY)
{
if (!m_area)
......@@ -290,8 +296,11 @@ void ScrollView::removeChild(Widget* child)
child->hide();
}
void ScrollView::scrollPointRecursively(int x, int y)
void ScrollView::scrollRectIntoViewRecursively(const IntRect& r)
{
int x = r.x();
int y = r.y();
x = (x < 0) ? 0 : x;
y = (y < 0) ? 0 : y;
......
......@@ -103,6 +103,12 @@ FloatRect ScrollView::visibleContentRect() const
return contentRect;
}
FloatRect ScrollView::visibleContentRectConsideringExternalScrollers() const
{
// external scrollers not supported for now
return visibleContentRect();
}
void ScrollView::setContentsPos(int newX, int newY)
{
int dx = newX - contentsX();
......
......@@ -346,7 +346,7 @@ bool ResourceHandle::loadsBlocked() { notImplemented(); return false; }
void ScrollView::addChild(Widget*) { notImplemented(); }
void ScrollView::removeChild(Widget*) { notImplemented(); }
void ScrollView::scrollPointRecursively(int x, int y) { notImplemented(); }
void ScrollView::scrollRectIntoViewRecursively(const IntRect&) { notImplemented(); }
bool ScrollView::inWindow() const { notImplemented(); return true; }
void ScrollView::paint(GraphicsContext*, const IntRect&) { notImplemented(); }
void ScrollView::wheelEvent(PlatformWheelEvent&) { notImplemented(); }
......
......@@ -759,24 +759,27 @@ void RenderLayer::scrollRectToVisible(const IntRect &rect, const ScrollAlignment
parentLayer = m_object->parent()->enclosingLayer();
} else {
if (frameView) {
IntRect viewRect = enclosingIntRect(frameView->visibleContentRect());
IntRect r = getRectToExpose(viewRect, rect, alignX, alignY);
xOffset = r.x();
yOffset = r.y();
// Adjust offsets if they're outside of the allowable range.
xOffset = max(0, min(frameView->contentsWidth(), xOffset));
yOffset = max(0, min(frameView->contentsHeight(), yOffset));
if (m_object->document() && m_object->document()->ownerElement() && m_object->document()->ownerElement()->renderer()) {
IntRect viewRect = enclosingIntRect(frameView->visibleContentRect());
IntRect r = getRectToExpose(viewRect, rect, alignX, alignY);
xOffset = r.x();
yOffset = r.y();
// Adjust offsets if they're outside of the allowable range.
xOffset = max(0, min(frameView->contentsWidth(), xOffset));
yOffset = max(0, min(frameView->contentsHeight(), yOffset));
frameView->setContentsPos(xOffset, yOffset);
parentLayer = m_object->document()->ownerElement()->renderer()->enclosingLayer();
newRect.setX(rect.x() - frameView->contentsX() + frameView->x());
newRect.setY(rect.y() - frameView->contentsY() + frameView->y());
} else {
IntRect viewRect = enclosingIntRect(frameView->visibleContentRectConsideringExternalScrollers());
IntRect r = getRectToExpose(viewRect, rect, alignX, alignY);
// If this is the outermost view that RenderLayer needs to scroll, then we should scroll the view recursively
// Other apps, like Mail, rely on this feature.
frameView->scrollPointRecursively(xOffset, yOffset);
frameView->scrollRectIntoViewRecursively(r);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment