Backout 3c3337ed60a1 (bug 1139306) for causing bug 1156918.

This commit is contained in:
Timothy Nikkel 2015-04-21 15:09:48 -05:00
parent 0dd96c1111
commit b76648e0f6
9 changed files with 43 additions and 55 deletions

View File

@ -30,14 +30,19 @@ html xul|scrollbar {
pointer-events: none;
}
/* Scrollbar code will reset the margin to the correct side depending on
layout.scrollbar.side pref */
xul|scrollbar[orient="vertical"] {
margin-left: -8px;
-moz-margin-start: -8px;
min-width: 8px;
max-width: 8px;
}
/* workaround for bug 1119057: as -moz-margin-start may not work as expected,
* force a right margin value in RTL mode. */
[dir="rtl"] xul|scrollbar[root="true"][orient="vertical"] {
-moz-margin-start: unset;
margin-right: -8px;
}
xul|scrollbar[orient="vertical"] xul|thumb {
max-width: 6px !important;
min-width: 6px !important;

View File

@ -9,10 +9,8 @@ scrollbar {
padding: 2px;
}
/* Scrollbar code will reset the margin to the correct side depending on
layout.scrollbar.side pref */
scrollbar[orient="vertical"] {
margin-left: -10px;
-moz-margin-start: -10px;
min-width: 10px;
max-width: 10px;
}

View File

@ -10,10 +10,8 @@ scrollbar {
padding: 2px;
}
/* Scrollbar code will reset the margin to the correct side depending on
layout.scrollbar.side pref */
scrollbar[orient="vertical"] {
margin-left: -8px;
-moz-margin-start: -8px;
min-width: 8px;
max-width: 8px;
}

View File

@ -9,10 +9,8 @@ scrollbar {
padding: 2px;
}
/* Scrollbar code will reset the margin to the correct side depending on
layout.scrollbar.side pref */
scrollbar[orient="vertical"] {
margin-left: -10px;
-moz-margin-start: -10px;
min-width: 10px;
max-width: 10px;
}

View File

@ -395,7 +395,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
aState->mShowVScrollbar = aAssumeVScroll;
nsPoint scrollPortOrigin(aState->mComputedBorder.left,
aState->mComputedBorder.top);
if (mHelper.GetScrollbarSide() == ScrollFrameHelper::eScrollbarOnLeft) {
if (!mHelper.IsScrollbarOnRight()) {
scrollPortOrigin.x += vScrollbarActualWidth;
}
mHelper.mScrollPort = nsRect(scrollPortOrigin, scrollPortSize);
@ -1009,7 +1009,7 @@ ScrollFrameHelper::GetDesiredScrollbarSizes(nsBoxLayoutState* aState)
if (mVScrollbarBox) {
nsSize size = mVScrollbarBox->GetPrefSize(*aState);
nsBox::AddMargin(mVScrollbarBox, size);
if (GetScrollbarSide() == eScrollbarOnRight)
if (IsScrollbarOnRight())
result.left = size.width;
else
result.right = size.width;
@ -3766,7 +3766,7 @@ ScrollFrameHelper::CreateAnonymousContent(
nsAutoString dir;
switch (resizeStyle) {
case NS_STYLE_RESIZE_HORIZONTAL:
if (GetScrollbarSide() == eScrollbarOnRight) {
if (IsScrollbarOnRight()) {
dir.AssignLiteral("right");
}
else {
@ -4213,8 +4213,8 @@ ScrollFrameHelper::IsLTR() const
return wm.IsVertical() ? wm.IsVerticalLR() : wm.IsBidiLTR();
}
ScrollFrameHelper::eScrollbarSide
ScrollFrameHelper::GetScrollbarSide() const
bool
ScrollFrameHelper::IsScrollbarOnRight() const
{
nsPresContext *presContext = mOuter->PresContext();
@ -4222,19 +4222,18 @@ ScrollFrameHelper::GetScrollbarSide() const
// layout.scrollbar.side. For non-top-level elements, it depends only on the
// directionaliy of the element (equivalent to a value of "1" for the pref).
if (!mIsRoot)
return IsLTR() ? eScrollbarOnRight : eScrollbarOnLeft;
return IsLTR();
switch (presContext->GetCachedIntPref(kPresContext_ScrollbarSide)) {
default:
case 0: // UI directionality
return (presContext->GetCachedIntPref(kPresContext_BidiDirection)
== IBMBIDI_TEXTDIRECTION_LTR)
? eScrollbarOnRight : eScrollbarOnLeft;
return presContext->GetCachedIntPref(kPresContext_BidiDirection)
== IBMBIDI_TEXTDIRECTION_LTR;
case 1: // Document / content directionality
return IsLTR() ? eScrollbarOnRight : eScrollbarOnLeft;
return IsLTR();
case 2: // Always right
return eScrollbarOnRight;
return true;
case 3: // Always left
return eScrollbarOnLeft;
return false;
}
}
@ -4272,8 +4271,7 @@ ScrollFrameHelper::IsScrollingActive(nsDisplayListBuilder* aBuilder) const
nsresult
nsXULScrollFrame::Layout(nsBoxLayoutState& aState)
{
bool scrollbarRight =
(mHelper.GetScrollbarSide() == ScrollFrameHelper::eScrollbarOnRight);
bool scrollbarRight = mHelper.IsScrollbarOnRight();
bool scrollbarBottom = true;
// get the content rect
@ -4740,7 +4738,7 @@ ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState,
"This should have been suppressed");
bool hasResizer = HasResizer();
bool scrollbarOnLeft = (GetScrollbarSide() == eScrollbarOnLeft);
bool scrollbarOnLeft = !IsScrollbarOnRight();
// place the scrollcorner
if (mScrollCornerBox || mResizerBox) {
@ -4806,14 +4804,9 @@ ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState,
vRect.width = aContentArea.width - mScrollPort.width;
vRect.x = scrollbarOnLeft ? aContentArea.x : mScrollPort.XMost();
if (mHasVerticalScrollbar) {
nsScrollbarFrame* scrollbar = do_QueryFrame(mVScrollbarBox);
NS_ASSERTION(scrollbar, "Frame must be a scrollbar");
if (scrollbar) {
nsMargin margin;
scrollbar->GetScrollbarMargin(margin, GetScrollbarSide());
vRect.Deflate(margin);
}
nsMargin margin;
mVScrollbarBox->GetMargin(margin);
vRect.Deflate(margin);
}
AdjustScrollbarRectForResizer(mOuter, presContext, vRect, hasResizer, true);
}

View File

@ -307,8 +307,7 @@ public:
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
nscoord GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState);
bool IsLTR() const;
enum eScrollbarSide { eScrollbarOnLeft, eScrollbarOnRight };
eScrollbarSide GetScrollbarSide() const;
bool IsScrollbarOnRight() const;
bool IsScrollingActive(nsDisplayListBuilder* aBuilder) const;
bool IsMaybeScrollingActive() const;
bool IsProcessingAsyncScroll() const {

View File

@ -167,11 +167,8 @@ nsScrollbarFrame::GetScrollbarMediator()
}
nsresult
nsScrollbarFrame::GetScrollbarMargin(
nsMargin& aMargin,
mozilla::ScrollFrameHelper::eScrollbarSide aSide)
nsScrollbarFrame::GetMargin(nsMargin& aMargin)
{
nsresult rv = NS_ERROR_FAILURE;
aMargin.SizeTo(0,0,0,0);
if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
@ -186,21 +183,18 @@ nsScrollbarFrame::GetScrollbarMargin(
aMargin.top = -presContext->DevPixelsToAppUnits(size.height);
}
else {
aMargin.left = -presContext->DevPixelsToAppUnits(size.width);
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
aMargin.right = -presContext->DevPixelsToAppUnits(size.width);
}
else {
aMargin.left = -presContext->DevPixelsToAppUnits(size.width);
}
}
rv = NS_OK;
return NS_OK;
}
}
if (NS_FAILED(rv)) {
rv = nsBox::GetMargin(aMargin);
}
if (NS_SUCCEEDED(rv) && aSide == ScrollFrameHelper::eScrollbarOnLeft) {
Swap(aMargin.left, aMargin.right);
}
return rv;
return nsBox::GetMargin(aMargin);
}
void

View File

@ -12,7 +12,6 @@
#include "mozilla/Attributes.h"
#include "nsBoxFrame.h"
#include "nsGfxScrollFrame.h"
class nsIScrollbarMediator;
@ -82,8 +81,7 @@ public:
*/
virtual bool DoesClipChildren() override { return true; }
nsresult GetScrollbarMargin(nsMargin& aMargin,
mozilla::ScrollFrameHelper::eScrollbarSide aSide);
virtual nsresult GetMargin(nsMargin& aMargin) override;
/**
* The following three methods set the value of mIncrement when a

View File

@ -33,6 +33,11 @@ xul|window xul|scrollbar[orient="vertical"] {
border: 0px solid transparent !important;
}
xul|window xul|scrollbar[orient="vertical"]:-moz-locale-dir(rtl) {
margin-left: 2px;
margin-right: -10px;
}
xul|window xul|scrollbar[orient="vertical"] xul|thumb {
max-width: 6px !important;
min-width: 6px !important;