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:
@@ -66,7 +66,7 @@ private:
|
|||||||
case NS_STYLE_TEXT_ORIENTATION_UPRIGHT:
|
case NS_STYLE_TEXT_ORIENTATION_UPRIGHT:
|
||||||
flags |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
flags |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
||||||
break;
|
break;
|
||||||
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_RIGHT:
|
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS:
|
||||||
flags |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
|
flags |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6644,38 +6644,38 @@ nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
|||||||
/* static */ uint32_t
|
/* static */ uint32_t
|
||||||
nsLayoutUtils::GetTextRunOrientFlagsForStyle(nsStyleContext* aStyleContext)
|
nsLayoutUtils::GetTextRunOrientFlagsForStyle(nsStyleContext* aStyleContext)
|
||||||
{
|
{
|
||||||
WritingMode wm(aStyleContext);
|
uint8_t writingMode = aStyleContext->StyleVisibility()->mWritingMode;
|
||||||
if (wm.IsVertical()) {
|
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) {
|
switch (aStyleContext->StyleVisibility()->mTextOrientation) {
|
||||||
case NS_STYLE_TEXT_ORIENTATION_MIXED:
|
case NS_STYLE_TEXT_ORIENTATION_MIXED:
|
||||||
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED;
|
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED;
|
||||||
case NS_STYLE_TEXT_ORIENTATION_UPRIGHT:
|
case NS_STYLE_TEXT_ORIENTATION_UPRIGHT:
|
||||||
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
return gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
||||||
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS:
|
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;
|
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:
|
default:
|
||||||
NS_NOTREACHED("unknown text-orientation");
|
NS_NOTREACHED("unknown text-orientation");
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
nsLayoutUtils::GetRectDifferenceStrips(const nsRect& aR1, const nsRect& aR2,
|
nsLayoutUtils::GetRectDifferenceStrips(const nsRect& aR1, const nsRect& aR2,
|
||||||
nsRect* aHStrip, nsRect* aVStrip) {
|
nsRect* aHStrip, nsRect* aVStrip) {
|
||||||
|
|||||||
@@ -298,7 +298,13 @@ public:
|
|||||||
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // vertical-lr
|
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // vertical-lr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Ignore the SIDEWAYS_MASK bit of the writing-mode value, as this has no
|
||||||
|
// effect on the side mappings.
|
||||||
|
aWritingModeValue &= ~NS_STYLE_WRITING_MODE_SIDEWAYS_MASK;
|
||||||
|
|
||||||
|
// What's left of the writing-mode should be in the range 0-3:
|
||||||
NS_ASSERTION(aWritingModeValue < 4, "invalid aWritingModeValue value");
|
NS_ASSERTION(aWritingModeValue < 4, "invalid aWritingModeValue value");
|
||||||
|
|
||||||
return kLogicalBlockSides[aWritingModeValue][aEdge];
|
return kLogicalBlockSides[aWritingModeValue][aEdge];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,12 +460,7 @@ public:
|
|||||||
eLineOrientMask |
|
eLineOrientMask |
|
||||||
eOrientationMask;
|
eOrientationMask;
|
||||||
uint8_t textOrientation = aStyleContext->StyleVisibility()->mTextOrientation;
|
uint8_t textOrientation = aStyleContext->StyleVisibility()->mTextOrientation;
|
||||||
#if 0 // not yet implemented
|
if (textOrientation == NS_STYLE_TEXT_ORIENTATION_SIDEWAYS) {
|
||||||
if (textOrientation == NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_LEFT) {
|
|
||||||
mWritingMode &= ~eLineOrientMask;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (textOrientation >= NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_RIGHT) {
|
|
||||||
mWritingMode |= eSidewaysMask;
|
mWritingMode |= eSidewaysMask;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -469,17 +470,24 @@ public:
|
|||||||
{
|
{
|
||||||
mWritingMode = eOrientationMask;
|
mWritingMode = eOrientationMask;
|
||||||
uint8_t textOrientation = aStyleContext->StyleVisibility()->mTextOrientation;
|
uint8_t textOrientation = aStyleContext->StyleVisibility()->mTextOrientation;
|
||||||
#if 0 // not yet implemented
|
if (textOrientation == NS_STYLE_TEXT_ORIENTATION_SIDEWAYS) {
|
||||||
if (textOrientation == NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_LEFT) {
|
|
||||||
mWritingMode |= eLineOrientMask;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (textOrientation >= NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_RIGHT) {
|
|
||||||
mWritingMode |= eSidewaysMask;
|
mWritingMode |= eSidewaysMask;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NS_STYLE_WRITING_MODE_SIDEWAYS_LR:
|
||||||
|
mWritingMode = eBlockFlowMask |
|
||||||
|
eInlineFlowMask |
|
||||||
|
eOrientationMask |
|
||||||
|
eSidewaysMask;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NS_STYLE_WRITING_MODE_SIDEWAYS_RL:
|
||||||
|
mWritingMode = eOrientationMask |
|
||||||
|
eSidewaysMask;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NS_NOTREACHED("unknown writing mode!");
|
NS_NOTREACHED("unknown writing mode!");
|
||||||
mWritingMode = 0;
|
mWritingMode = 0;
|
||||||
@@ -487,8 +495,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (NS_STYLE_DIRECTION_RTL == styleVisibility->mDirection) {
|
if (NS_STYLE_DIRECTION_RTL == styleVisibility->mDirection) {
|
||||||
mWritingMode |= eInlineFlowMask | //XXX needs update when text-orientation added
|
mWritingMode ^= eInlineFlowMask | eBidiMask;
|
||||||
eBidiMask;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,7 +587,10 @@ private:
|
|||||||
// Note: We have one excess bit of info; WritingMode can pack into 4 bits.
|
// Note: We have one excess bit of info; WritingMode can pack into 4 bits.
|
||||||
// But since we have space, we're caching interesting things for fast access.
|
// But since we have space, we're caching interesting things for fast access.
|
||||||
|
|
||||||
eSidewaysMask = 0x20, // true means text-orientation is sideways-*,
|
eSidewaysMask = 0x20, // true means text is being rendered vertically
|
||||||
|
// using rotated glyphs (i.e. writing-mode is
|
||||||
|
// sideways-*, or writing-mode is vertical-* AND
|
||||||
|
// text-orientation is sideways),
|
||||||
// which means we'll use alphabetic instead of
|
// which means we'll use alphabetic instead of
|
||||||
// centered default baseline for vertical text
|
// centered default baseline for vertical text
|
||||||
|
|
||||||
|
|||||||
@@ -484,9 +484,10 @@ CSS_KEY(separate, separate)
|
|||||||
CSS_KEY(sepia, sepia)
|
CSS_KEY(sepia, sepia)
|
||||||
CSS_KEY(serif, serif)
|
CSS_KEY(serif, serif)
|
||||||
CSS_KEY(show, show)
|
CSS_KEY(show, show)
|
||||||
/* CSS_KEY(sideways, sideways) */
|
CSS_KEY(sideways, sideways)
|
||||||
/* CSS_KEY(sideways-left, sideways_left) */
|
/*CSS_KEY(sideways-lr, sideways_lr)*/
|
||||||
CSS_KEY(sideways-right, sideways_right)
|
CSS_KEY(sideways-right, sideways_right) /* alias for 'sideways' */
|
||||||
|
CSS_KEY(sideways-rl, sideways_rl)
|
||||||
CSS_KEY(simp-chinese-formal, simp_chinese_formal)
|
CSS_KEY(simp-chinese-formal, simp_chinese_formal)
|
||||||
CSS_KEY(simp-chinese-informal, simp_chinese_informal)
|
CSS_KEY(simp-chinese-informal, simp_chinese_informal)
|
||||||
CSS_KEY(simplified, simplified)
|
CSS_KEY(simplified, simplified)
|
||||||
|
|||||||
@@ -1775,9 +1775,8 @@ const KTableValue nsCSSProps::kTextDecorationStyleKTable[] = {
|
|||||||
const KTableValue nsCSSProps::kTextOrientationKTable[] = {
|
const KTableValue nsCSSProps::kTextOrientationKTable[] = {
|
||||||
eCSSKeyword_mixed, NS_STYLE_TEXT_ORIENTATION_MIXED,
|
eCSSKeyword_mixed, NS_STYLE_TEXT_ORIENTATION_MIXED,
|
||||||
eCSSKeyword_upright, NS_STYLE_TEXT_ORIENTATION_UPRIGHT,
|
eCSSKeyword_upright, NS_STYLE_TEXT_ORIENTATION_UPRIGHT,
|
||||||
eCSSKeyword_sideways_right, NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_RIGHT,
|
eCSSKeyword_sideways, NS_STYLE_TEXT_ORIENTATION_SIDEWAYS,
|
||||||
/* eCSSKeyword_sideways_left, NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_LEFT, */
|
eCSSKeyword_sideways_right, NS_STYLE_TEXT_ORIENTATION_SIDEWAYS,
|
||||||
/* eCSSKeyword_sideways, NS_STYLE_TEXT_ORIENTATION_SIDEWAYS, */
|
|
||||||
eCSSKeyword_UNKNOWN, -1
|
eCSSKeyword_UNKNOWN, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1945,6 +1944,8 @@ const KTableValue nsCSSProps::kWritingModeKTable[] = {
|
|||||||
eCSSKeyword_horizontal_tb, NS_STYLE_WRITING_MODE_HORIZONTAL_TB,
|
eCSSKeyword_horizontal_tb, NS_STYLE_WRITING_MODE_HORIZONTAL_TB,
|
||||||
eCSSKeyword_vertical_lr, NS_STYLE_WRITING_MODE_VERTICAL_LR,
|
eCSSKeyword_vertical_lr, NS_STYLE_WRITING_MODE_VERTICAL_LR,
|
||||||
eCSSKeyword_vertical_rl, NS_STYLE_WRITING_MODE_VERTICAL_RL,
|
eCSSKeyword_vertical_rl, NS_STYLE_WRITING_MODE_VERTICAL_RL,
|
||||||
|
/* eCSSKeyword_sideways_lr, NS_STYLE_WRITING_MODE_SIDEWAYS_LR, */
|
||||||
|
eCSSKeyword_sideways_rl, NS_STYLE_WRITING_MODE_SIDEWAYS_RL,
|
||||||
eCSSKeyword_lr, NS_STYLE_WRITING_MODE_HORIZONTAL_TB,
|
eCSSKeyword_lr, NS_STYLE_WRITING_MODE_HORIZONTAL_TB,
|
||||||
eCSSKeyword_lr_tb, NS_STYLE_WRITING_MODE_HORIZONTAL_TB,
|
eCSSKeyword_lr_tb, NS_STYLE_WRITING_MODE_HORIZONTAL_TB,
|
||||||
eCSSKeyword_rl, NS_STYLE_WRITING_MODE_HORIZONTAL_TB,
|
eCSSKeyword_rl, NS_STYLE_WRITING_MODE_HORIZONTAL_TB,
|
||||||
|
|||||||
@@ -7641,6 +7641,8 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
|
|||||||
break;
|
break;
|
||||||
case NS_STYLE_WRITING_MODE_VERTICAL_RL:
|
case NS_STYLE_WRITING_MODE_VERTICAL_RL:
|
||||||
case NS_STYLE_WRITING_MODE_VERTICAL_LR:
|
case NS_STYLE_WRITING_MODE_VERTICAL_LR:
|
||||||
|
case NS_STYLE_WRITING_MODE_SIDEWAYS_RL:
|
||||||
|
case NS_STYLE_WRITING_MODE_SIDEWAYS_LR:
|
||||||
vertical = true;
|
vertical = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -399,12 +399,25 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
|||||||
#define NS_STYLE_DIRECTION_RTL 1
|
#define NS_STYLE_DIRECTION_RTL 1
|
||||||
|
|
||||||
// See nsStyleVisibility
|
// See nsStyleVisibility
|
||||||
// WritingModes.h depends on the particular values used here
|
// NOTE: WritingModes.h depends on the particular values used here.
|
||||||
#define NS_STYLE_WRITING_MODE_HORIZONTAL_TB 0
|
#define NS_STYLE_WRITING_MODE_HORIZONTAL_TB 0
|
||||||
#define NS_STYLE_WRITING_MODE_VERTICAL_RL 1
|
#define NS_STYLE_WRITING_MODE_VERTICAL_RL 1
|
||||||
// #define NS_STYLE_WRITING_MODE_HORIZONTAL_BT 2 // hypothetical
|
// #define NS_STYLE_WRITING_MODE_HORIZONTAL_BT 2 // hypothetical
|
||||||
#define NS_STYLE_WRITING_MODE_VERTICAL_LR 3
|
#define NS_STYLE_WRITING_MODE_VERTICAL_LR 3
|
||||||
|
|
||||||
|
// Single-bit flag, used in combination with VERTICAL_LR and _RL to specify
|
||||||
|
// the corresponding SIDEWAYS_* modes.
|
||||||
|
// (To avoid ambiguity, this bit must be high enough such that no other
|
||||||
|
// values here accidentally use it in their binary representation.)
|
||||||
|
#define NS_STYLE_WRITING_MODE_SIDEWAYS_MASK 4
|
||||||
|
|
||||||
|
#define NS_STYLE_WRITING_MODE_SIDEWAYS_RL \
|
||||||
|
(NS_STYLE_WRITING_MODE_VERTICAL_RL | \
|
||||||
|
NS_STYLE_WRITING_MODE_SIDEWAYS_MASK)
|
||||||
|
#define NS_STYLE_WRITING_MODE_SIDEWAYS_LR \
|
||||||
|
(NS_STYLE_WRITING_MODE_VERTICAL_LR | \
|
||||||
|
NS_STYLE_WRITING_MODE_SIDEWAYS_MASK)
|
||||||
|
|
||||||
// See nsStyleDisplay
|
// See nsStyleDisplay
|
||||||
#define NS_STYLE_DISPLAY_NONE 0
|
#define NS_STYLE_DISPLAY_NONE 0
|
||||||
#define NS_STYLE_DISPLAY_BLOCK 1
|
#define NS_STYLE_DISPLAY_BLOCK 1
|
||||||
@@ -879,9 +892,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
|||||||
// See nsStyleText
|
// See nsStyleText
|
||||||
#define NS_STYLE_TEXT_ORIENTATION_MIXED 0
|
#define NS_STYLE_TEXT_ORIENTATION_MIXED 0
|
||||||
#define NS_STYLE_TEXT_ORIENTATION_UPRIGHT 1
|
#define NS_STYLE_TEXT_ORIENTATION_UPRIGHT 1
|
||||||
#define NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_RIGHT 2
|
#define NS_STYLE_TEXT_ORIENTATION_SIDEWAYS 2
|
||||||
#define NS_STYLE_TEXT_ORIENTATION_SIDEWAYS_LEFT 3 /* placeholder, not yet parsed */
|
|
||||||
#define NS_STYLE_TEXT_ORIENTATION_SIDEWAYS 4 /* placeholder, not yet parsed */
|
|
||||||
|
|
||||||
// See nsStyleText
|
// See nsStyleText
|
||||||
#define NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE 0
|
#define NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE 0
|
||||||
|
|||||||
@@ -4577,12 +4577,24 @@ function logical_axis_prop_get_computed(cs, property)
|
|||||||
var orientation = writingMode.substring(0, writingMode.indexOf("-"));
|
var orientation = writingMode.substring(0, writingMode.indexOf("-"));
|
||||||
|
|
||||||
var mappings = {
|
var mappings = {
|
||||||
"block-size": { horizontal: "height", vertical: "width" },
|
"block-size": { horizontal: "height",
|
||||||
"inline-size": { horizontal: "width", vertical: "height" },
|
vertical: "width",
|
||||||
"max-block-size": { horizontal: "max-height", vertical: "max-width" },
|
sideways: "width" },
|
||||||
"max-inline-size": { horizontal: "max-width", vertical: "max-height" },
|
"inline-size": { horizontal: "width",
|
||||||
"min-block-size": { horizontal: "min-height", vertical: "min-width" },
|
vertical: "height",
|
||||||
"min-inline-size": { horizontal: "min-width", vertical: "min-height" },
|
sideways: "height" },
|
||||||
|
"max-block-size": { horizontal: "max-height",
|
||||||
|
vertical: "max-width",
|
||||||
|
sideways: "max-width" },
|
||||||
|
"max-inline-size": { horizontal: "max-width",
|
||||||
|
vertical: "max-height",
|
||||||
|
sideways: "max-height" },
|
||||||
|
"min-block-size": { horizontal: "min-height",
|
||||||
|
vertical: "min-width",
|
||||||
|
sideways: "min-width" },
|
||||||
|
"min-inline-size": { horizontal: "min-width",
|
||||||
|
vertical: "min-height",
|
||||||
|
sideways: "min-height" },
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!mappings[property]) {
|
if (!mappings[property]) {
|
||||||
@@ -4601,51 +4613,42 @@ function logical_box_prop_get_computed(cs, property)
|
|||||||
{
|
{
|
||||||
// http://dev.w3.org/csswg/css-writing-modes-3/#logical-to-physical
|
// http://dev.w3.org/csswg/css-writing-modes-3/#logical-to-physical
|
||||||
|
|
||||||
// Use defaults for these two properties in case the vertical text
|
// Use default for writing-mode in case the vertical text
|
||||||
// pref (which they live behind) is turned off.
|
// pref (which it lives behind) is turned off.
|
||||||
var writingMode = cs.getPropertyValue("writing-mode") || "horizontal-tb";
|
var writingMode = cs.getPropertyValue("writing-mode") || "horizontal-tb";
|
||||||
var textOrientation = cs.getPropertyValue("text-orientation") || "mixed";
|
|
||||||
|
|
||||||
var direction = cs.getPropertyValue("direction");
|
var direction = cs.getPropertyValue("direction");
|
||||||
|
|
||||||
// We only need to distinguish between text-orientation values of
|
|
||||||
// sideways-left and {mixed,upright,sideways-right} (which we will
|
|
||||||
// call "others").
|
|
||||||
|
|
||||||
if (textOrientation == "sideways") {
|
|
||||||
// text-orientation does not contribute to the logical to physical
|
|
||||||
// mapping when writing-mode is horizontal-tb, so it doesn't matter
|
|
||||||
// that we convert it to sideways-left in that case.
|
|
||||||
textOrientation = writingMode == "vertical-rl" ? "others" : "sideways-left";
|
|
||||||
} else if (textOrientation != "sideways-left") {
|
|
||||||
textOrientation = "others";
|
|
||||||
}
|
|
||||||
|
|
||||||
// keys in blockMappings are writing-mode values
|
// keys in blockMappings are writing-mode values
|
||||||
var blockMappings = {
|
var blockMappings = {
|
||||||
"horizontal-tb": { "start": "top", "end": "bottom" },
|
"horizontal-tb": { "start": "top", "end": "bottom" },
|
||||||
"vertical-rl": { "start": "right", "end": "left" },
|
"vertical-rl": { "start": "right", "end": "left" },
|
||||||
"vertical-lr": { "start": "left", "end": "right" },
|
"vertical-lr": { "start": "left", "end": "right" },
|
||||||
|
"sideways-rl": { "start": "right", "end": "left" },
|
||||||
|
"sideways-lr": { "start": "left", "end": "right" },
|
||||||
};
|
};
|
||||||
|
|
||||||
// keys in inlineMappings are regular expressions that match against
|
// keys in inlineMappings are regular expressions that match against
|
||||||
// a {writing-mode,text-orientation,direction} triple as a space-
|
// a {writing-mode,direction} pair as a space-separated string
|
||||||
// separated string
|
|
||||||
var inlineMappings = {
|
var inlineMappings = {
|
||||||
"horizontal-tb \\S+ ltr": { "start": "left", "end": "right" },
|
"horizontal-tb ltr": { "start": "left", "end": "right" },
|
||||||
"horizontal-tb \\S+ rtl": { "start": "right", "end": "left" },
|
"horizontal-tb rtl": { "start": "right", "end": "left" },
|
||||||
"vertical-.. sideways-left ltr": { "start": "bottom", "end": "top" },
|
"vertical-.. ltr": { "start": "bottom", "end": "top" },
|
||||||
"vertical-.. sideways-left rtl": { "start": "top", "end": "bottom" },
|
"vertical-.. rtl": { "start": "top", "end": "bottom" },
|
||||||
"vertical-.. others ltr": { "start": "top", "end": "bottom" },
|
"vertical-.. ltr": { "start": "top", "end": "bottom" },
|
||||||
"vertical-.. others rtl": { "start": "bottom", "end": "top" },
|
"vertical-.. rtl": { "start": "bottom", "end": "top" },
|
||||||
|
"sideways-lr ltr": { "start": "bottom", "end": "top" },
|
||||||
|
"sideways-lr rtl": { "start": "top", "end": "bottom" },
|
||||||
|
"sideways-rl ltr": { "start": "top", "end": "bottom" },
|
||||||
|
"sideways-rl rtl": { "start": "bottom", "end": "top" },
|
||||||
};
|
};
|
||||||
|
|
||||||
var blockMapping = blockMappings[writingMode];
|
var blockMapping = blockMappings[writingMode];
|
||||||
var inlineMapping;
|
var inlineMapping;
|
||||||
|
|
||||||
// test each regular expression in inlineMappings against the
|
// test each regular expression in inlineMappings against the
|
||||||
// {writing-mode,text-orientation,direction} triple
|
// {writing-mode,direction} pair
|
||||||
var key = `${writingMode} ${textOrientation} ${direction}`;
|
var key = `${writingMode} ${direction}`;
|
||||||
for (var k in inlineMappings) {
|
for (var k in inlineMappings) {
|
||||||
if (new RegExp(k).test(key)) {
|
if (new RegExp(k).test(key)) {
|
||||||
inlineMapping = inlineMappings[k];
|
inlineMapping = inlineMappings[k];
|
||||||
@@ -4728,16 +4731,16 @@ if (SpecialPowers.getBoolPref("layout.css.vertical-text.enabled")) {
|
|||||||
inherited: true,
|
inherited: true,
|
||||||
type: CSS_TYPE_LONGHAND,
|
type: CSS_TYPE_LONGHAND,
|
||||||
initial_values: [ "horizontal-tb", "lr", "lr-tb", "rl", "rl-tb" ],
|
initial_values: [ "horizontal-tb", "lr", "lr-tb", "rl", "rl-tb" ],
|
||||||
other_values: [ "vertical-lr", "vertical-rl", "tb", "tb-rl" ],
|
other_values: [ "vertical-lr", "vertical-rl", "sideways-rl", "tb", "tb-rl" ],
|
||||||
invalid_values: [ "10px", "30%", "justify", "auto", "1em" ]
|
invalid_values: [ "10px", "30%", "justify", "auto", "1em", "sideways-lr" ] /* sideways-lr not yet supported */
|
||||||
},
|
},
|
||||||
"text-orientation": {
|
"text-orientation": {
|
||||||
domProp: "textOrientation",
|
domProp: "textOrientation",
|
||||||
inherited: true,
|
inherited: true,
|
||||||
type: CSS_TYPE_LONGHAND,
|
type: CSS_TYPE_LONGHAND,
|
||||||
initial_values: [ "mixed" ],
|
initial_values: [ "mixed" ],
|
||||||
other_values: [ "upright", "sideways-right" ],
|
other_values: [ "upright", "sideways", "sideways-right" ], /* sideways-right alias for backward compatibility */
|
||||||
invalid_values: [ "none", "3em", "sideways", "sideways-left" ] /* sideways, sideways-left not yet supported */
|
invalid_values: [ "none", "3em", "sideways-left" ] /* sideways-left removed from CSS Writing Modes */
|
||||||
},
|
},
|
||||||
"border-block-end": {
|
"border-block-end": {
|
||||||
domProp: "borderBlockEnd",
|
domProp: "borderBlockEnd",
|
||||||
|
|||||||
@@ -43,60 +43,42 @@ var gValues = {
|
|||||||
"border-style": ["solid", "dashed", "dotted", "double", "groove"],
|
"border-style": ["solid", "dashed", "dotted", "double", "groove"],
|
||||||
};
|
};
|
||||||
|
|
||||||
// six unique overall writing modes
|
// Six unique overall writing modes for property-mapping purposes.
|
||||||
|
// Note that text-orientation does not affect these mappings, now that
|
||||||
|
// the proposed sideways-left value no longer exists (superseded in CSS
|
||||||
|
// Writing Modes by writing-mode: sideways-lr).
|
||||||
var gWritingModes = [
|
var gWritingModes = [
|
||||||
{ style: [
|
{ style: [
|
||||||
"writing-mode: horizontal-tb; text-orientation: mixed; direction: ltr; ",
|
"writing-mode: horizontal-tb; direction: ltr; ",
|
||||||
"writing-mode: horizontal-tb; text-orientation: upright; direction: ltr; ",
|
|
||||||
"writing-mode: horizontal-tb; text-orientation: sideways-right; direction: ltr; ",
|
|
||||||
// XXX See the todo()s below.
|
|
||||||
// "writing-mode: horizontal-tb; text-orientation: sideways-left; direction: ltr; ",
|
|
||||||
// "writing-mode: horizontal-tb; text-orientation: sideways; direction: ltr; ",
|
|
||||||
],
|
],
|
||||||
blockStart: "top", blockEnd: "bottom", inlineStart: "left", inlineEnd: "right",
|
blockStart: "top", blockEnd: "bottom", inlineStart: "left", inlineEnd: "right",
|
||||||
block: "vertical", inline: "horizontal" },
|
block: "vertical", inline: "horizontal" },
|
||||||
{ style: [
|
{ style: [
|
||||||
"writing-mode: horizontal-tb; text-orientation: mixed; direction: rtl; ",
|
"writing-mode: horizontal-tb; direction: rtl; ",
|
||||||
"writing-mode: horizontal-tb; text-orientation: upright; direction: rtl; ",
|
|
||||||
"writing-mode: horizontal-tb; text-orientation: sideways-right; direction: rtl; ",
|
|
||||||
// "writing-mode: horizontal-tb; text-orientation: sideways-left; direction: rtl; ",
|
|
||||||
// "writing-mode: horizontal-tb; text-orientation: sideways; direction: rtl; ",
|
|
||||||
],
|
],
|
||||||
blockStart: "top", blockEnd: "bottom", inlineStart: "right", inlineEnd: "left",
|
blockStart: "top", blockEnd: "bottom", inlineStart: "right", inlineEnd: "left",
|
||||||
block: "vertical", inline: "horizontal" },
|
block: "vertical", inline: "horizontal" },
|
||||||
{ style: [
|
{ style: [
|
||||||
"writing-mode: vertical-rl; text-orientation: mixed; direction: rtl; ",
|
"writing-mode: vertical-rl; direction: rtl; ",
|
||||||
"writing-mode: vertical-rl; text-orientation: upright; direction: rtl; ",
|
"writing-mode: sideways-rl; direction: rtl; ",
|
||||||
"writing-mode: vertical-rl; text-orientation: sideways-right; direction: rtl; ",
|
|
||||||
// "writing-mode: vertical-rl; text-orientation: sideways-left; direction: ltr; ",
|
|
||||||
// "writing-mode: vertical-rl; text-orientation: sideways; direction: rtl; ",
|
|
||||||
],
|
],
|
||||||
blockStart: "right", blockEnd: "left", inlineStart: "bottom", inlineEnd: "top",
|
blockStart: "right", blockEnd: "left", inlineStart: "bottom", inlineEnd: "top",
|
||||||
block: "horizontal", inline: "vertical" },
|
block: "horizontal", inline: "vertical" },
|
||||||
{ style: [
|
{ style: [
|
||||||
"writing-mode: vertical-rl; text-orientation: mixed; direction: ltr; ",
|
"writing-mode: vertical-rl; direction: ltr; ",
|
||||||
"writing-mode: vertical-rl; text-orientation: upright; direction: ltr; ",
|
"writing-mode: sideways-rl; direction: ltr; ",
|
||||||
"writing-mode: vertical-rl; text-orientation: sideways-right; direction: ltr; ",
|
|
||||||
// "writing-mode: vertical-rl; text-orientation: sideways-left; direction: rtl; ",
|
|
||||||
// "writing-mode: vertical-rl; text-orientation: sideways; direction: ltr; ",
|
|
||||||
],
|
],
|
||||||
blockStart: "right", blockEnd: "left", inlineStart: "top", inlineEnd: "bottom",
|
blockStart: "right", blockEnd: "left", inlineStart: "top", inlineEnd: "bottom",
|
||||||
block: "horizontal", inline: "vertical" },
|
block: "horizontal", inline: "vertical" },
|
||||||
{ style: [
|
{ style: [
|
||||||
"writing-mode: vertical-lr; text-orientation: mixed; direction: rtl; ",
|
"writing-mode: vertical-lr; direction: rtl; ",
|
||||||
"writing-mode: vertical-lr; text-orientation: upright; direction: rtl; ",
|
// "writing-mode: sideways-lr; direction: ltr; ",
|
||||||
"writing-mode: vertical-lr; text-orientation: sideways-right; direction: rtl; ",
|
|
||||||
// "writing-mode: vertical-lr; text-orientation: sideways-left; direction: ltr; ",
|
|
||||||
// "writing-mode: vertical-lr; text-orientation: sideways; direction: ltr; ",
|
|
||||||
],
|
],
|
||||||
blockStart: "left", blockEnd: "right", inlineStart: "bottom", inlineEnd: "top",
|
blockStart: "left", blockEnd: "right", inlineStart: "bottom", inlineEnd: "top",
|
||||||
block: "horizontal", inline: "vertical" },
|
block: "horizontal", inline: "vertical" },
|
||||||
{ style: [
|
{ style: [
|
||||||
"writing-mode: vertical-lr; text-orientation: mixed; direction: ltr; ",
|
"writing-mode: vertical-lr; direction: ltr; ",
|
||||||
"writing-mode: vertical-lr; text-orientation: upright; direction: ltr; ",
|
// "writing-mode: sideways-lr; direction: rtl; ",
|
||||||
"writing-mode: vertical-lr; text-orientation: sideways-right; direction: ltr; ",
|
|
||||||
// "writing-mode: vertical-lr; text-orientation: sideways-left; direction: rtl; ",
|
|
||||||
// "writing-mode: vertical-lr; text-orientation: sideways; direction: rtl; ",
|
|
||||||
],
|
],
|
||||||
blockStart: "left", blockEnd: "right", inlineStart: "top", inlineEnd: "bottom",
|
blockStart: "left", blockEnd: "right", inlineStart: "top", inlineEnd: "bottom",
|
||||||
block: "horizontal", inline: "vertical" },
|
block: "horizontal", inline: "vertical" },
|
||||||
@@ -162,23 +144,16 @@ function init() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assume that sideways-left and sideways keywords are still not parsed yet
|
// Assume that the sideways-lr keyword is not parsed yet for writing-mode.
|
||||||
// for text-orientation. When we start supporting these keywords, the
|
// When we start supporting this keyword, the entries in the .style
|
||||||
// entries in the .style properties of the gWritingModes objects above
|
// properties of the gWritingModes objects above should be uncommented.
|
||||||
// should be uncommented.
|
|
||||||
var s = document.createElement("style");
|
var s = document.createElement("style");
|
||||||
document.body.appendChild(s);
|
document.body.appendChild(s);
|
||||||
|
|
||||||
s.textContent = "div { }";
|
s.textContent = "div { }";
|
||||||
s.sheet.cssRules[0].style.textOrientation = "sideways-left";
|
s.sheet.cssRules[0].style.writingMode = "sideways-lr";
|
||||||
todo(s.sheet.cssRules[0].style.textOrientation, "sideways-left",
|
todo(s.sheet.cssRules[0].style.writingMode, "sideways-lr",
|
||||||
"uncomment sideways-left cases from gWritingModes and " +
|
"uncomment sideways-lr cases from gWritingModes and " +
|
||||||
"remove this todo()!");
|
|
||||||
|
|
||||||
s.textContent = "div { }";
|
|
||||||
s.sheet.cssRules[0].style.textOrientation = "sideways";
|
|
||||||
todo(s.sheet.cssRules[0].style.textOrientation, "sideways",
|
|
||||||
"uncomment sideways cases from gWritingModes and " +
|
|
||||||
"remove this todo()!");
|
"remove this todo()!");
|
||||||
|
|
||||||
s.remove();
|
s.remove();
|
||||||
|
|||||||
Reference in New Issue
Block a user