mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 539331 - browser_sanitizeDialog.js is failing, r=matspal
This commit is contained in:
parent
6e53298ce8
commit
15976008ca
@ -2656,16 +2656,16 @@ nsEventStateManager::DecideGestureEvent(nsGestureNotifyEvent* aEvent,
|
|||||||
displayPanFeedback = PR_FALSE;
|
displayPanFeedback = PR_FALSE;
|
||||||
}
|
}
|
||||||
} else { //Not a XUL box
|
} else { //Not a XUL box
|
||||||
nsMargin scrollbarSizes = scrollableFrame->GetActualScrollbarSizes();
|
PRUint32 scrollbarVisibility = scrollableFrame->GetScrollbarVisibility();
|
||||||
|
|
||||||
//Check if we have visible scrollbars
|
//Check if we have visible scrollbars
|
||||||
if (scrollbarSizes.LeftRight()) {
|
if (scrollbarVisibility & nsIScrollableFrame::VERTICAL) {
|
||||||
panDirection = nsGestureNotifyEvent::ePanVertical;
|
panDirection = nsGestureNotifyEvent::ePanVertical;
|
||||||
displayPanFeedback = PR_TRUE;
|
displayPanFeedback = PR_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrollbarSizes.TopBottom()) {
|
if (scrollbarVisibility & nsIScrollableFrame::HORIZONTAL) {
|
||||||
panDirection = nsGestureNotifyEvent::ePanHorizontal;
|
panDirection = nsGestureNotifyEvent::ePanHorizontal;
|
||||||
displayPanFeedback = PR_TRUE;
|
displayPanFeedback = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -4811,11 +4811,11 @@ nsDocShell::GetScrollbarVisibility(PRBool * verticalVisible,
|
|||||||
nsIScrollableFrame* sf = GetRootScrollFrame();
|
nsIScrollableFrame* sf = GetRootScrollFrame();
|
||||||
NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsMargin scrollbars = sf->GetActualScrollbarSizes();
|
PRUint32 scrollbarVisibility = sf->GetScrollbarVisibility();
|
||||||
if (verticalVisible)
|
if (verticalVisible)
|
||||||
*verticalVisible = scrollbars.left != 0 || scrollbars.right != 0;
|
*verticalVisible = (scrollbarVisibility & nsIScrollableFrame::VERTICAL) != 0;
|
||||||
if (horizontalVisible)
|
if (horizontalVisible)
|
||||||
*horizontalVisible = scrollbars.top != 0 || scrollbars.bottom != 0;
|
*horizontalVisible = (scrollbarVisibility & nsIScrollableFrame::HORIZONTAL) != 0;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -679,15 +679,17 @@ nsLayoutUtils::GetNearestScrollableFrameForDirection(nsIFrame* aFrame,
|
|||||||
nsIScrollableFrame* scrollableFrame = do_QueryFrame(f);
|
nsIScrollableFrame* scrollableFrame = do_QueryFrame(f);
|
||||||
if (scrollableFrame) {
|
if (scrollableFrame) {
|
||||||
nsPresContext::ScrollbarStyles ss = scrollableFrame->GetScrollbarStyles();
|
nsPresContext::ScrollbarStyles ss = scrollableFrame->GetScrollbarStyles();
|
||||||
nsMargin scrollbarSizes = scrollableFrame->GetActualScrollbarSizes();
|
PRUint32 scrollbarVisibility = scrollableFrame->GetScrollbarVisibility();
|
||||||
nsRect scrollRange = scrollableFrame->GetScrollRange();
|
nsRect scrollRange = scrollableFrame->GetScrollRange();
|
||||||
// Require visible scrollbars or something to scroll to in
|
// Require visible scrollbars or something to scroll to in
|
||||||
// the given direction.
|
// the given direction.
|
||||||
if (aDirection == eVertical ?
|
if (aDirection == eVertical ?
|
||||||
(ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN &&
|
(ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN &&
|
||||||
(scrollbarSizes.LeftRight() || scrollRange.height > 0)) :
|
((scrollbarVisibility & nsIScrollableFrame::VERTICAL) ||
|
||||||
|
scrollRange.height > 0)) :
|
||||||
(ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN &&
|
(ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN &&
|
||||||
(scrollbarSizes.TopBottom() || scrollRange.width > 0)))
|
((scrollbarVisibility & nsIScrollableFrame::HORIZONTAL) ||
|
||||||
|
scrollRange.width > 0)))
|
||||||
return scrollableFrame;
|
return scrollableFrame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5985,13 +5985,10 @@ nsIFrame::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse)
|
|||||||
// When clicked on, the selection position within the element
|
// When clicked on, the selection position within the element
|
||||||
// will be enough to make them keyboard scrollable.
|
// will be enough to make them keyboard scrollable.
|
||||||
nsIScrollableFrame *scrollFrame = do_QueryFrame(this);
|
nsIScrollableFrame *scrollFrame = do_QueryFrame(this);
|
||||||
if (scrollFrame) {
|
if (scrollFrame && scrollFrame->GetScrollbarVisibility() != 0) {
|
||||||
nsMargin margin = scrollFrame->GetActualScrollbarSizes();
|
// Scroll bars will be used for overflow
|
||||||
if (margin.top || margin.right || margin.bottom || margin.left) {
|
isFocusable = PR_TRUE;
|
||||||
// Scroll bars will be used for overflow
|
tabIndex = 0;
|
||||||
isFocusable = PR_TRUE;
|
|
||||||
tabIndex = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,10 +485,21 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
|
|||||||
kidReflowState.mComputedMinHeight = computedMinHeight;
|
kidReflowState.mComputedMinHeight = computedMinHeight;
|
||||||
kidReflowState.mComputedMaxHeight = computedMaxHeight;
|
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;
|
nsReflowStatus status;
|
||||||
nsresult rv = ReflowChild(mInner.mScrolledFrame, presContext, *aMetrics,
|
nsresult rv = ReflowChild(mInner.mScrolledFrame, presContext, *aMetrics,
|
||||||
kidReflowState, 0, 0,
|
kidReflowState, 0, 0,
|
||||||
NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_MOVE_VIEW, status);
|
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
|
// 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
|
// it to the correct size anyway in PlaceScrollArea. Allowing it to
|
||||||
// resize here would size it to the natural height of the frame,
|
// resize here would size it to the natural height of the frame,
|
||||||
|
@ -206,6 +206,10 @@ public:
|
|||||||
nsRect GetScrolledRectInternal(const nsRect& aScrolledOverflowArea,
|
nsRect GetScrolledRectInternal(const nsRect& aScrolledOverflowArea,
|
||||||
const nsSize& aScrollPortSize) const;
|
const nsSize& aScrollPortSize) const;
|
||||||
|
|
||||||
|
PRUint32 GetScrollbarVisibility() const {
|
||||||
|
return (mHasVerticalScrollbar ? nsIScrollableFrame::VERTICAL : 0) |
|
||||||
|
(mHasHorizontalScrollbar ? nsIScrollableFrame::HORIZONTAL : 0);
|
||||||
|
}
|
||||||
nsMargin GetActualScrollbarSizes() const;
|
nsMargin GetActualScrollbarSizes() const;
|
||||||
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
||||||
PRBool IsLTR() const;
|
PRBool IsLTR() const;
|
||||||
@ -376,6 +380,9 @@ public:
|
|||||||
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
||||||
return mInner.GetScrollbarStylesFromFrame();
|
return mInner.GetScrollbarStylesFromFrame();
|
||||||
}
|
}
|
||||||
|
virtual PRUint32 GetScrollbarVisibility() const {
|
||||||
|
return mInner.GetScrollbarVisibility();
|
||||||
|
}
|
||||||
virtual nsMargin GetActualScrollbarSizes() const {
|
virtual nsMargin GetActualScrollbarSizes() const {
|
||||||
return mInner.GetActualScrollbarSizes();
|
return mInner.GetActualScrollbarSizes();
|
||||||
}
|
}
|
||||||
@ -598,6 +605,9 @@ public:
|
|||||||
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
||||||
return mInner.GetScrollbarStylesFromFrame();
|
return mInner.GetScrollbarStylesFromFrame();
|
||||||
}
|
}
|
||||||
|
virtual PRUint32 GetScrollbarVisibility() const {
|
||||||
|
return mInner.GetScrollbarVisibility();
|
||||||
|
}
|
||||||
virtual nsMargin GetActualScrollbarSizes() const {
|
virtual nsMargin GetActualScrollbarSizes() const {
|
||||||
return mInner.GetActualScrollbarSizes();
|
return mInner.GetActualScrollbarSizes();
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual ScrollbarStyles GetScrollbarStyles() const = 0;
|
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
|
* 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.
|
* positions that don't have a scrollbar or where the scrollbar is not visible.
|
||||||
@ -83,12 +90,14 @@ public:
|
|||||||
virtual nsMargin GetActualScrollbarSizes() const = 0;
|
virtual nsMargin GetActualScrollbarSizes() const = 0;
|
||||||
/**
|
/**
|
||||||
* Return the sizes of all scrollbars assuming that any scrollbars that could
|
* 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;
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) = 0;
|
||||||
/**
|
/**
|
||||||
* Return the sizes of all scrollbars assuming that any scrollbars that could
|
* 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,
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
||||||
nsIRenderingContext* aRC) = 0;
|
nsIRenderingContext* aRC) = 0;
|
||||||
|
@ -268,11 +268,15 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox,
|
|||||||
nsIBox* scrollbox = nsGrid::GetScrollBox(parentBox);
|
nsIBox* scrollbox = nsGrid::GetScrollBox(parentBox);
|
||||||
nsIScrollableFrame *scrollable = do_QueryFrame(scrollbox);
|
nsIScrollableFrame *scrollable = do_QueryFrame(scrollbox);
|
||||||
if (scrollable) {
|
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;
|
diff += scrollbarSizes.left + scrollbarSizes.right;
|
||||||
} else {
|
} else if (!isHorizontal && (visible & nsIScrollableFrame::HORIZONTAL)) {
|
||||||
diff += scrollbarSizes.top + scrollbarSizes.bottom;
|
diff += scrollbarSizes.top + scrollbarSizes.bottom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user