From db6979f76c3fffeaa269a16114426f6ee977b5a8 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Fri, 9 Nov 2012 09:43:48 +0000 Subject: [PATCH] bug 774560 pt 2 - implement text-transform:full-width. r=smontagu --- layout/base/nsStyleConsts.h | 1 + layout/generic/nsTextRunTransformations.cpp | 4 ++++ layout/reftests/text-transform/fullwidth-1-ref.html | 9 +++++++++ layout/reftests/text-transform/fullwidth-1.html | 9 +++++++++ layout/reftests/text-transform/fullwidth-2-ref.html | 9 +++++++++ layout/reftests/text-transform/fullwidth-2.html | 9 +++++++++ layout/reftests/text-transform/reftest.list | 2 ++ layout/style/nsCSSKeywordList.h | 1 + layout/style/nsCSSProps.cpp | 1 + layout/style/test/property_database.js | 2 +- 10 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 layout/reftests/text-transform/fullwidth-1-ref.html create mode 100644 layout/reftests/text-transform/fullwidth-1.html create mode 100644 layout/reftests/text-transform/fullwidth-2-ref.html create mode 100644 layout/reftests/text-transform/fullwidth-2.html diff --git a/layout/base/nsStyleConsts.h b/layout/base/nsStyleConsts.h index 47dbebced125..d7183feff20b 100644 --- a/layout/base/nsStyleConsts.h +++ b/layout/base/nsStyleConsts.h @@ -680,6 +680,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_TEXT_TRANSFORM_CAPITALIZE 1 #define NS_STYLE_TEXT_TRANSFORM_LOWERCASE 2 #define NS_STYLE_TEXT_TRANSFORM_UPPERCASE 3 +#define NS_STYLE_TEXT_TRANSFORM_FULLWIDTH 4 // See nsStyleDisplay #define NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE 0 diff --git a/layout/generic/nsTextRunTransformations.cpp b/layout/generic/nsTextRunTransformations.cpp index 6d1a00cc1870..77a9d9f752b5 100644 --- a/layout/generic/nsTextRunTransformations.cpp +++ b/layout/generic/nsTextRunTransformations.cpp @@ -873,6 +873,10 @@ nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun, } break; + case NS_STYLE_TEXT_TRANSFORM_FULLWIDTH: + ch = mozilla::unicode::GetFullWidth(ch); + break; + default: break; } diff --git a/layout/reftests/text-transform/fullwidth-1-ref.html b/layout/reftests/text-transform/fullwidth-1-ref.html new file mode 100644 index 000000000000..d49be6121025 --- /dev/null +++ b/layout/reftests/text-transform/fullwidth-1-ref.html @@ -0,0 +1,9 @@ + + + + + + + full width ¥10 + + diff --git a/layout/reftests/text-transform/fullwidth-1.html b/layout/reftests/text-transform/fullwidth-1.html new file mode 100644 index 000000000000..147bea6241e0 --- /dev/null +++ b/layout/reftests/text-transform/fullwidth-1.html @@ -0,0 +1,9 @@ + + + + + + + full width ¥10 + + diff --git a/layout/reftests/text-transform/fullwidth-2-ref.html b/layout/reftests/text-transform/fullwidth-2-ref.html new file mode 100644 index 000000000000..a3a2761509cb --- /dev/null +++ b/layout/reftests/text-transform/fullwidth-2-ref.html @@ -0,0 +1,9 @@ + + + + + + + アイヴ + + diff --git a/layout/reftests/text-transform/fullwidth-2.html b/layout/reftests/text-transform/fullwidth-2.html new file mode 100644 index 000000000000..745b8ad19a71 --- /dev/null +++ b/layout/reftests/text-transform/fullwidth-2.html @@ -0,0 +1,9 @@ + + + + + + + アイヴ + + diff --git a/layout/reftests/text-transform/reftest.list b/layout/reftests/text-transform/reftest.list index cbec6ff8e213..6faf19826a43 100644 --- a/layout/reftests/text-transform/reftest.list +++ b/layout/reftests/text-transform/reftest.list @@ -22,3 +22,5 @@ HTTP(..) != small-caps-turkish-1.html small-caps-turkish-1-notref.html == greek-uppercase-1.html greek-uppercase-1-ref.html == greek-uppercase-2.html greek-uppercase-2-ref.html == greek-small-caps-1.html greek-small-caps-1-ref.html +== fullwidth-1.html fullwidth-1-ref.html +== fullwidth-2.html fullwidth-2-ref.html diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 2fb181723497..5f7f90f23f58 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -259,6 +259,7 @@ CSS_KEY(flex, flex) CSS_KEY(flex-end, flex_end) CSS_KEY(flex-start, flex_start) CSS_KEY(forwards, forwards) +CSS_KEY(full-width, full_width) CSS_KEY(georgian, georgian) CSS_KEY(grad, grad) CSS_KEY(graytext, graytext) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index fc88f07b187f..07d224fcc388 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -1389,6 +1389,7 @@ const int32_t nsCSSProps::kTextTransformKTable[] = { eCSSKeyword_capitalize, NS_STYLE_TEXT_TRANSFORM_CAPITALIZE, eCSSKeyword_lowercase, NS_STYLE_TEXT_TRANSFORM_LOWERCASE, eCSSKeyword_uppercase, NS_STYLE_TEXT_TRANSFORM_UPPERCASE, + eCSSKeyword_full_width, NS_STYLE_TEXT_TRANSFORM_FULLWIDTH, eCSSKeyword_UNKNOWN,-1 }; diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 03db8796cd4b..8598dd90caa1 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -3172,7 +3172,7 @@ var gCSSProperties = { inherited: true, type: CSS_TYPE_LONGHAND, initial_values: [ "none" ], - other_values: [ "capitalize", "uppercase", "lowercase" ], + other_values: [ "capitalize", "uppercase", "lowercase", "full-width" ], invalid_values: [] }, "top": {