Bug 539331 - browser_sanitizeDialog.js is failing, r=matspal

This commit is contained in:
Robert O'Callahan 2010-01-14 05:00:00 -08:00
Родитель 6e53298ce8
Коммит 15976008ca
8 изменённых файлов: 54 добавлений и 21 удалений

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

@ -2656,16 +2656,16 @@ nsEventStateManager::DecideGestureEvent(nsGestureNotifyEvent* aEvent,
displayPanFeedback = PR_FALSE;
}
} else { //Not a XUL box
nsMargin scrollbarSizes = scrollableFrame->GetActualScrollbarSizes();
PRUint32 scrollbarVisibility = scrollableFrame->GetScrollbarVisibility();
//Check if we have visible scrollbars
if (scrollbarSizes.LeftRight()) {
if (scrollbarVisibility & nsIScrollableFrame::VERTICAL) {
panDirection = nsGestureNotifyEvent::ePanVertical;
displayPanFeedback = PR_TRUE;
break;
}
if (scrollbarSizes.TopBottom()) {
if (scrollbarVisibility & nsIScrollableFrame::HORIZONTAL) {
panDirection = nsGestureNotifyEvent::ePanHorizontal;
displayPanFeedback = PR_TRUE;
}

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

@ -4811,11 +4811,11 @@ nsDocShell::GetScrollbarVisibility(PRBool * verticalVisible,
nsIScrollableFrame* sf = GetRootScrollFrame();
NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
nsMargin scrollbars = sf->GetActualScrollbarSizes();
PRUint32 scrollbarVisibility = sf->GetScrollbarVisibility();
if (verticalVisible)
*verticalVisible = scrollbars.left != 0 || scrollbars.right != 0;
*verticalVisible = (scrollbarVisibility & nsIScrollableFrame::VERTICAL) != 0;
if (horizontalVisible)
*horizontalVisible = scrollbars.top != 0 || scrollbars.bottom != 0;
*horizontalVisible = (scrollbarVisibility & nsIScrollableFrame::HORIZONTAL) != 0;
return NS_OK;
}

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

@ -679,15 +679,17 @@ nsLayoutUtils::GetNearestScrollableFrameForDirection(nsIFrame* aFrame,
nsIScrollableFrame* scrollableFrame = do_QueryFrame(f);
if (scrollableFrame) {
nsPresContext::ScrollbarStyles ss = scrollableFrame->GetScrollbarStyles();
nsMargin scrollbarSizes = scrollableFrame->GetActualScrollbarSizes();
PRUint32 scrollbarVisibility = scrollableFrame->GetScrollbarVisibility();
nsRect scrollRange = scrollableFrame->GetScrollRange();
// Require visible scrollbars or something to scroll to in
// the given direction.
if (aDirection == eVertical ?
(ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN &&
(scrollbarSizes.LeftRight() || scrollRange.height > 0)) :
((scrollbarVisibility & nsIScrollableFrame::VERTICAL) ||
scrollRange.height > 0)) :
(ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN &&
(scrollbarSizes.TopBottom() || scrollRange.width > 0)))
((scrollbarVisibility & nsIScrollableFrame::HORIZONTAL) ||
scrollRange.width > 0)))
return scrollableFrame;
}
}

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

@ -5985,13 +5985,10 @@ nsIFrame::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse)
// When clicked on, the selection position within the element
// will be enough to make them keyboard scrollable.
nsIScrollableFrame *scrollFrame = do_QueryFrame(this);
if (scrollFrame) {
nsMargin margin = scrollFrame->GetActualScrollbarSizes();
if (margin.top || margin.right || margin.bottom || margin.left) {
// Scroll bars will be used for overflow
isFocusable = PR_TRUE;
tabIndex = 0;
}
if (scrollFrame && scrollFrame->GetScrollbarVisibility() != 0) {
// Scroll bars will be used for overflow
isFocusable = PR_TRUE;
tabIndex = 0;
}
}
}

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

@ -485,10 +485,21 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
kidReflowState.mComputedMinHeight = computedMinHeight;
kidReflowState.mComputedMaxHeight = computedMaxHeight;
// Temporarily set mHasHorizontalScrollbar/mHasVerticalScrollbar to
// reflect our assumptions while we reflow the child.
PRBool didHaveHorizonalScrollbar = mInner.mHasHorizontalScrollbar;
PRBool didHaveVerticalScrollbar = mInner.mHasVerticalScrollbar;
mInner.mHasHorizontalScrollbar = aAssumeHScroll;
mInner.mHasVerticalScrollbar = aAssumeVScroll;
nsReflowStatus status;
nsresult rv = ReflowChild(mInner.mScrolledFrame, presContext, *aMetrics,
kidReflowState, 0, 0,
NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_MOVE_VIEW, status);
mInner.mHasHorizontalScrollbar = didHaveHorizonalScrollbar;
mInner.mHasVerticalScrollbar = didHaveVerticalScrollbar;
// Don't resize or position the view (if any) because we're going to resize
// it to the correct size anyway in PlaceScrollArea. Allowing it to
// resize here would size it to the natural height of the frame,

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

@ -206,6 +206,10 @@ public:
nsRect GetScrolledRectInternal(const nsRect& aScrolledOverflowArea,
const nsSize& aScrollPortSize) const;
PRUint32 GetScrollbarVisibility() const {
return (mHasVerticalScrollbar ? nsIScrollableFrame::VERTICAL : 0) |
(mHasHorizontalScrollbar ? nsIScrollableFrame::HORIZONTAL : 0);
}
nsMargin GetActualScrollbarSizes() const;
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
PRBool IsLTR() const;
@ -376,6 +380,9 @@ public:
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
return mInner.GetScrollbarStylesFromFrame();
}
virtual PRUint32 GetScrollbarVisibility() const {
return mInner.GetScrollbarVisibility();
}
virtual nsMargin GetActualScrollbarSizes() const {
return mInner.GetActualScrollbarSizes();
}
@ -598,6 +605,9 @@ public:
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
return mInner.GetScrollbarStylesFromFrame();
}
virtual PRUint32 GetScrollbarVisibility() const {
return mInner.GetScrollbarVisibility();
}
virtual nsMargin GetActualScrollbarSizes() const {
return mInner.GetActualScrollbarSizes();
}

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

@ -74,6 +74,13 @@ public:
*/
virtual ScrollbarStyles GetScrollbarStyles() const = 0;
enum { HORIZONTAL = 0x01, VERTICAL = 0x02 };
/**
* Return the scrollbars which are visible. It's OK to call this during reflow
* of the scrolled contents, in which case it will reflect the current
* assumptions about scrollbar visibility.
*/
virtual PRUint32 GetScrollbarVisibility() const = 0;
/**
* Return the actual sizes of all possible scrollbars. Returns 0 for scrollbar
* positions that don't have a scrollbar or where the scrollbar is not visible.
@ -83,12 +90,14 @@ public:
virtual nsMargin GetActualScrollbarSizes() const = 0;
/**
* Return the sizes of all scrollbars assuming that any scrollbars that could
* be visible due to overflowing content, are.
* be visible due to overflowing content, are. This can be called during reflow
* of the scrolled contents.
*/
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) = 0;
/**
* Return the sizes of all scrollbars assuming that any scrollbars that could
* be visible due to overflowing content, are.
* be visible due to overflowing content, are. This can be called during reflow
* of the scrolled contents.
*/
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
nsIRenderingContext* aRC) = 0;

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

@ -268,11 +268,15 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox,
nsIBox* scrollbox = nsGrid::GetScrollBox(parentBox);
nsIScrollableFrame *scrollable = do_QueryFrame(scrollbox);
if (scrollable) {
nsMargin scrollbarSizes = scrollable->GetActualScrollbarSizes();
// Don't call GetActualScrollbarSizes here because it's not safe
// to call that while we're reflowing the contents of the scrollframe,
// which we are here.
nsMargin scrollbarSizes = scrollable->GetDesiredScrollbarSizes(&aState);
PRUint32 visible = scrollable->GetScrollbarVisibility();
if (isHorizontal) {
if (isHorizontal && (visible & nsIScrollableFrame::VERTICAL)) {
diff += scrollbarSizes.left + scrollbarSizes.right;
} else {
} else if (!isHorizontal && (visible & nsIScrollableFrame::HORIZONTAL)) {
diff += scrollbarSizes.top + scrollbarSizes.bottom;
}
}