Title: [230321] trunk/Tools
- Revision
- 230321
- Author
- za...@apple.com
- Date
- 2018-04-05 20:10:20 -0700 (Thu, 05 Apr 2018)
Log Message
[LayoutReloaded] Add support for right floating boxes in inline formatting context
https://bugs.webkit.org/show_bug.cgi?id=184351
Reviewed by Antti Koivisto.
* LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js:
(InlineFormattingContext.prototype._handleFloatingBox):
(InlineFormattingContext.prototype._mapFloatingVerticalPosition):
* LayoutReloaded/FormattingContext/InlineFormatting/Line.js:
(Line.prototype.addFloatingBox):
(Line):
* LayoutReloaded/test/index.html:
* LayoutReloaded/test/inline-with-right-float-simple.html: Added.
* LayoutReloaded/test/inline-with-right-floats2.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/Tools/ChangeLog (230320 => 230321)
--- trunk/Tools/ChangeLog 2018-04-06 02:38:41 UTC (rev 230320)
+++ trunk/Tools/ChangeLog 2018-04-06 03:10:20 UTC (rev 230321)
@@ -1,5 +1,22 @@
2018-04-05 Zalan Bujtas <za...@apple.com>
+ [LayoutReloaded] Add support for right floating boxes in inline formatting context
+ https://bugs.webkit.org/show_bug.cgi?id=184351
+
+ Reviewed by Antti Koivisto.
+
+ * LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js:
+ (InlineFormattingContext.prototype._handleFloatingBox):
+ (InlineFormattingContext.prototype._mapFloatingVerticalPosition):
+ * LayoutReloaded/FormattingContext/InlineFormatting/Line.js:
+ (Line.prototype.addFloatingBox):
+ (Line):
+ * LayoutReloaded/test/index.html:
+ * LayoutReloaded/test/inline-with-right-float-simple.html: Added.
+ * LayoutReloaded/test/inline-with-right-floats2.html: Added.
+
+2018-04-05 Zalan Bujtas <za...@apple.com>
+
[LayoutReloaded] Move floating box to the next line when needed
https://bugs.webkit.org/show_bug.cgi?id=184349
Modified: trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js (230320 => 230321)
--- trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js 2018-04-06 02:38:41 UTC (rev 230320)
+++ trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js 2018-04-06 03:10:20 UTC (rev 230321)
@@ -102,13 +102,13 @@
_handleFloatingBox(floatingBox) {
this._computeFloatingWidth(floatingBox);
this._computeFloatingHeight(floatingBox);
- let displayFloatingBox = this.displayBox(floatingBox);
- if (displayFloatingBox.width() > this._line().availableWidth())
+ let displayBox = this.displayBox(floatingBox);
+ if (displayBox.width() > this._line().availableWidth())
this._commitLine();
// Position this float statically first, the floating context will figure it out the final position.
- displayFloatingBox.setTopLeft(this._line().rect().topLeft());
+ displayBox.setTopLeft(this._line().rect().topLeft());
this.floatingContext().computePosition(floatingBox);
- this._line().addFloatingBox(displayFloatingBox.size());
+ this._line().addFloatingBox(displayBox, Utils.isFloatingLeft(floatingBox));
}
_commitLine() {
@@ -151,7 +151,7 @@
if (root == floatFormattingRoot)
return verticalPosition;
let rootTop = Utils.mapPosition(root.topLeft(), root, floatFormattingRoot).top();
- return rootTop += root.contentBox().top();
+ return (rootTop + root.contentBox().top() + verticalPosition);
}
_mapFloatingHorizontalPosition(horizontalPosition) {
Modified: trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/Line.js (230320 => 230321)
--- trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/Line.js 2018-04-06 02:38:41 UTC (rev 230320)
+++ trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/Line.js 2018-04-06 03:10:20 UTC (rev 230321)
@@ -55,12 +55,15 @@
this.m_lineRect.growBy(new LayoutSize(size.width(), 0));
}
- addFloatingBox(size) {
- ASSERT(size.width() <= this.m_availableWidth);
+ addFloatingBox(floatingDisplayBox, isFloatingLeft) {
+ let width = floatingDisplayBox.width();
+ ASSERT(width <= this.m_availableWidth);
// Push non-floating boxes to the right.
- this.m_availableWidth -= size.width();
+ this.m_availableWidth -= width;
+ if (!isFloatingLeft)
+ return;
for (let lineBox of this.m_lineBoxes)
- lineBox.lineBoxRect.moveHorizontally(size.width());
- this.m_lineRect.moveHorizontally(size.width());
+ lineBox.lineBoxRect.moveHorizontally(width);
+ this.m_lineRect.moveHorizontally(width);
}
}
Modified: trunk/Tools/LayoutReloaded/test/index.html (230320 => 230321)
--- trunk/Tools/LayoutReloaded/test/index.html 2018-04-06 02:38:41 UTC (rev 230320)
+++ trunk/Tools/LayoutReloaded/test/index.html 2018-04-06 03:10:20 UTC (rev 230321)
@@ -70,7 +70,9 @@
"float-is-inside-inline-formatting-context-simple.html",
"multiple-left-floats-on-line-simple.html",
"multiple-left-floats-on-line-from-parent-formatting-context.html",
- "inline-with-floats-when-they-dont-fit.html"
+ "inline-with-floats-when-they-dont-fit.html",
+ "inline-with-right-float-simple.html",
+ "inline-with-right-floats2.html"
];
let debugThis = [];
Added: trunk/Tools/LayoutReloaded/test/inline-with-right-float-simple.html (0 => 230321)
--- trunk/Tools/LayoutReloaded/test/inline-with-right-float-simple.html (rev 0)
+++ trunk/Tools/LayoutReloaded/test/inline-with-right-float-simple.html 2018-04-06 03:10:20 UTC (rev 230321)
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div style="width: 100px; height: 100px;">foobar foobar foobar<div style="float: right; width: 20px; height: 20px;"></div><<div style="float: right; width: 20px; height: 20px;"></div></div>
+</body>
+</html>
Added: trunk/Tools/LayoutReloaded/test/inline-with-right-floats2.html (0 => 230321)
--- trunk/Tools/LayoutReloaded/test/inline-with-right-floats2.html (rev 0)
+++ trunk/Tools/LayoutReloaded/test/inline-with-right-floats2.html 2018-04-06 03:10:20 UTC (rev 230321)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div style="float: right; width: 120px; height: 10px;"></div>
+<div style="float: right; width: 820px; height: 10px;"></div>
+<div style="width: 500px; height: 100px;">foobar foobar foobar<div style="float: right; width: 420px; height: 20px;"></div><div style="float: right; width: 20px; height: 20px;"></div></div>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes