From 1efd222e54ef435b1459349ae90bdcdb42ee8a5d Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Thu, 27 Apr 2017 15:30:37 +0200 Subject: [PATCH] CSS: text-align: true -> text-align: unsafe; sizing problems with some form fields like --- dom/base/nsGkAtomList.h | 2 + layout/base/nsLayoutUtils.cpp | 110 ++++++++++++------ layout/base/nsLayoutUtils.h | 2 +- layout/forms/nsMeterFrame.cpp | 6 + layout/forms/nsMeterFrame.h | 2 + layout/forms/nsProgressFrame.cpp | 6 + layout/forms/nsProgressFrame.h | 2 + layout/reftests/bugs/reftest.list | 4 +- ...dth-percents-across-form-controls-ref.html | 97 +++++++++++++++ ...x-width-percents-across-form-controls.html | 97 +++++++++++++++ ...dth-percents-across-form-controls-ref.html | 97 +++++++++++++++ ...h-width-percents-across-form-controls.html | 97 +++++++++++++++ layout/reftests/css-sizing/reftest.list | 2 + layout/reftests/text/reftest.list | 2 +- ...ue-ref.html => text-align-unsafe-ref.html} | 4 +- ...align-true.html => text-align-unsafe.html} | 12 +- layout/style/nsCSSKeywordList.h | 2 +- layout/style/nsCSSParser.cpp | 8 +- layout/style/nsCSSProps.cpp | 4 +- layout/style/nsCSSProps.h | 2 +- layout/style/nsComputedDOMStyle.cpp | 2 +- layout/style/nsRuleNode.cpp | 4 +- layout/style/nsStyleConsts.h | 2 +- layout/style/test/property_database.js | 2 +- modules/libpref/init/all.js | 4 +- 25 files changed, 508 insertions(+), 64 deletions(-) create mode 100644 layout/reftests/css-sizing/min-intrinsic-with-max-width-percents-across-form-controls-ref.html create mode 100644 layout/reftests/css-sizing/min-intrinsic-with-max-width-percents-across-form-controls.html create mode 100644 layout/reftests/css-sizing/min-intrinsic-with-width-percents-across-form-controls-ref.html create mode 100644 layout/reftests/css-sizing/min-intrinsic-with-width-percents-across-form-controls.html rename layout/reftests/text/{text-align-true-ref.html => text-align-unsafe-ref.html} (95%) rename layout/reftests/text/{text-align-true.html => text-align-unsafe.html} (88%) diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h index 221fa863fc..b408012315 100644 --- a/dom/base/nsGkAtomList.h +++ b/dom/base/nsGkAtomList.h @@ -1926,6 +1926,7 @@ GK_ATOM(letterFrame, "LetterFrame") GK_ATOM(lineFrame, "LineFrame") GK_ATOM(listControlFrame,"ListControlFrame") GK_ATOM(menuFrame,"MenuFrame") +GK_ATOM(meterFrame, "MeterFrame") GK_ATOM(menuPopupFrame,"MenuPopupFrame") GK_ATOM(numberControlFrame, "NumberControlFrame") GK_ATOM(objectFrame, "ObjectFrame") @@ -1934,6 +1935,7 @@ GK_ATOM(pageBreakFrame, "PageBreakFrame") GK_ATOM(pageContentFrame, "PageContentFrame") GK_ATOM(placeholderFrame, "PlaceholderFrame") GK_ATOM(popupSetFrame, "PopupSetFrame") +GK_ATOM(progressFrame, "ProgressFrame") GK_ATOM(canvasFrame, "CanvasFrame") GK_ATOM(rangeFrame, "RangeFrame") GK_ATOM(rootFrame, "RootFrame") diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 4bffe0a758..c8ff2670f5 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -117,7 +117,7 @@ using namespace mozilla::gfx; #define RUBY_ENABLED_PREF_NAME "layout.css.ruby.enabled" #define STICKY_ENABLED_PREF_NAME "layout.css.sticky.enabled" #define DISPLAY_CONTENTS_ENABLED_PREF_NAME "layout.css.display-contents.enabled" -#define TEXT_ALIGN_TRUE_ENABLED_PREF_NAME "layout.css.text-align-true-value.enabled" +#define TEXT_ALIGN_UNSAFE_ENABLED_PREF_NAME "layout.css.text-align-unsafe-value.enabled" #ifdef DEBUG // TODO: remove, see bug 598468. @@ -328,41 +328,41 @@ DisplayContentsEnabledPrefChangeCallback(const char* aPrefName, void* aClosure) } } -// When the pref "layout.css.text-align-true-value.enabled" changes, this +// When the pref "layout.css.text-align-unsafe-value.enabled" changes, this // function is called to let us update kTextAlignKTable & kTextAlignLastKTable, -// to selectively disable or restore the entries for "true" in those tables. +// to selectively disable or restore the entries for "unsafe" in those tables. static void -TextAlignTrueEnabledPrefChangeCallback(const char* aPrefName, void* aClosure) +TextAlignUnsafeEnabledPrefChangeCallback(const char* aPrefName, void* aClosure) { - NS_ASSERTION(strcmp(aPrefName, TEXT_ALIGN_TRUE_ENABLED_PREF_NAME) == 0, - "Did you misspell " TEXT_ALIGN_TRUE_ENABLED_PREF_NAME " ?"); + NS_ASSERTION(strcmp(aPrefName, TEXT_ALIGN_UNSAFE_ENABLED_PREF_NAME) == 0, + "Did you misspell " TEXT_ALIGN_UNSAFE_ENABLED_PREF_NAME " ?"); static bool sIsInitialized; - static int32_t sIndexOfTrueInTextAlignTable; - static int32_t sIndexOfTrueInTextAlignLastTable; - bool isTextAlignTrueEnabled = - Preferences::GetBool(TEXT_ALIGN_TRUE_ENABLED_PREF_NAME, false); + static int32_t sIndexOfUnsafeInTextAlignTable; + static int32_t sIndexOfUnsafeInTextAlignLastTable; + bool isTextAlignUnsafeEnabled = + Preferences::GetBool(TEXT_ALIGN_UNSAFE_ENABLED_PREF_NAME, false); if (!sIsInitialized) { - // First run: find the position of "true" in kTextAlignKTable. - sIndexOfTrueInTextAlignTable = - nsCSSProps::FindIndexOfKeyword(eCSSKeyword_true, + // First run: find the position of "unsafe" in kTextAlignKTable. + sIndexOfUnsafeInTextAlignTable = + nsCSSProps::FindIndexOfKeyword(eCSSKeyword_unsafe, nsCSSProps::kTextAlignKTable); - // First run: find the position of "true" in kTextAlignLastKTable. - sIndexOfTrueInTextAlignLastTable = - nsCSSProps::FindIndexOfKeyword(eCSSKeyword_true, + // First run: find the position of "unsafe" in kTextAlignLastKTable. + sIndexOfUnsafeInTextAlignLastTable = + nsCSSProps::FindIndexOfKeyword(eCSSKeyword_unsafe, nsCSSProps::kTextAlignLastKTable); sIsInitialized = true; } - // OK -- now, stomp on or restore the "true" entry in the keyword tables, + // OK -- now, stomp on or restore the "unsafe" entry in the keyword tables, // depending on whether the pref is enabled vs. disabled. - MOZ_ASSERT(sIndexOfTrueInTextAlignTable >= 0); - nsCSSProps::kTextAlignKTable[sIndexOfTrueInTextAlignTable] = - isTextAlignTrueEnabled ? eCSSKeyword_true : eCSSKeyword_UNKNOWN; - MOZ_ASSERT(sIndexOfTrueInTextAlignLastTable >= 0); - nsCSSProps::kTextAlignLastKTable[sIndexOfTrueInTextAlignLastTable] = - isTextAlignTrueEnabled ? eCSSKeyword_true : eCSSKeyword_UNKNOWN; + MOZ_ASSERT(sIndexOfUnsafeInTextAlignTable >= 0); + nsCSSProps::kTextAlignKTable[sIndexOfUnsafeInTextAlignTable] = + isTextAlignUnsafeEnabled ? eCSSKeyword_unsafe : eCSSKeyword_UNKNOWN; + MOZ_ASSERT(sIndexOfUnsafeInTextAlignLastTable >= 0); + nsCSSProps::kTextAlignLastKTable[sIndexOfUnsafeInTextAlignLastTable] = + isTextAlignUnsafeEnabled ? eCSSKeyword_unsafe : eCSSKeyword_UNKNOWN; } static AnimationPlayerCollection* @@ -700,19 +700,18 @@ nsLayoutUtils::UnsetValueEnabled() } bool -nsLayoutUtils::IsTextAlignTrueValueEnabled() +nsLayoutUtils::IsTextAlignUnsafeValueEnabled() { - static bool sTextAlignTrueValueEnabled; - static bool sTextAlignTrueValueEnabledPrefCached = false; - - if (!sTextAlignTrueValueEnabledPrefCached) { - sTextAlignTrueValueEnabledPrefCached = true; - Preferences::AddBoolVarCache(&sTextAlignTrueValueEnabled, - TEXT_ALIGN_TRUE_ENABLED_PREF_NAME, + static bool sTextAlignUnsafeValueEnabled; + static bool sTextAlignUnsafeValueEnabledPrefCached = false; + if (!sTextAlignUnsafeValueEnabledPrefCached) { + sTextAlignUnsafeValueEnabledPrefCached = true; + Preferences::AddBoolVarCache(&sTextAlignUnsafeValueEnabled, + TEXT_ALIGN_UNSAFE_ENABLED_PREF_NAME, false); } - return sTextAlignTrueValueEnabled; + return sTextAlignUnsafeValueEnabled; } void @@ -4189,6 +4188,43 @@ GetIntrinsicCoord(const nsStyleCoord& aStyle, static int32_t gNoiseIndent = 0; #endif +// Return true for form controls whose minimum intrinsic inline-size +// shrinks to 0 when they have a percentage inline-size (but not +// percentage max-inline-size). (Proper replaced elements, whose +// intrinsic minimium inline-size shrinks to 0 for both percentage +// inline-size and percentage max-inline-size, are handled elsewhere.) +inline static bool +FormControlShrinksForPercentISize(nsIFrame* aFrame) +{ + if (!aFrame->IsFrameOfType(nsIFrame::eReplaced)) { + // Quick test to reject most frames. + return false; + } + + nsIAtom* fType = aFrame->GetType(); + if (fType == nsGkAtoms::meterFrame || fType == nsGkAtoms::progressFrame) { + // progress and meter do have this shrinking behavior + // FIXME: Maybe these should be nsIFormControlFrame? + return true; + } + + if (!static_cast(do_QueryFrame(aFrame))) { + // Not a form control. This includes fieldsets, which do not + // shrink. + return false; + } + + if (fType == nsGkAtoms::gfxButtonControlFrame || + fType == nsGkAtoms::HTMLButtonControlFrame) { + // Buttons don't have this shrinking behavior. (Note that color + // inputs do, even though they inherit from button, so we can't use + // do_QueryFrame here.) + return false; + } + + return true; +} + /* static */ nscoord nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext, nsIFrame *aFrame, @@ -4444,7 +4480,7 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext, (((styleISize.HasPercent() || styleMaxISize.HasPercent()) && aFrame->IsFrameOfType(nsIFrame::eReplacedSizing)) || (styleISize.HasPercent() && - aFrame->GetType() == nsGkAtoms::textInputFrame))) { + FormControlShrinksForPercentISize(aFrame)))) { // A percentage width or max-width on replaced elements means they // can shrink to 0. // This is also true for percentage widths (but not max-widths) on @@ -6989,14 +7025,14 @@ nsLayoutUtils::Initialize() Preferences::RegisterCallback(StickyEnabledPrefChangeCallback, STICKY_ENABLED_PREF_NAME); StickyEnabledPrefChangeCallback(STICKY_ENABLED_PREF_NAME, nullptr); - Preferences::RegisterCallback(TextAlignTrueEnabledPrefChangeCallback, - TEXT_ALIGN_TRUE_ENABLED_PREF_NAME); + Preferences::RegisterCallback(TextAlignUnsafeEnabledPrefChangeCallback, + TEXT_ALIGN_UNSAFE_ENABLED_PREF_NAME); Preferences::RegisterCallback(DisplayContentsEnabledPrefChangeCallback, DISPLAY_CONTENTS_ENABLED_PREF_NAME); DisplayContentsEnabledPrefChangeCallback(DISPLAY_CONTENTS_ENABLED_PREF_NAME, nullptr); - TextAlignTrueEnabledPrefChangeCallback(TEXT_ALIGN_TRUE_ENABLED_PREF_NAME, - nullptr); + TextAlignUnsafeEnabledPrefChangeCallback(TEXT_ALIGN_UNSAFE_ENABLED_PREF_NAME, + nullptr); nsComputedDOMStyle::RegisterPrefChangeCallbacks(); } diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 20248abb61..c3221e8f21 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2206,7 +2206,7 @@ public: * Checks whether support for the CSS text-align (and -moz-text-align-last) * 'true' value is enabled. */ - static bool IsTextAlignTrueValueEnabled(); + static bool IsTextAlignUnsafeValueEnabled(); /** * Checks if CSS variables are currently enabled. diff --git a/layout/forms/nsMeterFrame.cpp b/layout/forms/nsMeterFrame.cpp index e961e1802e..9c2ca76f5c 100644 --- a/layout/forms/nsMeterFrame.cpp +++ b/layout/forms/nsMeterFrame.cpp @@ -56,6 +56,12 @@ nsMeterFrame::DestroyFrom(nsIFrame* aDestructRoot) nsContainerFrame::DestroyFrom(aDestructRoot); } +nsIAtom* +nsMeterFrame::GetType() const +{ + return nsGkAtoms::meterFrame; +} + nsresult nsMeterFrame::CreateAnonymousContent(nsTArray& aElements) { diff --git a/layout/forms/nsMeterFrame.h b/layout/forms/nsMeterFrame.h index d7cc324705..985b3fd830 100644 --- a/layout/forms/nsMeterFrame.h +++ b/layout/forms/nsMeterFrame.h @@ -32,6 +32,8 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) override; + virtual nsIAtom* GetType() const override; + #ifdef DEBUG_FRAME_DUMP virtual nsresult GetFrameName(nsAString& aResult) const override { return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult); diff --git a/layout/forms/nsProgressFrame.cpp b/layout/forms/nsProgressFrame.cpp index 1fb010cfb2..cbb86f7bdd 100644 --- a/layout/forms/nsProgressFrame.cpp +++ b/layout/forms/nsProgressFrame.cpp @@ -55,6 +55,12 @@ nsProgressFrame::DestroyFrom(nsIFrame* aDestructRoot) nsContainerFrame::DestroyFrom(aDestructRoot); } +nsIAtom* +nsProgressFrame::GetType() const +{ + return nsGkAtoms::progressFrame; +} + nsresult nsProgressFrame::CreateAnonymousContent(nsTArray& aElements) { diff --git a/layout/forms/nsProgressFrame.h b/layout/forms/nsProgressFrame.h index e014ab00a0..0171303023 100644 --- a/layout/forms/nsProgressFrame.h +++ b/layout/forms/nsProgressFrame.h @@ -37,6 +37,8 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) override; + virtual nsIAtom* GetType() const override; + #ifdef DEBUG_FRAME_DUMP virtual nsresult GetFrameName(nsAString& aResult) const override { return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult); diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index cfa49867ec..cb024816ae 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -60,13 +60,13 @@ skip-if(B2G) == 28811-2a.html 28811-2-ref.html fuzzy-if(gtk2Widget,6,26200) == 28811-2b.html 28811-2-ref.html # Bug 1128229 == 40596-1a.html 40596-1-ref.html != 40596-1b.html 40596-1-ref.html -!= 40596-1c.html 40596-1-ref.html +== 40596-1c.html 40596-1-ref.html != 40596-1d.html 40596-1-ref.html != 40596-1e.html 40596-1-ref.html != 40596-1f.html 40596-1-ref.html != 40596-1g.html 40596-1-ref.html != 40596-1h.html 40596-1-ref.html -!= 40596-1i.html 40596-1-ref.html +== 40596-1i.html 40596-1-ref.html != 40596-1j.html 40596-1-ref.html == 50630-1a.html 50630-1-ref.html == 50630-1b.html 50630-1-ref.html diff --git a/layout/reftests/css-sizing/min-intrinsic-with-max-width-percents-across-form-controls-ref.html b/layout/reftests/css-sizing/min-intrinsic-with-max-width-percents-across-form-controls-ref.html new file mode 100644 index 0000000000..28bb9bd951 --- /dev/null +++ b/layout/reftests/css-sizing/min-intrinsic-with-max-width-percents-across-form-controls-ref.html @@ -0,0 +1,97 @@ + + +Tests for bug 823483 / bug 1247929 + + + + + +
input type="text"
+ + + + +
input type="button"
+ + + + +
button
+ + + + +
Fieldset
fieldset
+ + + + +
input type="file"
+ + + + +
input type="radio"
+ + + + +
input type="checkbox"
+ + + + +
input type="image"
+ + + + +
select
+ + + + +
select size="2"
+ + + + +
meter
+ + + + +
input type="number"
+ + + + +
progress
+ + + + +
input type="range"
+ + + + +
textarea
+ \ No newline at end of file diff --git a/layout/reftests/css-sizing/min-intrinsic-with-max-width-percents-across-form-controls.html b/layout/reftests/css-sizing/min-intrinsic-with-max-width-percents-across-form-controls.html new file mode 100644 index 0000000000..2539406fdb --- /dev/null +++ b/layout/reftests/css-sizing/min-intrinsic-with-max-width-percents-across-form-controls.html @@ -0,0 +1,97 @@ + + +Tests for bug 823483 / bug 1247929 + + + + + +
input type="text"
+ + + + +
input type="button"
+ + + + +
button
+ + + + +
Fieldset
fieldset
+ + + + +
input type="file"
+ + + + +
input type="radio"
+ + + + +
input type="checkbox"
+ + + + +
input type="image"
+ + + + +
select
+ + + + +
select size="2"
+ + + + +
meter
+ + + + +
input type="number"
+ + + + +
progress
+ + + + +
input type="range"
+ + + + +
textarea
+ \ No newline at end of file diff --git a/layout/reftests/css-sizing/min-intrinsic-with-width-percents-across-form-controls-ref.html b/layout/reftests/css-sizing/min-intrinsic-with-width-percents-across-form-controls-ref.html new file mode 100644 index 0000000000..32147133f5 --- /dev/null +++ b/layout/reftests/css-sizing/min-intrinsic-with-width-percents-across-form-controls-ref.html @@ -0,0 +1,97 @@ + + +Tests for bug 823483 / bug 1247929 + + + + + +
input type="text"
+ + + + +
input type="button"
+ + + + +
button
+ + + + +
Fieldset
fieldset
+ + + + +
input type="file"
+ + + + +
input type="radio"
+ + + + +
input type="checkbox"
+ + + + +
input type="image"
+ + + + +
select
+ + + + +
select size="2"
+ + + + +
meter
+ + + + +
input type="number"
+ + + + +
progress
+ + + + +
input type="range"
+ + + + +
textarea
+ \ No newline at end of file diff --git a/layout/reftests/css-sizing/min-intrinsic-with-width-percents-across-form-controls.html b/layout/reftests/css-sizing/min-intrinsic-with-width-percents-across-form-controls.html new file mode 100644 index 0000000000..856900aa5e --- /dev/null +++ b/layout/reftests/css-sizing/min-intrinsic-with-width-percents-across-form-controls.html @@ -0,0 +1,97 @@ + + +Tests for bug 823483 / bug 1247929 + + + + + +
input type="text"
+ + + + +
input type="button"
+ + + + +
button
+ + + + +
Fieldset
fieldset
+ + + + +
input type="file"
+ + + + +
input type="radio"
+ + + + +
input type="checkbox"
+ + + + +
input type="image"
+ + + + +
select
+ + + + +
select size="2"
+ + + + +
meter
+ + + + +
input type="number"
+ + + + +
progress
+ + + + +
input type="range"
+ + + + +
textarea
+ \ No newline at end of file diff --git a/layout/reftests/css-sizing/reftest.list b/layout/reftests/css-sizing/reftest.list index 5ffce29be3..87ee274319 100644 --- a/layout/reftests/css-sizing/reftest.list +++ b/layout/reftests/css-sizing/reftest.list @@ -1,2 +1,4 @@ == min-intrinsic-with-percents-across-img-cases.html min-intrinsic-with-percents-across-img-cases-ref.html == min-intrinsic-with-percents-across-elements.html min-intrinsic-with-percents-across-elements-ref.html +== min-intrinsic-with-max-width-percents-across-form-controls.html min-intrinsic-with-max-width-percents-across-form-controls-ref.html +== min-intrinsic-with-width-percents-across-form-controls.html min-intrinsic-with-width-percents-across-form-controls-ref.html diff --git a/layout/reftests/text/reftest.list b/layout/reftests/text/reftest.list index 4b673d2ec7..8070a074ea 100644 --- a/layout/reftests/text/reftest.list +++ b/layout/reftests/text/reftest.list @@ -300,7 +300,7 @@ fails-if(!cocoaWidget||OSX==1006||OSX==1007) != osx-font-smoothing.html osx-font fails-if(!cocoaWidget||OSX==1006||OSX==1007) != osx-font-smoothing-2.html osx-font-smoothing-2-notref.html == osx-font-smoothing-2.html osx-font-smoothing-2-ref.html -pref(layout.css.text-align-true-value.enabled,true) == text-align-true.html text-align-true-ref.html +pref(layout.css.text-align-unsafe-value.enabled,true) == text-align-unsafe.html text-align-unsafe-ref.html # stray control chars should not be invisible, bug 909344 != control-chars-01a.html control-chars-01-notref.html diff --git a/layout/reftests/text/text-align-true-ref.html b/layout/reftests/text/text-align-unsafe-ref.html similarity index 95% rename from layout/reftests/text/text-align-true-ref.html rename to layout/reftests/text/text-align-unsafe-ref.html index d928e87cfa..3a963ee29b 100644 --- a/layout/reftests/text/text-align-true-ref.html +++ b/layout/reftests/text/text-align-unsafe-ref.html @@ -1,7 +1,7 @@ - text-align-true + text-align-unsafe diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 8edfc05b75..09947b7642 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -551,12 +551,12 @@ CSS_KEY(translatey, translatey) CSS_KEY(translatez, translatez) CSS_KEY(transparent, transparent) // for nsComputedDOMStyle only CSS_KEY(tri-state, tri_state) -CSS_KEY(true, true) CSS_KEY(ultra-condensed, ultra_condensed) CSS_KEY(ultra-expanded, ultra_expanded) CSS_KEY(under, under) CSS_KEY(underline, underline) CSS_KEY(unicase, unicase) +CSS_KEY(unsafe, unsafe) CSS_KEY(unset, unset) CSS_KEY(uppercase, uppercase) CSS_KEY(upright, upright) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index b48cad90c5..28ef9d8d9b 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -12998,7 +12998,7 @@ CSSParserImpl::ParseTextAlign(nsCSSValue& aValue, const KTableValue aTable[]) return false; } - if (!nsLayoutUtils::IsTextAlignTrueValueEnabled()) { + if (!nsLayoutUtils::IsTextAlignUnsafeValueEnabled()) { aValue = left; return true; } @@ -13006,14 +13006,14 @@ CSSParserImpl::ParseTextAlign(nsCSSValue& aValue, const KTableValue aTable[]) nsCSSValue right; if (ParseVariant(right, VARIANT_KEYWORD, aTable)) { // 'true' must be combined with some other value than 'true'. - if (left.GetIntValue() == NS_STYLE_TEXT_ALIGN_TRUE && - right.GetIntValue() == NS_STYLE_TEXT_ALIGN_TRUE) { + if (left.GetIntValue() == NS_STYLE_TEXT_ALIGN_UNSAFE && + right.GetIntValue() == NS_STYLE_TEXT_ALIGN_UNSAFE) { return false; } aValue.SetPairValue(left, right); } else { // Single value 'true' is not allowed. - if (left.GetIntValue() == NS_STYLE_TEXT_ALIGN_TRUE) { + if (left.GetIntValue() == NS_STYLE_TEXT_ALIGN_UNSAFE) { return false; } aValue = left; diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index bf32af10bc..4445e6fb65 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -1671,7 +1671,7 @@ KTableValue nsCSSProps::kTextAlignKTable[] = { eCSSKeyword__moz_left, NS_STYLE_TEXT_ALIGN_MOZ_LEFT, eCSSKeyword_start, NS_STYLE_TEXT_ALIGN_DEFAULT, eCSSKeyword_end, NS_STYLE_TEXT_ALIGN_END, - eCSSKeyword_true, NS_STYLE_TEXT_ALIGN_TRUE, + eCSSKeyword_unsafe, NS_STYLE_TEXT_ALIGN_UNSAFE, eCSSKeyword_UNKNOWN,-1 }; @@ -1683,7 +1683,7 @@ KTableValue nsCSSProps::kTextAlignLastKTable[] = { eCSSKeyword_justify, NS_STYLE_TEXT_ALIGN_JUSTIFY, eCSSKeyword_start, NS_STYLE_TEXT_ALIGN_DEFAULT, eCSSKeyword_end, NS_STYLE_TEXT_ALIGN_END, - eCSSKeyword_true, NS_STYLE_TEXT_ALIGN_TRUE, + eCSSKeyword_unsafe, NS_STYLE_TEXT_ALIGN_UNSAFE, eCSSKeyword_UNKNOWN,-1 }; diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index cba62e9e6a..018bda8107 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -678,7 +678,7 @@ public: static const KTableValue kStackSizingKTable[]; static const KTableValue kTableLayoutKTable[]; // Not const because we modify its entries when the pref - // "layout.css.text-align-true-value.enabled" changes: + // "layout.css.text-align-unsafe-value.enabled" changes: static KTableValue kTextAlignKTable[]; static KTableValue kTextAlignLastKTable[]; static const KTableValue kTextCombineUprightKTable[]; diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index ce5a44ad5e..d1b16a563a 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -3124,7 +3124,7 @@ nsComputedDOMStyle::CreateTextAlignValue(uint8_t aAlign, bool aAlignTrue, } nsROCSSPrimitiveValue* first = new nsROCSSPrimitiveValue; - first->SetIdent(eCSSKeyword_true); + first->SetIdent(eCSSKeyword_unsafe); nsDOMCSSValueList* valueList = GetROCSSValueList(false); valueList->AppendCSSValue(first); diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 17919decd1..b37d860763 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -4189,7 +4189,7 @@ nsRuleNode::ComputeTextData(void* aStartStruct, const nsCSSValuePair& textAlignValuePair = textAlignValue->GetPairValue(); textAlignValue = &textAlignValuePair.mXValue; if (eCSSUnit_Enumerated == textAlignValue->GetUnit()) { - if (textAlignValue->GetIntValue() == NS_STYLE_TEXT_ALIGN_TRUE) { + if (textAlignValue->GetIntValue() == NS_STYLE_TEXT_ALIGN_UNSAFE) { textAlignValue = &textAlignValuePair.mYValue; } } else if (eCSSUnit_String == textAlignValue->GetUnit()) { @@ -4214,7 +4214,7 @@ nsRuleNode::ComputeTextData(void* aStartStruct, const nsCSSValuePair& textAlignLastValuePair = textAlignLastValue->GetPairValue(); textAlignLastValue = &textAlignLastValuePair.mXValue; if (eCSSUnit_Enumerated == textAlignLastValue->GetUnit()) { - if (textAlignLastValue->GetIntValue() == NS_STYLE_TEXT_ALIGN_TRUE) { + if (textAlignLastValue->GetIntValue() == NS_STYLE_TEXT_ALIGN_UNSAFE) { textAlignLastValue = &textAlignLastValuePair.mYValue; } } diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index f5e3ee5932..e6d194ca22 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -746,7 +746,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { // NS_STYLE_TEXT_ALIGN_MOZ_CENTER_OR_INHERIT is only used in data structs; it // is never present in stylesheets or computed data. #define NS_STYLE_TEXT_ALIGN_MOZ_CENTER_OR_INHERIT 11 -#define NS_STYLE_TEXT_ALIGN_TRUE 12 +#define NS_STYLE_TEXT_ALIGN_UNSAFE 12 // Note: make sure that the largest NS_STYLE_TEXT_ALIGN_* value is smaller than // the smallest NS_STYLE_VERTICAL_ALIGN_* value below! diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 1602092432..4ceb44f377 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -6466,7 +6466,7 @@ if (SpecialPowers.getBoolPref("layout.css.unset-value.enabled")) { if (SpecialPowers.getBoolPref("layout.css.filters.enabled")) { gCSSProperties["filter"].invalid_values.push("drop-shadow(unset, 2px 2px)", "drop-shadow(2px 2px, unset)"); } - if (SpecialPowers.getBoolPref("layout.css.text-align-true-value.enabled")) { + if (SpecialPowers.getBoolPref("layout.css.text-align-unsafe-value.enabled")) { gCSSProperties["text-align"].other_values.push("true left"); } else { gCSSProperties["text-align"].invalid_values.push("true left"); diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 896896edec..b0d33e46db 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2416,8 +2416,8 @@ pref("layout.css.unicode-range.enabled", true); pref("layout.css.unicode-range.enabled", false); #endif -// Is support for CSS "text-align: true X" enabled? -pref("layout.css.text-align-true-value.enabled", false); +// Is support for CSS "text-align: unsafe X" enabled? +pref("layout.css.text-align-unsafe-value.enabled", false); // Is support for the CSS4 image-orientation property enabled? pref("layout.css.image-orientation.enabled", true);