Bug 947588. Part 1: Add "-moz-control-character-visibility" property to the style system. r=heycam

Ideally we'd make this property inaccessible to Web content style sheets, but
that seems hard since view-source and plain text documents seem to load in a
context that's very similar to Web content as far as the style system is
concerned. It doesn't matter much since it's quite safe and unlikely to be
discovered or used by anyone.

--HG--
extra : rebase_source : 009aafc992afd07fd76a9026afe0f6994b4b214a
This commit is contained in:
Robert O'Callahan 2014-02-05 23:08:48 +13:00
Родитель 990a62a851
Коммит 21f9cc6065
8 изменённых файлов: 37 добавлений и 1 удалений

Просмотреть файл

@ -1534,6 +1534,18 @@ CSS_PROP_CONTENT(
kContentKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_TEXT(
-moz-control-character-visibility,
_moz_control_character_visibility,
CSS_PROP_DOMPROP_PREFIXED(ControlCharacterVisibility),
CSS_PROPERTY_PARSE_VALUE,
"",
VARIANT_HK,
kControlCharacterVisibilityKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
#endif
CSS_PROP_CONTENT(
counter-increment,
counter_increment,

Просмотреть файл

@ -914,6 +914,12 @@ const KTableValue nsCSSProps::kContentKTable[] = {
eCSSKeyword_UNKNOWN,-1
};
const KTableValue nsCSSProps::kControlCharacterVisibilityKTable[] = {
eCSSKeyword_hidden, NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN,
eCSSKeyword_visible, NS_STYLE_CONTROL_CHARACTER_VISIBILITY_VISIBLE,
eCSSKeyword_UNKNOWN,-1
};
const KTableValue nsCSSProps::kCursorKTable[] = {
// CSS 2.0
eCSSKeyword_auto, NS_STYLE_CURSOR_AUTO,

Просмотреть файл

@ -491,6 +491,7 @@ public:
static const KTableValue kClearKTable[];
static const KTableValue kColorKTable[];
static const KTableValue kContentKTable[];
static const KTableValue kControlCharacterVisibilityKTable[];
static const KTableValue kCursorKTable[];
static const KTableValue kDirectionKTable[];
static const KTableValue kDisplayKTable[];

Просмотреть файл

@ -4219,6 +4219,14 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
NS_STYLE_TEXT_SIZE_ADJUST_NONE, // none value
0, 0);
// -moz-text-discard: enum, inherit, initial
SetDiscrete(*aRuleData->ValueForControlCharacterVisibility(),
text->mControlCharacterVisibility,
canStoreInRuleTree,
SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
parentText->mControlCharacterVisibility,
NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN, 0, 0, 0, 0);
// text-orientation: enum, inherit, initial
SetDiscrete(*aRuleData->ValueForTextOrientation(), text->mTextOrientation,
canStoreInRuleTree,

Просмотреть файл

@ -1025,6 +1025,10 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#define NS_STYLE_BLEND_COLOR 14
#define NS_STYLE_BLEND_LUMINOSITY 15
// See nsStyleText::mControlCharacterVisibility
#define NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN 0
#define NS_STYLE_CONTROL_CHARACTER_VISIBILITY_VISIBLE 1
/*****************************************************************************
* Constants for media features. *
*****************************************************************************/

Просмотреть файл

@ -2970,6 +2970,7 @@ nsStyleText::nsStyleText(void)
mTextSizeAdjust = NS_STYLE_TEXT_SIZE_ADJUST_AUTO;
mTextOrientation = NS_STYLE_TEXT_ORIENTATION_AUTO;
mTextCombineHorizontal = NS_STYLE_TEXT_COMBINE_HORIZ_NONE;
mControlCharacterVisibility = NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN;
mLetterSpacing.SetNormalValue();
mLineHeight.SetNormalValue();
@ -2993,6 +2994,7 @@ nsStyleText::nsStyleText(const nsStyleText& aSource)
mTextSizeAdjust(aSource.mTextSizeAdjust),
mTextOrientation(aSource.mTextOrientation),
mTextCombineHorizontal(aSource.mTextCombineHorizontal),
mControlCharacterVisibility(aSource.mControlCharacterVisibility),
mTabSize(aSource.mTabSize),
mWordSpacing(aSource.mWordSpacing),
mLetterSpacing(aSource.mLetterSpacing),
@ -3016,7 +3018,8 @@ nsChangeHint nsStyleText::CalcDifference(const nsStyleText& aOther) const
return NS_STYLE_HINT_FRAMECHANGE;
}
if (mTextCombineHorizontal != aOther.mTextCombineHorizontal) {
if (mTextCombineHorizontal != aOther.mTextCombineHorizontal ||
mControlCharacterVisibility != aOther.mControlCharacterVisibility) {
return nsChangeHint_ReconstructFrame;
}

Просмотреть файл

@ -1395,6 +1395,7 @@ struct nsStyleText {
uint8_t mTextSizeAdjust; // [inherited] see nsStyleConsts.h
uint8_t mTextOrientation; // [inherited] see nsStyleConsts.h
uint8_t mTextCombineHorizontal; // [inherited] see nsStyleConsts.h
uint8_t mControlCharacterVisibility; // [inherited] see nsStyleConsts.h
int32_t mTabSize; // [inherited] see nsStyleConsts.h
nscoord mWordSpacing; // [inherited]

Просмотреть файл

@ -144,6 +144,7 @@ const char *gInaccessibleProperties[] = {
"padding-left-rtl-source",
"padding-right-ltr-source",
"padding-right-rtl-source",
"-moz-control-character-visibility",
"-moz-script-level", // parsed by UA sheets only
"-moz-script-size-multiplier",
"-moz-script-min-size",