From ff1d585b2e07c2c8e2038ac191bc1cc428517b1f Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Thu, 14 Apr 2016 08:57:57 +0200 Subject: [PATCH] Backed out changeset b68e6d1cf93a (bug 759568) for reftest failures --- layout/base/nsLayoutUtils.cpp | 38 ----------------------------- layout/style/Declaration.cpp | 16 +++++------- layout/style/nsCSSParser.cpp | 17 ++++++------- layout/style/nsCSSPropList.h | 2 +- layout/style/nsCSSProps.cpp | 19 +-------------- layout/style/nsCSSProps.h | 3 --- layout/style/nsComputedDOMStyle.cpp | 2 +- layout/style/nsStyleConsts.h | 4 +-- modules/libpref/init/all.js | 3 --- 9 files changed, 17 insertions(+), 87 deletions(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 16c69f86c943..af9769f4cb0e 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -146,7 +146,6 @@ using namespace mozilla::gfx; #define DISPLAY_CONTENTS_ENABLED_PREF_NAME "layout.css.display-contents.enabled" #define TEXT_ALIGN_UNSAFE_ENABLED_PREF_NAME "layout.css.text-align-unsafe-value.enabled" #define FLOAT_LOGICAL_VALUES_ENABLED_PREF_NAME "layout.css.float-logical-values.enabled" -#define BG_CLIP_TEXT_ENABLED_PREF_NAME "layout.css.background-clip-text.enabled" #ifdef DEBUG // TODO: remove, see bug 598468. @@ -393,39 +392,6 @@ FloatLogicalValuesEnabledPrefChangeCallback(const char* aPrefName, isFloatLogicalValuesEnabled ? eCSSKeyword_inline_end : eCSSKeyword_UNKNOWN; } - -// When the pref "layout.css.background-clip-text.enabled" changes, this -// function is invoked to let us update kBackgroundClipKTable, to selectively -// disable or restore the entries for "text" in that table. -static void -BackgroundClipTextEnabledPrefChangeCallback(const char* aPrefName, - void* aClosure) -{ - NS_ASSERTION(strcmp(aPrefName, BG_CLIP_TEXT_ENABLED_PREF_NAME) == 0, - "Did you misspell " BG_CLIP_TEXT_ENABLED_PREF_NAME " ?"); - - static bool sIsBGClipKeywordIndexInitialized; - static int32_t sIndexOfTextInBGClipTable; - bool isBGClipTextEnabled = - Preferences::GetBool(BG_CLIP_TEXT_ENABLED_PREF_NAME, false); - - if (!sIsBGClipKeywordIndexInitialized) { - // First run: find the position of "text" in kBackgroundClipKTable. - sIndexOfTextInBGClipTable = - nsCSSProps::FindIndexOfKeyword(eCSSKeyword_text, - nsCSSProps::kBackgroundClipKTable); - - sIsBGClipKeywordIndexInitialized = true; - } - - // OK -- now, stomp on or restore the "text" entry in kBackgroundClipKTable, - // depending on whether the pref is enabled vs. disabled. - if (sIndexOfTextInBGClipTable >= 0) { - nsCSSProps::kBackgroundClipKTable[sIndexOfTextInBGClipTable].mKeyword = - isBGClipTextEnabled ? eCSSKeyword_text : eCSSKeyword_UNKNOWN; - } -} - template static bool HasMatchingCurrentAnimations(const nsIFrame* aFrame, TestType&& aTest) @@ -7681,10 +7647,6 @@ nsLayoutUtils::Initialize() FLOAT_LOGICAL_VALUES_ENABLED_PREF_NAME); FloatLogicalValuesEnabledPrefChangeCallback(FLOAT_LOGICAL_VALUES_ENABLED_PREF_NAME, nullptr); - Preferences::RegisterCallback(BackgroundClipTextEnabledPrefChangeCallback, - BG_CLIP_TEXT_ENABLED_PREF_NAME); - BackgroundClipTextEnabledPrefChangeCallback(BG_CLIP_TEXT_ENABLED_PREF_NAME, - nullptr); nsComputedDOMStyle::RegisterPrefChangeCallbacks(); } diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index 848f2e353a92..5dea92b0af28 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -295,16 +295,12 @@ Declaration::GetImageLayerValue( if (clip->mValue.GetIntValue() != NS_STYLE_IMAGELAYER_CLIP_BORDER || origin->mValue.GetIntValue() != NS_STYLE_IMAGELAYER_ORIGIN_PADDING) { -#ifdef DEBUG - for (size_t i = 0; nsCSSProps::kImageLayerOriginKTable[i].mValue != -1; i++) { - // For each keyword & value in kOriginKTable, ensure that - // kBackgroundKTable has a matching entry at the same position. - MOZ_ASSERT(nsCSSProps::kImageLayerOriginKTable[i].mKeyword == - nsCSSProps::kBackgroundClipKTable[i].mKeyword); - MOZ_ASSERT(nsCSSProps::kImageLayerOriginKTable[i].mValue == - nsCSSProps::kBackgroundClipKTable[i].mValue); - } -#endif + MOZ_ASSERT(nsCSSProps::kKeywordTableTable[ + aTable[nsStyleImageLayers::origin]] == + nsCSSProps::kImageLayerOriginKTable); + MOZ_ASSERT(nsCSSProps::kKeywordTableTable[ + aTable[nsStyleImageLayers::clip]] == + nsCSSProps::kImageLayerOriginKTable); static_assert(NS_STYLE_IMAGELAYER_CLIP_BORDER == NS_STYLE_IMAGELAYER_ORIGIN_BORDER && NS_STYLE_IMAGELAYER_CLIP_PADDING == diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index ddc2e3874f5b..a3f15d81d8e1 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -12063,16 +12063,13 @@ CSSParserImpl::ParseImageLayersItem( // The spec allows a second box value (for background-clip), // immediately following the first one (for background-origin). -#ifdef DEBUG - for (size_t i = 0; nsCSSProps::kImageLayerOriginKTable[i].mValue != -1; i++) { - // For each keyword & value in kOriginKTable, ensure that - // kBackgroundKTable has a matching entry at the same position. - MOZ_ASSERT(nsCSSProps::kImageLayerOriginKTable[i].mKeyword == - nsCSSProps::kBackgroundClipKTable[i].mKeyword); - MOZ_ASSERT(nsCSSProps::kImageLayerOriginKTable[i].mValue == - nsCSSProps::kBackgroundClipKTable[i].mValue); - } -#endif + // 'background-clip' and 'background-origin' use the same keyword table + MOZ_ASSERT(nsCSSProps::kKeywordTableTable[ + aTable[nsStyleImageLayers::origin]] == + nsCSSProps::kImageLayerOriginKTable); + MOZ_ASSERT(nsCSSProps::kKeywordTableTable[ + aTable[nsStyleImageLayers::clip]] == + nsCSSProps::kImageLayerOriginKTable); static_assert(NS_STYLE_IMAGELAYER_CLIP_BORDER == NS_STYLE_IMAGELAYER_ORIGIN_BORDER && NS_STYLE_IMAGELAYER_CLIP_PADDING == diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index ed1283939441..f141ffba1e81 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -564,7 +564,7 @@ CSS_PROP_BACKGROUND( CSS_PROPERTY_VALUE_LIST_USES_COMMAS, "", VARIANT_KEYWORD, // used by list parsing - kBackgroundClipKTable, + kImageLayerOriginKTable, CSS_PROP_NO_OFFSET, eStyleAnimType_None) CSS_PROP_BACKGROUND( diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 65ef3ad42ecb..fe2b5be73dd6 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -890,9 +890,7 @@ const KTableEntry nsCSSProps::kImageLayerAttachmentKTable[] = { static_assert(NS_STYLE_IMAGELAYER_CLIP_BORDER == NS_STYLE_IMAGELAYER_ORIGIN_BORDER && NS_STYLE_IMAGELAYER_CLIP_PADDING == NS_STYLE_IMAGELAYER_ORIGIN_PADDING && NS_STYLE_IMAGELAYER_CLIP_CONTENT == NS_STYLE_IMAGELAYER_ORIGIN_CONTENT, - "Except background-clip:text, all {background,mask}-clip and " - "{background,mask}-origin style constants must agree"); - + "bg-clip and bg-origin style constants must agree"); const KTableEntry nsCSSProps::kImageLayerOriginKTable[] = { { eCSSKeyword_border_box, NS_STYLE_IMAGELAYER_ORIGIN_BORDER }, { eCSSKeyword_padding_box, NS_STYLE_IMAGELAYER_ORIGIN_PADDING }, @@ -900,21 +898,6 @@ const KTableEntry nsCSSProps::kImageLayerOriginKTable[] = { { eCSSKeyword_UNKNOWN, -1 } }; -KTableEntry nsCSSProps::kBackgroundClipKTable[] = { - { eCSSKeyword_border_box, NS_STYLE_IMAGELAYER_CLIP_BORDER }, - { eCSSKeyword_padding_box, NS_STYLE_IMAGELAYER_CLIP_PADDING }, - { eCSSKeyword_content_box, NS_STYLE_IMAGELAYER_CLIP_CONTENT }, - // The next entry is controlled by the layout.css.background-clip-text.enabled - // pref. - { eCSSKeyword_text, NS_STYLE_IMAGELAYER_CLIP_TEXT }, - { eCSSKeyword_UNKNOWN, -1 } -}; - -static_assert(ArrayLength(nsCSSProps::kImageLayerOriginKTable) == - ArrayLength(nsCSSProps::kBackgroundClipKTable) - 1, - "background-clip has one extra value, which is text, compared" - "to {background,mask}-origin"); - // Note: Don't change this table unless you update // ParseImageLayerPosition! diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index f928407346e6..7f22b1a90dd0 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -678,9 +678,6 @@ public: static const KTableEntry kImageLayerSizeKTable[]; static const KTableEntry kImageLayerCompositeKTable[]; static const KTableEntry kImageLayerModeKTable[]; - // Not const because we modify its entries when the pref - // "layout.css.background-clip.text" changes: - static KTableEntry kBackgroundClipKTable[]; static const KTableEntry kBlendModeKTable[]; static const KTableEntry kBorderCollapseKTable[]; static const KTableEntry kBorderColorKTable[]; diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 1663e9e96534..7a787d14bd62 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -1845,7 +1845,7 @@ nsComputedDOMStyle::DoGetBackgroundClip() return GetBackgroundList(&nsStyleImageLayers::Layer::mClip, &nsStyleImageLayers::mClipCount, StyleBackground()->mImage, - nsCSSProps::kBackgroundClipKTable); + nsCSSProps::kImageLayerOriginKTable); } already_AddRefed diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index 9941edf07250..c684007b9bd9 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -267,12 +267,10 @@ enum class FillMode : uint32_t; #define NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL 2 // See nsStyleImageLayers -// Code depends on these constants having the same values as IMAGELAYER_ORIGIN_* +// Code depends on these constants having the same values as BG_ORIGIN_* #define NS_STYLE_IMAGELAYER_CLIP_BORDER 0 #define NS_STYLE_IMAGELAYER_CLIP_PADDING 1 #define NS_STYLE_IMAGELAYER_CLIP_CONTENT 2 -// One extra constant which does not exist in IMAGELAYER_ORIGIN_* -#define NS_STYLE_IMAGELAYER_CLIP_TEXT 3 // A magic value that we use for our "pretend that background-clip is // 'padding' when we have a solid border" optimization. This isn't diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 92af54319eff..84db5c53e83e 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2421,9 +2421,6 @@ pref("layout.css.scope-pseudo.enabled", true); // Is support for background-blend-mode enabled? pref("layout.css.background-blend-mode.enabled", true); -// Is support for background-clip:text enabled? (bug 1263516) -pref("layout.css.background-clip-text.enabled", false); - // Is support for CSS vertical text enabled? pref("layout.css.vertical-text.enabled", true);