<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jan 25, 2014 at 8:40 AM, Quicksaver <span dir="ltr"><<a href="mailto:quicksaver@gmail.com" target="_blank">quicksaver@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi everyone, I was hoping someone could help me with a kind of a big problem I just can't figure out.<br>


<br>
I need to know, for my add-on, whether the scrollbar of a tab is on the right or on the left of the window. If the preference layout.scrollbar.side is 2 (right) or 3 (left) that is easy of course.<br>
<br>
But if it is 1 (content) I'm having doubts about how I'm doing it currently, as I'm just checking for contentDocument.<u></u>documentElement.dir == 'rtl' of each browser and I'm not sure if that gives me reliable results 100% of the time.<br>


<br>
And the biggest problem I have is when the pref is 0 (browser UI, default). I have no idea of what I should be checking for in this case. All of the methods in the Services.locale object can somehow be tricked into returning one of the rtl locales by changing my OS settings, and still keep the scrollbar on the right. In addition, I can also keep the scrollbar on the right even when using a rtl localization of firefox. Thus, pretty much every check I've come up with returns the rtl locale "correctly", despite the location of the scrollbar still being on the right.<br>


<br>
So, does anyone know of any way to always accurately get the location of the scrollbar? Maybe I'm missing something really simple and obvious, but like I said, I just can't figure it out. I'd really appreciate any kind of help with this.<br>

</blockquote><div><br></div><div>The behavior of this pref is implemented in ScrollFrameHelper::IsScrollbarOnRight (<a href="http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsGfxScrollFrame.cpp#3498">http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsGfxScrollFrame.cpp#3498</a>).  In short, for non-root scroll frames or for a value of 1, then we determine the scrollbar side based on the directionality of the element (or the documentElement for the top-level scrollbar), for a value of 0 we look at the value of the bidi.direction pref, 2 means always right, and 3 means always left.<br>

<br></div><div>None of this  should depend on your system locale direction.<br><br></div><div>I think the best way to do what you want is to port this behavior in your add-on JS code.<br><br>Cheers,<br clear="all"><div>--<br>

Ehsan<br><<a href="http://ehsanakhgari.org/">http://ehsanakhgari.org/</a>></div>
</div></div></div></div>