Bug 1193488 - Update values of writing-mode and text-orientation to reflect the CSS WG decision to revise them in the Writing Modes spec. r=dholbert

This commit is contained in:
Jonathan Kew
2015-09-23 22:16:01 +01:00
parent ae5dbf051f
commit 3d9ffd82eb
9 changed files with 129 additions and 126 deletions

View File

@@ -6644,36 +6644,36 @@ nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
/* static */ uint32_t
nsLayoutUtils::GetTextRunOrientFlagsForStyle(nsStyleContext* aStyleContext)
{
WritingMode wm(aStyleContext);
if (wm.IsVertical()) {
uint8_t writingMode = aStyleContext->StyleVisibility()->mWritingMode;
switch (writingMode) {
case NS_STYLE_WRITING_MODE_HORIZONTAL_TB:
return gfxTextRunFactory::TEXT_ORIENT_HORIZONTAL;
case NS_STYLE_WRITING_MODE_VERTICAL_LR:
case NS_STYLE_WRITING_MODE_VERTICAL_RL:
switch (aStyleContext->StyleVisibility()->mTextOrientation) {
case NS_STYLE_TEXT_ORIENTATION_MIXED:
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED;
case NS_STYLE_TEXT_ORIENTATION_UPRIGHT:
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS:
// This should depend on writing mode vertical-lr vs vertical-rl,
// but until we support SIDEWAYS_LEFT, we'll treat this the same
// as SIDEWAYS_RIGHT and simply fall through.
/*
if (wm.IsVerticalLR()) {
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT;
} else {
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
}
*/
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_RIGHT:
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_LEFT:
// Not yet supported, so fall through to the default (error) case.
/*
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT;
*/
default:
NS_NOTREACHED("unknown text-orientation");
return 0;
}
/* not yet implemented:
case NS_STYLE_WRITING_MODE_SIDEWAYS_LR:
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT;
*/
case NS_STYLE_WRITING_MODE_SIDEWAYS_RL:
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
default:
NS_NOTREACHED("unknown writing-mode");
return 0;
}
return 0;
}
/* static */ void