diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index af065c2906f8..e14d2a8f633f 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -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 diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index d32e7ae162b3..cf3bff41533e 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -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;