Title: [229734] trunk/Tools
Revision
229734
Author
za...@apple.com
Date
2018-03-19 19:30:51 -0700 (Mon, 19 Mar 2018)

Log Message

[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.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (229733 => 229734)


--- trunk/Tools/ChangeLog	2018-03-20 02:27:57 UTC (rev 229733)
+++ trunk/Tools/ChangeLog	2018-03-20 02:30:51 UTC (rev 229734)
@@ -1,3 +1,32 @@
+2018-03-19  Zalan Bujtas  <za...@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_...@apple.com>
 
         Unreviewed, another quick fix for r229699

Modified: trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js (229733 => 229734)


--- trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js	2018-03-20 02:27:57 UTC (rev 229733)
+++ trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js	2018-03-20 02:30:51 UTC (rev 229734)
@@ -171,7 +171,7 @@
         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 @@
         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 @@
     }
 
     _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 @@
             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 @@
         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 @@
     _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));

Modified: trunk/Tools/LayoutReloaded/FormattingContext/FloatingContext.js (229733 => 229734)


--- trunk/Tools/LayoutReloaded/FormattingContext/FloatingContext.js	2018-03-20 02:27:57 UTC (rev 229733)
+++ trunk/Tools/LayoutReloaded/FormattingContext/FloatingContext.js	2018-03-20 02:30:51 UTC (rev 229734)
@@ -132,13 +132,14 @@
     }
 
     _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) {

Modified: trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js (229733 => 229734)


--- trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js	2018-03-20 02:27:57 UTC (rev 229733)
+++ trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js	2018-03-20 02:30:51 UTC (rev 229734)
@@ -74,7 +74,7 @@
     }
 
     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;
@@ -81,7 +81,7 @@
     }
 
     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;
@@ -88,7 +88,7 @@
     }
 
     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;

Modified: trunk/Tools/LayoutReloaded/LayoutTree/Box.js (229733 => 229734)


--- trunk/Tools/LayoutReloaded/LayoutTree/Box.js	2018-03-20 02:27:57 UTC (rev 229733)
+++ trunk/Tools/LayoutReloaded/LayoutTree/Box.js	2018-03-20 02:30:51 UTC (rev 229734)
@@ -239,16 +239,4 @@
             ascendant = ascendant.parent();
         return !!ascendant;
     }
-
-    borderBox() {
-        return this.displayBox().borderBox();
-    }
-
-    paddingBox() {
-        return this.displayBox().paddingBox();
-    }
-
-    contentBox() {
-        return this.displayBox().contentBox();
-    }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to