Skip to content
Permalink
Browse files
[LayoutReloaded] Remove border/padding/contentBox() functions from La…
…yout.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.

Canonical link: https://commits.webkit.org/199392@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229734 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Mar 20, 2018
1 parent 7b32c90 commit e801affba01a5ba58c2210152b496655af803fd8
@@ -1,3 +1,32 @@
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
@@ -171,7 +171,7 @@ class BlockFormattingContext extends FormattingContext {
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
@@ -219,7 +219,7 @@ class BlockFormattingContext extends FormattingContext {
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
@@ -246,7 +246,7 @@ class BlockFormattingContext extends FormattingContext {
}

_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;
}
@@ -270,7 +270,7 @@ class BlockFormattingContext extends FormattingContext {
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;
}
@@ -281,7 +281,7 @@ class BlockFormattingContext extends FormattingContext {
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") {
@@ -312,7 +312,7 @@ class BlockFormattingContext extends FormattingContext {
_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));
@@ -132,13 +132,14 @@ class FloatingContext {
}

_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) {
@@ -74,21 +74,21 @@ class FormattingContext {
}

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;
@@ -239,16 +239,4 @@ Layout.Box = class Box {
ascendant = ascendant.parent();
return !!ascendant;
}

borderBox() {
return this.displayBox().borderBox();
}

paddingBox() {
return this.displayBox().paddingBox();
}

contentBox() {
return this.displayBox().contentBox();
}
}

0 comments on commit e801aff

Please sign in to comment.