https://bugs.webkit.org/show_bug.cgi?id=183731
Reviewed by Antti Koivisto.
...and use Display.Box instead.
* LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
(BlockFormattingContext.prototype._computeStaticPosition):
(BlockFormattingContext.prototype._computeOutOfFlowWidth):
(BlockFormattingContext.prototype._computeFloatingWidth):
(BlockFormattingContext.prototype._computeInFlowWidth):
(BlockFormattingContext.prototype._computeOutOfFlowHeight):
(BlockFormattingContext.prototype._computeFloatingHeight):
(BlockFormattingContext.prototype._computeInFlowHeight):
(BlockFormattingContext.prototype._computeInFlowPositionedPosition):
(BlockFormattingContext.prototype._computeOutOfFlowPosition):
* LayoutReloaded/FormattingContext/FloatingContext.js:
(FloatingContext.prototype.computePosition):
* LayoutReloaded/FormattingContext/FormattingContext.js:
(FormattingContext.prototype._toDisplayBox):
(FormattingContext.prototype._toLayoutBox):
* LayoutReloaded/Layout.js:
(layout):
* LayoutReloaded/LayoutTree/Box.js:
(Layout.Box.prototype.setTopLeft): Deleted.
(Layout.Box.prototype.setSize): Deleted.
(Layout.Box.prototype.setWidth): Deleted.
(Layout.Box.prototype.setHeight): Deleted.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229702
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-03-18 Zalan Bujtas <zalan@apple.com>
+
+ [LayoutReloaded] Remove left/right width/height setters from Layout.Box
+ https://bugs.webkit.org/show_bug.cgi?id=183731
+
+ Reviewed by Antti Koivisto.
+
+ ...and use Display.Box instead.
+
+ * LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
+ (BlockFormattingContext.prototype._computeStaticPosition):
+ (BlockFormattingContext.prototype._computeOutOfFlowWidth):
+ (BlockFormattingContext.prototype._computeFloatingWidth):
+ (BlockFormattingContext.prototype._computeInFlowWidth):
+ (BlockFormattingContext.prototype._computeOutOfFlowHeight):
+ (BlockFormattingContext.prototype._computeFloatingHeight):
+ (BlockFormattingContext.prototype._computeInFlowHeight):
+ (BlockFormattingContext.prototype._computeInFlowPositionedPosition):
+ (BlockFormattingContext.prototype._computeOutOfFlowPosition):
+ * LayoutReloaded/FormattingContext/FloatingContext.js:
+ (FloatingContext.prototype.computePosition):
+ * LayoutReloaded/FormattingContext/FormattingContext.js:
+ (FormattingContext.prototype._toDisplayBox):
+ (FormattingContext.prototype._toLayoutBox):
+ * LayoutReloaded/Layout.js:
+ (layout):
+ * LayoutReloaded/LayoutTree/Box.js:
+ (Layout.Box.prototype.setTopLeft): Deleted.
+ (Layout.Box.prototype.setSize): Deleted.
+ (Layout.Box.prototype.setWidth): Deleted.
+ (Layout.Box.prototype.setHeight): Deleted.
+
2018-03-18 Zalan Bujtas <zalan@apple.com>
[LayoutReloaded] Collect out-of-flow positioned boxes for a given formatting context.
let contentBottom = previousInFlowSibling ? previousInFlowSibling.bottomRight().top() + this.marginBottom(previousInFlowSibling) : parent.contentBox().top();
let position = new LayoutPoint(contentBottom, parent.contentBox().left());
position.moveBy(new LayoutSize(this.marginLeft(layoutBox), this.marginTop(layoutBox)));
- layoutBox.setTopLeft(position);
+ this.toDisplayBox(layoutBox).setTopLeft(position);
}
_placeInFlowPositionedChildren(container) {
else
ASSERT_NOT_REACHED();
width += Utils.computedHorizontalBorderAndPadding(layoutBox.node());
- layoutBox.setWidth(width);
+ this.toDisplayBox(layoutBox).setWidth(width);
}
_computeFloatingWidth(layoutBox) {
// FIXME: missing cases
- layoutBox.setWidth(Utils.width(layoutBox) + Utils.computedHorizontalBorderAndPadding(layoutBox.node()));
+ this.toDisplayBox(layoutBox).setWidth(Utils.width(layoutBox) + Utils.computedHorizontalBorderAndPadding(layoutBox.node()));
}
_computeInFlowWidth(layoutBox) {
if (Utils.isWidthAuto(layoutBox))
- return layoutBox.setWidth(this._horizontalConstraint(layoutBox));
- return layoutBox.setWidth(Utils.width(layoutBox) + Utils.computedHorizontalBorderAndPadding(layoutBox.node()));
+ return this.toDisplayBox(layoutBox).setWidth(this._horizontalConstraint(layoutBox));
+ return this.toDisplayBox(layoutBox).setWidth(Utils.width(layoutBox) + Utils.computedHorizontalBorderAndPadding(layoutBox.node()));
}
_computeOutOfFlowHeight(layoutBox) {
else
ASSERT_NOT_REACHED();
height += Utils.computedVerticalBorderAndPadding(layoutBox.node());
- layoutBox.setHeight(height);
+ this.toDisplayBox(layoutBox).setHeight(height);
}
_computeFloatingHeight(layoutBox) {
// FIXME: missing cases
- layoutBox.setHeight(Utils.height(layoutBox) + Utils.computedVerticalBorderAndPadding(layoutBox.node()));
+ this.toDisplayBox(layoutBox).setHeight(Utils.height(layoutBox) + Utils.computedVerticalBorderAndPadding(layoutBox.node()));
}
_computeInFlowHeight(layoutBox) {
// The element's height is the distance from its top content edge to the first applicable of the following:
// 1. the bottom edge of the last line box, if the box establishes a inline formatting context with one or more lines
- return layoutBox.setHeight(this._contentHeight(layoutBox) + Utils.computedVerticalBorderAndPadding(layoutBox.node()));
+ return this.toDisplayBox(layoutBox).setHeight(this._contentHeight(layoutBox) + Utils.computedVerticalBorderAndPadding(layoutBox.node()));
}
- return layoutBox.setHeight(Utils.height(layoutBox) + Utils.computedVerticalBorderAndPadding(layoutBox.node()));
+ return this.toDisplayBox(layoutBox).setHeight(Utils.height(layoutBox) + Utils.computedVerticalBorderAndPadding(layoutBox.node()));
}
_horizontalConstraint(layoutBox) {
relativePosition.shiftLeft(Utils.left(layoutBox));
else if (!Utils.isRightAuto(layoutBox))
relativePosition.shiftLeft(-Utils.right(layoutBox));
- layoutBox.setTopLeft(relativePosition);
+ this.toDisplayBox(layoutBox).setTopLeft(relativePosition);
}
_computeOutOfFlowPosition(layoutBox) {
left = containerSize.width() - Utils.right(layoutBox) - layoutBox.rect().width() - this.marginRight(layoutBox);
else
ASSERT_NOT_REACHED();
- layoutBox.setTopLeft(new LayoutPoint(top, left));
+ this.toDisplayBox(layoutBox).setTopLeft(new LayoutPoint(top, left));
}
_shrinkToFitWidth(layoutBox) {
computePosition(layoutBox) {
if (layoutBox.isOutOfFlowPositioned())
return;
+ let displayBox = this._formattingContext().toDisplayBox(layoutBox);
if (layoutBox.isFloatingPositioned()) {
let position = this._positionForFloating(layoutBox);
this._addFloating(layoutBox);
- return layoutBox.setTopLeft(position);
+ return displayBox.setTopLeft(position);
}
if (Utils.hasClear(layoutBox))
- return layoutBox.setTopLeft(this._positionForClear(layoutBox));
+ return displayBox.setTopLeft(this._positionForClear(layoutBox));
// Intruding floats might force this box move.
- return layoutBox.setTopLeft(this._computePositionToAvoidIntrudingFloats(layoutBox));
+ displayBox.setTopLeft(this._computePositionToAvoidIntrudingFloats(layoutBox));
}
bottom() {
layoutBox.setDisplayBox(displayBox);
}
- _toDisplayBox(layoutBox) {
+ toDisplayBox(layoutBox) {
ASSERT(layoutBox);
ASSERT(this.m_layoutToDisplay.has(layoutBox));
- return this.m_layoutToDisplay.get(layout);
+ return this.m_layoutToDisplay.get(layoutBox);
}
- _toLayoutBox(displayBox) {
+ toLayoutBox(displayBox) {
ASSERT(displayBox);
ASSERT(this.m_displayToLayout.has(displayBox));
- return this.m_displayToLayout.get(layout);
+ return this.m_displayToLayout.get(displayBox);
}
_outOfFlowDescendants() {
function layout(window, viewportSize) {
let treeBuilder = new TreeBuilder();
let initialContainingBlock = treeBuilder.createTree(window.document, window.renderTreeStructure);
- initialContainingBlock.setDisplayBox(new Display.Box());
- initialContainingBlock.setSize(viewportSize);
+ let displayBox = new Display.Box();
+ displayBox.setSize(viewportSize);
+ initialContainingBlock.setDisplayBox(displayBox);
let layoutContext = new LayoutContext(initialContainingBlock);
layoutContext.layoutFormattingContext(initialContainingBlock.establishedFormattingContext());
return this.rect().bottomRight();
}
- setTopLeft(topLeft) {
- this.displayBox().setTopLeft(topLeft);
- }
-
- setSize(size) {
- this.displayBox().setSize(size);
- }
-
- setWidth(width) {
- this.displayBox().setWidth(width);
- }
-
- setHeight(height) {
- this.displayBox().setHeight(height);
- }
-
isContainer() {
return false;
}