From 3ce09ae1e5eb219c6473b2b90f1c4899728cf307 Mon Sep 17 00:00:00 2001 From: "aaronleventhal%moonset.net" Date: Fri, 19 Nov 2004 03:49:20 +0000 Subject: [PATCH] Bug 265940. Textfield doesn't scroll horizontally to left after backspace or left arrow. r=mats, sr=roc, a=asa --- layout/base/nsLayoutUtils.cpp | 9 ++++++--- layout/base/src/nsLayoutUtils.cpp | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 7f9bdcf5320..02fd6e3a4dc 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -393,7 +393,8 @@ nsLayoutUtils::ScrollbarStylesOfView(nsIScrollableView *aScrollableView) nsIScrollableView* nsLayoutUtils::GetNearestScrollingView(nsIView* aView, Direction aDirection) { - // Find the first view that has a scrollable frame whose + // If aDirection is eEither, find first view with a scrolllable frame. + // Otherwise, find the first view that has a scrollable frame whose // ScrollbarStyles is not NS_STYLE_OVERFLOW_HIDDEN in aDirection // and where there is something currently not visible // that can be scrolled to in aDirection. @@ -419,13 +420,15 @@ nsLayoutUtils::GetNearestScrollingView(nsIView* aView, Direction aDirection) // Get size of currently visible area nsSize visibleSize = GetFrameFor(aView)->GetSize(); // aDirection can be eHorizontal, eVertical, or eEither + // If scrolling in a specific direction, require visible scrollbars or + // something to scroll to in that direction. if (aDirection != eHorizontal && ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN && - (totalHeight > visibleSize.height || margin.right)) + (aDirection == eEither || totalHeight > visibleSize.height || margin.right)) break; if (aDirection != eVertical && ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN && - (totalWidth > visibleSize.width || margin.bottom)) + (aDirection == eEither || totalWidth > visibleSize.width || margin.bottom)) break; } } diff --git a/layout/base/src/nsLayoutUtils.cpp b/layout/base/src/nsLayoutUtils.cpp index 7f9bdcf5320..02fd6e3a4dc 100644 --- a/layout/base/src/nsLayoutUtils.cpp +++ b/layout/base/src/nsLayoutUtils.cpp @@ -393,7 +393,8 @@ nsLayoutUtils::ScrollbarStylesOfView(nsIScrollableView *aScrollableView) nsIScrollableView* nsLayoutUtils::GetNearestScrollingView(nsIView* aView, Direction aDirection) { - // Find the first view that has a scrollable frame whose + // If aDirection is eEither, find first view with a scrolllable frame. + // Otherwise, find the first view that has a scrollable frame whose // ScrollbarStyles is not NS_STYLE_OVERFLOW_HIDDEN in aDirection // and where there is something currently not visible // that can be scrolled to in aDirection. @@ -419,13 +420,15 @@ nsLayoutUtils::GetNearestScrollingView(nsIView* aView, Direction aDirection) // Get size of currently visible area nsSize visibleSize = GetFrameFor(aView)->GetSize(); // aDirection can be eHorizontal, eVertical, or eEither + // If scrolling in a specific direction, require visible scrollbars or + // something to scroll to in that direction. if (aDirection != eHorizontal && ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN && - (totalHeight > visibleSize.height || margin.right)) + (aDirection == eEither || totalHeight > visibleSize.height || margin.right)) break; if (aDirection != eVertical && ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN && - (totalWidth > visibleSize.width || margin.bottom)) + (aDirection == eEither || totalWidth > visibleSize.width || margin.bottom)) break; } }