Bug 1094434 - Render resizer appropriately for vertical-lr and vertical-rl writing modes. r=roc

This commit is contained in:
Jonathan Kew 2014-11-13 08:58:06 +00:00
parent 5182bb2e02
commit dbeb458ff7
3 changed files with 27 additions and 10 deletions

View File

@ -502,21 +502,28 @@ nsResizerFrame::GetDirection()
{-1, 1}, {1, 1}
};
if (!GetContent())
if (!GetContent()) {
return directions[0]; // default: topleft
}
int32_t index = GetContent()->FindAttrValueIn(kNameSpaceID_None,
nsGkAtoms::dir,
strings, eCaseMatters);
if(index < 0)
if (index < 0) {
return directions[0]; // default: topleft
else if (index >= 8 && StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
}
if (index >= 8) {
// Directions 8 and higher are RTL-aware directions and should reverse the
// horizontal component if RTL.
Direction direction = directions[index];
direction.mHorizontal *= -1;
return direction;
WritingMode wm = GetWritingMode();
if (!(wm.IsVertical() ? wm.IsVerticalLR() : wm.IsBidiLTR())) {
Direction direction = directions[index];
direction.mHorizontal *= -1;
return direction;
}
}
return directions[index];
}

View File

@ -21,9 +21,15 @@
// if the direction is rtl, set the rtl attribute so that the
// stylesheet can use this to make the cursor appear properly
var direction = window.getComputedStyle(this, "").direction;
if (direction == "rtl") {
this.setAttribute("rtl", "true");
var cs = window.getComputedStyle(this, "");
if (cs.writingMode == "horizontal-tb") {;
if (cs.direction == "rtl") {
this.setAttribute("rtl", "true");
}
} else {
if (cs.writingMode == "vertical-rl") {
this.setAttribute("rtl", "true");
}
}
]]>
</constructor>

View File

@ -381,7 +381,11 @@ nsNativeTheme::IsDisabled(nsIFrame* aFrame, EventStates aEventStates)
bool
nsNativeTheme::IsFrameRTL(nsIFrame* aFrame)
{
return aFrame && aFrame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
if (!aFrame) {
return false;
}
WritingMode wm = aFrame->GetWritingMode();
return !(wm.IsVertical() ? wm.IsVerticalLR() : wm.IsBidiLTR());
}
bool