Merge pull request #4262 from yurydelendik/issue4257

Removes -moz-box-sizing usage
This commit is contained in:
Brendan Dahl 2014-02-24 12:47:27 -08:00
commit cc46cea7cb
3 changed files with 21 additions and 8 deletions

View File

@ -13,9 +13,8 @@
* limitations under the License.
*/
* { -moz-box-sizing: border-box; }
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}

View File

@ -101,17 +101,28 @@ function preprocess(inFilename, outFilename, defines) {
}
exports.preprocess = preprocess;
var deprecatedInMozcentral = new RegExp('(^|\\W)(' + [
'-moz-box-sizing',
'-moz-grab',
'-moz-grabbing'
].join('|') + ')');
function preprocessCSS(mode, source, destination) {
function hasPrefixed(line) {
function hasPrefixedFirefox(line) {
return (/(^|\W)-(ms|o|webkit)-\w/.test(line));
}
function removePrefixed(content) {
function hasPrefixedMozcentral(line) {
return (/(^|\W)-(ms|o|webkit)-\w/.test(line) ||
deprecatedInMozcentral.test(line));
}
function removePrefixed(content, hasPrefixedFilter) {
var lines = content.split(/\r?\n/g);
var i = 0;
while (i < lines.length) {
var line = lines[i];
if (!hasPrefixed(line)) {
if (!hasPrefixedFilter(line)) {
i++;
continue;
}
@ -151,12 +162,13 @@ function preprocessCSS(mode, source, destination) {
return lines.join('\n');
}
if (mode !== 'firefox') {
if (mode !== 'firefox' && mode !== 'mozcentral') {
throw new Error('Invalid CSS preprocessor mode');
}
var content = fs.readFileSync(source, 'utf8');
var out = removePrefixed(content);
var out = removePrefixed(content,
mode === 'mozcentral' ? hasPrefixedMozcentral : hasPrefixedFirefox);
fs.writeFileSync(destination, out);
}
exports.preprocessCSS = preprocessCSS;

View File

@ -613,7 +613,9 @@ target.mozcentral = function() {
[SRC_DIR + 'core/network.js', MOZCENTRAL_CONTENT_DIR]
],
preprocessCSS: [
['firefox', 'web/viewer.css', MOZCENTRAL_CONTENT_DIR + '/web/viewer.css']
['mozcentral',
'web/viewer.css',
MOZCENTRAL_CONTENT_DIR + '/web/viewer.css']
]
};
builder.build(setup);