Skip to content

Commit

Permalink
Merge pull request #9629 from wojtekmaj/add-autoprefixer
Browse files Browse the repository at this point in the history
Implement autoprefixer
  • Loading branch information
timvandermeij authored Apr 8, 2018
2 parents a7a034d + 69e9fe2 commit 1a634f9
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 140 deletions.
23 changes: 23 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

'use strict';

var autoprefixer = require('autoprefixer');
var fancylog = require('fancy-log');
var fs = require('fs');
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var rename = require('gulp-rename');
var replace = require('gulp-replace');
var transform = require('gulp-transform');
Expand Down Expand Up @@ -69,6 +71,20 @@ var builder = require('./external/builder/builder.js');
var CONFIG_FILE = 'pdfjs.config';
var config = JSON.parse(fs.readFileSync(CONFIG_FILE).toString());

// Default Autoprefixer config used for generic, components, minifed-pre
var AUTOPREFIXER_CONFIG = {
browsers: [
'last 2 versions',
'Chrome >= 49', // Last supported on Windows XP
'Firefox >= 52', // Last supported on Windows XP
'Firefox ESR',
'IE >= 11',
'Safari >= 8',
'> 0.5%',
'not dead',
],
};

var DEFINES = {
PRODUCTION: true,
// The main build targets:
Expand Down Expand Up @@ -577,6 +593,7 @@ gulp.task('generic', ['buildnumber', 'locale'], function () {
preprocessHTML('web/viewer.html', defines)
.pipe(gulp.dest(GENERIC_DIR + 'web')),
preprocessCSS('web/viewer.css', 'generic', defines, true)
.pipe(postcss([autoprefixer(AUTOPREFIXER_CONFIG)]))
.pipe(gulp.dest(GENERIC_DIR + 'web')),

gulp.src('web/compressed.tracemonkey-pldi-09.pdf')
Expand All @@ -602,6 +619,7 @@ gulp.task('components', ['buildnumber'], function () {
createComponentsBundle(defines).pipe(gulp.dest(COMPONENTS_DIR)),
gulp.src(COMPONENTS_IMAGES).pipe(gulp.dest(COMPONENTS_DIR + 'images')),
preprocessCSS('web/pdf_viewer.css', 'components', defines, true)
.pipe(postcss([autoprefixer(AUTOPREFIXER_CONFIG)]))
.pipe(gulp.dest(COMPONENTS_DIR)),
]);
});
Expand Down Expand Up @@ -629,6 +647,7 @@ gulp.task('minified-pre', ['buildnumber', 'locale'], function () {
preprocessHTML('web/viewer.html', defines)
.pipe(gulp.dest(MINIFIED_DIR + 'web')),
preprocessCSS('web/viewer.css', 'minified', defines, true)
.pipe(postcss([autoprefixer(AUTOPREFIXER_CONFIG)]))
.pipe(gulp.dest(MINIFIED_DIR + 'web')),

gulp.src('web/compressed.tracemonkey-pldi-09.pdf')
Expand Down Expand Up @@ -719,6 +738,9 @@ gulp.task('mozcentral-pre', ['buildnumber', 'locale'], function () {
preprocessHTML('web/viewer.html', defines)
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web')),
preprocessCSS('web/viewer.css', 'mozcentral', defines, true)
.pipe(postcss([
autoprefixer({ browsers: ['last 1 firefox versions'], })
]))
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web')),

gulp.src(FIREFOX_EXTENSION_DIR + 'locale/en-US/*.properties')
Expand Down Expand Up @@ -766,6 +788,7 @@ gulp.task('chromium-pre', ['buildnumber', 'locale'], function () {
preprocessHTML('web/viewer.html', defines)
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
preprocessCSS('web/viewer.css', 'chrome', defines, true)
.pipe(postcss([autoprefixer({ browsers: ['chrome >= 49'], })]))
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),

gulp.src('LICENSE').pipe(gulp.dest(CHROME_BUILD_DIR)),
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "2.0.0",
"devDependencies": {
"acorn": "^5.5.3",
"autoprefixer": "^8.2.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
Expand All @@ -14,6 +15,7 @@
"eslint-plugin-no-unsanitized": "^3.0.0",
"fancy-log": "^1.3.2",
"gulp": "^3.9.1",
"gulp-postcss": "^7.0.1",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.6.1",
"gulp-transform": "^3.0.5",
Expand Down
5 changes: 5 additions & 0 deletions test/annotation_layer_builder_overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
position: absolute;
}

.annotationLayer .buttonWidgetAnnotation.checkBox input,
.annotationLayer .buttonWidgetAnnotation.radioButton input {
-webkit-appearance: none;
}

.annotationLayer .linkAnnotation > a,
.annotationLayer .buttonWidgetAnnotation.pushButton > a {
opacity: 0.2;
Expand Down
3 changes: 0 additions & 3 deletions web/annotation_layer_builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@

.annotationLayer .buttonWidgetAnnotation.checkBox input,
.annotationLayer .buttonWidgetAnnotation.radioButton input {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
padding: 0;
}
Expand Down
11 changes: 0 additions & 11 deletions web/pdf_viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,8 @@
background: url('images/loading-icon.gif') center no-repeat;
}

.pdfPresentationMode:-webkit-full-screen .pdfViewer .page {
margin-bottom: 100%;
border: 0;
}

.pdfPresentationMode:-moz-full-screen .pdfViewer .page {
margin-bottom: 100%;
border: 0;
}

.pdfPresentationMode:-ms-fullscreen .pdfViewer .page {
margin-bottom: 100% !important;
border: 0;
}

.pdfPresentationMode:fullscreen .pdfViewer .page {
Expand Down
9 changes: 1 addition & 8 deletions web/text_layer_builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
position: absolute;
white-space: pre;
cursor: text;
-webkit-transform-origin: 0% 0%;
-moz-transform-origin: 0% 0%;
-o-transform-origin: 0% 0%;
-ms-transform-origin: 0% 0%;
transform-origin: 0% 0%;
}

Expand Down Expand Up @@ -61,7 +57,6 @@
}

.textLayer ::selection { background: rgb(0,0,255); }
.textLayer ::-moz-selection { background: rgb(0,0,255); }

.textLayer .endOfContent {
display: block;
Expand All @@ -72,9 +67,7 @@
bottom: 0px;
z-index: -1;
cursor: default;
-webkit-user-select: none;
-ms-user-select: none;
-moz-user-select: none;
user-select: none;
}

.textLayer .endOfContent.active {
Expand Down
Loading

0 comments on commit 1a634f9

Please sign in to comment.