Bug 1302389 - patch 2 - Add ScrollFrameHelper::IsBidiLTR to return the inline-bidi direction, as opposed to physical LTR-ness, and use this in GetScrolledFrameDir(). r=dholbert

This commit is contained in:
Jonathan Kew 2016-09-15 10:41:36 +01:00
parent 01c9f80e52
commit 19eb5fe1ee
2 changed files with 17 additions and 8 deletions

View File

@ -4918,11 +4918,9 @@ void ScrollFrameHelper::PostOverflowEvent()
rpc->AddWillPaintObserver(mAsyncScrollPortEvent.get());
}
bool
ScrollFrameHelper::IsPhysicalLTR() const
nsIFrame*
ScrollFrameHelper::GetFrameForDir() const
{
//TODO make bidi code set these from preferences
nsIFrame *frame = mOuter;
// XXX This is a bit on the slow side.
if (mIsRoot) {
@ -4946,8 +4944,7 @@ ScrollFrameHelper::IsPhysicalLTR() const
}
}
WritingMode wm = frame->GetWritingMode();
return wm.IsVertical() ? wm.IsVerticalLR() : wm.IsBidiLTR();
return frame;
}
bool
@ -5822,7 +5819,7 @@ ScrollFrameHelper::GetScrolledFrameDir() const
}
}
return IsPhysicalLTR() ? NS_STYLE_DIRECTION_LTR : NS_STYLE_DIRECTION_RTL;
return IsBidiLTR() ? NS_STYLE_DIRECTION_LTR : NS_STYLE_DIRECTION_RTL;
}
nsRect

View File

@ -329,7 +329,19 @@ public:
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
nscoord GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState,
mozilla::WritingMode aVerticalWM);
bool IsPhysicalLTR() const;
bool IsPhysicalLTR() const {
WritingMode wm = GetFrameForDir()->GetWritingMode();
return wm.IsVertical() ? wm.IsVerticalLR() : wm.IsBidiLTR();
}
bool IsBidiLTR() const {
nsIFrame* frame = GetFrameForDir();
return frame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR;
}
private:
nsIFrame* GetFrameForDir() const; // helper for Is{Physical,Bidi}LTR to find
// the frame whose directionality we use
public:
bool IsScrollbarOnRight() const;
bool IsScrollingActive(nsDisplayListBuilder* aBuilder) const;
bool IsMaybeScrollingActive() const;