https://bugs.webkit.org/show_bug.cgi?id=183761
Reviewed by Antti Koivisto.
Display.Box has them.
* LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
(BlockFormattingContext.prototype._computeOutOfFlowWidth):
(BlockFormattingContext.prototype._computeOutOfFlowHeight):
(BlockFormattingContext.prototype._horizontalConstraint):
(BlockFormattingContext.prototype._contentHeight):
(BlockFormattingContext.prototype._adjustBottomWithFIXME):
(BlockFormattingContext.prototype._computeOutOfFlowPosition):
* LayoutReloaded/FormattingContext/FloatingContext.js:
(FloatingContext.prototype._availableSpace):
* LayoutReloaded/FormattingContext/FormattingContext.js:
(FormattingContext.prototype.absoluteBorderBox):
(FormattingContext.prototype.absolutePaddingBox):
(FormattingContext.prototype.absoluteContentBox):
* LayoutReloaded/LayoutTree/Box.js:
(Layout.Box.prototype.isDescendantOf):
(Layout.Box):
(Layout.Box.prototype.borderBox): Deleted.
(Layout.Box.prototype.paddingBox): Deleted.
(Layout.Box.prototype.contentBox): Deleted.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229734
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-03-19 Zalan Bujtas <zalan@apple.com>
+
+ [LayoutReloaded] Remove border/padding/contentBox() functions from Layout.Box
+ https://bugs.webkit.org/show_bug.cgi?id=183761
+
+ Reviewed by Antti Koivisto.
+
+ Display.Box has them.
+
+ * LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
+ (BlockFormattingContext.prototype._computeOutOfFlowWidth):
+ (BlockFormattingContext.prototype._computeOutOfFlowHeight):
+ (BlockFormattingContext.prototype._horizontalConstraint):
+ (BlockFormattingContext.prototype._contentHeight):
+ (BlockFormattingContext.prototype._adjustBottomWithFIXME):
+ (BlockFormattingContext.prototype._computeOutOfFlowPosition):
+ * LayoutReloaded/FormattingContext/FloatingContext.js:
+ (FloatingContext.prototype._availableSpace):
+ * LayoutReloaded/FormattingContext/FormattingContext.js:
+ (FormattingContext.prototype.absoluteBorderBox):
+ (FormattingContext.prototype.absolutePaddingBox):
+ (FormattingContext.prototype.absoluteContentBox):
+ * LayoutReloaded/LayoutTree/Box.js:
+ (Layout.Box.prototype.isDescendantOf):
+ (Layout.Box):
+ (Layout.Box.prototype.borderBox): Deleted.
+ (Layout.Box.prototype.paddingBox): Deleted.
+ (Layout.Box.prototype.contentBox): Deleted.
+
2018-03-19 Jiewen Tan <jiewen_tan@apple.com>
Unreviewed, another quick fix for r229699
else if (Utils.isLeftAuto(layoutBox) && !Utils.isWidthAuto(layoutBox) && !Utils.isRightAuto(layoutBox))
width = Utils.width(layoutBox); // 4
else if (Utils.isWidthAuto(layoutBox) && !Utils.isLeftAuto(layoutBox) && !Utils.isRightAuto(layoutBox))
- width = Math.max(0, layoutBox.containingBlock().contentBox().width() - Utils.right(layoutBox) - Utils.left(layoutBox)); // 5
+ width = Math.max(0, this.toDisplayBox(layoutBox.containingBlock()).contentBox().width() - Utils.right(layoutBox) - Utils.left(layoutBox)); // 5
else if (Utils.isRightAuto(layoutBox) && !Utils.isLeftAuto(layoutBox) && !Utils.isWidthAuto(layoutBox))
width = Utils.width(layoutBox); // 6
else
else if (Utils.isTopAuto((layoutBox)) && !Utils.isHeightAuto((layoutBox)) && !Utils.isBottomAuto((layoutBox)))
height = Utils.height(layoutBox); // 6
else if (Utils.isHeightAuto((layoutBox)) && !Utils.isTopAuto((layoutBox)) && !Utils.isBottomAuto((layoutBox)))
- height = Math.max(0, layoutBox.containingBlock().contentBox().height() - Utils.bottom(layoutBox) - Utils.top(layoutBox)); // 7
+ height = Math.max(0, this.toDisplayBox(layoutBox.containingBlock()).contentBox().height() - Utils.bottom(layoutBox) - Utils.top(layoutBox)); // 7
else if (Utils.isBottomAuto((layoutBox)) && !Utils.isTopAuto((layoutBox)) && !Utils.isHeightAuto((layoutBox)))
height = Utils.height(layoutBox); // 8
else
}
_horizontalConstraint(layoutBox) {
- let horizontalConstraint = layoutBox.containingBlock().contentBox().width();
+ let horizontalConstraint = this.toDisplayBox(layoutBox.containingBlock()).contentBox().width();
horizontalConstraint -= this.marginLeft(layoutBox) + this.marginRight(layoutBox);
return horizontalConstraint;
}
let lastLine = lines[lines.length - 1];
return lastLine.rect().bottom();
}
- let top = layoutBox.contentBox().top();
+ let top = this.toDisplayBox(layoutBox).contentBox().top();
let bottom = this._adjustBottomWithFIXME(layoutBox);
return bottom - top;
}
let lastInFlowDisplayBox = lastInFlowChild.displayBox();
let bottom = lastInFlowDisplayBox.bottom() + this.marginBottom(lastInFlowChild);
// FIXME: margin for body
- if (lastInFlowChild.name() == "RenderBody" && Utils.isHeightAuto(lastInFlowChild) && !lastInFlowChild.contentBox().height())
+ if (lastInFlowChild.name() == "RenderBody" && Utils.isHeightAuto(lastInFlowChild) && !this.toDisplayBox(lastInFlowChild).contentBox().height())
bottom -= this.marginBottom(lastInFlowChild);
// FIXME: figure out why floatings part of the initial block formatting context get propagated to HTML
if (layoutBox.node().tagName == "HTML") {
_computeOutOfFlowPosition(layoutBox) {
let displayBox = this.toDisplayBox(layoutBox);
let top = Number.NaN;
- let containerSize = layoutBox.containingBlock().contentBox().size();
+ let containerSize = this.toDisplayBox(layoutBox.containingBlock()).contentBox().size();
// Top/bottom
if (Utils.isTopAuto(layoutBox) && Utils.isBottomAuto(layoutBox)) {
ASSERT(Utils.isStaticallyPositioned(layoutBox));
}
_availableSpace(containingBlock, floatingPair) {
+ let containingBlockContentBox = this._formattingContext().toDisplayBox(containingBlock);
if (floatingPair.left && floatingPair.right)
return this._formattingContext().absoluteMarginBox(floatingPair.right).left() - this._formattingContext().absoluteMarginBox(floatingPair.left).right();
if (floatingPair.left)
- return containingBlock.contentBox().width() - (this._formattingContext().absoluteMarginBox(floatingPair.left).right() - this._formattingContext().absoluteBorderBox(containingBlock).left());
+ return containingBlockContentBox.width() - (this._formattingContext().absoluteMarginBox(floatingPair.left).right() - this._formattingContext().absoluteBorderBox(containingBlock).left());
if (floatingPair.right)
return this._formattingContext().absoluteMarginBox(floatingPair.right).left();
- return containingBlock.contentBox().width();
+ return containingBlockContentBox.width();
}
_findFloatingAtVerticalPosition(verticalPosition, floatingStack) {
}
absoluteBorderBox(layoutBox) {
- let borderBox = layoutBox.borderBox();
+ let borderBox = this.toDisplayBox(layoutBox).borderBox();
let absoluteRect = new LayoutRect(this._toRootAbsolutePosition(layoutBox), borderBox.size());
absoluteRect.moveBy(borderBox.topLeft());
return absoluteRect;
}
absolutePaddingBox(layoutBox) {
- let paddingBox = layoutBox.paddingBox();
+ let paddingBox = this.toDisplayBox(layoutBox).paddingBox();
let absoluteRect = new LayoutRect(this._toRootAbsolutePosition(layoutBox), paddingBox.size());
absoluteRect.moveBy(paddingBox.topLeft());
return absoluteRect;
}
absoluteContentBox(layoutBox) {
- let contentBox = layoutBox.contentBox();
+ let contentBox = this.toDisplayBox(layoutBox).contentBox();
let absoluteRect = new LayoutRect(this._toRootAbsolutePosition(layoutBox), contentBox.size());
absoluteRect.moveBy(contentBox.topLeft());
return absoluteRect;
ascendant = ascendant.parent();
return !!ascendant;
}
-
- borderBox() {
- return this.displayBox().borderBox();
- }
-
- paddingBox() {
- return this.displayBox().paddingBox();
- }
-
- contentBox() {
- return this.displayBox().contentBox();
- }
}