1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Update contents css to handle style properties, important

This commit is contained in:
Fred Chasen 2017-02-26 19:46:24 -05:00
parent f17b7c7443
commit 6f092c46e5
3 changed files with 18 additions and 18 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "epubjs", "name": "epubjs",
"version": "0.3.14", "version": "0.3.15",
"description": "Parse and Render Epubs", "description": "Parse and Render Epubs",
"main": "lib/index.js", "main": "lib/index.js",
"jsnext:main": "src/index.js", "jsnext:main": "src/index.js",
@ -73,7 +73,7 @@
"dependencies": { "dependencies": {
"event-emitter": "^0.3.4", "event-emitter": "^0.3.4",
"jszip": "^3.1.3", "jszip": "^3.1.3",
"path-webpack": "^0.0.2", "path-webpack": "^0.0.3",
"stream-browserify": "^2.0.1", "stream-browserify": "^2.0.1",
"xmldom": "^0.1.27" "xmldom": "^0.1.27"
} }

View file

@ -165,11 +165,11 @@ class Contents {
return this.window.getComputedStyle(this.documentElement)["overflowY"]; return this.window.getComputedStyle(this.documentElement)["overflowY"];
} }
css(property, value) { css(property, value, priority) {
var content = this.content || this.document.body; var content = this.content || this.document.body;
if (value) { if (value) {
content.style[property] = value; content.style.setProperty(property, value, priority ? "important" : "");
} }
return this.window.getComputedStyle(content)[property]; return this.window.getComputedStyle(content)[property];
@ -649,15 +649,15 @@ class Contents {
} }
this.css("margin", "0"); this.css("margin", "0");
this.css("boxSizing", "border-box"); this.css("box-sizing", "border-box");
} }
columns(width, height, columnWidth, gap){ columns(width, height, columnWidth, gap){
var COLUMN_AXIS = prefixed("columnAxis"); var COLUMN_AXIS = prefixed("column-axis");
var COLUMN_GAP = prefixed("columnGap"); var COLUMN_GAP = prefixed("column-gap");
var COLUMN_WIDTH = prefixed("columnWidth"); var COLUMN_WIDTH = prefixed("column-width");
var COLUMN_FILL = prefixed("columnFill"); var COLUMN_FILL = prefixed("column-fill");
this.width(width); this.width(width);
this.height(height); this.height(height);
@ -666,11 +666,11 @@ class Contents {
this.viewport({ width: width, height: height, scale: 1.0 }); this.viewport({ width: width, height: height, scale: 1.0 });
// this.overflowY("hidden"); // this.overflowY("hidden");
this.css("overflowY", "hidden"); this.css("overflow-y", "hidden");
this.css("margin", "0 !important"); this.css("margin", "0", true);
this.css("padding", "0 !important"); this.css("padding", "0", true);
this.css("boxSizing", "border-box"); this.css("box-sizing", "border-box");
this.css("maxWidth", "inherit"); this.css("max-width", "inherit");
this.css(COLUMN_AXIS, "horizontal"); this.css(COLUMN_AXIS, "horizontal");
this.css(COLUMN_FILL, "auto"); this.css(COLUMN_FILL, "auto");
@ -683,7 +683,7 @@ class Contents {
var scaleStr = "scale(" + scale + ")"; var scaleStr = "scale(" + scale + ")";
var translateStr = ""; var translateStr = "";
// this.css("position", "absolute")); // this.css("position", "absolute"));
this.css("transformOrigin", "top left"); this.css("transform-origin", "top left");
if (offsetX >= 0 || offsetY >= 0) { if (offsetX >= 0 || offsetY >= 0) {
translateStr = " translate(" + (offsetX || 0 )+ "px, " + (offsetY || 0 )+ "px )"; translateStr = " translate(" + (offsetX || 0 )+ "px, " + (offsetY || 0 )+ "px )";
@ -710,7 +710,7 @@ class Contents {
// Scale to the correct size // Scale to the correct size
this.scaler(scale, 0, offsetY); this.scaler(scale, 0, offsetY);
this.css("backgroundColor", "transparent"); this.css("background-color", "transparent");
} }
mapPage(cfiBase, start, end) { mapPage(cfiBase, start, end) {

View file

@ -34,8 +34,8 @@ export function isFloat(n) {
} }
export function prefixed(unprefixed) { export function prefixed(unprefixed) {
var vendors = ["Webkit", "Moz", "O", "ms" ]; //var vendors = ["Webkit", "Moz", "O", "ms" ];
// var prefixes = ["-Webkit-", "-moz-", "-o-", "-ms-"]; var vendors = ["-Webkit-", "-moz-", "-o-", "-ms-"];
var upper = unprefixed[0].toUpperCase() + unprefixed.slice(1); var upper = unprefixed[0].toUpperCase() + unprefixed.slice(1);
var length = vendors.length; var length = vendors.length;