Skip to content

Commit

Permalink
Do not generate a page-margin box when the computed value of 'content…
Browse files Browse the repository at this point in the history
…' property is 'none'
  • Loading branch information
kwkbtr committed Jul 30, 2015
1 parent 281da97 commit 306d307
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/adapt/ops.js
Expand Up @@ -475,13 +475,13 @@ adapt.ops.StyleInstance.prototype.layoutContainer = function(page, boxInstance,
var cont;
if (!flowName || !flowName.isIdent()) {
var contentVal = boxInstance.getProp(self, "content");
if (contentVal) {
if (adapt.vtree.nonTrivialContent(contentVal)) {
contentVal.visit(new adapt.vtree.ContentPropertyHandler(boxContainer, self));
boxInstance.transferContentProps(self, layoutContainer, page);
}
}
boxInstance.finishContainer(self, layoutContainer, page, null, 1, self.clientLayout);
if (contentVal && adapt.vtree.nonTrivialContent(contentVal)) {
contentVal.visit(new adapt.vtree.ContentPropertyHandler(boxContainer, self));
boxInstance.transferContentProps(self, layoutContainer, page);
boxInstance.finishContainer(self, layoutContainer, page, null, 1, self.clientLayout);
} else if (boxInstance.suppressEmptyBoxGeneration) {
parentContainer.removeChild(boxContainer);
}
cont = adapt.task.newResult(true);
} else if (!self.pageBreaks[flowName.toString()]) {
/** @type {!adapt.task.Frame.<boolean>} */ var innerFrame = adapt.task.newFrame("layoutContainer.inner");
Expand Down
1 change: 1 addition & 0 deletions src/adapt/pm.js
Expand Up @@ -413,6 +413,7 @@ adapt.pm.PageBoxInstance = function(parentInstance, pageBox) {
/** @type {Object.<string,adapt.expr.Val>} */ this.namedValues = {};
/** @type {Object.<string,adapt.expr.Val>} */ this.namedFuncs = {};
/** @type {boolean} */ this.vertical = false;
/** @type {boolean} */ this.suppressEmptyBoxGeneration = false;
if (parentInstance) {
parentInstance.children.push(this);
}
Expand Down
1 change: 1 addition & 0 deletions src/vivliostyle/page.js
Expand Up @@ -731,6 +731,7 @@ vivliostyle.page.PageRulePartitionInstance.prototype.resolvePageBoxDimensions =
*/
vivliostyle.page.PageMarginBoxPartitionInstance = function(parentInstance, pageMarginBoxPartition) {
adapt.pm.PartitionInstance.call(this, parentInstance, pageMarginBoxPartition);
this.suppressEmptyBoxGeneration = true;
};
goog.inherits(vivliostyle.page.PageMarginBoxPartitionInstance, adapt.pm.PartitionInstance);

Expand Down

0 comments on commit 306d307

Please sign in to comment.