diff --git a/bower.json b/bower.json index c5d7873ce..354df51bd 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.6.254", + "version": "1.6.256", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index 8d19cacc2..0189c50e4 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -24,8 +24,8 @@ }(this, function (exports) { // Use strict in our context only - users might not want it 'use strict'; - var pdfjsVersion = '1.6.254'; - var pdfjsBuild = '273d2de'; + var pdfjsVersion = '1.6.256'; + var pdfjsBuild = '1783f14'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null; var pdfjsLibs = {}; (function pdfjsWrapper() { @@ -24884,8 +24884,8 @@ this.dashPhase = 0; this.dependencies = []; // Clipping - this.clipId = ''; - this.pendingClip = false; + this.activeClipUrl = null; + this.clipGroup = null; this.maskId = ''; } SVGExtraState.prototype = { @@ -25465,24 +25465,29 @@ clip: function SVGGraphics_clip(type) { var current = this.current; // Add current path to clipping path - current.clipId = 'clippath' + clipCount; + var clipId = 'clippath' + clipCount; clipCount++; - this.clippath = document.createElementNS(NS, 'svg:clipPath'); - this.clippath.setAttributeNS(null, 'id', current.clipId); + var clipPath = document.createElementNS(NS, 'svg:clipPath'); + clipPath.setAttributeNS(null, 'id', clipId); + clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); var clipElement = current.element.cloneNode(); if (type === 'evenodd') { clipElement.setAttributeNS(null, 'clip-rule', 'evenodd'); } else { clipElement.setAttributeNS(null, 'clip-rule', 'nonzero'); } - this.clippath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - this.clippath.appendChild(clipElement); - this.defs.appendChild(this.clippath); - // Create a clipping group that references the clipping path. - current.pendingClip = true; - this.cgrp = document.createElementNS(NS, 'svg:g'); - this.cgrp.setAttributeNS(null, 'clip-path', 'url(#' + current.clipId + ')'); - this.svg.appendChild(this.cgrp); + clipPath.appendChild(clipElement); + this.defs.appendChild(clipPath); + if (current.activeClipUrl) { + // The previous clipping group content can go out of order -- resetting + // cached clipGroup's. + current.clipGroup = null; + this.extraStack.forEach(function (prev) { + prev.clipGroup = null; + }); + } + current.activeClipUrl = 'url(#' + clipId + ')'; + this.tgrp = null; }, closePath: function SVGGraphics_closePath() { var current = this.current; @@ -25677,6 +25682,18 @@ this.svg = rootGroup; return svg; }, + /** + * @private + */ + _ensureClipGroup: function SVGGraphics_ensureClipGroup() { + if (!this.current.clipGroup) { + var clipGroup = document.createElementNS(NS, 'svg:g'); + clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl); + this.svg.appendChild(clipGroup); + this.current.clipGroup = clipGroup; + } + return this.current.clipGroup; + }, /** * @private */ @@ -25684,8 +25701,8 @@ if (!this.tgrp) { this.tgrp = document.createElementNS(NS, 'svg:g'); this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - if (this.current.pendingClip) { - this.cgrp.appendChild(this.tgrp); + if (this.current.activeClipUrl) { + this._ensureClipGroup().appendChild(this.tgrp); } else { this.svg.appendChild(this.tgrp); } diff --git a/build/pdf.js b/build/pdf.js index 04f354ae3..f7d2d8da3 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -24,8 +24,8 @@ }(this, function (exports) { // Use strict in our context only - users might not want it 'use strict'; - var pdfjsVersion = '1.6.254'; - var pdfjsBuild = '273d2de'; + var pdfjsVersion = '1.6.256'; + var pdfjsBuild = '1783f14'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null; var pdfjsLibs = {}; (function pdfjsWrapper() { @@ -3279,8 +3279,8 @@ this.dashPhase = 0; this.dependencies = []; // Clipping - this.clipId = ''; - this.pendingClip = false; + this.activeClipUrl = null; + this.clipGroup = null; this.maskId = ''; } SVGExtraState.prototype = { @@ -3860,24 +3860,29 @@ clip: function SVGGraphics_clip(type) { var current = this.current; // Add current path to clipping path - current.clipId = 'clippath' + clipCount; + var clipId = 'clippath' + clipCount; clipCount++; - this.clippath = document.createElementNS(NS, 'svg:clipPath'); - this.clippath.setAttributeNS(null, 'id', current.clipId); + var clipPath = document.createElementNS(NS, 'svg:clipPath'); + clipPath.setAttributeNS(null, 'id', clipId); + clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); var clipElement = current.element.cloneNode(); if (type === 'evenodd') { clipElement.setAttributeNS(null, 'clip-rule', 'evenodd'); } else { clipElement.setAttributeNS(null, 'clip-rule', 'nonzero'); } - this.clippath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - this.clippath.appendChild(clipElement); - this.defs.appendChild(this.clippath); - // Create a clipping group that references the clipping path. - current.pendingClip = true; - this.cgrp = document.createElementNS(NS, 'svg:g'); - this.cgrp.setAttributeNS(null, 'clip-path', 'url(#' + current.clipId + ')'); - this.svg.appendChild(this.cgrp); + clipPath.appendChild(clipElement); + this.defs.appendChild(clipPath); + if (current.activeClipUrl) { + // The previous clipping group content can go out of order -- resetting + // cached clipGroup's. + current.clipGroup = null; + this.extraStack.forEach(function (prev) { + prev.clipGroup = null; + }); + } + current.activeClipUrl = 'url(#' + clipId + ')'; + this.tgrp = null; }, closePath: function SVGGraphics_closePath() { var current = this.current; @@ -4072,6 +4077,18 @@ this.svg = rootGroup; return svg; }, + /** + * @private + */ + _ensureClipGroup: function SVGGraphics_ensureClipGroup() { + if (!this.current.clipGroup) { + var clipGroup = document.createElementNS(NS, 'svg:g'); + clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl); + this.svg.appendChild(clipGroup); + this.current.clipGroup = clipGroup; + } + return this.current.clipGroup; + }, /** * @private */ @@ -4079,8 +4096,8 @@ if (!this.tgrp) { this.tgrp = document.createElementNS(NS, 'svg:g'); this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - if (this.current.pendingClip) { - this.cgrp.appendChild(this.tgrp); + if (this.current.activeClipUrl) { + this._ensureClipGroup().appendChild(this.tgrp); } else { this.svg.appendChild(this.tgrp); } diff --git a/build/pdf.worker.js b/build/pdf.worker.js index 4ae2a9454..0531c79fe 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -24,8 +24,8 @@ }(this, function (exports) { // Use strict in our context only - users might not want it 'use strict'; - var pdfjsVersion = '1.6.254'; - var pdfjsBuild = '273d2de'; + var pdfjsVersion = '1.6.256'; + var pdfjsBuild = '1783f14'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null; var pdfjsLibs = {}; (function pdfjsWrapper() { diff --git a/package.json b/package.json index e19d134c5..7e1aba5d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.6.254", + "version": "1.6.256", "main": "build/pdf.js", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [