This commit is contained in:
Dão Gottwald 2012-03-19 12:54:47 +01:00
Родитель d5f85c93cb 6483ef2ee1
Коммит d95bec90ea
17 изменённых файлов: 287 добавлений и 352 удалений

Просмотреть файл

@ -277,9 +277,9 @@ nsAccessNode::ScrollTo(PRUint32 aScrollType)
if (!content)
return;
nsIPresShell::ScrollAxis vertical, horizontal;
nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
shell->ScrollContentIntoView(content, vertical, horizontal,
PRInt16 vPercent, hPercent;
nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent);
shell->ScrollContentIntoView(content, vPercent, hPercent,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}

Просмотреть файл

@ -2230,9 +2230,8 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex)
nsIPresShell* presShell = mDoc->PresShell();
// Scroll into view.
presShell->ScrollContentIntoView(aContent,
nsIPresShell::ScrollAxis(),
nsIPresShell::ScrollAxis(),
presShell->ScrollContentIntoView(aContent, NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
// Fire mouse down and mouse up events.

Просмотреть файл

@ -296,19 +296,18 @@ nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
PRUint32 aScrollType)
{
nsIPresShell::ScrollAxis vertical, horizontal;
ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
PRInt16 vPercent, hPercent;
ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent);
return ScrollSubstringTo(aFrame, aStartNode, aStartIndex, aEndNode, aEndIndex,
vertical, horizontal);
vPercent, hPercent);
}
nsresult
nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal)
PRInt16 aVPercent, PRInt16 aHPercent)
{
if (!aFrame || !aStartNode || !aEndNode)
return NS_ERROR_FAILURE;
@ -332,7 +331,7 @@ nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
selection->AddRange(scrollToRange);
privSel->ScrollIntoView(nsISelectionController::SELECTION_ANCHOR_REGION,
true, aVertical, aHorizontal);
true, aVPercent, aHPercent);
selection->CollapseToStart();
@ -366,57 +365,39 @@ nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
void
nsCoreUtils::ConvertScrollTypeToPercents(PRUint32 aScrollType,
nsIPresShell::ScrollAxis *aVertical,
nsIPresShell::ScrollAxis *aHorizontal)
PRInt16 *aVPercent,
PRInt16 *aHPercent)
{
PRInt16 whereY, whereX;
nsIPresShell::WhenToScroll whenY, whenX;
switch (aScrollType)
{
case nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT:
whereY = nsIPresShell::SCROLL_TOP;
whenY = nsIPresShell::SCROLL_ALWAYS;
whereX = nsIPresShell::SCROLL_LEFT;
whenX = nsIPresShell::SCROLL_ALWAYS;
*aVPercent = NS_PRESSHELL_SCROLL_TOP;
*aHPercent = NS_PRESSHELL_SCROLL_LEFT;
break;
case nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT:
whereY = nsIPresShell::SCROLL_BOTTOM;
whenY = nsIPresShell::SCROLL_ALWAYS;
whereX = nsIPresShell::SCROLL_RIGHT;
whenX = nsIPresShell::SCROLL_ALWAYS;
*aVPercent = NS_PRESSHELL_SCROLL_BOTTOM;
*aHPercent = NS_PRESSHELL_SCROLL_RIGHT;
break;
case nsIAccessibleScrollType::SCROLL_TYPE_TOP_EDGE:
whereY = nsIPresShell::SCROLL_TOP;
whenY = nsIPresShell::SCROLL_ALWAYS;
whereX = nsIPresShell::SCROLL_MINIMUM;
whenX = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
*aVPercent = NS_PRESSHELL_SCROLL_TOP;
*aHPercent = NS_PRESSHELL_SCROLL_ANYWHERE;
break;
case nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_EDGE:
whereY = nsIPresShell::SCROLL_BOTTOM;
whenY = nsIPresShell::SCROLL_ALWAYS;
whereX = nsIPresShell::SCROLL_MINIMUM;
whenX = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
*aVPercent = NS_PRESSHELL_SCROLL_BOTTOM;
*aHPercent = NS_PRESSHELL_SCROLL_ANYWHERE;
break;
case nsIAccessibleScrollType::SCROLL_TYPE_LEFT_EDGE:
whereY = nsIPresShell::SCROLL_MINIMUM;
whenY = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
whereX = nsIPresShell::SCROLL_LEFT;
whenX = nsIPresShell::SCROLL_ALWAYS;
*aVPercent = NS_PRESSHELL_SCROLL_ANYWHERE;
*aHPercent = NS_PRESSHELL_SCROLL_LEFT;
break;
case nsIAccessibleScrollType::SCROLL_TYPE_RIGHT_EDGE:
whereY = nsIPresShell::SCROLL_MINIMUM;
whenY = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
whereX = nsIPresShell::SCROLL_RIGHT;
whenX = nsIPresShell::SCROLL_ALWAYS;
*aVPercent = NS_PRESSHELL_SCROLL_ANYWHERE;
*aHPercent = NS_PRESSHELL_SCROLL_RIGHT;
break;
default:
whereY = nsIPresShell::SCROLL_MINIMUM;
whenY = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
whereX = nsIPresShell::SCROLL_MINIMUM;
whenX = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
*aVPercent = NS_PRESSHELL_SCROLL_ANYWHERE;
*aHPercent = NS_PRESSHELL_SCROLL_ANYWHERE;
}
*aVertical = nsIPresShell::ScrollAxis(whereY, whenY);
*aHorizontal = nsIPresShell::ScrollAxis(whereX, whenX);
}
nsIntPoint

Просмотреть файл

@ -181,14 +181,13 @@ public:
* @param aStartOffset an offset inside the start node
* @param aEndNode end node of a range
* @param aEndOffset an offset inside the end node
* @param aVertical how to align vertically, specified in percents, and when.
* @param aHorizontal how to align horizontally, specified in percents, and when.
* @param aVPercent how to align vertically, specified in percents
* @param aHPercent how to align horizontally, specified in percents
*/
static nsresult ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal);
PRInt16 aVPercent, PRInt16 aHPercent);
/**
* Scrolls the given frame to the point, used for implememntation of
@ -203,11 +202,11 @@ public:
/**
* Converts scroll type constant defined in nsIAccessibleScrollType to
* vertical and horizontal parameters.
* vertical and horizontal percents.
*/
static void ConvertScrollTypeToPercents(PRUint32 aScrollType,
nsIPresShell::ScrollAxis *aVertical,
nsIPresShell::ScrollAxis *aHorizontal);
PRInt16 *aVPercent,
PRInt16 *aHPercent);
/**
* Returns coordinates relative screen for the top level window.

Просмотреть файл

@ -52,7 +52,6 @@ class nsIFrame;
class nsIPresShell;
struct nsTextRangeStyle;
struct nsPoint;
struct ScrollAxis;
#include "nsIFrame.h"
#include "nsTArray.h"
%}
@ -64,7 +63,6 @@ struct ScrollAxis;
[ref] native constTextRangeStyleRef(const nsTextRangeStyle);
[ref] native nsPointRef(nsPoint);
native nsDirection(nsDirection);
native ScrollAxis(nsIPresShell::ScrollAxis);
[scriptable, uuid(1820a940-6203-4e27-bc94-fa81131722a4)]
interface nsISelectionPrivate : nsISelection
@ -176,13 +174,29 @@ interface nsISelectionPrivate : nsISelection
* @param aIsSynchronous - when true, scrolls the selection into view
* before returning. If false, posts a request which
* is processed at some point after the method returns.
* @param aVertical - how to align the frame vertically and when.
* See nsIPresShell.h:ScrollAxis for details.
* @param aHorizontal - how to align the frame horizontally and when.
* See nsIPresShell.h:ScrollAxis for details.
* @param aVPercent - how to align the frame vertically. A value of 0
* means the frame's upper edge is aligned with the top edge
* of the visible area. A value of 100 means the frame's
* bottom edge is aligned with the bottom edge of
* the visible area. For values in between, the point
* "aVPercent" down the frame is placed at the point
* "aVPercent" down the visible area. A value of 50 centers
* the frame vertically. A value of -1 means move
* the frame the minimum amount necessary in order for
* the entire frame to be visible vertically (if possible).
* @param aHPercent - how to align the frame horizontally. A value of 0
* means the frame's left edge is aligned with the left
* edge of the visible area. A value of 100 means the
* frame's right edge is aligned with the right edge of
* the visible area. For values in between, the point
* "aHPercent" across the frame is placed at the point
* "aHPercent" across the visible area. A value of 50
* centers the frame horizontally . A value of -1 means
* move the frame the minimum amount necessary in order
* for the entire frame to be visible horizontally
* (if possible).
*/
void scrollIntoView(in short aRegion, in boolean aIsSynchronous,
in ScrollAxis aVertical,
in ScrollAxis aHorizontal);
in short aVPercent, in short aHPercent);
};

Просмотреть файл

@ -1109,10 +1109,8 @@ nsContentEventHandler::OnSelectionEvent(nsSelectionEvent* aEvent)
selPrivate->EndBatchChanges();
NS_ENSURE_SUCCESS(rv, rv);
selPrivate->ScrollIntoView(nsISelectionController::SELECTION_FOCUS_REGION,
false,
nsIPresShell::ScrollAxis(),
nsIPresShell::ScrollAxis());
selPrivate->ScrollIntoView(
nsISelectionController::SELECTION_FOCUS_REGION, false, -1, -1);
aEvent->mSucceeded = true;
return NS_OK;
}

Просмотреть файл

@ -983,14 +983,11 @@ nsGenericHTMLElement::ScrollIntoView(bool aTop, PRUint8 optional_argc)
aTop = true;
}
PRInt16 vpercent = aTop ? nsIPresShell::SCROLL_TOP :
nsIPresShell::SCROLL_BOTTOM;
PRIntn vpercent = aTop ? NS_PRESSHELL_SCROLL_TOP :
NS_PRESSHELL_SCROLL_BOTTOM;
presShell->ScrollContentIntoView(this,
nsIPresShell::ScrollAxis(
vpercent,
nsIPresShell::SCROLL_ALWAYS),
nsIPresShell::ScrollAxis(),
presShell->ScrollContentIntoView(this, vpercent,
NS_PRESSHELL_SCROLL_ANYWHERE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
return NS_OK;

Просмотреть файл

@ -1960,8 +1960,8 @@ nsFocusManager::ScrollIntoView(nsIPresShell* aPresShell,
// if the noscroll flag isn't set, scroll the newly focused element into view
if (!(aFlags & FLAG_NOSCROLL))
aPresShell->ScrollContentIntoView(aContent,
nsIPresShell::ScrollAxis(),
nsIPresShell::ScrollAxis(),
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}

Просмотреть файл

@ -2705,27 +2705,24 @@ DocumentViewerImpl::GetPrintable(bool *aPrintable)
NS_IMETHODIMP DocumentViewerImpl::ScrollToNode(nsIDOMNode* aNode)
{
NS_ENSURE_ARG(aNode);
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
nsCOMPtr<nsIPresShell> presShell;
NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(presShell)), NS_ERROR_FAILURE);
NS_ENSURE_ARG(aNode);
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
nsCOMPtr<nsIPresShell> presShell;
NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(presShell)), NS_ERROR_FAILURE);
// Get the nsIContent interface, because that's what we need to
// get the primary frame
// Get the nsIContent interface, because that's what we need to
// get the primary frame
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
// Tell the PresShell to scroll to the primary frame of the content.
NS_ENSURE_SUCCESS(
presShell->ScrollContentIntoView(content,
nsIPresShell::ScrollAxis(
nsIPresShell::SCROLL_TOP,
nsIPresShell::SCROLL_ALWAYS),
nsIPresShell::ScrollAxis(),
nsIPresShell::SCROLL_OVERFLOW_HIDDEN),
NS_ERROR_FAILURE);
return NS_OK;
// Tell the PresShell to scroll to the primary frame of the content.
NS_ENSURE_SUCCESS(presShell->ScrollContentIntoView(content,
NS_PRESSHELL_SCROLL_TOP,
NS_PRESSHELL_SCROLL_ANYWHERE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN),
NS_ERROR_FAILURE);
return NS_OK;
}
void

Просмотреть файл

@ -147,13 +147,22 @@ typedef struct CapturingContentInfo {
{ 0x4dc4db09, 0x03d4, 0x4427, \
{ 0xbe, 0xfb, 0xc9, 0x29, 0xac, 0x5c, 0x62, 0xab } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
#define NS_PRESSHELL_SCROLL_BOTTOM 100
#define NS_PRESSHELL_SCROLL_LEFT 0
#define NS_PRESSHELL_SCROLL_RIGHT 100
#define NS_PRESSHELL_SCROLL_CENTER 50
#define NS_PRESSHELL_SCROLL_ANYWHERE -1
#define NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE -2
// debug VerifyReflow flags
#define VERIFY_REFLOW_ON 0x01
#define VERIFY_REFLOW_NOISY 0x02
#define VERIFY_REFLOW_ALL 0x04
#define VERIFY_REFLOW_DUMP_COMMANDS 0x08
#define VERIFY_REFLOW_NOISY_RC 0x10
#define VERIFY_REFLOW_REALLY_NOISY_RC 0x20
#define VERIFY_REFLOW_ON 0x01
#define VERIFY_REFLOW_NOISY 0x02
#define VERIFY_REFLOW_ALL 0x04
#define VERIFY_REFLOW_DUMP_COMMANDS 0x08
#define VERIFY_REFLOW_NOISY_RC 0x10
#define VERIFY_REFLOW_REALLY_NOISY_RC 0x20
#define VERIFY_REFLOW_DURING_RESIZE_REFLOW 0x40
#undef NOISY_INTERRUPTIBLE_REFLOW
@ -524,68 +533,34 @@ public:
*/
virtual NS_HIDDEN_(nsresult) ScrollToAnchor() = 0;
enum {
SCROLL_TOP = 0,
SCROLL_BOTTOM = 100,
SCROLL_LEFT = 0,
SCROLL_RIGHT = 100,
SCROLL_CENTER = 50,
SCROLL_MINIMUM = -1
};
enum WhenToScroll {
SCROLL_ALWAYS,
SCROLL_IF_NOT_VISIBLE,
SCROLL_IF_NOT_FULLY_VISIBLE
};
typedef struct ScrollAxis {
PRInt16 mWhereToScroll;
WhenToScroll mWhenToScroll;
/**
* @param aWhere: Either a percentage or a special value.
* nsIPresShell defines:
* * (Default) SCROLL_MINIMUM = -1: The visible area is
* scrolled to show the entire frame. If the frame is too
* large, the top and left edges are given precedence.
* * SCROLL_TOP = 0: The frame's upper edge is aligned with the
* top edge of the visible area.
* * SCROLL_BOTTOM = 100: The frame's bottom edge is aligned
* with the bottom edge of the visible area.
* * SCROLL_LEFT = 0: The frame's left edge is aligned with the
* left edge of the visible area.
* * SCROLL_RIGHT = 100: The frame's right edge is aligned with
* the right edge of the visible area.
* * SCROLL_CENTER = 50: The frame is centered along the axis
* the ScrollAxis is used for.
*
* Other values are treated as a percentage, and the point
* "percent" down the frame is placed at the point "percent"
* down the visible area.
* @param aWhen:
* * (Default) SCROLL_IF_NOT_FULLY_VISIBLE: Move the frame only
* if it is not fully visible (including if it's not visible
* at all). Note that in this case if the frame is too large to
* fit in view, it will only be scrolled if more of it can fit
* than is already in view.
* * SCROLL_IF_NOT_VISIBLE: Move the frame only if none of it
* is visible.
* * SCROLL_ALWAYS: Move the frame regardless of its current
* visibility.
*/
ScrollAxis(PRInt16 aWhere = SCROLL_MINIMUM,
WhenToScroll aWhen = SCROLL_IF_NOT_FULLY_VISIBLE) :
mWhereToScroll(aWhere), mWhenToScroll(aWhen) {}
} ScrollAxis;
/**
* Scrolls the view of the document so that the primary frame of the content
* is displayed in the window. Layout is flushed before scrolling.
*
* @param aContent The content object of which primary frame should be
* scrolled into view.
* @param aVertical How to align the frame vertically and when to do so.
* This is a ScrollAxis of Where and When.
* @param aHorizontal How to align the frame horizontally and when to do so.
* This is a ScrollAxis of Where and When.
* @param aVPercent How to align the frame vertically. A value of 0
* (NS_PRESSHELL_SCROLL_TOP) means the frame's upper edge is
* aligned with the top edge of the visible area. A value of
* 100 (NS_PRESSHELL_SCROLL_BOTTOM) means the frame's bottom
* edge is aligned with the bottom edge of the visible area.
* For values in between, the point "aVPercent" down the frame
* is placed at the point "aVPercent" down the visible area. A
* value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
* vertically. A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
* the frame the minimum amount necessary in order for the entire
* frame to be visible vertically (if possible)
* @param aHPercent How to align the frame horizontally. A value of 0
* (NS_PRESSHELL_SCROLL_LEFT) means the frame's left edge is
* aligned with the left edge of the visible area. A value of
* 100 (NS_PRESSHELL_SCROLL_RIGHT) means the frame's right
* edge is aligned with the right edge of the visible area.
* For values in between, the point "aVPercent" across the frame
* is placed at the point "aVPercent" across the visible area.
* A value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
* horizontally . A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
* the frame the minimum amount necessary in order for the entire
* frame to be visible horizontally (if possible)
* @param aFlags If SCROLL_FIRST_ANCESTOR_ONLY is set, only the nearest
* scrollable ancestor is scrolled, otherwise all
* scrollable ancestors may be scrolled if necessary.
@ -598,8 +573,8 @@ public:
* contain this document in a iframe or the like.
*/
virtual NS_HIDDEN_(nsresult) ScrollContentIntoView(nsIContent* aContent,
ScrollAxis aVertical,
ScrollAxis aHorizontal,
PRIntn aVPercent,
PRIntn aHPercent,
PRUint32 aFlags) = 0;
enum {
@ -612,8 +587,8 @@ public:
* is visible, if possible. Layout is not flushed before scrolling.
*
* @param aRect relative to aFrame
* @param aVertical see ScrollContentIntoView and ScrollAxis
* @param aHorizontal see ScrollContentIntoView and ScrollAxis
* @param aVPercent see ScrollContentIntoView
* @param aHPercent see ScrollContentIntoView
* @param aFlags if SCROLL_FIRST_ANCESTOR_ONLY is set, only the
* nearest scrollable ancestor is scrolled, otherwise all
* scrollable ancestors may be scrolled if necessary
@ -627,10 +602,10 @@ public:
* @return true if any scrolling happened, false if no scrolling happened
*/
virtual bool ScrollFrameRectIntoView(nsIFrame* aFrame,
const nsRect& aRect,
ScrollAxis aVertical,
ScrollAxis aHorizontal,
PRUint32 aFlags) = 0;
const nsRect& aRect,
PRIntn aVPercent,
PRIntn aHPercent,
PRUint32 aFlags) = 0;
/**
* Determine if a rectangle specified in the frame's coordinate system

Просмотреть файл

@ -3032,9 +3032,8 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll)
if (content) {
if (aScroll) {
rv = ScrollContentIntoView(content,
ScrollAxis(SCROLL_TOP, SCROLL_ALWAYS),
ScrollAxis(),
rv = ScrollContentIntoView(content, NS_PRESSHELL_SCROLL_TOP,
NS_PRESSHELL_SCROLL_ANYWHERE,
ANCHOR_SCROLL_FLAGS);
NS_ENSURE_SUCCESS(rv, rv);
@ -3123,9 +3122,8 @@ PresShell::ScrollToAnchor()
mLastAnchorScrollPositionY != rootScroll->GetScrollPosition().y)
return NS_OK;
nsresult rv = ScrollContentIntoView(mLastAnchorScrolledTo,
ScrollAxis(SCROLL_TOP, SCROLL_ALWAYS),
ScrollAxis(),
nsresult rv = ScrollContentIntoView(mLastAnchorScrolledTo, NS_PRESSHELL_SCROLL_TOP,
NS_PRESSHELL_SCROLL_ANYWHERE,
ANCHOR_SCROLL_FLAGS);
mLastAnchorScrolledTo = nsnull;
return rv;
@ -3213,58 +3211,6 @@ AccumulateFrameBounds(nsIFrame* aContainerFrame,
}
}
static bool
ComputeNeedToScroll(nsIPresShell::WhenToScroll aWhenToScroll,
nscoord aLineSize,
nscoord aRectMin,
nscoord aRectMax,
nscoord aViewMin,
nscoord aViewMax) {
// See how the rect should be positioned vertically
if (nsIPresShell::SCROLL_ALWAYS == aWhenToScroll) {
// The caller wants the frame as visible as possible
return true;
} else if (nsIPresShell::SCROLL_IF_NOT_VISIBLE == aWhenToScroll) {
// Scroll only if no part of the frame is visible in this view
return aRectMax - aLineSize <= aViewMin ||
aRectMin + aLineSize >= aViewMax;
} else if (nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE == aWhenToScroll) {
// Scroll only if part of the frame is hidden and more can fit in view
return !(aRectMin >= aViewMin && aRectMax <= aViewMax) &&
NS_MIN(aViewMax, aRectMax) - NS_MAX(aRectMin, aViewMin) < aViewMax - aViewMin;
}
return false;
}
static nscoord
ComputeWhereToScroll(PRInt16 aWhereToScroll,
nscoord aOriginalCoord,
nscoord aRectMin,
nscoord aRectMax,
nscoord aViewMin,
nscoord aViewMax) {
nscoord resultCoord = aOriginalCoord;
if (nsIPresShell::SCROLL_MINIMUM == aWhereToScroll) {
if (aRectMin < aViewMin) {
// Scroll up so the frame's top edge is visible
resultCoord = aRectMin;
} else if (aRectMax > aViewMax) {
// Scroll down so the frame's bottom edge is visible. Make sure the
// frame's top edge is still visible
resultCoord = aOriginalCoord + aRectMax - aViewMax;
if (resultCoord > aRectMin) {
resultCoord = aRectMin;
}
}
} else {
nscoord frameAlignCoord =
NSToCoordRound(aRectMin + (aRectMax - aRectMin) * (aWhereToScroll / 100.0f));
resultCoord = NSToCoordRound(frameAlignCoord - (aViewMax - aViewMin) * (
aWhereToScroll / 100.0f));
}
return resultCoord;
}
/**
* This function takes a scrollable frame, a rect in the coordinate system
* of the scrolled frame, and a desired percentage-based scroll
@ -3273,11 +3219,11 @@ ComputeWhereToScroll(PRInt16 aWhereToScroll,
*
* This needs to work even if aRect has a width or height of zero.
*/
static void ScrollToShowRect(nsIScrollableFrame* aScrollFrame,
const nsRect& aRect,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal,
PRUint32 aFlags)
static void ScrollToShowRect(nsIScrollableFrame* aScrollFrame,
const nsRect& aRect,
PRIntn aVPercent,
PRIntn aHPercent,
PRUint32 aFlags)
{
nsPoint scrollPt = aScrollFrame->GetScrollPosition();
nsRect visibleRect(scrollPt, aScrollFrame->GetScrollPortRect().Size());
@ -3286,37 +3232,83 @@ static void ScrollToShowRect(nsIScrollableFrame* aScrollFrame,
if ((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN) {
if (ComputeNeedToScroll(aVertical.mWhenToScroll,
lineSize.height,
aRect.y,
aRect.YMost(),
visibleRect.y,
visibleRect.YMost())) {
scrollPt.y = ComputeWhereToScroll(aVertical.mWhereToScroll,
scrollPt.y,
aRect.y,
aRect.YMost(),
visibleRect.y,
visibleRect.YMost());
// See how the rect should be positioned vertically
if (NS_PRESSHELL_SCROLL_ANYWHERE == aVPercent ||
(NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE == aVPercent &&
aRect.height < lineSize.height)) {
// The caller doesn't care where the frame is positioned vertically,
// so long as it's fully visible
if (aRect.y < visibleRect.y) {
// Scroll up so the frame's top edge is visible
scrollPt.y = aRect.y;
} else if (aRect.YMost() > visibleRect.YMost()) {
// Scroll down so the frame's bottom edge is visible. Make sure the
// frame's top edge is still visible
scrollPt.y += aRect.YMost() - visibleRect.YMost();
if (scrollPt.y > aRect.y) {
scrollPt.y = aRect.y;
}
}
} else if (NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE == aVPercent) {
// Scroll only if no part of the frame is visible in this view
if (aRect.YMost() - lineSize.height < visibleRect.y) {
// Scroll up so the frame's top edge is visible
scrollPt.y = aRect.y;
} else if (aRect.y + lineSize.height > visibleRect.YMost()) {
// Scroll down so the frame's bottom edge is visible. Make sure the
// frame's top edge is still visible
scrollPt.y += aRect.YMost() - visibleRect.YMost();
if (scrollPt.y > aRect.y) {
scrollPt.y = aRect.y;
}
}
} else {
// Align the frame edge according to the specified percentage
nscoord frameAlignY =
NSToCoordRound(aRect.y + aRect.height * (aVPercent / 100.0f));
scrollPt.y =
NSToCoordRound(frameAlignY - visibleRect.height * (aVPercent / 100.0f));
}
}
if ((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
if (ComputeNeedToScroll(aHorizontal.mWhenToScroll,
lineSize.width,
aRect.x,
aRect.XMost(),
visibleRect.x,
visibleRect.XMost())) {
scrollPt.x = ComputeWhereToScroll(aHorizontal.mWhereToScroll,
scrollPt.x,
aRect.x,
aRect.XMost(),
visibleRect.x,
visibleRect.XMost());
// See how the frame should be positioned horizontally
if (NS_PRESSHELL_SCROLL_ANYWHERE == aHPercent ||
(NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE == aHPercent &&
aRect.width < lineSize.width)) {
// The caller doesn't care where the frame is positioned horizontally,
// so long as it's fully visible
if (aRect.x < visibleRect.x) {
// Scroll left so the frame's left edge is visible
scrollPt.x = aRect.x;
} else if (aRect.XMost() > visibleRect.XMost()) {
// Scroll right so the frame's right edge is visible. Make sure the
// frame's left edge is still visible
scrollPt.x += aRect.XMost() - visibleRect.XMost();
if (scrollPt.x > aRect.x) {
scrollPt.x = aRect.x;
}
}
} else if (NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE == aHPercent) {
// Scroll only if no part of the frame is visible in this view
if (aRect.XMost() - lineSize.width < visibleRect.x) {
// Scroll left so the frame's left edge is visible
scrollPt.x = aRect.x;
} else if (aRect.x + lineSize.width > visibleRect.XMost()) {
// Scroll right so the frame's right edge is visible. Make sure the
// frame's left edge is still visible
scrollPt.x += aRect.XMost() - visibleRect.XMost();
if (scrollPt.x > aRect.x) {
scrollPt.x = aRect.x;
}
}
} else {
// Align the frame edge according to the specified percentage
nscoord frameAlignX =
NSToCoordRound(aRect.x + (aRect.width) * (aHPercent / 100.0f));
scrollPt.x =
NSToCoordRound(frameAlignX - visibleRect.width * (aHPercent / 100.0f));
}
}
@ -3324,10 +3316,10 @@ static void ScrollToShowRect(nsIScrollableFrame* aScrollFrame,
}
nsresult
PresShell::ScrollContentIntoView(nsIContent* aContent,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal,
PRUint32 aFlags)
PresShell::ScrollContentIntoView(nsIContent* aContent,
PRIntn aVPercent,
PRIntn aHPercent,
PRUint32 aFlags)
{
nsCOMPtr<nsIContent> content = aContent; // Keep content alive while flushing.
NS_ENSURE_TRUE(content, NS_ERROR_NULL_POINTER);
@ -3337,8 +3329,8 @@ PresShell::ScrollContentIntoView(nsIContent* aContent,
NS_ASSERTION(mDidInitialReflow, "should have done initial reflow by now");
mContentToScrollTo = aContent;
mContentScrollVAxis = aVertical;
mContentScrollHAxis = aHorizontal;
mContentScrollVPosition = aVPercent;
mContentScrollHPosition = aHPercent;
mContentToScrollToFlags = aFlags;
// Flush layout and attempt to scroll in the process.
@ -3354,16 +3346,16 @@ PresShell::ScrollContentIntoView(nsIContent* aContent,
// than a single best-effort scroll followed by one final scroll on the first
// completed reflow.
if (mContentToScrollTo) {
DoScrollContentIntoView(content, aVertical, aHorizontal, aFlags);
DoScrollContentIntoView(content, aVPercent, aHPercent, aFlags);
}
return NS_OK;
}
void
PresShell::DoScrollContentIntoView(nsIContent* aContent,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal,
PRUint32 aFlags)
PresShell::DoScrollContentIntoView(nsIContent* aContent,
PRIntn aVPercent,
PRIntn aHPercent,
PRUint32 aFlags)
{
NS_ASSERTION(mDidInitialReflow, "should have done initial reflow by now");
@ -3399,7 +3391,7 @@ PresShell::DoScrollContentIntoView(nsIContent* aContent,
// even if that assumption was false.)
nsRect frameBounds;
bool haveRect = false;
bool useWholeLineHeightForInlines = aVertical.mWhenToScroll != nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
bool useWholeLineHeightForInlines = aVPercent != NS_PRESSHELL_SCROLL_ANYWHERE;
// Reuse the same line iterator across calls to AccumulateFrameBounds. We set
// it every time we detect a new block (stored in prevBlock).
nsIFrame* prevBlock = nsnull;
@ -3412,16 +3404,16 @@ PresShell::DoScrollContentIntoView(nsIContent* aContent,
frameBounds, haveRect, prevBlock, lines, curLine);
} while ((frame = frame->GetNextContinuation()));
ScrollFrameRectIntoView(container, frameBounds, aVertical, aHorizontal,
ScrollFrameRectIntoView(container, frameBounds, aVPercent, aHPercent,
aFlags);
}
bool
PresShell::ScrollFrameRectIntoView(nsIFrame* aFrame,
const nsRect& aRect,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal,
PRUint32 aFlags)
PresShell::ScrollFrameRectIntoView(nsIFrame* aFrame,
const nsRect& aRect,
PRIntn aVPercent,
PRIntn aHPercent,
PRUint32 aFlags)
{
bool didScroll = false;
// This function needs to work even if rect has a width or height of 0.
@ -3434,7 +3426,7 @@ PresShell::ScrollFrameRectIntoView(nsIFrame* aFrame,
if (sf) {
nsPoint oldPosition = sf->GetScrollPosition();
ScrollToShowRect(sf, rect - sf->GetScrolledFrame()->GetPosition(),
aVertical, aHorizontal, aFlags);
aVPercent, aHPercent, aFlags);
nsPoint newPosition = sf->GetScrollPosition();
// If the scroll position increased, that means our content moved up,
// so our rect's offset should decrease
@ -4007,9 +3999,8 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
mViewManager->FlushDelayedResize(true);
if (ProcessReflowCommands(aType < Flush_Layout) && mContentToScrollTo) {
// We didn't get interrupted. Go ahead and scroll to our content
DoScrollContentIntoView(mContentToScrollTo,
mContentScrollVAxis,
mContentScrollHAxis,
DoScrollContentIntoView(mContentToScrollTo, mContentScrollVPosition,
mContentScrollHPosition,
mContentToScrollToFlags);
mContentToScrollTo = nsnull;
}
@ -6902,10 +6893,9 @@ PresShell::PrepareToUseCaretPosition(nsIWidget* aEventWidget, nsIntPoint& aTarge
// problem. The only difference in the result is that if your cursor is in
// an edit box below the current view, you'll get the edit box aligned with
// the top of the window. This is arguably better behavior anyway.
rv = ScrollContentIntoView(content,
ScrollAxis(),
ScrollAxis(),
SCROLL_OVERFLOW_HIDDEN);
rv = ScrollContentIntoView(content, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
SCROLL_OVERFLOW_HIDDEN);
NS_ENSURE_SUCCESS(rv, false);
frame = content->GetPrimaryFrame();
NS_WARN_IF_FALSE(frame, "No frame for focused content?");
@ -6967,10 +6957,9 @@ PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
nsIWidget *aRootWidget)
{
nsCOMPtr<nsIContent> focusedContent(do_QueryInterface(aCurrentEl));
ScrollContentIntoView(focusedContent,
ScrollAxis(),
ScrollAxis(),
SCROLL_OVERFLOW_HIDDEN);
ScrollContentIntoView(focusedContent, NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE,
SCROLL_OVERFLOW_HIDDEN);
nsPresContext* presContext = GetPresContext();

Просмотреть файл

@ -248,14 +248,14 @@ public:
virtual NS_HIDDEN_(nsresult) ScrollToAnchor();
virtual NS_HIDDEN_(nsresult) ScrollContentIntoView(nsIContent* aContent,
ScrollAxis aVertical,
ScrollAxis aHorizontal,
PRIntn aVPercent,
PRIntn aHPercent,
PRUint32 aFlags);
virtual bool ScrollFrameRectIntoView(nsIFrame* aFrame,
const nsRect& aRect,
ScrollAxis aVertical,
ScrollAxis aHorizontal,
PRUint32 aFlags);
const nsRect& aRect,
PRIntn aVPercent,
PRIntn aHPercent,
PRUint32 aFlags);
virtual nsRectVisibility GetRectVisibility(nsIFrame *aFrame,
const nsRect &aRect,
nscoord aMinTwips) const;
@ -493,8 +493,8 @@ protected:
// Helper for ScrollContentIntoView
void DoScrollContentIntoView(nsIContent* aContent,
ScrollAxis aVertical,
ScrollAxis aHorizontal,
PRIntn aVPercent,
PRIntn aHPercent,
PRUint32 aFlags);
friend struct AutoRenderingStateSaveRestore;
@ -672,8 +672,8 @@ protected:
// processing all our dirty roots. mContentScrollVPosition and
// mContentScrollHPosition are only used when it's non-null.
nsCOMPtr<nsIContent> mContentToScrollTo;
ScrollAxis mContentScrollVAxis;
ScrollAxis mContentScrollHAxis;
PRIntn mContentScrollVPosition;
PRIntn mContentScrollHPosition;
PRUint32 mContentToScrollToFlags;
class nsDelayedEvent

Просмотреть файл

@ -206,11 +206,10 @@ public:
// The 'position' is a zero-width rectangle.
nsIFrame* GetSelectionEndPointGeometry(SelectionRegion aRegion, nsRect *aRect);
nsresult PostScrollSelectionIntoViewEvent(
SelectionRegion aRegion,
bool aFirstAncestorOnly,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal);
nsresult PostScrollSelectionIntoViewEvent(SelectionRegion aRegion,
bool aFirstAncestorOnly,
PRInt16 aVPercent,
PRInt16 aHPercent);
enum {
SCROLL_SYNCHRONOUS = 1<<1,
SCROLL_FIRST_ANCESTOR_ONLY = 1<<2,
@ -219,10 +218,8 @@ public:
// aDoFlush only matters if aIsSynchronous is true. If not, we'll just flush
// when the scroll event fires so we make sure to scroll to the right place.
nsresult ScrollIntoView(SelectionRegion aRegion,
nsIPresShell::ScrollAxis aVertical =
nsIPresShell::ScrollAxis(),
nsIPresShell::ScrollAxis aHorizontal =
nsIPresShell::ScrollAxis(),
PRInt16 aVPercent = NS_PRESSHELL_SCROLL_ANYWHERE,
PRInt16 aHPercent = NS_PRESSHELL_SCROLL_ANYWHERE,
PRInt32 aFlags = 0);
nsresult SubtractRange(RangeData* aRange, nsRange* aSubtract,
nsTArray<RangeData>* aOutput);
@ -289,23 +286,23 @@ private:
NS_DECL_NSIRUNNABLE
ScrollSelectionIntoViewEvent(nsTypedSelection *aTypedSelection,
SelectionRegion aRegion,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal,
PRInt16 aVScroll,
PRInt16 aHScroll,
bool aFirstAncestorOnly)
: mTypedSelection(aTypedSelection),
mRegion(aRegion),
mVerticalScroll(aVertical),
mHorizontalScroll(aHorizontal),
mVerticalScroll(aVScroll),
mHorizontalScroll(aHScroll),
mFirstAncestorOnly(aFirstAncestorOnly) {
NS_ASSERTION(aTypedSelection, "null parameter");
}
void Revoke() { mTypedSelection = nsnull; }
private:
nsTypedSelection *mTypedSelection;
SelectionRegion mRegion;
nsIPresShell::ScrollAxis mVerticalScroll;
nsIPresShell::ScrollAxis mHorizontalScroll;
bool mFirstAncestorOnly;
SelectionRegion mRegion;
PRInt16 mVerticalScroll;
PRInt16 mHorizontalScroll;
bool mFirstAncestorOnly;
};
void setAnchorFocusRange(PRInt32 aIndex); // pass in index into mRanges;
@ -1973,7 +1970,7 @@ nsFrameSelection::ScrollSelectionIntoView(SelectionType aType,
if (!mDomSelections[index])
return NS_ERROR_NULL_POINTER;
nsIPresShell::ScrollAxis verticalScroll = nsIPresShell::ScrollAxis();
PRInt16 verticalScroll = PRInt16(NS_PRESSHELL_SCROLL_ANYWHERE);
PRInt32 flags = nsTypedSelection::SCROLL_DO_FLUSH;
if (aFlags & nsISelectionController::SCROLL_SYNCHRONOUS) {
flags |= nsTypedSelection::SCROLL_SYNCHRONOUS;
@ -1981,15 +1978,14 @@ nsFrameSelection::ScrollSelectionIntoView(SelectionType aType,
flags |= nsTypedSelection::SCROLL_FIRST_ANCESTOR_ONLY;
}
if (aFlags & nsISelectionController::SCROLL_CENTER_VERTICALLY) {
verticalScroll = nsIPresShell::ScrollAxis(
nsIPresShell::SCROLL_CENTER, nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE);
verticalScroll = PRInt16(NS_PRESSHELL_SCROLL_CENTER);
}
// After ScrollSelectionIntoView(), the pending notifications might be
// flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
return mDomSelections[index]->ScrollIntoView(aRegion,
verticalScroll,
nsIPresShell::ScrollAxis(),
PRInt16(NS_PRESSHELL_SCROLL_ANYWHERE),
flags);
}
@ -4671,12 +4667,10 @@ nsTypedSelection::DoAutoScroll(nsIFrame *aFrame, nsPoint& aPoint)
// about to do will change the coordinates of aFrame.
nsPoint globalPoint = aPoint + aFrame->GetOffsetToCrossDoc(rootmostFrame);
bool didScroll = presContext->PresShell()->ScrollFrameRectIntoView(
aFrame,
nsRect(aPoint, nsSize(1,1)),
nsIPresShell::ScrollAxis(),
nsIPresShell::ScrollAxis(),
0);
bool didScroll = presContext->PresShell()->
ScrollFrameRectIntoView(aFrame, nsRect(aPoint, nsSize(1,1)),
NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE, 0);
//
// Start the AutoScroll timer if necessary.
@ -5546,11 +5540,10 @@ nsTypedSelection::ScrollSelectionIntoViewEvent::Run()
}
nsresult
nsTypedSelection::PostScrollSelectionIntoViewEvent(
SelectionRegion aRegion,
bool aFirstAncestorOnly,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal)
nsTypedSelection::PostScrollSelectionIntoViewEvent(SelectionRegion aRegion,
bool aFirstAncestorOnly,
PRInt16 aVPercent,
PRInt16 aHPercent)
{
// If we've already posted an event, revoke it and place a new one at the
// end of the queue to make sure that any new pending reflow events are
@ -5559,7 +5552,7 @@ nsTypedSelection::PostScrollSelectionIntoViewEvent(
mScrollEvent.Revoke();
nsRefPtr<ScrollSelectionIntoViewEvent> ev =
new ScrollSelectionIntoViewEvent(this, aRegion, aVertical, aHorizontal,
new ScrollSelectionIntoViewEvent(this, aRegion, aVPercent, aHPercent,
aFirstAncestorOnly);
nsresult rv = NS_DispatchToCurrentThread(ev);
NS_ENSURE_SUCCESS(rv, rv);
@ -5569,19 +5562,16 @@ nsTypedSelection::PostScrollSelectionIntoViewEvent(
}
NS_IMETHODIMP
nsTypedSelection::ScrollIntoView(SelectionRegion aRegion,
bool aIsSynchronous,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal)
nsTypedSelection::ScrollIntoView(SelectionRegion aRegion, bool aIsSynchronous,
PRInt16 aVPercent, PRInt16 aHPercent)
{
return ScrollIntoView(aRegion, aVertical, aHorizontal,
return ScrollIntoView(aRegion, aVPercent, aHPercent,
aIsSynchronous ? nsTypedSelection::SCROLL_SYNCHRONOUS : 0);
}
nsresult
nsTypedSelection::ScrollIntoView(SelectionRegion aRegion,
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal,
PRInt16 aVPercent, PRInt16 aHPercent,
PRInt32 aFlags)
{
nsresult result;
@ -5594,7 +5584,7 @@ nsTypedSelection::ScrollIntoView(SelectionRegion aRegion,
if (!(aFlags & nsTypedSelection::SCROLL_SYNCHRONOUS))
return PostScrollSelectionIntoViewEvent(aRegion,
!!(aFlags & nsTypedSelection::SCROLL_FIRST_ANCESTOR_ONLY),
aVertical, aHorizontal);
aVPercent, aHPercent);
//
// Shut the caret off before scrolling to avoid
@ -5632,7 +5622,7 @@ nsTypedSelection::ScrollIntoView(SelectionRegion aRegion,
if (!frame)
return NS_ERROR_FAILURE;
presShell->ScrollFrameRectIntoView(frame, rect, aVertical, aHorizontal,
presShell->ScrollFrameRectIntoView(frame, rect, aVPercent, aHPercent,
(aFlags & nsTypedSelection::SCROLL_FIRST_ANCESTOR_ONLY) ? nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY: 0);
return NS_OK;
}

Просмотреть файл

@ -195,8 +195,8 @@ inFlasher::ScrollElementIntoView(nsIDOMElement *aElement)
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
presShell->ScrollContentIntoView(content,
nsIPresShell::ScrollAxis(),
nsIPresShell::ScrollAxis(),
NS_PRESSHELL_SCROLL_ANYWHERE /* VPercent */,
NS_PRESSHELL_SCROLL_ANYWHERE /* HPercent */,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
return NS_OK;

Просмотреть файл

@ -1480,13 +1480,13 @@ nsIScrollableFrame* nsMenuPopupFrame::GetScrollFrame(nsIFrame* aStart)
void nsMenuPopupFrame::EnsureMenuItemIsVisible(nsMenuFrame* aMenuItem)
{
if (aMenuItem) {
aMenuItem->PresContext()->PresShell()->ScrollFrameRectIntoView(
aMenuItem,
nsRect(nsPoint(0,0), aMenuItem->GetRect().Size()),
nsIPresShell::ScrollAxis(),
nsIPresShell::ScrollAxis(),
nsIPresShell::SCROLL_OVERFLOW_HIDDEN |
nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY);
aMenuItem->PresContext()->PresShell()->
ScrollFrameRectIntoView(aMenuItem,
nsRect(nsPoint(0,0), aMenuItem->GetRect().Size()),
NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN |
nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY);
}
}

Просмотреть файл

@ -263,12 +263,8 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollToElement(nsIDOMElement *child)
nsCOMPtr<nsIContent> content = do_QueryInterface(child);
shell->ScrollContentIntoView(content,
nsIPresShell::ScrollAxis(
nsIPresShell::SCROLL_TOP,
nsIPresShell::SCROLL_ALWAYS),
nsIPresShell::ScrollAxis(
nsIPresShell::SCROLL_LEFT,
nsIPresShell::SCROLL_ALWAYS),
NS_PRESSHELL_SCROLL_TOP,
NS_PRESSHELL_SCROLL_LEFT,
nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY |
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
return NS_OK;
@ -321,8 +317,8 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureElementIsVisible(nsIDOMElement *child)
nsCOMPtr<nsIContent> content = do_QueryInterface(child);
shell->ScrollContentIntoView(content,
nsIPresShell::ScrollAxis(),
nsIPresShell::ScrollAxis(),
NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE,
nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY |
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
return NS_OK;

Просмотреть файл

@ -335,8 +335,8 @@ nsFormFillController::SetPopupOpen(bool aPopupOpen)
docShell->GetPresShell(getter_AddRefs(presShell));
NS_ENSURE_STATE(presShell);
presShell->ScrollContentIntoView(content,
nsIPresShell::ScrollAxis(),
nsIPresShell::ScrollAxis(),
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
// mFocusedPopup can be destroyed after ScrollContentIntoView, see bug 420089
if (mFocusedPopup)