enyojs/moonstone — pull request #1822 by aarontam (2014-12-05 00:21:17+00:00)
Title: ENYO-589: Only reverse small header content when necessary.

### Issue
In RTL locales, if either or both of the small header's `title` and `titleBelow` content has RTL directionality, the placement of the small header elements is reversed. This is due to a recent change where we reversed the order of these elements based on the locale's directionality (via `enyo.Control.prototype.rtl`), but this would result in us handling the directionality twice in these instances, as the small header's content would be detected as having RTL directionality, and reverse the original reversal of the elements.

### Fix
We modify the ternary operator's conditional to only reverse the elements if we're both in an RTL locale _and_ our content does not have RTL directionality. This preserves the fix for BHV-17963 while not regressing when we have RTL content in the header. This is kind of a chicken and egg problem, as we want to set the content based upon what that content will be. The most straightforward way seemed to be to determine the directionality of the combination of the `title` and `subtitle` values. It could seem wasteful to potentially run `enyo.isRTL` more than once upon initialization, and the alternative could be to utilize `this.$.title.rtl` instead. This could result in less, but potentially multiple calls to `enyo.isRtl` as the `rtl` property of `this.$.title` can change once its content is set, resulting in another call to `detectTextDirectionality`, which calls `enyo.isRtl`. I decided to go with `enyo.isRtl` for the time being as it seemed more semantically correct and expressive of the logic here. Additionally, there could be potential problems down the road if the Header logic is updated and `contentChanged` is not called multiple times, as it currently is.

Enyo-DCO-1.1-Signed-off-by: Aaron Tam