author | Wes Kocher <wkocher@mozilla.com> |
Thu, 26 Feb 2015 23:35:25 -0800 | |
changeset 231118 | 68df163b1792131fe2541fdc70eae75895d48b2a |
parent 231117 | 351ff671a30106a8f4aea581997da1e5af2c44ba |
child 231119 | 138f4bb6fbde091b5ad82ed14b26e118255958d1 |
push id | 28344 |
push user | ryanvm@gmail.com |
push date | Fri, 27 Feb 2015 18:20:08 +0000 |
treeherder | mozilla-central@9dd9d1e5b43c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1107378 |
milestone | 39.0a1 |
backs out | 44144b89241487a8b89d3ceaf4a91856bc9060a5 5a8d5e8ff5241612e67fdbe3a952806a19153ba1 960037d0fc98f36d1ed9e8c47a03b677f4f5c778 23fb39cb0f9761b56d8207abc6aa431aa1addf43 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
b2g/installer/package-manifest.in | file | annotate | diff | comparison | revisions | |
browser/installer/package-manifest.in | file | annotate | diff | comparison | revisions | |
layout/style/CSSUnprefixingService.js | file | annotate | diff | comparison | revisions | |
layout/style/CSSUnprefixingService.manifest | file | annotate | diff | comparison | revisions | |
layout/style/moz.build | file | annotate | diff | comparison | revisions | |
layout/style/nsCSSParser.cpp | file | annotate | diff | comparison | revisions | |
layout/style/nsICSSUnprefixingService.idl | file | annotate | diff | comparison | revisions | |
layout/style/test/mochitest.ini | file | annotate | diff | comparison | revisions | |
layout/style/test/test_unprefixing_service.html | file | annotate | diff | comparison | revisions | |
mobile/android/installer/package-manifest.in | file | annotate | diff | comparison | revisions | |
modules/libpref/init/all.js | file | annotate | diff | comparison | revisions |
--- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -532,18 +532,16 @@ @BINPATH@/components/satchel.manifest @BINPATH@/components/nsFormAutoComplete.js @BINPATH@/components/nsFormHistory.js @BINPATH@/components/FormHistoryStartup.js @BINPATH@/components/nsInputListAutoComplete.js @BINPATH@/components/formautofill.manifest @BINPATH@/components/FormAutofillContentService.js @BINPATH@/components/FormAutofillStartup.js -@BINPATH@/components/CSSUnprefixingService.js -@BINPATH@/components/CSSUnprefixingService.manifest @BINPATH@/components/contentAreaDropListener.manifest @BINPATH@/components/contentAreaDropListener.js @BINPATH@/components/messageWakeupService.js @BINPATH@/components/messageWakeupService.manifest @BINPATH@/components/SettingsManager.js @BINPATH@/components/SettingsManager.manifest @BINPATH@/components/SettingsService.js @BINPATH@/components/SettingsService.manifest
--- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -471,18 +471,16 @@ @RESPATH@/components/satchel.manifest @RESPATH@/components/nsFormAutoComplete.js @RESPATH@/components/nsFormHistory.js @RESPATH@/components/FormHistoryStartup.js @RESPATH@/components/nsInputListAutoComplete.js @RESPATH@/components/formautofill.manifest @RESPATH@/components/FormAutofillContentService.js @RESPATH@/components/FormAutofillStartup.js -@RESPATH@/components/CSSUnprefixingService.js -@RESPATH@/components/CSSUnprefixingService.manifest @RESPATH@/components/contentAreaDropListener.manifest @RESPATH@/components/contentAreaDropListener.js @RESPATH@/browser/components/BrowserProfileMigrators.manifest @RESPATH@/browser/components/ProfileMigrator.js @RESPATH@/browser/components/ChromeProfileMigrator.js @RESPATH@/browser/components/FirefoxProfileMigrator.js #ifdef XP_WIN @RESPATH@/browser/components/IEProfileMigrator.js
deleted file mode 100644 --- a/layout/style/CSSUnprefixingService.js +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- / -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* Implementation of a service that converts certain vendor-prefixed CSS - properties to their unprefixed equivalents, for sites on a whitelist. */ -// XXXdholbert whitelist is coming in bug 1132743 - -"use strict"; - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -function CSSUnprefixingService() { -} - -CSSUnprefixingService.prototype = { - // Boilerplate: - classID: Components.ID("{f0729490-e15c-4a2f-a3fb-99e1cc946b42}"), - _xpcom_factory: XPCOMUtils.generateSingletonFactory(CSSUnprefixingService), - QueryInterface: XPCOMUtils.generateQI([Ci.nsICSSUnprefixingService]), - - // See documentation in nsICSSUnprefixingService.idl - generateUnprefixedDeclaration: function(aPropName, aRightHalfOfDecl, - aUnprefixedDecl /*out*/) { - - // Convert our input strings to lower-case, for easier string-matching. - // (NOTE: If we ever need to add support for unprefixing properties that - // have case-sensitive parts, then we should do these toLowerCase() - // conversions in a more targeted way, to avoid breaking those properties.) - aPropName = aPropName.toLowerCase(); - aRightHalfOfDecl = aRightHalfOfDecl.toLowerCase(); - - // We have several groups of supported properties: - // FIRST GROUP: Properties that can just be handled as aliases: - // ============================================================ - const propertiesThatAreJustAliases = { - "-webkit-background-size": "background-size", - "-webkit-box-flex": "flex-grow", - "-webkit-box-ordinal-group": "order", - "-webkit-box-sizing": "box-sizing", - "-webkit-transform": "transform", - }; - - let unprefixedPropName = propertiesThatAreJustAliases[aPropName]; - if (unprefixedPropName !== undefined) { - aUnprefixedDecl.value = unprefixedPropName + ":" + aRightHalfOfDecl; - return true; - } - - // SECOND GROUP: Properties that take a single keyword, where the - // unprefixed version takes a different (but analogous) set of keywords: - // ===================================================================== - const propertiesThatNeedKeywordMapping = { - "-webkit-box-align" : { - unprefixedPropName : "align-items", - valueMap : { - "start" : "flex-start", - "center" : "center", - "end" : "flex-end", - "baseline" : "baseline", - "stretch" : "stretch" - } - }, - "-webkit-box-orient" : { - unprefixedPropName : "flex-direction", - valueMap : { - "horizontal" : "row", - "inline-axis" : "row", - "vertical" : "column", - "block-axis" : "column" - } - }, - "-webkit-box-pack" : { - unprefixedPropName : "justify-content", - valueMap : { - "start" : "flex-start", - "center" : "center", - "end" : "flex-end", - "justify" : "space-between" - } - }, - }; - - let propInfo = propertiesThatNeedKeywordMapping[aPropName]; - if (typeof(propInfo) != "undefined") { - // Regexp for parsing the right half of a declaration, for keyword-valued - // properties. Divides the right half of the declaration into: - // 1) any leading whitespace - // 2) the property value (one or more alphabetical character or hyphen) - // 3) anything after that (e.g. "!important", ";") - // Then we can look up the appropriate unprefixed-property value for the - // value (part 2), and splice that together with the other parts and with - // the unprefixed property-name to make the final declaration. - const keywordValuedPropertyRegexp = /^(\s*)([a-z\-]+)(.*)/; - let parts = keywordValuedPropertyRegexp.exec(aRightHalfOfDecl); - if (!parts) { - // Failed to parse a keyword out of aRightHalfOfDecl. (It probably has - // no alphabetical characters.) - return false; - } - - let mappedKeyword = propInfo.valueMap[parts[2]]; - if (mappedKeyword === undefined) { - // We found a keyword in aRightHalfOfDecl, but we don't have a mapping - // to an equivalent keyword for the unprefixed version of the property. - return false; - } - - aUnprefixedDecl.value = propInfo.unprefixedPropName + ":" + - parts[1] + // any leading whitespace - mappedKeyword + - parts[3]; // any trailing text (e.g. !important, semicolon, etc) - - return true; - } - - // THIRD GROUP: Properties that may need arbitrary string-replacement: - // =================================================================== - const propertiesThatNeedStringReplacement = { - // "-webkit-transition" takes a multi-part value. If "-webkit-transform" - // appears as part of that value, replace it w/ "transform". - // And regardless, we unprefix the "-webkit-transition" property-name. - // (We could handle other prefixed properties in addition to 'transform' - // here, but in practice "-webkit-transform" is the main one that's - // likely to be transitioned & that we're concerned about supporting.) - "-webkit-transition": { - unprefixedPropName : "transition", - stringMap : { - "-webkit-transform" : "transform", - } - }, - }; - - propInfo = propertiesThatNeedStringReplacement[aPropName]; - if (typeof(propInfo) != "undefined") { - let newRightHalf = aRightHalfOfDecl; - for (let strToReplace in propInfo.stringMap) { - let replacement = propInfo.stringMap[strToReplace]; - newRightHalf = newRightHalf.replace(strToReplace, replacement, "g"); - } - aUnprefixedDecl.value = propInfo.unprefixedPropName + ":" + newRightHalf; - - return true; - } - - // No known mapping for property aPropName. - return false; - }, -}; - -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CSSUnprefixingService]);
deleted file mode 100644 --- a/layout/style/CSSUnprefixingService.manifest +++ /dev/null @@ -1,2 +0,0 @@ -component {f0729490-e15c-4a2f-a3fb-99e1cc946b42} CSSUnprefixingService.js -contract @mozilla.org/css-unprefixing-service;1 {f0729490-e15c-4a2f-a3fb-99e1cc946b42}
--- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -2,22 +2,16 @@ # vim: set filetype=python: # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. DIRS += ['xbl-marquee'] TEST_DIRS += ['test'] -XPIDL_SOURCES += [ - 'nsICSSUnprefixingService.idl', -] - -XPIDL_MODULE = 'layout_base' - EXPORTS += [ 'AnimationCommon.h', 'CounterStyleManager.h', 'nsAnimationManager.h', 'nsComputedDOMStylePropertyList.h', 'nsCSSAnonBoxes.h', 'nsCSSAnonBoxList.h', 'nsCSSCounterDescList.h', @@ -148,21 +142,16 @@ UNIFIED_SOURCES += [ # FontFaceSet.cpp needs to be built separately because it redefines LOG. # nsCSSRuleProcessor.cpp needs to be built separately because it uses plarena.h. SOURCES += [ 'FontFaceSet.cpp', 'nsCSSRuleProcessor.cpp', ] -EXTRA_COMPONENTS += [ - 'CSSUnprefixingService.js', - 'CSSUnprefixingService.manifest', -] - FAIL_ON_WARNINGS = True MSVC_ENABLE_PGO = True include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul'
--- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -33,17 +33,16 @@ #include "nsCSSPseudoClasses.h" #include "nsCSSPseudoElements.h" #include "nsNameSpaceManager.h" #include "nsXMLNameSpaceMap.h" #include "nsError.h" #include "nsIMediaList.h" #include "nsStyleUtil.h" #include "nsIPrincipal.h" -#include "nsICSSUnprefixingService.h" #include "prprf.h" #include "nsContentUtils.h" #include "nsAutoPtr.h" #include "CSSCalc.h" #include "nsMediaFeatures.h" #include "nsLayoutUtils.h" #include "mozilla/Preferences.h" #include "nsRuleData.h" @@ -52,17 +51,16 @@ #include "gfxFontFamilyList.h" using namespace mozilla; typedef nsCSSProps::KTableValue KTableValue; // pref-backed bool values (hooked up in nsCSSParser::Startup) static bool sOpentypeSVGEnabled; -static bool sUnprefixingServiceEnabled; const uint32_t nsCSSProps::kParserVariantTable[eCSSProperty_COUNT_no_shorthands] = { #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \ stylestruct_, stylestructoffset_, animtype_) \ parsevariant_, #define CSS_PROP_LIST_INCLUDE_LOGICAL #include "nsCSSPropList.h" @@ -413,113 +411,16 @@ protected: }; // the caller must hold on to aString until parsing is done void InitScanner(nsCSSScanner& aScanner, css::ErrorReporter& aReporter, nsIURI* aSheetURI, nsIURI* aBaseURI, nsIPrincipal* aSheetPrincipal); void ReleaseScanner(void); - - /** - * This is a RAII class which behaves like an "AutoRestore<>" for our parser - * input state. When instantiated, this class saves the current parser input - * state (in a CSSParserInputState object), and it restores the parser to - * that state when destructed, unless "DoNotRestore()" has been called. - */ - class MOZ_STACK_CLASS nsAutoCSSParserInputStateRestorer { - public: - explicit nsAutoCSSParserInputStateRestorer(CSSParserImpl* aParser - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : mParser(aParser), - mShouldRestore(true) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - mParser->SaveInputState(mSavedState); - } - - void DoNotRestore() - { - mShouldRestore = false; - } - - ~nsAutoCSSParserInputStateRestorer() - { - if (mShouldRestore) { - mParser->RestoreSavedInputState(mSavedState); - } - } - - private: - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER - CSSParserImpl* mParser; - CSSParserInputState mSavedState; - bool mShouldRestore; - }; - - /** - * This is a RAII class which creates a temporary nsCSSScanner for the given - * string, and reconfigures aParser to use *that* scanner instead of its - * existing scanner, until we go out of scope. (This allows us to rewrite - * a portion of a stylesheet using a temporary string, and switch to parsing - * that rewritten section, and then resume parsing the original stylesheet.) - * - * aParser must have a non-null nsCSSScanner (which we'll be temporarily - * replacing) and ErrorReporter (which this class will co-opt for the - * temporary parser). While we're in scope, we also suppress error reporting, - * so it doesn't really matter which reporter we use. We suppress reporting - * because this class is only used with CSS that is synthesized & didn't - * come directly from an author, and it would be confusing if we reported - * syntax errors for CSS that an author didn't provide. - * - * XXXdholbert we could also change this & report errors, if needed. Might - * want to customize the error reporting somehow though. - */ - class MOZ_STACK_CLASS nsAutoScannerChanger { - public: - nsAutoScannerChanger(CSSParserImpl* aParser, - const nsAString& aStringToScan - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : mParser(aParser), - mOriginalScanner(aParser->mScanner), - mStringScanner(aStringToScan, 0), - mParserStateRestorer(aParser), - mErrorSuppresser(aParser) - { - MOZ_ASSERT(mOriginalScanner, - "Shouldn't use nsAutoScannerChanger unless we already " - "have a scanner"); - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - - // Set & setup the new scanner: - mParser->mScanner = &mStringScanner; - mStringScanner.SetErrorReporter(mParser->mReporter); - - // We might've had push-back on our original scanner (and if we did, - // that fact is saved via mParserStateRestorer). But we don't have - // push-back in mStringScanner, so clear that flag. - mParser->mHavePushBack = false; - } - - ~nsAutoScannerChanger() - { - // Restore original scanner. All other cleanup is done by RAII members. - mParser->mScanner = mOriginalScanner; - } - - private: - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER - CSSParserImpl* mParser; - nsCSSScanner *mOriginalScanner; - nsCSSScanner mStringScanner; - nsAutoCSSParserInputStateRestorer mParserStateRestorer; - nsAutoSuppressErrors mErrorSuppresser; - }; - - bool IsSVGMode() const { return mScanner->IsSVGMode(); } /** * Saves the current input state, which includes any currently pushed * back token, and the current position of the scanner. */ @@ -699,49 +600,32 @@ protected: // If aStopChar is non-zero, the selector list is done when we hit // aStopChar. Otherwise, it's done when we hit EOF. bool ParseSelectorList(nsCSSSelectorList*& aListHead, char16_t aStopChar); bool ParseSelectorGroup(nsCSSSelectorList*& aListHead); bool ParseSelector(nsCSSSelectorList* aList, char16_t aPrevCombinator); enum { - eParseDeclaration_InBraces = 1 << 0, - eParseDeclaration_AllowImportant = 1 << 1, - // The declaration we're parsing was generated by the CSSUnprefixingService: - eParseDeclaration_FromUnprefixingSvc = 1 << 2 + eParseDeclaration_InBraces = 1 << 0, + eParseDeclaration_AllowImportant = 1 << 1 }; enum nsCSSContextType { eCSSContext_General, eCSSContext_Page }; css::Declaration* ParseDeclarationBlock(uint32_t aFlags, nsCSSContextType aContext = eCSSContext_General); bool ParseDeclaration(css::Declaration* aDeclaration, uint32_t aFlags, bool aMustCallValueAppended, bool* aChanged, nsCSSContextType aContext = eCSSContext_General); - // A "prefix-aware" wrapper for nsCSSKeywords::LookupKeyword(). - // Use this instead of LookupKeyword() if you might be parsing an unprefixed - // property (like "display") for which we emulate a vendor-prefixed value - // (like "-webkit-box"). - nsCSSKeyword LookupKeywordPrefixAware(nsAString& aKeywordStr, - const KTableValue aKeywordTable[]); - - bool ShouldUseUnprefixingService(); - bool ParsePropertyWithUnprefixingService(const nsAString& aPropertyName, - css::Declaration* aDeclaration, - uint32_t aFlags, - bool aMustCallValueAppended, - bool* aChanged, - nsCSSContextType aContext); - bool ParseProperty(nsCSSProperty aPropID); bool ParsePropertyByFunction(nsCSSProperty aPropID); bool ParseSingleValueProperty(nsCSSValue& aValue, nsCSSProperty aPropID); enum PriorityParsingStatus { ePriority_None, ePriority_Important, @@ -1197,22 +1081,16 @@ protected: // false. bool mInFailingSupportsRule : 1; // True if we will suppress all parse errors (except unexpected EOFs). // This is used to prevent errors for declarations inside a failing // @supports rule. bool mSuppressErrors : 1; - // True if we've parsed "display: -webkit-box" as "display: flex" in an - // earlier declaration within the current block of declarations, as part of - // emulating support for certain -webkit-prefixed properties on certain - // sites. - bool mDidUnprefixWebkitBoxInEarlierDecl; // not :1 so we can use AutoRestore - // Stack of rule groups; used for @media and such. InfallibleTArray<nsRefPtr<css::GroupRule> > mGroupStack; // During the parsing of a property (which may be a shorthand), the data // are stored in |mTempData|. (It is needed to ensure that parser // errors cause the data to be ignored, and to ensure that a // non-'!important' declaration does not override an '!important' // one.) @@ -1279,17 +1157,16 @@ CSSParserImpl::CSSParserImpl() mUnsafeRulesEnabled(false), mIsChromeOrCertifiedApp(false), mViewportUnitsEnabled(true), mHTMLMediaMode(false), mParsingCompoundProperty(false), mInSupportsCondition(false), mInFailingSupportsRule(false), mSuppressErrors(false), - mDidUnprefixWebkitBoxInEarlierDecl(false), mNextFree(nullptr) { } CSSParserImpl::~CSSParserImpl() { mData.AssertInitialState(); mTempData.AssertInitialState(); @@ -1508,20 +1385,16 @@ CSSParserImpl::ParseDeclarations(const n *aChanged = false; NS_PRECONDITION(aSheetPrincipal, "Must have principal here!"); nsCSSScanner scanner(aBuffer, 0); css::ErrorReporter reporter(scanner, mSheet, mChildLoader, aSheetURI); InitScanner(scanner, reporter, aSheetURI, aBaseURI, aSheetPrincipal); - MOZ_ASSERT(!mDidUnprefixWebkitBoxInEarlierDecl, - "Someone forgot to clear the 'did unprefix webkit-box' flag"); - AutoRestore<bool> autoRestore(mDidUnprefixWebkitBoxInEarlierDecl); - mSection = eCSSSection_General; mData.AssertInitialState(); aDeclaration->ClearData(); // We could check if it was already empty, but... *aChanged = true; for (;;) { @@ -6156,20 +6029,16 @@ CSSParserImpl::ParseSelector(nsCSSSelect return true; } css::Declaration* CSSParserImpl::ParseDeclarationBlock(uint32_t aFlags, nsCSSContextType aContext) { bool checkForBraces = (aFlags & eParseDeclaration_InBraces) != 0; - MOZ_ASSERT(!mDidUnprefixWebkitBoxInEarlierDecl, - "Someone forgot to clear the 'did unprefix webkit-box' flag"); - AutoRestore<bool> restorer(mDidUnprefixWebkitBoxInEarlierDecl); - if (checkForBraces) { if (!ExpectSymbol('{', true)) { REPORT_UNEXPECTED_TOKEN(PEBadDeclBlockStart); OUTPUT_ERROR(); return nullptr; } } css::Declaration* declaration = new css::Declaration(); @@ -6567,118 +6436,16 @@ CSSParserImpl::ParseTreePseudoElement(ns } } *aPseudoElementArgs = fakeSelector.mClassList; fakeSelector.mClassList = nullptr; return true; } #endif -nsCSSKeyword -CSSParserImpl::LookupKeywordPrefixAware(nsAString& aKeywordStr, - const KTableValue aKeywordTable[]) -{ - nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(aKeywordStr); - - if (aKeywordTable == nsCSSProps::kDisplayKTable) { - if (keyword == eCSSKeyword_UNKNOWN && - ShouldUseUnprefixingService() && - aKeywordStr.EqualsLiteral("-webkit-box")) { - // Treat "display: -webkit-box" as "display: flex". In simple scenarios, - // they largely behave the same, as long as we use the CSS Unprefixing - // Service to also translate the associated properties. - mDidUnprefixWebkitBoxInEarlierDecl = true; - return eCSSKeyword_flex; - } - - // If we've seen "display: -webkit-box" in an earlier declaration and we - // tried to unprefix it to emulate support for it, then we have to watch - // out for later "display: -moz-box" declarations; they're likely just a - // halfhearted attempt at compatibility, and they actually end up stomping - // on our emulation of the earlier -webkit-box display-value, via the CSS - // cascade. To prevent this problem, we also treat "display: -moz-box" as - // "display: flex" (but only if we unprefixed an earlier "-webkit-box"). - if (mDidUnprefixWebkitBoxInEarlierDecl && keyword == eCSSKeyword__moz_box) { - MOZ_ASSERT(ShouldUseUnprefixingService(), - "mDidUnprefixWebkitBoxInEarlierDecl should only be set if " - "we're using the unprefixing service on this site"); - return eCSSKeyword_flex; - } - } - - return keyword; -} - -bool -CSSParserImpl::ShouldUseUnprefixingService() -{ - if (!sUnprefixingServiceEnabled) { - return false; - } - - // XXXdholbert Bug 1132743: Check if stylesheet URI is on fixlist here. - return true; -} - -bool -CSSParserImpl::ParsePropertyWithUnprefixingService( - const nsAString& aPropertyName, - css::Declaration* aDeclaration, - uint32_t aFlags, - bool aMustCallValueAppended, - bool* aChanged, - nsCSSContextType aContext) -{ - MOZ_ASSERT(ShouldUseUnprefixingService(), - "Caller should've checked ShouldUseUnprefixingService()"); - - nsCOMPtr<nsICSSUnprefixingService> unprefixingSvc = - do_GetService(NS_CSSUNPREFIXINGSERVICE_CONTRACTID); - NS_ENSURE_TRUE(unprefixingSvc, false); - - // Save the state so we can jump back to this spot if our unprefixing fails - // (so we can behave as if we didn't even try to unprefix). - nsAutoCSSParserInputStateRestorer parserStateBeforeTryingToUnprefix(this); - - // Caller has already parsed the first half of the declaration -- - // aPropertyName and the ":". Now, we record the rest of the CSS declaration - // (the part after ':') into rightHalfOfDecl. (This is the property value, - // plus anything else up to the end of the declaration -- maybe "!important", - // maybe trailing junk characters, maybe a semicolon, maybe a trailing "}".) - bool checkForBraces = (aFlags & eParseDeclaration_InBraces) != 0; - nsAutoString rightHalfOfDecl; - mScanner->StartRecording(); - SkipDeclaration(checkForBraces); - mScanner->StopRecording(rightHalfOfDecl); - - // Try to unprefix: - bool success; - nsAutoString unprefixedDecl; - nsresult rv = - unprefixingSvc->GenerateUnprefixedDeclaration(aPropertyName, - rightHalfOfDecl, - unprefixedDecl, &success); - if (NS_FAILED(rv) || !success) { - return false; - } - - // Attempt to parse the unprefixed declaration: - nsAutoScannerChanger scannerChanger(this, unprefixedDecl); - success = ParseDeclaration(aDeclaration, - aFlags | eParseDeclaration_FromUnprefixingSvc, - aMustCallValueAppended, aChanged, aContext); - if (success) { - // We succeeded, so we'll leave the parser pointing at the end of - // the declaration; don't restore it to the pre-recording position. - parserStateBeforeTryingToUnprefix.DoNotRestore(); - } - - return success; -} - //---------------------------------------------------------------------- bool CSSParserImpl::ParseDeclaration(css::Declaration* aDeclaration, uint32_t aFlags, bool aMustCallValueAppended, bool* aChanged, nsCSSContextType aContext) @@ -6758,29 +6525,17 @@ CSSParserImpl::ParseDeclaration(css::Dec } else { // Map property name to its ID. propID = LookupEnabledProperty(propertyName); if (eCSSProperty_UNKNOWN == propID || eCSSPropertyExtra_variable == propID || (aContext == eCSSContext_Page && !nsCSSProps::PropHasFlags(propID, CSS_PROPERTY_APPLIES_TO_PAGE_RULE))) { // unknown property - if (NonMozillaVendorIdentifier(propertyName)) { - if (!mInSupportsCondition && - aContext == eCSSContext_General && - !(aFlags & eParseDeclaration_FromUnprefixingSvc) && // no recursion - ShouldUseUnprefixingService()) { - if (ParsePropertyWithUnprefixingService(propertyName, - aDeclaration, aFlags, - aMustCallValueAppended, - aChanged, aContext)) { - return true; - } - } - } else { + if (!NonMozillaVendorIdentifier(propertyName)) { REPORT_UNEXPECTED_P(PEUnknownProperty, propertyName); REPORT_UNEXPECTED(PEDeclDropped); OUTPUT_ERROR(); } return false; } // Then parse the property. if (!ParseProperty(propID)) { @@ -7141,19 +6896,17 @@ CSSParserImpl::ParseVariant(nsCSSValue& "VARIANT_IDENTIFIER_NO_INHERIT"); if (!GetToken(true)) { return false; } nsCSSToken* tk = &mToken; if (((aVariantMask & (VARIANT_AHK | VARIANT_NORMAL | VARIANT_NONE | VARIANT_ALL)) != 0) && (eCSSToken_Ident == tk->mType)) { - nsCSSKeyword keyword = LookupKeywordPrefixAware(tk->mIdent, - aKeywordTable); - + nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(tk->mIdent); if (eCSSKeyword_UNKNOWN < keyword) { // known keyword if ((aVariantMask & VARIANT_AUTO) != 0) { if (eCSSKeyword_auto == keyword) { aValue.SetAutoValue(); return true; } } if ((aVariantMask & VARIANT_INHERIT) != 0) { @@ -15302,18 +15055,16 @@ CSSParserImpl::IsValueValidForProperty(c static CSSParserImpl* gFreeList = nullptr; /* static */ void nsCSSParser::Startup() { Preferences::AddBoolVarCache(&sOpentypeSVGEnabled, "gfx.font_rendering.opentype_svg.enabled"); - Preferences::AddBoolVarCache(&sUnprefixingServiceEnabled, - "layout.css.unprefixing-service.enabled"); } nsCSSParser::nsCSSParser(mozilla::css::Loader* aLoader, CSSStyleSheet* aSheet) { CSSParserImpl *impl = gFreeList; if (impl) { gFreeList = impl->mNextFree;
deleted file mode 100644 --- a/layout/style/nsICSSUnprefixingService.idl +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* interface for a service that converts certain vendor-prefixed CSS properties - to their unprefixed equivalents */ - -#include "nsISupports.idl" - -[scriptable, uuid(927a5c60-0378-4bcb-a50d-99e6d1fe6063)] -interface nsICSSUnprefixingService : nsISupports -{ - /** - * This function helps to convert unsupported vendor-prefixed CSS into - * supported unprefixed CSS. Given a vendor-prefixed property name and a - * value (or e.g. value + trailing junk like " !important;}"), this function - * will attempt to produce an equivalent CSS declaration that uses a - * supported unprefixed CSS property. - * - * @param aPropName - * The vendor-prefixed property name. - * - * @param aRightHalfOfDecl - * Everything after the ":" in the CSS declaration. This includes - * the property's value, along with possibly some leading whitespace - * and trailing text like "!important", and possibly a ';' and/or - * '}' (along with any other bogus text the author happens to - * include before those, which will probably make the decl invalid). - * - * @param aUnprefixedDecl[out] - * The resulting unprefixed declaration, if we return true. - * - * @return true if we were able to unprefix -- i.e. if we were able to - * convert the property to a known unprefixed equivalent, and we also - * performed any known-to-be-necessary fixup on the value, and we put - * the result in aUnprefixedDecl. - * Otherwise, this function returns false. - */ - boolean generateUnprefixedDeclaration(in AString aPropName, - in AString aRightHalfOfDecl, - out AString aUnprefixedDecl); -}; - -%{C++ -#define NS_CSSUNPREFIXINGSERVICE_CONTRACTID \ - "@mozilla.org/css-unprefixing-service;1" -%}
--- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -218,17 +218,16 @@ skip-if = buildapp == 'b2g' || toolkit = [test_transitions_step_functions.html] [test_transitions_dynamic_changes.html] [test_transitions_bug537151.html] [test_unclosed_parentheses.html] [test_units_angle.html] [test_units_frequency.html] [test_units_length.html] [test_units_time.html] -[test_unprefixing_service.html] [test_value_cloning.html] skip-if = (toolkit == 'gonk' && debug) || toolkit == 'android' #bug 775227 #debug-only failure; timed out [test_value_computation.html] skip-if = (toolkit == 'gonk' && debug) || toolkit == 'android' #debug-only failure [test_value_storage.html] skip-if = (toolkit == 'gonk' && debug) #debug-only failure [test_variable_serialization_computed.html] [test_variable_serialization_specified.html]
deleted file mode 100644 --- a/layout/style/test/test_unprefixing_service.html +++ /dev/null @@ -1,240 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=1107378 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 1107378</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <script type="text/javascript" src="property_database.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1107378">Mozilla Bug 1107378</a> -<div id="display"> - <div id="content"> - </div> -</div> -<pre id="test"> -<script type="application/javascript;version=1.7"> -"use strict"; - -/** Test for the CSS Unprefixing Service (Bug 1107378) **/ - -function getComputedStyleWrapper(elem, prop) -{ - return window.getComputedStyle(elem, null).getPropertyValue(prop); -} - -const gTestcases = [ - { decl: "-webkit-box-flex:5", - targetPropName: "flex-grow", - targetPropVal: "5" }, - - /* If author happens to specify modern flexbox style after prefixed style, - make sure the modern stuff is preserved. */ - { decl: "-webkit-box-flex:4;flex-grow:6", - targetPropName: "flex-grow", - targetPropVal: "6" }, - - /* Tests for handling !important: */ - { decl: "-webkit-box-flex:3!important;", - targetPropName: "flex-grow", - targetPropVal: "3" }, - { decl: "-webkit-box-flex:2!important;flex-grow:1", - targetPropName: "flex-grow", - targetPropVal: "2" }, - - { decl: "-webkit-box-flex:1!important bogusText;", - targetPropName: "flex-grow" - /* invalid syntax --> no target prop-val. */ - }, - - // Make sure we handle weird capitalization in property & value, too: - { decl: "-WEBKIT-BoX-aLign: baSELine", - targetPropName: "align-items", - targetPropVal: "baseline" }, - - { decl: "display:-webkit-box", - targetPropName: "display", - targetPropVal: "flex" }, - - { decl: "display:-webkit-box; display:-moz-box;", - targetPropName: "display", - targetPropVal: "flex" }, - - { decl: "display:-webkit-foobar; display:-moz-box;", - targetPropName: "display", - targetPropVal: "-moz-box" }, - - // -webkit-box-align: baseline | center | end | start | stretch - // ...maps to: - // align-items: baseline | center | flex-end | flex-start | stretch - { decl: "-webkit-box-align: baseline", - targetPropName: "align-items", - targetPropVal: "baseline" }, - { decl: "-webkit-box-align: center", - targetPropName: "align-items", - targetPropVal: "center" }, - { decl: "-webkit-box-align: end", - targetPropName: "align-items", - targetPropVal: "flex-end" }, - { decl: "-webkit-box-align: start", - targetPropName: "align-items", - targetPropVal: "flex-start" }, - { decl: "-webkit-box-align: stretch", - targetPropName: "align-items", - targetPropVal: "stretch" }, - - // -webkit-box-direction is not supported, because it's unused & would be - // complicated to support. See note in CSSUnprefixingService.js for more. - - // -webkit-box-ordinal-group: <number> maps directly to "order". - { decl: "-webkit-box-ordinal-group: 2", - targetPropName: "order", - targetPropVal: "2" }, - { decl: "-webkit-box-ordinal-group: 6000", - targetPropName: "order", - targetPropVal: "6000" }, - - // -webkit-box-orient: horizontal | inline-axis | vertical | block-axis - // ...maps to: - // flex-direction: row | row | column | column - { decl: "-webkit-box-orient: horizontal", - targetPropName: "flex-direction", - targetPropVal: "row" }, - { decl: "-webkit-box-orient: inline-axis", - targetPropName: "flex-direction", - targetPropVal: "row" }, - { decl: "-webkit-box-orient: vertical", - targetPropName: "flex-direction", - targetPropVal: "column" }, - { decl: "-webkit-box-orient: block-axis", - targetPropName: "flex-direction", - targetPropVal: "column" }, - - // -webkit-box-pack: start | center | end | justify - // ... maps to: - // justify-content: flex-start | center | flex-end | space-between - { decl: "-webkit-box-pack: start", - targetPropName: "justify-content", - targetPropVal: "flex-start" }, - { decl: "-webkit-box-pack: center", - targetPropName: "justify-content", - targetPropVal: "center" }, - { decl: "-webkit-box-pack: end", - targetPropName: "justify-content", - targetPropVal: "flex-end" }, - { decl: "-webkit-box-pack: justify", - targetPropName: "justify-content", - targetPropVal: "space-between" }, - - // -webkit-transform: <transform> maps directly to "transform" - { decl: "-webkit-transform: matrix(1, 2, 3, 4, 5, 6)", - targetPropName: "transform", - targetPropVal: "matrix(1, 2, 3, 4, 5, 6)" }, - - // -webkit-transition: <property> maps directly to "transition" - { decl: "-webkit-transition: width 1s linear 2s", - targetPropName: "transition", - targetPropVal: "width 1s linear 2s" }, - - // -webkit-transition **with** -webkit-prefixed property in value. - { decl: "-webkit-transition: -webkit-transform 1s linear 2s", - targetPropName: "transition", - targetPropVal: "transform 1s linear 2s" }, - // (Re-test to check that it sets the "transition-property" subproperty.) - { decl: "-webkit-transition: -webkit-transform 1s linear 2s", - targetPropName: "transition-property", - targetPropVal: "transform" }, - - // Same as previous test, except with "-webkit-transform" in the - // middle of the value instead of at the beginning (still valid): - { decl: "-webkit-transition: 1s -webkit-transform linear 2s", - targetPropName: "transition", - targetPropVal: "transform 1s linear 2s" }, - { decl: "-webkit-transition: 1s -webkit-transform linear 2s", - targetPropName: "transition-property", - targetPropVal: "transform" }, -]; - -// The main test function. -// aFlexboxTestcase is an entry from the list in flexbox_layout_testcases.js -function runOneTest(aTestcase) -{ - let elem = document.getElementById("content"); - - let expectedValueInDOMStyle; - let expectedValueInComputedStyle; - if (typeof(aTestcase.targetPropVal) == 'undefined') { - expectedValueInDOMStyle = ''; - expectedValueInComputedStyle = // initial computed style: - getComputedStyleWrapper(elem, aTestcase.targetPropName); - } else { - expectedValueInDOMStyle = aTestcase.targetPropVal; - expectedValueInComputedStyle = aTestcase.targetPropVal; - } - - elem.setAttribute("style", aTestcase.decl); - - // Check specified style for fixup: - is(elem.style[aTestcase.targetPropName], expectedValueInDOMStyle, - "Checking if unprefixing service produced expected result " + - "in elem.style['" + aTestcase.targetPropName + "'] " + - "when given decl '" + aTestcase.decl + "'"); - - // Check computed style for fixup: - // (only for longhand properties; shorthands aren't in computed style) - if (gCSSProperties[aTestcase.targetPropName].type == CSS_TYPE_LONGHAND) { - let computedValue = getComputedStyleWrapper(elem, aTestcase.targetPropName); - is(computedValue, expectedValueInComputedStyle, - "Checking if unprefixing service produced expected result " + - "in computed value of property '" + aTestcase.targetPropName + "' " + - "when given decl '" + aTestcase.decl + "'"); - } - - elem.setAttribute("style", ""); -} - -function testWithUnprefixingDisabled() -{ - // Sanity-check that -webkit-prefixed properties are rejected, when - // pref is disabled: - let elem = document.getElementById("content"); - let initialFlexGrow = getComputedStyleWrapper(elem, "flex-grow"); - elem.setAttribute("style", "-webkit-box-flex:5"); - is(getComputedStyleWrapper(elem, "flex-grow"), initialFlexGrow, - "-webkit-box-flex shouldn't affect 'flex-grow' " + - "when unprefixing pref is disabled"); - - let initialDisplay = getComputedStyleWrapper(elem, "display"); - elem.setAttribute("style", "display:-webkit-box"); - is(getComputedStyleWrapper(elem, "display"), initialDisplay, - "-webkit-box-flex shouldn't affect 'display' " + - "when unprefixing pref is disabled"); -} - -function testWithUnprefixingEnabled() -{ - gTestcases.forEach(runOneTest); - SimpleTest.finish(); -} - -SimpleTest.waitForExplicitFinish(); - -// First, test with unprefixing disabled (by default for now): -testWithUnprefixingDisabled(); - -// ...and then test with it enabled. -// XXXdholbert in bug 1132743, we'll be restricting unprefixing to only happen -// on a "fixlist" of domains. We'll need to run this test from a predetermined -// fake mochitest-domain, and include that domain in the "fixlist". -SpecialPowers.pushPrefEnv( - { set: [["layout.css.unprefixing-service.enabled", true]] }, - testWithUnprefixingEnabled); - -</script> -</pre> -</body> -</html>
--- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -386,18 +386,16 @@ @BINPATH@/components/satchel.manifest @BINPATH@/components/nsFormAutoComplete.js @BINPATH@/components/nsFormHistory.js @BINPATH@/components/FormHistoryStartup.js @BINPATH@/components/nsInputListAutoComplete.js @BINPATH@/components/formautofill.manifest @BINPATH@/components/FormAutofillContentService.js @BINPATH@/components/FormAutofillStartup.js -@BINPATH@/components/CSSUnprefixingService.js -@BINPATH@/components/CSSUnprefixingService.manifest @BINPATH@/components/contentAreaDropListener.manifest @BINPATH@/components/contentAreaDropListener.js @BINPATH@/components/messageWakeupService.js @BINPATH@/components/messageWakeupService.manifest #ifdef MOZ_ENABLE_DBUS @BINPATH@/components/@DLL_PREFIX@dbusservice@DLL_SUFFIX@ #endif @BINPATH@/components/nsINIProcessor.manifest
--- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2149,20 +2149,16 @@ pref("layout.css.image-orientation.enabl // Are sets of prefixed properties supported? pref("layout.css.prefixes.border-image", true); pref("layout.css.prefixes.transforms", true); pref("layout.css.prefixes.transitions", true); pref("layout.css.prefixes.animations", true); pref("layout.css.prefixes.box-sizing", true); pref("layout.css.prefixes.font-features", true); -// Is the CSS Unprefixing Service enabled? (This service emulates support -// for certain vendor-prefixed properties & values, for sites on a "fixlist".) -pref("layout.css.unprefixing-service.enabled", false); - // Is support for the :scope selector enabled? 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 CSS vertical text enabled? pref("layout.css.vertical-text.enabled", false);