--- a/layout/reftests/w3c-css/import-tests.py
+++ b/layout/reftests/w3c-css/import-tests.py
@@ -45,16 +45,19 @@ gPrefixedProperties = [
"column-rule-color",
"column-rule-style",
"column-rule-width",
"columns",
"column-span",
"column-width"
]
+gPrefixRegexp = re.compile(
+ r"([^-#]|^)(" + r"|".join(gPrefixedProperties) + r")\b")
+
# Map of about:config prefs that need toggling, for a given test subdirectory.
# Entries should look like:
# "$SUBDIR_NAME": "pref($PREF_NAME, $PREF_VALUE)"
#
# For example, when "@supports" was behind a pref, gDefaultPreferences had:
# "css3-conditional": "pref(layout.css.supports-rule.enabled,true)"
gDefaultPreferences = {
}
@@ -129,17 +132,17 @@ def copy_file(test, srcfile, destname, i
gLog.write("Importing " + to_unix_path_sep(logname) +
" to " + to_unix_path_sep(destname) + "\n")
destfile = os.path.join(gDestPath, destname)
destdir = os.path.dirname(destfile)
if not os.path.exists(destdir):
os.makedirs(destdir)
if os.path.exists(destfile):
raise StandardError("file " + destfile + " already exists")
- copy_and_prefix(test, srcfile, destfile, gPrefixedProperties, isSupportFile)
+ copy_and_prefix(test, srcfile, destfile, isSupportFile)
def copy_support_files(test, dirname):
global gSrcPath
if dirname in support_dirs_mapped:
return
support_dirs_mapped.add(dirname)
support_dir = os.path.join(dirname, "support")
if not os.path.exists(support_dir):
@@ -237,37 +240,35 @@ AHEM_DECL_HTML = """<style type="text/cs
""" + AHEM_DECL_CONTENT + """
</style>
"""
AHEM_DECL_XML = """<style type="text/css"><![CDATA[
""" + AHEM_DECL_CONTENT + """
]]></style>
"""
-def copy_and_prefix(test, aSourceFileName, aDestFileName, aProps, isSupportFile=False):
- global gTestFlags
+def copy_and_prefix(test, aSourceFileName, aDestFileName, isSupportFile=False):
+ global gTestFlags, gPrefixRegexp
newFile = open(aDestFileName, 'wb')
unPrefixedFile = open(aSourceFileName, 'rb')
testName = aDestFileName[len(gDestPath)+1:]
ahemFontAdded = False
for line in unPrefixedFile:
replacementLine = line
searchRegex = "\s*<style\s*"
if not isSupportFile and not ahemFontAdded and 'ahem' in gTestFlags[test] and re.search(searchRegex, line):
# First put our ahem font declation before the first <style>
# element
template = AHEM_DECL_HTML if is_html(aDestFileName) else AHEM_DECL_XML
ahemPath = os.path.relpath(AHEM_FONT_PATH, os.path.dirname(aDestFileName))
newFile.write(template.format(to_unix_path_sep(ahemPath)))
ahemFontAdded = True
- for prop in aProps:
- replacementLine = re.sub(r"([^-#]|^)" + prop + r"\b", r"\1-moz-" + prop, replacementLine)
-
+ replacementLine = gPrefixRegexp.sub(r"\1-moz-\2", replacementLine)
newFile.write(replacementLine)
newFile.close()
unPrefixedFile.close()
def read_options():
global gArgs, gOptions
op = OptionParser()